function search() { if (!CheckRights()) { senderror("{ERROR_NO_PRIVS}"); } $boot = new boostrap_form(); $sock = new sockets(); $users = new usersMenus(); $maillog_path = $users->maillog_path; $tpl = new templates(); $t = time(); $query = base64_encode($_GET["search"]); if (!is_numeric($_POST["rp"])) { $_POST["rp"] = 500; } $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}"))); $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log")); krsort($array); $zDate = $tpl->_ENGINE_parse_body("{zDate}"); $hostTXT = $tpl->_ENGINE_parse_body("{host}"); $serviceTXT = $tpl->_ENGINE_parse_body("{servicew}"); $eventsTXT = $tpl->_ENGINE_parse_body("{events}"); while (list($index, $line) = each($array)) { $lineenc = base64_encode($line); if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) { $date = "{$re[1]}"; $host = $re[2]; $service = $re[3]; $pid = $re[4]; $line = $re[5]; } $class = LineToClass($line); $img = statusLogs($line); $loupejs = "ZoomEvents('{$lineenc}')"; $trSwitch = $boot->trswitch("blur()"); $tr[] = "\n\t\t<tr id='{$id}' class={$class} {$trSwitch}>\n\t\t<td style='font-size:12px' {$trSwitch} width=1% nowrap><i class='icon-time'></i> {$date}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap><i class='icon-arrow-right'></i> {$host}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap>{$service}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap><img src='{$img}'></td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=99% nowrap>{$line}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\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>{$zDate}</th>\n\t\t\t\t\t<th>{$hostTXT}</th>\n\t\t\t\t\t<th>{$serviceTXT}</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th colspan=2>{$eventsTXT}</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>\n\t\t\t\t<script>\n\n\t</script>\n\t"; }
function members_search() { $tpl = new templates(); $MyPage = CurrentPageName(); $boot = new boostrap_form(); $q = new mysql_squid_builder(); $sock = new sockets(); $fontsize = "14px"; $page = 1; $t = time(); $ORDER = $boot->TableOrder(array("uid" => "ASC")); $searchstring = string_to_flexquery("search-members"); $table = "hotspot_members"; $minutes = $tpl->_ENGINE_parse_body("{minutes}"); $unlimited = $tpl->_ENGINE_parse_body("{unlimited}"); $ttl = $tpl->_ENGINE_parse_body("{ttl}"); $members = $tpl->_ENGINE_parse_body("{members}"); $MAC = $tpl->_ENGINE_parse_body("{MAC}"); $ttl = $tpl->_ENGINE_parse_body("{ttl}"); $finaltime = $tpl->_ENGINE_parse_body("{re_authenticate_each}"); $endtime = $tpl->_ENGINE_parse_body("{endtime}"); $title = $tpl->_ENGINE_parse_body("{sessions} " . date("{l} d {F}")); $q = new mysql_squid_builder(); $hostname = $tpl->_ENGINE_parse_body("{hostname}"); $enabled = $tpl->_ENGINE_parse_body("{enabled}"); $new_account = $tpl->_ENGINE_parse_body("{new_account}"); $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error_html(); } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $md5 = md5(serialize($ligne)); $uid = $ligne["uid"]; $ttl = intval($ligne["ttl"]); $logintime = intval($ligne["logintime"]); $Start = $tpl->_ENGINE_parse_body(date("{l} d H:i", $logintime)); $delete = imgsimple("delete-48.png", null, "DeleteMember{$t}('{$ligne["uid"]}','{$md5}')"); $End = $tpl->_ENGINE_parse_body(date("{l} d H:i", $ligne["finaltime"])); $hostname = $ligne["hostname"]; $MAC = $ligne["MAC"]; $ipaddr = $ligne["ipaddr"]; $ttl = $ligne["ttl"]; if ($ttl == 0) { $ttl = $unlimited; } else { $ttl = $tpl->_ENGINE_parse_body(date("{l} d H:i", $ttl)); } $enabled = Field_checkbox("enable_{$uid}", 1, $ligne["enabled"], "MemberEnable{$t}('{$uid}')"); $color = "black"; if ($ligne["enabled"] == 0) { $color = "#A4A1A1"; } $uid_url = urlencode($ligne["uid"]); $uid_url = urlencode($ligne["uid"]); $js = $boot->trswitch("YahooWin4('600','miniadmin.hotspot.php?uid={$uid_url}&t={$t}','{$ligne["uid"]}');"); $jsttl = $boot->trswitch("YahooWin4('500','miniadmin.hotspot.php?ttl={$uid_url}&t={$t}','{$ttl}:{$ligne["uid"]}');"); $tr[] = "\n\t\t<tr>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% {$js}>{$ligne["uid"]}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap {$jsttl}>{$ttl}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% {$js}>{$ligne["sessiontime"]} {$minutes}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1%>{$enabled}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% {$js}>{$delete}</td>\n\n\t\t</tr>"; } echo $boot->TableCompile(array("uid" => "{$members}", "ttl" => "{ttl}", "sessiontime" => "{$finaltime}", "enabled" => "{$enabled}", "delete" => " "), $tr) . "\t\n<script>\t\t\t\t\nvar x_DeleteSession{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#row'+mem{$t}).remove();\n}\n\nfunction DeleteSession{$t}(md){\n\tmem{$t}=md;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('DeleteSession',md);\t\n\tXHR.sendAndLoad('miniadmin.hotspot.php', 'POST',x_DeleteSession{$t});\t\n\n}\n\nfunction NewAccount{$t}(){\n\tYahooWin4('600','miniadmin.hotspot.php?uid=&t={$t}','{$new_account}');\n}\n\nvar x_MemberEnable{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#flexRT{$t}').flexReload();\n}\n\nfunction MemberEnable{$t}(uid){\n\tvar enabled=0;\n\tif(document.getElementById('enable_'+uid).checked){enabled=1;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('EnableMember',uid);\n\tXHR.appendData('value',enabled);\t\t\n\tXHR.sendAndLoad('miniadmin.hotspot.php', 'POST',x_MemberEnable{$t});\t\n\t\n}\n\nvar x_DeleteMember{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#row'+mem{$t}).remove();\n}\n\nfunction DeleteMember{$t}(uid,md){\n\tmem{$t}=md;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('DeleteMember',uid);\n\tXHR.sendAndLoad('miniadmin.hotspot.php', 'POST',x_DeleteMember{$t});\t\t\n}\n\n</script>"; }
function table_sites_search() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $boot = new boostrap_form(); $database = "squidlogs"; $search = '%'; $table = "generic_categories"; $rp = 250; $page = 1; $FORCE_FILTER = null; $ORDER = "ORDER BY size DESC"; if (!$q->TABLE_EXISTS($table, $database)) { senderror("{$table} doesn't exists..."); } if ($q->COUNT_ROWS($table, $database) == 0) { senderror("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $search = string_to_flexquery("category-search"); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $category = mysql_escape_string2($_GET["category"]); $sql = "SELECT SUM( size ) AS size,SUM(hits) as hits, zDate, category FROM generic_categories GROUP BY category,zDate\n\tHAVING category='{$_GET["category"]}' ORDER BY zDate"; $results = $q->QUERY_SQL($sql); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror($q->mysql_error . "<br>{$sql}"); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $xtime = strtotime($ligne["zDate"] . " 00:00:00"); $dateText = time_to_date($xtime); $catz = urlencode($_GET["category"]); $jsSitename = $boot->trswitch("Loadjs('miniadm.webstats.websites.ByDayByCategory.php?category={$catz}&xtime={$xtime}')"); $tr[] = "\n\t\t\t\t<tr {$jsSitename}>\n\t\t\t\t\t<td><i class='icon-time'></i> {$dateText}</a></td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i> {$ligne["size"]}</td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i> {$ligne["hits"]}</td>\n\t\t\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>{day}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function items_search() { $page = CurrentPageName(); $boot = new boostrap_form(); $tpl = new templates(); $searchstring = string_to_flexquery("items-search"); $ORDER = $boot->TableOrder(array("token" => "ASC")); $limitSql = "LIMIT 0,150"; $sql = "SELECT * FROM nginx_exploits_items WHERE groupid={$_GET["groupid"]} {$searchstring} ORDER BY {$ORDER} {$limitSql}"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql); $sock = new sockets(); $not = $tpl->_ENGINE_parse_body("{is_not}"); if (!$q->ok) { echo $q->mysql_error_html(); } while ($ligne = mysql_fetch_assoc($results)) { $reverse = null; if ($ligne["reverse"] == 1) { $reverse = "<strong>{$not}</strong> "; } $linkipaddr = $boot->trswitch("Loadjs('{$page}?js-item=yes&ID={$ligne["ID"]}&groupid={$ligne["groupid"]}&servername={$_GET["servername"]}')"); $ligne["token"] = $tpl->_ENGINE_parse_body("{{$ligne["token"]}}"); $delete = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-item-js={$ligne["ID"]}&ID={$ligne["ID"]}')"); $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td {$linkipaddr} width='30%' nowrap><i class='icon-list-alt'></i> {$ligne["token"]}</a></td>\n\t<td {$linkipaddr} width='70%' nowrap><i class='icon-list-alt'></i> {$reverse}{$ligne["pattern"]}</a></td>\n\t<td style='text-align:center' width='24px' nowrap>{$delete}</td>\n\t</tr>"; } $html = $boot->TableCompile(array("token" => "{token}", "pattern" => "{pattern}", "delete" => "{delete}"), $tr); echo $tpl->_ENGINE_parse_body($html); }
function search() { $page = CurrentPageName(); $boot = new boostrap_form(); $tpl = new templates(); $searchstring = string_to_flexquery("search"); $ORDER = $boot->TableOrder(array("subject" => "ASC")); $limitSql = "LIMIT 0,250"; $sql = "SELECT * FROM reverse_pages_content WHERE 1 {$searchstring} ORDER BY {$ORDER} {$limitSql}"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error_html(); } while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $jsselect = null; $select = null; $js = $boot->trswitch("Loadjs('miniadmin.crm.pages.php?ID={$ID}')"); if ($_GET["field-id"] != null) { $select = "Loadjs('{$page}?select-js=yes&ID={$ID}&field-id={$_GET["field-id"]}')"; $jsselect = $boot->trswitch($select); $select_img = imgsimple("arrow-right-24.png", null, $select); } $delete_img = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-js=yes&ID={$ID}')"); $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td width='99%' nowrap {$js}><i class='icon-tags'></i> {$ligne["subject"]}</a></td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$select_img}</td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$delete_img}</td>\n\t</tr>"; } $html = $boot->TableCompile(array("subject" => "{subject}", "ID" => "select", "delete" => "{delete}"), $tr); echo $tpl->_ENGINE_parse_body($html); }
function charters_search() { $boot = new boostrap_form(); $tpl = new templates(); $page = CurrentPageName(); $searchstring = string_to_flexquery("itcharters-search"); $q = new mysql_squid_builder(); $ORDER = $boot->TableOrder(array("title" => "ASC")); $table = "itcharters"; $t = time(); $sql = "SELECT ID,title,TextIntro,TextButton FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,150"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<hr><code>{$sql}</code></p>"; } while ($ligne = mysql_fetch_assoc($results)) { $md = md5(serialize($ligne)); $link = $boot->trswitch("Loadjs('{$page}?charter-js=yes&ID={$ligne["ID"]}')"); $delete = imgtootltip("delete-24.png", null, "Delete{$t}({$ligne["ID"]},'{$md}')"); $tr[] = "\n\t<tr id='{$md}'>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["title"]}</td>\n\t<td width=1% nowrap>{$delete}</td>\n\t</tr>"; } $delete_text = $tpl->javascript_parse_text("{delete_this_itchart}"); echo $boot->TableCompile(array("title" => "{it_charters}", "delete" => null), $tr) . "\n<script>\nvar mem{$t}='';\nvar xDelete{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\$('#'+mem{$t}).remove();\n}\nfunction Delete{$t}(ID,mem){\n\tmem{$t}=mem;\n\tif(confirm('{$delete_text} '+ID+'?')){\n\t\tmem{$t}=mem;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('itcharters-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n\t}\n</script>\t\t\t\t\t\n"; }
function www_top_table() { $q = new mysql_squid_builder(); $tpl = new templates(); $boot = new boostrap_form(); $tablename = "www_" . $q->uid_to_tablename($_GET["uid"]); $member = urlencode($_GET["uid"]); $q = new mysql_squid_builder(); if (!$q->TABLE_EXISTS($tablename)) { echo "<p class=text-error>No table «{$tablename}» for {$_GET["uid"]}</p>"; return; } $sql = "SELECT SUM(hits) as hits,SUM(size) as size,familysite FROM `{$tablename}` GROUP BY\n\tcategory,familysite HAVING category='{$_GET["category"]}' ORDER BY size DESC,hits DESC LIMIT 0,100"; if ($_GET["category"] == null) { $sql = "SELECT SUM(hits) as hits,SUM(size) as size,familysite FROM `{$tablename}` GROUP BY\n\tcategory,familysite HAVING category IS NULL ORDER BY size DESC,hits DESC LIMIT 0,100"; } $results = $q->QUERY_SQL($sql); $_GET["uid"] = urlencode($_GET["uid"]); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $hits = FormatNumber($ligne["hits"]); $familysite = $ligne["familysite"]; $fsite = urlencode($familysite); $jslink = "Loadjs('miniadm.webstats.ByMember.website.php?familysite={$fsite}&member-value={$member}&by=uid')"; $link = $boot->trswitch($jslink); $tr[] = "\n\t<tr>\n\t<td {$link}><i class='icon-globe'></i> {$familysite}</a></td>\n\t<td {$link}><i class='icon-info-sign'></i> {$size}</td>\n\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\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>{websites}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function table_sites_search() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $boot = new boostrap_form(); $database = "squidlogs"; $search = '%'; $table = date("Ymd", $_GET["xtime"]) . "_hour"; $rp = 250; $page = 1; $FORCE_FILTER = null; $ORDER = "ORDER BY size DESC"; if (!$q->TABLE_EXISTS($table, $database)) { senderror("{$table} doesn't exists..."); } if ($q->COUNT_ROWS($table, $database) == 0) { senderror("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $search = string_to_flexquery("sitename-search"); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $familysite = mysql_escape_string2($_GET["familysite"]); $sql = "SELECT SUM(size) as size, sum(hits) as hits,sitename,familysite FROM {$table}\n\tGROUP BY sitename,familysite HAVING `familysite`='{$familysite}' {$search} {$ORDER} LIMIT 0,500"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror($q->mysql_error . "<br>{$sql}"); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $jsSitename = $boot->trswitch("Loadjs('miniadm.webstats.websites.ByDayBySiteName.php?sitename={$ligne["sitename"]}&xtime={$_GET["xtime"]}')"); $tr[] = "\n\t\t\t\t<tr id='{$id}'>\n\t\t\t\t\t<td {$jsSitename}><i class='icon-globe'></i> {$ligne["sitename"]}</a></td>\n\t\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$ligne["size"]}</td>\n\t\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$ligne["hits"]}</td>\n\t\t\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>{website}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function www_requests_search() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $search = string_to_flexquery("requests-search"); $xtime = $_GET["xtime"]; $hourtable = date("Ymd", $xtime) . "_hour"; $q = new mysql_squid_builder(); $sql = "SELECT SUM(size) as size,SUM(hits) as hits,`hour`,uid,category,sitename FROM {$hourtable} GROUP BY\n\tcategory,`hour`,sitename,uid \n\tHAVING `hour`='{$_GET["hour"]}' \n\tAND uid='{$_GET["uid"]}' {$search}\n\tORDER BY `size` DESC,`hits`,`sitename` DESC"; $results = $q->QUERY_SQL($sql); $results = $q->QUERY_SQL($sql); $_GET["uid"] = urlencode($_GET["uid"]); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $hits = FormatNumber($ligne["hits"]); $sitename = $ligne["sitename"]; $uri = $ligne["uri"]; $urilenth = strlen($sitename); if ($urilenth > 80) { $sitename = substr($sitename, 0, 77) . "..."; } $sitenameenc = urlencode($sitename); $js = "Loadjs('miniadm.webstats.ByMember.ByHour.queries.php?sitename={$sitenameenc}&uid={$_GET["uid"]}&hour={$_GET["hour"]}&xtime={$_GET["xtime"]}')"; $link = $boot->trswitch($js); $tr[] = "\n\t\t<tr>\n\t\t\t<td {$link}><i class='icon-globe'></i> {$sitename}</td>\n\t\t\t<td {$link}><i class='icon-globe'></i> {$ligne["category"]}</td>\n\t\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$size}</td>\n\t\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$hits}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{websites}</th>\n\t\t\t\t\t<th>{category}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function caches_search() { $prox = new squid_reverse(); $searchstring = string_to_flexquery("caches-search"); $q = new mysql_squid_builder(); $sql = "SELECT * FROM nginx_caches WHERE 1 {$searchstring} ORDER BY directory LIMIT 0,250"; $results = $q->QUERY_SQL($sql, 'artica_backup'); $tpl = new templates(); $GLOBALS["CLASS_TPL"] = $tpl; $boot = new boostrap_form(); $AdminPrivs = AdminPrivs(); $page = CurrentPageName(); $t = time(); $delete_text = $tpl->javascript_parse_text("{delete}"); $purge_cache = $tpl->javascript_parse_text("{purge_cache}"); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $icon = "disk-64.png"; $icon2 = "folder-network-64.png"; $color = "black"; $md = md5(serialize($ligne)); $keys_zone = $ligne["keys_zone"]; $delete = imgsimple("delete-64.png", null, "Delete{$t}('{$ligne["ID"]}','{$md}')"); $purge = imgsimple("dustbin-64.png", null, "Purge{$t}('{$ligne["ID"]}')"); if (!$AdminPrivs) { $delete = imgsimple("delete-64-grey.png", null, "blur()"); $purge = imgsimple("dustbin-64-grey.png", null, "blur()"); } $jsedit = $boot->trswitch("Loadjs('{$page}?js-cache=yes&ID={$ligne["ID"]}')"); $CurrentSize = $ligne["CurrentSize"]; $CurrentSizeText = FormatBytes($CurrentSize / 1024); $tr[] = "\n\t\t<tr style='color:{$color}' id='{$md}'>\n\t\t<td width=1% nowrap {$jsedit} style='vertical-align:middle' nowrap><img src='img/{$icon}'></td>\n\t\t<td width=80% {$jsedit} style='vertical-align:middle'>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$ligne["directory"]}</span>\n\t\t\t<br><div style='font-size:16px'>{$CurrentSizeText}/{$ligne["max_size"]}G</div>\n\t\t</td>\n\t\t\n\t\t<td width=1% nowrap {$jsedit} style='vertical-align:middle' nowrap>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$keys_zone}</span>\n\t\t</td>\n\t\t<td width=1% nowrap {$jsedit} style='vertical-align:middle' nowrap>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$ligne["max_size"]}G</span>\n\t\t</td>\n\t\t<td width=1% nowrap style='vertical-align:middle;min-width:64px'>{$purge}</td>\n\t\t<td width=1% nowrap style='vertical-align:middle;min-width:64px'>{$delete}</td>\n\t\t\n\t\t\n\t\t</tr>\n\t\t"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\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 colspan=2>{directory}</th>\n\t\t\t\t\t<th >{name}</th>\n\t\t\t\t\t<th >{maxsize}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>") . @implode("", $tr) . "</tbody></table>\n<script>\nvar mem{$t}='';\n\nvar xDelete{$t} = function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return}\n\t\$('#'+mem{$t}).remove();\n}\nvar xPurge{$t} = function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return}\n\tExecuteByClassName('SearchFunction');\n\t\n}\t\t\t\n\nfunction Delete{$t}(id,md){\n\t\tmem{$t}=md;\n\t\tif(!confirm('{$delete_text}: '+id)){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DeleteCache',id);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\t\t\t\n}\n\t\nfunction Purge{$t}(id){\n\tif(!confirm('{$purge_cache}: '+id)){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('PurgeCache',id);\n\tXHR.sendAndLoad('{$page}', 'POST',xPurge{$t});\t\t\t\n}\t\n\t\n\t\n</script>\t\n\t\t\t \t\t\n"; }
function www_table() { $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $q = new mysql_squid_builder(); $uidtable = $q->uid_to_tablename($_GET["member-value"]); $_GET["member-value"] = urlencode($_GET["member-value"]); $q = new mysql_squid_builder(); $sql = "SELECT SUM(hits) as hits,SUM(size) as size,zDate FROM `www_{$uidtable}`\n\tGROUP BY familysite,zDate HAVING familysite='{$_GET["familysite"]}' ORDER BY zDate DESC"; $results = $q->QUERY_SQL($sql); $_GET["familysite"] = urlencode($_GET["familysite"]); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}</p>"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $date = strtotime($ligne["zDate"] . "00:00:00"); $hits = FormatNumber($ligne["hits"]); $dateT = date("{l} {F} d", $date); if ($tpl->language == "fr") { $dateT = date("{l} d {F} ", $date); } $dateT = $tpl->_ENGINE_parse_body($dateT); $jshost = "Loadjs('miniadm.webstats.ByMember.website.byday.php?xtime={$date}&uid={$_GET["member-value"]}&familysite={$_GET["familysite"]}')"; $link = $boot->trswitch($jshost); $tr[] = "\n\t\t\t\t<tr id='{$id}'>\n\t\t\t\t\t<td {$link}><i class='icon-time'></i> {$dateT}</a></td>\n\t\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$size}</td>\n\t\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t\t\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>{date}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function routes_search() { $q = new mysql(); $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $t = time(); //$q->QUERY_SQL("DROP TABLE iproute_table","artica_backup"); $q->BuildTables(); $search = string_to_flexquery("routes-search"); $sql = "SELECT * FROM iproute_table WHERE 1 {$search} ORDER BY routename LIMIT 0,500"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { senderror($q->mysql_error); } while ($ligne = mysql_fetch_assoc($results)) { $link = $boot->trswitch("Loadjs('{$page}?ruleid={$ligne["ID"]}');"); $sql = "SELECT * FROM iproute_rules WHERE ruleid={$ligne["ID"]} ORDER BY priority LIMIT 0,10"; $results2 = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { senderror($q->mysql_error); } $ff = array(); while ($ligne2 = mysql_fetch_assoc($results2)) { $ff[] = "<div style='font-size:14px'>{$ligne2["src"]} - {$ligne2["destination"]}</div>"; } $delete = imgtootltip("delete-64.png", null, "Delete{$t}({$ligne["ID"]})"); $tr[] = "<tr id='R{$ligne["ID"]}'>\n\t\t<td width=1% nowrap {$link}><img src='img/64-ip-settings.png'></td>\n\t\t<td style='font-size:18px' {$link}>{$ligne["routename"]}</td>\n\t\t<td style='font-size:18px' {$link} width=1% nowrap {$link}>{$ligne["interface"]}</td>\n\t\t<td style='font-size:18px' {$link} width=1% nowrap {$link}>{$ligne["gateway"]}</td>\n\t\t<td {$link} width=1% nowrap>" . @implode("\n", $ff) . "</td>\n\t\t<td width=1% nowrap>{$delete}</td>\n\t\t</tr>\t\t\n\t\t\t\t\n\t\t"; } $deleteTXT = $tpl->javascript_parse_text("{delete_group}"); 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 colspan=2>{groupname}</th>\n\t\t\t\t\t<th>{interface}</th>\n\t\t\t\t\t<th>{gateway}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </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>\n\t<script>\nvar FreeWebIDMEM{$t}='';\n\tvar xDelete{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>10){alert(results);return;}\n\tExecuteByClassName('SearchFunction');\n\t}\n\t\nfunction Delete{$t}(id){\n\tif(confirm('{$deleteTXT} \"'+id+'\" ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('route-delete',id);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\n\t</script>\t\t\t\t\t\n\t\t\t\t\t\n"; }
function DefaultRule() { $t = $_GET["t"]; $webfilter = new webfilter_rules(); $boot = new boostrap_form(); $styleTD = "style='font-size:16px;font-weight:bold'"; $styleTDCenter = "style='font-size:16px;font-weight:bold;text-align:center !important'"; $js = "DansGuardianEditRule('0','default')"; $jsblack = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:document.getElementById('anim-img-0').innerHTML='<img src=img/wait.gif>';\"\n\t\tstyle='text-decoration:underline;font-weight:bold'>"; $delete = " "; $duplicate = imgsimple("duplicate-24.png", null, "Loadjs('dansguardian2.duplicate.php?default-rule=yes&t={$t}')"); $sock = new sockets(); $ligne = unserialize(base64_decode($sock->GET_INFO("DansGuardianDefaultMainRule"))); $TimeSpace = $webfilter->rule_time_list_explain($ligne["TimeSpace"], 0, $t); $link = $boot->trswitch($js); $link_blacklist = $boot->trswitch("Loadjs('dansguardian2.edit.php?js-blacklist-list=yes&RULEID=0&modeblk=0&group=&TimeID=&t={$t}');"); $link_whitelist = $boot->trswitch("Loadjs('dansguardian2.edit.php?js-blacklist-list=yes&RULEID=0&modeblk=1&group=&TimeID=&t={$t}');"); $templatejs = $boot->trswitch("Loadjs('dansguardian.template.php?js=yes&ID=0')"); return "\n\t<tr id='0'>\n\t<td {$styleTD} {$link} width=99%><span id='anim-img-0'>Default</span> {$TimeSpace} " . $webfilter->rules_dans_time_rule(0) . "</td>\n\t<td {$styleTDCenter} {$link} width=1% align=center >*</td>\n\t<td {$styleTDCenter} {$link_blacklist} width=1% align=center>" . $webfilter->COUNTDEGBLKS(0) . "</td>\n\t<td {$styleTDCenter} {$link_whitelist} width=1% align=center>" . $webfilter->COUNTDEGBWLS(0) . "</td>\n\t<td> </td>\n\t<td {$styleTDCenter} {$templatejs} width=35px align=center nowrap><img src='img/banned-template-32.png'></td>\n\t<td width=35px align=center {$styleTDCenter}>{$duplicate}</td>\n\t<td> </td>\n\t</tr>"; }
function visists_days_popup() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = time(); $sql = "SELECT SUM(hits) as hits,SUM(size) as size,MAC,zDate \n\tFROM members_mac GROUP BY MAC,zDate HAVING MAC='{$_GET["MAC"]}' ORDER BY zDate "; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); $sock = new sockets(); $boot = new boostrap_form(); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<hr><code>{$sql}</code></p>"; } while ($ligne = mysql_fetch_assoc($results)) { $ligne["size"] = FormatBytes($ligne["size"] / 1024); $ligne["hits"] = FormatNumber($ligne["hits"]); $xtime = strtotime($ligne["zDate"] . " 00:00:00"); $dateT = date("{l} {F} d", $xtime); if ($tpl->language == "fr") { $dateT = date("{l} d {F} ", $xtime); } $linkVisit = $boot->trswitch("Loadjs('miniadm.webstats.ByMAC.popup.php?MAC={$ligne["MAC"]}&xtime={$xtime}')"); $tr[] = $tpl->_ENGINE_parse_body("\n\t\t\t\t\t<tr id='{$ligne["MAC"]}'>\n\t\t\t\t\t<td {$linkVisit}><i class='icon-time'></i> {$dateT}</a></td>\n\t\t\t\t\t<td {$linkVisit}><i class='icon-download'></i> {$ligne["size"]} </td>\n\t\t\t\t\t<td {$linkVisit}><i class='icon-signal'></i> {$ligne["hits"]} </td>\n\t\t\t\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>{date}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</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</table>\n\t\t\t\t"; }
function NicBuildTR($NicRequested) { $val = $NicRequested; $val = trim($val); if (preg_match('#master#', $val)) { return; } if (preg_match("#^veth.+?#", $val)) { return; } if (preg_match("#^tunl[0-9]+#", $val)) { return; } if (preg_match("#^dummy[0-9]+#", $val)) { return; } if (preg_match("#^gre[0-9]+#", $val)) { return; } if (preg_match("#^ip6tnl[0-9]+#", $val)) { return; } if (preg_match("#^sit[0-9]+#", $val)) { return; } if (preg_match("#^vlan[0-9]+#", $val)) { return; } if (preg_match("#^lxc[0-9]+#", $val)) { return; } $sock = new sockets(); $snortInterfaces = array(); $LXCEthLocked = $sock->GET_INFO("LXCEthLocked"); $EnableipV6 = $sock->GET_INFO("EnableipV6"); if (!is_numeric($EnableipV6)) { $EnableipV6 = 0; } if (!is_numeric($LXCEthLocked)) { $LXCEthLocked = 0; } $IPBANS = unserialize(base64_decode($sock->GET_INFO("ArticaIpListBanned"))); $LXCInterface = $sock->GET_INFO("LXCInterface"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if (!is_numeric($DisableNetworksManagement)) { $DisableNetworksManagement = 0; } $page = CurrentPageName(); $tpl = new templates(); $apply_network_configuration = $tpl->_ENGINE_parse_body("{apply_network_configuration}"); $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $apply_network_configuration_warn = $tpl->javascript_parse_text("{apply_network_configuration_warn}"); $users = new usersMenus(); if ($users->SNORT_INSTALLED) { $EnableSnort = $sock->GET_INFO("EnableSnort"); if ($EnableSnort == 1) { $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics"))); } } $tcp = new networking(); if (!isset($GLOBALS["ipsZ"])) { $GLOBALS["ipsZ"] = $tcp->ALL_IPS_GET_ARRAY(); } $nic = new system_nic($NicRequested); if (!$nic->unconfigured) { if ($LXCEthLocked == 1) { if ($val == $LXCInterface) { writelogs("LXCEthLocked:{$LXCEthLocked}; {$val}=={$LXCInterface} -> abort", __FUNCTION__, __FILE__, __LINE__); return; } } } $NIC_UP = false; if (trim($val) == null) { continue; } $tcp->ifconfig(trim($val)); $array_ipcfg = listnicinfos(trim($val)); $ipddr = $array_ipcfg["tcp_address"]; $defaultroute_text = null; if ($nic->defaultroute == 1) { $defaultroute_text = "<div><i style='color:#C40000;font-size:11px'>{default_route}</i></div>"; } /* return array( "textColor"=>$textColor, "tcp_address"=>$IPADDR, "IPV6"=>$IPV6, "NETMASK"=>$tbl[2], "gateway"=>$tbl[4], "mac_addr"=>$tbl[1], "HAMACHI"=>$HAMACHI ); */ $js = "javascript:Loadjs('system.nic.edit.php?nic={$val}')"; if (!$tcp->linkup) { $img_on = "net-card-64-grey.png"; } else { $img_on = "net-card-64.png"; $NIC_UP = true; if ($snortInterfaces[trim($val)] == 1) { $img_on = "64-win-nic-snort.png"; } } $icon1 = imgtootltip("service-restart-16.png", "{rebuild}", "RebuildMyNic{$val}()"); $icon2 = imgtootltip("plus-16.png", "{add_virtual_ip_addr_explain_js}", "Loadjs('{$page}?js-add-nic={$val}')"); if ($array_ipcfg["HAMACHI"]) { $img_on = "64-win-nic-hamachi.png"; $js = "javascript:Loadjs('hamachi.php')"; $icon1 = null; $icon2 = null; } if ($IPBANS[$ipddr]) { $img_on = "64-win-nic-off.png"; $icon1 = null; $icon2 = null; $js = null; } $boot = new boostrap_form(); $link = $boot->trswitch("Loadjs('miniadm.network.interfaces.NIC.php?nic={$NicRequested}')"); if (!$GLOBALS["AsSystemAdministrator"]) { $link = null; } $nic = new system_nic($NicRequested); $oldnic = null; $oldMac = null; $failover_text = null; $error = null; if ($nic->ucarp_enabled == 0) { $failover_text = "{disabled}"; } if ($nic->ucarp_enabled == 1) { $oldnic = $ipddr; $ipddr = $nic->ucarp_vip; if (!isset($GLOBALS["ipsZ"][$nic->ucarp_vip])) { $error = "<img src='img/ok24-grey.png' style='marign-right:10px;float-left'>"; } if ($nic->ucarp_master == 1) { $failover_text = "{master2}"; } else { $failover_text = "{slave}"; } $failover_text = $error . $failover_text . ": {$oldnic}"; $nicinfos = $sock->getFrameWork("cmd.php?nicstatus={$NicRequested}:ucarp"); $tbl = explode(";", $nicinfos); $oldMac = "<div style='color:{$array_ipcfg["textColor"]};font-size:12px'><i>{$array_ipcfg["mac_addr"]}</i></div>"; $array_ipcfg["mac_addr"] = $tbl[1]; } if (!$users->UCARP_INSTALLED) { $failover_text = "{not_installed}"; } if ($array_ipcfg["gateway"] == null) { $nicz = new system_nic($NicRequested); $array_ipcfg["gateway"] = $nicz->GATEWAY; } return $tpl->_ENGINE_parse_body("\n\t\t<tr style='font-size:18px' {$link}>\n\t\t\t<td><img src='img/{$img_on}'></td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$NicRequested}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'><i class='icon-signal'></i> {$ipddr}<div style='color:{$array_ipcfg["textColor"]};font-size:12px'><i>{failover}:{$failover_text}</i><br>{$array_ipcfg["IPV6"]}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'><i class='icon-signal'></i> {$array_ipcfg["mac_addr"]}{$oldMac}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$array_ipcfg["gateway"]}{$defaultroute_text}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$array_ipcfg["NETMASK"]}</td>\n\t\t</tr>"); }
function search_records() { //SELECT MacAddress, uid FROM hostsusers $search = '%'; $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $q2 = new mysql(); $limitSql = "LIMIT 0,150"; $t = time(); $q = new mysql_squid_builder(); if (!$q->FIELD_EXISTS("webfilters_ipaddr", "ip")) { $q->QUERY_SQL("ALTER TABLE `webfilters_ipaddr` ADD `ip` int(10) unsigned NOT NULL default '0',ADD INDEX ( `ip` )"); } $boot = new boostrap_form(); $searchstring = string_to_flexquery("search-records"); $ORDER = $boot->TableOrder(array("ip" => "ASC")); $sql = "SELECT * FROM webfilters_ipaddr WHERE 1 {$searchstring} ORDER BY {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); $sock = new sockets(); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<hr><code>{$sql}</code></p>"; } while ($ligne = mysql_fetch_assoc($results)) { $id = md5(serialize($ligne)); $explainthis = null; $articasrv = null; $aliases_text = null; $explainMac = null; $OS = null; $macencoded = urlencode($ligne["ipaddr"]); $delete = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-ipaddr-js={$macencoded}&id={$id}')"); $jshost = "NewPDNSEntry{$t}({$id});"; $linkipaddr = $boot->trswitch("Loadjs('{$page}?NewipaddrLink-js=yes&ipaddr={$macencoded}')"); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$linkipaddr} width=1% nowrap><i class='icon-user'></i> {$ligne["ipaddr"]}</a></td>\n\t\t<td nowrap {$linkipaddr}><i class='icon-user'></i> {$ligne["hostname"]}</a></td>\n\t\t<td nowrap {$linkipaddr} width=1% nowrap><i class='icon-user'></i> {$ligne["uid"]}</td>\n\t\t<td style='text-align:center' width=1% nowrap>{$delete}</td>\n\t\t</tr>"; } $html = $boot->TableCompile(array("ip" => "{ipaddr}", "hostname" => "{hostname}", "uid" => "{uid}", "delete:no" => "{delete}"), $tr); echo $tpl->_ENGINE_parse_body($html); }
function section_search() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $xtime = $_GET["xtime"]; $tablename_prod = date("Ymd", $xtime) . "_blocked"; $tablename = $_GET["tablename"]; $subtable = "( SELECT COUNT(ID) as hits,website,category FROM `{$tablename_prod}` \n\tGROUP BY website,category ORDER BY hits DESC) as t"; $search = '%'; $table = $subtable; $page = 1; $FORCE_FILTER = null; if (!$q->TABLE_EXISTS($tablename_prod)) { senderror("{$table} doesn't exists..."); } if ($q->COUNT_ROWS($tablename_prod) == 0) { senderror("No data"); } $searchstring = string_to_flexquery($_GET["www-search"]); $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { senderror($q->mysql_error); } while ($ligne = mysql_fetch_assoc($results)) { $zmd5 = md5(serialize($ligne)); $color = "black"; $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); if ($ligne["uid"] == "-") { $ligne["uid"] = null; } $boot = new boostrap_form(); $urljs = null; $truri = $boot->trswitch($urljsSIT); $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $tr[] = "\n\t<tr {$truri}>\n\t<td ><i class='icon-globe'></i> {$ligne["website"]}</td>\n\t<td width=1% align=center nowrap>{$ligne["category"]}</td>\n\t<td width=1% align=center nowrap>{$ligne["hits"]}</td>\n\t</tr>\n\t"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{websites}</th>\n\t\t\t<th>{category}</th>\n\t\t\t<th>{hits}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("\n", $tr) . "\n\t\t\t</tbody>\n\t\t\t</table>"; }
function virtip_search() { $boot = new boostrap_form(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql(); $table = "nics_virtuals"; $database = "artica_backup"; $t = time(); $ORDER = $boot->TableOrder(array("ID" => "DESC")); $sock = new sockets(); $net = new networking(); $ip = new IP(); $interfaces = unserialize(base64_decode($sock->getFrameWork("cmd.php?ifconfig-interfaces=yes"))); $searchstring = string_to_flexquery("search-virtip"); $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderrors($q->mysql_error . "<br>{$sql}"); } $net = new networking(); while ($ligne = mysql_fetch_assoc($results)) { $md = md5(serialize($ligne)); $ip = new IP(); $cdir = $ligne["cdir"]; $eth = "{$ligne["nic"]}:{$ligne["ID"]}"; $eth_text = "{$ligne["nic"]}:{$ligne["ID"]}"; if ($ligne["cdir"] == null) { $ligne["cdir"] = $net->array_TCP[$ligne["nic"]]; $eth = $ligne["nic"]; } if ($ligne["cdir"] == null) { $ligne["cdir"] = $net->array_TCP[$ligne["nic"]]; $eth = $ligne["nic"]; } $img = "folder-network-48.png"; if ($interfaces["{$ligne["nic"]}.{$ligne["ID"]}"] != null) { $img = "folder-network-48-grey.png"; } if (trim($ligne["org"]) == null) { $ligne["org"] = $tpl->_ENGINE_parse_body("<strong style='color:red'>{no_organization}</strong>"); } $edit = $boot->trswitch("Loadjs('{$page}?virtid-js={$ligne["ID"]}')"); $delete = imgsimple("delete-48.png", "{delete}", "Delete{$t}('{$ligne["ID"]}','{$md}')"); $a = $ip->parseCIDR($cdir); if ($a[0] == 0) { $img = "warning-panneau-24.png"; $cdir = "<span style='color:red'>{$cdir}</span>"; } $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:18px' width=48px nowrap {$edit}><img src='img/{$img}'></td>\n\t\t\t<td style='font-size:18px' width=1% nowrap {$edit}>{$eth_text}</td>\n\t\t\t<td style='font-size:18px' width=90% nowrap {$edit}>{$ligne["org"]}</td>\n\t\t\t<td style='font-size:18px' width=10% nowrap {$edit}>{$ligne["nic"]}</td>\n\t\t\t<td style='font-size:18px' width=5% nowrap {$edit}>{$ligne["ipaddr"]}</td>\n\t\t\t<td style='font-size:18px' width=5% nowrap {$edit}>{$ligne["netmask"]}</td>\n\t\t\t<td style='font-size:18px' width=1% nowrap>{$delete}</td>\n\t\t</tr>\n\t\t"; } $delete_text = $tpl->javascript_parse_text("{delete}"); echo $boot->TableCompile(array("ID" => "ID:colspan=2", "org" => " {organization}", "nic" => "{nic}", "ipaddr" => "{ipaddr}", "netmask" => "{netmask}", "delete" => null), $tr) . "\n\t\t\t\t\t\n<script>\nvar mem{$t}='';\nvar xDelete{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\$('#'+mem{$t}).remove();\n}\nfunction Delete{$t}(ID,mem){\n\tmem{$t}=mem;\n\tif(confirm('{$delete_text} ID: '+ID+'?')){\n\t\tmem{$t}=mem;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('virtip-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n\t}\n</script>\t\t\t\t\t\n"; }
function table_blocked() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $dt = strtotime("{$_GET["zday"]} 00:00:00"); if (isset($_SESSION["QUERY_BLOCKED_DATE"])) { $dt = $_SESSION["QUERY_BLOCKED_DATE"]; } $zday = date('Ymd', $dt); $title_date = time_to_date($dt); $MAIN_QUERY = $_GET["query-blocked"]; $search = '%'; $table = $zday . "_blocked"; if (!$q->TABLE_EXISTS($table)) { senderrors("{no_such_table}:{$table}"); } $main_query = $_GET["query-blocked"]; $QUERY_BLOCKED_UID = $_SESSION["QUERY_BLOCKED_UID"]; $QUERY_BLOCKED_CATEGORY = $_SESSION["QUERY_BLOCKED_CATEGORY"]; $BLOCKED_CATEGORY_LIMIT = $_SESSION["BLOCKED_CATEGORY_LIMIT"]; if (!is_numeric($BLOCKED_CATEGORY_LIMIT)) { $BLOCKED_CATEGORY_LIMIT = 250; } if ($QUERY_BLOCKED_UID != null) { $title_members = " {and} {member}:{$QUERY_BLOCKED_UID}"; $QUERY_BLOCKED_UID_OP = " = "; if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_UID, $re)) { $neg = true; $QUERY_BLOCKED_UID = trim($re[1]); } if ($neg) { $QUERY_BLOCKED_UID_OP = " != "; } $QUERY_BLOCKED_UID = str_replace("*", "%", $QUERY_BLOCKED_UID); if (strpos(" {$QUERY_BLOCKED_UID}", "%") > 0) { $QUERY_BLOCKED_UID_OP = " LIKE "; if ($neg) { $QUERY_BLOCKED_UID_OP = " NOT LIKE "; } } $QUERY_BLOCKED_UID_SQL = " AND (\n\t\t\t(`client` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}') \n\t\t\tOR (`hostname` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\tOR (`uid` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\t)\n\t\t"; } $neg = false; if ($QUERY_BLOCKED_CATEGORY != null) { $title_cat = " {and} {category}:{$QUERY_BLOCKED_CATEGORY}"; if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_CATEGORY, $re)) { $neg = true; $QUERY_BLOCKED_CATEGORY = trim($re[1]); } $QUERY_BLOCKED_CATEGORY = str_replace("*", "%", $QUERY_BLOCKED_CATEGORY); $QUERY_BLOCKED_CATEGORY_OP = " = "; if ($neg) { $QUERY_BLOCKED_CATEGORY_OP = " != "; } if (strpos(" {$QUERY_BLOCKED_CATEGORY}", "%") > 0) { $QUERY_BLOCKED_CATEGORY_OP = " LIKE "; if ($neg) { $QUERY_BLOCKED_CATEGORY_OP = " NOT LIKE "; } } $QUERY_BLOCKED_CATEGORY_SQL = " AND `category`{$QUERY_BLOCKED_CATEGORY_OP}'{$QUERY_BLOCKED_CATEGORY}'"; } $neg = false; if ($MAIN_QUERY != null) { $title_cat = " {and} {website}:{$MAIN_QUERY}"; if (preg_match("#not.*?:(.+)#i", $MAIN_QUERY, $re)) { $neg = true; $MAIN_QUERY = trim($re[1]); } $MAIN_QUERY = str_replace("*", "%", $MAIN_QUERY); $MAIN_QUERY_OP = " = "; if ($neg) { $MAIN_QUERY_OP = " != "; } if (strpos(" {$MAIN_QUERY}", "%") > 0) { $MAIN_QUERY_OP = " LIKE "; if ($neg) { $MAIN_QUERY_OP = " NOT LIKE "; } } $MAIN_QUERY_SQL = " AND `website`{$MAIN_QUERY_OP}'{$MAIN_QUERY}'"; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$MAIN_QUERY_SQL}{$QUERY_BLOCKED_UID_SQL}{$QUERY_BLOCKED_CATEGORY_SQL} ORDER BY zDate LIMIT 0,{$BLOCKED_CATEGORY_LIMIT}"; $results = $q->QUERY_SQL($sql, 'artica_events'); $boot = new boostrap_form(); $UnBlockWebSiteExplain = $tpl->javascript_parse_text("{UnBlockWebSiteExplain}"); $today = date('Y-m-d'); if (!$q->ok) { sendserrors($q->mysql_error . "<br>{$sql}"); } $t = time(); $q2 = new mysql(); while ($ligne = mysql_fetch_assoc($results)) { $member = $ligne["client"]; if ($ligne["hostname"] != null) { $member = $ligne["hostname"]; } if ($ligne["uid"] != null) { $member = $ligne["uid"]; } $js = "Loadjs('squid.categories.php?category={$ligne["category"]}&website={$ligne["website"]}',true)"; $link = $boot->trswitch($js); $unblock = imgsimple("whitelist-24.png", null, "UnBlockWebSite{$t}('{$ligne["website"]}')"); $ligne3 = mysql_fetch_array($q2->QUERY_SQL("SELECT items FROM urlrewriteaccessdeny WHERE items='{$ligne["website"]}'", "artica_backup")); if (!$q->ok) { $unblock = "<img src='img/icon_err.gif'><br>{$q->mysql_error}"; } else { if ($ligne3["items"] != null) { $unblock = imgsimple("20-check.png", null, null); } } if ($ligne["blocktype"] != null) { $blocktype = "<div><i style='font-size:10px'>{$ligne["blocktype"]}</i></div>"; } $tr[] = "\n\t\t<tr>\n\t\t<td nowrap><i class='icon-time'></i> {$ligne["zDate"]}</td>\n\t\t<td {$link}><i class='icon-user'></i> {$member}</td>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["website"]}{$blocktype}</td>\n\t\t<td {$link}><i class='icon-info'></i> {$ligne["category"]}</td>\n\t\t<td {$link}><i class='icon-info'></i> {$ligne["rulename"]}</td>\n\t\t<td>{$unblock}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t\n\t\t<p>{search}:{$title_date}{$title_members}{$title_cat}</p>\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>{zDate} </th>\n\t\t\t\t\t<th>{member}</th>\n\t\t\t\t\t<th>{website}</th>\n\t\t\t\t\t<th>{category}</th>\n\t\t\t\t\t<th>{rule}</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</table>\n\t\t<script>\n\tvar x_UnBlockWebSite{$t}=function(obj){\n\t var tempvalue=obj.responseText;\n\t if(tempvalue.length>3){alert(tempvalue);}\n\t \n\t}\t\n\nfunction UnBlockWebSite{$t}(domain){\n\tif(confirm('{$UnBlockWebSiteExplain}:'+domain+' ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('unlock',domain);\n\t\tXHR.sendAndLoad('squid.blocked.events.php', 'POST',x_UnBlockWebSite{$t});\n\t}\n\n}\n</script>\t\t\t\t\t\n"; }
function policies_search() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $html = "<p class=text-info>{amavis_users_policies_explain}</p>"; $boot = new boostrap_form(); $user = new user($_SESSION["uid"]); $mails = $user->HASH_ALL_MAILS; $amavis = new amavisdb(); $search = string_to_flexregex(); while (list($b, $email) = each($mails)) { if ($search != null) { if (!preg_match("#{$search}#", $email)) { continue; } } $id = $amavis->policyid_from_mail($email); $ligne = $amavis->policy_array($id); $policy_name = $ligne["policy_name"]; $tr[] = "\n\t\t<tr id='{$id}' " . $boot->trswitch("Loadjs('{$page}?policy-email-js={$email}')") . ">\n\t\t<td width=30%><i class='icon-envelope'></i> {$email}</td>\n\t\t<td width=30%><i class='icon-filter'></i> {$policy_name}</td>\n\t\t<td width=1%><i class='icon-eye-open'></i> {$ligne["spam_tag_level"]}</td>\n\t\t<td width=1%><i class='icon-fire'></i> {$ligne["spam_tag2_level"]}</td>\n\t\t<td width=1%><i class='icon-trash'></i> {$ligne["spam_kill_level"]}</td>\n\t\t\n\t\t</tr>\n\t\t"; } echo $tpl->_ENGINE_parse_body("<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>{email} «{$_SESSION["uid"]}»</th>\n\t\t\t\t<th>{policy}</th>\n\t\t\t\t<th width=1% nowrap>TAG {level}</th>\n\t\t\t\t<th width=1% nowrap>QUAR {level}</th>\n\t\t\t\t<th width=1% nowrap>KILL {level}</th>\n\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>"; }
function topmembers_table_search() { $tpl = new templates(); $MyPage = CurrentPageName(); $boot = new boostrap_form(); $q = new mysql_squid_builder(); $sock = new sockets(); $fontsize = "14px"; $page = 1; $t = time(); $ORDER = $boot->TableOrder(array("size" => "DESC")); $searchstring = string_to_flexquery("topmembers-search"); $year = $_GET["year"]; $month = $_GET["month"]; $familysite = mysql_escape_string2($_GET["familysite"]); $table = "quotamonth_{$year}{$month}"; $table = "(SELECT `uid`,familysite,SUM(size) as `size` FROM {$table} GROUP BY `uid`,familysite \n\tHAVING familysite='{$familysite}' ORDER BY `size` DESC LIMIT 0,50) as t"; $size_text = $tpl->_ENGINE_parse_body("{size}"); $members_text = $tpl->_ENGINE_parse_body("{members}"); $websites_text = $tpl->_ENGINE_parse_body("{websites}"); $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,20"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error_html(); } $suffix = suffix(); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $color = "black"; $size = FormatBytes($ligne["size"] / 1024); $websiteenc = urlencode($ligne["familysite"]); $js = $boot->trswitch("Loadjs('miniadm.webstats.popup.ByMonthByUserByFamilysite.php?uid={$ligne["uid"]}{$suffix}')"); $tr[] = "\n\t\t<tr>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=99% nowrap {$js}>{$ligne["uid"]}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% nowrap {$js}>{$size}</td>\n\t\t</tr>"; } echo $boot->TableCompile(array("uid" => "{$members_text}", "size" => "{$size_text}"), $tr); }
function search_database() { $page = 1; $MyPage = CurrentPageName(); $users = new usersMenus(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_storelogs(); if (!$q->BD_CONNECT()) { senderror($q->mysql_error); } if ($q->start_error != null) { senderror($q->start_error); } $table = "files_info"; $tableOrg = $table; $database = $q->database; $t = time(); $delete_alert = $tpl->javascript_parse_text("{delete_this_item}"); $MySQLType = $tpl->_ENGINE_parse_body($q->MYSQLTypeText); //if(!$q->TABLE_EXISTS($table,$database)==0){senderror("{table_does_not_exists}: <strong>$database/$table</strong> $MySQLType: `$q->SocketName`!");} if ($q->COUNT_ROWS($table, $database) == 0) { senderror("{$table}/{$database} is empty"); } $searchstring = string_to_flexquery("search-database"); $limit = "LIMIT 0,250"; if (is_numeric($_GET["xtime"])) { $WHERE1 = " (DATE_FORMAT(filetime,'%Y-%m-%d')='" . date("Y-m-d") . "') AND"; unset($_SESSION["QUERY_SYSLOG_DATE"]); } if ($_SESSION["QUERY_SYSLOG_LIMIT"] > 0) { $limit = "LIMIT 0,{$_SESSION["QUERY_SYSLOG_LIMIT"]}"; } $filters = array(); $filters[] = SearchToSql("DATE_FORMAT(filetime,'%Y-%m-%d')", $_SESSION["QUERY_SYSLOG_DATE"]); $filters[] = SearchToSql("filename", $_SESSION["QUERY_SYSLOG_FILE"]); $filters[] = SearchToSql("hostname", $_SESSION["QUERY_SYSLOG_HOST"]); $table = "(SELECT `filename`,`taskid`,`storeid`,`filesize`,`filetime`,`hostname` FROM {$table}\n\t\t\tWHERE {$WHERE1} (`filename` LIKE 'auth.log%') OR (filename LIKE 'squid-access%')) as t"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} " . @implode(" ", $filters) . " ORDER BY `filetime` DESC LIMIT 0,250"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror("{$q->mysql_error}"); } if (mysql_num_rows($results) == 0) { senderror("Query return empty array"); } $boot = new boostrap_form(); while ($ligne = mysql_fetch_assoc($results)) { $md5S = md5(serialize($ligne)); $filename = $ligne["filename"]; $hostname = $ligne["hostname"]; $storeid = $ligne["storeid"]; $taskid = $ligne["taskid"]; $filesize = FormatBytes($ligne["filesize"] / 1024); $filetime = $ligne["filetime"]; $delete = imgsimple("delete-32.png", null, "Delete{$t}('{$storeid}','{$md5S}')"); $action = " "; if (preg_match("#auth\\.log-.*?#", $ligne["filename"])) { $action = imgsimple("32-import.png", null, "Loadjs('squid.restoreSource.php?filename={$ligne["filename"]}&storeid={$storeid}')"); } if (preg_match("#squid-access-(.*?)\\.log\\.#", $ligne["filename"])) { $action = imgsimple("32-import.png", null, "Loadjs('squid.restoreSource.php?filename={$ligne["filename"]}&storeid={$storeid}')"); } $download = "<a href=\"{$MyPage}?download={$storeid}&filename={$ligne["filename"]}&storeid={$storeid}\"><img src='img/arrow-down-32.png'></a>"; $js = "Loadjs('logrotate.php?log-js=yes&filename={$filename}&storeid={$storeid}&t=1368560783');"; $trlink = $boot->trswitch($js); $tr[] = "\n\t\t<tr id='{$md5S}'>\n\t\t<td nowrap {$trlink}>{$filetime}</td>\n\t\t<td nowrap {$trlink}>{$filename}</td>\n\t\t<td nowrap {$trlink}>{$hostname}</td>\n\t\t<td nowrap {$trlink}>{$filesize}</td>\n\t\t<td width=1% align=center>{$download}</td>\n\t\t<td width=1% align=center>{$action}</td>\n\t\t<td width=1% align=center>{$delete}</td>\n\t\t</tr>\n\t\t"; } echo $tpl->_ENGINE_parse_body("\n\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th>{filename}</th>\n\t\t\t\t\t<th>{hostname}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n\t\t\t<script>\n\t\t\tvar memedb{$t}='';\n\t\t\tvar xDelete{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#'+memedb{$t}).remove();\n}\n\n\t\t\tfunction Delete{$t}(ID,md){\n\t\t\tmemedb{$t}=md;\n\t\t\tif(confirm('{$delete_alert} '+ID+' ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('syslog-delete',ID);\n\t\t\tXHR.sendAndLoad('{$MyPage}', 'POST', xDelete{$t});\n}\n}\n\t\t\t</script>"; }
function websites_directories_search() { $searchstring = string_to_flexquery("directories-search"); $q = new mysql_squid_builder(); $servername = $_GET["servername"]; $servername_enc = urlencode($servername); $sql = "SELECT * FROM reverse_dirs WHERE servername='{$servername}' {$searchstring} ORDER BY directory LIMIT 0,250"; $results = $q->QUERY_SQL($sql); $tpl = new templates(); $GLOBALS["CLASS_TPL"] = $tpl; $boot = new boostrap_form(); $page = CurrentPageName(); $t = time(); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $icon = "folder-move-64.png"; $arrow = "arrow-right-64.png"; $color = "black"; $md = md5(serialize($ligne)); $delete = imgsimple("delete-48.png", null, "Loadjs('{$page}?delete-folder-id-js={$ligne["folderid"]}');"); $jsEditWW = $boot->trswitch("Loadjs('website-js=yes&servername={$servername_enc}')"); $jsedit = $boot->trswitch("Loadjs('{$page}?website-directory-js=yes&servername={$servername}&folderid={$ligne["folderid"]}')"); $jseditA = $jsedit; $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT servername,ipaddr,port FROM reverse_sources WHERE ID='{$ligne["cache_peer_id"]}'")); $destination = "{$ligne2["servername"]}:{$ligne2["port"]}"; $jseditS = $boot->trswitch("Loadjs('{$page}?js-source=yes&source-id={$ligne["cache_peer_id"]}')"); $jseditDest = $jsedit; $DestFont = 16; $directory = trim(stripslashes($ligne["directory"])); $hostweb = "<div><i>{$ligne["hostweb"]}</i></div>"; if ($ligne["local"] == 1) { $destination = $ligne["localdirectory"]; } if ($ligne["webpageid"] > 0) { $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT subject FROM reverse_pages_content WHERE ID='{$ligne["webpageid"]}'")); $destination = $ligne2["subject"]; $hostweb = null; $DestFont = 12; $jseditDest = $boot->trswitch("Loadjs('miniadmin.crm.pages.php?ID={$ligne["webpageid"]}')"); } $tr[] = "\n\t\t<tr style='color:{$color}' id='{$md}'>\n\t\t<td width=1% nowrap {$jsedit}><img src='img/{$icon}'></td>\n\t\t<td width=80% {$jsedit}><span style='font-size:16px;font-weight:bold'>http(s)://{$servername}/{$directory}</span></td>\n\t\t<td width=1% nowrap {$jsedit} style='vertical-align:middle'><img src='img/{$arrow}'></td>\n\t\t<td width=1% nowrap {$jseditDest} style='vertical-align:middle'>\n\t\t\t<span style='font-size:{$DestFont}px;font-weight:bold'>{$destination}</span>{$hostweb}\n\t\t</td>\n\t\t\t\n\t\t\t\n\t\t<td width=1% nowrap style='vertical-align:middle'>{$delete}</td>\n\t\t</tr>\n\t\t"; } $t = time(); $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}"); $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}"); $delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}"); $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}"); echo $tpl->_ENGINE_parse_body("\n<table class='table table-bordered table-hover'>\n\t<thead>\n\t\t<tr>\n\t\t\t<th colspan=2>{paths}</th>\n\t\t\t<th colspan=2>{destination}</th>\n\t\t\t<th> </th>\n\t\t</tr>\n\t\t</thead>\n<tbody>") . @implode("", $tr) . "</tbody></table>\n<script>\n var FreeWebIDMEM{$t}='';\nvar xDelete{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>10){alert(results);return;}\n\t\$('#'+FreeWebIDMEM{$t}).remove();\n}\n\t\nfunction Delete{$t}(server,md){\n\tFreeWebIDMEM{$t}=md;\n\tif(confirm('{$delete_freeweb_text}')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('website-delete',server);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\n</script>\n"; }
function who_items() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $youtubeid = $_GET["youtubeid"]; $searchstring = string_to_flexregex("who-items"); $table = "youtube_all"; $page = 1; $FORCE_FILTER = " AND "; if ($searchstring != null) { $searchstring = "{$searchstring}"; } $sql = "SELECT zDate,uid,MAC,youtubeid,SUM(hits) as hits FROM {$table} GROUP BY youtubeid,zDate,uid,MAC HAVING youtubeid='{$youtubeid}' {$searchstring} ORDER BY zDate DESC LIMIT 0,250"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { throw new Exception("ERROR {$q->mysql_error} `{$sql}`", 500); } $boot = new boostrap_form(); while ($ligne = mysql_fetch_assoc($results)) { $zmd5 = md5(serialize($ligne)); $color = "black"; $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')"; $link = $boot->trswitch($urljsSIT); $jsvideo = $boot->trswitch("Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}');"); $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}&xtime={$_GET["xtime"]}');"; $link = $boot->trswitch($urljsSIT); $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $urljsSIT = null; $link = null; $xtime = strtotime($ligne["zDate"] . " 00:00:00"); $linkuid = $boot->trswitch("Loadjs('miniadm.webstats.ByMember.ByYoutubeByHour.php?filterBy=uid&xtime={$xtime}&value={$ligne["uid"]}&youtubeid={$youtubeid}')"); $linkMAC = $boot->trswitch("Loadjs('miniadm.webstats.ByMember.ByYoutubeByHour.php?filterBy=MAC&xtime={$xtime}&value={$ligne["MAC"]}&youtubeid={$youtubeid}')"); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$link} nowrap><i class='icon-time'></i> {$ligne["zDate"]}</td>\n\t\t<td {$linkuid}><i class='icon-info-sign'></i> {$ligne["uid"]}</td>\n\t\t<td {$linkMAC}><i class='icon-info-sign'></i> {$ligne["MAC"]}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$ligne["hits"]}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t<table class='table table-bordered table-hover'>\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>{zDate}</th>\n\t\t\t\t<th>{member}</th>\n\t\t\t\t<th>{MAC}</th>\n\t\t\t\t<th>{hits}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t<tbody>\n\t") . @implode("", $tr) . "</tbody></table>"; }
function webstats_middle_table_items() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $xtime = $_GET["xtime"]; $database = "squidlogs"; $tablename_members = date("Ymd", $_GET["xtime"]) . "_members"; if ($_GET["FILTER"] == null) { $_GET["FILTER"] = which_filter($tablename_members); } $subtable = "( SELECT {$_GET["FILTER"]},SUM(size) as size, SUM(hits) as hits FROM `{$tablename_members}` \n\tGROUP BY {$_GET["FILTER"]} HAVING LENGTH({$_GET["FILTER"]})>0) as t"; $search = '%'; $table = $subtable; $page = 1; $FORCE_FILTER = null; $dansguardian_events = date("Ymd", $xtime) . "_hour"; if (!$q->TABLE_EXISTS($tablename_members, $database)) { json_error_show("{$table} doesn't exists..."); } if ($q->COUNT_ROWS($tablename_members, $database) == 0) { json_error_show("No data"); } 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("items"); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $boot = new boostrap_form(); $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} ORDER BY size DESC LIMIT 0,150"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); while ($ligne = mysql_fetch_assoc($results)) { $zmd5 = md5(serialize($ligne)); $color = "black"; //familysite size hits $colorsize = "black"; $sizeorg = $ligne["size"]; $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $ligne["size"] = FormatBytes($ligne["size"] / 1024); if ($sizeorg > 102400000) { $colorsize = "#4E0000"; } if ($sizeorg > 512000000) { $colorsize = "#9A0000"; } // https://192.168.1.106:9000/ $urljs = "Loadjs('squid.members.zoom.php?table={$dansguardian_events}&field={$_GET["FILTER"]}&value={$ligne["{$_GET["FILTER"]}"]}')"; $link = $boot->trswitch($urljs); $tr[] = "\n\t<tr id='{$id}'>\n\t<td {$link}><i class='icon-user'></i> {$ligne["name"]}</a>{$ligne["{$_GET["FILTER"]}"]}</td>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["hits"]}</td>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["size"]}</td>\n\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\n\t\t<table class='table table-bordered table-hover'>\n\t\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{{$_GET["FILTER"]}}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t\t<th>{size}</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</table>"; }
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>"; }
function section_webrules_search() { $q = new mysql_squid_builder(); $database = "squidlogs"; $sock = new sockets(); $tpl = new templates(); $search = '%'; $table = "websites_caches_params"; $searchstring = string_to_flexquery("search-webrules"); $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} ORDER BY sitename"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror($q->mysql_error); } $boot = new boostrap_form(); $t = time(); while ($ligne = mysql_fetch_assoc($results)) { $ID = md5($ligne["sitename"]); $delete = imgtootltip("delete-24.png", "{delete}", "DeleteWebsiteCached{$t}('{$ligne["sitename"]}','{$ID}')"); $select = "Loadjs('squid.miniwebsite.tasks.php?cache-params-js=yes&sitename={$ligne["sitename"]}&table-t={$_GET["t"]}');"; $ligne["MIN_AGE"] = $ligne["MIN_AGE"]; $ligne["MIN_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MIN_AGE"] * 60, true)); $ligne["MAX_AGE"] = $ligne["MAX_AGE"]; $ligne["MAX_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MAX_AGE"] * 60, true)); if (trim($ligne["sitename"]) == '.') { $ligne["sitename"] = $tpl->_ENGINE_parse_body("{all}"); } $link = $boot->trswitch($select); $tr[] = "\n\t\t<tr id='{$ID}'>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["sitename"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MIN_AGE"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["PERCENT"]}%</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MAX_AGE"]}</td>\n\t\t<td width=1% nowrap>{$delete}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{website}</th>\n\t\t\t<th>{expire_time}</th>\n\t\t\t<th>%</th>\n\t\t\t<th>{limit}</th>\n\t\t\t<th> </th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n<script>\nvar websiteMem{$t}='';\n\t\tvar x_DeleteWebsiteCached{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\t\$('#'+websiteMem{$t}).remove();\t\t\t\n\t\t\t\t\n\t\t}\t\n\n\t\tfunction DeleteWebsiteCached{$t}(domain,id){\n\t\t\twebsiteMem{$t}=id;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DELETE',domain);\n\t\t\tXHR.sendAndLoad('squid.caches32.caches-www.php', 'POST',x_DeleteWebsiteCached{$t});\n\t\t}\n</script>\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n"; }
function acl_list() { //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $boot = new boostrap_form(); $RULEID = $_GET["RULEID"]; $t = $_GET["t"]; $search = '%'; $table = "webfilters_sqacls"; $page = 1; $data = array(); $data['rows'] = array(); $sock = new sockets(); $gliff = "<i class='icon-ok'></i>"; $EnableSquidPortsRestrictions = $sock->GET_INFO("EnableSquidPortsRestrictions"); if (!is_numeric($EnableSquidPortsRestrictions)) { $EnableSquidPortsRestrictions = 0; } $ORDER = "ORDER BY xORDER ASC"; if (!is_numeric($_GET["t"])) { $_GET["t"] = time(); } $searchstring = string_to_flexquery("search-rule"); $default = $tpl->_ENGINE_parse_body("{default}"); $ports_restrictions = $tpl->_ENGINE_parse_body("{ports_restrictions}"); $http_safe_ports = $tpl->_ENGINE_parse_body("{http_safe_ports}"); $deny_ports_expect = $tpl->_ENGINE_parse_body("{deny_ports_expect}"); $q2 = new mysql(); $items = $q2->COUNT_ROWS("urlrewriteaccessdeny", "artica_backup"); $explain = $tpl->_ENGINE_parse_body("{urlrewriteaccessdeny_explain} <br><strong>{$items} {items}</strong>"); $delete_rule_ask = $tpl->javascript_parse_text("{delete_rule_ask}"); $WHERE = "`aclport`=0 AND aclgpid=0"; if (!is_numeric($_GET["listen-port"])) { $_GET["listen-port"] = 0; } if ($_GET["listen-port"] > 0) { $q = new mysql_squid_builder(); $WHERE = "`aclport`={$_GET["listen-port"]}"; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT enabled FROM webfilters_sqaclsports WHERE aclport='{$_GET["listen-port"]}'")); if (!$q->ok) { if (preg_match("#Unknown column#", $q->mysql_error)) { $q->CheckTables(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT enabled FROM webfilters_sqaclsports WHERE aclport='{$_GET["listen-port"]}'")); } } if (!$q->ok) { $error_explain = "<p class=text-error>{$q->mysql_error}</p>"; } if ($ligne["enabled"] == 0) { $error_explain = "<p class=text-error>{this_rule_is_disabled}</p>"; } } if ($searchstring == null) { if ($_GET["listen-port"] == 0) { $link = $boot->trswitch("Loadjs('squid.urlrewriteaccessdeny.php?t={$_GET["t"]}')"); $tr[] = "\n\t\t\t<tr id='aclNone1'>\n\t\t\t\t<td {$link}>{$gliff} {$default}</td>\n\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$explain}</td>\n\t\t\t\t<td {$link}> </td>\n\t\t\t\t<td {$link}> </td>\n\t\t\t\t<td> </td>\n\t\t\t\t<td> </td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>"; $ports = unserialize(base64_decode($sock->GET_INFO("SquidSafePortsSSLList"))); if (is_array($ports)) { while (list($port, $explain) = each($ports)) { $bbcSSL[] = $port; } } $ports = unserialize(base64_decode($sock->GET_INFO("SquidSafePortsList"))); if (is_array($ports)) { while (list($port, $explain) = each($ports)) { $bbcHTTP[] = $port; } } $color = "black"; $colored = "#A71A05"; if ($EnableSquidPortsRestrictions == 0) { $color = "#8a8a8a"; $colored = $color; } $sslp = "{$deny_ports_expect}: {$http_safe_ports} SSL: " . @implode(", ", $bbcSSL); $http = "{$deny_ports_expect}: {$http_safe_ports}: " . @implode(", ", $bbcHTTP); $enableSSL = Field_checkbox("EnableSquidPortsRestrictions", 1, $EnableSquidPortsRestrictions, "EnableSquidPortsRestrictionsCK()"); $link = $boot->trswitch("Loadjs('squid.advParameters.php?t={$_GET["t"]}&OnLyPorts=yes');"); $tr[] = "\n\t\t\t<tr id='aclNone2'>\n\t\t\t\t<td {$link}>{$gliff} <span style='color:{$color}'>{$default}</span></td>\n\t\t\t\t<td {$link}><i class='icon-info-sign'></i> <span style='color:{$color}'> {$ports_restrictions}\n\t\t\t\t<span style='color:{$colored};font-weight:bold'><div>{$sslp}</div><div>{$http}</div></span>\n\t\t\t\t</td>\n\t\t\t\t<td {$link}> </td>\n\t\t\t\t<td {$link}> </td>\n\t\t\t\t<td> </td>\n\t\t\t\t<td> </td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>"; } } $rp = 50; $sql = "SELECT * FROM `{$table}` WHERE {$WHERE} {$searchstring} {$ORDER}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show("{$q->mysql_error}"); } $acls = new squid_acls_groups(); $order = $tpl->_ENGINE_parse_body("{order}:"); while ($ligne = mysql_fetch_assoc($results)) { $gliff = "<i class='icon-ok'></i>"; $val = 0; $color = "black"; $disable = Field_checkbox("aclid_{$ligne['ID']}", 1, $ligne["enabled"], "EnableDisableAclRule{$t}('{$ligne['ID']}')"); $ligne['aclname'] = utf8_encode($ligne['aclname']); $delete = imgsimple("delete-24.png", null, "DeleteSquidAclRule('{$ligne['ID']}')"); if ($ligne["enabled"] == 0) { $color = "#8a8a8a"; $gliff = null; } $explain = $tpl->_ENGINE_parse_body($acls->ACL_MULTIPLE_EXPLAIN($ligne['ID'], $ligne["enabled"], $ligne["aclgroup"], true)); $up = imgsimple("arrow-up-16.png", "", ""); $down = imgsimple("arrow-down-18.png", "", ""); $export = imgsimple("24-export.png", "", "Loadjs('squid.acls.export.php?single-id={$ligne['ID']}')"); $link = $boot->trswitch("Loadjs('squid.acls-rules.php?Addacl-js=yes&ID={$ligne['ID']}&t={$_GET["t"]}');"); $tr[] = "\n\t\t<tr id='acl{$ligne['ID']}'>\n\t\t<td {$link} nowrap>{$gliff} <span style='color:{$color}'>{$ligne['aclname']}</span></td>\n\t\t<td ><i class='icon-info-sign'></i> <span style='color:{$color}'> {$explain}</td>\n\t\t<td width=1% " . $boot->trswitch("AclUpDown('{$ligne['ID']}',1)") . ">{$up}</td>\n\t\t<td width=1% " . $boot->trswitch("AclUpDown('{$ligne['ID']}',0)") . ">{$down}</td>\n\t\t<td width=1% align='center' style='text-align:center'>{$disable}</td>\n\t\t<td width=1% align='center' style='text-align:center'>{$export}</td>\n\t\t<td width=1% align='center' style='text-align:center'>{$delete}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t{$error_explain}\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>{rule}</th>\n\t\t\t\t\t<th>{description}</th>\n\t\t\t\t\t<th colspan=2>{order}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </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>\n<script>\nvar DeleteSquidAclGroupTemp='';\n\n\tvar x_EnableDisableAclRule{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\tExecuteByClassName('SearchFunction');\n\t}\n\t\n\tvar x_DeleteSquidAclRule{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#acl'+DeleteSquidAclGroupTemp).remove();\n\t}\t\n\t\n\t\n\tfunction DeleteSquidAclRule(ID){\n\t\tDeleteSquidAclGroupTemp=ID;\n\t\tif(confirm('{$delete_rule_ask} :'+ID)){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('acl-rule-delete', ID);\n\t\t\tXHR.sendAndLoad('squid.acls-rules.php', 'POST',x_DeleteSquidAclRule{$t});\n\t\t} \t\t\n\t}\n\n\tfunction AclUpDown(ID,dir){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('acl-rule-move', ID);\n\t\t\tXHR.appendData('acl-rule-dir', dir);\n\t\t\tXHR.sendAndLoad('squid.acls-rules.php', 'POST',x_EnableDisableAclRule{$t}); \t\n\t\t}\t\n\n\tfunction EnableDisableAclRule{$t}(ID){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('acl-rule-enable', ID);\n\t\tif(document.getElementById('aclid_'+ID).checked){XHR.appendData('enable', '1');}else{XHR.appendData('enable', '0');}\n\t\tXHR.sendAndLoad('squid.acls-rules.php', 'POST',x_EnableDisableAclRule{$t}); \t\t\n\t}\t\n\n</script>"; }
function table_all_videos_search() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $TB_HEIGHT = 500; $TB_WIDTH = 910; $uid = $_GET["uid"]; $t = time(); $new_entry = $tpl->javascript_parse_text("{new_backup_rule}"); $imapserv = $tpl->_ENGINE_parse_body("{imap_server}"); $account = $tpl->_ENGINE_parse_body("{account}"); // $title=$tpl->_ENGINE_parse_body("$attachments_storage {items}: «$size»"); $filessize = $tpl->_ENGINE_parse_body("{filesize}"); $action_delete_rule = $tpl->javascript_parse_text("{action_delete_rule}"); $enable = $tpl->_ENGINE_parse_body("{enable}"); $compile_rules = $tpl->_ENGINE_parse_body("{compile_rules}"); $online_help = $tpl->_ENGINE_parse_body("{online_help}"); $enabled = $tpl->_ENGINE_parse_body("{enabled}"); $items = $tpl->_ENGINE_parse_body("{items}"); $error_want_operation = $tpl->javascript_parse_text("{error_want_operation}"); $events = $tpl->javascript_parse_text("{events}"); $category = $tpl->javascript_parse_text("{category}"); $title = $tpl->javascript_parse_text("{video_title}"); $created = $tpl->javascript_parse_text("{created}"); $duration = $tpl->javascript_parse_text("{duration}"); $hits = $tpl->javascript_parse_text("{hits}"); $categories = $tpl->javascript_parse_text("{categories}"); if (!isset($_SESSION["QUERY_YOUTUBE_LIMIT"])) { $_SESSION["QUERY_YOUTUBE_LIMIT"] = 250; } $q = new mysql_squid_builder(); $search = string_to_flexquery("videos-search"); $filters = array(); $filters[] = SearchToSql("category", $_SESSION["QUERY_YOUTUBE_CATE"]); $sql = "SELECT * FROM youtube_objects WHERE 1 {$search} " . @implode($filters, " ") . " ORDER BY uploaded DESC LIMIT 0,{$_SESSION["QUERY_YOUTUBE_LIMIT"]}"; $results = $q->QUERY_SQL($sql); $boot = new boostrap_form(); if (!$q->ok) { die("<p class=text-error>{$q->mysql_error}</p>"); } $seconds = $tpl->_ENGINE_parse_body("{seconds}"); $minutes = $tpl->_ENGINE_parse_body("{minutes}"); $hours = $tpl->_ENGINE_parse_body("{hours}"); while ($ligne = mysql_fetch_assoc($results)) { $youtubeid = $ligne["youtubeid"]; $color = "black"; $unit = $seconds; $ligne["duration"] = format_time($ligne["duration"]); $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')"; $link = $boot->trswitch($urljsSIT); $jsvideo = $boot->trswitch("Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}');"); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$jsvideo}><img src='{$page}?thumbnail={$youtubeid}' class=img-polaroid></td>\n\t\t<td {$link} nowrap><i class='icon-time'></i> {$ligne["uploaded"]}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$ligne["title"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$ligne["category"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$ligne["duration"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$ligne["hits"]}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t<table class='table table-bordered table-hover'>\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{$created}</th>\n\t\t\t\t\t<th>{$title}</th>\n\t\t\t\t\t<th>{$category} {$_SESSION["QUERY_YOUTUBE_CATE"]}</th>\n\t\t\t\t\t<th>{$duration}</th>\n\t\t\t\t\t<th>{$hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function www_requests_search() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $search = string_to_flexquery("requests-search"); $xtime = $_GET["xtime"]; $dansguardian_table = "dansguardian_events_" . date("Ymd", $xtime); $q = new mysql_squid_builder(); if (!$q->TABLE_EXISTS($dansguardian_table)) { echo "<p class=text-error>No table «{$dansguardian_table}» for {$_GET["uid"]}</p>"; return; } $sql = "SELECT * FROM (SELECT hits as hits,QuerySize as size,uri,HOUR(zDate) as `hour`,\n\tsitename FROM `{$dansguardian_table}` WHERE uid='{$_GET["uid"]}'\n\tAND sitename LIKE '%{$_GET["familysite"]}' \n\tAND LENGTH(uri)>4\n\tORDER BY zDate LIMIT 0,250) as t WHERE 1 {$search}"; $results = $q->QUERY_SQL($sql); $_GET["uid"] = urlencode($_GET["uid"]); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $hits = FormatNumber($ligne["hits"]); $link = $boot->trswitch("blur()"); $date = $ligne["hour"]; $uri = $ligne["uri"]; $urilenth = strlen($ligne["uri"]); if ($urilenth > 80) { $uri = substr($uri, 0, 77) . "..."; } $tr[] = "\n\t<tr id='{$id}'>\n\t\t<td {$link} nowrap><i class='icon-clock'></i> {$date}H</td>\n\t\t<td {$link}><i class='icon-globe'></i> <a href=\"{$ligne["uri"]}\" target=_new>{$uri}</a></a></td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$size}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$hits}</td>\n\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\n\t\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>{hour}</th>\n\t\t\t\t\t<th>{url}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }