Reorganizes includes and helpers folders

main
Yasen Pramatarov 2025-01-04 18:37:48 +02:00
parent 608946ddee
commit 4bfae911db
5 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,17 @@
<?php
// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Include Messages class
require_once __DIR__ . '/../classes/messages.php';
// Initialize messages array
$messages = [];
// Get any flash messages from previous requests
$flash_messages = Messages::getFlash();
if (!empty($flash_messages)) {
$messages = array_merge($messages, $flash_messages);
}

View File

@ -16,9 +16,15 @@
ob_start(); ob_start();
// sanitize all input vars that may end up in URLs or forms // sanitize all input vars that may end up in URLs or forms
require '../app/helpers/sanitize.php'; require '../app/includes/sanitize.php';
require '../app/helpers/errors.php'; require '../app/includes/errors.php';
// Include Messages class
require_once '../app/classes/messages.php';
// Initialize variables for feedback messages
$messages = [];
// error reporting, comment out in production // error reporting, comment out in production
ini_set('display_errors', 1); ini_set('display_errors', 1);
@ -97,7 +103,7 @@ if ( !isset($_COOKIE['username']) && ($page !== 'login' && $page !== 'register')
// connect to db of Jilo Web // connect to db of Jilo Web
require '../app/classes/database.php'; require '../app/classes/database.php';
require '../app/helpers/database.php'; require '../app/includes/database.php';
$response = connectDB($config); $response = connectDB($config);
if ($response['db'] === null) { if ($response['db'] === null) {
$error .= $response['error']; $error .= $response['error'];
@ -197,6 +203,8 @@ if ($page == 'logout') {
$server_status = $serverObject->getServerStatus($server_host, $server_port, $server_endpoint); $server_status = $serverObject->getServerStatus($server_host, $server_port, $server_endpoint);
if (!$server_status) { if (!$server_status) {
$error = 'The Jilo Server is not running. Some data may be old and incorrect.'; $error = 'The Jilo Server is not running. Some data may be old and incorrect.';
Messages::get('SECURITY', 'RATE_LIMIT_INFO');
Messages::render('SECURITY', 'RATE_LIMIT_INFO');
} }
} }