Jelajahi Sumber

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 %-)

Thijs Kinkhorst 22 tahun lalu
induk
melakukan
e4adb83265
2 mengubah file dengan 9 tambahan dan 16 penghapusan
  1. 5 13
      functions/abook_ldap_server.php
  2. 4 3
      functions/prefs.php

+ 5 - 13
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. */
 }
-?>
+?>

+ 4 - 3
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();
 }