fix logic

remove debug prints
This commit is contained in:
Bruno Rybársky 2024-02-01 10:06:50 +01:00
parent 15ad67fdba
commit 775c40ff9a

@ -79,10 +79,6 @@ function getPage($page_name = null): array|false|string
http_response_code(404); http_response_code(404);
} }
print_r($pageMetadata["parameters"]);
echo "<br>";
print_r($_SESSION);
if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){ if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){
$page_required_permission = intval($pageMetadata["parameters"]["minimal_permission_level"]); $page_required_permission = intval($pageMetadata["parameters"]["minimal_permission_level"]);
} }
@ -91,16 +87,20 @@ function getPage($page_name = null): array|false|string
} }
if(!empty($pageMetadata["parameters"]["secret"])){ if(!empty($pageMetadata["parameters"]["secret"])){
$is_secret_page = intval($pageMetadata["parameters"]["secret"]); $origSecret = $pageMetadata["parameters"]["secret"];
if ($origSecret == "yes"){
$is_secret_page = 1;
}
elseif ($origSecret == "no"){
$is_secret_page = 0;
}
else{
$is_secret_page = $routerConfig["default_page_secret"];
}
} }
else{ else{
$is_secret_page = $routerConfig["default_page_secret"]; $is_secret_page = $routerConfig["default_page_secret"];
} }
$curprivlvl = $_SESSION["privilegelevel"];
$orig = $pageMetadata["parameters"]["secret"];
print_r(empty($pageMetadata["parameters"]["secret"]));
echo "Secrecy: $is_secret_page($orig), you need to have $page_required_permission, you have $curprivlvl";
if($page_required_permission > $_SESSION["privilegelevel"]){ if($page_required_permission > $_SESSION["privilegelevel"]){
if($is_secret_page == 1) { if($is_secret_page == 1) {