本文整理汇总了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})";