本文整理汇总了PHP中clladp::Ldap_search方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::Ldap_search方法的具体用法?PHP clladp::Ldap_search怎么用?PHP clladp::Ldap_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::Ldap_search方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FindComputerByIP
function FindComputerByIP()
{
if ($_GET["SelectDansGuardianExceptionipList"] == '*') {
$_GET["SelectDansGuardianExceptionipList"] = null;
}
if ($_GET["SelectDansGuardianExceptionipList"] == null) {
$tofind = "*";
} else {
$tofind = "{$_GET["SelectDansGuardianExceptionipList"]}*";
}
$filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))";
writelogs($filter_search, __FUNCTION__, __FILE__, __LINE__);
$ldap = new clladp();
$attrs = array("uid", "ComputerIP", "ComputerOS", "ComputerMachineType");
$dn = "{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter_search, $attrs, 10);
$html = "<table style='width:250px' class=table_form>";
for ($i = 0; $i < $hash["count"]; $i++) {
$realuid = $hash[$i]["uid"][0];
$hash[$i]["uid"][0] = str_replace('$', '', $hash[$i]["uid"][0]);
$ip = $hash[$i][strtolower("ComputerIP")][0];
if (trim($ip) == null) {
continue;
}
$js = "AddDansGuardianExceptionipList('{$ip}');";
$html = $html . "<tr " . CellRollOver($js, "{add}") . ">\n\t\t<td width=1%><img src='img/base.gif'></td>\n\t\t<td nowrap><strong>{$hash[$i]["uid"][0]}</strong></td>\n\t\t<td ><strong>{$ip}</strong></td>\n\t</tr>\n\t";
}
$html = $html . "</table>";
$html = "<center><div style='height:300px;overflow:auto'>{$html}</div></center>";
$tpl = new templates();
return $tpl->_ENGINE_parse_body($html);
}
示例2: find_member
function find_member()
{
$tofind = $_GET["find-member"];
if ($_SESSION["uid"] == -100) {
$ou = $_GET["ou"];
} else {
$ou = $_SESSION["ou"];
}
$ldap = new clladp();
if (is_base64_encoded($ou)) {
$ou = base64_decode($ou);
}
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$tofind = str_replace('***', '*', $tofind);
writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
$filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind}) ))";
$attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber");
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs, 20);
$users = new user();
$number = $hash["count"];
for ($i = 0; $i < $number; $i++) {
$user = $hash[$i];
$html = $html . formatUser($user);
}
return $html;
}
示例3: export_to_zarafa
function export_to_zarafa($uid)
{
$f[] = "First Name,Middle Name,Last Name,Title,Suffix,Initials,Web Page,Gender,Birthday,Anniversary,Location,Language,Internet Free Busy,Notes,E-mail Address,E-mail 2 Address,E-mail 3 Address,Primary Phone,Home Phone,Home Phone 2,Mobile Phone,Pager,Home Fax,Home Address,Home Street,Home Street 2,Home Street 3,Home Address PO Box,Home City,Home State,Home Postal Code,Home Country,Spouse,Children,Manager's Name,Assistant's Name,Referred By,Company Main Phone,Business Phone,Business Phone 2,Business Fax,Assistant's Phone,Company,Job Title,Department,Office Location,Organizational ID Number,Profession,Account,Business Address,Business Street,Business Street 2,Business Street 3,Business Address PO Box,Business City,Business State,Business Postal Code,Business Country,Other Phone,Other Fax,Other Address,Other Street,Other Street 2,Other Street 3,Other Address PO Box,Other City,Other State,Other Postal Code,Other Country,Callback,Car Phone,ISDN,Radio Phone,TTY/TDD Phone,Telex,User 1,User 2,User 3,User 4,Keywords,Mileage,Hobby,Billing Information,Directory Server,Sensitivity,Priority,Private,Categories";
$ldap = new clladp();
$ct = new user($uid);
$dn = "ou={$uid},ou=People,dc={$ct->ou},dc=NAB,{$ldap->suffix}";
$filter = "(objectClass=inetOrgPerson)";
$attrs = array();
$hash = $ldap->Ldap_search($dn, $filter, array("employeeNumber"));
if ($GLOBALS["VERBOSE"]) {
echo "[{$uid}]: Exporting {$hash["count"]} user(s)\n";
}
for ($i = 0; $i < $hash["count"]; $i++) {
$emp = new contacts(null, $hash[$i]["employeenumber"][0]);
$f[] = @implode(",", $emp->ContactTocsvArray());
}
$tmpfile = "/tmp/{$uid}." . time() . ".csv";
@file_put_contents("{$tmpfile}", @implode("\n", $f));
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$basename = basename($tmpfile);
$cmd = $php . " " . dirname(__FILE__) . "/exec.zarafa.csv2contacts.php {$uid} \"{$ct->password}\" {$basename} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo "[{$uid}]: {$cmd}\n";
}
exec($cmd, $results);
if ($GLOBALS["VERBOSE"]) {
while (list($num, $line) = each($results)) {
echo "[{$uid}]: {$line}\n";
}
}
}
示例4: popup_list
function popup_list()
{
$ou = base64_decode($_GET["ou"]);
$tpl = new templates();
$gpid = $_GET["gpid"];
if ($_POST["query"] != null) {
$tofind = $_POST["query"];
}
$groups = new groups($gpid);
$group_members = $groups->members_array;
$ldap = new clladp();
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$tofind = str_replace("**", "*", $tofind);
$filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
$attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber");
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
if (strlen(trim($ldap->ldap_last_error)) > 5) {
json_error_show("Error:" . $ldap->ldap_last_error);
}
$number = $hash["count"];
$data = array();
$data['page'] = 1;
$data['total'] = $number;
$data['rows'] = array();
$c = 0;
for ($i = 0; $i < $number; $i++) {
$exist = false;
$userARR = $hash[$i];
$uid = $userARR["uid"][0];
if ($uid == null) {
continue;
}
$md = md5($uid);
$c++;
if ($uid == "squidinternalauth") {
continue;
}
if ($group_members[$uid]) {
$exist = true;
}
$js = "add_already_member_add('" . base64_encode($uid) . "','{$md}');";
$mail = texttooltip($userARR["mail"][0], "{add}:{$uid}", $js, null, 0, "font-size:13px");
$color = "black";
$add = imgsimple("arrow-right-24.png", "{add}:{$uid}", $js);
if ($exist) {
$add = " ";
$color = "#8a8a8a";
}
$data['rows'][] = array('id' => "uidS{$md}", 'cell' => array("<span style='font-size:14px;color:{$color}'>{$uid}</span>", "<span style='font-size:14px;color:{$color}'>{$mail}</span>", "<span style='font-size:14px;color:{$color}'>{$add}</span>"));
}
echo json_encode($data);
}
示例5: popup
function popup()
{
$page = CurrentPageName();
$ldap = new clladp();
$sock = new sockets();
$info = $ldap->OUDatas($_GET["ou"]);
$zarafaEnabled = 1;
if (!$info["objectClass"]["zarafa-company"]) {
$zarafaEnabled = 0;
}
$ZarafaUserSafeMode = $sock->GET_INFO("ZarafaUserSafeMode");
$languages = unserialize(base64_decode($sock->getFrameWork("zarafa.php?locales=yes")));
$langbox[null] = "{select}";
while (list($index, $data) = each($languages)) {
$langbox[$data] = $data;
}
$t = $_GET["t"];
if (!is_numeric($t)) {
$t = time();
}
$oumd5 = md5(strtolower(trim($_GET["ou"])));
$OuDefaultLang = $sock->GET_INFO("zarafaMBXLang{$oumd5}");
$OuZarafaDeleteADM = $sock->GET_INFO("OuZarafaDeleteADM{$oumd5}");
$filter = "(&(objectClass=zarafa-user)(zarafaAdmin=1))";
$attrs = array("displayName", "uid", "mail");
$dn = "ou={$_GET["ou"]},dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
$number = $hash["count"];
$arruid[null] = "{select}";
for ($i = 0; $i < $number; $i++) {
$userZ = $hash[$i];
$uid = $userZ["uid"][0];
$arruid[$uid] = $uid;
}
$admin_delete = Field_array_Hash($arruid, "OuZarafaDeleteADM{$t}", $OuZarafaDeleteADM, "style:font-size:16px;padding:3px");
$mailbox_language = Field_array_Hash($langbox, "zarafaMbxLang{$t}", $OuDefaultLang, "style:font-size:16px;padding:3px");
if ($OuDefaultLang != null) {
$rescan = "<div style='width:100%;margin:10px'><center>" . button("{scan_mailboxes_language}", "zarafaDScanMBXLang{$t}()", "16") . "</center></div>";
}
if ($ZarafaUserSafeMode == 1) {
$warn = "\n\t\t\t<hr>\n\t\t\t<table style='width:99 %' class=form>\n\t\t\t<tr>\n\t\t\t<td valign='top'><img src='img/error-64.png'></td>\n\t\t\t<td valign='top'><strong style='font-size:14px'>{ZARAFA_SAFEMODE_EXPLAIN}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t\n\t\t\t";
}
$enable = Paragraphe_switch_img("{ENABLE_ZARAFA_COMPANY}", "{ENABLE_ZARAFA_COMPANY_TEXT}", "zarafaEnabled", $zarafaEnabled, null, 400);
$html = "\n\t<div id='{$t}-anim'></div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2>{$enable}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{default_language}:</td>\n\t\t<td>{$mailbox_language}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{delete_store_receiver}:</td>\n\t\t<td>{$admin_delete}</td>\n\t</tr>\t\n\t<tr>\n\t<td colspan=2 align='right'>\n\t<hr>" . button("{apply}", "ENABLE_ZARAFA_COMPANY()", 16) . "{$warn}</td>\n\t</tr>\n\t</table>\n\t{$rescan}\n\t</div>\n\t<script>\nvar X_ENABLE_ZARAFA_COMPANY= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\tdocument.getElementById('{$t}-anim').innerHTML='';\n\t\$('#table-{$t}').flexReload();\n\tif(document.getElementById('organization-find')){SearchOrgs();YahooWin3Hide();return;}\n\tZARAFA_OU_LOAD();\n\t\n\t}\t\n\t\nfunction ENABLE_ZARAFA_COMPANY(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zarafaEnabled',document.getElementById('zarafaEnabled').value);\n\tXHR.appendData('zarafaMbxLang',document.getElementById('zarafaMbxLang{$t}').value);\n\tXHR.appendData('OuZarafaDeleteADM',document.getElementById('OuZarafaDeleteADM{$t}').value);\n\tXHR.appendData('ou','{$_GET["ou"]}');\n\tAnimateDiv('{$t}-anim');\n\tXHR.sendAndLoad('{$page}', 'GET',X_ENABLE_ZARAFA_COMPANY);\t\n}\n\n\nfunction zarafaDScanMBXLang{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zarafaScanMbxLang','yes');\n\tXHR.appendData('ou','{$_GET["ou"]}');\n\tAnimateDiv('{$t}-anim');\n\tXHR.sendAndLoad('{$page}', 'POST',X_ENABLE_ZARAFA_COMPANY);\t\n}\n\n</script>\t\n\t\n\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例6: LDAP_SEARCH_2QUERY
function LDAP_SEARCH_2QUERY($dn = null, $query, $key, $tofind)
{
$ldap = new clladp();
if ($dn != null) {
$dn = $dn . ',' . $ldap->suffix;
} else {
$dn = $ldap->suffix;
}
$hash = $ldap->Ldap_search($dn, $query, array($tofind, $key));
for ($z = 0; $z < $hash["count"]; $z++) {
$value = $hash[$z][$key][0];
for ($i = 0; $i < $hash[$z][strtolower($tofind)]["count"]; $i++) {
$res = $res . "{$value}=" . $hash[$z][strtolower($tofind)][$i] . "<br> ";
}
}
return $res;
}
示例7: BuildList
function BuildList()
{
if (!isset($_SESSION["uid"])) {
if (!logon()) {
die;
}
}
$users = new usersMenus();
if (!$users->AsSystemAdministrator) {
die;
}
$filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn=*)(ComputerIP=*)(uid=*))(gecos=computer))";
$attrs = array("uid", "ComputerIP", "ComputerOS", "ComputerMachineType", "ComputerMacAddress", "ComputerRealName", "DnsZoneName", "DnsType");
$ldap = new clladp();
$dn = "{$ldap->suffix}";
$hash["COMPUTERS"] = $ldap->Ldap_search($dn, $filter_search, $attrs);
$hash["VPN"] = export_vpn_remotes_sites();
echo base64_encode(serialize($hash));
}
示例8: SyncSafeBoxes
function SyncSafeBoxes()
{
$ldap = new clladp();
$pattern = "(&(objectclass=UserArticaClass)(CryptedHome=TRUE))";
$dn = "dc=organizations,{$ldap->suffix}";
$filters = array("uid", "CryptedHomePassword", "homeDirectory");
$hash = $ldap->Ldap_search($dn, $pattern, $filters);
if ($hash["count"] == 0) {
return;
}
writelogs("{$hash["count"]} user(s) with safe box", __FUNCTION__, __FILE__, __LINE__);
for ($i = 0; $i < $hash["count"]; $i++) {
$cryptedhomepassword = $hash[$i]["cryptedhomepassword"][0];
if ($cryptedhomepassword == null) {
continue;
}
$uid = $hash[$i]["uid"][0];
$homedirectory = $hash[$i]["homedirectory"][0];
$dn = $hash[$i]["dn"];
SafeBoxMount($uid, $dn, $homedirectory, $cryptedhomepassword, $ldap->suffix);
}
}
示例9: computer_list
function computer_list()
{
if ($_GET["tofind"] == '*') {
$_GET["tofind"] = null;
}
if ($_GET["tofind"] == null) {
$tofind = "*";
} else {
$tofind = "*{$_GET["tofind"]}*";
}
$filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))";
$ldap = new clladp();
$attrs = array("uid", "ComputerIP", "ComputerOS");
$dn = "{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter_search, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$realuid = $hash[$i]["uid"][0];
$hash[$i]["uid"][0] = strtolower(str_replace('$', '', $hash[$i]["uid"][0]));
$js = MEMBER_JS($realuid, 1);
$finalHash[$hash[$i]["uid"][0]] = $hash[$i][strtolower("ComputerIP")][0];
}
return $finalHash;
}
示例10: computer_list
function computer_list()
{
if ($_GET["tofind"] == '*') {
$_GET["tofind"] = null;
}
if ($_GET["tofind"] == null) {
$tofind = "*";
} else {
$tofind = "*{$_GET["tofind"]}*";
}
$filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))";
$ldap = new clladp();
$attrs = array("uid", "ComputerIP", "ComputerOS", "ComputerMachineType");
$dn = "{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter_search, $attrs, 20);
$PowerDNS = "<td width=1%><h3> | </h3></td><td><h3>" . texttooltip('{APP_PDNS}', '{APP_PDNS_TEXT}', "javascript:Loadjs('pdns.php')") . "</h3></td>";
if ($_GET["mode"] == "selection") {
$PowerDNS = null;
}
$html = "\n\n<input type='hidden' id='mode' value='{$_GET["mode"]}' name='mode'>\n<input type='hidden' id='value' value='{$_GET["value"]}' name='value'>\n<input type='hidden' id='callback' value='{$_GET["callback"]}' name='callback'>\n<table style='width:100%'><tr>\n<td width=1% nowrap><H3>{$hash["count"]} {computers}</H3></td>{$PowerDNS}</tr></table>\n<table style='width:100%'>";
for ($i = 0; $i < $hash["count"]; $i++) {
$realuid = $hash[$i]["uid"][0];
$hash[$i]["uid"][0] = str_replace('$', '', $hash[$i]["uid"][0]);
$js = MEMBER_JS($realuid, 1);
if ($_GET["mode"] == "dansguardian-ip-group") {
$js_add = "<td width=1%>" . imgtootltip('add-18.gif', "{add_computer}", "AddComputerToDansGuardian('{$realuid}','{$_GET["value"]}')") . "</td>";
}
if ($_GET["mode"] == "selection") {
$js = "{$_GET["callback"]}('{$realuid}');";
}
$roolover = CellRollOver($js);
$ip = $hash[$i][strtolower("ComputerIP")][0];
$os = $hash[$i][strtolower("ComputerOS")][0];
$type = $hash[$i][strtolower("ComputerMachineType")][0];
$name = $hash[$i]["uid"][0];
if (strlen($name) > 25) {
$name = substr($name, 0, 23) . "...";
}
if ($os == "Unknown") {
if ($type != "Unknown") {
$os = $type;
}
}
if (strlen($os) > 20) {
$os = texttooltip(substr($os, 0, 17) . '...', $os, null, null, 1);
}
if (strlen($ip) > 20) {
$ip = texttooltip(substr($ip, 0, 17) . '...', $ip, null, null, 1);
}
$html = $html . "<tr>\n\t<td width=1% {$roolover}><img src='img/base.gif'></td>\n\t<td {$roolover} nowrap><strong>{$name}</strong></td>\n\t<td {$roolover}><strong>{$ip}</strong></td>\n\t<td {$roolover}><strong>{$os}</strong></td>\n\t{$js_add}\n\t</tr>\n\t";
}
$html = $html . "</table>";
$tpl = new templates();
return $tpl->_ENGINE_parse_body($html);
}
示例11: users_search_ldap
function users_search_ldap()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$ldap = new clladp();
$ou = $_GET["ou"];
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
if ($_GET["search-users-ldap"] != null) {
$tofind = $_GET["search-users-ldap"];
}
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
$attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
$hash = $ldap->Ldap_search($dn, $filter, $attrs, 550);
$boot = new boostrap_form();
$users = new user();
$number = $hash["count"];
$styleTD = " style='font-size:16px'";
for ($i = 0; $i < $number; $i++) {
$userARR = $hash[$i];
$uid = $userARR["uid"][0];
if ($uid == "squidinternalauth") {
continue;
}
$js = MEMBER_JS($uid, 1, 1);
if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) {
$userARR["sn"][0] = $uid;
}
$sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
if ($userARR["telephonenumber"][0] == null) {
$userARR["telephonenumber"][0] = " ";
}
if ($userARR["mail"][0] == null) {
$userARR["mail"][0] = " ";
}
$link = $boot->trswitch("{$_GET["CallBack"]}('{$uid}')");
$tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$styleTD} width=99% nowrap {$link}><i class='icon-user'></i> {$userARR["sn"][0]} {$userARR["givenname"][0]}<div><i>{$userARR["title"][0]}</i></td>\n\t\t<td {$styleTD} width=99% nowrap {$link}>{$userARR["telephonenumber"][0]}</td>\n\t\t<td {$styleTD} width=99% nowrap {$link}>{$userARR["mail"][0]}</td>\n\t\t</tr>";
}
echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{member}</th>\n\t\t\t\t\t<th>{phone}</th>\n\t\t\t\t\t<th>{email}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>";
}
示例12: find_member
function find_member()
{
if ($_POST["qtype"] == "find-member") {
$tofind = $_POST["query"];
}
if ($_SESSION["uid"] == -100) {
$ou = $_GET["ou"];
} else {
$ou = $_SESSION["ou"];
}
$sock = new sockets();
if (is_base64_encoded($ou)) {
$ou = base64_decode($ou);
}
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$tofind = str_replace('***', '*', $tofind);
$tofind = str_replace('**', '*', $tofind);
$tofind = str_replace('**', '*', $tofind);
$EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
$EnableManageUsersTroughActiveDirectory = 0;
}
writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
$ldap = new clladp();
if (!$ldap->IsOUUnderActiveDirectory($ou)) {
if ($EnableManageUsersTroughActiveDirectory == 1) {
$cc = new ldapAD();
$hash = $cc->find_users($ou, $tofind);
} else {
$ldap = new clladp();
$filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind}) ))";
$attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs, 20);
}
} else {
include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
$p = new external_ad_search();
$hash = $p->find_users($ou, $tofind);
$ldap->EnableManageUsersTroughActiveDirectory = true;
}
$users = new user();
$number = $hash["count"];
$data = array();
$data['page'] = 0;
$data['total'] = $number;
$data['rows'] = array();
for ($i = 0; $i < $number; $i++) {
$user = $hash[$i];
$data['rows'][] = formatUser($user, $ldap->EnableManageUsersTroughActiveDirectory);
}
echo json_encode($data);
}
示例13: MembersSearch
function MembersSearch()
{
$ldap = new clladp();
$tofind = $_POST["query"];
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
$attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber", "sAMAccountName");
$hash = $ldap->Ldap_search($ldap->suffix, $filter, $attrs, $_POST["rp"]);
$users = new user();
$number = $hash["count"];
if ($number == 0) {
json_error_show("no member");
}
$data = array();
$data['page'] = 1;
$data['total'] = $number;
$data['rows'] = array();
$color = "black";
for ($i = 0; $i < $number; $i++) {
$userARR = $hash[$i];
$uid = $userARR["uid"][0];
$uidenc = urlencode($uid);
if ($uid == "squidinternalauth") {
continue;
}
$js = MEMBER_JS($uid, 1, 1);
$jsbl = "javascript:Loadjs('whitelists.members.php?uid={$uidenc}');";
if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) {
$userARR["sn"][0] = $uid;
}
$sn = texttooltip($userARR["sn"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$givenname = texttooltip($userARR["givenname"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$title = texttooltip($userARR["title"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$mail = texttooltip($userARR["mail"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
$telephonenumber = texttooltip($userARR["telephonenumber"][0], "{display}:{$uid}", $js, null, 0, "font-size:13px");
if ($userARR["telephonenumber"][0] == null) {
$userARR["telephonenumber"][0] = " ";
}
if ($userARR["mail"][0] == null) {
$userARR["mail"][0] = " ";
}
$ct = new user($uid);
$CountDeBlack = count($ct->amavisBlacklistSender);
$countDeWhite = count($ct->amavisWhitelistSender);
$id = md5("{$uid}");
$data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:22px;color:{$color}'><a href=\"javascript:blur();\" OnClick=\"{$jsbl}\" style='text-decoration:underline'>{$userARR["givenname"][0]} {$userARR["sn"][0]}</a>\n\t\t\t\t\t\t<br><i style='font-size:14px'><a href=\"javascript:blur();\" OnClick=\"{$js}\" style='text-decoration:underline'>{$uid} {$userARR["mail"][0]}</a></i></span>", "<span style='font-size:22px;color:{$color}'>{$CountDeBlack}</span>", "<span style='font-size:22px;color:{$color}'>{$countDeWhite}</span>"));
}
echo json_encode($data);
}
示例14: COMPUTER_FIND
function COMPUTER_FIND()
{
$gpid = $_GET["gpid"];
$ou = $_GET["ou"];
$tofind = $_GET["find_computer"];
$ldap = new clladp();
if ($tofind == null) {
$tofind = '*';
} else {
$tofind = "*{$tofind}*";
}
$filter = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))";
$attrs = array("uid", "ComputerIP", "ComputerOS");
$dn = "dc=samba,{$ldap->suffix}";
$html = "\n<input type='hidden' id='add_computer_confirm' value='{add_computer_confirm}'>\n<table style='width:100%'>";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$realuid = $hash[$i]["uid"][0];
$hash[$i]["uid"][0] = str_replace('$', '', $hash[$i]["uid"][0]);
$html = $html . "<tr " . CellRollOver() . ">\n\t<td width=1%><img src='img/base.gif'></td>\n\t<td><strong>{$hash[$i]["uid"][0]}</strong></td>\n\t<td><strong>{$hash[$i][strtolower("ComputerIP")][0]}</strong></td>\n\t<td><strong>{$hash[$i][strtolower("ComputerOS")][0]}</strong></td>\n\t<td width=1%>" . imgtootltip('plus-16.png', '{add_computer}', "javascript:add_computer_selected('{$gpid}','{$hash[$i]["dn"]}','{$hash[$i]["uid"][0]}','{$realuid}')") . "</td>\n\t</tr>\n\t";
}
$html = $html . "</table>";
$html = RoundedLightGrey($html);
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例15: RELAY_DOMAINS_LIST_SEARCH
function RELAY_DOMAINS_LIST_SEARCH()
{
$ldap = new clladp();
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$ou = $_GET["ou"];
include_once "ressources/class.amavis.inc";
$amavis = new amavis();
$amavis_oui = false;
$t = $_GET["t"];
writelogs("----------------> Hash_relay_domains", __FUNCTION__, __FILE__, __LINE__);
$HashDomains = $ldap->Hash_relay_domains($ou);
$aliases = new AutoAliases($ou);
$users->LoadModulesEnabled();
if ($users->AMAVIS_INSTALLED) {
if ($users->EnableAmavisDaemon == 1) {
$amavis_oui = true;
}
}
$disclaimer = IS_DISCLAIMER();
$tools = new DomainsTools();
$domainstyle = "font-size:16px";
if (isset($_GET["expand"])) {
$domainstyle = "font-size:18px";
}
if ($_POST["query"] != null) {
$search = str_replace("*", ".*?", $_POST["query"]);
}
$data = array();
$c = 0;
while (list($num, $ligne) = each($HashDomains)) {
if ($search != null) {
if (!preg_match("#{$search}#", $num)) {
continue;
}
}
$c++;
$autoalias = " ";
$disclaimer_domain = " ";
$amavis_infos = " ";
$amavis_duplicate = " ";
$delete = imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteRelayDomain{$t}('{$num}')");
if ($amavis->copy_to_domain_array[strtolower($num)]["enable"] == 1) {
$amavis_duplicate = "<strong style='font-size:12px'>{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_host"]}:{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_port"]}";
}
$autoalias = $tpl->_ENGINE_parse_body($autoalias);
writelogs("add in row {$ligne} ", __FUNCTION__, __FILE__);
$arr = $tools->transport_maps_explode($ligne);
$alreadyDomain[$num] = true;
$count++;
$js = "Loadjs('domains.relay.domains.php?domain={$num}&ou={$ou}')";
$relay = "{$arr[1]}:{$arr[2]}";
if (strlen($aliases->DomainsArray[$num]) > 0) {
$autoalias = "<img src='img/20-check.png'>";
}
if ($arr[3] == "yes") {
$mx = "{yes}";
} else {
$mx = "{no}";
}
if ($amavis_oui) {
$amavis_infos = imgtootltip("24-parameters.png", "AS -> {$num}", "Loadjs('domains.amavis.php?domain={$num}')");
}
if ($disclaimer) {
$disclaimer_domain = imgtootltip("24-parameters.png", "disclaimer -> {$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')");
}
$data['rows'][] = array('id' => "dom-{$num}", 'cell' => array("\n\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='{$domainstyle};font-weight:bold;text-decoration:underline'>{$num}</span>", "<span style='font-size:14px'>{$autoalias}</span>", "<span style='font-size:14px'>{$amavis_infos}</span>", "<span style='font-size:14px'>{$disclaimer_domain}</span>", "<span style='font-size:14px'>{$relay}</span>", $delete));
}
$dn = "cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, '(objectclass=transportTable)', array());
for ($i = 0; $i < $hash["count"]; $i++) {
$transport = $hash[$i]["transport"][0];
$domain = $hash[$i]["cn"][0];
if (isset($alreadyDomain[$domain])) {
continue;
}
if ($search != null) {
if (!preg_match("#{$search}#", $domain)) {
continue;
}
}
$arr = $tools->transport_maps_explode($transport);
$relay = "{$arr[1]}:{$arr[2]}";
$js = "PostfixAddRoutingTable('{$domain}')";
$count++;
$data['rows'][] = array('id' => "dom-{$domain}", 'cell' => array("\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:16px;font-weight:bold;text-decoration:underline'>{$domain}</span>", "<span style='font-size:14px'> </span>", "<span style='font-size:14px'> </span>", "<span style='font-size:14px'> </span>", "<span style='font-size:14px'>{$relay}</span>", " "));
}
$data['page'] = 1;
$data['total'] = $c;
echo json_encode($data);
}