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


PHP AuthLdap::getField方法代碼示例

本文整理匯總了PHP中AuthLdap::getField方法的典型用法代碼示例。如果您正苦於以下問題:PHP AuthLdap::getField方法的具體用法?PHP AuthLdap::getField怎麽用?PHP AuthLdap::getField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AuthLdap的用法示例。


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

示例1: buildLdapFilter

 /**
  * @param $authldap  AuthLDAP object
  **/
 private static function buildLdapFilter(AuthLdap $authldap)
 {
     //Build search filter
     $counter = 0;
     $filter = '';
     if (!empty($_SESSION['ldap_import']['criterias']) && $_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE) {
         foreach ($_SESSION['ldap_import']['criterias'] as $criteria => $value) {
             if ($value != '') {
                 $begin = 0;
                 $end = 0;
                 if (($length = strlen($value)) > 0) {
                     if ($value[0] == '^') {
                         $begin = 1;
                     }
                     if ($value[$length - 1] == '$') {
                         $end = 1;
                     }
                 }
                 if ($begin || $end) {
                     // no Toolbox::substr, to be consistent with strlen result
                     $value = substr($value, $begin, $length - $end - $begin);
                 }
                 $counter++;
                 $filter .= '(' . $authldap->fields[$criteria] . '=' . ($begin ? '' : '*') . $value . ($end ? '' : '*') . ')';
             }
         }
     } else {
         $filter = "(" . $authldap->getField("login_field") . "=*)";
     }
     //If time restriction
     $begin_date = isset($_SESSION['ldap_import']['begin_date']) && !empty($_SESSION['ldap_import']['begin_date']) ? $_SESSION['ldap_import']['begin_date'] : NULL;
     $end_date = isset($_SESSION['ldap_import']['end_date']) && !empty($_SESSION['ldap_import']['end_date']) ? $_SESSION['ldap_import']['end_date'] : NULL;
     $filter .= self::addTimestampRestrictions($begin_date, $end_date);
     $ldap_condition = $authldap->getField('condition');
     //Add entity filter and filter filled in directory's configuration form
     return "(&" . (isset($_SESSION['ldap_import']['entity_filter']) ? $_SESSION['ldap_import']['entity_filter'] : '') . " {$filter} {$ldap_condition})";
 }
開發者ID:euqip,項目名稱:glpi-smartcities,代碼行數:40,代碼來源:authldap.class.php

示例2: AuthLdap

<?php

include '../../../inc/includes.php';
Session::checkRight("config", "w");
$authldap = new AuthLdap();
$authldap->getFromDB($_POST['value']);
$filter = "(" . $authldap->getField("login_field") . "=*)";
$ldap_condition = $authldap->getField('condition');
echo "(& {$filter} {$ldap_condition})";
開發者ID:nicholaseduardo,項目名稱:formcreator,代碼行數:9,代碼來源:ldap_filter.php


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