function arp_query() { $tpl = new templates(); $MyPage = CurrentPageName(); $sock = new sockets(); $ArpSpoofEnabled = $sock->GET_INFO("ArpSpoofEnabled"); if (!is_numeric($ArpSpoofEnabled)) { $ArpSpoofEnabled = 0; } $q = new mysql(); $q->BuildTables(); $t = $_GET["t"]; $search = '%'; $table = "arpspoof_rules"; $page = 1; $ORDER = "ORDER BY ipaddr ASC"; if (!$q->TABLE_EXISTS($table, "artica_backup")) { json_error_show("`{$table}` No such table...", 1); } if ($q->COUNT_ROWS($table, "artica_backup") == 0) { json_error_show("No rule set", 1); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "WHERE (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(ID) as TCOUNT FROM `{$table}` {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table, "artica_backup"); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { json_error_show("{$q->mysql_error}", 1); } $divstop = "</div>"; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $srvstatus = "okdanger32.png"; $status = @implode("\n", unserialize(base64_decode($sock->getFrameWork("services.php?arp-poisonning-status=yes&ID={$ligne["ID"]}")))); $ini = new Bs_IniHandler(); $ini->loadString($status); $textservice = null; if (DAEMON_STATUS_IS_OK("APP_ARPSOOF", $ini)) { $srvstatus = "ok32.png"; $master_pid = $ini->_params["APP_ARPSOOF"]["master_pid"]; $memory = FormatBytes($ini->_params["APP_ARPSOOF"]["master_memory"]); $version = $ini->_params["APP_ARPSOOF"]["master_version"]; $since = "{since}: {$ini->_params["APP_ARPSOOF"]["uptime"]}"; $textservice = $tpl->_ENGINE_parse_body("<div style='font-size:11px'><i>{running} {$since} pid:{$master_pid} version:{$version}</i></div>"); } if ($ArpSpoofEnabled == 0) { $color = "#949494"; $srvstatus = "okdanger32.png"; } if ($ligne["enabled"] == 0) { $color = "#949494"; $srvstatus = "ok32-grey.png"; } $divstart = "<span style='font-size:14px;font-weight:bold;color:{$color}'>"; $ligne["rulename"] = utf8_encode($ligne["rulename"]); $delete = imgsimple("delete-24.png", "{delete}", "SpoofRuleDelete{$t}({$ligne["ID"]})"); $edit = "<a href=\"javascript:blur();\" OnClick=\"javascript:EditArpSpoofRule('{$ligne['ID']}');\"\n\t\t\tstyle='font-size:14px;font-weight:bold;text-decoration:underline;color:{$color}'>"; $ipaddr = array(); $results2 = $q->QUERY_SQL("SELECT ipaddr FROM arpspoof_objects WHERE ruleid={$ligne["ID"]}", "artica_backup"); if (!$q->ok) { $ipaddr[] = $q->mysql_error; } while ($ligne2 = mysql_fetch_assoc($results2)) { $ipaddr[] = $ligne2["ipaddr"]; } if (count($ipaddr) > 0) { $ipaddrT = "<div style='font-size:11px;color:{$color}'><i>" . @implode(", ", $ipaddr) . "</i></div>"; } $data['rows'][] = array('id' => "-rule-" . $ligne['ID'], 'cell' => array("<img src='img/{$srvstatus}'>", "{$edit}{$ligne["rulename"]}</a>{$ipaddrT}{$textservice}", $divstart . $ligne["gateway"] . $divstop, $divstart . $ligne['iface'] . $divstop, $delete)); } echo json_encode($data); }
function bar_status() { $page = CurrentPageName(); $tpl = new templates(); if (is_file("ressources/logs/global.status.ini")) { $ini = new Bs_IniHandler("ressources/logs/global.status.ini"); } else { writelogs("ressources/logs/global.status.ini no such file"); $sock = new sockets(); $datas = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes')); $ini = new Bs_IniHandler($datas); } $c = 0; $array = $array = array_postfix_status(); while (list($num, $DAEMON_NAME) = each($array)) { if (!DAEMON_STATUS_IS_OK($DAEMON_NAME, $ini)) { $c++; } } if ($c > 0) { $status = ParagrapheTEXT("warn-red-48.png", "{$c} {SERVICESS_STOPPED}", "{$c} {SERVICESS_STOPPED_TEXT}", "javascript:Loadjs('postfix.status.allservices.php')", 90); } else { $status = ParagrapheTEXT("ok42.png", "{SERVICESS_OK}", "{SERVICESS_OK_TEXT}", "javascript:Loadjs('postfix.status.allservices.php')", 90); } $main = new maincf_multi("master", "master"); $freeze_delivery_queue = $main->GET('freeze_delivery_queue'); if ($freeze_delivery_queue == 1) { $warn1 = ParagrapheTEXT("warn-red-48.png", "{WARN_QUEUE_FREEZE}", "{WARN_QUEUE_FREEZE}"); } $main = new main_cf(); $count = 0; while (list($num, $ligne) = each($main->array_mynetworks)) { if ($ligne == "127.0.0.0/8") { continue; } if ($ligne == "127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128") { continue; } $count++; } if ($count == 0) { $nonet = ParagrapheTEXT('warn-red-48.png', "{NO_POSTFIX_NETWORK_SET}", '{NO_POSTFIX_NETWORK_SET_EXPLAIN}', "javascript:Loadjs('postfix.network.php?ajax=yes')", 90); } return $tpl->_ENGINE_parse_body($status . $nonet . $refresh . $warn1); }
function load_balance_form_status_service() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $status = base64_decode($sock->getFrameWork("xr.php?status-instance=yes&ID={$_GET["ID"]}")); $ini = new Bs_IniHandler(); $ini->loadString($status); if (DAEMON_STATUS_IS_OK("APP_CROSSROADS", $ini)) { $tr[] = imgtootltip("32-run-grey.png", "{start}", ""); $tr[] = imgtootltip("32-stop.png", "{stop}", "Loadjs('{$page}?stop-instance-js=yes&ID={$_GET["ID"]}')"); } else { $tr[] = imgtootltip("32-run.png", "{start}", "Loadjs('{$page}?start-instance-js=yes&ID={$_GET["ID"]}')"); $tr[] = imgtootltip("32-stop-grey.png", "{stop}", ""); } $tr[] = imgtootltip("restart-32.png", "{restart}", "Loadjs('{$page}?restart-instance-js=yes&ID={$_GET["ID"]}')"); $table = CompileTr3($tr); echo $tpl->_ENGINE_parse_body(DAEMON_STATUS_ROUND("APP_CROSSROADS", $ini) . "\n\t<center><div style='text-align:center;width:150px'><center>{$table}</center></div></center>\n\t<script>\n\t\tLoadAjax('status2','{$page}?load-balance-form-status-service-stats=yes&ID={$_GET["ID"]}');\n\t</script>"); }