Ejemplo n.º 1
0
function section_websites_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $current_month = date("Ym", $_GET["xtime"]);
    $table = "{$current_month}_catfam";
    $searchstring = string_to_flexquery("sites-search");
    $ORDER = $boot->TableOrder(array("size" => "DESC"));
    if (!$q->TABLE_EXISTS($table)) {
        senderrors("no such table");
    }
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    //zDate      | client        | uid               | hostname                | MAC               | familysite                                 | catfam | hits | size
    $table = "( SELECT familysite,catfam,SUM(size) as size,SUM(hits) as hits FROM `{$table}` GROUP BY familysite HAVING catfam='{$_GET["catfam"]}') as t";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $js = "Loadjs('miniadm.webstats.familysite.all.php?familysite={$sitenameenc}')";
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:16px' width=10% nowrap {$link}>{$ligne["familysite"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("familysite" => "{familysite}", "hits" => "{hits}", "size" => "{size}"), $tr);
}
function bridge_search()
{
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    $table = "iptables_bridge";
    $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-bridge");
    $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();
        $img = "folder-network-48.png";
        $cdir = $ligne["cdir"];
        $eth = "br{$ligne["ID"]}";
        $eth_text = "br{$ligne["ID"]}";
        $array = $net->GetNicInfos($ligne["nic_inbound"]);
        $nic_inbound_ip = $array["IPADDR"];
        $array = $net->GetNicInfos($ligne["nic_linked"]);
        $nic_linked_ip = $array["IPADDR"];
        $delete = imgsimple("delete-48.png", "{delete}", "Delete{$t}('{$ligne["ID"]}','{$md}')");
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:18px' width=1% nowrap><img src='img/{$img}'></td>\n\t\t\t<td style='font-size:18px' width=1% nowrap>{$ligne["nic_inbound"]} - {$nic_inbound_ip}</td>\n\t\t\t<td style='font-size:18px' width=10% nowrap>{$ligne["nic_linked"]} - {$nic_linked_ip}</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_nic_bridge}");
    echo $boot->TableCompile(array("ID" => "ID", "nic_inbound" => "{from}", "nic_linked" => "{to}", "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('bridge-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n\t}\n</script>\t\t\t\t\t\n";
}
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()
{
    $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 events_rotate_table()
{
    $q = new mysql_storelogs();
    $boot = new boostrap_form();
    $table = "evnts";
    $rows = $q->COUNT_ROWS($table);
    if ($rows == 0) {
        senderror("{$table} is empty");
    }
    $ORDER = $boot->TableOrder(array("zDate" => "DESC"));
    $searchstring = string_to_flexquery("search-rotate-events");
    $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}");
    }
    $tpl = new templates();
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["content"] = $tpl->_ENGINE_parse_body($ligne["content"]);
        $ligne["content"] = str_replace("\n", "<br>", $ligne["content"]);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:12px' width=1% nowrap>{$ligne["zDate"]}</td>\n\t\t<td style='font-size:12px' width=1% nowrap>{$ligne["hostname"]}</td>\n\t\t<td style='font-size:12px' width=30% nowrap>{$ligne["subject"]}</td>\n\t\t<td style='font-size:12px' width=70% nowrap>{$ligne["content"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("zDate" => " {zDate} {$rows} {rows}", "hostname" => "{hostname}", "subject" => "{subject}", "content" => null), $tr);
}
function etchosts_search()
{
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    $table = "net_hosts";
    $database = "artica_backup";
    $t = time();
    if ($q->COUNT_ROWS($table, $database) == 0) {
        $sock->getFrameWork("system.php?etchosts-default=yes");
    }
    $ORDER = $boot->TableOrder(array("hostname" => "ASC"));
    $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-etchosts");
    $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));
        $delete = imgsimple("delete-48.png", "{delete}", "Delete{$t}('{$ligne["zmd5"]}','{$md}','{$ligne["hostname"]}@{$ligne["ipaddr"]}')");
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:20px' width=90% nowrap >{$ligne["hostname"]}</td>\n\t\t\t<td style='font-size:20px' width=5% nowrap >{$ligne["ipaddr"]}</td>\n\t\t\t<td style='font-size:20px' width=5% nowrap >{$ligne["alias"]}</td>\n\t\t\t<td style='font-size:20px' width=1% nowrap>{$delete}</td>\n\t\t</tr>\n\t\t";
    }
    $delete_text = $tpl->javascript_parse_text("{delete_nic_etchosts}");
    echo $boot->TableCompile(array("hostname" => "{hostname}", "ipaddr" => "{ipaddr}", "alias" => "{alias}", "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}(md5,mem,ipaddr){\n\tmem{$t}=mem;\n\tif(confirm('{$delete_text}: '+ipaddr+'?')){\n\t\tmem{$t}=mem;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('etchosts-delete',md5);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n\t}\n</script>\t\t\t\t\t\n";
}
function section_websites_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $table = "visited_sites_tot";
    $searchstring = string_to_flexquery("sites-search");
    $ORDER = $boot->TableOrder(array("size" => "ASC"));
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $js = "Loadjs('miniadm.webstats.familysite.all.php?familysite={$sitenameenc}')";
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:16px' width=10% nowrap {$link}>{$ligne["familysite"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("familysite" => "{familysite}", "hits" => "{hits}", "size" => "{size}"), $tr);
}
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" => "&nbsp;"), $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 search_websites()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $searchstring = string_to_flexquery("search-websites");
    $Params = url_decode_special_tool($_GET["Params"]);
    $table = "notcategorized";
    $boot = new boostrap_form();
    $ORDER = $boot->TableOrder(array("hits" => "DESC"));
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,30";
    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)) {
        $id = md5($ligne["sitename"]);
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $ligne["hits"] = FormatNumber($ligne["hits"]);
        $dates = unserialize($ligne["seen"]);
        $trg = array();
        if (is_array($dates)) {
            while (list($none, $xtime) = each($dates)) {
                $trg[] = time_to_date($xtime);
            }
        }
        $params = BuildDiv($ligne["sitename"]);
        $link = $boot->trswitch($params[2]);
        $content = $params[0];
        $js[] = $params[1];
        $tr[] = "\n\t<tr id='{$id}'>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["sitename"]}{$content}<br><i style='font-size:10px'>" . @implode(", ", $trg) . "</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["familysite"]}</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["country"]}</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["size"]}</td>\n\t<td {$link} nowrap><i class='icon-star'></i> {$ligne["hits"]}</td>\n\t</tr>";
    }
    echo $boot->TableCompile(array("sitename" => "{website}", "familysite" => "{familysite}", "country" => "{country}", "size" => "{size}", "hits" => "{hits}"), $tr) . "\n\t\t\t<script>" . @implode("\n", $js) . "</script>\t\n\t\t\t\t\t\n\t\t\t";
}
function rules_search()
{
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $table = "authenticator_rules";
    $t = time();
    $ORDER = $boot->TableOrder(array("ID" => "DESC"));
    if (!$q->TABLE_EXISTS($table)) {
        $f = new squid_reverse();
    }
    $searchstring = string_to_flexquery("rules-search");
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    $AdminPrivs = AdminPrivs();
    while ($ligne = mysql_fetch_assoc($results)) {
        $edit = $boot->trswitch("Loadjs('{$page}?rules-js={$ligne["ID"]}');");
        $md = md5(serialize($ligne));
        if ($AdminPrivs) {
            $delete = imgsimple("delete-48.png", "{delete}", "Delete{$t}('{$ligne["ID"]}','{$md}')");
        }
        $explaintext = EXPLAIN_RULE($ligne["ID"]);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:18px' width=1% nowrap {$edit}>{$ligne["rulename"]}</td>\n\t\t<td style='font-size:18px' width=90% nowrap>{$ligne["explain"]}<div style='font-size:12px'>{$explaintext}</div></td>\n\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("rulename" => " {rulename}", "explain:no" => "{explain}", "delete" => null), $tr) . "\n\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('rules-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\n</script>\n";
}
Ejemplo n.º 11
0
function container_search()
{
    $t = time();
    ini_set('display_errors', 1);
    ini_set('error_prepend_string', "<p class=text-error>");
    ini_set('error_append_string', "</p>\n");
    $q = new mysql();
    $users = new usersMenus();
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $ORDER = $boot->TableOrder(array("container_name" => "ASC"));
    $searchstring = string_to_flexquery("container-search");
    $table = "users_containers";
    $gpidenc = urlencode($_GET["gpid"]);
    $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}<hr>{$sql}</p>\n";
    }
    $available = $tpl->_ENGINE_parse_body("{available}");
    $used_text = $tpl->_ENGINE_parse_body("{used}");
    $error = $tpl->_ENGINE_parse_body("{error}");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT maxsize FROM storage_containers WHERE `groupid`='" . mysql_escape_string2($_GET["gpid"]) . "'", "artica_backup"));
    $maxsize = $ligne["maxsize"];
    if ($maxsize > 0) {
        $uidenc = mysql_escape_string2($_SESSION["uid"]);
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(container_size) as tSize FROM users_containers WHERE `uid`='{$uidenc}'", "artica_backup"));
        $tSize = $ligne["tSize"];
        $prc = $tSize / $maxsize * 100;
        $status = "\n\t\t<div style='width:100%;text-align:right;margin-top:25px'>{global_size}: " . pourcentage($prc) . "\n\t\t</div>";
    }
    $iscsi_chap_secret_explain = $tpl->_ENGINE_parse_body("{iscsi_chap_secret_explain}");
    $delete_container_ask = $tpl->javascript_parse_text("{delete_container_ask}");
    $tr = array();
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ID = $ligne["container_id"];
        $addtext = null;
        $md5 = md5(serialize($ligne));
        $container_name = $ligne["container_name"];
        $container_size = $ligne["container_size"];
        $container_size_UNIT = "MB";
        $per = null;
        $iscsi_error = null;
        $CMD_WEBDAV_ICON = null;
        $CMD_ISCSI_JS = null;
        $CMD_ISCSI_ICON = null;
        if ($container_size >= 1000) {
            $container_size = $container_size / 1000;
            $container_size_UNIT = "GB";
        }
        $delete = imgsimple("delete-32.png", null, "Delete{$t}('{$ID}','{$md5}')");
        $color = "black";
        $availble = null;
        $lock = "<img src='img/lock.gif' style='float:right'>";
        $status_img = "ok32-grey.png";
        if ($ligne["created"] == 0) {
            $color = "#C1C1C1";
            $addtext = $tpl->_ENGINE_parse_body("&nbsp;{building} {please_wait}...");
        }
        if ($ligne["onerror"] == 1) {
            $color = "#A10000";
            $addtext = "&nbsp;{$error}:" . $ligne["onerrortext"];
        }
        $statusA = unserialize(base64_decode($ligne["status"]));
        if (is_array($statusA)) {
            if ($statusA["MOUNTED"] != null) {
                $status_img = "ok32.png";
            }
            $availble = "&nbsp;{$available}:" . FormatBytes($statusA["STATUS"]["AIVA"]) . " {$used_text} {$statusA["STATUS"]["POURC"]}%";
            $per = pourcentage($statusA["STATUS"]["POURC"]);
        } else {
            $addtext = "&nbsp;No status...";
        }
        $webdav_creds = unserialize(base64_decode($ligne["webdav_creds"]));
        if ($webdav_creds["username"] == null) {
            $lock = null;
        }
        if ($ligne["iscsid"] == 1) {
            $length = strlen($webdav_creds["password"]);
            if ($length < 12) {
                $iscsi_error = "<div style='color:#C50808'>{$iscsi_chap_secret_explain}</div>";
            }
            if ($length > 16) {
                $iscsi_error = "<div style='color:#C50808'>{$iscsi_chap_secret_explain}</div>";
            }
            $CMD_ISCSI_JS = $boot->trswitch("Loadjs('{$page}?iscsi-cmd-js=yes&ID={$ID}')");
            $CMD_ISCSI_ICON = "<img src='img/32-infos.png'>";
            ////http://nas-appliance.org/index.php?cID=220
        }
        $trjs = $boot->trswitch("Loadjs('{$page}?wizard-js=yes&ID={$ID}&gpid={$gpidenc}')");
        if ($ligne["webdav"] == 1) {
            $CMD_WEBDAV_ICON = "<img src='img/cmd-32.png'>";
            $CMD_WEBDAV_JS = $boot->trswitch("Loadjs('{$page}?webdav-cmd-js=yes&ID={$ID}')");
        }
        $tr[] = "\n\t\t<tr id='{$md5}'>\n\t\t<td style='font-size:18px;color:{$color}' nowrap {$trjs}>{$lock}[disk{$ID}] {$container_name} ({$container_size}{$container_size_UNIT}) {$addtext}{$availble}{$iscsi_error}</td>\n\t\t<td style='font-size:18px;color:{$color};text-align:center' nowrap width=1% {$CMD_ISCSI_JS}>{$CMD_ISCSI_ICON}</td>\n\t\t<td style='font-size:18px;color:{$color};text-align:center' nowrap width=1% {$CMD_WEBDAV_JS}>{$CMD_WEBDAV_ICON}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% {$trjs}><img src='img/{$status_img}'></td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% {$trjs}>{$per}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap width=1% >{$delete}</td>\n\t\t</tr>";
    }
    echo $status . $boot->TableCompile(array("container_name" => "{name}", "5:no" => "iSCSI", "3:no" => "WebDav", "1:no" => "{status}", "delete" => "{delete}", "2:no" => ""), $tr) . "\n\t\t\t\t\n<script>\nvar id{$t}='';\nvar xDelete{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\t\$('#'+id{$t}).remove();\n}\n\t\nfunction Delete{$t}(ID,md){\n\tif(!confirm('{$delete_container_ask}')){return;}\n\tid{$t}=md;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('delete-container',ID);\n\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n}\n</script>";
}
function tasks_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql();
    $t = time();
    if (isset($_GET["t"])) {
        $t = $_GET["t"];
    }
    $page = CurrentPageName();
    $table = "system_schedules";
    $searchstring = string_to_flexquery("search-tasks");
    $ORDER = $boot->TableOrder(array("ID" => "DESC"));
    if ($q->COUNT_ROWS($table, "artica_backup") == 0) {
        senderrors("{no_task}");
    }
    if ($_GET["task-section"] > 0) {
        $table = "( SELECT * FROM {$table} WHERE `TaskType`={$_GET["task-section"]} ) as T";
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    $schedules = new system_tasks();
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $events = "&nbsp;";
        $md = md5(serialize($ligne));
        $TaskType = $ligne["TaskType"];
        $jstaskexplain = $tpl->javascript_parse_text($schedules->tasks_array[$ligne["TaskType"]]);
        $ligne["TaskType"] = $tpl->_ENGINE_parse_body($schedules->tasks_array[$ligne["TaskType"]]);
        $TimeDescription = $ligne["TimeDescription"];
        $delete = imgtootltip("delete-32.png", "{delete} {$ligne['ID']}", "Delete{$t}('{$ligne['ID']}','{$md}')");
        $run = $tpl->_ENGINE_parse_body(imgtootltip("24-run.png", "{run} {$ligne['ID']}", "SystemTaskRun('{$ligne['ID']}','{$jstaskexplain}')"));
        if ($ligne["enabled"] == 0) {
            $color = "#A0A0A0";
        }
        $tablename = "Taskev{$ligne['ID']}";
        if (!$q->TABLE_EXISTS($tablename, "artica_events")) {
            $events = null;
        } else {
            $evs = $q->COUNT_ROWS($tablename, "artica_events");
            if ($evs > 0) {
                $events = imgsimple("events-32.png");
            }
        }
        $explainTXT = $tpl->_ENGINE_parse_body($schedules->tasks_explain_array[$TaskType]);
        $TimeText = $tpl->_ENGINE_parse_body($schedules->PatternToHuman($ligne["TimeText"]));
        $TimeText = str_replace("<br>", "", $TimeText);
        if (preg_match("#(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)#", $TimeDescription, $re)) {
            $TimeDescription = $TimeText;
            $TimeText = null;
        }
        $js = "Loadjs('{$page}?schedule-js=yes&ID={$ligne['ID']}')";
        $link = $boot->trswitch($js);
        $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]);
        $ligne["TaskType"] = utf8_encode($ligne["TaskType"]);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne['ID']}</td>\n\t\t<td style='font-size:16px' width=25% nowrap {$link}>{$ligne["TaskType"]}</td>\n\t\t<td style='font-size:16px' width=70% {$link}>{$TimeDescription}<br>{$explainTXT}</td>\n\t\t<td style='font-size:16px' width=1% nowrap >{$run}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$events}</td>\n\t\t<td style='font-size:12px' width=1%>{$delete}</td>\n\t\t</tr>\n\t\t";
    }
    $run_this_task_now = $tpl->javascript_parse_text("{run_this_task_now}");
    $delete_text = $tpl->javascript_parse_text("{delete_this_task}");
    echo $boot->TableCompile(array("ID" => "ID", "TaskType" => "{type}", "TimeText" => "{explain}", "run:no" => "{run}", "event:no" => "{events}", "delete:no" => 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: '+ID+'?')){\n\t\tmem{$t}=mem;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('task-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\nvar xSystemTaskEnable{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\tExecuteByClassName('SearchFunction');\t\t\n}\n\nfunction SystemTaskRun{$t}(ID){\n\tif(confirm('{$run_this_task_now} :`'+ID+'`')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('task-run',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSystemTaskEnable{$t});\t\t\n\t}\n}\n\t\t\t\n</script>\n\t\t\t\n";
}
function events_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql();
    $page = CurrentPageName();
    $table = "mirror_logs";
    $searchstring = string_to_flexquery("search-events");
    $ORDER = $boot->TableOrder(array("zDate" => "DESC"));
    if ($q->COUNT_ROWS($table, "artica_events") == 0) {
        senderrors("no data");
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        if ($ligne["totalsize"] > 0) {
            $ligne["totalsize"] = FormatBytes($ligne["totalsize"] / 1024);
        }
        $distance = $tpl->_ENGINE_parse_body(distanceOfTimeInWords($ligne["starton"], $ligne["endon"]));
        $link = null;
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["zDate"]}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["pid"]}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$distance}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["filesnumber"]}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["totalsize"]}</td>\n\t\t<td style='font-size:12px' width=99% {$link}>{$ligne["error"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("zDate" => "{date}", "pid" => "pid", "endon" => "{duration}", "filesnumber" => "{files}", "size" => "{size}", "error" => "{error}"), $tr);
}
Ejemplo n.º 14
0
function events_search()
{
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $tpl = new templates();
    $searchstring = string_to_flexquery("events-search");
    $ORDER = $boot->TableOrder(array("zDate" => "DESC"));
    $limitSql = "LIMIT 0,250";
    $sql = "SELECT * FROM nginx_exploits_fwev WHERE servername='{$_GET["servername"]}' {$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)) {
        $tr[] = "\n\t\t\t\t\t<tr id='{$ligne["ID"]}'>\n\t\t\t\t\t<td width='25%' nowrap><i class='icon-time'></i> {$ligne["zDate"]}</a></td>\n\t\t\t\t\t<td width='25%' nowrap>{$ligne["ipaddr"]}</a></td>\n\t\t\t\t\t<td width='25%' nowrap>{$ligne["hostname"]}</td>\n\t\t\t\t\t<td width='25%' nowrap>{$ligne["country"]}</td>\n\t\t\t\t\t</tr>";
    }
    $html = $boot->TableCompile(array("zDate" => "{date}", "ipaddr" => "{ipaddr}", "hostname" => "{hostname}", "country" => "{country}"), $tr);
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 15
0
function computers_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $boot = new boostrap_form();
    $q = new mysql();
    $sock = new sockets();
    $fontsize = "14px";
    $page = 1;
    if (!$q->DATABASE_EXISTS("ocsweb")) {
        $sock->getFrameWork("services.php?mysql-ocs=yes");
    }
    if (!$q->TABLE_EXISTS("hardware", "ocsweb")) {
        $sock->getFrameWork("services.php?mysql-ocs=yes");
    }
    if (!$q->TABLE_EXISTS("networks", "ocsweb", true)) {
        $sock->getFrameWork("services.php?mysql-ocs=yes");
    }
    $EnableScanComputersNet = $sock->GET_INFO("EnableScanComputersNet");
    if (!is_numeric($EnableScanComputersNet)) {
        $EnableScanComputersNet = 0;
    }
    if (!$q->FIELD_EXISTS("networks", "isActive", "ocsweb")) {
        $q->QUERY_SQL("ALTER TABLE `networks` ADD `isActive` SMALLINT( 1 ) NOT NULL DEFAULT '0',ADD INDEX ( `isActive` ) ", "ocsweb");
    }
    $ORDER = $boot->TableOrder(array("NAME" => "ASC"));
    $searchstring = string_to_flexquery("computer-search");
    $table = "(SELECT networks.MACADDR,networks.IPADDRESS,\n\t\t\thardware.OSNAME,\n\t\t\thardware.LASTDATE,\n\t\t\thardware.NAME,\n\t\t\thardware.IPADDR,\n\t\t\thardware.IPSRC\n\t\t\tFROM networks,hardware WHERE networks.HARDWARE_ID=hardware.ID) as t";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "ocsweb");
    if (!$q->ok) {
        echo $q->mysql_error . "<br>{$sql}\n";
    }
    $computer = new computers();
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["MACADDR"] == "unknown") {
            continue;
        }
        $uid = null;
        $OSNAME = null;
        if ($ligne["OSNAME"] == "Unknown") {
            $ligne["OSNAME"] = null;
        }
        $color = "#7D7D7D";
        $md = md5($ligne["MACADDR"]);
        $uri = strtolower($ligne["NAME"]);
        $uid = $computer->ComputerIDFromMAC($ligne["MACADDR"]);
        $view = "&nbsp;";
        $jsfiche = MEMBER_JS($uid, 1, 1);
        $js = null;
        if ($uid != null) {
            $js = $boot->trswitch($jsfiche);
        }
        if ($ligne["OSNAME"] != null) {
            $OSNAME = "<div style='font-size:9px'><i>{$ligne["OSNAME"]}</i></div>";
        }
        $isActive = "img/unknown24.png";
        if ($EnableScanComputersNet == 1) {
            if ($ligne["isActive"] == 1) {
                $isActive = "img/ok24.png";
            } else {
                $isActive = "img/danger24.png";
            }
        }
        if (!IsPhysicalAddress($ligne["MACADDR"])) {
            if ($_GET["CorrectMac"] == 1) {
                continue;
            }
        }
        $AlreadyMAC[$ligne["MACADDR"]] = true;
        $zdate = null;
        if (isset($ligne["zDate"])) {
            $zdate = "<div style='font-size:11px;color:#7D7D7D'>{$ligne["zDate"]}</div>";
        }
        $tr[] = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px' nowrap  width=1% {$js}>{$ligne["LASTDATE"]}</td>\n\t\t\t<td style='font-size:18px' nowrap {$js}>{$ligne["NAME"]}</td>\n\t\t\t<td style='font-size:18px' nowrap width=1% {$js}>{$ligne["IPADDRESS"]}</td>\n\t\t\t<td style='font-size:18px' nowrap width=1% {$js}>{$ligne["MACADDR"]}</td>\n\t\t\t<td style='font-size:18px' nowrap width=1% {$js}><img src='{$isActive}'></td>\t\t\t\n\t\t\t\t\n\t\t</tr>";
    }
    echo $boot->TableCompile(array("LASTDATE" => "{date}", "NAME" => "{hostname}", "IPADDRESS" => "{ipaddr}", "MACADDR" => "{MAC}"), $tr);
}
function search_members()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $searchstring = string_to_flexquery("search-members");
    $Params = url_decode_special_tool($_GET["Params"]);
    if (!$_SESSION["CORP"]) {
        $tpl = new templates();
        $onlycorpavailable = $tpl->_ENGINE_parse_body("{onlycorpavailable}");
        $content = "<p class=text-error>{$onlycorpavailable}</p>";
        echo $content;
        return;
    }
    $boot = new boostrap_form();
    $ORDER = $boot->TableOrder(array("uid" => "ASC"));
    $table = "(SELECT SUM(size) as size,SUM(hits) as hits,uid FROM members_uid \n\t\t\tGROUP BY uid HAVING uid NOT LIKE '%\$' AND LENGTH(uid) >0 ) as t";
    $sql = "SELECT *  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)) {
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $ligne["hits"] = FormatNumber($ligne["hits"]);
        $link = $boot->trswitch("document.location.href='miniadm.webstats.ByMember.php?by=uid&member-value=" . urlencode($ligne["uid"]) . "';");
        $tr[] = "\n\t<tr id='{$id}'>\n\t<td {$link}><i class='icon-user'></i> {$ligne["uid"]}</a></td>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["size"]}</td>\n\t<td {$link}><i class='icon-star'></i> {$ligne["hits"]}</td>\n\t</tr>";
    }
    echo $boot->TableCompile(array("uid" => "{member}", "size" => "{size}", "hits" => "{hits}"), $tr);
}
function category_search()
{
    $t = time();
    ini_set('display_errors', 1);
    ini_set('error_prepend_string', "<p class=text-error>");
    ini_set('error_append_string', "</p>\n");
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $ORDER = $boot->TableOrder(array("pattern" => "ASC"));
    $searchstring = string_to_flexquery("category-search");
    $table = $q->cat_totablename($_GET["category"]);
    $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}<hr>{$sql}</p>\n";
    }
    $tr = array();
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $date = $boot->time_to_date(strtotime($ligne['zDate']), true);
        $md5 = md5(serialize($ligne));
        $pattern = $ligne["pattern"];
        $delete = imgsimple("delete-32.png", null, "Delete{$t}('{$pattern}','{$md5}')");
        $tr[] = "\n\t\t<tr id='{$md5}'>\n\t\t<td style='font-size:18px' nowrap  width=1% nowrap>{$date}</td>\n\t\t<td style='font-size:18px' nowrap >{$pattern}</td>\n\t\t<td style='font-size:18px' nowrap width=1% >{$delete}</td>\n\t\t</tr>";
    }
    echo $boot->TableCompile(array("zDate" => "{date}", "pattern" => "{sitename}", "delete" => "{delete}"), $tr) . "\n\t\t\t\t\t\n<script>\nvar id{$t}='';\n\tvar xDelete{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){alert(res);return;}\n\t\t\$('#'+id{$t}).remove();\n\t\t\n\t}\n\nfunction Delete{$t}(www,md){\n\tid{$t}=md;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('www-delete',www);\n\tXHR.appendData('category','{$_GET["category"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\t\t\n}\n</script>";
}
function section_categories_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";
    $familysite = $_GET["familysite"];
    $search = '%';
    $table = date("Ymd", $_GET["xtime"]) . "_hour";
    $rp = 250;
    $page = 1;
    $boot = new boostrap_form();
    $FAMS = $boot->SQUID_CATEGORIES_FAM;
    $searchstring = string_to_flexquery("categories-search");
    $ORDER = $boot->TableOrder(array("size" => "DESC"));
    if (!$q->TABLE_EXISTS($table)) {
        senderrors("no such table");
    }
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    //zDate      | client        | uid               | hostname                | MAC               | familysite                                 | catfam | hits | size
    $table = "( SELECT sitename,familysite,category,catfam,SUM(size) as size,SUM(hits) as hits FROM `{$table}` GROUP BY\n\tsitename HAVING familysite='{$familysite}' AND catfam={$_GET["fam"]}) as t";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $fam = $tpl->_ENGINE_parse_body("{$FAMS[$ligne["catfam"]]["TITLE"]}");
        $link = null;
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:14px' width=50% nowrap {$link}>{$ligne["sitename"]}</td>\n\t\t<td style='font-size:14px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t<td style='font-size:14px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t<td style='font-size:14px' width=1% nowrap {$link}>{$ligne["category"]}</td>\n\t\t<td style='font-size:14px' width=50% {$link}>{$fam}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("zDate" => "{this_month}", "hits" => "{hits}", "size" => "{size}", "category" => "{category}", "catfam" => "{behavior}"), $tr);
}
function www_beahvior_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $boot = new boostrap_form();
    $familysite = $_GET["familysite"];
    $FAMS = $boot->SQUID_CATEGORIES_FAM;
    $current_month = date("Ym");
    $table = "{$current_month}_catfam";
    $q = new mysql_squid_builder();
    $searchstring = string_to_flexquery("www-behavior-search");
    $ORDER = $boot->TableOrder(array("zDate" => "DESC"));
    if (!$q->TABLE_EXISTS($table)) {
        senderrors("no such table");
    }
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    //zDate      | client        | uid               | hostname                | MAC               | familysite                                 | catfam | hits | size
    $table = "( SELECT familysite,zDate,catfam,SUM(size) as size,SUM(hits) as hits FROM `{$table}` GROUP BY \n\tzDate,familysite HAVING familysite='{$familysite}') as t";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $xtime = strtotime("{$ligne["zDate"]} 00:00:00");
        $js = "Loadjs('miniadm.webstats.fam.ByDay.php?familysite={$sitenameenc}&xtime={$xtime}&fam={$ligne["catfam"]}')";
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["zDate"]}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t<td style='font-size:16px' width=99% {$link}>" . $tpl->_ENGINE_parse_body($FAMS[$ligne["catfam"]]["TITLE"]) . "</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("zDate" => "{this_month}", "hits" => "{hits}", "size" => "{size}", "catfam" => "{behavior}"), $tr);
}
Ejemplo n.º 20
0
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 sources_search()
{
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $table = "authenticator_authlnk";
    $ORDER = $boot->TableOrder(array("zorder" => "ASC"));
    $searchstring = string_to_flexquery("sources-search");
    if (!$q->TABLE_EXISTS("authenticator_authlnk")) {
        $f = new squid_reverse();
    }
    $table = "(\n\tSELECT\n\tauthenticator_authlnk.ID,\n\tauthenticator_authlnk.zorder,\n\tauthenticator_auth.groupname,\n\tauthenticator_auth.group_type,\n\tauthenticator_authlnk.groupid\n\tFROM authenticator_authlnk,authenticator_auth\n\tWHERE authenticator_authlnk.ruleid='{$_GET["mainrule"]}'\n\t\t\tAND authenticator_authlnk.groupid=authenticator_auth.ID\n\t\t\t) as t";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    $AdminPrivs = AdminPrivs();
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $edit = $boot->trswitch("Loadjs('{$page}?sources-group-js=yes&groupid={$ligne["groupid"]}');");
        $md = md5(serialize($ligne));
        if ($AdminPrivs) {
            $delete = imgsimple("delete-48.png", "{delete}", "Delete{$t}('{$ligne["ID"]}','{$md}')");
        }
        $tr[] = "\n\t\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:18px' width=99% nowrap {$edit}>{$ligne["groupname"]} - " . $tpl->_ENGINE_parse_body($GLOBALS["TYPES"][$ligne["group_type"]]) . "</td>\n\t\t\t<td style='font-size:18px' width=1% nowrap>{$delete}</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t";
    }
    $delete_text = $tpl->javascript_parse_text("{unlink}");
    echo $boot->TableCompile(array("rulename" => " {groupname}", "delete" => null), $tr) . "\n\n<script>\nvar mem{$t}='';\n\tvar xDelete{$t}=function(obj){\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\t\$('#'+mem{$t}).remove();\n\t}\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('source-unlink',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\n</script>\n\t";
}
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 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"]);
    $uid = mysql_escape_string2($_GET["uid"]);
    $sql = "SELECT SUM(size) as size, sum(hits) as hits,sitename,familysite,uid FROM {$table}\n\tGROUP BY sitename,familysite,uid HAVING `familysite`='{$familysite}' AND uid='{$uid}' {$search} {$ORDER} LIMIT 0,500";
    $results = $q->QUERY_SQL($sql, $database);
    $ORDER = $boot->TableOrder(array("size" => "DESC"));
    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);
        $id = md5(serialize($ligne));
        $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 ><i class='icon-globe'></i>&nbsp;{$ligne["sitename"]}</a></td>\n\t\t\t\t\t<td ><i class='icon-info-sign'></i>&nbsp;{$ligne["size"]}</td>\n\t\t\t\t\t<td ><i class='icon-info-sign'></i>&nbsp;{$ligne["hits"]}</td>\n\t\t\t\t</tr>";
    }
    echo $boot->TableCompile(array("sitename" => "{website}", "size" => "{size}", "hits" => "{hits}"), $tr);
}
Ejemplo n.º 24
0
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 section_flow_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("day" => "DESC"));
    $searchstring = string_to_flexquery("topwebsites-search");
    $year = $_GET["year"];
    $month = $_GET["month"];
    $uid = mysql_escape_string2($_GET["uid"]);
    $familysite = mysql_escape_string2($_GET["familysite"]);
    $familysiteEnc = urlencode($_GET["familysite"]);
    $uidenc = urlencode($_GET["uid"]);
    $table = "quotamonth_{$year}{$month}";
    $table = "(SELECT `uid`,`day`,familysite,SUM(size) as `size` FROM {$table} GROUP BY `uid`,familysite,`day`\n\tHAVING uid='{$uid}' \n\tAND familysite='{$familysite}'\n\tORDER BY `day` LIMIT 0,30) as t";
    $size_text = $tpl->_ENGINE_parse_body("{size}");
    $websites_text = $tpl->_ENGINE_parse_body("{day}");
    $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";
        $day = $ligne["day"];
        if (strlen($day) == 1) {
            $day = "0{$day}";
        }
        $size = FormatBytes($ligne["size"] / 1024);
        $time = strtotime("{$year}-{$month}-{$day} 00:00:00");
        $dayname = $tpl->_ENGINE_parse_body(date("{l} {$day}", $time));
        $js = $boot->trswitch("Loadjs('miniadm.webstats.websites.ByDayByFamilySiteByMember.php?familysite={$familysiteEnc}&xtime={$time}&uid={$uidenc}')");
        $tr[] = "\n\t\t<tr>\n\t\t<td style='font-size:18px;color:{$color}' nowrap  width=99% nowrap {$js}>{$dayname}</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("day" => "{days}", "size" => "{$size_text}"), $tr);
}
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>&nbsp;";
        }
        $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 section_dump_table_search()
{
    $t = $_GET["t"];
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    $boot = new boostrap_form();
    $table = date("Ymd", $_GET["xtime"]) . "_hour";
    $searchstring = string_to_flexquery("dump-table-search");
    $ORDER = $boot->TableOrder(array("size" => "DESC"));
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER}  LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    $TABLE_GET_COLUMNS = $q->TABLE_GET_COLUMNS($table);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $js = "Loadjs('miniadm.webstats.familysite.all.php?familysite={$sitenameenc}')";
        $link = $boot->trswitch($js);
        $tr[] = "<tr id='{$md}'>";
        reset($TABLE_GET_COLUMNS);
        while (list($index, $field) = each($TABLE_GET_COLUMNS)) {
            $tr[] = "<td style='font-size:11px' width=1% nowrap>{$ligne[$field]}</td>";
        }
        $tr[] = "</tr>";
    }
    reset($TABLE_GET_COLUMNS);
    while (list($index, $field) = each($TABLE_GET_COLUMNS)) {
        $array[$field] = $field;
    }
    echo $boot->TableCompile($array, $tr);
}