This commit is contained in:
edsea
2025-10-11 00:21:00 +02:00
commit f0c9786164
27 changed files with 10684 additions and 0 deletions

43
rss/php/pageHandler.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'] . '/rss/php/autoload.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/rss/php/conf.php');
$page = isset($_GET['page']) && !empty($_GET['page']) ? str_replace('.php', '', $_GET['page']) : 'home';
if($page == '404'){
http_response_code(404);
}
if(file_exists($_SERVER['DOCUMENT_ROOT'] . '/rss/json/pages/' . $page . '.json')){
// Load page configuration
$jsonInfo = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/rss/json/pages/' . $page .'.json');
$pageInfo = json_decode($jsonInfo, true);
$gU = new App\Users();
$userAuth = $gU->isAuth();
if($pageInfo['restricted'] && !$userAuth){
header('location:/login/');
}
if($pageInfo['redirect_login'] && $userAuth){
header('location:/account/');
}
}else{
http_response_code(404);
header('location:/404');
die('Not found');
}
?>
<?php
function loadContents(){
global $pageInfo;
if(file_exists($_SERVER['DOCUMENT_ROOT'] . '/rss/php/templates/'.$pageInfo['template'].'.php')){
include($_SERVER['DOCUMENT_ROOT'] . '/rss/php/templates/'.$pageInfo['template'].'.php');
}else{
http_response_code(404);
header('location:/404');
exit();
}
}
?>