當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ldap_next_entry函數代碼示例

本文整理匯總了PHP中ldap_next_entry函數的典型用法代碼示例。如果您正苦於以下問題:PHP ldap_next_entry函數的具體用法?PHP ldap_next_entry怎麽用?PHP ldap_next_entry使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ldap_next_entry函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: verify

 function verify($cert, $dn)
 {
     $conn = ldap_connect($this->LDAP_HOST);
     if (!$conn) {
         return false;
     }
     if (!ldap_bind($conn)) {
         return false;
     }
     $resultset = ldap_search($conn, "c=EE", "(serialNumber=38212200301)");
     if (!$resultset) {
         echo "No recs";
         return false;
     }
     $rec = ldap_first_entry($conn, $resultset);
     while ($rec !== false) {
         $values = ldap_get_values($conn, $rec, 'usercertificate;binary');
         $certificate = "-----BEGIN CERTIFICATE-----\n" . chunk_split(base64_encode($values[0]), 64, "\n") . "-----END CERTIFICATE-----\n";
         if (strcmp($cert, $certificate) == 0) {
             return "Found";
         }
         $rec = ldap_next_entry($conn, $rec);
     }
     // Not found a record with a matching certificate
     return false;
 }
開發者ID:raisty,項目名稱:eid-webauth-samples,代碼行數:26,代碼來源:ldap.php

示例2: fetchEntry

 /**
  * @return mixed resource
  */
 public function fetchEntry()
 {
     if (!$this->result_resource) {
         return null;
     }
     if (null === $this->entry_resource) {
         $this->entry_resource = ldap_first_entry($this->resource, $this->result_resource);
     } else {
         $this->entry_resource = ldap_next_entry($this->resource, $this->entry_resource);
     }
     if (!$this->entry_resource) {
         return null;
     }
     $dn = ldap_get_dn($this->resource, $this->entry_resource);
     $rawAttributes = ldap_get_attributes($this->resource, $this->entry_resource);
     $count = $rawAttributes['count'];
     $attributes = array();
     for ($i = 0; $i < $count; $i++) {
         $attribute = $rawAttributes[$i];
         $values = array();
         $subCount = $rawAttributes[$attribute]['count'];
         for ($j = 0; $j < $subCount; $j++) {
             $values[] = $rawAttributes[$attribute][$j];
         }
         $attributes[$attribute] = $values;
     }
     $object = new Object($dn, $attributes);
     return $object;
 }
開發者ID:heiglandreas,項目名稱:ldap,代碼行數:32,代碼來源:SearchResultProxy.php

示例3: fetch_row

 public function fetch_row()
 {
     if ($this->get_opt('fetch_pos')) {
         return ldap_next_entry($this->handle, $this->resource);
     } else {
         return ldap_first_entry($this->handle, $this->resource);
     }
 }
開發者ID:codifyllc,項目名稱:phpopenfw,代碼行數:8,代碼來源:dr_ldap.class.php

示例4: nextEntry

 /**
  * @return Entry|null
  * @throws EntryRetrievalFailureException
  */
 public function nextEntry()
 {
     if (!($entry = ldap_next_entry($this->link, $this->entry))) {
         if (0 !== ($errNo = ldap_errno($this->link))) {
             throw new EntryRetrievalFailureException(ldap_error($this->link), $errNo);
         }
         return null;
     }
     return new Entry($this->link, $entry);
 }
開發者ID:daverandom,項目名稱:ldapi,代碼行數:14,代碼來源:Entry.php

示例5: readUsers

 public static function readUsers($ldapconn)
 {
     $users = array();
     $search = ldap_list($ldapconn, USER_DN, User::FILTER_USERS, array("cn", "mail", "displayName", "sn", "givenName", "memberOf"));
     if (ldap_count_entries($ldapconn, $search) > 0) {
         $entry = ldap_first_entry($ldapconn, $search);
         do {
             $users[] = User::readFromLdapEntry($ldapconn, $entry);
         } while ($entry = ldap_next_entry($ldapconn, $entry));
     }
     return $users;
 }
