- check for required extensions at startup

- die hard if the php version is too low (otherwise syntax errors will occur)
This commit is contained in:
Sarjuuk
2014-11-09 20:20:11 +01:00
parent 9b281f45cb
commit ba151fefcd

View File

@@ -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 <b>'.$r."</b> was not found. Please see if it exists, using <i>php -m</i>\n\n";
if (version_compare(PHP_VERSION, '5.5.0') < 0)
$error .= 'PHP Version <b>5.5.0</b> or higher required! Your version is <b>'.PHP_VERSION."</b>.\nCore functions are unavailable!";
if ($error)
die('<pre>'.$error.'</pre>');
// 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)