本文整理匯總了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})";
}
示例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})";