開發者ID:tmaex,項目名稱:useradmin,代碼行數:12,代碼來源:user.inc.php

示例6: getNextEntry

 /**
  * Returns the next entry in the result set or false wether there are no more entries.
  * 
  * @return \gossi\ldap\LdapEntry The new LdapEntry.
  */
 public function getNextEntry()
 {
     if ($this->pointer == null) {
         return $this->getFirstEntry();
     }
     $this->pointer = ldap_next_entry($this->conn, $this->pointer);
     if ($this->pointer) {
         return new LdapEntry($this->conn, $this->pointer);
     } else {
         return false;
     }
 }
開發者ID:gossi,項目名稱:ldap,代碼行數:17,代碼來源:LdapResult.php

示例7: iterarEntradas

 /**
  * Auxiliar directo de busqueda. Dado un ldap result, itera por el para conseguir sus datos
  * 
  * @param ldap result $busquedaLdap
  * @param array $atributos
  * @return boolean
  */
 private function iterarEntradas($busquedaLdap, array $atributos)
 {
     $datos = array();
     if ($entrada = ldap_first_entry($this->conexionLdap, $busquedaLdap)) {
         do {
             // Ejecutamos al menos una vez el mapeo de entradas con sus atributos, a menos
             // que no haya nada
             $datos[] = $this->mapa($atributos, $entrada);
         } while ($entrada = ldap_next_entry($this->conexionLdap, $entrada));
         return $datos;
     } else {
         return FALSE;
     }
 }
開發者ID:vtacius,項目名稱:ldappm,代碼行數:21,代碼來源:ldapOperations.php

示例8: ldap_flatresults

 function ldap_flatresults($ad, $sr, $key = false)
 {
     for ($entry = ldap_first_entry($ad, $sr); $entry != false; $entry = ldap_next_entry($ad, $entry)) {
         $user = array();
         $attributes = ldap_get_attributes($ad, $entry);
         for ($i = $attributes['count']; $i-- > 0;) {
             $user[strtolower($attributes[$i])] = $attributes[$attributes[$i]][0];
         }
         if ($key && $user[$key]) {
             $users[strtolower($user[$key])] = $user;
         } else {
             $users[] = $user;
         }
     }
     return $users;
 }
開發者ID:bazo,項目名稱:diplomovka,代碼行數:16,代碼來源:LDAPModel.php

示例9: getIterator

 public function getIterator()
 {
     $con = $this->connection->getResource();
     $search = $this->search->getResource();
     $current = ldap_first_entry($con, $search);
     if (0 === $this->count()) {
         return;
     }
     if (false === $current) {
         throw new LdapException(sprintf('Could not rewind entries array: %s', ldap_error($con)));
     }
     (yield $this->getSingleEntry($con, $current));
     while (false !== ($current = ldap_next_entry($con, $current))) {
         (yield $this->getSingleEntry($con, $current));
     }
 }
開發者ID:ayoah,項目名稱:symfony,代碼行數:16,代碼來源:Collection.php

示例10: next

 /**
  * Retrieves next available entry from the search result set
  *
  * @return EntryInterface next entry if available, null otherwise
  */
 public function next()
 {
     if ($this->isEndReached) {
         return null;
     }
     if (null === $this->previous) {
         $this->previous = @ldap_first_entry($this->connection, $this->resultSet);
     } else {
         $this->previous = @ldap_next_entry($this->connection, $this->previous);
     }
     if (false === $this->previous) {
         $this->previous = null;
         $this->isEndReached = true;
         return null;
     }
     return new Entry($this->connection, $this->previous);
 }
開發者ID:81square,項目名稱:ldap,代碼行數:22,代碼來源:Search.php

示例11: getUsers

 public function getUsers($filter = null)
 {
     if ($filter !== null) {
         $filter = "(&(objectClass=inetOrgPerson)(uid=" . addcslashes($filter, '()\\') . "))";
     } else {
         $filter = "(objectClass=inetOrgPerson)";
     }
     $resource = ldap_search($this->ldapconn, $this->ldapbasedn, $filter);
     ldap_sort($this->ldapconn, $resource, "uid");
     $entry = ldap_first_entry($this->ldapconn, $resource);
     $users = array();
     while ($entry) {
         $attributes = ldap_get_attributes($this->ldapconn, $entry);
         $users[] = $attributes["uid"][0];
         $entry = ldap_next_entry($this->ldapconn, $entry);
     }
     return $users;
 }
