From 84e9690f0275d7bc8434fa7d00a0c4eef2ba00f5 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 20 Feb 2026 06:17:21 +0000 Subject: [PATCH] updates error handling --- assets/css/custom.css | 5 +++++ index.php | 40 ++++++++++++++++++++++++++++++++-------- installation/index.php | 5 +++++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/assets/css/custom.css b/assets/css/custom.css index 03275d0..ea58ee6 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -246,6 +246,8 @@ body { padding: 2rem; transition: all 0.3s; min-height: 100vh; + display: flex; + flex-direction: column; } [dir="rtl"] .main-content { @@ -296,6 +298,7 @@ body { display: flex; justify-content: space-between; align-items: center; + flex-shrink: 0; } /* UI Components */ @@ -332,6 +335,8 @@ body { .main-footer { background: transparent; color: var(--text-muted); + margin-top: auto; + flex-shrink: 0; } .main-footer .border-top { diff --git a/index.php b/index.php index eea9493..5130a2a 100644 --- a/index.php +++ b/index.php @@ -2,10 +2,26 @@ declare(strict_types=1); // Sessions setup -if (!is_dir(__DIR__ . '/sessions')) { - mkdir(__DIR__ . '/sessions', 0777, true); +$sessions_dir = __DIR__ . '/sessions'; +if (!is_dir($sessions_dir)) { + @mkdir($sessions_dir, 0777, true); +} +if (is_writable($sessions_dir)) { + session_save_path($sessions_dir); +} + +// Check for required extensions +$required_extensions = ['pdo', 'pdo_mysql', 'curl', 'json']; +$missing_extensions = []; +foreach ($required_extensions as $ext) { + if (!extension_loaded($ext)) { + $missing_extensions[] = $ext; + } +} + +if (!empty($missing_extensions)) { + die("Error: The following PHP extensions are required but missing: " . implode(', ', $missing_extensions) . ". Please contact your hosting provider to enable them."); } -session_save_path(__DIR__ . '/sessions'); // Enhanced session security and iframe compatibility if ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) { @@ -37,9 +53,15 @@ $lang = $_SESSION['lang']; $dir = ($lang === 'ar') ? 'rtl' : 'ltr'; // Licensing Middleware -$is_activated = LicenseService::isActivated(); -$trial_days = LicenseService::getTrialRemainingDays(); -$can_access = LicenseService::canAccess(); +try { + $is_activated = LicenseService::isActivated(); + $trial_days = LicenseService::getTrialRemainingDays(); + $can_access = LicenseService::canAccess(); +} catch (PDOException $e) { + die("Database Connection Error: " . $e->getMessage() . "

Please check your db/config.php settings."); +} catch (Exception $e) { + die("Application Error: " . $e->getMessage()); +} $page = $_GET['page'] ?? 'dashboard'; if (!$can_access && $page !== 'activate') { @@ -11255,8 +11277,10 @@ document.addEventListener('DOMContentLoaded', function() { diff --git a/installation/index.php b/installation/index.php index 5b7a54f..26701a8 100644 --- a/installation/index.php +++ b/installation/index.php @@ -23,6 +23,11 @@ if ($step === 1) { 'status' => extension_loaded('pdo_mysql'), 'current' => extension_loaded('pdo_mysql') ? 'Loaded' : 'Missing' ], + 'curl' => [ + 'name' => 'cURL Extension (Required for Licensing)', + 'status' => extension_loaded('curl'), + 'current' => extension_loaded('curl') ? 'Loaded' : 'Missing' + ], 'config_writable' => [ 'name' => 'db/config.php Writable', 'status' => is_writable(__DIR__ . '/../db/config.php'),