Bladeren bron

We don't support PHP 4.0.x anymore; update the docs to reflect that and
remove 4.0.x legacy code.

Thijs Kinkhorst 21 jaren geleden
bovenliggende
commit
644750922c
9 gewijzigde bestanden met toevoegingen van 18 en 80 verwijderingen
  1. 1 0
      ChangeLog
  2. 1 1
      INSTALL
  3. 1 1
      UPGRADE
  4. 1 0
      functions/addressbook.php
  5. 9 63
      functions/global.php
  6. 1 2
      functions/imap_asearch.php
  7. 1 6
      functions/prefs.php
  8. 1 5
      plugins/listcommands/setup.php
  9. 2 2
      src/configtest.php

+ 1 - 0
ChangeLog

@@ -24,6 +24,7 @@ Version 1.5.1 -- CVS
     functionality added to core in 1.5.0.
     functionality added to core in 1.5.0.
   - Fix test for LOGINDISABLED, should only test when the auth_mech actually
   - Fix test for LOGINDISABLED, should only test when the auth_mech actually
     is 'login'.
     is 'login'.
+  - Update required PHP version to 4.1.0, and remove PHP 4.0.x legacy code.
 
 
 Version 1.5.0
 Version 1.5.0
 --------------------
 --------------------

+ 1 - 1
INSTALL

@@ -18,7 +18,7 @@ Table of Contents:
   to run as CGI under Apache. How you end up doing this is up to you
   to run as CGI under Apache. How you end up doing this is up to you
   (your mileage may vary).
   (your mileage may vary).
 
 
-  You will need at least PHP v4.0.6. If you need to upgrade please go
+  You will need at least PHP v4.1.0. If you need to upgrade please go
   ahead and install it now.
   ahead and install it now.
 
 
 a. Obtaining and compiling PHP4
 a. Obtaining and compiling PHP4

+ 1 - 1
UPGRADE

@@ -7,7 +7,7 @@ using a previous version (0.1 or 0.2), it is suggested that you just start
 from scratch and configure your settings as if it was your first install.
 from scratch and configure your settings as if it was your first install.
 
 
 NOTE: The new plugin architecture required the use of some functions which
 NOTE: The new plugin architecture required the use of some functions which
-are not in all versions of PHP4. You will need at least PHP 4.0.6. If you
+are not in all versions of PHP4. You will need at least PHP 4.1.0. If you
 need to upgrade please go ahead and install the latest release version of
 need to upgrade please go ahead and install the latest release version of
 PHP4.
 PHP4.
 
 

+ 1 - 0
functions/addressbook.php

