function CategoriesCheckGroupsArray() { if (isset($GLOBALS[__CLASS__ . __FUNCTION__])) { return $GLOBALS[__CLASS__ . __FUNCTION__]; } $ldap = new clladp(); $ARRAYPERS = array(); if ($ldap->IsKerbAuth()) { include_once dirname(__FILE__) . "/class.external.ad.inc"; $ad = new external_ad_search(); $groups = $ad->GroupsOfMember($_SESSION["uid"]); if (!is_array($groups)) { $groups = array(); } while (list($dn, $name) = each($groups)) { $ARRAYPERS[strtolower($dn)] = true; } } else { $users = new user($_SESSION["uid"]); $groups = $users->Groups_list(); if (!is_array($groups)) { $groups = array(); } while (list($gid, $name) = each($groups)) { $ARRAYPERS[$gid] = true; } } $GLOBALS[__CLASS__ . __FUNCTION__] = $ARRAYPERS; return $ARRAYPERS; }
function notadmin_status() { $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; include_once dirname(__FILE__) . "/ressources/class.user.inc"; $users = new usersMenus(); if (!$users->SQUID_INSTALLED) { $_SESSION["ACLS_PRIVILEGES"] = null; } $icon = "member-128.png"; $ct = new user($_SESSION["uid"]); $squid_acls = null; if ($ct->AsActiveDirectoryMember) { include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ad = new external_ad_search(); $DN = $ad->GetDNFromUserid($_SESSION["uid"]); $groupsArray = $ad->GroupsOfMember($DN); $MyGroups = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:30px;text-decoration:underline'\n\t\t\t\tOnClick=\"javascript:{$js}\" {$curs}>{$ct->mail}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:top'>{gidNumber} " . count($groupsArray) . " {groups2}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td style='font-size:18px;vertical-align:top'>{organization} <strong>{$ct->ou}</strong></td>\n\t\t</tr>\n\t\t"; } else { $MEMBER_JS = "javascript:blur();"; $OU_js = "javascript:blur();"; $OU_decoration = "none"; $OU_curs = null; if ($users->AllowChangeUserPassword) { $MEMBER_JS = MEMBER_JS($_SESSION["uid"]); } if (VerifyRights_ou()) { $OU_js = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ct->ou}');"; $OU_decoration = "underline"; $OU_curs = $curs; } $MyGroups = "\n\t\t<tr>\n\t\t<td style='font-size:16px;text-decoration:underline'\n\t\tOnClick=\"{$MEMBER_JS}\" {$curs}>{myaccount}: {$ct->mail}\n\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td style='font-size:18px;vertical-align:top'>{my_organization} <strong OnClick=\"{$OU_js}\" {$curs} style='text-decoration:{$OU_decoration}'>{$ct->ou}</strong></td>\n\t\t</tr>\n\t\t"; } if ($users->SQUID_INSTALLED) { if (!isset($_SESSION["ACLS_PRIVILEGES"])) { include_once dirname(__FILE__) . "/ressources/class.squid.acls.privileges.inc"; $f = new squid_acls_privileges(); $_SESSION["ACLS_PRIVILEGES"] = $f->build(); } $squid_acls = $_SESSION["ACLS_PRIVILEGES"]; if ($squid_acls != null) { $squid_acls = "<tr><td>{$squid_acls}</td></tr>"; } } $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' style='width:128px'>\n\t<img src='img/{$icon}'>\n\t</td>\n\t<td style='width:99%'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td style='font-size:30px;vertical-align:top'>{$ct->DisplayName}</td>\n\t</tr>\n\t{$MyGroups}\n\t{$squid_acls}\n\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function search() { $t = $_GET["t"]; $_SESSION["SEARCH_MEMBER_MEMORY"] = $_GET["search"]; $stringtofind = url_decode_special_tool($_GET["search"]); if (preg_match("#(.+?)\\s+\\(#", $stringtofind, $re)) { $stringtofind = trim($re[1]); } $stringtofind = "{$stringtofind}*"; $stringtofind = str_replace("**", "*", $stringtofind); $ldap = new clladp(); $tpl = new templates(); $IsKerbAuth = $ldap->IsKerbAuth(); if (!$IsKerbAuth) { $hash_full = $ldap->UserSearch(null, $stringtofind, 50); $hash1 = $hash_full[0]; $hash2 = $hash_full[1]; $MAIN_HASH = array_merge($hash1, $hash2); } else { include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ad = new external_ad_search(); $hash_full = $ad->UserSearch(null, $stringtofind, 50); $hash1 = $hash_full[0]; $hash2 = $hash_full[1]; $MAIN_HASH = array_merge($hash1, $hash2); } $TABLE[] = "<table style='width:100%'>"; $colortr = null; if (is_array($hash1)) { while (list($num, $ligne) = each($MAIN_HASH)) { $displayname = null; $givenname = null; $uid = null; $email_address = array(); $telephonenumber = array(); $GroupsTableau = null; if ($colortr == "f0f9ec") { $colortr = "FFFFFF"; } else { $colortr = "f0f9ec"; } $sn = null; $gps = array(); if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) { continue; } if (isset($ligne["samaccountname"][0])) { $uid = $ligne["samaccountname"][0]; } if (isset($ligne["userprincipalname"][0])) { $email_address[] = "<div>{$ligne["userprincipalname"][0]}</div>"; } if (isset($ligne["telephonenumber"][0])) { $telephonenumber[] = "<div>{$ligne["telephonenumber"][0]}</div>"; } if (isset($ligne["mobile"][0])) { $telephonenumber[] = "<div>{$ligne["mobile"][0]}</div>"; } if (isset($ligne["givenname"][0])) { $givenname = $ligne["givenname"][0]; } if (isset($ligne["sn"][0])) { $sn = $ligne["sn"][0]; } if ($givenname != null) { if ($sn != null) { $displayname = " {$givenname} {$sn}"; } } if (isset($ligne["mail"][0])) { $email_address[] = "<div>{$ligne["mail"][0]}</div>"; } if (!$IsKerbAuth) { if ($uid == null) { if (isset($ligne["uid"][0])) { $uid = $ligne["uid"][0]; } } } if ($uid == null) { if (preg_match("#^CN=(.+?),#i", $ligne["dn"], $re)) { $uid = $re[1]; $displayname = $re[1]; } } if ($uid == null) { continue; } $TABLE[] = "<tr style='height:60px;background-color:{$colortr}'>"; if ($IsKerbAuth) { $DN = $ligne["dn"]; $ad = new external_ad_search(); $DNENC = urlencode($DN); $js = "Loadjs('system.member.activedirectory.php?DN={$DNENC}')"; $Groups = $ad->GroupsOfMember($DN); } else { $js = "Loadjs('system.member.ldap.php?uid={$uid}')"; $ct = new user($uid); $Groups = $ct->GroupsOf; } while (list($GroupDN, $GroupName) = each($Groups)) { if (trim($GroupName) == null) { continue; } $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id=" . urlencode($GroupDN) . "',true)"; $gps[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a>"; if (count($gps) > 5) { $gps[] = "..."; break; } } $GroupsTableau = @implode(", ", $gps); $picture_link = "img/impersonate-photo-48.png"; $linkuser = "******"javascript:blur();\" OnClick=\"javascript:{$js}\" style='text-decoration:underline'>"; if ($displayname == null) { $displayname = trim($ligne["displayname"][0]); } if ($displayname == null) { $displayname = $uid; } if (strpos($displayname, '$') > 0) { $displayname = str_replace("\$", "", $displayname); $picture_link = "img/computer-tour2-48.png"; $linkuser = null; } $TABLE[] = "<td style='width:48px;'>"; $TABLE[] = "<img src='{$picture_link}' style='border-radius: 50% 50% 50% 50%;\n box-shadow: 0 0 5px silver;height: 48px;margin: 0 32px;width: 48px;'>"; $TABLE[] = "</td>"; $TABLE[] = "<td style='width:300px;padding-left:5px'>"; $TABLE[] = "<span style='font-size:18px'>{$linkuser}{$displayname}</a></span>"; $TABLE[] = "</td>"; $TABLE[] = "<td style='width:300px;padding-left:5px'>"; $TABLE[] = "<span style='font-size:18px'>" . @implode("", $email_address) . "</span>"; $TABLE[] = "</td>"; $TABLE[] = "<td>"; $TABLE[] = "<span style='font-size:18px;padding-left:5px;width:300px;'>" . @implode("", $telephonenumber) . "</span>"; $TABLE[] = "</td>"; $TABLE[] = "<td>"; $TABLE[] = "<span style='font-size:18px;padding-left:5px'>{$GroupsTableau}</span>"; $TABLE[] = "</td>"; $TABLE[] = "</tr>"; } } $TABLE[] = "</table>"; $TABLE[] = "<script>"; $TABLE[] = "document.getElementById('title-{$t}').innerHTML='{$stringtofind}';"; $TABLE[] = "</script>"; echo $tpl->_ENGINE_parse_body(@implode("", $TABLE)); }
function privileges() { $tpl = new templates(); $sock = new sockets(); if ($GLOBALS["VERBOSE"]) { echo "<H1>" . __FUNCTION__ . "(line " . __LINE__ . ")</H1>\n"; } $EnableSambaVirtualsServers = 0; include_once dirname(__FILE__) . "/ressources/class.translate.rights.inc"; $cr = new TranslateRights(null, null); $r = $cr->GetPrivsArray(); $users = new usersMenus(); $ldap = new clladp(); $ht = array(); $ht[] = "<div style='width:98%' class=form>"; $ht[] = "<table style='width:99%'>"; if ($ldap->IsKerbAuth()) { if ($GLOBALS["VERBOSE"]) { echo "<li><strong>IsKerbAuth = TRUE (line " . __LINE__ . ")</strong></li>\n"; } include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ht[] = "<div style='font-size:18px;font-weight:bold'>{my_microsoft_groups}</div>"; $ad = new external_ad_search(); $groups = $ad->GroupsOfMember($_SESSION["uid"]); while (list($dn, $name) = each($groups)) { $ht[] = "<tr>\n\t\t\t\t\t<td width=1% valign='top'><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t<td><span style='font-size:14px;font-weight:bold'>{$name}</span>\n\t\t\t\t\t\t<br><span style='font-size:10px'> ({$dn})</span></td>\n\t\t\t\t</tr>"; } } while (list($key, $val) = each($r)) { if ($GLOBALS["VERBOSE"]) { echo "<li>{$key} = \"{$val}\"</li>\n"; } if ($users->{$key}) { $ht[] = "<tr><td width=1%><img src='img/arrow-right-16.png'></td><td><span style='font-size:14px'>{{$key}}</span></td></tr>"; } } $users = new usersMenus(); if ($users->SAMBA_INSTALLED) { $EnableSambaVirtualsServers = $sock->GET_INFO("EnableSambaVirtualsServers"); if (!is_numeric($EnableSambaVirtualsServers)) { $EnableSambaVirtualsServers = 0; } } if ($EnableSambaVirtualsServers == 1) { if (count($_SESSION["VIRTUALS_SERVERS"]) > 0) { $ht[] = "<tr><td colspan=2 style='font-size:16px;font-weight:bolder'>{virtual_servers}</td></tr>"; while (list($key, $val) = each($_SESSION["VIRTUALS_SERVERS"])) { $ht[] = "<tr><td width=1%><img src='img/arrow-right-16.png'></td><td><span style='font-size:14px'>{$key}</span></td></tr>"; } } } $ht[] = "</table></div>"; echo $tpl->_ENGINE_parse_body(@implode("\n", $ht)); }
function tests() { $ad = new external_ad_search(); print_r($ad->GroupsOfMember("CN=Jerome JB. Beunel,OU=AFEONLINE,OU=AFE,DC=afeonline,DC=net")); }