本文整理汇总了PHP中mysql::CheckTablesSquid方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::CheckTablesSquid方法的具体用法?PHP mysql::CheckTablesSquid怎么用?PHP mysql::CheckTablesSquid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::CheckTablesSquid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: popup
function popup()
{
$tpl = new templates();
$sock = new sockets();
$ENABLED = trim($sock->getFrameWork("squid.php?enable-http-violations-enabled=yes"));
if ($ENABLED != "TRUE") {
$html = "\n\t\t<table style='width:98%' class=form>\n\t\t<tr>\n\t\t\t<td valign='top' width=1%><img src='img/error-128.png'></td>\n\t\t\t<td valign='top'><div style='font-size:18px'>{HTTP_VIOLATIONS_NOT_ENABLED_IN_SQUID}</td>\n\t\t</tr>\n\t\t</table>\n\t\t\n\t\t";
echo $tpl->_ENGINE_parse_body($html);
return;
}
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql();
$q->CheckTablesSquid();
$enabled = $tpl->_ENGINE_parse_body("{enable}");
$allow = $tpl->_ENGINE_parse_body("{allow}");
$active = $tpl->javascript_parse_text("{activew}");
$standard = $tpl->javascript_parse_text("{standard}");
$anonymous_browsing = $tpl->_ENGINE_parse_body("{anonymous_browsing}");
$standard_anonymous = $tpl->javascript_parse_text("{standard_anonymous}");
$paranoid_anonymous = $tpl->javascript_parse_text("{paranoid_anonymous}");
$set_the_new_value_for_this_header = $tpl->javascript_parse_text("{set_the_new_value_for_this_header}");
$restart_onlysquid = $tpl->_ENGINE_parse_body("{restart_onlysquid}");
$tt = $_GET["tt"];
$t = time();
$html = "\n\t<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:99%'></table>\n<script>\nvar tmp{$t}='';\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?headers-list=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: ' ', name : 'img', width : 24, sortable : true, align: 'left'},\n\t\t{display: 'header', name : 'header', width : 328, sortable : true, align: 'left'},\n\t\t{display: '{$active}', name : 'active', width : 80, sortable : false, align: 'center'},\n\t\t{display: '{$allow}', name : 'allow', width : 80, sortable : false, align: 'center'},\n\t\t\n\t\t\n\t\t\n\t],\nbuttons : [\n\t{name: '{$standard}', bclass: 'Script', onpress : standard{$t}},\n\t{name: '{$standard_anonymous}', bclass: 'Script', onpress : standard_anonymous},\n\t{name: '{$paranoid_anonymous}', bclass: 'Script', onpress : paranoid_anonymous},\n\t{name: '{$restart_onlysquid}', bclass: 'Reload', onpress : RestartProxy{$t}},\n\t],\t\n\tsearchitems : [\n\t\t{display: 'header', name : 'header'},\n\t\t],\n\tsortname: 'header',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '{$anonymous_browsing}',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: 580,\n\theight: 300,\n\tsingleSelect: true\n\t\n\t}); \n});\t\n\t\nfunction AddProxyChild(){\n\tYahooWin5('380','{$page}?add-proxy=yes&t={$t}','{$new_proxy}');\n\n}\n\n\n\n\tvar x_DeleteSquidChild{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#rowTSC'+tmp{$t}).remove();\n\t\t}\t\t\n\n\tfunction DeleteSquidChild(ID){\n\t\ttmp{$t}=ID;\n\t\tif(confirm('{$delete_this_child} ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('proxy-delete',ID);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteSquidChild{$t});\n\t\t}\n\t}\n\t\n\tvar x_EnableDisableProxyHeader{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\n\t\t}\n\t\t\n\tvar x_standard_anonymous{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#table-{$t}').flexReload();\n\t\t}\t\t\n\n\tfunction standard_anonymous(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('standard-anonymous',1);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_standard_anonymous{$t});\t\n\t}\n\t\nfunction standard{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('standard',1);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_standard_anonymous{$t});\n}\t\n\t\n\tfunction paranoid_anonymous(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('paranoid-anonymous',1);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_standard_anonymous{$t});\t\n\t}\t\n\t\n\t\n\t\n\tfunction standard_anonymous(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('standard-anonymous',1);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_standard_anonymous{$t});\t\n\t}\t\n\t\n\tfunction RestartProxy{$t}(){\n\t\tLoadjs('squid.restart.php?onlySquid=yes');\n\t}\n\t\n\t\n\t\n\tfunction EnableDisableProxyHeader(header,md){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('header-enable',header);\n\t\tif(document.getElementById(md).checked){\n\t\t\tXHR.appendData('enable',1);\n\t\t}else{\n\t\t\tXHR.appendData('enable',0);\n\t\t}\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableProxyHeader{$t});\t\n\t}\n\tfunction AllowProxyHeader(header,md){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('header-allow',header);\n\t\tif(document.getElementById(md).checked){\n\t\t\tXHR.appendData('enable',1);\n\t\t}else{\n\t\t\tXHR.appendData('enable',0);\n\t\t}\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableProxyHeader{$t});\t\n\t}\n\tfunction ChangeSquidHeader(header){\n\t\tvar vl=prompt('{$set_the_new_value_for_this_header}:'+header);\n\t\tif(vl){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('header-change',header);\n\t\t\tXHR.appendData('value',vl);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_standard_anonymous{$t});\n\t\t}\t\n\t}\n</script>\n";
echo $html;
}
示例2: popup
function popup()
{
$tpl = new templates();
$sock = new sockets();
$EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
if (!is_numeric($EnableWebProxyStatsAppliance)) {
$EnableWebProxyStatsAppliance = 0;
}
if ($users->WEBSTATS_APPLIANCE) {
$EnableWebProxyStatsAppliance = 1;
}
if ($EnableWebProxyStatsAppliance == 1) {
$ENABLED = "TRUE";
} else {
$ENABLED = trim($sock->getFrameWork("squid.php?follow-xforwarded-for-enabled=yes"));
}
if ($ENABLED != "TRUE") {
$html = "\n\t\t<table style='width:98%' class=form>\n\t\t<tr>\n\t\t\t<td valign='top' width=1%><img src='img/error-128.png'></td>\n\t\t\t<td valign='top'><div style='font-size:18px'>{X_FORWARDED_FOR_NOT_ENABLED_IN_SQUID}</td>\n\t\t</tr>\n\t\t</table>\n\t\t\n\t\t";
echo $tpl->_ENGINE_parse_body($html);
return;
}
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql();
$q->CheckTablesSquid();
$enabled = $tpl->_ENGINE_parse_body("{enable}");
$delete = $tpl->_ENGINE_parse_body("{delete}");
$new_proxy = $tpl->javascript_parse_text("{new_proxy}");
$proxy_child = $tpl->_ENGINE_parse_body("{proxy_child}");
$delete_this_child = $tpl->javascript_parse_text("{delete_this_child}");
$apply_params = $tpl->_ENGINE_parse_body("{apply}");
$tt = $_GET["tt"];
$t = time();
$html = "\n\t<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:99%'></table>\n<script>\nvar tmp{$t}='';\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?proxies-list=yes&t={$t}&ID={$_GET["ID"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: ' ', name : 'isnull', width : 50, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:18px>Proxys</span>', name : 'ipsrc', width : 622, sortable : true, align: 'left'},\n\t\t{display: '<span style=font-size:18px>{$enabled}</span>', name : 'enabled', width : 80, sortable : false, align: 'center'},\n\t\t{display: ' ', name : 'delete', width : 52, sortable : true, align: 'center'},\n\t\t\n\t],\nbuttons : [\n\t{name: '<strong style=font-size:18px>{$new_proxy}</strong>', bclass: 'add', onpress : AddProxyChild},\n\t{separator: true},{name: '<strong style=font-size:18px>{$apply_params}</strong>', bclass: 'apply', onpress : SquidBuildNow{$t}},\n\n\t\t],\t\n\tsearchitems : [\n\t\t{display: 'Proxy', name : 'ipsrc'},\n\t\t],\n\tsortname: 'ID',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true\n\t\n\t}); \n});\t\n\tfunction SquidBuildNow{$t}(){\n\t\tLoadjs('squid.compile.php');\n\t}\n\t\nfunction AddProxyChild(){\n\tYahooWin5('750','{$page}?add-proxy=yes&t={$t}&portid={$_GET["ID"]}','{$new_proxy}');\n\n}\n\n\tvar x_DeleteSquidChild{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#rowTSC'+tmp{$t}).remove();\n\t\t}\t\t\n\n\tfunction DeleteSquidChild(ID){\n\t\ttmp{$t}=ID;\n\t\tif(confirm('{$delete_this_child} ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('proxy-delete',ID);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteSquidChild{$t});\n\t\t}\n\t}\n\t\n\tvar x_EnableDisableProxyClient{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#table-{$t}').flexReload();\n\t\t}\t\t\n\t\n\tfunction EnableDisableProxyClient(ID){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('proxy-enable',ID);\n\t\tif(document.getElementById('ProxyClient_'+ID).checked){\n\t\t\tXHR.appendData('enable',1);\n\t\t}else{\n\t\t\tXHR.appendData('enable',0);\n\t\t}\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableProxyClient{$t});\t\n\t}\n\n</script>\n";
echo $html;
}
示例3: mysql
}
if ($argv[1] == '--members-month') {
members_month();
die;
}
if ($argv[1] == '--parse-cacheperfs') {
squid_cache_perfs();
die;
}
if ($argv[1] == '--show-tables') {
show_tables();
die;
}
if ($argv[1] == '--tables') {
$q = new mysql();
$q->CheckTablesSquid();
die;
}
if ($argv[1] == '--members-month-kill') {
members_month_delete();
exit;
}
if ($argv[1] == '--fix-tables') {
$GLOBALS["Q"]->FixTables();
exit;
}
if ($argv[1] == '--visited-sites') {
visited_sites();
exit;
}
if ($argv[1] == '--sync-categories') {
示例4: acl_time_save
function acl_time_save()
{
$pool_id = $_GET["pool_id"];
$acl_time_id = $_GET["bandacltime_ID"];
if ($acl_time_id < 1) {
$sql = "SELECT * FROM squid_pools_acls WHERE pool_id={$pool_id} AND ACL_TYPE='TIME_RESTRICT'";
$q = new mysql();
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
$acl_time_id = $ligne["ID"];
}
$datas = base64_encode(serialize($_GET));
$sql = "INSERT INTO squid_pools_acls (pool_id,ACL_TYPE,ACL_DATAS,enabled) VALUES('{$pool_id}','TIME_RESTRICT','{$datas}','{$_GET["enable"]}')";
if ($acl_time_id > 0) {
$sql = "UPDATE squid_pools_acls SET ACL_DATAS='{$datas}',enabled='{$_GET["enable"]}' WHERE ID='{$acl_time_id}'";
}
$q = new mysql();
$q->CheckTablesSquid();
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?squid-reload=yes");
}
示例5: table
function table()
{
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$sock = new sockets();
$tt = time();
$t = $_GET["t"];
$_GET["ruleid"] = $_GET["ID"];
$cache = $tpl->javascript_parse_text("{cache}");
$directory = $tpl->_ENGINE_parse_body("{directory}");
$type = $tpl->javascript_parse_text("{type}");
$rule = $tpl->javascript_parse_text("{rule}");
$delete = $tpl->javascript_parse_text("{delete} {zone} ?");
$rewrite_rules_fdb_explain = $tpl->javascript_parse_text("{rewrite_rules_fdb_explain}");
$new_cache = $tpl->javascript_parse_text("{new_cache}");
$license = $tpl->javascript_parse_text("{artica_license}");
$rules = $tpl->javascript_parse_text("{rules}");
$cpu = $tpl->javascript_parse_text("{process}");
$apply = $tpl->javascript_parse_text("{apply}");
$action = $tpl->javascript_parse_text("{action}");
$restricted_ports = $tpl->javascript_parse_text("{restricted_ports}");
$title = $tpl->javascript_parse_text("{caches_center}");
$size = $tpl->javascript_parse_text("{size}");
$order = $tpl->javascript_parse_text("{order}");
$all = $tpl->javascript_parse_text("{all}");
$reconstruct_caches = $tpl->javascript_parse_text("{reconstruct_caches}");
$enable = $tpl->_ENGINE_parse_body("{enable}");
$refresh = $tpl->javascript_parse_text("{refresh}");
$cpu_affinity = $tpl->javascript_parse_text("{cpu_affinity}");
$tt = time();
$sock = new sockets();
$DisableAnyCache = intval($sock->GET_INFO("DisableAnyCache"));
if ($DisableAnyCache == 1) {
echo FATAL_ERROR_SHOW_128("{DisableAnyCache_enabled_warning}");
return;
}
$smp_mode_is_disabled = null;
$cpunumber = $users->CPU_NUMBER - 1;
if ($cpunumber < 1) {
$cpunumber = 1;
}
$q = new mysql();
$q->CheckTablesSquid();
$bts[] = "{name: '<strong style=font-size:18px>{$new_cache}</strong>', bclass: 'add', onpress : NewRule{$tt}}";
$bts[] = "{name: '<strong style=font-size:18px>{$all}</strong>', bclass: 'cpu', onpress : Bycpu0}";
$CPUZ[] = "function Bycpu0(){\n\$('#flexRT{$tt}').flexOptions({url: '{$page}?items=yes&t={$tt}&tt={$tt}&cpu=0'}).flexReload();\n}";
for ($i = 1; $i < $cpunumber + 1; $i++) {
$bts[] = "{name: '<strong style=font-size:18px>Proc. {$i}</strong>', bclass: 'cpu', onpress : Bycpu{$i}}";
$CPUZ[] = "function Bycpu{$i}(){\n\t\t\$('#flexRT{$tt}').flexOptions({url: '{$page}?items=yes&t={$tt}&tt={$tt}&cpu={$i}'}).flexReload(); \n\t}";
}
$bts[] = "{name: '<strong style=font-size:18px>{$cpu_affinity}</strong>', bclass: 'Settings', onpress : CpuAff{$tt}}";
$bts[] = "{name: '<strong style=font-size:18px>{$refresh}</strong>', bclass: 'Reload', onpress : Refresh{$tt}}";
$bts[] = "{name: '<strong style=font-size:18px>{$reconstruct_caches}</strong>', bclass: 'recycle', onpress : ReconstructCaches{$tt}}";
$bts[] = "{name: '<strong style=font-size:18px>{$apply}</strong>', bclass: 'Reconf', onpress : Apply{$tt}}";
$sock = new sockets();
$sock->getFrameWork("squid.php?squid_caches_infos=yes");
if (!$users->CORP_LICENSE) {
$bts[] = "{name: '{$license}', bclass: 'Warn', onpress : License{$tt}}";
}
$buttons = "buttons : [ " . @implode(",", $bts) . " ],";
$html = "{$smp_mode_is_disabled}\n<input type='hidden' id='CACHE_CENTER_TABLEAU' value='flexRT{$tt}'>\n<table class='flexRT{$tt}' style='display: none' id='flexRT{$tt}' style='width:100%'></table>\n<script>\n\tfunction Start{$tt}(){\n\t\t\$('#flexRT{$tt}').flexigrid({\n\t\turl: '{$page}?items=yes&t={$tt}&tt={$tt}',\n\t\tdataType: 'json',\n\t\tcolModel : [\n\t\t{display: ' ', name : 'none', width :32, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:18px>{$order}</span>', name : 'cpu', width :48, sortable : true, align: 'center'},\n\t\t{display: '<span style=font-size:18px>{$cpu}</span>', name : 'cpu', width :32, sortable : true, align: 'center'},\n\t\t{display: '<span style=font-size:18px>{$cache}</span>', name : 'cachename', width :210, sortable : true, align: 'left'},\n\t\t{display: '<span style=font-size:18px>{$directory}</span>', name : 'cache_dir', width :332, sortable : true, align: 'left'},\n\t\t{display: '<span style=font-size:18px>{$type}</span>', name : 'cache_type', width :68, sortable : true, align: 'left'},\n\t\t{display: '<span style=font-size:18px>{$size}</span>', name : 'cache_size', width :236, sortable : true, align: 'left'},\n\t\t{display: '<span style=font-size:18px>%</span>', name : 'percentcache', width :55, sortable : true, align: 'center'},\n\t\t{display: '<span style=font-size:18px>{$enable}</span>', name : 'enabled', width :55, sortable : true, align: 'center'},\n\t\t{display: ' ', name : 'up', width :55, sortable : false, align: 'center'},\n\t\t{display: ' ', name : 'down', width :55, sortable : true, align: 'center'},\n\t\t{display: ' ', name : 'delete', width : 70, sortable : false, align: 'center'},\n\t\t{display: ' ', name : 'rebuild', width : 70, sortable : false, align: 'center'},\n\t\t],\n\t\t{$buttons}\n\t\tsearchitems : [\n\t\t{display: '{$cache}', name : 'cachename'},\n\t\t{display: '{$cpu}', name : 'cpu'},\n\t\t{display: '{$type}', name : 'cache_type'},\n\t\t{display: '{$directory}', name : 'cache_dir'},\n\t\t],\n\t\tsortname: 'zOrder',\n\t\tsortorder: 'asc',\n\t\tusepager: true,\n\t\ttitle: '<span style=font-size:30px>{$title}</span>',\n\t\tuseRp: true,\n\t\trp: 50,\n\t\tshowTableToggleBtn: false,\n\t\twidth: '99%',\n\t\theight: 500,\n\t\tsingleSelect: true,\n\t\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});\n\t}\n\t\nvar xNewRule{$tt}= function (obj) {\nvar res=obj.responseText;\nif (res.length>3){alert(res);return;}\n\$('#flexRT{$t}').flexReload();\n\$('#flexRT{$tt}').flexReload();\n}\n\t\nfunction Apply{$tt}(){\n\tLoadjs('squid.caches.progress.php');\n\t\n}\n\nfunction CpuAff{$tt}(){\n\tLoadjs('squid.caches.center.cpuaff.php');\n}\n\nfunction Refresh{$tt}(){\n\tLoadjs('squid.refresh-status.php');\n}\n\n\t\nfunction License{$tt}(){\n\tGoToArticaLicense();\n}\n" . @implode("\n", $CPUZ) . "\n\t\nfunction NewRule{$tt}(){\n\tLoadjs('squid.caches.center.wizard.php',true);\n\t//Loadjs('{$page}?item-js=yes&ID=0&t={$tt}',true);\n}\nfunction ReconstructCaches{$tt}(){\n\tLoadjs('squid.rebuild.caches.progress.php');\n}\n\t\nfunction INOUT{$tt}(ID){\nvar XHR = new XHRConnection();\nXHR.appendData('INOUT', ID);\nXHR.sendAndLoad('{$page}', 'POST',xINOUT{$tt});\n}\n\t\nfunction rports(){\nLoadjs('squid.webauth.hotspots.restricted.ports.php',true);\n}\n\t\nfunction reverse{$tt}(ID){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('reverse', ID);\n\tXHR.sendAndLoad('{$page}', 'POST',xINOUT{$tt});\n}\n\t\nvar x_LinkAclRuleGpid{$tt}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\t\$('#table-{$t}').flexReload();\n\t\$('#flexRT{$tt}').flexReload();\n\tExecuteByClassName('SearchFunction');\n\t}\n\tfunction FlexReloadRulesRewrite(){\n\t\$('#flexRT{$t}').flexReload();\n\t}\n\t\n\tfunction MoveRuleDestination{$tt}(mkey,direction){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('rules-destination-move', mkey);\n\tXHR.appendData('direction', direction);\n\tXHR.sendAndLoad('{$page}', 'POST',x_LinkAclRuleGpid{$tt});\n\t}\n\t\n\tfunction MoveRuleDestinationAsk{$tt}(mkey,def){\n\tvar zorder=prompt('Order',def);\n\tif(!zorder){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('rules-destination-move', mkey);\n\tXHR.appendData('rules-destination-zorder', zorder);\n\tXHR.sendAndLoad('{$page}', 'POST',x_LinkAclRuleGpid{$tt});\n\t}\n\tStart{$tt}();\n\t\n\t</script>\n\t";
echo $html;
}
示例6: clients_hours
function clients_hours(){
$pidfile="/etc/artica-postfix/pids/".basename(__FILE__).".".__FUNCTION__.".pid";
$oldpid=@file_get_contents($pidfile);
$unix=new unix();
if($unix->process_exists($oldpid)){die();}
$mypid=getmygid();
@file_put_contents($pidfile,$mypid);
$q=new mysql();
$q->CheckTablesSquid();
if(!$q->TABLE_EXISTS('squid_events_hours','artica_events')){
$unix->send_email_events("Unable to create statistics for \"squid_events_hours\"","Table squid_events_hours did not exists, please contact Artica support team","proxy");
return;
}
$today=date('Y-m-d');
$hour=date('H');
$sql="SELECT COUNT(uri) as tcount, SUM(QuerySize) as tsize,DATE_FORMAT(zDate,'%Y-%m-%d %H') as tdate
FROM dansguardian_events WHERE zDate >DATE_ADD(zDate,INTERVAL -24 HOUR) GROUP BY tdate";
$q=new mysql();
$results=$q->QUERY_SQL($sql,"artica_events");
if(!$q->ok){
if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";}
$unix->send_email_events("Unable to synthetize Web Proxy hour statistics ","Errors: $sql\n$q->mysql_error","proxy");
return;
}
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
$md5=md5($ligne["tdate"]);
if(preg_match("#(.+?)\s+([0-9]+)#",$ligne["tdate"],$re)){
$day=$re[1];
$hour=$re[2];
}
$sql="INSERT INTO squid_events_hours (zmd5,`day`,`hour`,`hits`,`www_size`) VALUES('$md5','$day','$hour','{$ligne["tcount"]}','{$ligne["tsize"]}');";
if(clients_hours_md($md5)<>null){
$sql="UPDATE squid_events_hours SET `hits`='{$ligne["tcount"]}', `www_size`='{$ligne["tsize"]}' WHERE `zmd5`='$md5'";
}
$q->QUERY_SQL($sql,"artica_events");
}
}
示例7: popup
function popup(){
$tpl=new templates();
$sock=new sockets();
$EnableWebProxyStatsAppliance=$sock->GET_INFO("EnableWebProxyStatsAppliance");
if(!is_numeric($EnableWebProxyStatsAppliance)){$EnableWebProxyStatsAppliance=0;}
if($users->WEBSTATS_APPLIANCE){$EnableWebProxyStatsAppliance=1;}
if($EnableWebProxyStatsAppliance==1){$ENABLED="TRUE";}else{
$ENABLED=trim($sock->getFrameWork("squid.php?follow-xforwarded-for-enabled=yes"));
}
if($ENABLED<>"TRUE"){
$html="
<table style='width:98%' class=form>
<tr>
<td valign='top' width=1%><img src='img/error-128.png'></td>
<td valign='top'><div style='font-size:18px'>{X_FORWARDED_FOR_NOT_ENABLED_IN_SQUID}</td>
</tr>
</table>
";
echo $tpl->_ENGINE_parse_body($html);
return;
}
$page=CurrentPageName();
$tpl=new templates();
$q=new mysql();
$q->CheckTablesSquid();
$enabled=$tpl->_ENGINE_parse_body("{enable}");
$delete=$tpl->_ENGINE_parse_body("{delete}");
$new_proxy=$tpl->javascript_parse_text("{new_proxy}");
$proxy_child=$tpl->_ENGINE_parse_body("{proxy_child}");
$delete_this_child=$tpl->javascript_parse_text("{delete_this_child}");
$apply_params=$tpl->_ENGINE_parse_body("{apply}");
$tt=$_GET["tt"];
$t=time();
$html="
<table class='table-$t' style='display: none' id='table-$t' style='width:99%'></table>
<script>
var tmp$t='';
$(document).ready(function(){
$('#table-$t').flexigrid({
url: '$page?proxies-list=yes&t=$t',
dataType: 'json',
colModel : [
{display: ' ', name : 'isnull', width : 50, sortable : false, align: 'center'},
{display: 'Proxys', name : 'ipsrc', width : 440, sortable : true, align: 'left'},
{display: '$enabled', name : 'enabled', width : 80, sortable : false, align: 'center'},
{display: ' ', name : 'delete', width : 52, sortable : true, align: 'center'},
],
buttons : [
{name: '$new_proxy', bclass: 'add', onpress : AddProxyChild},
{name: '$apply_params', bclass: 'apply', onpress : SquidBuildNow$t},
],
searchitems : [
{display: 'Proxy', name : 'ipsrc'},
],
sortname: 'ID',
sortorder: 'desc',
usepager: true,
title: '$proxy_child',
useRp: true,
rp: 15,
showTableToggleBtn: false,
width: '99%',
height: 400,
singleSelect: true
});
});
function SquidBuildNow$t(){
Loadjs('squid.compile.php');
}
function AddProxyChild(){
YahooWin5('450','$page?add-proxy=yes&t=$t','$new_proxy');
}
var x_DeleteSquidChild$t= function (obj) {
var results=obj.responseText;
if(results.length>2){alert(results);return;}
$('#rowTSC'+tmp$t).remove();
}
function DeleteSquidChild(ID){
tmp$t=ID;
if(confirm('$delete_this_child ?')){
var XHR = new XHRConnection();
XHR.appendData('proxy-delete',ID);
XHR.sendAndLoad('$page', 'POST',x_DeleteSquidChild$t);
}
}
//.........这里部分代码省略.........
示例8: table
function table(){
$page=CurrentPageName();
$tpl=new templates();
$users=new usersMenus();
$tt=time();
$t=$_GET["t"];
$_GET["ruleid"]=$_GET["ID"];
$cache=$tpl->javascript_parse_text("{cache}");
$directory=$tpl->_ENGINE_parse_body("{directory}");
$type=$tpl->javascript_parse_text("{type}");
$rule=$tpl->javascript_parse_text("{rule}");
$delete=$tpl->javascript_parse_text("{delete} {zone} ?");
$rewrite_rules_fdb_explain=$tpl->javascript_parse_text("{rewrite_rules_fdb_explain}");
$new_cache=$tpl->javascript_parse_text("{new_cache}");
$license=$tpl->javascript_parse_text("{artica_license}");
$rules=$tpl->javascript_parse_text("{rules}");
$cpu=$tpl->javascript_parse_text("{cpu}");
$apply=$tpl->javascript_parse_text("{apply}");
$action=$tpl->javascript_parse_text("{action}");
$restricted_ports=$tpl->javascript_parse_text("{restricted_ports}");
$title=$tpl->javascript_parse_text("{caches_center}");
$size=$tpl->javascript_parse_text("{size}");
$order=$tpl->javascript_parse_text("{order}");
$all=$tpl->javascript_parse_text("{all}");
$reconstruct_caches=$tpl->javascript_parse_text("{reconstruct_caches}");
$enable=$tpl->_ENGINE_parse_body("{enable}");
$refresh=$tpl->javascript_parse_text("{refresh}");
$tt=time();
$sock=new sockets();
$smp_mode_is_disabled=null;
$cpunumber=$users->CPU_NUMBER;
$q=new mysql();
$q->CheckTablesSquid();
$bts[]="{name: '$new_cache', bclass: 'add', onpress : NewRule$tt}";
$bts[]="{name: '$all', bclass: 'cpu', onpress : Bycpu0}";
$CPUZ[]="function Bycpu0(){
$('#flexRT$tt').flexOptions({url: '$page?items=yes&t=$tt&tt=$tt&cpu=0'}).flexReload();
}";
for($i=1;$i<$cpunumber+1;$i++){
$bts[]="{name: 'CPU $i', bclass: 'cpu', onpress : Bycpu$i}";
$CPUZ[]="function Bycpu$i(){
$('#flexRT$tt').flexOptions({url: '$page?items=yes&t=$tt&tt=$tt&cpu=$i'}).flexReload();
}";
}
$bts[]="{name: '$refresh', bclass: 'Reload', onpress : Refresh$tt}";
$bts[]="{name: '$reconstruct_caches', bclass: 'recycle', onpress : ReconstructCaches$tt}";
$bts[]="{name: '<center style=font-size:16px;font-weight:bold>$apply</center>', bclass: 'Reconf', onpress : Apply$tt}";
$sock=new sockets();
$sock->getFrameWork("squid.php?squid_caches_infos=yes");
if(!$users->CORP_LICENSE){
$bts[]="{name: '$license', bclass: 'Warn', onpress : License$tt}";
}
$buttons="buttons : [ ".@implode(",", $bts)." ],";
$html="$smp_mode_is_disabled
<input type='hidden' id='CACHE_CENTER_TABLEAU' value='flexRT$tt'>
<table class='flexRT$tt' style='display: none' id='flexRT$tt' style='width:100%'></table>
<script>
function Start$tt(){
$('#flexRT$tt').flexigrid({
url: '$page?items=yes&t=$tt&tt=$tt',
dataType: 'json',
colModel : [
{display: ' ', name : 'none', width :32, sortable : false, align: 'center'},
{display: '$order', name : 'cpu', width :32, sortable : true, align: 'center'},
{display: '$cpu', name : 'cpu', width :32, sortable : true, align: 'center'},
{display: '$cache', name : 'cachename', width :122, sortable : true, align: 'left'},
{display: '$directory', name : 'cache_dir', width :162, sortable : true, align: 'left'},
{display: '$type', name : 'cache_type', width :55, sortable : true, align: 'left'},
{display: '$size', name : 'cache_size', width :160, sortable : true, align: 'left'},
{display: '%', name : 'percentcache', width :55, sortable : true, align: 'center'},
{display: '$enable', name : 'enabled', width :55, sortable : true, align: 'center'},
{display: ' ', name : 'up', width :55, sortable : false, align: 'center'},
{display: ' ', name : 'down', width :55, sortable : true, align: 'center'},
{display: ' ', name : 'delete', width : 70, sortable : false, align: 'center'},
{display: ' ', name : 'rebuild', width : 70, sortable : false, align: 'center'},
],
$buttons
searchitems : [
{display: '$cache', name : 'cachename'},
{display: '$cpu', name : 'cpu'},
//.........这里部分代码省略.........