From 30db97cbac97aef381bdf24a8d7b85cecfac9493 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 24 Jun 2020 14:35:49 -0700 Subject: [PATCH] A PHP module check (similar to the one during installation) has been added to the PHPInfo page to quickly detect any missing modules after one migrates e107 to another PHP configuration. --- e107_admin/phpinfo.php | 28 +++++++++++++++++++- e107_languages/English/admin/lan_phpinfo.php | 3 ++- install.php | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/e107_admin/phpinfo.php b/e107_admin/phpinfo.php index 66b852823..7ac521f76 100644 --- a/e107_admin/phpinfo.php +++ b/e107_admin/phpinfo.php @@ -40,6 +40,31 @@ $phpinfo = preg_replace('/]*>/i', ' function_exists('exif_imagetype'), 'url'=> 'http://php.net/manual/en/book.exif.php'), + 'gd' => array('label'=> 'GD Library', 'status' => function_exists('gd_info'), 'url'=> 'http://php.net/manual/en/book.image.php'), + 'mb' => array('label'=> 'MB String Library', 'status' => function_exists('mb_strimwidth'), 'url'=> 'http://php.net/manual/en/book.mbstring.php'), + 'pdo' => array('label'=> "PDO (MySQL)", 'status' => extension_loaded('pdo_mysql'), 'url'=> 'https://php.net/manual/en/book.pdo.php'), + 'xml' => array('label'=> "XML Extension", 'status' => function_exists('utf8_encode') && class_exists('DOMDocument', false), 'url'=> 'http://php.net/manual/en/ref.xml.php'), +); + +foreach($extensionCheck as $var) +{ + if($var['status'] !== true) + { + $erTitle = deftrue('PHP_LAN_7', "PHP Configuration Issue(s) Found:"); + $def = deftrue('PHP_LAN_8', "[x] is missing from the PHP configuration and need to be installed."); + $message = $tp->lanVars($def,$var['label'],true); + + $mes->setIcon('fa-hand-stop-o', E_MESSAGE_ERROR)->setTitle($erTitle,E_MESSAGE_ERROR)->addError($message." ".ADMIN_INFO_ICON." "); + + } + +} + + + $security_risks = array( "allow_url_fopen" => PHP_LAN_1, "allow_url_include" => PHP_LAN_2, @@ -74,6 +99,7 @@ $security_risks = array( ob_end_clean(); + if(deftrue('e_DEBUG')) { $mes->addDebug("Session ID: ".session_id()); @@ -81,4 +107,4 @@ if(deftrue('e_DEBUG')) $ns->tablerender("PHPInfo", $mes->render(). $phpinfo); require_once("footer.php"); -?> + diff --git a/e107_languages/English/admin/lan_phpinfo.php b/e107_languages/English/admin/lan_phpinfo.php index bead1ad98..581d88aab 100644 --- a/e107_languages/English/admin/lan_phpinfo.php +++ b/e107_languages/English/admin/lan_phpinfo.php @@ -16,4 +16,5 @@ define("PHP_LAN_3", "On a production server, it is better to disable the display define("PHP_LAN_4", "Disabling this will hide your PHP version from browsers."); define("PHP_LAN_5", "This is a security risk and should be disabled."); define("PHP_LAN_6", "[b]session.save_path[/b] is not writable! That can cause major issues with your site."); -?> +define("PHP_LAN_7", "PHP Configuration Issue(s) Found:"); +define("PHP_LAN_8", "[x] is missing and need to be installed."); diff --git a/install.php b/install.php index 48cfe57c9..0c8eb9348 100644 --- a/install.php +++ b/install.php @@ -998,7 +998,7 @@ class e_install $extensionCheck = array( - 'pdo' => array('label'=> "PDO (MySQL)", 'status' => extension_loaded('pdo_mysql'), 'url'=> ''), + 'pdo' => array('label'=> "PDO (MySQL)", 'status' => extension_loaded('pdo_mysql'), 'url'=> 'https:/php.net/manual/en/book.pdo.php'), 'xml' => array('label'=> LANINS_050, 'status' => function_exists('utf8_encode') && class_exists('DOMDocument', false), 'url'=> 'http://php.net/manual/en/ref.xml.php'), 'exif' => array('label'=> LANINS_048, 'status' => function_exists('exif_imagetype'), 'url'=> 'http://php.net/manual/en/book.exif.php'), 'curl' => array('label'=> 'Curl Library', 'status' => function_exists('curl_version'), 'url'=> 'http://php.net/manual/en/book.curl.php'),