Adds app root in links

main
Yasen Pramatarov 2024-08-15 10:31:26 +03:00
parent e84c880289
commit b02d72b29d
7 changed files with 19 additions and 21 deletions

View File

@ -3,7 +3,7 @@
<h2 class="card-header">Login</h2>
<div class="card-body">
<p class="card-text"><strong>Welcome to JILO!</strong><br />Please enter login credentials:</p>
<form method="POST" action="?page=login">
<form method="POST" action="<?= $app_root ?>?page=login">
<input type="text" name="username" placeholder="Username" required />
<br />
<input type="password" name="password" placeholder="Password" required />

View File

@ -3,7 +3,7 @@
<h2 class="card-header">Register</h2>
<div class="card-body">
<p class="card-text">Enter credentials for registration:</p>
<form method="POST" action="?page=register">
<form method="POST" action="<?php= $app_root ?>?page=register">
<input type="text" name="username" placeholder="Username" required />
<br />
<input type="password" name="password" placeholder="Password" required />

View File

@ -2,8 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="static/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="static/all.css">
<link rel="stylesheet" type="text/css" href="<?= $app_root ?>static/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?= $app_root ?>static/all.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

View File

@ -4,7 +4,7 @@
<ul class="menu-left">
<div class="container">
<div class="row">
<a href="index.php" class="logo-link"><div class="col-4"><img class="logo" src="static/jilo-logo.png" alt="JILO"/></div></a>
<a href="<?= $app_root ?>" class="logo-link"><div class="col-4"><img class="logo" src="<?= $app_root ?>static/jilo-logo.png" alt="JILO"/></div></a>
</div>
</div>
@ -23,11 +23,11 @@
<ul class="menu-right">
<?php if ( isset($_SESSION['username']) ) { ?>
<li><a href="?page=profile"><?= $user ?></a></li>
<li><a href="?page=logout">logout</a></li>
<li><a href="<?= $app_root ?>?page=profile"><?= $user ?></a></li>
<li><a href="<?= $app_root ?>?page=logout">logout</a></li>
<?php } else { ?>
<li><a href="?page=login">login</a></li>
<li><a href="?page=register">register</a></li>
<li><a href="<?= $app_root ?>?page=login">login</a></li>
<li><a href="<?= $app_root ?>?page=register">register</a></li>
<?php } ?>
</ul>
</div>

View File

@ -5,33 +5,33 @@
<div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div>
<div class="sidebar-content card ml-3 mt-3">
<ul class="list-group">
<a href="?page=front">
<a href="<?= $app_root ?>?page=front">
<li class="list-group-item<?php if ($page === 'front') 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>
<a href="?page=conferences">
<a href="<?= $app_root ?>?page=conferences">
<li class="list-group-item<?php if ($page === 'conferences') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-video" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="conferences"></i>conferences
</li>
</a>
<a href="?page=participants">
<a href="<?= $app_root ?>?page=participants">
<li class="list-group-item<?php if ($page === 'participants') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-users" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="participants"></i>participants
</li>
</a>
<a href="?page=components">
<a href="<?= $app_root ?>?page=components">
<li class="list-group-item<?php if ($page === 'components') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-puzzle-piece" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="components"></i>components
</li>
</a>
<li class="list-group-item bg-light" style="border-left: none; border-right: none;"></li>
<a href="?page=config">
<a href="<?= $app_root ?>?page=config">
<li class="list-group-item<?php if ($page === 'config') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config
</li>
</a>
<a href="?page=logs">
<a href="<?= $app_root ?>?page=logs">
<li class="list-group-item<?php if ($page === 'logs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-list" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="logs"></i>logs
</li>

View File

@ -36,7 +36,7 @@
<td>conferences</td>
<?php foreach ($widget['records'] as $record) { ?>
<td><?php if (!empty($record['conferences'])) { ?>
<a href="?page=conferences&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['conferences']) ?></a> <?php } else { ?>
<a href="<?= $app_root ?>?page=conferences&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['conferences']) ?></a> <?php } else { ?>
0<?php } ?>
</td>
<?php } ?>
@ -45,7 +45,7 @@
<td>participants</td>
<?php foreach ($widget['records'] as $record) { ?>
<td><?php if (!empty($record['participants'])) { ?>
<a href="?page=participants&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['participants']) ?></a> <?php } else { ?>
<a href="<?= $app_root ?>?page=participants&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['participants']) ?></a> <?php } else { ?>
0<?php } ?>
</td>
<?php } ?>

View File

@ -58,10 +58,8 @@ $app_root = $config['folder'];
session_name('jilo');
session_start();
if (isset($_GET['page'])) {
$page = $_GET['page'];
} elseif (isset($_POST['page'])) {
$page = $_POST['page'];
if (isset($_REQUEST['page'])) {
$page = $_REQUEST['page'];
} else {
$page = 'front';
}