Commit 0f8a8317aef85034207100c06b1fdbe5fb526ca5

Authored by Megan Watson
1 parent 56bb238d

KTC-378

"A Pear fatal error when attempting to create a new authentication provider"
Fixed. Made the isError function static as it inherits from PEAR::isError which was made static.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8112 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 80 additions and 80 deletions
thirdparty/pear/Net/LDAP.php
@@ -31,7 +31,7 @@ require_once('LDAP/Search.php'); @@ -31,7 +31,7 @@ require_once('LDAP/Search.php');
31 31
32 32
33 /** 33 /**
34 - * Error constants for errors that are not LDAP errors 34 + * Error constants for errors that are not LDAP errors
35 */ 35 */
36 36
37 define ('NET_LDAP_ERROR', 1000); 37 define ('NET_LDAP_ERROR', 1000);
@@ -89,7 +89,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -89,7 +89,7 @@ define ('NET_LDAP_ERROR', 1000);
89 * @var string 89 * @var string
90 */ 90 */
91 var $_version = "0.6.6"; 91 var $_version = "0.6.6";
92 - 92 +
93 /** 93 /**
94 * Net_LDAP_Schema object 94 * Net_LDAP_Schema object
95 * 95 *
@@ -97,7 +97,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -97,7 +97,7 @@ define ('NET_LDAP_ERROR', 1000);
97 * @var object Net_LDAP_Schema 97 * @var object Net_LDAP_Schema
98 */ 98 */
99 var $_schema = null; 99 var $_schema = null;
100 - 100 +
101 /** 101 /**
102 * Cache for attribute encoding checks 102 * Cache for attribute encoding checks
103 * 103 *
@@ -120,17 +120,17 @@ define ('NET_LDAP_ERROR', 1000); @@ -120,17 +120,17 @@ define ('NET_LDAP_ERROR', 1000);
120 function Net_LDAP($_config = array()) 120 function Net_LDAP($_config = array())
121 { 121 {
122 $this->PEAR('Net_LDAP_Error'); 122 $this->PEAR('Net_LDAP_Error');
123 - 123 +
124 foreach ($_config as $k => $v) { 124 foreach ($_config as $k => $v) {
125 $this->_config[$k] = $v; 125 $this->_config[$k] = $v;
126 } 126 }
127 } 127 }
128 - 128 +
129 /** 129 /**
130 * Creates the initial ldap-object 130 * Creates the initial ldap-object
131 * 131 *
132 * Static function that returns either an error object or the new Net_LDAP object. 132 * Static function that returns either an error object or the new Net_LDAP object.
133 - * Something like a factory. Takes a config array with the needed parameters. 133 + * Something like a factory. Takes a config array with the needed parameters.
134 * 134 *
135 * @access public 135 * @access public
136 * @param array Configuration array 136 * @param array Configuration array
@@ -173,20 +173,20 @@ define ('NET_LDAP_ERROR', 1000); @@ -173,20 +173,20 @@ define ('NET_LDAP_ERROR', 1000);
173 return $this->raiseError("Host not defined in config. {$this->_config['host']}"); 173 return $this->raiseError("Host not defined in config. {$this->_config['host']}");
174 } 174 }
175 175
176 - if (!$this->_link) { 176 + if (!$this->_link) {
177 // there is no good errorcode for this one! I chose 52. 177 // there is no good errorcode for this one! I chose 52.
178 return $this->raiseError("Could not connect to server. ldap_connect failed.", 52); 178 return $this->raiseError("Could not connect to server. ldap_connect failed.", 52);
179 } 179 }
180 // You must set the version and start tls BEFORE binding! 180 // You must set the version and start tls BEFORE binding!
181 - 181 +
182 if ($this->_config['version'] != 2 && Net_LDAP::isError($msg = $this->setLDAPVersion())) { 182 if ($this->_config['version'] != 2 && Net_LDAP::isError($msg = $this->setLDAPVersion())) {
183 return $msg; 183 return $msg;
184 } 184 }
185 - 185 +
186 if ($this->_config['tls'] && Net_LDAP::isError($msg = $this->startTLS())) { 186 if ($this->_config['tls'] && Net_LDAP::isError($msg = $this->startTLS())) {
187 return $msg; 187 return $msg;
188 } 188 }
189 - 189 +
190 if (isset($this->_config['options']) && 190 if (isset($this->_config['options']) &&
191 is_array($this->_config['options']) && 191 is_array($this->_config['options']) &&
192 count($this->_config['options'])) 192 count($this->_config['options']))
@@ -198,7 +198,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -198,7 +198,7 @@ define ('NET_LDAP_ERROR', 1000);
198 } 198 }
199 } 199 }
200 } 200 }
201 - 201 +
202 if (isset($this->_config['dn']) && isset($this->_config['password'])) { 202 if (isset($this->_config['dn']) && isset($this->_config['password'])) {
203 $bind = @ldap_bind($this->_link, $this->_config['dn'], $this->_config['password']); 203 $bind = @ldap_bind($this->_link, $this->_config['dn'], $this->_config['password']);
204 } else { 204 } else {
@@ -223,10 +223,10 @@ define ('NET_LDAP_ERROR', 1000); @@ -223,10 +223,10 @@ define ('NET_LDAP_ERROR', 1000);
223 * @return mixed Net_LDAP_Error or true 223 * @return mixed Net_LDAP_Error or true
224 * @see $_config 224 * @see $_config
225 */ 225 */
226 -  
227 - function reBind ($dn = null, $password = null) 226 +
  227 + function reBind ($dn = null, $password = null)
