Location: PHPKode > projects > Wiki Web Help > wwh/pages/getpage.php
<?php
require_once("../config.php");
//require_once("../class/node.class.php");
// TODO: use node class to get id to CamelCase links

$page = $_GET['id'];
if(!is_numeric($page)) exit; // extra precaution

$sql = "SELECT * FROM page INNER JOIN node ON node.node_id=page.node_id WHERE node.node_id=$page";
$result = mysql_query($sql,$con) or die("Database Error ".mysql_error());

$pid = mysql_result($result, 0, 'parent_id');
$title = mysql_result($result, 0, 'label');
echo "<html>\n<head>\n<title>$title</title>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head>\n<body>\n";

$wikimarkup = stripslashes(mysql_result($result, 0, 'page_text'));

// basic transformations only
$wikimarkup = preg_replace('/\n(.*)\n/','<p>$1</p>',$wikimarkup); // paragraph
$wikimarkup = preg_replace('/\[(http(s?)\:\/\/[^ ,]+)[, ]([^\]]*)\]/','<a href="$1$2">$3</a>',$wikimarkup); // external link
//$wikimarkup = preg_replace('/\[(\/[a-zA-z0-9_\u00A1-\uFFFF\-\/]+)\]/','<a href="../$1">$2</a>',$wikimarkup); // internal link
$wikimarkup = preg_replace('/\[([^ ,]+)[, ]([^\]]*)\]/','<a href="../$1">$2</a>',$wikimarkup); // internal link
$wikimarkup = preg_replace('/\[%(.*?)%\]/s', '<pre>$1</pre>', $wikimarkup); // pre
$wikimarkup = preg_replace('/%(.*?)%/s', '<code>$1</code>', $wikimarkup); // code
if($pid > 0)
	echo $wikimarkup."<br/><br/>";

include("links.php");
echo "<script>window.location = '../#$page';</script>";
echo "\n</body>\n</html>\n"
?>
Return current item: Wiki Web Help