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) { ?> <?php foreach ($platformsAll as $platform) { ?>
<li style="margin-right: 3px;"> <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']) ?> <?= htmlspecialchars($platform['name']) ?>
</a> </a>
</li> </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> <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"> <a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=dashboard">
<li class="list-group-item<?php if ($page === 'front') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <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 <i class="fas fa-chart-line" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="general jitsi stats"></i>general stats
</li> </li>
</a> </a>

View File

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