@@ -125,6 +125,7 @@ function addressbook_init($showerr = true, $onlylocal = false) {
 /*
 /*
  *   Had to move this function outside of the Addressbook Class
  *   Had to move this function outside of the Addressbook Class
  *   PHP 4.0.4 Seemed to be having problems with inline functions.
  *   PHP 4.0.4 Seemed to be having problems with inline functions.
+ *   Note: this can return now since we don't support 4.0.4 anymore.
  */    
  */    
 function addressbook_cmp($a,$b) {
 function addressbook_cmp($a,$b) {
 
 

+ 9 - 63
functions/global.php

@@ -40,28 +40,6 @@ $uid_support = true;
 
 
 sqsession_is_active();
 sqsession_is_active();
 
 
-/* convert old-style superglobals to current method
- * this is executed if you are running PHP 4.0.x.
- * it is run via a require_once directive in validate.php 
- * and redirect.php. Patch submitted by Ray Black.
- */ 
-
-if ( !check_php_version(4,1) ) {
-  global $_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_SERVER, $_SESSION;
-  global $HTTP_COOKIE_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES, $HTTP_GET_VARS,
-         $HTTP_POST_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $PHP_SELF;
-  $_COOKIE  =& $HTTP_COOKIE_VARS;
-  $_ENV     =& $HTTP_ENV_VARS;
-  $_FILES   =& $HTTP_POST_FILES;
-  $_GET     =& $HTTP_GET_VARS;
-  $_POST    =& $HTTP_POST_VARS;
-  $_SERVER  =& $HTTP_SERVER_VARS;
-  $_SESSION =& $HTTP_SESSION_VARS;
-  if (!isset($PHP_SELF) || empty($PHP_SELF)) {
-     $PHP_SELF =  $HTTP_SERVER_VARS['PHP_SELF'];
-  }
-}
-
 /* if running with magic_quotes_gpc then strip the slashes
 /* if running with magic_quotes_gpc then strip the slashes
    from POST and GET global arrays */
    from POST and GET global arrays */
 
 
@@ -148,13 +126,8 @@ function sqsession_register ($var, $name) {
 
 
     sqsession_is_active();
     sqsession_is_active();
 
 
-    if ( !check_php_version(4,1) ) {
-        global $HTTP_SESSION_VARS;
-        $HTTP_SESSION_VARS[$name] = $var;
-    }
-    else {
-        $_SESSION["$name"] = $var; 
-    }
+    $_SESSION["$name"] = $var; 
+    
     session_register("$name");
     session_register("$name");
 }
 }
 
 
@@ -167,13 +140,8 @@ function sqsession_unregister ($name) {
 
 
     sqsession_is_active();
     sqsession_is_active();
 
 
-    if ( !check_php_version(4,1) ) {
-        global $HTTP_SESSION_VARS;
-        unset($HTTP_SESSION_VARS[$name]);
-    }
-    else {
-        unset($_SESSION[$name]);
-    }
+    unset($_SESSION[$name]);
+    
     session_unregister("$name");
     session_unregister("$name");
 }
 }
 
 
@@ -186,17 +154,11 @@ function sqsession_unregister ($name) {
 function sqsession_is_registered ($name) {
 function sqsession_is_registered ($name) {
     $test_name = &$name;
     $test_name = &$name;
     $result = false;
     $result = false;
-    if ( !check_php_version(4,1) ) {
-        global $HTTP_SESSION_VARS;
-        if (isset($HTTP_SESSION_VARS[$test_name])) {
-            $result = true;
-        }
-    }
-    else {
-        if (isset($_SESSION[$test_name])) {
-            $result = true;
-        }
+    
+    if (isset($_SESSION[$test_name])) {
+        $result = true;
     }
     }
+    
     return $result;
     return $result;
 }
 }
 
 
@@ -232,17 +194,6 @@ define('SQ_FORM',6);
  */
  */
 function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) {
 function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) {
 
 
-    if ( !check_php_version(4,1) ) {
-        global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, 
-               $HTTP_SERVER_VARS, $HTTP_SESSION_VARS;
-
-        $_COOKIE  =& $HTTP_COOKIE_VARS;
-        $_GET     =& $HTTP_GET_VARS;
-        $_POST    =& $HTTP_POST_VARS;
-        $_SERVER  =& $HTTP_SERVER_VARS;
-        $_SESSION =& $HTTP_SESSION_VARS;
-    }
-
     /* NOTE: DO NOT enclose the constants in the switch
     /* NOTE: DO NOT enclose the constants in the switch
        statement with quotes. They are constant values,
        statement with quotes. They are constant values,
        enclosing them in quotes will cause them to evaluate
        enclosing them in quotes will cause them to evaluate
@@ -316,12 +267,7 @@ function sqsession_destroy() {
 
 
     $sessid = session_id();
     $sessid = session_id();
     if (!empty( $sessid )) {
     if (!empty( $sessid )) {
-        if ( !check_php_version(4,1) ) {
-            global $HTTP_SESSION_VARS;
-            $HTTP_SESSION_VARS = array();
-        } else {
-            $_SESSION = array();
-        }
+        $_SESSION = array();
         @session_destroy();
         @session_destroy();
     }
     }
 
 

+ 1 - 2
functions/imap_asearch.php

@@ -112,8 +112,7 @@ function sqimap_asearch_error_box($response, $query, $message, $link = '')
 {
 {
 	global $imap_error_titles;
 	global $imap_error_titles;
 
 
-	//if (!array_key_exists($response, $imap_error_titles))	//php 4.0.6 compatibility
-	if (!in_array($response, array_keys($imap_error_titles)))
+	if (!array_key_exists($response, $imap_error_titles))
 		$title = _("ERROR : Unknown imap response.");
 		$title = _("ERROR : Unknown imap response.");
 	else
 	else
 		$title = $imap_error_titles[$response];
 		$title = $imap_error_titles[$response];

+ 1 - 6
functions/prefs.php

@@ -18,14 +18,9 @@ require_once(SM_PATH . 'functions/global.php');
 sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION );
 sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION );
 sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION );
 sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION );
 
 
-$rg = ini_get('register_globals');
-
-/* if php version >= 4.1 OR (4.0 AND $rg = off) */
 if ( !sqsession_is_registered('prefs_are_cached') ||
 if ( !sqsession_is_registered('prefs_are_cached') ||
      !isset( $prefs_cache) ||
      !isset( $prefs_cache) ||
-     !is_array( $prefs_cache) ||
-     check_php_version(4,1) ||
-     empty($rg)
+     !is_array( $prefs_cache) 
    ) {
    ) {
     $prefs_are_cached = false;
     $prefs_are_cached = false;
     $prefs_cache = array();
     $prefs_cache = array();

+ 1 - 5
plugins/listcommands/setup.php

@@ -44,11 +44,7 @@ function plugin_listcommands_menu() {
     foreach ($message->rfc822_header->mlist as $cmd => $actions) {
     foreach ($message->rfc822_header->mlist as $cmd => $actions) {
 
 
 	/* I don't know this action... skip it */
 	/* I don't know this action... skip it */
-	if ( ( function_exists('array_key_exists') &&       /* PHP >= 4.1 */
-               !array_key_exists($cmd, $fieldsdescr) ) ||
-             ( function_exists('key_exists') && 
-               !key_exists($cmd, $fieldsdescr) )            /* PHP == 4.0.6 */
-        ) {
+	if ( !array_key_exists($cmd, $fieldsdescr) ) {
             continue;
             continue;
         }
         }
 
 

+ 2 - 2
src/configtest.php

@@ -72,8 +72,8 @@ echo '<p>SquirrelMail version: '.$version.'<br />'.
 
 
 echo "Checking PHP configuration...<br />\n";
 echo "Checking PHP configuration...<br />\n";
 
 
-if(!check_php_version(4,0,6)) {
-    do_err('Insufficient PHP version: '. PHP_VERSION . '! Minimum required: 4.0.6');
+if(!check_php_version(4,1,0)) {
+    do_err('Insufficient PHP version: '. PHP_VERSION . '! Minimum required: 4.1.0');
 }
 }
 
 
 echo $IND . 'PHP version '.PHP_VERSION.' OK.<br />';
 echo $IND . 'PHP version '.PHP_VERSION.' OK.<br />';