From ba151fefcd81a9d4402a49e48aee26085d65cfe6 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 9 Nov 2014 20:20:11 +0100 Subject: [PATCH] - check for required extensions at startup - die hard if the php version is too low (otherwise syntax errors will occur) --- index.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 9a008328..107f8674 100644 --- a/index.php +++ b/index.php @@ -9,16 +9,21 @@ if (!file_exists('config/config.php')) exit; } +$reqExt = ['SimpleXML', 'gd', 'mysqli', 'mbstring', 'mcrypt']; +$error = ''; +foreach ($reqExt as $r) + if (!extension_loaded($r)) + $error .= 'Required Extension '.$r." was not found. Please see if it exists, using php -m\n\n"; + +if (version_compare(PHP_VERSION, '5.5.0') < 0) + $error .= 'PHP Version 5.5.0 or higher required! Your version is '.PHP_VERSION.".\nCore functions are unavailable!"; + +if ($error) + die('
'.$error.'
'); + // include all necessities, set up basics require 'includes/kernel.php'; -if (version_compare(PHP_VERSION, '5.5.0') <= 0) -{ - if (User::isInGroup(U_GROUP_EMPLOYEE)) - Util::addNote(U_GROUP_EMPLOYEE, 'PHP Version 5.5.0 or higher required! Your version is '.PHP_VERSION."[br]Core functions are unavailable!"); - else - (new GenericPage)->maintenance(); -} $altClass = ''; switch ($pageCall)