ID:276028
 
This is my old RyeWicki source. It's in PHP. I am currently changing my RyeWicki over to use a MySQL DB so I figured I hate wasting stuff. But, I did remove a feature or two.

<?
$p=array("/\n----+/","/\n( +.*".")\n/","/\t(.*):\t/","/''''''/","/'''(.*)'''/","/''(.*)''/","/\n+/","/\n\*\*(".".*)/","/\n\*/","/(([A-Z][a-z]+){2,})/");

$r=array("\n<hr/>","<pre>\\1</pre>","<dt>\\1<dd>","","<strong>\\1</strong>","<em>\\1</em>","<p></p>\n","<ul><li>". "\\1</ul>","<li>","<a href=\"?\\1\">\\1</a>");

foreach($_GET as $key => $value) {if($key!="a"&&$key!="PHPSESSID"){$firstw=$key;break;}}

$w=($firstw) ?preg_replace("/[\.'.'\/ ]/","",$firstw):"HomePage";

$t=(file_exists("files/$w"))?file_get_contents("files/$w"):'Enter the page information here.';

$a=(isset($_REQUEST['a']))?$_REQUEST['a']:"view";

if(!file_exists("files/$w")&&($a!='save')){
$is_formated = preg_replace("/(([A-Z][a-z]+){2,})/","work",$w);
if($is_formated != "work") {echo 'The page name you provided is not in the correct format. Please check the name and try again.';exit();}
$a='edit';}

switch($a){
case'edit':
require('ipBAN.php');
echo'<form method="POST" action="'.$_SERVER["REQUEST_URI"].'">
<input type="hidden" name="" value="'.$w.'">When you finish editing this page you can click this <input type="submit" name="a" value="save"> to the document.'.
' Please keep it clean.<br><textarea name="t" cols="90" rows="24">'.$t .'</textarea></form>';
break;

case'save':
$t=$_REQUEST['t'];
$old =(file_exists("files/$w"))?file_get_contents("files/$w"):"NULL";
$f=fopen("files/$w",'w+');
$t=stripslashes($t);
fwrite($f,$t);
fclose($f);

default:
echo '<h1><a href="'. $_SERVER["HTTP_REFERER"].'">'.$w.'</a>'.'</h1>'.preg_replace($p, $r, $t);
echo'<hr>Click <a href="?'. $w.'&a=edit">here</a> to edit this page.<br>';
echo'Click <a href="?files">here</a> to view all the pages.';
break;
}}

?>


-Ryan