Adds "not found" page

main
Yasen Pramatarov 2024-09-13 14:02:59 +03:00
parent 6ec0981b0a
commit 3170d87934
5 changed files with 32 additions and 29 deletions

View File

@ -0,0 +1,8 @@
<div class="text-center">
<div class="mt-3 h5">The page is not found.</div>
<div>
<small>go to <a href="<?= $app_root ?>">front page</a> or to <a href="<?= $app_root ?>?page=profile">your profile</a></small>
</div>
</div>

View File

@ -14,7 +14,7 @@
<?php foreach ($platformsAll as $platform) { ?>
<li style="margin-right: 3px;">
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars($platform['id']) ?>&page=front">
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars($platform['id']) ?>&page=dashboard">
<?= htmlspecialchars($platform['name']) ?>
</a>
</li>

View File

@ -16,8 +16,8 @@ $timeNow = new DateTime('now', new DateTimeZone($userTimezone));
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>statistics</small></p></li>
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=front">
<li class="list-group-item<?php if ($page === 'front') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=dashboard">
<li class="list-group-item<?php if ($page === 'dashboard') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-chart-line" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="general jitsi stats"></i>general stats
</li>
</a>

View File

@ -25,16 +25,21 @@ error_reporting(E_ALL);
// list of available pages
// edit accordingly, add 'pages/PAGE.php'
$allowed_urls = [
'front',
'login',
'logout',
'register',
'profile',
'config',
'agents',
'dashboard',
'conferences',
'participants',
'components',
'agents',
'profile',
'config',
'logs',
'login',
'logout',
'register',
];
// cnfig file
@ -68,7 +73,7 @@ session_start();
if (isset($_REQUEST['page'])) {
$page = $_REQUEST['page'];
} else {
$page = 'front';
$page = 'dashboard';
}
if (isset($_REQUEST['item'])) {
$item = $_REQUEST['item'];
@ -142,28 +147,18 @@ if ($page == 'logout') {
}
// page building
include '../app/templates/page-header.php';
include '../app/templates/page-menu.php';
include '../app/templates/block-message.php';
if (isset($currentUser)) {
include '../app/templates/page-sidebar.php';
}
if (in_array($page, $allowed_urls)) {
// all normal pages
include '../app/templates/page-header.php';
include '../app/templates/page-menu.php';
include '../app/templates/block-message.php';
if (isset($currentUser)) {
include '../app/templates/page-sidebar.php';
}
include "../app/pages/{$page}.php";
} else {
// the page is not in allowed urls, loading front page
$error = 'The page "' . $page . '" is not found';
include '../app/templates/page-header.php';
include '../app/templates/page-menu.php';
include '../app/templates/block-message.php';
if (isset($currentUser)) {
include '../app/templates/page-sidebar.php';
}
include '../app/pages/front.php';
// the page is not in allowed urls, loading "not found" page
include '../app/templates/error-notfound.php';
}
}
// end with the footer