fix dynamic pages
This commit is contained in:
parent
7920fa5b1d
commit
6e63f56fe2
@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
function getDynamicPermission($file): int {
|
||||
include_once($file);
|
||||
return get_parameters()["minimal_permission_level"];
|
||||
}
|
||||
|
||||
function generateNavigation(): string
|
||||
{
|
||||
global $routerConfig;
|
||||
@ -36,7 +41,8 @@ function generateNavigation(): string
|
||||
|
||||
$navpages = "";
|
||||
foreach ($pages_dir as $page_file) {
|
||||
$page_dir = explode(".", $page_file)[0];
|
||||
$page_dir_tmp = explode(".", $page_file);
|
||||
$page_dir = $page_dir_tmp[0];
|
||||
$page_class = "class=\"navpage_link\"";
|
||||
if ($routerRequest["subdomain"] == $site_dir && $routerRequest["page_name"] == $page_dir) {
|
||||
$page_class = "class=\"navpage_link active\"";
|
||||
@ -48,11 +54,20 @@ function generateNavigation(): string
|
||||
$page_name = explode(".", $page_name)[0];
|
||||
$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); //make dynamic pages work here
|
||||
if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){
|
||||
$page_required_permission = intval($pageMetadata["parameters"]["minimal_permission_level"]);
|
||||
if($page_dir_tmp[1] == "html"){
|
||||
$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"];
|
||||
}
|
||||
}
|
||||
elseif($page_dir_tmp[1] == "php"){
|
||||
$page_required_permission = getDynamicPermission($page_file);
|
||||
}
|
||||
else{
|
||||
$page_required_permission = $routerConfig["default_page_permission_level"];
|
||||
|
Loading…
Reference in New Issue
Block a user