/**
  * Returns an array of Syntax objects that this LDAP server uses mapped to
  * their descriptions. The key of each entry is the OID of the Syntax.
  */
 function SchemaSyntaxes($dn = null)
 {
     # Set default return
     $return = null;
     if ($return = get_cached_item($this->server_id, 'schema', 'syntaxes')) {
         debug_log('%s::SchemaSyntaxes(): Returning CACHED [%s] (%s).', 25, get_class($this), $this->server_id, 'syntaxes');
         return $return;
     }
     $raw_syntaxes = $this->getRawSchema('ldapSyntaxes', $dn);
     if ($raw_syntaxes) {
         # build the array of attributes
         $return = array();
         foreach ($raw_syntaxes as $syntax_string) {
             $syntax = new Syntax($syntax_string);
             $key = strtolower(trim($syntax->getOID()));
             if (!$key) {
                 continue;
             }
             $return[$key] = $syntax;
         }
         ksort($return);
         # cache the schema to prevent multiple schema fetches from LDAP server
         set_cached_item($this->server_id, 'schema', 'syntaxes', $return);
     }
     debug_log('%s::SchemaSyntaxes(): Entered with (%s), Returning (%s).', 25, get_class($this), $dn, $return);
     return $return;
 }
Exemple #2
0
 /**
  * Returns an array of Syntax objects that this LDAP server uses mapped to
  * their descriptions. The key of each entry is the OID of the Syntax.
  */
 public function SchemaSyntaxes($method = null, $dn = '')
 {
     if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
         debug_log('Entered (%%)', 25, 0, __FILE__, __LINE__, __METHOD__, $fargs);
     }
     # Set default return
     $return = null;
     if ($return = get_cached_item($this->index, 'schema', 'syntaxes')) {
         if (DEBUG_ENABLED) {
             debug_log('Returning CACHED [%s] (%s).', 25, 0, __FILE__, __LINE__, __METHOD__, $this->index, 'syntaxes');
         }
         return $return;
     }
     $raw = $this->getRawSchema($method, 'ldapSyntaxes', $dn);
     if ($raw) {
         # build the array of attributes
         $return = array();
         foreach ($raw as $line) {
             if (is_null($line) || !strlen($line)) {
                 continue;
             }
             $syntax = new Syntax($line);
             $key = strtolower(trim($syntax->getOID()));
             if (!$key) {
                 continue;
             }
             $return[$key] = $syntax;
         }
         ksort($return);
         # cache the schema to prevent multiple schema fetches from LDAP server
         set_cached_item($this->index, 'schema', 'syntaxes', $return);
     }
     if (DEBUG_ENABLED) {
         debug_log('Returning (%s)', 25, 0, __FILE__, __LINE__, __METHOD__, $return);
     }
     return $return;
 }