error_reporting(E_ALL);
function displayPage($request)
{
// Instantiate the xajaxResponse object
$objResponse = new xajaxResponse();
$link = getMysql();
// load the html into $newcontent
// strip off get items into $_GET
$content = retrievePage($request);
$objResponse->assign("content","innerHTML", $content);
// build permalink
$permalink="Permalink";
$objResponse->assign("permalink","innerHTML",$permalink);
//return the xajaxResponse object
return $objResponse;
}
$xajax->registerFunction("displayPage");
function retrievePage($request)
{
$link = getMysql();
$filename=stripGet($request);
ob_start();
include($filename);
$content = ob_get_clean();
$content = replaceLinks($content);
$content = pohp($content); // post hypertext processor :P
return $content;
}
function dP($request)
{
return displayPage($request);
}
$xajax->registerFunction("dP");
function stripGet($request)
{
if (strpos($request,'?'))
{
$filename=substr($request,0,strpos($request,'?'));
$vars = substr($request,strpos($request,'?')+1);
$v2=explode('&',$vars);
foreach($v2 as $req)
{
$full=explode('=',$req);
$_GET[$full[0]]=$full[1];
}
return $filename;
}
else
{
return $request;
}
}
function replaceLinks($content)
{
// rewrite the content so that links are
// replaced with JS calls
// find a tags
$start = 0;
while (stripos($content,'',$pos)-$pos+4;
$tag = substr($content,$pos,$length);
if (!stripos($tag,"http")) {
// get href
$explodedtag = explode("\"",$tag);
$href=$explodedtag[1];
$linky = explode("",$explodedtag[2]);
$linky=substr($linky[0],1);
$newlink = "$linky";
//$content2.=htmlspecialchars($tag."==".$newlink)."
";
$content = str_replace($tag,$newlink,$content);
$start = $pos+strlen($newlink)+1;
} else {
// leave alone
$start = $pos+strlen($tag)+1;
}
}
return $content;
}
function pohp($content)
{
$content = str_replace("","