function MEMBER_JS_JS() { header("content-type: application/x-javascript"); $comp = new computers(); $uid = $comp->ComputerIDFromMAC($_GET["MEMBER_JS"]); echo MEMBER_JS($uid, 1, 1); }
function popup() { $users = new usersMenus(); $ct = new user($_GET["uid"]); $tpl = new templates(); $title = $ct->DisplayName; $GRPS = $ct->GetGroups($_GET["uid"], 1); while (list($num, $GroupName) = each($ct->GroupsOf)) { $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id={$num}',true)"; $XTRG[] = "<tr>\n\t\t\t\t\t<td style='width:16px'><img src='img/wingroup.png'></td>\n\t\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a></td>\n\t\t\t\t</tr>"; } $editjs = MEMBER_JS($_GET["uid"], 1, 1); $bouton = button("{edit_member}", $editjs, 18, 185); if ($users->cyrus_imapd_installed) { include_once dirname(__FILE__) . "/ressources/class.cyrus.inc"; $cyr = new cyrus(); $RealMailBox = $cyr->IfMailBoxExists($_GET["uid"]); $button2 = "<div style='margin-top:10px'>" . button("{mailbox}", "Loadjs('domain.edit.user.cyrus-mailbox.php?js=yes&uid={$_GET["uid"]}')", 18, 185) . "</div>"; if (!$RealMailBox) { if (preg_match("#Authentication failed#i", $cyr->cyrus_infos)) { $error = "<p class=text-error>{authentication_failed_cyrus}</p>"; } else { $error = "<p class=text-error>{user_no_mailbox} !!</p>"; $button2 = "<div style='margin-top:10px'>" . button("{create_mailbox2}", "Loadjs('domains.edit.user.php?create-mailbox-wizard=yes&uid={$_GET["uid"]}&MailBoxMaxSize=0')", 18, 185) . "</div>"; } } } $picture_link = "img/impersonate-photo.png"; $html = "\n\t{$error}\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:190px;vertical-align:top'>\n\t\t<center style='margin-top:15px'>\n\t\t<img style='border-radius: 50% 50% 50% 50%;\n \t\tbox-shadow: 0 0 5px silver;height: 180px;margin: 0 32px;width: 180px;' src='{$picture_link}'></a>\n <center style='font-size: 24px;line-height: 1.2;word-wrap: break-word;margin-top:30px;margin-bottom:30px'>\n {$title}</center>\n\n {$bouton}{$button2}\n </center>\t\n\t</td>\n\t\t<td style='width:80%;vertical-aglin:top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend><div>{Contact_Information}:</div>\n\t\t\t\t<i style='font-size:16px'>{$description}</i></td>\n\t\t\t</tr>\n\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{member}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->givenName} {$ct->sn}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{account}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->uid}</strong></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{email}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mail}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{telephoneNumber}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->telephoneNumber}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{mobile}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mobile}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend>" . count($GRPS) . " {groups}:</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRG) . "</table></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<p> </p>\n\t</div>\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function formatUser($hash) { $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2>\n\t\t\t<span style='font-size:14px;font-weight:bold;text-transform:capitalize'>{$hash["displayname"][0]}</span> - \n\t\t\t<span style='font-size:10px;font-weight:bold;text-transform:capitalize'>{$hash["sn"][0]} {$hash["givenname"][0]}</span>\n\t\t\t\n\t\t\t<hr style='border:1px solid #FFF;margin:3px'>\n\t\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right'><span style='font-size:10px;font-weight:bold'>{$hash["title"][0]}</span> | {$hash["mail"][0]} | {$hash["telephonenumber"][0]}\n\t</table>\n\t\n\t"; $js = MEMBER_JS($hash["uid"][0], 1); $html = RoundedLightGrey($html, $js, 1); $html = "<div style='margin:5px;padding-right:10px;padding-left:10px'>{$html}</div>"; return $html; }
function local_users() { $stringtofind = $_GET["browser-users"]; $ldap = new clladp(); $page = CurrentPageName(); $tpl = new templates(); if ($_SESSION["ou"] != null) { $ou = $_SESSION["ou"]; } $hash = $ldap->UserSearch($ou, $stringtofind); $YahooWin = "YahooWin5"; if (isset($_GET["YahooWin"])) { $YahooWin = "YahooWin{$_GET["YahooWin"]}"; } $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th colspan=4>{members}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; for ($i = 0; $i < $hash[0]["count"]; $i++) { $ligne = $hash[0][$i]; $dn = $ligne["dn"]; if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) { continue; } $uid = $ligne["uid"][0]; if ($uid == null) { continue; } if ($uid == "squidinternalauth") { continue; } if ($array[$uid] != null) { continue; } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ct = new user($uid); $js = MEMBER_JS($uid, 1, 1); $img = imgtootltip("contact-48.png", "{view}", $js); $add = imgtootltip("plus-24.png", "{add}", "SelectMemberBrowser('{$uid}')"); $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>{$img}</td>\n\t\t\t<td><strong style='font-size:14px'>{$ct->DisplayName}</td>\n\t\t\t<td width=1%>{$add}</td>\n\t\t\t</tr>\n\t\t\t"; } $html = $html . "</tbody></table>\n\t<script>\t\n\t\tfunction SelectMemberBrowser(uid){\n\t\t\tdocument.getElementById('{$_GET["field"]}').value=uid;\n\t\t\t{$YahooWin}Hide();\n\t\t}\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
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; }
function computer_list() { $tofindorg = $_POST["query"]; $tpl = new templates(); $_GET["tofind"] = $_POST["query"]; $MyPage = CurrentPageName(); if ($_GET["tofind"] == '*') { $_GET["tofind"] = null; } if ($_GET["tofind"] == null) { $tofind = "*"; } else { $tofind = "*{$_GET["tofind"]}*"; } $tofind = str_replace("**", "*", $tofind); $filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))"; $ldap = new clladp(); $attrs = array("uid", "ComputerIP", "ComputerOS", "ComputerMachineType", "ComputerMacAddress"); $dn = "{$ldap->suffix}"; $hash = $ldap->Ldap_search($dn, $filter_search, $attrs, $_POST["rp"]); if (IsPhysicalAddress($tofindorg)) { $tofind = strtolower($tofindorg); $tofind = str_replace('-', ":", $tofind); $patternMac = "(&(objectclass=posixAccount)(ComputerMacAddress={$tofind}))"; $hash2 = $ldap->Ldap_search($dn, $patternMac, $attrs, $_POST["rp"]); } $spanStyle = "<span style='font-size:14px;font-weight:bold'>"; $data['page'] = 1; $data['total'] = $hash["count"]; $data['rows'] = array(); $c = 0; $unknown = $tpl->_ENGINE_parse_body("{unknown}"); 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); $Alreadyrealuid[$realuid] = true; if ($_GET["mode"] == "dansguardian-ip-group") { $js_add = "<td width=1%>" . imgtootltip('add-18.png', "{add_computer}", "AddComputerToDansGuardian('{$realuid}','{$_GET["value"]}')") . "</td>"; } if ($_GET["mode"] == "selection") { $js = "{$_GET["callback"]}('{$realuid}');"; } $ip = $hash[$i][strtolower("ComputerIP")][0]; $os = $hash[$i][strtolower("ComputerOS")][0]; $type = $hash[$i][strtolower("ComputerMachineType")][0]; $name = $hash[$i]["uid"][0]; if ($os == "Unknown") { if ($type != "Unknown") { $os = $type; } } $js = str_replace("javascript:", '', $js); $md5S = md5(serialize($hash[$i])); if (!preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\$#", $ip)) { $ip = gethostbyname($hash[$i]["uid"][0]); if (!preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\$#", $ip)) { $ip = $unknown; } else { $computer = new computers($realuid); $computer->update_ipaddr($ip); } } if ($os == "UnKnown") { $os = $unknown; } $c++; $delete = imgsimple("delete-24.png", null, "Loadjs('{$MyPage}?computer-delete-js=yes&uid={$realuid}&id={$md5S}')"); $data['rows'][] = array('id' => $md5S, 'cell' => array("<img src='img/computer-32.png'>", "<a href='#' OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline;font-weight:bold'>{$name}</a>", "{$spanStyle}{$ip}</span>", "{$spanStyle}{$os}</span>", $delete)); } if (is_array($hash2)) { for ($i = 0; $i < $hash2["count"]; $i++) { $realuid = $hash2[$i]["uid"][0]; if (isset($Alreadyrealuid[$realuid])) { continue; } $hash2[$i]["uid"][0] = str_replace('$', '', $hash2[$i]["uid"][0]); $js = MEMBER_JS($realuid, 1); $Alreadyrealuid[$realuid] = true; if ($_GET["mode"] == "dansguardian-ip-group") { $js_add = "<td width=1%>" . imgtootltip('add-18.png', "{add_computer}", "AddComputerToDansGuardian('{$realuid}','{$_GET["value"]}')") . "</td>"; } if ($_GET["mode"] == "selection") { $js = "{$_GET["callback"]}('{$realuid}');"; } $ip = $hash2[$i][strtolower("ComputerIP")][0]; $os = $hash2[$i][strtolower("ComputerOS")][0]; $type = $hash2[$i][strtolower("ComputerMachineType")][0]; $name = $hash2[$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); } $js = str_replace("javascript:", '', $js); $md5S = md5(serialize($hash2[$i])); $delete = imgsimple("delete-24.png", null, "Loadjs('{$MyPage}?computer-delete-js=yes&uid={$realuid}&id={$md5S}');"); $c++; $data['rows'][] = array('id' => $md5S, 'cell' => array("<img src='img/computer-32.png'>", "<a href='#' OnClick=\"javascript:{$js}\" style='font-size:13px;text-decoration:underline'>{$name}</a>", "{$spanStyle}{$ip}</span>", "{$spanStyle}{$os}</span>", $delete)); } } $data['total'] = $c; if ($c == 0) { json_error_show("no item"); } echo json_encode($data); }
function mailbox_items(){ $tpl=new templates(); $MyPage=CurrentPageName(); $q=new mysql(); $t=$_GET["t"]; $search='%'; $table="zarafauserss"; $database="artica_events"; $page=1; $ORDER=""; $total=0; if($q->COUNT_ROWS($table,$database)==0){json_error_show("$table, no such table");} if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}} if(isset($_POST['page'])) {$page = $_POST['page'];} if($_POST["query"]<>null){ $_POST["query"]="*".$_POST["query"]."*"; $_POST["query"]=str_replace("**", "*", $_POST["query"]); $_POST["query"]=str_replace("**", "*", $_POST["query"]); $_POST["query"]=str_replace("*", "%", $_POST["query"]); $search=$_POST["query"]; $searchstring="AND (`{$_POST["qtype"]}` LIKE '$search')"; $sql="SELECT COUNT(*) as TCOUNT FROM `$table` WHERE 1 $searchstring"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database)); $total = $ligne["TCOUNT"]; }else{ $sql="SELECT COUNT(*) as TCOUNT FROM `$table` WHERE 1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) {$rp = $_POST['rp'];} $pageStart = ($page-1)*$rp; $limitSql = "LIMIT $pageStart, $rp"; if($OnlyEnabled){$limitSql=null;} $sql="SELECT * FROM `$table` WHERE 1 $searchstring $ORDER $limitSql"; writelogs($sql,__FUNCTION__,__FILE__,__LINE__); $results = $q->QUERY_SQL($sql,$database); if(!$q->ok){json_error_show("$q->mysql_error");} $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); while ($ligne = mysql_fetch_assoc($results)) { $uid=$ligne["uid"]; $md5=$ligne["zmd5"]; $color="black"; $imglicense="22-key.png"; if($ligne["license"]==0){$imglicense="ed_delete_grey.gif";} $js=MEMBER_JS($uid,1,1); $license=imgsimple($imglicense,"{delete}"); $href="<a href=\"javascript:blur();\" OnClick=\"javascript:$js\" style='font-size:14px;text-decoration:underline'>"; $span="<span style='font-size:14px'>"; $ligne["storesize"]=FormatBytes($ligne["storesize"]/1024); $data['rows'][] = array( 'id' => $md5, 'cell' => array( $span.$href.$uid."</a></span>", $span.$href.$ligne["mail"]."</a></span>", $span.$href.$ligne["ou"]."</a></span>", $span.$license."</span>", $span.$href.$ligne["NONACTIVETYPE"]."</a></span>", $span.$ligne["storesize"]."</a></span>", ) ); } echo json_encode($data); }
function users_search_directory() { $database = "artica_backup"; $search = '%'; $table = "squid_ssl"; $page = 1; $FORCE_FILTER = "AND `type`='ssl-bump-wl'"; $t = $_GET["t"]; $dn = urldecode($_GET["dn"]); $sock = new sockets(); if ($_POST["query"] != null) { $tofind = $_POST["query"]; } if ($tofind == null) { $tofind = '*'; } else { $tofind = "*{$tofind}*"; } if (strpos($dn, ",") > 0) { $ou = $dn; } include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ad = new external_ad_search(); $hash = $ad->find_users($ou, $tofind, $_POST['rp']); $number = $hash["count"]; if (!is_numeric($number)) { $number = 0; } $data = array(); $data['page'] = 1; $data['total'] = $number; $data['rows'] = array(); for ($i = 0; $i < $number; $i++) { $userARR = $hash[$i]; $dn = null; $uid = $userARR["uid"][0]; if (isset($userARR["samaccountname"][0])) { $uid = $userARR["samaccountname"][0]; } if (isset($userARR["distinguishedname"][0])) { $dn = $userARR["distinguishedname"][0]; } if ($uid == "squidinternalauth") { continue; } $js = MEMBER_JS($uid, 1, 1, $dn); if ($userARR["sn"][0] == null && $userARR["givenname"][0] == null) { $userARR["sn"][0] = $uid; } $sn = $userARR["sn"][0]; $givenname = $userARR["givenname"][0]; $title = $userARR["title"][0]; $mail = $userARR["mail"][0]; $telephonenumber = $userARR["telephonenumber"][0]; if ($userARR["telephonenumber"][0] == null) { $userARR["telephonenumber"][0] = " "; } if ($userARR["mail"][0] == null) { $userARR["mail"][0] = " "; } $img = imgsimple("contact-24.png", null, $js); $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='text-decoration:underline'>"; $dele = " "; $data['rows'][] = array('id' => $uid, 'cell' => array($img, "<span style='font-size:14px;color:{$color}'>{$href}{$userARR["sn"][0]} {$userARR["givenname"][0]}</a><div><i>{$userARR["title"][0]}</i></span>", "<span style='font-size:14px;color:{$color}'>{$userARR["telephonenumber"][0]}</span>", "<span style='font-size:14px;color:{$color}'>{$href}{$userARR["mail"][0]}</a></span>", $dele)); } echo json_encode($data); }
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); }
function showConfig() { echo MEMBER_JS($_GET["userid"], 1, 1); }
function list_nets() { $tpl = new templates(); $page = CurrentPageName(); $search = $_GET["search"]; $q = new mysql(); if ($search != null) { $search = "*{$search}*"; $search = str_replace("**", "*", $search); $search = str_replace("*", "%", $search); $search_sql = " WHERE (mac LIKE '{$search}') OR (ipaddr LIKE '{$search}') OR (hostname LIKE '{$search}')"; } $sql = "SELECT * FROM dhcpd_leases {$search_sql} ORDER BY `dhcpd_leases`.`cltt` DESC LIMIT 0,100"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<th width=1%> </th>\n\t<th>{hostname}</th>\n\t<th>{ipaddr}</th>\n\t<th>{ComputerMacAddress}</th>\n\t<th>{end}</th>\n</thead>\n<tbody class='tbody'>"; $cmp = new computers(); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ligne["hostname"] = trim($ligne["hostname"]); if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } if ($ligne["mac"] == null) { continue; } $tooltip = "\n\t\t<table class=form>\n\t\t<tr>\n\t\t\t<td class=legend>start:</td>\n\t\t\t<td><strong style=font-size:13px>{$ligne["starts"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>cltt:</td>\n\t\t\t<td><strong style=font-size:13px>{$ligne["cltt"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>tstp:</td>\n\t\t\t<td><strong style=font-size:13px>{$ligne["tstp"]}</td>\n\t\t</tr>\n\t\t</table>\n\t\t"; $js = null; $uid = $cmp->ComputerIDFromMAC($ligne["mac"]); if ($uid != null) { $img = "30-computer.png"; $js = MEMBER_JS($uid, 1, 1); $tooltip = $tooltip . "<br>{view}"; } else { $img = "30-computer-grey.png"; } if ($ligne["hostname"] == null) { $ligne["hostname"] = " "; } if ($ligne["ipaddr"] == null) { $ligne["ipaddr"] = " "; } if ($ligne["mac"] == null) { $ligne["mac"] = " "; } $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td width=1% style='font-size:14px' align='center'>" . imgtootltip("30-computer.png", "{$tooltip}", $js) . "</td>\n\t\t<td style='font-size:13px'>{$href}{$ligne["hostname"]}</a></td>\n\t\t<td style='font-size:13px' nowrap>{$href}{$ligne["ipaddr"]}</a></td>\n\t\t<td style='font-size:13px'>{$href}{$ligne["mac"]}</a></td>\n\t\t<td style='font-size:13px' nowrap>{$href}{$ligne["ends"]}</td>\n\t</tr>\n\t\t"; } $html = $html . "</table>\n\n\n"; echo $tpl->_ENGINE_parse_body($html); }
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 USERS_POPUP_LIST() { $page = CurrentPageName(); $sock = new sockets(); $tpl = new templates(); $ou = $_GET["ou"]; $sql = "SELECT * FROM mbx_migr_users WHERE ou='{$ou}'"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H3>{$q->mysql_error}</h3>"; } $html = "\n\t<center>\n\t<table style='margin:5px'>\n\t<tr>\n\t\t<td width=50%>" . button("{restart_task}", "RestartMembers('{$_GET["ou"]}')") . "</td>\n\t\t<td width=50%>" . button("{run_task}", "ReloadMembers()") . "</td>\n\t</tr>\n\t</table>\n\t<hr style='width:70%'>\n\t</center>\n\t\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th> </th>\n\t<th>{member}</th>\n\t<th>{imap_server}</th>\n\t<th>{account}</th>\n\t<th>{terminated}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $over = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\""; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $PID = $ligne["PID"]; $status = "<br><strong style='color:#7C7777;font-size:11px'><i>{stopped} PID:{$PID}</i></strong>"; $showuser = MEMBER_JS($ligne["uid"], 1, 1); if ($ligne["imported"] == 0) { $imported = "danger24.png"; } else { $imported = "ok24.png"; } if ($sock->getFrameWork("cmd.php?ProcessExists=yes&PID={$PID}")) { $status = "<br><strong style='color:#d32d2d;font-size:11px'><i>{running} PID {$PID}</i></strong>"; } $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>" . imgtootltip("user-32.png", $ligne["uid"], $showuser) . "</td>\n\t\t\t<td width=99%><strong style='font-size:14px;text-decoration:underline' {$over} OnClick=\"javascript:MigrShowLogs('{$ligne["zmd5"]}')\">{$ligne["uid"]}</td>\n\t\t\t<td width=99%><strong style='font-size:14px;' {$over} OnClick=\"javascript:MigrShowLogs('{$ligne["zmd5"]}')\">{$ligne["imap_server"]}{$status}</td>\n\t\t\t<td width=99%><strong style='font-size:14px;' {$over} OnClick=\"javascript:MigrShowLogs('{$ligne["zmd5"]}')\">{$ligne["username"]}</td>\n\t\t\t<td align='center' width=1%><strong style='font-size:14px'><img src='img/{$imported}'></td>\n\t\t\t</tr>\n\t\t\t"; } $html = $html . "</tbody></table>\n\t<div style='text-align:right;margin-top:8px'>" . imgtootltip("refresh-32.png", "{refresh}", "RefreshTab('main_config_migrmbx')") . "</div>\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function search() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $sock = new sockets(); $search = '%'; $table = "dhcpd_logs"; $database = "artica_events"; $page = 1; $FORCE_FILTER = ""; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } $computers = new computers(); while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $uid = null; $mac = null; $js = "zblur()"; if (preg_match("#to\\s+([0-9a-z:]+)\\s+via#", $ligne["description"], $re)) { $mac = $re[1]; } if (preg_match("#from\\s+([0-9a-z:]+)\\s+via#", $ligne["description"], $re)) { $mac = $re[1]; } if ($mac != null) { $uid = $computers->ComputerIDFromMAC($mac); if ($uid != null) { $js = MEMBER_JS($uid, 1, 1); $uri = "<a href=\"javascript:blur();\" OnClick=\"{$js}\" style='font-size:14px;font-weight:bold;color:{$color};text-decoration:underline'>{$mac}</a> <span style='font-size:11px'>({$uid})</span>"; $ligne["description"] = str_replace($mac, $uri, $ligne["description"]); } } $data['rows'][] = array('id' => "{$ID}", 'cell' => array("<span style='font-size:14px;color:{$color}'>{$urljs}{$ligne["zDate"]}</a></span>", "<span style='font-size:14px;color:{$color}'>{$ligne["description"]}</a></span>")); } echo json_encode($data); }
function SearchComputers() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql(); $search = "*" . $_GET["SearchComputers"] . "*"; $search = str_replace("**", "*", $search); $search = str_replace("**", "*", $search); $search = str_replace("*", "%", $search); $order = "ORDER BY hardware.LASTDATE DESC"; if (trim($_GET["orderBydate"]) != null) { $order = "ORDER BY hardware.LASTDATE {$_GET["orderBydate"]} "; } $add_computer_js = "YahooUser(780,'domains.edit.user.php?userid=newcomputer\$&ajaxmode=yes','New computer');"; $add = imgtootltip("plus-24.png", "{add}", $add_computer_js); $sql = "SELECT networks.*,hardware.* FROM networks,hardware WHERE\n\tnetworks.HARDWARE_ID=hardware.ID\n\tAND ( (hardware.NAME LIKE '{$search}') OR (networks.MACADDR LIKE '{$search}') OR (networks.IPADDRESS LIKE '{$search}') OR (hardware.OSNAME LIKE '{$search}'))\n\t{$order} LIMIT 0,30\n\t"; $html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>{$add}</th>\n\t\t<th><a href=\"javascript:blur();\" OnClick=\"OcsFilterBYDate()\" style='font-weight:bold;text-decoration:underline'>{date}</a></th>\n\t\t<th>{hostname}</th>\n\t\t<th>{ipaddr}</th>\n\t\t<th>MAC</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $results = $q->QUERY_SQL($sql, "ocsweb"); $computer = new computers(); if (!$q->ok) { if (preg_match("#Unknown database#", $q->mysql_error)) { $sock = new sockets(); $sock->getFrameWork("services.php?mysql-ocs=yes"); $results = $q->QUERY_SQL($sql, "ocsweb"); } if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } } $cs = 0; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["MACADDR"] == "unknown") { continue; } $color = "black"; $uid = null; $OSNAME = null; if ($ligne["OSNAME"] == "Unknown") { $ligne["OSNAME"] = null; } //$delete=imgtootltip("delete-32.png","{delete}","CgroupProcessDel('{$ligne["process_name"]}')"); if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $md = md5($ligne["MACADDR"]); $uid = $computer->ComputerIDFromMAC($ligne["MACADDR"]); $view = " "; $jsfiche = MEMBER_JS($uid, 1, 1); $uri = $ligne["NAME"]; if ($uid != null) { $view = imgtootltip("computer-32.png", "{view}", $jsfiche); } $js[] = "LoadAjaxTiny('cmp-{$md}','{$page}?compt-status={$ligne["IPADDRESS"]}');"; if ($ligne["OSNAME"] != null) { $OSNAME = "<div style='font-size:9px'><i>{$ligne["OSNAME"]}</i></div>"; } if ($_GET["callback"] != null) { $view = imgtootltip("arrow-down-32.png", "{select}", "{$_GET["callback"]}('{$uid}')"); $uri = texttooltip($ligne["NAME"], "{view}", $jsfiche, null, 0, "font-size:12px;text-decoration:underline"); } $cs++; $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td style='font-size:12px;font-weight:normal;color:{$color}' width=1% nowrap>{$view}</td>\n\t\t\t<td style='font-size:12px;font-weight:normal;color:{$color}' width=1% nowrap>{$link}{$ligne["LASTDATE"]}</a></td>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=99%>{$link}{$uri}</a>{$OSNAME}</td>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=1%>{$link}{$ligne["IPADDRESS"]}</a></td>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=1%>{$link}{$ligne["MACADDR"]}</a></td>\n\t\t\t<td width=1%><input type=hidden id='ipaddr-{$cs}' value='{$ligne["IPADDRESS"]}'><div id='cmp-{$cs}'><img src='img/unknown24.png'></div></td>\n\t\t</tr>\n\t\t"; } $html = $html . "</tbody></table>\n\t'\n\t<script>\n\t\n\t\n\tfunction CheckIpConfig2(i){\n\t\tif(document.getElementById('ipaddr-'+i)){\n\t\t\tvar ipaddr=document.getElementById('ipaddr-'+i).value;\n\t\t\tLoadAjaxPreload('cmp-'+i,'{$page}?compt-status='+ipaddr);\n\t\t\ti=i+1;\n\t\t\tsetTimeout('CheckIpConfig2('+i+')',800);\t\n\t\t}\n\t}\n\t\n\t\n\n\t\n\tCheckIpConfig2(1);\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function organization_users_find_member() { $t = time(); $html = "\n\t<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','domains.manage.org.findusers.php?ou={$ou}');\n\t</script>\n\t"; echo $html; return; $keycached = "{$_GET["finduser"]}{$_GET["ou"]}"; if (GET_CACHED(__FILE__, __FUNCTION__, $keycached)) { return true; } $sock = new sockets(); $tofind = $_GET["finduser"]; $tpl = new templates(); $page = CurrentPageName(); $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } if (is_base64_encoded($_GET["ou"])) { $ou_encoded = $_GET["ou"]; $ou = base64_decode($_GET["ou"]); } else { $ou = $_GET["ou"]; $ou_encoded = base64_encode($_GET["ou"]); } writelogs("Find users {$tofind} in {$ou} (encoded={$_GET["ou"]}) EnableManageUsersTroughActiveDirectory:{$EnableManageUsersTroughActiveDirectory}", __FUNCTION__, __FILE__, __LINE__); if ($_SESSION["uid"] != -100) { $ou = $_SESSION["ou"]; } 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"); if ($EnableManageUsersTroughActiveDirectory == 1) { $cc = new ldapAD(); $hash = $cc->find_users($ou, $tofind); } else { $ldap = new clladp(); $dn = "ou={$ou},dc=organizations,{$ldap->suffix}"; $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150); } $users = new user(); $number = $hash["count"]; if (!is_numeric($number)) { $number = 0; } $bg = "#FFFFFF"; writelogs("Find users {$tofind} in ou {$ou} DN:\"{$dn}\" (encoded={$_GET["ou"]}) {$number} items", __FUNCTION__, __FILE__, __LINE__); $html = "\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t<div style='width:100%;height:560px;overflow:auto'>\t\n\t\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t\t<thead class='thead'>\n\t\t\t<tr>\n\t\t\t\t<th colspan=4>{$tofind}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody class='tbody'>\n\t\t\t\t\n\t"; $add_user_disabled = Paragraphe('folder-useradd-64-grey.png', '{create_user}', '{create_user_text}'); $add_user = Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); $groups = Paragraphe('folder-group-64.png', '{manage_groups}', '{manage_groups_text}', "javascript:Loadjs('domains.edit.group.php?ou={$ou_encoded}&js=yes')", null, 210, 100, 0, true); $delete_all_users = Paragraphe('member-64-delete.png', '{delete_all_users}', '{delete_all_users_text}', "javascript:DeleteAllusers()", null, 210, 100, 0, true); if ($EnableManageUsersTroughActiveDirectory == 1) { $delete_all_users = Paragraphe('member-64-delete-grey.png', '{delete_all_users}', '{delete_all_users_text}', "", null, 210, 100, 0, true); } $usermenus = new usersMenus(); if ($usermenus->ARTICA_META_ENABLED) { if ($sock->GET_INFO("AllowArticaMetaAddUsers") != 1) { $add_user = $add_user_disabled; } } if ($EnableManageUsersTroughActiveDirectory == 1) { $add_user = $add_user_disabled; } $delete_all_users_warn = $tpl->javascript_parse_text("{delete_all_users_warn}"); for ($i = 0; $i < $number; $i++) { $userARR = $hash[$i]; $uid = $userARR["uid"][0]; if ($EnableManageUsersTroughActiveDirectory == 1) { $uid = $userARR["samaccountname"][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 ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $img = imgtootltip("contact-48.png", "{apply}", $js); if ($userARR["telephonenumber"][0] == null) { $userARR["telephonenumber"][0] = " "; } if ($userARR["mail"][0] == null) { $userARR["mail"][0] = " "; } $html = $html . "<tr class={$classtr}>\n\t\t\t\t\t\t<td width=1% style='font-size:12px'>{$img}</td>\n\t\t\t\t\t\t<td width=50% style='font-size:12px'>{$userARR["sn"][0]} {$userARR["givenname"][0]}<div><i>{$userARR["title"][0]}</i></div></td>\n\t\t\t\t\t\t<td width=1% style='font-size:12px'>{$userARR["telephonenumber"][0]}</td>\n\t\t\t\t\t\t<td width=50% style='font-size:12px' nowrap>{$userARR["mail"][0]}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\n\t\t"; } $html = $html . "</table>\n\t</div>\n\t</td>\n\t<td valign='top' width=1%>{$add_user}<br>{$groups}<br>{$delete_all_users}</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\n\tvar X_DeleteAllusers= function (obj) {\n\t\tvar results=trim(obj.responseText);\n\t\tif(results.length>0){alert(results);}\n\t\tLoadAjax('org_user_list','{$page}?finduser=&ou='+escape('{$ou}'));\n\t\t}\t\t\n\n\t\tfunction DeleteAllusers(){\n\t\t\tif(confirm('{$delete_all_users_warn}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DeleteAllUsersInOu','yes');\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tdocument.getElementById('org_user_list').src='img/wait_verybig.gif'; \t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',X_DeleteAllusers);\n\t\t\t}\n\t\t\n\t\t}\n\t\n</script>\t\n\t"; $html = $tpl->_ENGINE_parse_body($html); SET_CACHED(__FILE__, __FUNCTION__, $keycached, $html); echo $html; }
function formatUser($hash, $EnableManageUsersTroughActiveDirectory = false) { $uid = $hash["uid"][0]; if ($EnableManageUsersTroughActiveDirectory) { $uid = $hash["samaccountname"][0]; } if ($hash["displayname"][0] == null) { $hash["displayname"][0] = $uid; } $html = "<table style='width:100%' class=form>\n\t<tr>\n\t\t<td colspan=2>\n\t\t\t<span style='font-size:14px;font-weight:bold;text-transform:capitalize'>{$hash["displayname"][0]}</span> - \n\t\t\t<span style='font-size:10px;font-weight:bold;text-transform:capitalize'>{$hash["sn"][0]} {$hash["givenname"][0]}</span>\n\t\t\t\n\t\t\t<hr style='border:1px solid #FFF;margin:3px'>\n\t\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right'><span style='font-size:10px;font-weight:bold'>{$hash["title"][0]}</span> | {$hash["mail"][0]} | {$hash["telephonenumber"][0]}\n\t</table>\n\t\n\t"; $js = MEMBER_JS($uid, 1); $html = "<div style='margin:5px;padding-right:10px;padding-left:10px'>{$html}</div>"; return $html; }
function finduser_list() { $keycached = "{$_GET["finduser"]}"; header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); $GLOBALS["OUTPUT_DEBUG"] = false; $stringtofind = trim($_GET["finduser"]); if ($_POST["query"] != null) { $stringtofind = $_POST["query"]; } if (!isset($_POST["rp"])) { $_POST["rp"] = 15; } $users = new usersMenus(); $sock = new sockets(); $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } if (preg_match("#debug:(.+)#", $stringtofind, $re)) { $GLOBALS["OUTPUT_DEBUG"] = true; $stringtofind = trim($re[1]); } if ($GLOBALS["OUTPUT_DEBUG"]) { echo "Want to search {$stringtofind}<br>"; } $tpl = new templates(); $usermenu = new usersMenus(); $ldap = new clladp(); if (!$ldap->IsKerbAuth()) { if ($usermenu->AsAnAdministratorGeneric == true) { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "It is an administrator search in the entire tree<br>"; } $hash_full = $ldap->UserSearch(null, $stringtofind, $_POST["rp"]); } else { $us = $ldap->UserDatas($_SESSION["uid"]); if ($GLOBALS["OUTPUT_DEBUG"]) { echo "It is an user search in the {$us["ou"]} tree<br>"; } $hash_full = $ldap->UserSearch($us["ou"], $stringtofind, $_POST["rp"]); } $hash1 = $hash_full[0]; $hash2 = $hash_full[1]; if ($GLOBALS["OUTPUT_DEBUG"]) { echo "Search results " . count($hash1) . " users and " . count($hash2) . " contacts<br>"; } } else { include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ad = new external_ad_search(); $hash_full = $ad->UserSearch(null, $stringtofind, $_POST["rp"]); $hash1 = $hash_full[0]; $hash2 = $hash_full[1]; if ($GLOBALS["OUTPUT_DEBUG"]) { echo "Search results " . count($hash1) . " users and " . count($hash2) . " contacts<br>"; } } $hash = array(); $count = 0; $data = array(); $data['page'] = 1; $data['total'] = 0; $data['rows'] = array(); if (is_array($hash1)) { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "<strong>Search results ->HASH1</strong><br>\n"; } while (list($num, $ligne) = each($hash1)) { if (isset($ligne["samaccountname"][0])) { $ligne["uid"][0] = $ligne["samaccountname"][0]; } if ($ligne["uid"][0] == null) { if (preg_match("#^CN=(.+?),#i", $ligne["dn"], $re)) { $ligne["uid"][0] = $re[1]; $hash[$count]["displayname"][0] = $re[1]; } } if ($EnableManageUsersTroughActiveDirectory == 0) { if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { continue; } } if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) { continue; } $hash[$count]["displayname"][0] = trim($ligne["displayname"][0]); $hash[$count]["givenname"][0] = $ligne["givenname"][0]; if ($EnableManageUsersTroughActiveDirectory == 1) { $hash[$count]["uid"][0] = $ligne["samaccountname"][0]; } else { $hash[$count]["uid"][0] = $ligne["uid"][0]; } if (substr($hash[$count]["uid"][0], strlen($hash[$count]["uid"][0]) - 1, 1) == '$') { continue; } $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0]; $hash[$count]["title"][0] = $ligne["title"][0]; $hash[$count]["uri"][0] = $ligne["uri"][0]; $hash[$count]["mail"][0] = $ligne["mail"][0]; $hash[$count]["phone"][0] = $ligne["telephonenumber"][0]; $hash[$count]["sn"][0] = $ligne["sn"][0]; $hash[$count]["dn"] = $ligne["dn"]; $count++; } } else { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "<strong>Search results ->HASH1 NOT AN ARRAY</strong><br>\n"; } } if (is_array($hash2)) { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "<strong>Search results ->HASH2</strong><br>\n"; } while (list($num, $ligne) = each($hash2)) { if (isset($ligne["samaccountname"][0])) { $ligne["uid"][0] = $ligne["samaccountname"][0]; } if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { continue; } if (strpos($ligne["dn"], "dc=pureftpd,dc=organizations") > 0) { continue; } $hash[$count]["displayname"][0] = $ligne["displayname"][0]; $hash[$count]["givenname"][0] = $ligne["givenname"][0]; $hash[$count]["uid"][0] = $ligne["uid"][0]; $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0]; $hash[$count]["title"][0] = $ligne["title"][0]; $hash[$count]["uri"][0] = $ligne["uri"][0]; $hash[$count]["mail"][0] = $ligne["mail"][0]; $hash[$count]["phone"][0] = $ligne["telephonenumber"][0]; $hash[$count]["sn"][0] = $ligne["sn"][0]; $hash[$count]["dn"] = $ligne["dn"]; $count = $count + 1; } } else { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "<strong>Search results ->HASH2 NOT AN ARRAY</strong><br>\n"; } } $count = count($hash); $data['total'] = $count; if ($count == 0) { json_error_show("no data", 1); } if ($GLOBALS["OUTPUT_DEBUG"]) { echo "<strong>Search results {$count} items</strong><br>\n"; } if (is_array($hash)) { while (list($num, $ligne) = each($hash)) { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "dn:{$ligne["dn"]}<br>"; } if ($GLOBALS["OUTPUT_DEBUG"]) { echo "uid:{$ligne["uid"][0]}<br>"; } if ($GLOBALS["OUTPUT_DEBUG"]) { echo "employeenumber:{$ligne["employeenumber"][0]}<br>"; } if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { if ($GLOBALS["OUTPUT_DEBUG"]) { echo "null twice, aborting...<br>"; } continue; } if ($ligne["uid"][0] == "squidinternalauth") { $count = $count - 1; continue; } if ($GLOBALS["OUTPUT_DEBUG"]) { echo "edit_config_user={$ligne["uid"][0]}<br>"; } $edit_config_user = MEMBER_JS($ligne["uid"][0], 1, 0, $ligne["dn"]); if ($usermenu->AllowAddUsers == true) { $uri = $edit_config_user; } else { $uri = null; } if ($usermenu->AsOrgAdmin == true) { $uri = $edit_config_user; } else { $uri = null; } if ($usermenu->AsArticaAdministrator == true) { $uri = $edit_config_user; } else { $uri = null; } $displayname = trim($ligne["displayname"][0]); $givenname = $ligne["givenname"][0]; $mail = $ligne["mail"][0]; if ($displayname == null) { $displayname = $ligne["uid"][0]; } if ($givenname == null) { $givenname = '{unknown}'; } if ($mail == null) { $mail = '{unknown}'; } if ($ligne["employeenumber"][0] != null) { $array["employeenumber"] = $ligne["employeenumber"][0]; $user = new contacts($_SESSION["uid"], $ligne["employeenumber"][0]); $array["title"] = $user->displayName; $uri = "javascript:Loadjs('contact.php?employeeNumber={$ligne["employeenumber"][0]}')"; } else { if ($ligne["uid"][0] != null) { $array["title"] = $ligne["uid"][0]; $user = new user($ligne["uid"][0]); } } if (strlen($user->jpegPhoto) > 0) { $array["img"] = $user->img_identity; } else { $array["img"] = "img/contact-unknown-user.png"; } writelogs("identity:{$user->img_identity} ", __FUNCTION__, __FILE__); $array["uri"] = $uri; $array["mail"] = $ligne["mail"][0]; $array["phone"] = $ligne["telephonenumber"][0]; $array["sn"] = $ligne["sn"][0]; if (!$ldap->EnableManageUsersTroughActiveDirectory) { if ($displayname == null) { $displayname = "{$givenname} {$ligne["sn"][0]}"; } } $array["displayname"] = $displayname; $array["givenname"] = $givenname; $array["JS"] = $edit_config_user; $array["title"] = $ligne["title"][0]; $array["ou"] = $user->ou; $array["uid"] = $ligne["uid"][0]; $data['rows'][] = finduser_format($array); } } echo json_encode($data); }
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); }
function COMPUTERS_LIST_LIST() { $gpid = $_GET["gpid"]; $group = new groups($gpid); $html = "<table style='width:100%'>"; while (list($num, $val) = each($group->computers_array)) { $js = MEMBER_JS($val, 1); $html = $html . "<tr " . CellRollOver() . ">\n\t\t\t<td width=1%><img src='img/base.gif'></td>\n\t\t\t<td><strong>" . texttooltip($val, '{view}', $js) . "</td>\n\t\t</tr>"; } $html = $html . "</table>"; return RoundedLightGrey($html); }
function popup_connected_search() { $ocs = new ocs(); $sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["connected-search"]); $CONFIG = $ocs->GET_SERVER_SETTINGS(); $PROLOG_FREQ = $CONFIG["PROLOG_FREQ"] * 60; $q = new mysql(); $results = $q->QUERY_SQL($sql, "ocsweb"); if (!$q->ok) { echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>"; return; } $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n<thead class='thead'>\n<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{status}</th>\n\t\t<th>{ComputerMacAddress}</th>\n\t\t<th>{ip_address}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\t"; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["IPADDRESS"] == "0.0.0.0") { continue; } if ($ligne["MACADDR"] == "00:00:00:00:00:00") { continue; } if ($already[$ligne["MACADDR"]]) { continue; } if ($already[$ligne["NAME"] . $ligne["IPSRC"]]) { continue; } $status = null; $already[$ligne["MACADDR"]] = true; $already[$ligne["NAME"] . $ligne["IPADDRESS"]] = true; $f = new computers(); $uid = $f->ComputerIDFromMAC($ligne["MACADDR"]); if (trim($uid) != null) { $already[$ligne["NAME"] . $ligne["IPSRC"]] = true; } $js = MEMBER_JS($uid, 1, 1); $last = distanceOfTimeInWords(strtotime($ligne["LASTCOME"]), time()); $mins = distanceMinStrings($ligne["LASTCOME"]); $js_text = "{$ligne["NAME"]}<hr>{last_com}:{$last}<hr>{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}"; if ($mins > $PROLOG_FREQ) { $js_text = "{$ligne["NAME"]}<hr><span color:#d32d2d>{last_com}:{$last}</span>"; $status = imgtootltip('ok32-grey.png', $js_text); } else { $status = imgtootltip('ok32.png', "{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}<br>{$last}"); } if ($uid == null) { $js = null; $status = imgtootltip("warning-panneau-32.png", "{ocs_computer_is_not_in_ldap}", "AddComputerFromOCS('{$ligne["MACADDR"]}')", null, md5($ligne["MACADDR"]) . time()); $js_text = "{ocs_computer_is_not_in_ldap}"; } else { } if (trim($ligne["IPADDRESS"]) != null) { if (trim($ligne["IPSRC"]) != null) { if (trim($ligne["IPSRC"]) != trim($ligne["IPADDRESS"])) { $ligne["IPSRC"] = $ligne["IPSRC"] . "/" . $ligne["IPADDRESS"]; } } else { $ligne["IPSRC"] = $ligne["IPADDRESS"]; } } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>" . imgtootltip("laptop-32.png", $js_text, $js) . "</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["NAME"]}</code></td>\n\t\t\t<td width=1% align='center' valign='middle'>{$status}</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["MACADDR"]}</code></td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["IPSRC"]}</code></td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function popup_connected_search() { $ocs = new ocs(); $sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["connected-search"]); $CONFIG = $ocs->GET_SERVER_SETTINGS(); $PROLOG_FREQ = $CONFIG["PROLOG_FREQ"] * 60; $q = new mysql(); $results = $q->QUERY_SQL($sql, "ocsweb"); if (!$q->ok) { echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>"; return; } $html = "\n\t<table style='width:100%;'>\n\t<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{status}</th>\n\t\t<th>{ComputerMacAddress}</th>\n\t\t<th>{ip_address}</th>\n\t</tr>"; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["IPADDRESS"] == "0.0.0.0") { continue; } if ($ligne["MACADDR"] == "00:00:00:00:00:00") { continue; } if ($already[$ligne["MACADDR"]]) { continue; } if ($already[$ligne["NAME"] . $ligne["IPSRC"]]) { continue; } $status = null; $already[$ligne["MACADDR"]] = true; $already[$ligne["NAME"] . $ligne["IPADDRESS"]] = true; $f = new computers(); $uid = $f->ComputerIDFromMAC($ligne["MACADDR"]); if (trim($uid) != null) { $already[$ligne["NAME"] . $ligne["IPSRC"]] = true; } $js = MEMBER_JS($uid, 1, 1); $last = distanceOfTimeInWords(strtotime($ligne["LASTCOME"]), time()); $mins = distanceMinStrings($ligne["LASTCOME"]); $js_text = "{$ligne["NAME"]}<hr>{last_com}:{$last}<hr>{$ligne["IPADDRESS"]}"; if ($mins > $PROLOG_FREQ) { $status = imgtootltip('status_service_removed.png', $last); $js_text = "{$ligne["NAME"]}<hr><span color:red>{last_com}:{$last}</span>"; } else { $status = imgtootltip('status_service_run.png', $last); } if ($uid == null) { $js = null; $status = imgtootltip("status_warning.gif", "{ocs_computer_is_not_in_ldap}", "AddComputerFromOCS('{$ligne["MACADDR"]}')", null, md5($ligne["MACADDR"]) . time()); $js_text = "{ocs_computer_is_not_in_ldap}"; } else { } if (trim($ligne["IPADDRESS"]) != null) { if (trim($ligne["IPSRC"]) != trim($ligne["IPADDRESS"])) { $ligne["IPSRC"] = $ligne["IPSRC"] . "/" . $ligne["IPADDRESS"]; } } $html = $html . "\n\t\t<tr " . CellRollOver($js, $js_text) . ">\n\t\t\t<td width=1%><img src='img/laptop-32.png'></td>\n\t\t\t<td style='font-size:13px'>{$ligne["NAME"]}</td>\n\t\t\t<td width=1% align='center' valign='middle'>{$status}</td>\n\t\t\t<td style='font-size:13px'>{$ligne["MACADDR"]}</td>\n\t\t\t<td style='font-size:12px'>{$ligne["IPSRC"]}</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function thinclient_list(){ $cursor="OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\""; $page=CurrentPageName(); $html=" <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th colspan=4> </th> </tr> </thead> <tbody class='tbody'>"; $q=new mysql(); $sql="SELECT * FROM thinclient_computers ORDER BY uid"; $results=$q->QUERY_SQL($sql,'artica_backup'); while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} $cmp=new computers($ligne["uid"]); $js=MEMBER_JS($ligne["uid"],1,1); $js_thin="Loadjs('thinclient.parameters.php?uid={$ligne["uid"]}')"; $html=$html." <tr class=$classtr> <td width=1%>". imgtootltip("computer-32.png",$cmp->ComputerRealName,$js)."</td> <td nowrap><span $cursor OnClick=\"javascript:$js_thin\" style='font-size:13px;text-decoration:underline'>$cmp->ComputerRealName</span></td> <td nowrap><span $cursor OnClick=\"javascript:$js_thin\" style='font-size:13px;text-decoration:underline'>$cmp->ComputerMacAddress</span></td> <td width=1%>". imgtootltip("delete-32.png","{delete}","ThinclientDelete('{$ligne["uid"]}')")."</td> </tr>"; } $html=$html."</tbody></table> <div id='dhcptftpinfos'></div> <script> LoadAjax('dhcptftpinfos','$page?tftp-infos=yes'); </script> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function finduser() { header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); $stringtofind = $_GET["finduser"]; writelogs("Want to search {$stringtofind}", __FUNCTION__, __FILE__); $tpl = new templates(); $usermenu = new usersMenus(); $ldap = new clladp(); if ($usermenu->AsAnAdministratorGeneric == true) { writelogs("It is an administrator search in the entire tree", __FUNCTION__, __FILE__); $hash_full = $ldap->UserSearch(null, $stringtofind); } else { $us = $ldap->UserDatas($_SESSION["uid"]); writelogs("It is an user search in the {$us["ou"]} tree", __FUNCTION__, __FILE__); $hash_full = $ldap->UserSearch($us["ou"], $stringtofind); } $hash1 = $hash_full[0]; $hash2 = $hash_full[1]; writelogs("Search results " . count($hash1) . " users and " . count($hash2) . " contacts", __FUNCTION__, __FILE__); $count = 0; if (is_array($hash1)) { while (list($num, $ligne) = each($hash1)) { if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { continue; } $hash[$count]["displayname"][0] = $ligne["displayname"][0]; $hash[$count]["givenname"][0] = $ligne["givenname"][0]; $hash[$count]["uid"][0] = $ligne["uid"][0]; $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0]; $hash[$count]["title"][0] = $ligne["title"][0]; $hash[$count]["uri"][0] = $ligne["uri"][0]; $hash[$count]["mail"][0] = $ligne["mail"][0]; $hash[$count]["phone"][0] = $ligne["telephonenumber"][0]; $hash[$count]["sn"][0] = $ligne["sn"][0]; $count = $count + 1; } } if (is_array($hash2)) { while (list($num, $ligne) = each($hash2)) { if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { continue; } $hash[$count]["displayname"][0] = $ligne["displayname"][0]; $hash[$count]["givenname"][0] = $ligne["givenname"][0]; $hash[$count]["uid"][0] = $ligne["uid"][0]; $hash[$count]["employeenumber"][0] = $ligne["employeenumber"][0]; $hash[$count]["title"][0] = $ligne["title"][0]; $hash[$count]["uri"][0] = $ligne["uri"][0]; $hash[$count]["mail"][0] = $ligne["mail"][0]; $hash[$count]["phone"][0] = $ligne["telephonenumber"][0]; $hash[$count]["sn"][0] = $ligne["sn"][0]; $count = $count + 1; } } $count = count($hash); writelogs("Search results {$count} items", __FUNCTION__, __FILE__); if (is_array($hash)) { while (list($num, $ligne) = each($hash)) { if ($ligne["uid"][0] == null && $ligne["employeenumber"][0] == null) { continue; } if ($ligne["uid"][0] == "squidinternalauth") { $count = $count - 1; continue; } $edit_config_user = MEMBER_JS($ligne["uid"][0], 1); if ($usermenu->AllowAddUsers == true) { $uri = $edit_config_user; } else { $uri = null; } if ($usermenu->AsOrgAdmin == true) { $uri = $edit_config_user; } else { $uri = null; } if ($usermenu->AsArticaAdministrator == true) { $uri = $edit_config_user; } else { $uri = null; } $displayname = $ligne["displayname"][0]; $givenname = $ligne["givenname"][0]; $mail = $ligne["mail"][0]; if ($displayname == null) { $displayname = $ligne["uid"][0]; } if ($givenname == null) { $givenname = '{unknown}'; } if ($mail == null) { $mail = '{unknown}'; } if ($ligne["employeenumber"][0] != null) { $user = new contacts($_SESSION["uid"], $ligne["employeenumber"][0]); $array["title"] = $user->displayName; $uri = "javascript:Loadjs('contact.php?employeeNumber={$ligne["employeenumber"][0]}')"; } else { if ($ligne["uid"][0] != null) { $array["title"] = $ligne["uid"][0]; $user = new user($ligne["uid"][0]); } } if (strlen($user->jpegPhoto) > 0) { $array["img"] = $user->img_identity; } else { $array["img"] = "img/contact-unknown-user.png"; } writelogs("identity:{$user->img_identity} ", __FUNCTION__, __FILE__); $array["uri"] = $uri; $array["mail"] = $ligne["mail"][0]; $array["phone"] = $ligne["telephonenumber"][0]; $array["sn"] = $ligne["sn"][0]; if ($displayname == null) { $displayname = "{$givenname} {$ligne["sn"][0]}"; } $array["displayname"] = $displayname; $array["givenname"] = $givenname; $array["JS"] = $edit_config_user; $array["title"] = $ligne["title"][0]; $tr_users[] = finduser_format($array); } } $tables[] = "<table style='width:100%'><tr>"; $t = 0; while (list($key, $line) = each($tr_users)) { $line = trim($line); if ($line == null) { continue; } $t = $t + 1; $tables[] = "<td valign='top'>{$line}</td>"; if ($t == 2) { $t = 0; $tables[] = "</tr><tr>"; } } if ($t < 2) { for ($i = 0; $i <= $t; $i++) { $tables[] = "<td valign='top'> </td>"; } } $tables[] = "</table>"; $add = Paragraphe("my-address-book-user-add.png", '{add_new_contact}', '{add_new_contact_text}', "javascript:Loadjs('contact.php')"); if ($_SESSION["uid"] == -100) { $add = null; } $html = "<p style='font-size:18px'>{search}:«{$stringtofind}» ({$count} {entries})</p>\n\t\n\t<center>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>" . implode("\n", $tables) . "\n\t\t\n\t</td>\n\t<td valign='top'>\n\t{$add}\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t</center>"; echo $tpl->_ENGINE_parse_body($html); }
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","ComputerMacAddress","ComputerMachineType"); $dn="$ldap->suffix"; $hash=$ldap->Ldap_search($dn,$filter_search,$attrs,10); $html="<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th colspan=4> </th> </tr> </thead> <tbody class='tbody'>"; 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]; $mac=$hash[$i][strtolower("ComputerMacAddress")][0]; if(trim($ip)==null){continue;} $js="AddDansGuardianExceptionipList('$ip','$realuid');"; //--enable-arp-acl if($mac<>null){$mac="<br><span style='font-size:10px'>$mac</span>";} if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} $showomp=MEMBER_JS($realuid,1,1); $html=$html." <tr class=$classtr> <td width=1% >". imgtootltip("computer-32.png",'{edit}',"$showomp")."</td> <td nowrap><strong style='font-size:14px'>{$hash[$i]["uid"][0]}$mac</strong></td> <td ><strong style='font-size:14px'>$ip</strong></td> <td width=1% >". imgtootltip("plus-24.png","{add}",$js)."</td> </tr> "; } $html=$html . " </tbody> </table> </center> "; $tpl=new templates(); return $tpl->_ENGINE_parse_body($html); }
function SimpleShareSearch() { if ($_GET["SimpleShareSearch"] == '*') { $_GET["SimpleShareSearch"] = null; } if ($_GET["SimpleShareSearch"] == null) { $tofind = "*"; } else { $tofind = "*{$_GET["SimpleShareSearch"]}*"; } $filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn={$tofind})(ComputerIP={$tofind})(uid={$tofind}))(gecos=computer))"; $ldap = new clladp(); $attrs = array("uid", "ComputerIP", "ComputerOS", "ComputerMachineType", "ComputerMacAddress"); $dn = "{$ldap->suffix}"; $hash = $ldap->Ldap_search($dn, $filter_search, $attrs, 20); $html = "<table class=tableView>\n\t<thead class=thead>\n\t<tr>\n\t\t<th colspan=2>{computers} ({$tofind})</th>\n\t\t<th colspan=2>{ip_address}</th>\n\t</tr>\n\t</thead>\n\n\n"; for ($i = 0; $i < $hash["count"]; $i++) { $realuid = $hash[$i]["uid"][0]; $hash[$i]["uid"][0] = str_replace('$', '', $hash[$i]["uid"][0]); $js_show = MEMBER_JS($realuid, 1); if ($_GET["callback"] != null) { $js_selection = "{$_GET["callback"]}('{$realuid}');"; } $ip = $hash[$i][strtolower("ComputerIP")][0]; $os = $hash[$i][strtolower("ComputerOS")][0]; $type = $hash[$i][strtolower("ComputerMachineType")][0]; $mac = $hash[$i][strtolower("ComputerMacAddress")][0]; $name = $hash[$i]["uid"][0]; if (strlen($name) > 25) { $name = substr($name, 0, 23) . "..."; } if ($os == "Unknown") { if ($type != "Unknown") { $os = $type; } } if (!preg_match("#^[0-9]+\\.[0-9]+#", $ip)) { $ip = $ip = "0.0.0.0"; } 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); } $img = "<img src='img/base.gif'>"; if ($cl == "oddRow") { $cl = null; } else { $cl = "oddRow"; } $roolover = CellRollOver($js_selection, "{select}"); $html = $html . "<tr class={$cl}>\n\t<td width=1% {$roolover}>{$img}</td>\n\t<td nowrap width=99%><strong style='font-size:12px'>{$name}</strong></td>\n\t<td width=2% nowrap><strong style='font-size:12px'>{$ip}</strong></td>\n\t<td width=1%>" . imgtootltip("plus-24.png", "{add}", "SimpleSearchAddComputerPath('{$realuid}')") . "</td>\n\t</tr>\n\t"; } $html = $html . "</table>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function dhcp_computers_scripts() { $dhc = new dhcpd(); $array = $dhc->LoadfixedAddresses(); if (!is_array($array)) { return null; } $html = "\n\t<table style='width:100%'>\n\t"; $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99.5%'>\n<thead class='thead'>\n\t<tr>\n\t<th colspan=4> {fixedHosts}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while (list($num, $ligne) = each($array)) { if (preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\$#", trim($num))) { continue; } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ligne["MAC"] = str_replace("hardware ethernet", "", $ligne["MAC"]); $js = MEMBER_JS("{$num}\$", 1, 1); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td valign='top'><img src='img/computer-32.png'></td>\n\t\t\t<td><strong><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px'>{$num}</a></td>\n\t\t\t<td><strong><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px'>{$ligne["MAC"]}</a></td>\n\t\t\t<td><strong><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px'>{$ligne["IP"]}</a></td>\n\t\t</tr>\n\t\t\t\n\t\t"; } $html = $html . "</tbody></table>"; $tpl = new templates(); return RoundedLightWhite($tpl->_ENGINE_parse_body($html)); }
function events() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th width=1%>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('main_config_nmap')") . "</th>\n\t<th width=1%>{date}</th>\n\t<th width=1%> </th>\n\t<th width=99%>events</th>\n\t<th width=1%>" . imgtootltip("delete-32.png", "{delete_all}", "DeleteAllNMAPEV()") . "</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $sql = "SELECT subject,zDate,ID,uid FROM nmap_events ORDER BY zDate DESC LIMIT 0,300"; $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $view = " "; if ($ligne["uid"] != null) { $view = imgtootltip("computer-32.png", "{view}", MEMBER_JS($ligne["uid"], 1, 1)); } $color = "black"; $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:NMAP_EVENTS({$ligne["ID"]})\" style='font-size:12px;text-decoration:underline'>"; $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=1% nowrap colspan=2>{$ligne["zDate"]}</a></td>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=1% nowrap>{$view}</a></td>\n\t\t\t<td style='font-size:12px;font-weight:bold;color:{$color}' width=99% nowrap colspan=2>{$link}{$ligne["subject"]}</a></td>\n\t\t</tr>\n\t\t"; } $html = $html . "\n\t</tbody>\n\t</table>\n\t\n\t<script>\n\t\tfunction NMAP_EVENTS(ID){\n\t\t\tYahooWin4('650','{$page}?NMAP_EVENTS='+ID,ID);\n\t\t}\n\t\t\n\tvar x_DeleteAllNMAPEV= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tRefreshTab('main_config_nmap');\n\t}\n\t\n\tfunction DeleteAllNMAPEV(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DeleteAllNMAPEV','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteAllNMAPEV);\n\t}\n\t\n\t</script>"; echo $tpl->_ENGINE_parse_body($html); }
function formatUser($hash, $EnableManageUsersTroughActiveDirectory = false) { $uid = $hash["uid"][0]; if ($EnableManageUsersTroughActiveDirectory) { $uid = $hash["samaccountname"][0]; } if ($hash["displayname"][0] == null) { $hash["displayname"][0] = $uid; } $html = "<table style='width:99%' class=form>\n\t<tr>\n\t\t<td colspan=2>\n\t\t\t<span style='font-size:14px;font-weight:bold;text-transform:capitalize'>{$hash["displayname"][0]}</span> - \n\t\t\t<span style='font-size:10px;font-weight:bold;text-transform:capitalize'>{$hash["sn"][0]} {$hash["givenname"][0]}</span>\n\t\t\t\n\t\t\t<hr style='border:1px solid #FFF;margin:3px'>\n\t\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right'><span style='font-size:10px;font-weight:bold'>{$hash["title"][0]}</span> | {$hash["mail"][0]} | {$hash["telephonenumber"][0]}\n\t</table>\n\t\n\t"; $js = MEMBER_JS($uid, 1); $delete = imgtootltip("delete-24.png", "{$uid}<hr>{delete_this_user_text}", "Loadjs('domains.delete.user.php?uid={$uid}')"); return array('id' => $uid, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" style='font-size:14px;text-decoration:underline'>{$hash["displayname"][0]}</a>", "<span style='font-size:14px'>{$hash["mail"][0]}</span>", "<span style='font-size:14px'>{$hash["telephonenumber"][0]}</span>", $delete)); }
function items_groups() { $tt = $_GET["tt"]; $search = $_POST["query"]; $search = "*{$search}*"; $search = str_replace("**", "*", $search); $search = str_replace("**", "*", $search); $field_user = $_GET["field-user"]; $ad = new external_ad_search(); $array = $ad->SearchGroups($search, $_GET["DN"], $_POST["rp"]); $data = array(); $data['page'] = 1; $data['total'] = $array["count"]; $data['rows'] = array(); $fontsize = 13; $c = 0; for ($i = 0; $i < $array["count"]; $i++) { $c++; $color = "black"; $DN = $array[$i]["dn"]; $samaccountname = $array[$i]["samaccountname"][0]; $description = $array[$i]["description"][0]; $itemsNum = $array[$i]["member"]["count"]; if ($samaccountname == null) { $samaccountname = $array[$i]["cn"][0]; } if (!is_numeric($itemsNum)) { $itemsNum = 0; } $select = " "; $DN_enc = urlencode($DN); $FicheGroup = "Loadjs('domains.edit.group.php?ou=ABC&js=yes&group-id={$DN_enc}',true)"; $editjs = "<a href=\"javascript:Blur();\" OnClick=\"{$FicheGroup}\" style='text-decoration:underline;font-size:{$fontsize}px;font-weight:bold;'>"; if ($field_user != null) { $base64 = base64_encode($DN); $select = imgsimple("arrow-right-24.png", null, "EditField{$tt}('{$base64}','{$samaccountname}')"); } if ($description != null) { $description = "<br><span style='font-size:10px;font-style:italic;font-weight:normal'>{$description}</span>"; } $data['rows'][] = array('id' => md5($DN), 'cell' => array("<img src='img/wingroup.png'>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$samaccountname}</a>{$description}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$itemsNum}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$select}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$link}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } $array = $ad->SearchUsers($search, $_GET["DN"], $_POST["rp"]); for ($i = 0; $i < $array["count"]; $i++) { if ($c > $_POST["rp"]) { break; } $c++; $color = "black"; $DN = $array[$i]["dn"]; $samaccountname = $array[$i]["samaccountname"][0]; $description = $array[$i]["description"][0]; $itemsNum = "-"; if ($samaccountname == null) { $samaccountname = $array[$i]["cn"][0]; } $select = " "; $jsUser = MEMBER_JS($samaccountname, 0, 0, $DN); $editjs = "<a href=\"javascript:Blur();\" {$jsUser} style='text-decoration:underline;font-size:{$fontsize}px;font-weight:bold;'>"; if ($description != null) { $description = "<br><span style='font-size:10px;font-style:italic;font-weight:normal'>{$description}</span>"; } $data['rows'][] = array('id' => md5($DN), 'cell' => array("<img src='img/user-18.png'>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$samaccountname}{$description}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$itemsNum}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$itemsNum}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$link}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } if ($c == 0) { json_error_show("{$search} no data"); } $data['total'] = $c; echo json_encode($data); }