From cccfa9c251810e01919d3ea0eb7fe3f23eb321cb Mon Sep 17 00:00:00 2001 From: kink Date: Thu, 23 Jan 2003 20:50:22 +0000 Subject: [PATCH] Version check fixes. 1) the required version is minimum 4.0.4 so the 4.0.2 check is always passed. 2) make the check in prefs.php also work when new php versions are released %-) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4459 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/abook_ldap_server.php | 18 +++++------------- functions/prefs.php | 7 ++++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/functions/abook_ldap_server.php b/functions/abook_ldap_server.php index 75a3105c..19143148 100644 --- a/functions/abook_ldap_server.php +++ b/functions/abook_ldap_server.php @@ -157,18 +157,10 @@ class abook_ldap_server extends addressbook_backend { return false; } - /* Do the search. Use improved ldap_search() if PHP version is - * 4.0.2 or newer. */ - if(sqCheckPHPVersion(4, 0, 2)) { - $sret = @ldap_search($this->linkid, $this->basedn, $expression, - array('dn', 'o', 'ou', 'sn', 'givenname', - 'cn', 'mail', 'telephonenumber'), - 0, $this->maxrows, $this->timeout); - } else { - $sret = @ldap_search($this->linkid, $this->basedn, $expression, - array('dn', 'o', 'ou', 'sn', 'givenname', - 'cn', 'mail', 'telephonenumber')); - } + $sret = @ldap_search($this->linkid, $this->basedn, $expression, + array('dn', 'o', 'ou', 'sn', 'givenname', + 'cn', 'mail', 'telephonenumber'), + 0, $this->maxrows, $this->timeout); /* Should get error from server using the ldap_error() function, * but it only exist in the PHP LDAP documentation. */ @@ -264,4 +256,4 @@ class abook_ldap_server extends addressbook_backend { * * Careful with this -- it could get quite large for big sites. */ } -?> \ No newline at end of file +?> diff --git a/functions/prefs.php b/functions/prefs.php index 47e854f2..9b35834a 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -18,12 +18,13 @@ 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) || - substr( phpversion(), 0, 3 ) == '4.1' || - substr( phpversion(), 0, 3 ) == '4.2' || - (substr( phpversion(), 0, 3 ) == '4.0' && empty($rg))) { + check_php_version(4,1) || + empty($rg) + ) { $prefs_are_cached = false; $prefs_cache = array(); } -- 2.25.1