Commit 10757e30 authored by Konstantin Narkhov's avatar Konstantin Narkhov
Browse files

Version 0.9.0

This is initial commit of Perl6-driven CMS Pheix.
A journey of a thousand miles begins with a single step. Ok, here we go!
parents
The MIT License
Copyright (c) 2018 Konstantin G Narkhov. https://perl6.pheix.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Pheix CMS implemented in Perl 6.c
## Overview
**Pheix CMS** is a MIT-licence compliant, Perl 6.c driven Content Management System. It is extremely lightweight, simple and customizable.
## Important
[Official Pheix Site](https://perl6.pheix.org)
[Changelog](https://perl6.pheix.org/changelog.txt)
[MIT License](https://opensource.org/licenses/MIT)
## Contact
Please contact us via [feedback form](https://pheix.org/feedback.html) at pheix.org
AddHandler cgi-script .pl6
# Options ExecCGI SymLinksIfOwnerMatch Includes MultiViews
DirectoryIndex user.pl6
RewriteEngine on
RewriteRule ^$ user.pl6
RewriteRule ^index.htm$ user.pl6
RewriteRule ^([a-z/-]+).html$ user.pl6?action=$1
RewriteRule ^([a-z/-]+)_([a-z0-9]+).html$ user.pl6?action=$1&id=$2
RewriteRule ^([a-z/-]+)_([a-z0-9]+)_([a-z0-9]+).html$ user.pl6?action=$1&id1=$2&id2=$3
RewriteRule ^rss.xml$ user.pl6?action=getnewsrss
ErrorDocument 404 /user.pl6?action=404error
template.html
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<base href="/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>PERL 6.c: Racudo + Apache + MoarVM</title>
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link href="css/pheix.css?ts=%tmpl_timestamp%" rel="stylesheet">
</head>
<body>
<div class="_phx-cntr">
<h1>PERL 6.c</h1>
<p><a href="https://docs.perl6.org/" target="_blank"><img class="pheix-camelia" src="images/perl6-camelia.svg" alt="Camelia"></a></p>
<h2>It works!!!</h2>
<h3>%tmpl_hdr3%</h3>
<p class="pheix-descr-text">Update full date: %tmpl_update_full%, update year: %tmpl_update_year%.</p>
</div>
<div class="pheix-quote">%tmpl_env_vars%</div>
</body>
</html>
body { font-family: Ubuntu; }
._phx-cntr { text-align:center; }
._phx-ccc { color:#ccc; }
._phx-fnt10 { font-size:10pt; }
.pheix-descr-text { color:#c0c0c0; font-size:10pt; }
.pheix-quote { background-color:#f5f5f5; white-space:nowrap; font-size:12pt; overflow-x:auto; }
.pheix-camelia { width:350px; border:none; }
@media(max-width:400px){
.pheix-camelia { width:95%; }
}
File added
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="948" height="693" viewBox="22 40 948 693"><defs><clipPath id="clipPath17"><path d="M 0,-0.1 L 792.1,-0.1 L 792.1,612 L 0,612 L 0,-0.1 z" id="path19"/></clipPath></defs><g transform="matrix(1.25,0,0,-1.25,0,765)" id="g11"><g id="g13"><g clip-path="url(#clipPath17)" id="g15"><path d="M 304.2,75.7 C 248.8,35.1 174.7,42.1 138.6,91.4 C 102.6,140.6 118.3,213.4 173.7,253.9 C 229,294.5 303.2,287.5 339.2,238.3 C 375.3,189 359.6,116.2 304.2,75.7 z" id="path21" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g23"><path d="M 304.2,75.7 C 248.8,35.1 174.7,42.1 138.6,91.4 C 102.6,140.6 118.3,213.4 173.7,253.9 C 229,294.5 303.2,287.5 339.2,238.3 C 375.3,189 359.6,116.2 304.2,75.7 z" id="path25" style="fill:none;stroke:#000000;stroke-width:4.30158997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 273.6,523.5 C 342.5,473.1 362,382.6 317.1,321.4 C 272.3,260.2 180.1,251.5 111.3,301.9 C 42.4,352.3 22.9,442.9 67.7,504.1 C 112.6,565.3 204.7,574 273.6,523.5 z" id="path27" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g29"><path d="M 273.6,523.5 C 342.5,473.1 362,382.6 317.1,321.4 C 272.3,260.2 180.1,251.5 111.3,301.9 C 42.4,352.3 22.9,442.9 67.7,504.1 C 112.6,565.3 204.7,574 273.6,523.5 z" id="path31" style="fill:none;stroke:#000000;stroke-width:7.1882;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 213.3,370.5 C 187.5,391.7 186,432.7 210,461.9 C 234.1,491.2 274.5,497.8 300.3,476.5 C 326.2,455.3 327.7,414.4 303.6,385.1 C 279.6,355.8 239.2,349.3 213.3,370.5 z" id="path33" style="fill:#00ff00;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g35"><path d="M 213.3,370.5 C 187.5,391.7 186,432.7 210,461.9 C 234.1,491.2 274.5,497.8 300.3,476.5 C 326.2,455.3 327.7,414.4 303.6,385.1 C 279.6,355.8 239.2,349.3 213.3,370.5 z" id="path37" style="fill:none;stroke:none"/></g><path d="M 191.7,375.8 C 165.8,397.1 164.3,438 188.3,467.3 C 212.4,496.6 252.9,503.1 278.7,481.9 C 304.6,460.7 306.1,419.7 282,390.4 C 258,361.1 217.5,354.6 191.7,375.8 z" id="path39" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g41"><path d="M 191.7,375.8 C 165.8,397.1 164.3,438 188.3,467.3 C 212.4,496.6 252.9,503.1 278.7,481.9 C 304.6,460.7 306.1,419.7 282,390.4 C 258,361.1 217.5,354.6 191.7,375.8 z" id="path43" style="fill:none;stroke:none"/></g><g id="g45"><path d="M 245.6,311.6 C 204,339.3 146.5,360.8 121.8,397.8 C 103.4,425.3 82.5,436.1 104.5,463.3 C 125.5,489 137.2,516.6 166.4,521.2 C 199.2,516.8 224.7,513.9 245.7,477.4 C 243.3,456 250.5,410.8 222.7,389.3 L 174.6,362.6" id="path47" style="fill:none;stroke:#0000ff;stroke-width:21.56459045;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 175,400.5 C 151.2,400.5 131.9,419.4 131.9,442.8 C 131.9,466.2 151.2,485.1 175,485.1 C 198.8,485.1 218.1,466.2 218.1,442.8 C 218.1,419.4 198.8,400.5 175,400.5 z" id="path49" style="fill:#ff3366;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g51"><path d="M 175,400.5 C 151.2,400.5 131.9,419.4 131.9,442.8 C 131.9,466.2 151.2,485.1 175,485.1 C 198.8,485.1 218.1,466.2 218.1,442.8 C 218.1,419.4 198.8,400.5 175,400.5 z" id="path53" style="fill:none;stroke:none"/></g><path d="M 194.2,418.9 C 185.3,411.6 172,413 164.5,422.1 C 157,431.2 158.2,444.5 167.2,451.8 C 176.1,459.1 189.4,457.7 196.8,448.6 C 204.3,439.5 203.1,426.2 194.2,418.9 z" id="path55" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g57"><path d="M 194.2,418.9 C 185.3,411.6 172,413 164.5,422.1 C 157,431.2 158.2,444.5 167.2,451.8 C 176.1,459.1 189.4,457.7 196.8,448.6 C 204.3,439.5 203.1,426.2 194.2,418.9 z" id="path59" style="fill:none;stroke:none"/></g><g id="g61"><path d="M 249.3,308.8 C 207.6,336.6 144.6,336.6 119.9,373.5 C 101.5,401.1 69.6,436.6 91.6,463.7 C 111.7,495.6 137.2,517.5 169.1,517.5 C 202,513.2 235.8,500.5 243.8,474.7 C 241.5,453.2 245.9,419.3 218.1,397.8 L 172.8,361.7" id="path63" style="fill:none;stroke:#0000ff;stroke-width:21.56459045;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 268,298 C 265.1,292.9 252.7,294.6 240.4,301.7 C 228,308.8 220.4,318.7 223.3,323.8 C 226.3,328.8 238.6,327.2 251,320.1 C 263.3,312.9 271,303.1 268,298 z" id="path65" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g67"><path d="M 268,298 C 265.1,292.9 252.7,294.6 240.4,301.7 C 228,308.8 220.4,318.7 223.3,323.8 C 226.3,328.8 238.6,327.2 251,320.1 C 263.3,312.9 271,303.1 268,298 z" id="path69" style="fill:none;stroke:none"/></g><path d="M 629.1,253 C 684.4,212.5 700.1,139.6 664,90.4 C 627.9,41.1 553.8,34.1 498.4,74.6 C 443.1,115.2 427.4,188 463.5,237.2 C 499.6,286.5 573.7,293.6 629.1,253 z" id="path71" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g73"><path d="M 629.1,253 C 684.4,212.5 700.1,139.6 664,90.4 C 627.9,41.1 553.8,34.1 498.4,74.6 C 443.1,115.2 427.4,188 463.5,237.2 C 499.6,286.5 573.7,293.6 629.1,253 z" id="path75" style="fill:none;stroke:#000000;stroke-width:4.30158997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 399.5,162 C 335.5,162 283.7,203.4 283.7,254.6 C 283.7,305.7 335.5,347.2 399.5,347.2 C 463.5,347.2 515.3,305.7 515.3,254.6 C 515.3,203.4 463.5,162 399.5,162 z" id="path77" style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g79"><path d="M 399.5,162 C 335.5,162 283.7,203.4 283.7,254.6 C 283.7,305.7 335.5,347.2 399.5,347.2 C 463.5,347.2 515.3,305.7 515.3,254.6 C 515.3,203.4 463.5,162 399.5,162 z" id="path81" style="fill:none;stroke:#000000;stroke-width:8.63150024;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 320.1,255.7 C 294.5,255.7 273.8,276.5 273.8,302 C 273.8,327.6 294.5,348.3 320.1,348.3 C 345.7,348.3 366.5,327.6 366.5,302 C 366.5,276.5 345.7,255.7 320.1,255.7 z" id="path83" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g85"><path d="M 320.1,255.7 C 294.5,255.7 273.8,276.5 273.8,302 C 273.8,327.6 294.5,348.3 320.1,348.3 C 345.7,348.3 366.5,327.6 366.5,302 C 366.5,276.5 345.7,255.7 320.1,255.7 z" id="path87" style="fill:none;stroke:#000000;stroke-width:10.07479;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 683.4,296.3 C 615,246.2 523.4,254.9 478.9,315.7 C 434.3,376.5 453.7,466.4 522.1,516.6 C 590.5,566.7 682.1,558 726.6,497.2 C 771.2,436.3 751.8,346.4 683.4,296.3 z" id="path89" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g91"><path d="M 683.4,296.3 C 615,246.2 523.4,254.9 478.9,315.7 C 434.3,376.5 453.7,466.4 522.1,516.6 C 590.5,566.7 682.1,558 726.6,497.2 C 771.2,436.3 751.8,346.4 683.4,296.3 z" id="path93" style="fill:none;stroke:#000000;stroke-width:7.1882;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 698.5,335.2 C 672.8,314.1 632.6,320.7 608.7,349.8 C 584.8,378.9 586.2,419.6 611.9,440.7 C 637.6,461.8 677.8,455.3 701.7,426.1 C 725.6,397 724.2,356.3 698.5,335.2 z" id="path95" style="fill:#00ff00;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g97"><path d="M 698.5,335.2 C 672.8,314.1 632.6,320.7 608.7,349.8 C 584.8,378.9 586.2,419.6 611.9,440.7 C 637.6,461.8 677.8,455.3 701.7,426.1 C 725.6,397 724.2,356.3 698.5,335.2 z" id="path99" style="fill:none;stroke:none"/></g><path d="M 677.1,335.2 C 651.4,314.1 611.2,320.7 587.3,349.8 C 563.4,378.9 564.8,419.6 590.5,440.6 C 616.2,461.7 656.4,455.2 680.3,426.1 C 704.2,397 702.7,356.3 677.1,335.2 z" id="path101" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g103"><path d="M 677.1,335.2 C 651.4,314.1 611.2,320.7 587.3,349.8 C 563.4,378.9 564.8,419.6 590.5,440.6 C 616.2,461.7 656.4,455.2 680.3,426.1 C 704.2,397 702.7,356.3 677.1,335.2 z" id="path105" style="fill:none;stroke:none"/></g><g id="g107"><path d="M 705.7,464.7 C 687.7,522.8 607.2,502.9 577.2,482.8 C 535.8,455.2 541,460.7 516.5,424 C 498.2,396.5 508.1,360.4 530,333.4 C 550.7,307.8 559,319.6 591.6,323.9 C 624.2,328.2 633.1,329.3 641,354.9 C 650.9,387 618.9,420.2 591.3,441.5 L 560.2,463" id="path109" style="fill:none;stroke:#0000ff;stroke-width:21.56459045;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 569.2,345.3 C 548.2,345.3 531.3,362.5 531.3,383.8 C 531.3,405.1 548.2,422.3 569.2,422.3 C 590.1,422.3 607,405.1 607,383.8 C 607,362.5 590.1,345.3 569.2,345.3 z" id="path111" style="fill:#ff3366;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g113"><path d="M 569.2,345.3 C 548.2,345.3 531.3,362.5 531.3,383.8 C 531.3,405.1 548.2,422.3 569.2,422.3 C 590.1,422.3 607,405.1 607,383.8 C 607,362.5 590.1,345.3 569.2,345.3 z" id="path115" style="fill:none;stroke:none"/></g><path d="M 582.5,361.7 C 573.6,354.5 560.4,355.9 553,365 C 545.6,374 546.7,387.3 555.5,394.5 C 564.3,401.8 577.6,400.3 585,391.3 C 592.4,382.2 591.3,369 582.5,361.7 z" id="path117" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g119"><path d="M 582.5,361.7 C 573.6,354.5 560.4,355.9 553,365 C 545.6,374 546.7,387.3 555.5,394.5 C 564.3,401.8 577.6,400.3 585,391.3 C 592.4,382.2 591.3,369 582.5,361.7 z" id="path121" style="fill:none;stroke:none"/></g><g id="g123"><path d="M 711.2,466.5 C 693.2,524.6 594.5,513.8 564.5,493.7 C 523.1,466.1 529.2,471.5 504.7,434.8 C 486.4,407.4 502.7,357.9 524.6,330.9 C 545.3,305.3 560.4,311.1 592.9,315.4 C 625.5,319.7 636.9,318.9 644.9,344.6 C 654.8,376.6 648.9,416.1 621.2,437.5 L 560.2,463" id="path125" style="fill:none;stroke:#0000ff;stroke-width:21.56459045;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 473.4,255.7 C 447.8,255.7 427,276.5 427,302 C 427,327.6 447.8,348.3 473.4,348.3 C 499,348.3 519.7,327.6 519.7,302 C 519.7,276.5 499,255.7 473.4,255.7 z" id="path127" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g129"><path d="M 473.4,255.7 C 447.8,255.7 427,276.5 427,302 C 427,327.6 447.8,348.3 473.4,348.3 C 499,348.3 519.7,327.6 519.7,302 C 519.7,276.5 499,255.7 473.4,255.7 z" id="path131" style="fill:none;stroke:#000000;stroke-width:10.07479;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 321.5,279 C 308.7,279 298.3,289.4 298.3,302.2 C 298.3,315 308.7,325.4 321.5,325.4 C 334.3,325.4 344.6,315 344.6,302.2 C 344.6,289.4 334.3,279 321.5,279 z" id="path133" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g135"><path d="M 321.5,279 C 308.7,279 298.3,289.4 298.3,302.2 C 298.3,315 308.7,325.4 321.5,325.4 C 334.3,325.4 344.6,315 344.6,302.2 C 344.6,289.4 334.3,279 321.5,279 z" id="path137" style="fill:none;stroke:none"/></g><path d="M 475.1,281.6 C 462.2,281.6 451.9,292 451.9,304.7 C 451.9,317.5 462.2,327.8 475.1,327.8 C 487.9,327.8 498.2,317.5 498.2,304.7 C 498.2,292 487.9,281.6 475.1,281.6 z" id="path139" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g141"><path d="M 475.1,281.6 C 462.2,281.6 451.9,292 451.9,304.7 C 451.9,317.5 462.2,327.8 475.1,327.8 C 487.9,327.8 498.2,317.5 498.2,304.7 C 498.2,292 487.9,281.6 475.1,281.6 z" id="path143" style="fill:none;stroke:none"/></g><g id="g145"><path d="M 360,230 C 355.4,198.3 447.5,175.4 436.4,224.6 L 436.4,227.3" id="path147" style="fill:none;stroke:#ff3366;stroke-width:12.93309021;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g149"><path d="M 385.1,348 C 383.2,373.2 392.4,401.8 380.9,425.1 L 371.2,448.2 L 358.6,427 L 368.3,425.1" id="path151" style="fill:none;stroke:#000000;stroke-width:10.07479;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g153"><path d="M 413.3,348 C 415.2,373.2 405.9,401.8 417.4,425.1 L 427.1,448.2 L 439.7,427 L 430,425.1" id="path155" style="fill:none;stroke:#000000;stroke-width:10.07479;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 181.1,99.3 C 154.5,121.2 153.6,164.1 179.1,195.3 C 204.7,226.4 247,233.9 273.7,212 C 300.3,190.1 301.2,147.2 275.6,116.1 C 250.1,84.9 207.8,77.4 181.1,99.3 z" id="path157" style="fill:#ff3366;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g159"><path d="M 181.1,99.3 C 154.5,121.2 153.6,164.1 179.1,195.3 C 204.7,226.4 247,233.9 273.7,212 C 300.3,190.1 301.2,147.2 275.6,116.1 C 250.1,84.9 207.8,77.4 181.1,99.3 z" id="path161" style="fill:none;stroke:none"/></g><g id="g163"><path d="M 375.5,161 L 375.5,131.1 L 391.9,103.9 L 391.9,103.9" id="path165" style="fill:none;stroke:#000000;stroke-width:8.63150024;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g167"><path d="M 412,161 L 412,131 L 428.4,103.8 L 428.4,103.8" id="path169" style="fill:none;stroke:#000000;stroke-width:8.63150024;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"/></g><path d="M 212.3,134.8 C 200.3,144.6 202.2,166.8 216.6,184.3 C 231,201.9 252.3,208.1 264.4,198.2 C 276.3,188.4 274.4,166.2 260.1,148.6 C 245.7,131.1 224.3,124.9 212.3,134.8 z" id="path171" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g173"><path d="M 212.3,134.8 C 200.3,144.6 202.2,166.8 216.6,184.3 C 231,201.9 252.3,208.1 264.4,198.2 C 276.3,188.4 274.4,166.2 260.1,148.6 C 245.7,131.1 224.3,124.9 212.3,134.8 z" id="path175" style="fill:none;stroke:none"/></g><path d="M 616.6,99.2 C 589.9,77.3 547.6,84.8 522,116 C 496.5,147.1 497.4,190.1 524,211.9 C 550.7,233.8 593,226.3 618.6,195.2 C 644.1,164 643.2,121.1 616.6,99.2 z" id="path177" style="fill:#ff3366;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g179"><path d="M 616.6,99.2 C 589.9,77.3 547.6,84.8 522,116 C 496.5,147.1 497.4,190.1 524,211.9 C 550.7,233.8 593,226.3 618.6,195.2 C 644.1,164 643.2,121.1 616.6,99.2 z" id="path181" style="fill:none;stroke:none"/></g><path d="M 581.8,132 C 569.8,122.2 548.4,128.4 534.1,145.8 C 519.7,163.3 517.8,185.5 529.9,195.3 C 541.8,205.2 563.2,199 577.6,181.5 C 591.9,164.1 593.8,141.9 581.8,132 z" id="path183" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g185"><path d="M 581.8,132 C 569.8,122.2 548.4,128.4 534.1,145.8 C 519.7,163.3 517.8,185.5 529.9,195.3 C 541.8,205.2 563.2,199 577.6,181.5 C 591.9,164.1 593.8,141.9 581.8,132 z" id="path187" style="fill:none;stroke:none"/></g><g id="g189"><text transform="matrix(1,0,0,-1,658.4,245.8)" id="text191"><tspan x="0 9.6960001" y="0" id="tspan193" style="font-size:16px;font-variant:normal;writing-mode:lr-tb;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:NimbusSanL;-inkscape-font-specification:NimbusSanL-Regu">TM</tspan></text>
</g><path d="M 722.4,447.3 C 716.3,443.1 703.1,451.6 692.8,466.4 C 682.4,481.1 679,496.5 685,500.7 C 691,504.9 704.3,496.4 714.6,481.6 C 724.9,466.9 728.4,451.5 722.4,447.3 z" id="path195" style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none"/><g id="g197"><path d="M 722.4,447.3 C 716.3,443.1 703.1,451.6 692.8,466.4 C 682.4,481.1 679,496.5 685,500.7 C 691,504.9 704.3,496.4 714.6,481.6 C 724.9,466.9 728.4,451.5 722.4,447.3 z" id="path199" style="fill:none;stroke:none"/></g></g></g></g></svg>
\ No newline at end of file
use v6;
use November::URI;
class November::CGI {
has %.params;
has %.cookie;
has @.keywords;
has November::URI $.uri;
has $!crlf = "\x[0D]\x[0A]";
submethod BUILD() {
# RAKUDO #66792, Attribute defaults don't get instantiated when BUILD
# method exists.
$!crlf = "\x[0D]\x[0A]";
self.parse_params(%*ENV<QUERY_STRING> // '');
# It's prudent to handle CONTENT_LENGTH too, but right now that's not
# a priority. It would make our tests scripts more complicated, with
# little gains. It would look like this:
# if %*ENV<REQUEST_METHOD> eq 'POST' && %*ENV{CONTENT_LENGTH} > 0 {
if (%*ENV<REQUEST_METHOD> // '') eq 'POST' {
my $input;
if %*ENV<MODPERL6> {
my $r = Apache::RequestRec.new();
my $len = $r.read($input, %*ENV<CONTENT_LENGTH>);
}
else {
# Maybe check content_length here and only take that many bytes?
$input = $*IN.slurp;
}
self.parse_params($input);
}
self.eat_cookie( %*ENV<HTTP_COOKIE> ) if %*ENV<HTTP_COOKIE>;
my $uri_str = 'http://' ~ (%*ENV<SERVER_NAME> // '');
$uri_str ~= ':' ~ %*ENV<SERVER_PORT> if %*ENV<SERVER_PORT>;
$uri_str ~= (%*ENV<MODPERL6> ?? %*ENV<PATH_INFO> !! %*ENV<REQUEST_URI>) // '';
$!uri = November::URI.new( uri => $uri_str );
}
# For debugging
method save_params() {
my $debug = open('/tmp/debug.out', :w);
for $.param.kv -> $k, $v {
$debug.say("$k => $v");
}
$debug.close;
}
# From `perldoc perlop`:
#
# All systems use the virtual "\n" to represent a line terminator, called
# a "newline". There is no such thing as an unvarying, physical newline
# character. It is only an illusion that the operating system, device
# drivers, C libraries, and Perl all conspire to preserve. Not all
# systems read "\r" as ASCII CR and "\n" as ASCII LF. For example, on a
# Mac, these are reversed, and on systems without line terminator,
# printing "\n" may emit no actual data. In general, use "\n" when you
# mean a "newline" for your system, but use the literal ASCII when you
# need an exact character. For example, most networking protocols expect
# and prefer a CR+LF ("\015\012" or "\cM\cJ") for line terminators, and
# although they often accept just "\012", they seldom tolerate just
# "\015". If you get in the habit of using "\n" for networking, you may
# be burned some day.
method send_response($contents, %opts?) {
# The header
print "Content-Type: text/html; charset=utf-8$!crlf";
if %opts && %opts<cookie> {
print "Set-Cookie: {%opts<cookie>}; path=/;$!crlf";
}
print "$!crlf";
print $contents;
}
method redirect($uri, %opts?) {
my $status = '302 Moved' || %opts<status>;
print "Status: $status$!crlf";
print "Location: $uri";
print "$!crlf$!crlf";
}
method parse_params($string) {
if $string ~~ / '&' | ';' | '=' / {
my @param_values = $string.split(/ '&' | ';' /);
for @param_values -> $param_value {
my @kvs = $param_value.split("=");
self.add_param( @kvs[0], unescape(@kvs[1]) );
}
}
else {
self.parse_keywords($string);
}
}
method parse_keywords (Str $string is copy) {
my $kws = unescape($string);
@!keywords = $kws.split(/ \s+ /);
}
method eat_cookie(Str $http_cookie) {
# RAKODO: split(/ ; ' '? /) produce [""] on "", perl #60228 should cure that
my @param_values = $http_cookie.split('; ');
for @param_values -> $param_value {
my @kvs = $param_value.split('=');
%!cookie{ @kvs[0] } = unescape( @kvs[1] );
}
}
our sub unescape($string is copy) {
$string .= subst('+', ' ', :g);
# RAKUDO: This could also be rewritten as a single .subst :g call.
# ...when the semantics of .subst is revised to change $/,
# that is.
# The percent_hack can be removed once the bug is fixed and :g is
# added
while $string ~~ / ( [ '%' <[0..9A..F]>**2 ]+ ) / {
$string .= subst( ~$0,
percent_hack_start( decode_urlencoded_utf8( ~$0 ) ) );
}
return percent_hack_end( $string );
}
sub percent_hack_start($str is copy) {
if $str ~~ '%' {
$str = '___PERCENT_HACK___';
}
return $str;
}
sub percent_hack_end($str) {
return $str.subst('___PERCENT_HACK___', '%', :g);
}
sub decode_urlencoded_utf8($str) {
my $r = '';
my @chars = map { :16($_) }, $str.split('%').grep({$^w});
while @chars {
my $bytes = 1;
my $mask = 0xFF;
given @chars[0] {
when { $^c +& 0xF0 == 0xF0 } { $bytes = 4; $mask = 0x07 }
when { $^c +& 0xE0 == 0xE0 } { $bytes = 3; $mask = 0x0F }
when { $^c +& 0xC0 == 0xC0 } { $bytes = 2; $mask = 0x1F }
}
my @shift = (^$bytes).reverse.map({6 * $_});
my @mask = $mask, Slip(0x3F xx $bytes-1);
$r ~= chr( [+] @chars.splice(0,$bytes) »+&« @mask »+<« @shift );
}
return $r;
}
method add_param ( Str $key, $value ) {
if %.params{$key} :exists {
# RAKUDO: ~~ Scalar
if %.params{$key} ~~ Str | Int {
my $old_param = %.params{$key};
%!params{$key} = [ $old_param, $value ];
}
elsif %.params{$key} ~~ Array {
%!params{$key}.push( $value );
}
}
else {
%!params{$key} = $value;
}
}
method param ($key) {
return %.params{$key};
}
}
# vim:ft=perl6
unit class November::URI;
# This class used to be called just 'URI', but there was a collision with
# the eponymous class in the 'uri' project. Arguably, that class has more
# rights to that name, so this one was renamed. Since the 'uri' project
# ought to cover the same functionality as this class, maybe long-term we
# could switch to using that instead. One more dependency, but less code
# duplication across projects.
use November::URI::Grammar;
# RAKUDO: Match object does not do assignment properly :(
#my Match $.parts; dies in init with 'Type mismatch in assignment';
# workaround:
has $.uri;
has @.chunks;
submethod BUILD(:$uri) {
# clear string before parsing
my $c_str = $uri;
$c_str .= subst(/^ \s* ['<' | '"'] /, '');
$c_str .= subst(/ ['>' | '"'] \s* $/, '');
November::URI::Grammar.parse($c_str);
unless $/ { die "Could not parse URI: $uri" }
$!uri = $/;
@!chunks = @($<path><chunk>) || ('');
}
method scheme {
my $s = $.uri<scheme> || '';
# RAKUDO: return 1 if use ~ below die because can`t do lc on Math after
return ~$s.lc;
}
method authority {
my $a = $.uri<authority> || '';
# RAKUDO: return 1 if use ~ below die because can`t do lc on Math after
return ~$a.lc;
}
method host {
#RAKUDO: $.uri<authority>[0]<host> return full <authority> now
my $h = ~$.uri<authority><host>;
return $h.lc || '';
}
method port {
# TODO: send rakudobug
# RAKUDO: $.uri<authority><port> return full <authority> now
# workaround:
item $.uri<authority><port> || '';
}
method path {
my $p = ~$.uri<path> || '';
return $p.lc;
}
method absolute {
# RAKUDO: The grammar uses <slash>?, so this should be either Nil or a
# Match object. But Rakudo returns [] or [Match] instead, so we must use
# || instead of // to test.
return ?($.uri<path><slash> || $.scheme);
}
method relative {
# Rakudo: Must use || instead of //, see above.
return !($.uri<path><slash> || $.scheme);
}
method query {
item $.uri<query> || '';
}
method frag {
my $f = $.uri<fragment> || '';
return ~$f.lc;
}
method fragment { $.frag }
method Str() {
my $str;
$str ~= $.scheme if $.scheme;
$str ~= '://' ~ $.authority if $.authority;
$str ~= $.path;
$str ~= '?' ~ $.query if $.query;
$str ~= '#' ~ $.frag if $.frag;
return $str;
}
=begin pod
=head NAME
November::URI Uniform Resource Identifiers (absolute and relative)
=head SYNOPSYS
use November::URI;
my $u = November::URI.new;
$u.init('http://example.com/foo/bar?tag=woow#bla');
my $scheme = $u.scheme;
my $authority = $u.authority;
my $host = $u.host;
my $port = $u.port;
my $path = $u.path;
my $query = $u.query;
my $frag = $u.frag; # or $u.fragment;
my $is_absolute = $u.absolute;
my $is_relative = $u.relative;
=end pod
# vim:ft=perl6
use v6;
grammar November::URI::Grammar {
token TOP { ^ [<scheme> ':']? [ '//' <authority>]? <path> ['?' <query>]? ['#' <fragment>]? $ };
token scheme { <-[:/&?#]>+ };
token authority { <host> [':' <port>]? };
token host { <-[/&?#:]>* };
token port { (\d**1..5)
<?{ $0 < 2 ** 16 }>
<!before \d> };
token path { <slash>? [ <chunk> '/'?]* }; # * mb wrong, because that allow '' URI
token slash { '/' };
token chunk { <-[/?#]>+ };
token query { <-[#]>* };
token fragment { .* };
}
# Official regexp (p5):
# my($scheme, $authority, $path, $query, $fragment) =
# $uri =~ m/
# (?:([^:/?#]+):)?
# (?://([^/?#]*))?
# ([^?#]*)
# (?:\?([^#]*))?
# (?:#(.*))?
# /x;
# vim:ft=perl6
use v6.c;
use Pheix::Resources::En;
use Pheix::Utils;
class Pheix::Datepack {
has $.date;
method format_update() {
my $res_obj = Pheix::Resources::En.new;
return $.date.day ~ ' ' ~ $res_obj.months{$.date.month} ~ ", " ~ $.date.year;
}
method year_update() {
return $.date.year;
}
method hex_unixtime() {
my $utils_obj = Pheix::Utils.new;
return $utils_obj.get_hex(time);
}
}
use v6.c;
use Pheix::HTML::Markup;
class Pheix::Debug {
my $obj = Pheix::HTML::Markup.new;
method show_env_variables () {
my $env;
for (%*ENV.keys) -> $key {
$env ~= "\%*ENV\{$key\} = %*ENV{$key}" ~ $obj.br ~ "\n";
}
return $env;
}
}
use v6.c;
class Pheix::HTML::Markup {
has $.br = "<br>";
method p($class, $content) {
if $class {
return "<p class=\"$class\">$content\</p>";
} else {
return "<p>$content\</p>";
}
}
}
use v6.c;
class Pheix::Resources::En {
has %.months =
1 => "January",
2 => "February",
3 => "March",
4 => "April",
5 => "May",
6 => "June",
7 => "July",
8 => "August",
9 => "September",
10 => "October",
11 => "November",
12 => "Decemver"
;
has $.render_mess_prefix = "render time: ";
has $.render_mess_postfix = " seconds";
}
use v6.c;
class Pheix::Template {
has $.uitempl_indx = "./conf/config/index.html";
has $.html_tmpl is rw;
method render($tmpl_type) {
given $tmpl_type {
default {
if $.uitempl_indx {
if $.uitempl_indx.IO ~~ :e {
my $fh = open $.uitempl_indx, :r;
$.html_tmpl = $fh.slurp;
$fh.close;
}
}
}
}
return $.html_tmpl;
}
}
use v6.c;
class Pheix::Utils {
method get_hex($s) {
my $rc;
if $s {
for $s.split("",:skip-empty) -> $char {
if $char {
my $hex = "%" ~ sprintf "%x", ord($char);
$rc ~= $hex;
}
}
} else {
$rc = Nil;
}
return $rc;
}
}
#!/bin/bash
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
NC='\e[0m'
for STAGE in {1..6}
do
if [ $STAGE -eq 1 ]
then
echo -e "Running ${YELLOW}Pheix::Template${NC} tests:"
perl6 ./t/_phx-template.t;
elif [ $STAGE -eq 2 ]
then
echo -e "Running ${YELLOW}Pheix::Utils${NC} tests:"
perl6 ./t/_phx-utils.t;
elif [ $STAGE -eq 3 ]
then
echo -e "Running ${YELLOW}November::CGI${NC} tests, part 1:"
perl6 ./t/cgi/01-cgi.t;
elif [ $STAGE -eq 4 ]
then
echo -e "Running ${YELLOW}November::CGI${NC} tests, part 2:"
./t/cgi/02-cgi_post.t.sh
elif [ $STAGE -eq 5 ]
then