dont show pages you dont have permission to in the navigation
This commit is contained in:
parent
f2e3ac6bcd
commit
60bf24ec77
@ -35,8 +35,8 @@ function generateNavigation(): string
|
|||||||
}
|
}
|
||||||
|
|
||||||
$navpages = "";
|
$navpages = "";
|
||||||
foreach ($pages_dir as $page_dir) {
|
foreach ($pages_dir as $page_file) {
|
||||||
$page_dir = explode(".", $page_dir)[0];
|
$page_dir = explode(".", $page_file)[0];
|
||||||
$page_class = "class=\"navpage_link\"";
|
$page_class = "class=\"navpage_link\"";
|
||||||
if ($routerRequest["subdomain"] == $site_dir && $routerRequest["page_name"] == $page_dir) {
|
if ($routerRequest["subdomain"] == $site_dir && $routerRequest["page_name"] == $page_dir) {
|
||||||
$page_class = "class=\"navpage_link active\"";
|
$page_class = "class=\"navpage_link active\"";
|
||||||
@ -47,11 +47,25 @@ function generateNavigation(): string
|
|||||||
$page_name = str_replace("_", " ", $page_dir);
|
$page_name = str_replace("_", " ", $page_dir);
|
||||||
$page_name = explode(".", $page_name)[0];
|
$page_name = explode(".", $page_name)[0];
|
||||||
$page_name = ucfirst($page_name);
|
$page_name = ucfirst($page_name);
|
||||||
|
$page_file = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ;
|
||||||
|
$page_tmp = file_get_contents($page_file);
|
||||||
|
|
||||||
|
$pageMetadata = parsePageTag($page_tmp);
|
||||||
|
if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){
|
||||||
|
$page_required_permission = intval($pageMetadata["parameters"]["minimal_permission_level"]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$page_required_permission = $routerConfig["default_page_permission_level"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($page_required_permission <= $_SESSION["privilegelevel"]) {
|
||||||
$navpages .= "<li class='navpage_item'><a href='$page_location' $page_class>$page_name</a></li>";
|
$navpages .= "<li class='navpage_item'><a href='$page_location' $page_class>$page_name</a></li>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!empty($navpages)){
|
||||||
$nav_out .= "<li class='navsite_item'><a href='$site_location' $site_class>$site_name</a><ul class='navpage_list'>$navpages</ul></li>";
|
$nav_out .= "<li class='navsite_item'><a href='$site_location' $site_class>$site_name</a><ul class='navpage_list'>$navpages</ul></li>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $nav_out;
|
return $nav_out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user