"; //drawaRRAY($GLOBALS); $nhost = substr($HTTP_GET_VARS["host"],0,-1-strlen($addhost)); $url = array("host" => $nhost, "path" => $GLOBALS["arg"]); if((substr($url["path"],0,1) == "/") && (substr($url["path"],0,2) != "//")) { // $url["path"] = "/".$url["path"]; $url["path"] = substr($url["path"],1); } else { $url["path"] = substr($url["path"],2); } //$url["path"] = "/".$url["path"]; //drawArray($url,0); $active = true; if(strpos($GLOBALS["arg"],"NACTIVE") > 0) $active = false; $nurl = ""; if(!is_array(($row = getData($url["host"],$url["path"])))) { if(!is_array(($row = getData($url["host"],"error/404".$url["path"])))) $row = getData("poelzi.org","error/404"); $row["options"] = @substr($url["path"],strpos($url["path"],"//")+2); } else { $nurl = $row["path"]; } //echo $row["options"]; //$lang = $row["lang"]; if(strlen($row["options"]) == "2" || substr($row["options"],2,1) == "/") { $lang = substr($row["options"],0,2); } $langs = getLangs(); if($lang == "") { //echo substr($GLOBALS["HTTP_ACCEPT_LANGUAGE"],0,strpos($GLOBALS["HTTP_ACCEPT_LANGUAGE"],";")); $al = explode(",",substr($GLOBALS["HTTP_ACCEPT_LANGUAGE"],0,strpos($GLOBALS["HTTP_ACCEPT_LANGUAGE"],";"))); while(list(,$n) = each($al)) { if(isset($langs[$n])) { $lang = $n; break; } } } $ot = explode("/",$row["options"]); $intree = false; while(list($i,$co) = each($ot)) { // set language if($i == 0 && strlen($co) == 2) { $language = $co; } else { switch($co) { case "debug": if(!defined("DEBUG")) define("DEBUG",1); break; case "empire": $menuroot = 2; $menustart = 8; $tree = "empire"; $intree = true; break; case "era": $menuroot = 3; $menustart = 12; $tree = "era"; $intree = true; break; default: if($intree) { $tree .= "/".$co; } } } } function handleLink($string) { global $addhost,$active; if(defined("DEBUG")) echo "handleLink:".$string."
\r\n"; if($GLOBALS["HTTPS"] == "on") $result = "https://"; else $result = "http://"; $tags = explode(";",$string); $nlang = ""; $ndebug = ""; $ntree = ""; if(count($tags) == 1) { switch($tags[0]) { case "runtime": return substr(getRuntime(),0,6); case "sizeinfo": return strlen($GLOBALS["kalki"]->getData("main"))."/".strlen($GLOBALS["result"]); default: $row = getStructureItem($tags[0]); if($row == false) return ""; $tags[0] = $row["host"]; $tags[1] = $row["path"]; if($row["tree"] != "") $tags[2] = "tree=".$row["tree"]; } } while(list($number,$value) = each($tags)) { switch($number) { case "0": $port = ""; if(($GLOBALS["SERVER_PORT"] != "80") && ($GLOBALS["SERVER_PORT"] != "443")) $port = ":".$GLOBALS["SERVER_PORT"]; if($value != "") $result .= $value.".".$addhost.$port; else $result .= $addhost.$port; break; case "1": if(substr($value,0,1) == "/") $result .= $value."/"; elseif($value != "") $result .= "/".$value."/"; else $result .= "/"; break; // handle options default: if(strpos($value,"=") === false) { $na = $value; } else { $na = substr($value,0,strpos($value,"=")); $va = substr($value,strlen($na)+1); } switch($na) { case "lang": $nlang = $va; break; case "debug": $ndebug = "debug"; break; case "active": $nactive = $va; case "tree": $ntree = $va; break; } } } // add //if(($nlang != "")||($GLOBALS["lang"] != "")) { if(substr($result,-2) != "//") $result .= "/"; //} if(($nlang == "") && ($GLOBALS["lang"] != "")) $result .= $GLOBALS["lang"]."/"; elseif($nlang != "") $result .= $nlang."/"; if(($ndebug == "debug") || defined("DEBUG")) $result .= "debug/"; if(($nactive == "true") || ($GLOBALS["active"] == false)) $result .= "NACTIVE/"; if(($ntree == "") && ($GLOBALS["tree"] != "")) $result .= $GLOBALS["tree"]; elseif($ntree != "") $result .= $ntree; // $result = preg_replace("/^(.*)(\/*)$/U","\\1",$result); if(substr($result,-2) == "//") $result = substr($result,0,-1); if(substr($result,-1) != "/") $result .= '/'; // echo $result; return $result; } if(defined("DEBUG")) drawArray($row); $eof = ""; for($i = 0; $i < 10; $i++) $eof .= str_repeat ("a".$i, 5); function theader($header) { if($header != "") header($header); } if($row["header"] != "") { preg_replace("/(.*)((\015\012)|(\015)|(\012))/e","theader('\\1')",$row["header"]); } $kalki = new kalkitemplate; if($row["schema"] != "" && file_exists("layout/".$row["schema"].".kt")) { $kalki->loadTemplate("layout/".$row["schema"].".kt"); } else { $kalki->loadTemplate("layout/index.kt"); } // set date if($row["date"] == 0) $date = time(); else $date = $row["date"]; switch($row["type"]) { case "R": header("Location: ".handleLink(stripslashes($row["text"]))); echo ''.handleLink($row["text"]).''; exit; case "E": $kalki->setData("main",eval(stripslashes($row["text"]))); break; case "M": $module = false; $cdat = parse_array::StringToAssocArray($row["text"],":"); if(file_exists("modules/".trim($cdat["module"]).".inc")) { include("modules/".trim($cdat["module"]).".inc"); eval('$module = new '.trim($cdat["module"]).'($cdat);'); } if(is_object($module)) { $kalki->setData("main",$module->getContent($cdat)); $date = $module->getDate(); //$kalki->setData("date", ''.date("Y.m.d:B",$date).""); break; } else { $row = getData("poelzi.org","error/404"); } default: $kalki->setData("main",stripslashes($row["text"])); } if(false == $kalki->getData("date")) { $kalki->setData("date", ''.date("Y.m.d:B",$date).""); } $kalki->setData("meta-date",gmdate("Y-m-d",$date)."T".gmdate("H:i:s",$date)."+00:00"); if($menuroot != 0) { // $kalki->setData("menu",getMenu($menuroot,$tree,$menustart)); $kalki->setData("menu",getMenu($menuroot,$tree, array("startpos" => $menustart, "maxlength" => 22))); } else $kalki->setData("menu",""); //$kalki->setData("text"," this is a samle text"); // send mod header header ("Last-Modified: " . gmdate("D, d M Y H:i:s",$date) . " GMT"); $clangs = getLangs($nhost,$nurl); $ls = "/"; while(list($nl,$nc) = each($langs)) { if(trim($nl) == "") continue; $ls .= ''; if(!isset($clangs[$nl])) $ls .= ''; $ls .= strtoupper($nl); if(!isset($clangs[$nl])) $ls .= ''; $ls .= '/'; } switch($lang) { case "de": $sizeinfo = "inhalt/größe"; $runtime = "laufzeit"; break; default: $sizeinfo = "content/size"; $runtime = "runtime"; } $kalki->setData("meta-description",$row["description"]); $kalki->setData("meta-keyword",$row["keyword"]); $kalki->setData("runtime",$runtime); $kalki->setData("sizeinfo",$sizeinfo); $kalki->setData("lang",$ls); if($url["host"] == "") $url["host"] = $realhost; $kalki->setData("title",'<'.$url["host"].'> '.$row["title"]); if(($row["mime"] == "") || (substr($row["mime"],0,4) == "text")) { $result = $kalki->getResult(); } else { echo $row["text"]; exit; } $result = preg_replace ('/pmlnk\((.*)\)/iUse',"handleLink('\\1')",$result); @header("Content-Length: ".strlen($result)); @header("X-Powered-BY: poelzi.org"); echo $result; ?>