開發者ID:jungepiraten,項目名稱:ucp,代碼行數:18,代碼來源:UserDatabase.class.php

示例12: fetch

 /**
  * Fetch the next record or return false if there's none.
  * 
  * @return Record 
  */
 public function fetch()
 {
     if (!isset($this->_numEntry)) {
         $this->_numEntry = 0;
         $this->_entryId = ldap_first_entry($this->_ldapConn->getLink(), $this->_searchId);
     } else {
         $this->_numEntry++;
         $this->_entryId = ldap_next_entry($this->_ldapConn->getLink(), $this->_entryId);
     }
     if (!$this->_entryId) {
         return false;
     }
     $record = new $this->fetchClass($this->_ldapConn, $this->_entryId);
     if (!is_a($record, 'GO\\Base\\Ldap\\Record')) {
         throw new Exception($this->fetchClass . ' is not a GO\\Base\\Ldap\\Record subclass');
     }
     return $record;
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:23,代碼來源:Result.php

示例13: next

 /**
  * Get the next LDAP entry from search results.
  *
  * @return Entry|null
  *   Next LDAP entry or null if no entries left.
  */
 public function next()
 {
     if ($this->entryID === null) {
         $this->entryID = ldap_first_entry($this->ds, $this->sr);
     } else {
         $this->entryID = ldap_next_entry($this->ds, $this->entryID);
     }
     if (!$this->entryID) {
         return null;
     }
     $data = Utils::readEntry($this->ds, $this->entryID, $this->binaryFields);
     if (array_key_exists('nsRole', $data)) {
         $data['roles'] = Utils::getRoles($this->ds, $data);
     }
     $dn = ldap_get_dn($this->ds, $this->entryID);
     $rdn = Utils::getRDN($dn, $this->baseDN);
     return new Entry($this->ds, $rdn, $dn, $data);
 }
開發者ID:grom358,項目名稱:php-ldap,代碼行數:24,代碼來源:SearchResults.php

示例14: next

 /**
  * @see ResultSet::next()
  */
 public function next()
 {
     if (!$this->entry) {
         $this->entry = ldap_first_entry($this->conn->getResource(), $this->result);
     }
     $this->entry = ldap_next_entry($this->conn->getResource(), $this->entry);
     if (!$this->entry) {
         $errno = mysql_errno($this->conn->getResource());
         if (!$errno) {
             // We've advanced beyond end of recordset.
             $this->afterLast();
             return false;
         } else {
             throw new SQLException("Error fetching result", mysql_error($this->conn->getResource()));
         }
     }
     $this->cursorPos++;
     return $this->entry;
 }
開發者ID:nmicht,項目名稱:tlalokes-in-acst,代碼行數:22,代碼來源:LdapResultSet.php

示例15: get_ldap_attribute_for_various_data

 public function get_ldap_attribute_for_various_data($pAttributes, $ldapRequest)
 {
     $allResults = array();
     $ldapc = $this->ldap_conn;
     //ldap connection
     if (!is_array($pAttributes)) {
         throw new Exception("Argument is not an array", E_PARAM);
     }
     //search for multiple ldap attributes
     //search string is prefix notation
     $search = ldap_search($ldapc, LDAP_O . ", " . LDAP_C, $ldapRequest, $pAttributes);
     //get ldap attributes
     for ($entryID = ldap_first_entry($ldapc, $search); $entryID != false; $entryID = ldap_next_entry($ldapc, $entryID)) {
         foreach ($pAttributes as $attribute) {
             $value = ldap_get_values($ldapc, $entryID, $attribute);
             $result[$attribute] = $value[0];
         }
         $allResults[] = $result;
     }
     return $allResults;
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:21,代碼來源:lms_ldap.class.php


注:本文中的ldap_next_entry函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。