forked from Adleraci/adlerka.top
fix dynamic pages
This commit is contained in:
parent
7920fa5b1d
commit
6e63f56fe2
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function getDynamicPermission($file): int {
|
||||||
|
include_once($file);
|
||||||
|
return get_parameters()["minimal_permission_level"];
|
||||||
|
}
|
||||||
|
|
||||||
function generateNavigation(): string
|
function generateNavigation(): string
|
||||||
{
|
{
|
||||||
global $routerConfig;
|
global $routerConfig;
|
||||||
@ -36,7 +41,8 @@ function generateNavigation(): string
|
|||||||
|
|
||||||
$navpages = "";
|
$navpages = "";
|
||||||
foreach ($pages_dir as $page_file) {
|
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\"";
|
$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\"";
|
||||||
@ -48,11 +54,20 @@ function generateNavigation(): string
|
|||||||
$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_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($page_dir_tmp[1] == "html"){
|
||||||
if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){
|
$page_tmp = file_get_contents($page_file);
|
||||||
$page_required_permission = intval($pageMetadata["parameters"]["minimal_permission_level"]);
|
|
||||||
|
$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{
|
else{
|
||||||
$page_required_permission = $routerConfig["default_page_permission_level"];
|
$page_required_permission = $routerConfig["default_page_permission_level"];
|
||||||
|
Loading…
Reference in New Issue
Block a user