function tabs() { $page = CurrentPageName(); $tpl = new templates(); $artica_meta = new mysql_meta(); $isProxyAll = $artica_meta->isProxyAll(); if ($isProxyAll > 0) { $array["proxys"] = "Proxys ({$isProxyAll})"; } $array["hosts"] = '{hosts}'; $array["groups"] = '{groups2}'; if ($isProxyAll > 0) { if ($artica_meta->COUNT_ROWS("hotspot_members") > 0) { $array["hotspot_members"] = '{hotspot_members}'; } } if ($isProxyAll > 0) { $array["categories"] = '{your_categories}'; $array["acls"] = '{acls}'; } $array["server-params"] = "{main_parameters}"; //$array["uploads"]='{uploads}'; while (list($num, $ligne) = each($array)) { if ($num == "proxys") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.proxys.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "hosts") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.hosts.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "categories") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.proxys.categories.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "groups") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.groups.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "server-params") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.php?parameters=yes\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "hotspot_members") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.hotspot_members.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "uploads") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.uploads.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } if ($num == "acls") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"artica-meta.proxy.acls.php\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); continue; } $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&uuid=" . urlencode($_GET["uuid"]) . "\"><span style='font-size:22px'>{$ligne}</span></a></li>\n"); } echo build_artica_tabs($html, "meta-start", 1490); }
function table() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $disks = $tpl->javascript_parse_text("{disks}"); $ipaddr = $tpl->javascript_parse_text("{ipaddr}"); $memory = $tpl->javascript_parse_text("{memory}"); $load = $tpl->javascript_parse_text("{load}"); $version = $tpl->javascript_parse_text("{version}"); $servername = $tpl->javascript_parse_text("{servername2}"); $status = $tpl->javascript_parse_text("{status}"); $events = $tpl->javascript_parse_text("{events}"); $global_whitelist = $tpl->javascript_parse_text("{whitelist} (Meta)"); $policies = $tpl->javascript_parse_text("{policies}"); $packages = $tpl->javascript_parse_text("{packages}"); $switch = $tpl->javascript_parse_text("{switch}"); $new_server = $tpl->javascript_parse_text("{new_server}"); $software = $tpl->javascript_parse_text("{software}"); $performance = $tpl->javascript_parse_text("{performance}"); $filter = $tpl->javascript_parse_text("{filter}"); $tablewith = 691; $compilesize = 35; $size_elemnts = 50; $size_size = 58; $delete = "{display: 'delete', name : 'icon3', width : 35, sortable : false, align: 'left'},"; $categorysize = 387; $tag = $tpl->javascript_parse_text("{tag}"); $q = new mysql_meta(); if (!$q->TABLE_EXISTS("metahosts")) { $q->CheckTables(); } if (!$q->TABLE_EXISTS("metahosts")) { echo FATAL_ERROR_SHOW_128("MySQL Error, table metahosts does not exists..."); return; } $sql = "SELECT version FROM metahosts GROUP BY version ORDER BY version"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { if (stripos($q->mysql_error, "crashed and should be repaired") > 0) { $button = "<center style='margin:20px'>" . button("{repair_table}", "Loadjs('mysql.repair.progress.php?table=metahosts&database=articameta')", 40) . "</center>"; } echo FATAL_ERROR_SHOW_128(__FUNCTION__ . "/" . __LINE__ . "<br>" . $q->mysql_error . $button); return; } $ARTICAVER = @file_get_contents("VERSION"); while ($ligne = mysql_fetch_assoc($results)) { $ligne["version"] = trim($ligne["version"]); $ligne["version"] = str_replace(" ", "", $ligne["version"]); $VVERS[] = "\t{display: '{$version}: {$ligne["version"]}', name : '{$ligne["version"]}'}"; } $proxy = 0; $sql = "SELECT squidver,PROXY FROM metahosts GROUP BY squidver,PROXY ORDER BY squidver"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { if (stripos($q->mysql_error, "crashed and should be repaired") > 0) { $button = "<center style='margin:20px'>" . button("{repair_table}", "Loadjs('mysql.repair.progress.php?table=metahosts&database=articameta')", 40) . "</center>"; } echo FATAL_ERROR_SHOW_128(__FUNCTION__ . "/" . __LINE__ . "<br>" . $q->mysql_error . $button); return; } while ($ligne = mysql_fetch_assoc($results)) { if ($ligne["PROXY"] == 0) { continue; } $proxy++; $VVERS[] = "\t{display: '<strong style=font-size:18px>Proxy {$version}: {$ligne["squidver"]}</strong>', name : 'prxy{$ligne["squidver"]}'}"; } $clientsNumber = $q->isProxyAll(); $policies_button = "{name: '<strong style=font-size:18px>{$policies}</strong>', bclass: 'Settings', onpress : Policies{$t}},"; if ($proxy > 0) { $proxy_whitelist = "{name: '<strong style=font-size:18px>{$global_whitelist}</strong>', bclass: 'export', onpress : MetaProxyWhiteList},"; } $buttons = "\tbuttons : [\n\t{name: '<strong style=font-size:18px>{$events}</strong>', bclass: 'Search', onpress : MetaEvents},\n\t{name: '<strong style=font-size:18px>{$packages}</strong>', bclass: 'Search', onpress : Packages{$t}},\n\t{$policies_button}\n\t{$proxy_whitelist}\n\t],"; $t = time(); $html = "\n\t<table class='ARTICA_META_PROXYS_TABLE' style='display: none' id='ARTICA_META_PROXYS_TABLE' style='width:1200px'></table>\n<script>\n\$(document).ready(function(){\n\t\$('#ARTICA_META_PROXYS_TABLE').flexigrid({\n\turl: '{$page}?search=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<span style=font-size:18px>status</span>', name : 'icon1', width : 70, sortable : false, align: 'center'},\n\t{display: '<span style=font-size:18px>{$servername}</span>', name : 'hostname', width : 384, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:18px>{$ipaddr}</span>', name : 'public_ip', width : 165, sortable : true, align: 'right'},\n\t{display: '<span style=font-size:18px>{$performance}</span>', name : 'performance', width : 136, sortable : false, align: 'center'},\n\t{display: '<span style=font-size:18px>{$disks}</span>', name : 'xdisks', width : 136, sortable : false, align: 'center'},\n\t{display: '<span style=font-size:18px>AD</span>', name : 'AD', width : 136, sortable : false, align: 'center'},\n\t{display: '<span style=font-size:18px>{$filter}</span>', name : 'webfiltering', width : 136, sortable : false, align: 'center'},\n\t{display: '<span style=font-size:18px>Proxy ver</span>', name : 'squidver', width : 136, sortable : true, align: 'right'},\n\t\n\t\n\t],\n{$buttons}\n\tsearchitems : [\n\t{display: '{$servername}', name : 'hostname'},\n\t{display: '{$tag}', name : 'hostag'},\n\t{display: '{$ipaddr}', name : 'public_ip'},\n\t{display: '{$version}', name : 'version'},\n" . @implode($VVERS, ",\n") . "\n\t],\n\tsortname: 'hostname',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:30px>Meta Server v{$ARTICAVER} - {$clientsNumber} Client(s) </strong>',\n\tuseRp: true,\n\trpOptions: [10, 20, 30, 50,100,200],\n\trp:50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 800,\n\tsingleSelect: true\n\t\n\t});\n});\n\t\nfunction Profiles{$t}(){\n\tLoadjs('artica-meta.profiles.php');\n}\n\t\nfunction MetaAddServ{$t}(){\n\tLoadjs('artica-meta.NewServ.php');\n}\t\n\t\nfunction Switch{$t}(){\n\tvar ARTICA_META_MAIN_TABLE_SWITCH=document.getElementById('ARTICA_META_MAIN_TABLE_SWITCH').value;\n\tif(ARTICA_META_MAIN_TABLE_SWITCH==0){ARTICA_META_MAIN_TABLE_SWITCH=1;}else{ARTICA_META_MAIN_TABLE_SWITCH=0;}\n\tdocument.getElementById('ARTICA_META_MAIN_TABLE_SWITCH').value=ARTICA_META_MAIN_TABLE_SWITCH;\n\t\$('#ARTICA_META_MAIN_TABLE').flexOptions({url: '{$page}?search=yes&switch='+ARTICA_META_MAIN_TABLE_SWITCH}).flexReload();\n}\n\t\n\t\nfunction MetaEvents(){\n\tLoadjs('artica-meta.events.php?js=yes&t={$t}');\n}\n\t\nfunction MetaProxyWhiteList(){\n\tLoadjs('squid.whitelist-meta.php');\n}\n\t\nfunction Policies{$t}(){\n\tLoadjs('artica-meta.policies.php');\n}\n\t\nfunction SwitchToArtica(){\n\t\$('#dansguardian2-category-{$t}').flexOptions({url: '{$page}?category-search=yes&minisize={$_GET["minisize"]}&t={$t}&artica=1'}).flexReload();\n}\n\t\nfunction SaveAllToDisk(){\n\tLoadjs('{$page}?compile-all-dbs-js=yes')\n}\n\nfunction LoadCategoriesSize(){\n\tLoadjs('dansguardian2.compilesize.php')\n}\n\t\nfunction CategoryDansSearchCheck(e){\n\tif(checkEnter(e)){CategoryDansSearch();}\n}\n\t\nfunction CategoryDansSearch(){\n\tvar se=escape(document.getElementById('category-dnas-search').value);\n\tLoadAjax('dansguardian2-category-list','{$page}?category-search='+se,false);\n}\n\t\n\tfunction DansGuardianCompileDB(category){\n\tLoadjs('ufdbguard.compile.category.php?category='+category);\n\t}\n\t\n\tfunction CheckStatsApplianceC(){\n\tLoadAjax('CheckStatsAppliance','{$page}?CheckStatsAppliance=yes',false);\n\t}\n\t\n\tvar X_PurgeCategoriesDatabase= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>2){alert(results);}\n\tRefreshAllTabs();\n\t}\n\t\n\tfunction PurgeCategoriesDatabase(){\n\tif(confirm('{$purge_catagories_database_explain}')){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('PurgeCategoriesDatabase','yes');\n\tAnimateDiv('dansguardian2-category-list');\n\tXHR.sendAndLoad('{$page}', 'POST',X_PurgeCategoriesDatabase);\n\t}\n\t\n\t}\n\t\n\tvar X_TableCategoryPurge= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>2){alert(results);}\n\t\$('#dansguardian2-category-{$t}').flexReload();\n\t}\n\t\n\tfunction TableCategoryPurge(tablename){\n\tif(confirm('{$purge_catagories_table_explain}')){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('PurgeCategoryTable',tablename);\n\tXHR.sendAndLoad('dansguardian2.databases.compiled.php', 'POST',X_TableCategoryPurge);\n\t}\n\t}\n\t\n\tfunction Packages{$t}(){\n\t\tLoadjs('artica-meta.packages.php');\n\t}\n\t\n\t\n\t\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }