From abd74f7defe104b7d691be5670f59a46b0b7d025 Mon Sep 17 00:00:00 2001 From: kink Date: Thu, 11 Mar 2004 19:34:43 +0000 Subject: [PATCH 1/1] We don't support PHP 4.0.x anymore; update the docs to reflect that and remove 4.0.x legacy code. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6766 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + INSTALL | 2 +- UPGRADE | 2 +- functions/addressbook.php | 1 + functions/global.php | 72 +++++----------------------------- functions/imap_asearch.php | 3 +- functions/prefs.php | 7 +--- plugins/listcommands/setup.php | 6 +-- src/configtest.php | 4 +- 9 files changed, 18 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index ede4d78b..05185373 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ Version 1.5.1 -- CVS functionality added to core in 1.5.0. - Fix test for LOGINDISABLED, should only test when the auth_mech actually is 'login'. + - Update required PHP version to 4.1.0, and remove PHP 4.0.x legacy code. Version 1.5.0 -------------------- diff --git a/INSTALL b/INSTALL index 04ca7186..b6e59660 100644 --- a/INSTALL +++ b/INSTALL @@ -18,7 +18,7 @@ Table of Contents: to run as CGI under Apache. How you end up doing this is up to you (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. a. Obtaining and compiling PHP4 diff --git a/UPGRADE b/UPGRADE index d77082c5..aadc72b0 100644 --- a/UPGRADE +++ b/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. 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 PHP4. diff --git a/functions/addressbook.php b/functions/addressbook.php index 51151df3..ef757cf6 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -125,6 +125,7 @@ function addressbook_init($showerr = true, $onlylocal = false) { /* * Had to move this function outside of the Addressbook Class * 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) { diff --git a/functions/global.php b/functions/global.php index 0c19df88..84db5ec5 100644 --- a/functions/global.php +++ b/functions/global.php @@ -40,28 +40,6 @@ $uid_support = true; 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 from POST and GET global arrays */ @@ -148,13 +126,8 @@ function sqsession_register ($var, $name) { 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"); } @@ -167,13 +140,8 @@ function sqsession_unregister ($name) { 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"); } @@ -186,17 +154,11 @@ function sqsession_unregister ($name) { function sqsession_is_registered ($name) { $test_name = &$name; $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; } @@ -232,17 +194,6 @@ define('SQ_FORM',6); */ 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 statement with quotes. They are constant values, enclosing them in quotes will cause them to evaluate @@ -316,12 +267,7 @@ function sqsession_destroy() { $sessid = session_id(); if (!empty( $sessid )) { - if ( !check_php_version(4,1) ) { - global $HTTP_SESSION_VARS; - $HTTP_SESSION_VARS = array(); - } else { - $_SESSION = array(); - } + $_SESSION = array(); @session_destroy(); } diff --git a/functions/imap_asearch.php b/functions/imap_asearch.php index 23924e63..4222d11a 100644 --- a/functions/imap_asearch.php +++ b/functions/imap_asearch.php @@ -112,8 +112,7 @@ function sqimap_asearch_error_box($response, $query, $message, $link = '') { 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."); else $title = $imap_error_titles[$response]; diff --git a/functions/prefs.php b/functions/prefs.php index 5876b86c..112d7572 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -18,14 +18,9 @@ require_once(SM_PATH . 'functions/global.php'); sqgetGlobalVar('prefs_cache', $prefs_cache, 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') || !isset( $prefs_cache) || - !is_array( $prefs_cache) || - check_php_version(4,1) || - empty($rg) + !is_array( $prefs_cache) ) { $prefs_are_cached = false; $prefs_cache = array(); diff --git a/plugins/listcommands/setup.php b/plugins/listcommands/setup.php index 8d816a8d..68643796 100644 --- a/plugins/listcommands/setup.php +++ b/plugins/listcommands/setup.php @@ -44,11 +44,7 @@ function plugin_listcommands_menu() { foreach ($message->rfc822_header->mlist as $cmd => $actions) { /* 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; } diff --git a/src/configtest.php b/src/configtest.php index b3f6324e..bc0b9528 100644 --- a/src/configtest.php +++ b/src/configtest.php @@ -72,8 +72,8 @@ echo '

SquirrelMail version: '.$version.'
'. echo "Checking PHP configuration...
\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.
'; -- 2.25.1