228 { 228 {
229 - 229 +
230 if ($dn && $password ) { 230 if ($dn && $password ) {
231 $bind = @ldap_bind($this->_link, $dn, $password); 231 $bind = @ldap_bind($this->_link, $dn, $password);
232 } else { 232 } else {
@@ -238,7 +238,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -238,7 +238,7 @@ define ('NET_LDAP_ERROR', 1000);
238 } 238 }
239 return true; 239 return true;
240 } 240 }
241 - 241 +
242 /** 242 /**
243 * Starts an encrypted session 243 * Starts an encrypted session
244 * 244 *
@@ -252,13 +252,13 @@ define ('NET_LDAP_ERROR', 1000); @@ -252,13 +252,13 @@ define ('NET_LDAP_ERROR', 1000);
252 } 252 }
253 return true; 253 return true;
254 } 254 }
255 - 255 +
256 /** 256 /**
257 * alias function of startTLS() for perl-ldap interface 257 * alias function of startTLS() for perl-ldap interface
258 - * 258 + *
259 * @see startTLS() 259 * @see startTLS()
260 */ 260 */
261 - function start_tls() 261 + function start_tls()
262 { 262 {
263 $args = func_get_args(); 263 $args = func_get_args();
264 return call_user_func_array(array($this, 'startTLS' ), $args); 264 return call_user_func_array(array($this, 'startTLS' ), $args);
@@ -314,7 +314,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -314,7 +314,7 @@ define ('NET_LDAP_ERROR', 1000);
314 * @access public 314 * @access public
315 * @param mixed string or Net_LDAP_Entry 315 * @param mixed string or Net_LDAP_Entry
316 * @param array 316 * @param array
317 - * @return mixed Net_LDAP_Error or true 317 + * @return mixed Net_LDAP_Error or true
318 */ 318 */
319 function delete($dn, $param = array()) 319 function delete($dn, $param = array())
320 { 320 {
@@ -323,13 +323,13 @@ define ('NET_LDAP_ERROR', 1000); @@ -323,13 +323,13 @@ define ('NET_LDAP_ERROR', 1000);
323 } else { 323 } else {
324 if (!is_string($dn)) { 324 if (!is_string($dn)) {
325 // this is what the server would say: invalid_dn_syntax. 325 // this is what the server would say: invalid_dn_syntax.
326 - return $this->raiseError("$dn not a string nor an entryobject!", 34); 326 + return $this->raiseError("$dn not a string nor an entryobject!", 34);
327 } 327 }
328 } 328 }
329 - 329 +
330 if ($param['recursive'] ) { 330 if ($param['recursive'] ) {
331 $searchresult = @ldap_list($this->_link, $dn, '(objectClass=*)', array()); 331 $searchresult = @ldap_list($this->_link, $dn, '(objectClass=*)', array());
332 - 332 +
333 if ($searchresult) { 333 if ($searchresult) {
334 $entries = @ldap_get_entries($this->_link, $searchresult); 334 $entries = @ldap_get_entries($this->_link, $searchresult);
335 335
@@ -338,19 +338,19 @@ define ('NET_LDAP_ERROR', 1000); @@ -338,19 +338,19 @@ define ('NET_LDAP_ERROR', 1000);
338 if (!$result) { 338 if (!$result) {
339 $errno = @ldap_errno($this->_link); 339 $errno = @ldap_errno($this->_link);
340 return $this->raiseMessage ("Net_LDAP::delete: " . $this->errorMessage($errno), $errno); 340 return $this->raiseMessage ("Net_LDAP::delete: " . $this->errorMessage($errno), $errno);
341 - } 341 + }
342 if(PEAR::isError($result)){ 342 if(PEAR::isError($result)){
343 return $result; 343 return $result;
344 - } 344 + }
345 } 345 }
346 } 346 }
347 } 347 }
348 if (!@ldap_delete($this->_link, $dn)) { 348 if (!@ldap_delete($this->_link, $dn)) {
349 - $error = ldap_errno($this->_link ); 349 + $error = ldap_errno($this->_link );
350 if ($error == 66) { 350 if ($error == 66) {
351 /* entry has subentries */ 351 /* entry has subentries */
352 return $this->raiseError('Net_LDAP::delete: Cound not delete entry ' . $dn . 352 return $this->raiseError('Net_LDAP::delete: Cound not delete entry ' . $dn .
353 - ' because of subentries. Use the recursive param to delete them.'); 353 + ' because of subentries. Use the recursive param to delete them.');
354 } else { 354 } else {
355 return $this->raiseError("Net_LDAP::delete: Could not delete entry " . $dn ." because: ". 355 return $this->raiseError("Net_LDAP::delete: Could not delete entry " . $dn ." because: ".
356 $this->errorMessage($error), $error); 356 $this->errorMessage($error), $error);
@@ -462,7 +462,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -462,7 +462,7 @@ define ('NET_LDAP_ERROR', 1000);
462 } // end foreach($_params['changes'] AS $option => $atrr) { 462 } // end foreach($_params['changes'] AS $option => $atrr) {
463 } // end if (is_array($_params['changes'])) { 463 } // end if (is_array($_params['changes'])) {
464 // everything went fine :) 464 // everything went fine :)
465 - return true; 465 + return true;
466 466
467 /* old broken code see bug#2987 467 /* old broken code see bug#2987
468 if (isset($params['changes'])) { 468 if (isset($params['changes'])) {
@@ -510,7 +510,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -510,7 +510,7 @@ define ('NET_LDAP_ERROR', 1000);
510 // everything went fine :) 510 // everything went fine :)
511 return true; 511 return true;
512 */ 512 */
513 - 513 +
514 } 514 }
515 515
516 /** 516 /**
@@ -520,7 +520,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -520,7 +520,7 @@ define ('NET_LDAP_ERROR', 1000);
520 * $base and $filter may be ommitted. BaseDN and default filter will then be used. 520 * $base and $filter may be ommitted. BaseDN and default filter will then be used.
521 * Params may contain: 521 * Params may contain:
522 * 522 *
523 - * scope: The scope which will be used for searching 523 + * scope: The scope which will be used for searching
524 * base - Just one entry 524 * base - Just one entry
525 * sub - The whole tree 525 * sub - The whole tree
526 * one - Immediately below $base 526 * one - Immediately below $base
@@ -534,41 +534,41 @@ define ('NET_LDAP_ERROR', 1000); @@ -534,41 +534,41 @@ define ('NET_LDAP_ERROR', 1000);
534 * deref: By default aliases are dereferenced to locate the base object for the search, but not when 534 * deref: By default aliases are dereferenced to locate the base object for the search, but not when
535 * searching subordinates of the base object. This may be changed by specifying one of the 535 * searching subordinates of the base object. This may be changed by specifying one of the
536 * following values: 536 * following values:
537 - * 537 + *
538 * never - Do not dereference aliases in searching or in locating the base object of the search. 538 * never - Do not dereference aliases in searching or in locating the base object of the search.
539 - * search - Dereference aliases in subordinates of the base object in searching, but not in  
540 - * locating the base object of the search. 539 + * search - Dereference aliases in subordinates of the base object in searching, but not in
  540 + * locating the base object of the search.
541 * find 541 * find
542 * always 542 * always
543 * 543 *
544 * @access public 544 * @access public
545 - * @param string LDAP searchbase 545 + * @param string LDAP searchbase
546 * @param string LDAP search filter 546 * @param string LDAP search filter
547 * @param array Array of options 547 * @param array Array of options
548 * @return object mixed Net_LDAP_Search or Net_LDAP_Error 548 * @return object mixed Net_LDAP_Search or Net_LDAP_Error
549 */ 549 */
550 function search($base = null, $filter = null, $params = array()) 550 function search($base = null, $filter = null, $params = array())
551 - { 551 + {
552 if (is_null($base)) { 552 if (is_null($base)) {
553 $base = $this->_config['base']; 553 $base = $this->_config['base'];
554 } 554 }
555 if (is_null($filter)) { 555 if (is_null($filter)) {
556 $filter = $this->_config['filter']; 556 $filter = $this->_config['filter'];
557 - }  
558 - 557 + }
  558 +
559 /* setting searchparameters */ 559 /* setting searchparameters */
560 (isset($params['sizelimit'])) ? $sizelimit = $params['sizelimit'] : $sizelimit = 0; 560 (isset($params['sizelimit'])) ? $sizelimit = $params['sizelimit'] : $sizelimit = 0;
561 (isset($params['timelimit'])) ? $timelimit = $params['timelimit'] : $timelimit = 0; 561 (isset($params['timelimit'])) ? $timelimit = $params['timelimit'] : $timelimit = 0;
562 - (isset($params['attrsonly'])) ? $attrsonly = $params['attrsonly'] : $attrsonly = 0;  
563 - (isset($params['attributes'])) ? $attributes = $params['attributes'] : $attributes = array('');  
564 - 562 + (isset($params['attrsonly'])) ? $attrsonly = $params['attrsonly'] : $attrsonly = 0;
  563 + (isset($params['attributes'])) ? $attributes = $params['attributes'] : $attributes = array('');
  564 +
565 if (!is_array($attributes)) { 565 if (!is_array($attributes)) {
566 $this->raiseError("The param attributes must be an array!"); 566 $this->raiseError("The param attributes must be an array!");
567 } 567 }
568 -  
569 - /* scoping makes searches faster! */ 568 +
  569 + /* scoping makes searches faster! */
570 $scope = (isset($params['scope']) ? $params['scope'] : $this->_config['scope']); 570 $scope = (isset($params['scope']) ? $params['scope'] : $this->_config['scope']);
571 - 571 +
572 switch ($scope) { 572 switch ($scope) {
573 case 'one': 573 case 'one':
574 $search_function = 'ldap_list'; 574 $search_function = 'ldap_list';
@@ -578,9 +578,9 @@ define ('NET_LDAP_ERROR', 1000); @@ -578,9 +578,9 @@ define ('NET_LDAP_ERROR', 1000);
578 break; 578 break;
579 default: 579 default:
580 $search_function = 'ldap_search'; 580 $search_function = 'ldap_search';
581 - }  
582 -  
583 - $search = @call_user_func($search_function, 581 + }
  582 +
  583 + $search = @call_user_func($search_function,
584 $this->_link, 584 $this->_link,
585 $base, 585 $base,
586 $filter, 586 $filter,
@@ -589,22 +589,22 @@ define ('NET_LDAP_ERROR', 1000); @@ -589,22 +589,22 @@ define ('NET_LDAP_ERROR', 1000);
589 $sizelimit, 589 $sizelimit,
590 $timelimit); 590 $timelimit);
591 591
592 - if ($err = ldap_errno($this->_link)) { 592 + if ($err = ldap_errno($this->_link)) {
593 593
594 if ($err == 32) { 594 if ($err == 32) {
595 // Errorcode 32 = no such object, i.e. a nullresult. 595 // Errorcode 32 = no such object, i.e. a nullresult.
596 - return $obj =& new Net_LDAP_Search ($search, $this->_link);  
597 - 596 + return $obj =& new Net_LDAP_Search ($search, $this->_link);
  597 +
598 // Errorcode 4 = sizelimit exeeded. this will be handled better in time... 598 // Errorcode 4 = sizelimit exeeded. this will be handled better in time...
599 //} elseif ($err == 4) { 599 //} elseif ($err == 4) {
600 - // return $obj = & new Net_LDAP_Search ($search, $this->_link);  
601 - 600 + // return $obj = & new Net_LDAP_Search ($search, $this->_link);
  601 +
602 } elseif ($err == 87) { 602 } elseif ($err == 87) {
603 // bad search filter 603 // bad search filter
604 return $this->raiseError($this->errorMessage($err) . "($filter)", $err); 604 return $this->raiseError($this->errorMessage($err) . "($filter)", $err);
605 } else { 605 } else {
606 $msg = "\nParameters:\nBase: $base\nFilter: $filter\nScope: $scope"; 606 $msg = "\nParameters:\nBase: $base\nFilter: $filter\nScope: $scope";
607 - return $this->raiseError($this->errorMessage($err) . $msg, $err); 607 + return $this->raiseError($this->errorMessage($err) . $msg, $err);
608 } 608 }
609 } else { 609 } else {
610 @$obj =& new Net_LDAP_Search($search, $this->_link); 610 @$obj =& new Net_LDAP_Search($search, $this->_link);
@@ -630,16 +630,16 @@ define ('NET_LDAP_ERROR', 1000); @@ -630,16 +630,16 @@ define ('NET_LDAP_ERROR', 1000);
630 } else { 630 } else {
631 $err = @ldap_errno($this->_link); 631 $err = @ldap_errno($this->_link);
632 if ($err) { 632 if ($err) {
633 - $msg = @ldap_err2str($err); 633 + $msg = @ldap_err2str($err);
634 } else { 634 } else {
635 $err = NET_LDAP_ERROR; 635 $err = NET_LDAP_ERROR;
636 $msg = $this->errorMessage($err); 636 $msg = $this->errorMessage($err);
637 - } 637 + }
638 return $this->raiseError($msg, $err); 638 return $this->raiseError($msg, $err);
639 } 639 }
640 } else { 640 } else {
641 return $this->raiseError("Unkown Option requested"); 641 return $this->raiseError("Unkown Option requested");
642 - } 642 + }
643 } else { 643 } else {
644 return $this->raiseError("No LDAP connection"); 644 return $this->raiseError("No LDAP connection");
645 } 645 }
@@ -661,16 +661,16 @@ define ('NET_LDAP_ERROR', 1000); @@ -661,16 +661,16 @@ define ('NET_LDAP_ERROR', 1000);
661 } else { 661 } else {
662 $err = @ldap_errno($this->_link); 662 $err = @ldap_errno($this->_link);
663 if ($err) { 663 if ($err) {
664 - $msg = @ldap_err2str($err); 664 + $msg = @ldap_err2str($err);
665 } else { 665 } else {
666 $err = NET_LDAP_ERROR; 666 $err = NET_LDAP_ERROR;
667 $msg = $this->errorMessage($err); 667 $msg = $this->errorMessage($err);
668 - } 668 + }
669 return $this->raiseError($msg, $err); 669 return $this->raiseError($msg, $err);
670 } 670 }
671 } else { 671 } else {
672 $this->raiseError("Unkown Option requested"); 672 $this->raiseError("Unkown Option requested");
673 - } 673 + }
674 } else { 674 } else {
675 $this->raiseError("No LDAP connection"); 675 $this->raiseError("No LDAP connection");
676 } 676 }
@@ -709,7 +709,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -709,7 +709,7 @@ define ('NET_LDAP_ERROR', 1000);
709 } 709 }
710 710
711 /** 711 /**
712 - * Get the Net_LDAP version. 712 + * Get the Net_LDAP version.
713 * 713 *
714 * Return the Net_LDAP version 714 * Return the Net_LDAP version
715 * 715 *
@@ -721,7 +721,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -721,7 +721,7 @@ define ('NET_LDAP_ERROR', 1000);
721 } 721 }
722 722
723 /** 723 /**
724 - * Tell if a dn already exists 724 + * Tell if a dn already exists
725 * 725 *
726 * @param string 726 * @param string
727 * @return boolean 727 * @return boolean
@@ -731,9 +731,9 @@ define ('NET_LDAP_ERROR', 1000); @@ -731,9 +731,9 @@ define ('NET_LDAP_ERROR', 1000);
731 $dns = explode(",",$dn); 731 $dns = explode(",",$dn);
732 $filter = array_shift($dns); 732 $filter = array_shift($dns);
733 $base= implode($dns,','); 733 $base= implode($dns,',');
734 - //$base = $dn; 734 + //$base = $dn;
735 //$filter = '(objectclass=*)'; 735 //$filter = '(objectclass=*)';
736 - 736 +
737 $result = @ldap_list($this->_link, $base, $filter, array(), 1, 1); 737 $result = @ldap_list($this->_link, $base, $filter, array(), 1, 1);
738 if (ldap_errno($this->_link) == 32) { 738 if (ldap_errno($this->_link) == 32) {
739 return false; 739 return false;
@@ -746,14 +746,14 @@ define ('NET_LDAP_ERROR', 1000); @@ -746,14 +746,14 @@ define ('NET_LDAP_ERROR', 1000);
746 } 746 }
747 return false; 747 return false;
748 } 748 }
749 - 749 +
750 750
751 /** 751 /**
752 * Get a specific entry based on the dn 752 * Get a specific entry based on the dn
753 * 753 *
754 * @param string dn 754 * @param string dn
755 * @param array Array of Attributes to select 755 * @param array Array of Attributes to select
756 - * @return object Net_LDAP_Entry or Net_LDAP_Error 756 + * @return object Net_LDAP_Entry or Net_LDAP_Error
757 */ 757 */
758 function &getEntry($dn, $attr = array('')) 758 function &getEntry($dn, $attr = array(''))
759 { 759 {
@@ -767,7 +767,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -767,7 +767,7 @@ define ('NET_LDAP_ERROR', 1000);
767 } 767 }
768 return $entry; 768 return $entry;
769 } 769 }
770 - 770 +
771 771
772 /** 772 /**
773 * Returns the string for an ldap errorcode. 773 * Returns the string for an ldap errorcode.
@@ -843,7 +843,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -843,7 +843,7 @@ define ('NET_LDAP_ERROR', 1000);
843 0x5f => "LDAP_MORE_RESULTS_TO_RETURN", 843 0x5f => "LDAP_MORE_RESULTS_TO_RETURN",
844 0x60 => "LDAP_CLIENT_LOOP", 844 0x60 => "LDAP_CLIENT_LOOP",
845 0x61 => "LDAP_REFERRAL_LIMIT_EXCEEDED", 845 0x61 => "LDAP_REFERRAL_LIMIT_EXCEEDED",
846 - 1000 => "Unknown Net_LDAP error" 846 + 1000 => "Unknown Net_LDAP error"
847 ); 847 );
848 848
849 return isset($errorMessages[$errorcode]) ? $errorMessages[$errorcode] : $errorMessages[NET_LDAP_ERROR]; 849 return isset($errorMessages[$errorcode]) ? $errorMessages[$errorcode] : $errorMessages[NET_LDAP_ERROR];
@@ -853,10 +853,10 @@ define ('NET_LDAP_ERROR', 1000); @@ -853,10 +853,10 @@ define ('NET_LDAP_ERROR', 1000);
853 * Tell whether value is a Net_LDAP_Error or not 853 * Tell whether value is a Net_LDAP_Error or not
854 * 854 *
855 * @access public 855 * @access public
856 - * @param mixed 856 + * @param mixed
857 * @return boolean 857 * @return boolean
858 */ 858 */
859 - function isError($value) 859 + static function isError($value)
860 { 860 {
861 return (is_a($value, "Net_LDAP_Error") || parent::isError($value)); 861 return (is_a($value, "Net_LDAP_Error") || parent::isError($value));
862 } 862 }
@@ -869,10 +869,10 @@ define ('NET_LDAP_ERROR', 1000); @@ -869,10 +869,10 @@ define ('NET_LDAP_ERROR', 1000);
869 * @param array Array of attributes to search for 869 * @param array Array of attributes to search for
870 * @return object mixed Net_LDAP_Error or Net_LDAP_RootDSE 870 * @return object mixed Net_LDAP_Error or Net_LDAP_RootDSE
871 */ 871 */
872 - function &rootDse($attrs = null) 872 + function &rootDse($attrs = null)
873 { 873 {
874 require_once('Net/LDAP/RootDSE.php'); 874 require_once('Net/LDAP/RootDSE.php');
875 - 875 +
876 if (is_array($attrs) && count($attrs) > 0 ) { 876 if (is_array($attrs) && count($attrs) > 0 ) {
877 $attributes = $attrs; 877 $attributes = $attrs;
878 } else { 878 } else {
@@ -892,19 +892,19 @@ define ('NET_LDAP_ERROR', 1000); @@ -892,19 +892,19 @@ define ('NET_LDAP_ERROR', 1000);
892 892
893 return new Net_LDAP_RootDSE($entry); 893 return new Net_LDAP_RootDSE($entry);
894 } 894 }
895 - 895 +
896 /** 896 /**
897 * alias function of rootDse() for perl-ldap interface 897 * alias function of rootDse() for perl-ldap interface
898 * 898 *
899 * @access public 899 * @access public
900 * @see rootDse() 900 * @see rootDse()
901 */ 901 */
902 - function &root_dse() 902 + function &root_dse()
903 { 903 {
904 $args = func_get_args(); 904 $args = func_get_args();
905 return call_user_func_array(array($this, 'rootDse'), $args); 905 return call_user_func_array(array($this, 'rootDse'), $args);
906 } 906 }
907 - 907 +
908 /** 908 /**
909 * get a schema object 909 * get a schema object
910 * 910 *
@@ -916,7 +916,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -916,7 +916,7 @@ define ('NET_LDAP_ERROR', 1000);
916 function &schema($dn = null) 916 function &schema($dn = null)
917 { 917 {
918 require_once('Net/LDAP/Schema.php'); 918 require_once('Net/LDAP/Schema.php');
919 - 919 +
920 $schema =& new Net_LDAP_Schema(); 920 $schema =& new Net_LDAP_Schema();
921 921
922 if (is_null($dn)) { 922 if (is_null($dn)) {
@@ -931,8 +931,8 @@ define ('NET_LDAP_ERROR', 1000); @@ -931,8 +931,8 @@ define ('NET_LDAP_ERROR', 1000);
931 } 931 }
932 if (is_null($dn)) { 932 if (is_null($dn)) {
933 $dn = 'cn=Subschema'; 933 $dn = 'cn=Subschema';
934 - }  
935 - 934 + }
  935 +
936 // fetch the subschema entry 936 // fetch the subschema entry
937 $result = $this->search($dn, '(objectClass=*)', 937 $result = $this->search($dn, '(objectClass=*)',
938 array('attributes' => array_values($schema->types), 'scope' => 'base')); 938 array('attributes' => array_values($schema->types), 'scope' => 'base'));
@@ -944,7 +944,7 @@ define ('NET_LDAP_ERROR', 1000); @@ -944,7 +944,7 @@ define ('NET_LDAP_ERROR', 1000);
944 if (false === $entry) { 944 if (false === $entry) {
945 return $this->raiseError('Could not fetch Subschema entry'); 945 return $this->raiseError('Could not fetch Subschema entry');
946 } 946 }
947 - 947 +
948 $schema->parse($entry); 948 $schema->parse($entry);
949 949
950 return $schema; 950 return $schema;
@@ -997,9 +997,9 @@ define ('NET_LDAP_ERROR', 1000); @@ -997,9 +997,9 @@ define ('NET_LDAP_ERROR', 1000);
997 } 997 }
998 998
999 if (is_array($attributes) && count($attributes) > 0) { 999 if (is_array($attributes) && count($attributes) > 0) {
1000 - 1000 +
1001 foreach( $attributes as $k => $v ) { 1001 foreach( $attributes as $k => $v ) {
1002 - 1002 +
1003 if (!isset($this->_schemaAttrs[$k])) { 1003 if (!isset($this->_schemaAttrs[$k])) {
1004 1004
1005 $attr = $this->_schema->get('attribute', $k); 1005 $attr = $this->_schema->get('attribute', $k);
@@ -1011,9 +1011,9 @@ define ('NET_LDAP_ERROR', 1000); @@ -1011,9 +1011,9 @@ define ('NET_LDAP_ERROR', 1000);
1011 $encode = true; 1011 $encode = true;
1012 } else { 1012 } else {
1013 $encode = false; 1013 $encode = false;
1014 - } 1014 + }
1015 $this->_schemaAttrs[$k] = $encode; 1015 $this->_schemaAttrs[$k] = $encode;
1016 - 1016 +
1017 } else { 1017 } else {
1018 $encode = $this->_schemaAttrs[$k]; 1018 $encode = $this->_schemaAttrs[$k];
1019 } 1019 }