$label, "###NAVHREF###" => $link, "###NAVCLASS###" => $class ); } function pgsLoadPages($mysqli, $userID) { /* userID unused for now, maybe will add page access control if neccessary */ $ret = array(); $dir = scandir("pgs"); foreach ($dir as $val) { if ($val!="." && $val!="..") { if (file_exists("pgs/".$val."/module.json")) { $json = json_decode(file_get_contents("pgs/".$val."/module.json"), true); if (lgnCheckRight($mysqli, $json["useRight"], $userID)) { $key = $json["moduleName"]; $ret[$key]["ID"] = $json["moduleName"]; $ret[$key]["name"] = $json["title"]; $ret[$key]["path"] = $val; $ret[$key]["tpl"] = pgsCreatePage($val, "", ""); } } } } return $ret; } function pgsIncPage($name) { #Checks if a mainpage exists, completes filename and returns valid page or default $path = "pgs/".$name."/"; $possiblefiles = array("index.php", $name.".php"); foreach ($possiblefiles as $val) { if (file_exists($path.$val)) return $path.$val; } } function pgsInclSub($name) { // global $pages,$page; $possibleexts = array("", ".php", ".htm", ".html", ".txt"); $file = "pgs/".$pages[$page["main"]]["path"]."/".$name; foreach ($possibleexts as $val) { if (file_exists($file.$val)) return $file.$val; } addError("pgsInc", $name); return false; } ?>