function WEBSITES_SEARCH() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_blackbox(); $database = "artica_backup"; $search = '%'; $table = "cacheitems_{$_GET["hostid"]}"; $page = 1; $FORCE_FILTER = null; if ($q->COUNT_ROWS($table, $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(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show(0, $q->mysql_error); } /*`sitename` varchar(255) NOT NULL, `familysite` varchar(255) NOT NULL, `size` BIGINT UNSIGNED,`items` BIGINT UNSIGNED, PRIMARY KEY (`sitename`), KEY `familysite` (`familysite`), KEY `size` (`size`), KEY `items` (`items`) */ if (mysql_num_rows($results) == 0) { json_error_show(0, "no data"); } while ($ligne = mysql_fetch_assoc($results)) { $ID = md5($ligne["sitename"]); $siteenc = $ligne["sitename"]; $delete = imgtootltip("delete-24.png", "{delete}", "Loadjs('{$MyPage}?DeleteWebsiteZCached-js=yes&t={$_GET["t"]}&sitename={$siteenc}&ID={$ID}&hostid={$_GET["hostid"]}')"); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $data['rows'][] = array('id' => $ID, 'cell' => array("\n\t\t<span style='font-size:14px'>{$link}{$ligne["sitename"]}</a></span>", "<span style='font-size:14px'>{$ligne["size"]}</a></span>", "<span style='font-size:14px'>{$ligne["items"]}</a></span>", $delete)); } echo json_encode($data); }
function status_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_blackbox(); $search = '%'; $table = "nodesstatus"; $page = 1; $ORDER = "ORDER BY category ASC"; $FORCE_FILTER = "nodeid={$_GET["nodeid"]}"; if ($q->COUNT_ROWS($table) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } 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 = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; if ($OnlyEnabled) { $limitSql = null; } $sql = "SELECT * FROM `{$table}` WHERE {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $service = $tpl->_ENGINE_parse_body("{{$ligne["service_name"]}}"); $master_memory = FormatBytes($ligne["master_memory"]); $master_cached_memory = FormatBytes($ligne["master_cached_memory"]); $master_version = $ligne["master_version"]; $master_pid = $ligne["master_pid"]; $img = "img/ok24-grey.png"; if ($master_pid > 0) { $img = "img/ok24.png"; } else { $img = "img/danger24.png"; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:14px;color:{$color}'>{$service}</span>", "<span style='font-size:14px;color:{$color}'>{$master_memory}</span>", "<span style='font-size:14px;color:{$color}'>{$master_cached_memory}</a></span>", "<span style='font-size:14px;color:{$color}'>{$master_version}</span>", "<img src='{$img}'>", "<span style='font-size:14px;color:{$color}'>{$master_pid}</span>", $delete)); } echo json_encode($data); }
function main_tabs() { $tpl = new templates(); $page = CurrentPageName(); $squid = new squidbee(); $sock = new sockets(); $DisableAnyCache = $sock->GET_INFO("DisableAnyCache"); if (!is_numeric($DisableAnyCache)) { $DisableAnyCache = 0; } $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel"); if (!is_numeric($SquidCacheLevel)) { $SquidCacheLevel = 4; } if ($SquidCacheLevel == 0) { $DisableAnyCache = 1; } $UseSimplifiedCachePattern = $sock->GET_INFO("UseSimplifiedCachePattern"); if (!is_numeric($UseSimplifiedCachePattern)) { $UseSimplifiedCachePattern = 1; } $realsquidversion = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidVersion"); $ID = $_GET["ID"]; $t = $_GET["t"]; $array["caches-level"] = '{cache_level}'; $array["caches-status"] = '{caches_status}'; if ($DisableAnyCache == 0) { if (preg_match("#^3\\.(4|5|6|7|8)\\.#", $realsquidversion)) { $array["rock"] = '{rock_store}'; } } $array["caches-center"] = '{caches_center}'; $array["artica-cache"] = "{enforce_rules}"; if ($UseSimplifiedCachePattern == 0) { if ($SquidCacheLevel > 2) { //$array["dyn-section"]="{dynamic_enforce_rules}"; } } if ($SquidCacheLevel > 1) { //$array["main-section"]="{cache_rules}"; } $array["parameters"] = "{global_parameters}"; if ($DisableAnyCache == 0) { $q = new mysql_blackbox(); if ($q->TABLE_EXISTS("cacheitems_localhost")) { $ct = $q->COUNT_ROWS("cacheitems_localhost"); if ($ct > 0) { $array["cached_items"] = "{$ct} {cached_items}"; } } } if (count($array) >= 4) { $fontsize = 18; } if (count($array) >= 8) { $fontsize = 14; } while (list($num, $ligne) = each($array)) { if ($num == "artica-cache") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.artica-rules.php\">\n\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "rock") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.rock.php\">\n\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches-level") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.level.php\">\n\t\t\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches-status") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.status.php\">\n\t\t\t\t\t <span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches") { $html[] = $tpl->_ENGINE_parse_body("<li>\n\t\t\t\t\t<a href=\"squid.caches32.php?uuid={$squid->uuid}\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches-params") { $html[] = $tpl->_ENGINE_parse_body("<li>\n\t\t\t\t\t<a href=\"squid.caches.php?parameters=yes\">\n\t\t\t\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches-center") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.center.php\" ><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "cached_items") { $html[] = $tpl->_ENGINE_parse_body("<li ><a href=\"squid.cached.itemps.php?hostid=localhost\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "dyn-section") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.cache.dynamic.rules.php\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } $html[] = $tpl->_ENGINE_parse_body("<li>\n\t\t\t\t\t<a href=\"{$page}?{$num}=yes&t={$t}&ID={$ID}&tt={$_GET["tt"]}&SourceT={$_GET["SourceT"]}\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); } echo build_artica_tabs($html, "main_cache_rules_main_tabs") . "<script>LeftDesign('caches-center-white-256-opac20.png');</script>"; }
function rows_table() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_blackbox(); $nodeid = $_GET["nodeid"]; $search = '%'; $table = "cachelogs{$nodeid}"; $page = 1; $ORDER = "ORDER BY zDate DESC"; if (!$q->TABLE_EXISTS($table)) { writelogs("`{$table}` no such table", __FUNCTION__, __FILE__, __LINE__); } writelogs("`{$table}` " . $q->COUNT_ROWS($table) . " items", __FUNCTION__, __FILE__, __LINE__); $total = 0; if ($q->COUNT_ROWS($table) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { writelogs("`{$table}` {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", "")); $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); echo json_encode($data); return; } //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));} writelogs("`{$sql}` " . mysql_num_rows($results), __FUNCTION__, __FILE__, __LINE__); while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; if (preg_match("#(crashing|failed|No such|FATAL|abnormally|WARNING|refused)#", $ligne["line"])) { $color = "red"; } $data['rows'][] = array('id' => $ligne['mac'], 'cell' => array("<span style='font-size:14px;color:{$color}'>{$ligne["zDate"]}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["line"]}</span>")); } echo json_encode($data); }
function section_status() { $page = CurrentPageName(); $sock = new sockets(); $users = new usersMenus(); $q = new mysql_blackbox(); $tpl = new templates(); $language = $tpl->language; $array["status"] = "{services_status}"; $array["events-squidaccess"] = '{realtime_requests}'; if ($q->TABLE_EXISTS("cacheitems_localhost")) { $ct = $q->COUNT_ROWS("cacheitems_localhost"); if ($ct > 0) { $array["cached_items"] = "{$ct} {cached_items}"; } } $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $array["remote-web-appliances"] = "{appliances}"; $fontsize = 14; if ($language == "fr") { $fontsize = "12.5"; } while (list($num, $ligne) = each($array)) { if ($num == "software-update") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.softwares.php\">\n\t\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "events-squidaccess") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.accesslogs.php?table-size=898&url-row=433\">\n\t\t\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "remote-web-appliances") { $html[] = $tpl->_ENGINE_parse_body("<li ><a href=\"squid.statsappliance.clients.php\">\n\t\t\t\t\t<span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n", null, "310", null, 1); continue; } if ($num == "cached_items") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.cached.itemps.php?hostid=localhost\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "graphs") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.graphs.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "events-squidcache") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.cachelogs.php\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); continue; } $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n"); //$html=$html . "<li><a href=\"javascript:LoadAjax('squid_main_config','$page?main=$num&hostname={$_GET["hostname"]}')\" $class>$ligne</a></li>\n"; } echo build_artica_tabs($html, "squid_main_svc", 950) . "\n\t\t<script>QuickLinkShow('quicklinks-services_status');</script>"; }
function rows_table() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_blackbox(); $nodeid = $_GET["nodeid"]; $search = '%'; $table = "nics"; $page = 1; $ORDER = "ORDER BY nics ASC"; $total = 0; if ($q->COUNT_ROWS($table) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND ((`{$_POST["qtype"]}` LIKE '{$search}' AND nodeid={$nodeid}) OR (`mac` LIKE '{$search}' AND nodeid={$nodeid}))"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE nodeid={$nodeid}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE nodeid={$nodeid} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", "")); $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); echo json_encode($data); return; } //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));} while ($ligne = mysql_fetch_assoc($results)) { $data['rows'][] = array('id' => $ligne['mac'], 'cell' => array("<img src='img/folder-network-24.png'>", "<span style='font-size:16px'>{$ligne["ipaddr"]}</span>", "<span style='font-size:16px'>{$ligne["netmask"]}</span>", "<span style='font-size:16px'>{$ligne["gateway"]}</span>", "<span style='font-size:16px'>{$ligne["mac"]}</span>")); } echo json_encode($data); }
function rows_table() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_blackbox(); $nodeid = $_GET["nodeid"]; $search = '%'; $table = "softwares"; $page = 1; $ORDER = "ORDER BY software ASC"; $total = 0; if ($q->COUNT_ROWS($table) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND ((`{$_POST["qtype"]}` LIKE '{$search}' AND nodeid={$nodeid}) OR (`software` LIKE '{$search}' AND nodeid={$nodeid}))"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE nodeid={$nodeid}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE nodeid={$nodeid} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", "")); $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); echo json_encode($data); return; } //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));} while ($ligne = mysql_fetch_assoc($results)) { $software_name = $tpl->_ENGINE_parse_body("{{$ligne['software']}}"); if (strpos($software_name, "}") > 0) { $software_name = $ligne['software']; } if (preg_match("#.+?\\((.+?)\\)\$#", trim($software_name), $re)) { $software_name = str_replace($re[1], "<span style='font-size:11px'>{$re[1]}</span>", $software_name); } $ligne['software'] = $software_name; $data['rows'][] = array('id' => $ligne['software'], 'cell' => array("<span style='font-size:16px'>{$ligne["software"]}</span>", "<span style='font-size:16px'>{$ligne["version"]}</span>")); } echo json_encode($data); }
function main_tabs(){ $tpl=new templates(); $page=CurrentPageName(); $squid=new squidbee(); $sock=new sockets(); $DisableAnyCache=$sock->GET_INFO("DisableAnyCache"); if(!is_numeric($DisableAnyCache)){$DisableAnyCache=0;} $CacheManagement2=$sock->GET_INFO("CacheManagement2"); if(!is_numeric($CacheManagement2)){$CacheManagement2=0;} $SquidCacheLevel=$sock->GET_INFO("SquidCacheLevel"); if(!is_numeric($SquidCacheLevel)){$SquidCacheLevel=4;} if($SquidCacheLevel==0){$DisableAnyCache=1;} $UseSimplifiedCachePattern=$sock->GET_INFO("UseSimplifiedCachePattern"); if(!is_numeric($UseSimplifiedCachePattern)){$UseSimplifiedCachePattern=1;} $ID=$_GET["ID"]; $t=$_GET["t"]; $array["caches-level"]='{cache_level}'; $array["caches-status"]='{caches_status}'; if($CacheManagement2==1){ $array["caches-center"]='{caches_center}'; } $array["artica-cache"]="{enforce_rules}"; if($UseSimplifiedCachePattern==0){ if($SquidCacheLevel>2){ $array["dyn-section"]="{dynamic_enforce_rules}"; } } if($SquidCacheLevel>1){ $array["main-section"]="{cache_rules}"; } $array["parameters"]='{global_parameters}'; if($CacheManagement2==0){ $array["caches"]='{caches}'; $array["caches-params"]='{caches_parameters}'; } if($DisableAnyCache==0){ $q=new mysql_blackbox(); if($q->TABLE_EXISTS("cacheitems_localhost")){ $ct=$q->COUNT_ROWS("cacheitems_localhost"); if($ct>0){ if($CacheManagement2==1){$array["cached_items"]="$ct {cached_items}";} } } } if(count($array)>=4){ $fontsize=18; } if(count($array)>=7){ $fontsize=14; } while (list ($num, $ligne) = each ($array) ){ if($num=="artica-cache"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.artica-rules.php\"> <span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="caches-level"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.level.php\"> <span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="caches-status"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.status.php\"> <span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="caches"){ $html[]= $tpl->_ENGINE_parse_body("<li> <a href=\"squid.caches32.php?uuid=$squid->uuid\"><span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="caches-params"){ $html[]= $tpl->_ENGINE_parse_body("<li> <a href=\"squid.caches.php?parameters=yes\"> <span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="caches-center"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.caches.center.php\" ><span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="cached_items"){ $html[]= $tpl->_ENGINE_parse_body("<li ><a href=\"squid.cached.itemps.php?hostid=localhost\"><span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } if($num=="dyn-section"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.cache.dynamic.rules.php\"><span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); continue; } $html[]= $tpl->_ENGINE_parse_body("<li> <a href=\"$page?$num=yes&t=$t&ID=$ID&tt={$_GET["tt"]}&SourceT={$_GET["SourceT"]}\"><span style='font-size:{$fontsize}px'>$ligne</span></a></li>\n"); } echo build_artica_tabs($html, "main_cache_rules_main_tabs")."<script>LeftDesign('caches-center-white-256-opac20.png');</script>"; }
function rows_table() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_blackbox(); $nodeid = $_GET["nodeid"]; $mountedon = $tpl->_ENGINE_parse_body("{mounted}"); $search = '%'; $table = "harddrives"; $page = 1; $ORDER = "ORDER BY path desc"; $total = 0; if ($q->COUNT_ROWS($table) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND ((`{$_POST["qtype"]}` LIKE '{$search}' AND nodeid={$nodeid}) OR (`mac` LIKE '{$search}' AND nodeid={$nodeid}))"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE nodeid={$nodeid}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE nodeid={$nodeid} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", "")); $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); echo json_encode($data); return; } //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));} $usb = new usb(); while ($ligne = mysql_fetch_assoc($results)) { $model = $ligne["ID_MODEL_1"] . " " . $ligne["ID_MODEL_2"] . " " . $ligne["ID_VENDOR"] . " " . $ligne["ID_FS_LABEL"]; $partitions = unserialize(base64_decode($ligne["PARTITIONS"])); $ppp = array(); if (count($partitions) > 0) { while (list($num, $line) = each($partitions)) { $MOUNTED = $line["MOUNTED"]; $free_size = explode(";", $line["free_size"]); $bigsize = $free_size[0]; $used = $free_size[1]; $free = $free_size[2]; $pourcent = $free_size[3]; $perc = pourcentage($pourcent); if ($used == null) { $line["USED"] = 0; } if ($bigsize == null) { $bigsize = 0; } if ($line["TYPE"] == 5) { $perc = "-"; } if ($line["TYPE"] == 82) { $perc = "-"; } $ppp[] = "<tr style='border:0px'>\n\t\t\t\t\t<td style='border:0px'><span style='font-size:12px'>" . basename($num) . " {$label}</td>\n\t\t\t\t\t<td valign='middle' style='width:99%'>{$perc}\n\t\t\t\t\t<div style='margin-top:-10px'>{$used}/{$bigsize} <span style='font-size:12px' >{$usb->getPartypename($line["TYPE"])} ({$line["TYPE"]}) {$mountedon} {$MOUNTED}</div>\n\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t\t\n\t\t\t\t\t"; } } $ligne["size"] = FormatBytes($ligne["size"] * 1000); $data['rows'][] = array('id' => $ligne['mac'], 'cell' => array("<img src='img/disk-64.png'>", "<span style='font-size:16px'>{$ligne["path"]}</span>", "<span style='font-size:16px'>{$ligne["size"]}</span>", "<span style='font-size:16px'>{$model}</span>", "<table style='border:0px'>" . @implode("", $ppp) . "</table>")); } echo json_encode($data); }