Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
authorDan
Wed, 09 Jan 2008 22:13:42 -0500
changeset 443 a48b72312f6d
parent 442 4da2dfc28728
child 444 4e26d6079910
Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
includes/common.php
plugins/SpecialAdmin.php
--- a/includes/common.php	Tue Jan 01 22:50:49 2008 -0500
+++ b/includes/common.php	Wed Jan 09 22:13:42 2008 -0500
@@ -60,7 +60,16 @@
 $_starttime = microtime_float();
 
 // Verbose error reporting
-error_reporting(E_ALL & ~E_STRICT);
+if ( defined('E_STRICT') )
+{
+  // PHP5, PHP6
+  error_reporting(E_ALL & ~E_STRICT);
+}
+else
+{
+  // PHP4
+  error_reporting(E_ALL);
+}
 
 //
 // Determine the location of Enano as an absolute path.
--- a/plugins/SpecialAdmin.php	Tue Jan 01 22:50:49 2008 -0500
+++ b/plugins/SpecialAdmin.php	Wed Jan 09 22:13:42 2008 -0500
@@ -69,6 +69,22 @@
           <p>If you borked something up, or if you\'re done testing, you can <a href="' . makeUrlNS('Special', 'DemoReset', false, true) . '">reset this site</a>. The site is reset automatically once every two hours. When a reset is performed, all custom modifications to the site are lost and replaced with default values.</p>';
   }
   
+  // If we're on PHP4, warn the user
+  // Enano is not supported on PHP4 after December 31, 2007.
+  if ( version_compare(PHP_VERSION, '5.0.0', '<') )
+  {
+    echo '<div class="warning-box">
+            <b>Your server is running PHP ' . PHP_VERSION . '.</b><br />
+            As of December 31, 2007, servers running the PHP 4.x interpreter are not eligible for support on the Enano forums. While you
+            may be able to obtain support elsewhere, all official Enano support channels do not provide any type of support for servers
+            running this outdated and vulnerable version of PHP.<br />
+            <br />
+            This notice will not show if PHP 5.0.0 or later is detected. You may want to ask your web host to upgrade their PHP
+            installation. If you\'re refused, point them to <a href="http://gophp5.org/">GoPHP5.org</a> and explain that they are opening
+            themselves to security problems by not upgrading.
+          </div>';
+  }
+  
   // Check for the installer scripts
   if( ( file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql') ) && !defined('ENANO_DEMO_MODE') )
   {