public function match($user_) { switch ($this->type) { case 'equal': return $user_->getAttribute($this->attribute) == $this->value; break; case 'not_equal': return !($user_->getAttribute($this->attribute) == $this->value); break; case 'contains': return strstr($user_->getAttribute($this->attribute), $this->value) !== false; break; case 'not_contains': return !(strstr($user_->getAttribute($this->attribute), $this->value) !== false); break; case 'startswith': return str_startswith($user_->getAttribute($this->attribute), $this->value); break; case 'not_startswith': return !str_startswith($user_->getAttribute($this->attribute), $this->value); break; case 'endswith': return str_endswith($user_->getAttribute($this->attribute), $this->value); break; case 'not_endswith': return !str_endswith($user_->getAttribute($this->attribute), $this->value); break; } Logger::error('main', 'UserGroup_Rule::match type (=' . $this->type . ') not matched'); return false; }
public function testStr_endswith() { $text = 'abcdef'; $this->assertFalse(str_endswith($text, 'abc'), "La cha�ne '{$text}' ne se termine pas par 'abc'."); $this->assertTrue(str_endswith($text, 'def'), "La cha�ne '{$text}' se termine par 'def'."); $this->assertTrue(str_endswith($text, 'ef'), "La cha�ne '{$text}' se termine par 'ef'."); $this->assertFalse(str_endswith($text, 'abcdefgef'), "La cha�ne '{$text}' ne se termine par 'abcdefgef'."); }
function str_crop($string, $start, $end, $ignore_case = FALSE) { if (str_startswith($string, $start, $ignore_case)) { $string = substr($string, strlen($start)); } if (str_endswith($string, $end, $ignore_case)) { $string = substr($string, 0, strlen($string) - strlen($end)); } return $string; }
static function stem_ending($inf) { $stem = NULL; $ending = NULL; if (str_endswith($inf, 'er')) { $stem = substr($inf, 0, strlen($inf) - 2); $ending = 'er'; } elseif (str_endswith($inf, 'ir')) { $stem = substr($inf, 0, strlen($inf) - 2); $ending = 'ir'; } return array($stem, $ending); }
function homePage() { global $app; $screenshots = []; $ss_dir = 'img/screenshots/'; $files = scandir($ss_dir); foreach ($files as $file) { if (str_startswith($file, 'ss_', true) && str_endswith($file, '.png', true)) { $screenshots[] = ['title' => humanize_title($file), 'path' => '/' . $ss_dir . $file, 'th_path' => '/' . $ss_dir . 'th_' . $file]; } } return $app['twig']->render('home.twig', ['screenshots' => $screenshots]); }
public function import($id1_) { Logger::debug('main', "UserGroupDB::ldap_memberof::import (id = {$id1_})"); if (is_base64url($id1_)) { $id_ = base64url_decode($id1_); } else { $id_ = $id1_; } $prefs = Preferences::getInstance(); if (!$prefs) { die_error('get Preferences failed', __FILE__, __LINE__); } $config_ldap = $prefs->get('UserDB', 'ldap'); $config_ldap['match'] = array(); if (array_key_exists('match', $this->preferences)) { $config_ldap['match'] = $this->preferences['match']; } if (str_endswith(strtolower($id_), strtolower($config_ldap['suffix'])) === true) { $id2 = substr($id_, 0, -1 * strlen($config_ldap['suffix']) - 1); } else { $id2 = $id_; } $expl = explode(',', $id2, 2); if (count($expl) == 1) { $expl = array($id2, ''); } $config_ldap['userbranch'] = $expl[1]; $buf = $config_ldap['match']; $buf['id'] = $id_; $ldap = new LDAP($config_ldap); $sr = $ldap->search($expl[0], array_keys($config_ldap['match'])); if ($sr === false) { Logger::error('main', "UserGroupDB::ldap_memberof::import search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); if ($infos === array()) { Logger::error('main', "UserGroupDB::ldap_memberof::import get_entries failed for ({$id_})"); return NULL; } $keys = array_keys($infos); $dn = $keys[0]; $info = $infos[$dn]; foreach ($config_ldap['match'] as $attribut => $match_ldap) { if (isset($info[$match_ldap][0])) { $buf[$attribut] = $info[$match_ldap][0]; } } $ug = new UsersGroup($buf['id'], $buf['name'], $buf['description'], true); return $ug; }
/** * @param callable|string $needle * @param callable|string|null $haystack * @return callable */ function str_endswith_dg($needle, $haystack = null) { if (null === $haystack) { $haystack = tuple_get(0); } elseif (is_string($haystack)) { $haystack = return_dg($haystack); } else { debug_enforce_type($haystack, 'callable'); } if (is_string($needle)) { $needle = return_dg($needle); } else { debug_enforce_type($needle, 'callable'); } return function () use($haystack, $needle) { $args = func_get_args(); return str_endswith(call_user_func_array($haystack, $args), call_user_func_array($needle, $args)); }; }
public static function loadElements($type_, $group_) { Logger::debug('main', "Abstract_Liaison_activedirectory::loadElements ({$type_},{$group_})"); $userGroupDB = UserGroupDB::getInstance(); $userGroupDB_activedirectory = new UserGroupDB_activedirectory(); $use_child_group = false; $userGroupDB_activedirectory_preferences = $userGroupDB_activedirectory->preferences; if (array_key_exists('use_child_group', $userGroupDB_activedirectory_preferences)) { if ($userGroupDB_activedirectory_preferences['use_child_group'] == 1 || $userGroupDB_activedirectory_preferences['use_child_group'] == '1') { $use_child_group = true; } } $group = $userGroupDB->import($group_); if (!is_object($group)) { Logger::error('main', "Abstract_Liaison_activedirectory::loadElements load group ({$group_}) failed"); return NULL; } if ($group->type != 'static') { return NULL; } $elements = array(); $id_ = $group->id; $userDBAD2 = new UserDB_activedirectory(); $userDBAD = UserDB::getInstance(); if (get_class($userDBAD) == get_class($userDBAD2)) { $userDBAD = $userDBAD2; // for cache } $config_ldap = $userDBAD->makeLDAPconfig(); if (isset($group->extras) && is_array($group->extras) && isset($group->extras['member'])) { $buf = $group->extras; } else { $config_ldap['match'] = array('description' => 'description', 'name' => 'name', 'member' => 'member'); if (str_endswith(strtolower($id_), strtolower($config_ldap['suffix'])) === true) { $id2 = substr($id_, 0, -1 * strlen($config_ldap['suffix']) - 1); } else { $id2 = $id_; } $expl = explode(',', $id2, 2); if (count($expl) < 2) { Logger::error('main', "Abstract_Liaison_activedirectory::loadElements({$type_},{$group_}) count(expl) != 2 (count=" . count($expl) . ")(id2=" . $id2 . ")"); return NULL; } $config_ldap['userbranch'] = $expl[1]; $buf = array(); $buf['id'] = $id_; $ldap = new LDAP($config_ldap); $sr = $ldap->search($expl[0], array_keys($config_ldap['match'])); if ($sr === false) { Logger::error('main', "Abstract_Liaison_activedirectory::loadElements search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); $keys = array_keys($infos); $dn = $keys[0]; $info = $infos[$dn]; foreach ($config_ldap['match'] as $attribut => $match_ldap) { if (isset($info[$match_ldap])) { unset($info[$match_ldap]['count']); $buf[$attribut] = $info[$match_ldap]; } } } if (isset($buf['member']) && is_array($buf['member'])) { foreach ($buf['member'] as $member) { $u = $userDBAD->importFromDN($member); if (is_object($u)) { if ($u->hasAttribute('objectclass')) { if (in_array('user', $u->getAttribute('objectclass'))) { $l = new Liaison($u->getAttribute('login'), $group_); $elements[$l->element] = $l; } else { if (in_array('group', $u->getAttribute('objectclass')) && $use_child_group == true) { $ret1 = self::loadElements($type_, 'static_' . $member); if (is_array($ret1)) { foreach ($ret1 as $element1 => $liaison1) { $elements[$element1] = $liaison1; } } } } } else { $l = new Liaison($u->getAttribute('login'), $group_); $elements[$l->element] = $l; } } } } return $elements; }
public function config2form($prefs) { $form = array(); $config = $prefs->get('UserDB', 'ldap'); $form['host'] = ''; if (isset($config['hosts'][0])) { $form['host'] = $config['hosts'][0]; } $form['host2'] = ''; if (isset($config['hosts'][1])) { $form['host2'] = $config['hosts'][1]; } $form['suffix'] = $config['suffix']; $form['port'] = $config['port'] == '' ? '389' : $config['port']; if ($config['login'] == '') { $form['bind_anonymous'] = 1; } $form['bind_dn'] = $config['login']; $form['bind_password'] = $config['password']; $buf = ',' . $form['suffix']; if (str_endswith($form['bind_dn'], $buf)) { $form['bind_dn'] = substr($form['bind_dn'], 0, strlen($form['bind_dn']) - strlen($buf)); } $form['user_branch'] = $config['userbranch']; //$form['user_branch_recursive'] = No Yet Implementd $form['field_rdn'] = ''; if (isset($config['match']['login'])) { $form['field_rdn'] = $config['match']['login']; } if (isset($config['match']['displayname'])) { $form['field_displayname'] = $config['match']['displayname']; } else { $form['field_displayname'] = ''; } if (isset($config['match']['countrycode'])) { $form['field_countrycode'] = $config['match']['countrycode']; } else { $form['field_countrycode'] = ''; } if (isset($config['filter'])) { $form['field_filter'] = $config['filter']; } else { $form['field_filter'] = ''; } $config2 = $prefs->get('UserGroupDB', 'enable'); if ($config2 == 'ldap_memberof') { $form['user_group'] = 'ldap_memberof'; } elseif ($config2 == 'ldap_posix') { $form['user_group'] = 'ldap_posix'; } else { $form['user_group'] = 'sql'; } $form['group_branch_dn'] = ''; $buf = $prefs->get('UserGroupDB', 'ldap_posix'); if (isset($buf['group_dn'])) { $form['group_branch_dn'] = $buf['group_dn']; } return $form; }
?> "> </div> <div class="form-group"> <label for="website-meta-language"><?php echo PP_WEBSITE_LANGUAGE; ?> </label> <select id="website-meta-language" name="language" class="form-control"> <?php $languages = array_diff(scandir('include/languages/'), array('..', '.')); if (in_array($settings['metaLanguage'] . '.php', $languages)) { echo ' <option>' . $settings['metaLanguage'] . '</option>' . PHP_EOL; } foreach ($languages as $language) { if (str_endswith($language, '.php')) { $language = str_replace('.php', '', $language); if ($language == $settings['metaLanguage']) { continue; } echo ' <option>' . $language . '</option>' . PHP_EOL; } } ?> </select> </div> <input name="method" type="hidden" value="1"> <button type="submit" class="btn btn-primary"><?php echo PP_UPDATE; ?> </button>
$files[$name]['applications'] = array(); if (is_array($apps)) { foreach ($apps as $application) { if (in_array($f['mimetype'], $application['mimetypes'])) { $files[$name]['applications'][] = $application; } } } } $base_url_file = 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] == 80 ? '' : $_SERVER['SERVER_PORT']); if (str_endswith($_SERVER['REQUEST_URI'], basename(__FILE__))) { $base_url_file .= dirname($_SERVER['REQUEST_URI']); } else { $base_url_file .= $_SERVER['REQUEST_URI']; } if (str_endswith($base_url_file, '/')) { $base_url_file .= '/'; } $base_url_file .= 'file.php'; ?> <html> <head> <title>My portal</title> <script type="text/javascript" src="<?php echo ULTEO_OVD_WEBCLIENT_URL; ?> /media/script/external.js" charset="utf-8"></script> <script type="text/javascript">
public static function join_filters($filters, $rule) { // rule can be & or | $res = array(); foreach ($filters as $filter) { if (is_null($filter)) { continue; } $filter = trim($filter); if (strlen($filter) == 0) { continue; } if (!(str_startswith($filter, '(') and str_endswith($filter, ')'))) { $filter = '(' . $filter . ')'; } array_push($res, $filter); } switch (count($res)) { case 0: return null; case 1: return $res[0]; default: return '(' . $rule . implode('', $res) . ')'; } }
public function config2form($prefs) { $form = array(); $config = $prefs->get('UserDB', 'ldap'); if (isset($config['extra']['dsfw'])) { $default_user_branch = 'cn=Users,'; $domain_separator = 'dc'; } else { $default_user_branch = ''; //'ou=users,'; $domain_separator = 'o'; } $config_session = $prefs->get('SessionManagement', 'novell'); $form['host'] = ''; if (isset($config['hosts'][0])) { $form['host'] = $config['hosts'][0]; } $form['host2'] = ''; if (isset($config['hosts'][1])) { $form['host2'] = $config['hosts'][1]; } $form['domain'] = self::suffix2domain($config['suffix'], $domain_separator); // Admin login - Todo: replace by a regexp if ($config['login'] != '') { $buf = explode('=', $config['login'], 2); $buf = explode(',', $buf[1], 2); $admin_login = $buf[0]; $admin_ou = $buf[1]; } else { $admin_login = ''; $admin_ou = ''; } $uidprefix = 'cn'; if (isset($config['match']['login'])) { $uidprefix = $config['match']['login']; } $form['admin_login'] = $admin_login; $form['admin_password'] = $config['password']; $form['admin_branch_ou'] = ''; if ($config['login'] == $uidprefix . '=' . $admin_login . ',' . $default_user_branch . $config['suffix']) { $form['admin_branch'] = 'default'; } else { $form['admin_branch'] = 'specific'; if (str_endswith(strtoupper($admin_ou), strtoupper($config['suffix']))) { $admin_ou = substr($admin_ou, 0, -1 * (strlen($config['suffix']) + 1)); } $buffer = explode(',', $admin_ou); for ($i = 0; $i < count($buffer); $i++) { $buf = explode('=', $buffer[$i], 2); if (!isset($buf[1])) { break; } $buffer[$i] = $buf[1]; } $form['admin_branch_ou'] = implode(',', array_reverse($buffer)); } if (isset($config['extra']['dsfw'])) { $form['dsfw'] = 'dsfw'; } if ($config_session['dlu'] == 1) { $form['dlu'] = 'dlu'; } $buf = $prefs->get('UserGroupDB', 'enable'); $form['user_group'] = $buf == 'sql' ? 'internal' : 'novell'; return $form; }
/** * @param string $path */ function rrmdir($path) { if (!str_endswith($path, '/.') && !str_endswith($path, '/..')) { @array_map('rrmdir', @glob($path . '/*')); @array_map('rrmdir', @glob($path . '/.*')); @unlink($path); @rmdir($path); } }
public static function loadElements($type_, $group_) { Logger::debug('main', "Abstract_Liaison_ldap_memberof::loadElements ({$type_},{$group_})"); $prefs = Preferences::getInstance(); if (!$prefs) { die_error('get Preferences failed', __FILE__, __LINE__); } $userGroupDB = UserGroupDB::getInstance(); $group = $userGroupDB->import($group_); if (!is_object($group)) { Logger::error('main', "Abstract_Liaison_ldap_memberof::loadElements load group ({$group_}) failed"); return NULL; } $userGroupDB_ldap_memberof = new UserGroupDB_ldap_memberof(); $use_child_group = false; ${$userGroupDB_ldap_memberof_preferences} = $userGroupDB_ldap_memberof->preferences; if (array_key_exists('use_child_group', ${$userGroupDB_ldap_memberof_preferences})) { if (${$userGroupDB_ldap_memberof_preferences}['use_child_group'] == 1 || ${$userGroupDB_ldap_memberof_preferences}['use_child_group'] == '1') { $use_child_group = true; } } $elements = array(); if (is_base64url($group->id)) { $id_ = base64url_decode($group->id); } else { $id_ = $group->id; } $userDBldap = new UserDB_ldap(); $userDBldap2 = UserDB::getInstance(); if (get_class($userDBldap) == get_class($userDBldap2)) { $userDBldap = $userDBldap2; // for cache } $config_ldap = $prefs->get('UserDB', 'ldap'); $config_ldap['match'] = array('description' => 'description', 'name' => 'name', 'member' => 'member'); if (str_endswith(strtolower($id_), strtolower($config_ldap['suffix'])) === true) { $id2 = substr($id_, 0, -1 * strlen($config_ldap['suffix']) - 1); } else { $id2 = $id_; } $expl = explode(',', $id2, 2); $config_ldap['userbranch'] = $expl[1]; $buf = array(); $buf['id'] = $id_; $ldap = new LDAP($config_ldap); $sr = $ldap->search($expl[0], array_keys($config_ldap['match'])); if ($sr === false) { Logger::error('main', "Abstract_Liaison_ldap_memberof::loadElements search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); if ($infos === array()) { return $elements; } $keys = array_keys($infos); $dn = $keys[0]; $info = $infos[$dn]; foreach ($config_ldap['match'] as $attribut => $match_ldap) { if (isset($info[$match_ldap])) { unset($info[$match_ldap]['count']); $buf[$attribut] = $info[$match_ldap]; } } if (isset($buf['member']) && is_array($buf['member'])) { foreach ($buf['member'] as $member) { $u = $userDBldap->importFromDN($member); if (is_object($u) == false) { Logger::error('main', "Abstract_Liaison_ldap_memberof::loadElements ({$type_},{$group_}) failed to import " . $member); continue; } else { if ($u->hasAttribute('objectclass')) { if (in_array('user', $u->getAttribute('objectclass'))) { $l = new Liaison($u->getAttribute('login'), $group_); $elements[$l->element] = $l; } else { if (in_array('group', $u->getAttribute('objectclass')) && $use_child_group == true) { $ret1 = self::loadElements($type_, 'static_' . $member); if (is_array($ret1)) { foreach ($ret1 as $element1 => $liaison1) { $elements[$element1] = $liaison1; } } } } } else { $l = new Liaison($u->getAttribute('login'), $group_); $elements[$l->element] = $l; } } } } return $elements; }
function download_log($where_, $name_, $server_ = NULL) { $log = null; if ($where_ == 'sm') { $download_name = 'sessionmanager_' . $name_; $log = $name_; if (str_endswith($log, '.log')) { $log = substr($log, 0, -4); } } elseif ($where_ == 'aps') { $download_name = 'slaveserver_' . $server_ . '.log'; $log = $server_; } $content = $_SESSION['service']->log_download($log); if (is_null($content)) { popup_error(sprintf(_('Unable to get log %s'), $log)); redirect(); } header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $download_name); echo $content; die; }
<?php // Find out our current working directory $cwd = getcwd(); $is_in_admin_ui = str_endswith('admin', $cwd); $currentFile = $_SERVER["PHP_SELF"]; $parts = explode('/', $currentFile); $fileNameWithExt = $parts[count($parts) - 1]; $fileName = strtolower(substr($fileNameWithExt, 0, strpos($fileNameWithExt, '.'))); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title><?php global $page_title; echo isset($page_title) ? $page_title : 'Metrics - Admin'; ?> </title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="description" content=""/> <meta name="author" content="Tyler Blair <*****@*****.**>"/> <meta name="viewport" content="width=device-width"> <!-- css --> <link href="http://static.mcstats.org/css/libraries/bootstrap/bootstrap.min.css" rel="stylesheet"/> <link href="http://static.mcstats.org/css/libraries/font-awesome/font-awesome.min.css" rel="stylesheet"/> <link href="http://static.mcstats.org/css/libraries/template/template.min.css" rel="stylesheet"/> <link href="http://static.mcstats.org/css/libraries/template/template.blue.min.css" rel="stylesheet"/>
function getCheckStyles() { global $jarDir; $result = array(); $dhandle = @opendir($jarDir); if ($dhandle != FALSE) { while (($name = @readdir($dhandle)) !== false) { if ($name == "." || $name == "..") { continue; } if (@filetype($jarDir . $name) != "dir" && str_endswith($name, ".jar")) { $result[] = $name; } } closedir($dhandle); } sort($result); return $result; }
function is_feed_image($a_tag) { $image_exts = explode(',', 'png,jpg,jpeg,gif,bmp,tif,tiff,svg'); foreach ($image_exts as $ext) { if (str_endswith($a_tag->href, '.' . trim($ext), true) || str_contains($a_tag->innertext, '.' . trim($ext) . '?', false)) { return true; } } return false; }
protected function import_nocache($id_) { Logger::debug('main', "UserGroupDB::ldap::import_nocache (id = {$id_})"); $configLDAP = $this->get_usergroup_ldap_config(); if (!str_endswith(strtolower($id_), strtolower($configLDAP['suffix']))) { Logger::error('main', "UserGroupDB::ldap::import_nocache unable to import '{$id_}' because not same LDAP suffix"); return NULL; } $expl = explode_with_escape(',', $id_, 2); $rdn = $expl[0]; $configLDAP['suffix'] = $expl[1]; $filter = LDAP::join_filters(array($this->preferences['filter'], $rdn), '&'); $ldap = new LDAP($configLDAP); $sr = $ldap->search($rdn, array_values($this->preferences['match'])); if ($sr === false) { Logger::error('main', "UserGroupDB::ldap::import_nocache search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); if (!is_array($infos) || $infos === array()) { return NULL; } $keys = array_keys($infos); $dn = $keys[0]; $info = $infos[$dn]; return $this->generateUsersGroupFromRow($info, $dn, $this->preferences['match']); }
public function import($id_) { Logger::debug('main', "UserGroupDB::activedirectory::import (id = {$id_})"); // cache if (isset($this->cache[$id_])) { return $this->cache[$id_]; } // cache end if (isset($this->cache[$id_])) { return $this->cache[$id_]; } $userGroupDB = UserGroupDB::getInstance(); $userDBAD2 = new UserDB_activedirectory(); $userDBAD = UserDB::getInstance(); if (get_class($userDBAD) == get_class($userDBAD2)) { $userDBAD = $userDBAD2; // for cache } $config_ldap = $userDBAD->makeLDAPconfig(); $config_ldap['match'] = array('description' => 'description', 'name' => 'name', 'member' => 'member'); if (str_endswith(strtolower($id_), strtolower($config_ldap['suffix'])) === true) { $id2 = substr($id_, 0, -1 * strlen($config_ldap['suffix']) - 1); } else { $id2 = $id_; } $expl = explode(',', $id2, 2); if (count($expl) == 1) { $expl = array($id2, ''); } $config_ldap['userbranch'] = $expl[1]; $buf = $config_ldap['match']; $buf['id'] = $id_; $buf['name'] = ''; $buf['description'] = ''; $ldap = new LDAP($config_ldap); $sr = $ldap->search($expl[0], array_values($config_ldap['match'])); if ($sr === false) { Logger::error('main', "UserGroupDB::activedirectory::import search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); if (count($infos) == 0) { Logger::error('main', "UserGroupDB::activedirectory::import search failed for ({$id_}), no data found on the directory"); return NULL; } $keys = array_keys($infos); $dn = $keys[0]; $info = $infos[$dn]; foreach ($config_ldap['match'] as $attribut => $match_ldap) { if (isset($info[$match_ldap][0])) { $buf[$attribut] = $info[$match_ldap][0]; } if (array_key_exists($match_ldap, $info) && is_array($info[$match_ldap])) { if (isset($info[$match_ldap]['count'])) { unset($info[$match_ldap]['count']); } $extras[$attribut] = $info[$match_ldap]; } } if ($buf['name'] == '') { Logger::error('main', "UserGroupDB::activedirectory::import({$id_}) error group name is empty"); return NULL; } $ug = new UsersGroup($buf['id'], $buf['name'], $buf['description'], true); $ug->extras = $extras; $this->cache[$buf['id']] = $ug; return $ug; }
<?php if (System::$Configuration["Forums.Enabled"]) { if (count($path) > 1 && $path[1] != "") { if (str_endswith($path[1], ".mmo")) { switch ($path[1]) { case "create.mmo": require "create.inc.php"; return; default: System::Redirect("~/community/forums"); return; } } else { require "detail.inc.php"; } } else { require "list.inc.php"; } return; } else { System::Redirect("~/community"); return; }
protected function import_nocache($id_) { Logger::debug('main', "UserGroupDB::ldap_posix::import_nocache (id = {$id_})"); $configLDAP = $this->makeLDAPconfig(); if (str_endswith(strtolower($id_), strtolower($configLDAP['suffix'])) === true) { $id2 = substr($id_, 0, -1 * strlen($configLDAP['suffix']) - 1); } else { $id2 = $id_; } $expl = explode(',', $id2, 2); if (count($expl) == 1) { $expl = array($id2, ''); } $configLDAP['userbranch'] = $expl[1]; $ldap = new LDAP($configLDAP); $sr = $ldap->search($expl[0], array_values($configLDAP['match'])); if ($sr === false) { Logger::error('main', "UserGroupDB::ldap_posix::import_nocache search failed for ({$id_})"); return NULL; } $infos = $ldap->get_entries($sr); $keys = array_keys($infos); if (!is_array($infos) || $infos === array()) { return NULL; } $dn = $keys[0]; $info = $infos[$dn]; return $this->generateUsersGroupFromRow($info, $dn, $configLDAP['match']); }