本文整理汇总了PHP中distanceOfTimeInWords函数的典型用法代码示例。如果您正苦于以下问题:PHP distanceOfTimeInWords函数的具体用法?PHP distanceOfTimeInWords怎么用?PHP distanceOfTimeInWords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了distanceOfTimeInWords函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: table
function table()
{
$t = time();
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$sock = new sockets();
$t = time();
$websites = $tpl->_ENGINE_parse_body("{websites}");
$add_member = $tpl->_ENGINE_parse_body("{add_member}");
$delete = $tpl->javascript_parse_text("{delete}");
$aliases = $tpl->javascript_parse_text("{aliases}");
$about2 = $tpl->_ENGINE_parse_body("{about2}");
$new_report = $tpl->javascript_parse_text("{new_report}");
$report = $tpl->javascript_parse_text("{report}");
$title = $tpl->javascript_parse_text("{websites}: {not_categorized}");
$progress = $tpl->javascript_parse_text("{progress}");
$size = $tpl->javascript_parse_text("{size}");
$hits = $tpl->javascript_parse_text("{hits}");
$computers = $tpl->javascript_parse_text("{computers}");
$launch = $tpl->javascript_parse_text("{analyze}");
$export = $tpl->javascript_parse_text("{export}");
$q = new mysql_squid_builder();
$NOT_CATEGORIZED_TIME = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/NOT_CATEGORIZED_TIME"));
$lastscan = null;
if ($NOT_CATEGORIZED_TIME > 0) {
$lastscan = $tpl->javascript_parse_text("{last_scan} " . distanceOfTimeInWords($NOT_CATEGORIZED_TIME, time()));
}
//current_members
$t = time();
$buttons = "\n\tbuttons : [\n\t\t{name: '<strong style=font-size:22px>{$launch}</strong>', bclass: 'link', onpress : Launch{$t}},\n\t\t{name: '<strong style=font-size:22px>{$export}</strong>', bclass: 'link', onpress : export{$t}},\n\t],";
$html = "\n\t<table class='SQUID_NOT_CATEGORIZED_TABLE' style='display: none' id='SQUID_NOT_CATEGORIZED_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#SQUID_NOT_CATEGORIZED_TABLE').flexigrid({\n\turl: '{$page}?search=yes&ID={$_GET["ID"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<strong style=font-size:18px>{$websites}</strong>', name : 'familysite', width : 418, sortable : true, align: 'left'},\n\t{display: '<strong style=font-size:18px>{$hits}</strong>', name : 'hits', width : 228, sortable : true, align: 'right'},\n\t{display: '<strong style=font-size:18px>{$size}</strong>', name : 'size', width : 228, sortable : false, align: 'right'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$websites}', name : 'familysite'},\n\t\n\t],\n\tsortname: 'size',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$title} {$lastscan}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: '500',\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\n\nfunction Launch{$t}(){\n\tLoadjs('squid.statistics.not-categorized.progress.php');\n}\n\nfunction export{$t}(){\n\tLoadjs('{$page}?export=yes');\n}\n\nfunction GoToProxyAliases{$t}(){\n\tGoToProxyAliases();\n}\n\nfunction GotoNetworkBrowseComputers{$t}(){\n\tGotoNetworkBrowseComputers();\n}\n\nvar xAddcategory{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\t\$('#SQUID_MAIN_REPORTS').flexReload();\n\t\$('#SQUID_MAIN_REPORTS_USERZ').flexReload();\n}\n\nfunction Addcategory{$t}(field,value){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$_GET["ID"]}');\n\tXHR.appendData('field',field);\n\tXHR.appendData('value',value);\n\tXHR.sendAndLoad('{$page}', 'POST',xAddcategory{$t});\n}\n</script>\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例2: popup
function popup()
{
$artica_meta = new mysql_meta();
$LicenseInfos = $artica_meta->LicenseInfos($_GET["uuid"]);
$page = CurrentPageName();
$tpl = new templates();
$FINAL_TIME = 0;
if (isset($LicenseInfos["FINAL_TIME"])) {
$FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]);
}
$LICT = "Community Edition";
if ($LicenseInfos["CORP_LICENSE"]) {
$LICT = "Entreprise Edition";
}
if ($LicenseInfos["ExpiresSoon"] > 0) {
if ($LicenseInfos["ExpiresSoon"] < 31) {
$LICT = "<span style='color:red'>{trial_mode}</span>";
}
}
if ($FINAL_TIME > 0) {
$ExpiresSoon = intval(time_between_day_Web($FINAL_TIME));
if ($ExpiresSoon < 7) {
$ExpiresSoon_text = "<strong style='color:red;font-size:16px'> {ExpiresSoon}</strong>";
}
$licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " (" . distanceOfTimeInWords(time(), $FINAL_TIME) . "{$ExpiresSoon_text})</td>\n\t\t\t\t\t</tr>";
}
if (is_numeric($LicenseInfos["TIME"])) {
$tt = distanceOfTimeInWords($LicenseInfos["TIME"], time());
$last_access = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t</tr>";
}
$html = "<div style='font-size:30px'>{$LICT}</div><div style='width:98%' class=form>\n<table style='width:100%'>\n\t</tr>\n\t{$last_access}\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["COMPANY"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{your_email_address}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["EMAIL"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>" . FormatNumber($LicenseInfos["EMPLOYEES"]) . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t\t\t\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:24px;'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t</table>\n</td>\n</table></div>";
echo $tpl->_ENGINE_parse_body($html);
}
示例3: report
function report()
{
if (!is_file("/usr/share/artica-postfix/ressources/logs/categorized.array")) {
return;
}
$ARRAY = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/categorized.array"));
$stats_sites = $ARRAY["stats_sites"];
$stats_categorized = $ARRAY["stats_categorized"];
$stats_not_categorized = $ARRAY["stats_not_categorized"];
$SumOflines = $ARRAY["SumOflines"];
$stats_ip = $ARRAY["stats_ip"];
$FIRSTTIME = $ARRAY["firsttime"];
$LASTTIME = $ARRAY["lasttime"];
$rate = $stats_categorized / $stats_sites;
$rate = $rate * 100;
$rate = round($rate, 2);
$stats_not_categorized = FormatNumber($stats_not_categorized);
$stats_categorized = FormatNumber($stats_categorized);
$stats_sites = FormatNumber($stats_sites);
$stats_ip = FormatNumber($stats_ip);
$SumOflines = FormatNumber($SumOflines);
if ($rate > 60) {
$rate_color = "46a346";
}
if ($rate < 60) {
$rate_color = "d32d2d";
}
$tpl = new templates();
$html = "<div style='width:98%' class=form>\n\t\n\t<div style='font-size:18px;margin-bottom:15px'>{from} " . $tpl->time_to_date($FIRSTTIME) . " {to} " . $tpl->time_to_date($LASTTIME) . " (" . distanceOfTimeInWords($FIRSTTIME, $LASTTIME) . ")</div>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{rate}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong style='font-size:36px;color:{$rate_color}'>{$rate}%</strong></td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{duration}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$ARRAY["DURATION"]}</strong></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{lines}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$SumOflines}</strong></td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{not_categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_not_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/notcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/categorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ipaddresses}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_ip}</strong></td>\n\t\t<td><a href=\"ressources/logs/ipcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{websites}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_sites}</strong></td>\n\t\t<td> </td>\n\t\t\n\t</tr>\t\n\t</table>\n\t</div>\t\t\t\t\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例4: ScanQueue
function ScanQueue()
{
$users = new usersMenus();
$GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
$unix = new unix();
$path = "/var/log/artica-postfix/xapian";
$SartOn = time();
$files = $unix->DirFiles($path);
if (count($files) == 0) {
return;
}
cpulimitProcessName("omindex");
while (list($num, $file) = each($files)) {
$toScan = "{$path}/{$file}";
if (ScanFile($toScan)) {
@unlink($toScan);
}
}
$SartOff = time();
$time = distanceOfTimeInWords($SartOn, $SartOff);
$countdir = count($GLOBALS["DIRS"]);
cpulimitProcessNameKill("omindex");
$echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}";
if ($GLOBALS["INDEXED"] > 0) {
@file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo);
@chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777);
}
echo $echo . "\n";
}
示例5: page
function page()
{
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$ARRAY = unserialize(base64_decode($sock->GET_INFO("SquidSiegeConfig")));
if (!is_numeric($ARRAY["GRAB_URLS"])) {
$ARRAY["GRAB_URLS"] = 0;
}
if (!is_numeric($ARRAY["USE_LOCAL_PROXY"])) {
$ARRAY["USE_LOCAL_PROXY"] = 1;
}
if (!is_numeric($ARRAY["SESSIONS"])) {
$ARRAY["SESSIONS"] = 150;
}
if (!is_numeric($ARRAY["MAX_TIME"])) {
$ARRAY["MAX_TIME"] = 30;
}
$REPORT = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/siege.report.txt"));
if (isset($REPORT["START_TIME"])) {
$duration = distanceOfTimeInWords($REPORT["START_TIME"], $REPORT["STOP_TIME"]);
$ttime = $tpl->time_to_date($REPORT["STOP_TIME"], true);
unset($REPORT["START_TIME"]);
unset($REPORT["STOP_TIME"]);
$f[] = "<div style='width:98%' class=form><table style='width:100%'><tr><td style='font-size:26px' nowrap colsspan=2>{last_report}:</td></tr>";
$f[] = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{date}:</td>\n\t\t<td style='font-size:22px'>{$ttime}</td>\n\t\t</tr>";
$f[] = "\n\t\t\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{duration}:</td>\n\t\t<td style='font-size:22px'>{$duration}</td>\n\t\t</tr>";
while (list($num, $line) = each($REPORT)) {
$f[] = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px' nowrap>{$num}:</td>\n\t\t\t\t<td style='font-size:22px'>{$line}</td>\n\t\t\t</tr>";
}
$f[] = "\n\t\t<td style='font-size:26px' nowrap colspan=2 align='right'>" . imgtootltip("delete-42.png", "{delete}", "ReportDelete()") . "</td></tr>\t\t\n\t\t</table></div><p> </p>";
}
if (count($f) > 0) {
$report_text = @implode("\n", $f);
}
$t = time();
$html = "\n\t\t\t\n\t<div style='font-size:32px;margin-bottom:30px'>Stress Tool</div>\n\t<div style='font-size:18px;margin-bottom:30px' class=explain>{squid_siege_explain} </div>\n\t\t\t{$report_text}\n<div style='width:98%' class=form>\n\t\t\t\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{get_url_from_lastlogs}:</td>\n\t\t\t<td>" . Field_checkbox_design("GRAB_URLS", 1, $ARRAY["GRAB_URLS"]) . "</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{use_local_proxy}:</td>\n\t\t\t<td>" . Field_checkbox_design("USE_LOCAL_PROXY", 1, $ARRAY["USE_LOCAL_PROXY"], "USE_LOCAL_PROXY_CHECK()") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_proxy}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY", $ARRAY["REMOTE_PROXY"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_port}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY_PORT", $ARRAY["REMOTE_PROXY_PORT"], "font-size:22px;width:110px;") . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{username}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("USERNAME", $ARRAY["USERNAME"], "font-size:22px;width:300px") . "\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{password}:</td>\n\t\t\t<td >\n\t\t\t\t" . Field_password("PASSWORD", $ARRAY["PASSWORD"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{simulate}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("SESSIONS", $ARRAY["SESSIONS"], "font-size:22px;width:110px;") . " {members}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px' nowrap>{MaxExecutionTime}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("MAX_TIME", $ARRAY["MAX_TIME"], "font-size:22px;width:110px;") . " {seconds}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-top:20px;font-size:36px'>\n\t\t\t\t\t\t<hr>" . button("{launch_test}", "Submit{$t}(true)", 36) . " | " . button("{apply}", "Submit{$t}(false)", 36) . "</td>\n\t\t</tr>\n\t</table>\n\t</div>\n<div style='margin-bottom:50px'> </div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t}\n\tvar xSubmit2{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tLoadjs('squid.siege.progress.php');\n\t}\t\n\tvar xDelete{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tRefreshTab('debug_squid_config');\n\t}\t\n\t\n\tfunction ReportDelete(){\n\t\tvar XHR = new XHRConnection();\t\n\t\tXHR.appendData('report-delete','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n\t\n\n\n\tfunction Submit{$t}(run){\n\t\tvar XHR = new XHRConnection();\t\n\t\t\n\t\tif(document.getElementById('GRAB_URLS').checked){XHR.appendData('GRAB_URLS',1);}else{XHR.appendData('GRAB_URLS',0);}\n\t\tif(document.getElementById('USE_LOCAL_PROXY').checked){XHR.appendData('USE_LOCAL_PROXY',1);}else{XHR.appendData('USE_LOCAL_PROXY',0);}\n\t\tXHR.appendData('REMOTE_PROXY',document.getElementById('REMOTE_PROXY').value);\n\t\tXHR.appendData('REMOTE_PROXY_PORT',document.getElementById('REMOTE_PROXY_PORT').value);\n\t\t\n\t\tXHR.appendData('USERNAME',encodeURIComponent(document.getElementById('USERNAME').value));\n\t\tXHR.appendData('PASSWORD',encodeURIComponent(document.getElementById('PASSWORD').value));\n\t\t\n\t\t\n\t\tXHR.appendData('SESSIONS',document.getElementById('SESSIONS').value);\n\t\tXHR.appendData('MAX_TIME',document.getElementById('MAX_TIME').value);\n\t\tif(!run){\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t\t}else{\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit2{$t});\n\t\t}\n\t}\n\t\n\t\n\tfunction USE_LOCAL_PROXY_CHECK(){\n\t\tdocument.getElementById('REMOTE_PROXY').disabled=true;\n\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=true;\n\t\tif(!document.getElementById('USE_LOCAL_PROXY').checked){\n\t\t\tdocument.getElementById('REMOTE_PROXY').disabled=false;\n\t\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=false;\t\t\n\t\t}\n\t\n\t}\n\tUSE_LOCAL_PROXY_CHECK();\n\tLoadAjax('request-{$t}','{$page}?request-tool-status=yes',true);\n</script>\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例6: ScanQueue
function ScanQueue()
{
$unix = new unix();
$GLOBALS["omindex"] = $unix->find_program("omindex");
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid)) {
writelogs("Already instance executed pid:{$olpid}", __FUNCTION__, __FILE__, __LINE__);
die;
}
@file_put_contents($pidfile, getmypid());
$users = new usersMenus();
$GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
$path = "{$GLOBALS["ARTICALOGDIR"]}/xapian";
$SartOn = time();
$files = $unix->DirFiles($path);
if (count($files) == 0) {
return;
}
cpulimitProcessName("omindex");
while (list($num, $file) = each($files)) {
$toScan = "{$path}/{$file}";
if (ScanFile($toScan)) {
@unlink($toScan);
}
}
$SartOff = time();
$time = distanceOfTimeInWords($SartOn, $SartOff);
$countdir = count($GLOBALS["DIRS"]);
cpulimitProcessNameKill("omindex");
$echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}";
if ($GLOBALS["INDEXED"] > 0) {
@file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo);
@chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777);
}
echo $echo . "\n";
}
示例7: loggers_status
function loggers_status()
{
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$data = unserialize(base64_decode($sock->getFrameWork("squid.php?loggers-status=yes")));
if (!is_array($data)) {
return;
}
while (list($PID, $ARRAY) = each($data)) {
$timettl = $ARRAY["TTL"];
$PURGED = $ARRAY["PURGED"];
$COUNT_RQS = $ARRAY["COUNT_RQS"];
$PURGED = FormatNumber($PURGED);
$COUNT_RQS = FormatNumber($COUNT_RQS);
if ($ARRAY["LASTTIME"] > 0) {
$Laststatus = distanceOfTimeInWords($ARRAY["LASTTIME"], time(), true);
} else {
$Laststatus = "-";
}
$f[] = "\n\t\t<div style='width:550px;margin-bottom:20px' class=form>\n\t\t<table>\n\t\t<tr>\n\t\t\t<td style='min-width:68px;vertical-align:top'><img src='img/process-64.png'></td>\n\t\t\t<td style='min-width:482px;vertical-align:top'>\t\t\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{PID}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$PID}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{running_since}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$timettl}mn</td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{purged_events}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$PURGED}</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{received_connections}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$COUNT_RQS}</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{last_status}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$Laststatus}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t";
}
echo $tpl->_ENGINE_parse_body(CompileTr2($f) . "\n\t\t\t<div style='width:100%;height:160px'>\n\t\t\t <div style='float:right;margin-left:10px;'>" . button("{refresh}", "LoadAjax('logger-status','{$page}?logger-status=yes',true);", 26) . "</div>\n\t\t\t<div style='float:right'>" . button("{reload_proxy}", "Loadjs('squid.reload.php');", 26) . "</div></div>");
}
示例8: dirname
}
include_once dirname(__FILE__) . '/framework/class.unix.inc';
if ($GLOBALS["DEBUG_INCLUDES"]) {
echo basename(__FILE__) . "::frame.class.inc\n";
}
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . '/ressources/class.mysql.inc';
include_once dirname(__FILE__) . '/ressources/class.squid.acls.inc';
$unix = new unix();
$NICE = $unix->EXEC_NICE();
$GetCachesInsquidConf = $unix->SQUID_CACHE_FROM_SQUIDCONF();
$chown = $unix->find_program("chown");
$chmod = $unix->find_program("chmod");
$t = time();
$c = 0;
while (list($CacheDirectory, $type) = each($GetCachesInsquidConf)) {
if (trim($CacheDirectory) == null) {
continue;
}
if (!is_dir($CacheDirectory)) {
continue;
}
$c++;
$F[] = $CacheDirectory;
shell_exec("{$NICE} {$chown} -R squid:squid {$CacheDirectory}");
shell_exec("{$NICE} {$chmod} -R 0755 {$CacheDirectory}");
}
if ($c > 0) {
$took = distanceOfTimeInWords($t, time(), true);
squid_admin_mysql(2, "Privileges was reset on {$c} caches directories took {$took}", @implode("\n", $F), __FILE__, __LINE__);
}
示例9: search
//.........这里部分代码省略.........
$Loadbr = "<br>";
$StyleLoad = "font-size:30px;font-weight:bold";
if (preg_match("#^([0-9\\.]+)-#", $ligne["squidver"], $rz)) {
$ligne["squidver"] = $rz[1];
}
if ($ArticaMetaUseSendClient == 1) {
$PING_URI = " <a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.menus.php?send-ping-js=yes&uuid={$uuidenc}&gpid=0');\"\n\t\t\tstyle='font-size:12px;text-decoration:underline;color:#0021C6'\n\t\t\t>Ping</a>";
}
if ($UFDB_ENABLED == 1) {
if ($UFDBARTICA > 0) {
$UFDBARTICAT = date("Y-m-d H:i:s", $UFDBARTICA);
$webfiltering_version = "<br>{$webfiltering} {$UFDBARTICAT}";
}
}
if ($BANDWIDTH > 0) {
$BANDWIDTH_text = " (" . FormatBytes($BANDWIDTH / 1024) . ")";
}
if ($switch == 1) {
$icon_warning_32 = "22-warn.png";
$icon_red_32 = "22-red.png";
$icon = "ok22.png";
$icon_panneau_32 = "warning-panneau-24.png";
$StyleLoad = "font-size:14px;";
$Loadbr = null;
}
if ($load > $CPU_NUMBER_MAX) {
$overloaded = "<br><strong style='color:#d32d2d'>{$overloaded_text}</strong>";
$icon = $icon_warning_32;
$loadcolor = "#d32d2d";
$LOGSWHY[] = "{$overloaded_text} {$load}>{$CPU_NUMBER_MAX}";
}
$xtime = strtotime($updated);
$diff = time_diff_min($xtime);
$Difftext = distanceOfTimeInWords($xtime, time(), true);
if ($diff > $ArticaMetaPooling * 1.5) {
$icon = $icon_warning_32;
$ColorTime = "#d32d2d";
$LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
$loadcolor = $ColorTime;
}
if ($diff > $ArticaMetaPooling * 4) {
$icon = $icon_red_32;
$ColorTime = "#d32d2d";
$LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
$NeCommuniquePlus = $NeCommuniquePlus_text;
}
if ($PROXYEMERG == 1) {
$icon = $icon_panneau_32;
$ColorTime = "#d32d2d";
$loadcolor = $ColorTime;
$LOGSWHY[] = "<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.urgency.php?uuid={$uuid}');\" style='color:{$ColorTime};text-decoration:underline'>{$proxy_in_emergency_mode}</a>";
}
if ($WINDOWSAD == 1) {
$secondincon = "windows-server-32.png";
if ($ADEMERG == 1) {
$icon = $icon_warning_32;
$ColorTime = "#d32d2d";
$secondincon = "windows-server-32-red.png";
$LOGSWHY[] = $activedirectory_emergency_mode;
$loadcolor = $ColorTime;
}
}
if ($MetaUfdbArticaVer > 0) {
if ($UFDB_ENABLED == 1) {
if ($UFDBARTICA < $MetaUfdbArticaVer) {
$LOGSWHY[] = "{$webfiltering} < " . date("Y-m-d H:i:s", $MetaUfdbArticaVer);
示例10: section_webrules_search
function section_webrules_search()
{
$q = new mysql_squid_builder();
$database = "squidlogs";
$sock = new sockets();
$tpl = new templates();
$search = '%';
$table = "websites_caches_params";
$searchstring = string_to_flexquery("search-webrules");
$sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} ORDER BY sitename";
$results = $q->QUERY_SQL($sql, $database);
if (!$q->ok) {
senderror($q->mysql_error);
}
$boot = new boostrap_form();
$t = time();
while ($ligne = mysql_fetch_assoc($results)) {
$ID = md5($ligne["sitename"]);
$delete = imgtootltip("delete-24.png", "{delete}", "DeleteWebsiteCached{$t}('{$ligne["sitename"]}','{$ID}')");
$select = "Loadjs('squid.miniwebsite.tasks.php?cache-params-js=yes&sitename={$ligne["sitename"]}&table-t={$_GET["t"]}');";
$ligne["MIN_AGE"] = $ligne["MIN_AGE"];
$ligne["MIN_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MIN_AGE"] * 60, true));
$ligne["MAX_AGE"] = $ligne["MAX_AGE"];
$ligne["MAX_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MAX_AGE"] * 60, true));
if (trim($ligne["sitename"]) == '.') {
$ligne["sitename"] = $tpl->_ENGINE_parse_body("{all}");
}
$link = $boot->trswitch($select);
$tr[] = "\n\t\t<tr id='{$ID}'>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["sitename"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MIN_AGE"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["PERCENT"]}%</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MAX_AGE"]}</td>\n\t\t<td width=1% nowrap>{$delete}</td>\n\t\t</tr>";
}
echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{website}</th>\n\t\t\t<th>{expire_time}</th>\n\t\t\t<th>%</th>\n\t\t\t<th>{limit}</th>\n\t\t\t<th> </th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n<script>\nvar websiteMem{$t}='';\n\t\tvar x_DeleteWebsiteCached{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\t\$('#'+websiteMem{$t}).remove();\t\t\t\n\t\t\t\t\n\t\t}\t\n\n\t\tfunction DeleteWebsiteCached{$t}(domain,id){\n\t\t\twebsiteMem{$t}=id;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DELETE',domain);\n\t\t\tXHR.sendAndLoad('squid.caches32.caches-www.php', 'POST',x_DeleteWebsiteCached{$t});\n\t\t}\n</script>\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n";
}
示例11: BuildReverse
function BuildReverse($ligne, $backupBefore = false)
{
$T1 = time();
$q = new mysql_squid_builder();
$unix = new unix();
$ligne["servername"] = trim($ligne["servername"]);
$GLOBALS["IPADDRS"] = $unix->NETWORK_ALL_INTERFACES(true);
$IPADDRS = $GLOBALS["IPADDRS"];
$DenyConf = $ligne["DenyConf"];
$ligne["servername"] = trim($ligne["servername"]);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] ************* {$ligne["servername"]}:{$ligne["port"]} / {$DenyConf} ************* \n";
}
if ($ligne["port"] == 82) {
echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] 82 port is an apache port, SKIP\n";
build_progress("Bad port {$ligne["servername"]}:82", 110);
return;
}
if ($GLOBALS["REMOVE_LOCAL_ADDR"]) {
if (isset($IPADDRS[$ligne["servername"]])) {
build_progress("{$IPADDRS[$ligne["servername"]]} *** SKIPPED ***", 110);
echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] {$ligne["servername"]} *** SKIPPED ***\n";
return;
}
}
if ($DenyConf == 1) {
build_progress("Denied config *** SKIPPED ***", 110);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] Local web site `{$ligne["servername"]}`, DenyConf = 1,skipped\n";
}
return;
}
if (isset($ALREADYSET[$ligne["servername"]])) {
build_progress("Already setup", 110);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] `{$ligne["servername"]}` Already defined, abort\n";
}
return;
}
$ListenPort = $ligne["port"];
$SSL = $ligne["ssl"];
$certificate = $ligne["certificate"];
echo "Starting......: " . date("H:i:s") . " [INIT]: ListenPort..............:{$ListenPort}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: SSL.....................:{$SSL}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: Certificate.............:{$certificate}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: OWA.....................:{$ligne["owa"]}\n";
if ($ligne["owa"] == 1) {
$GLOBALS["OUTPUT"] = true;
$nginx_exchange = new nginx_exchange($ligne["servername"]);
build_progress("{$ligne["servername"]}: {building} Microsoft Exchange Configuration", 50);
$nginx_exchange->buildConfig();
build_progress("{$ligne["servername"]}: {building} Microsoft Exchange Configuration {done}", 70);
$Took = distanceOfTimeInWords($T1, time(), true);
nginx_admin_mysql(2, "Success build Microsoft Exchange Configuration configuration for {$ligne["servername"]} took: {$Took}", "Took: {$Took}", __FILE__, __LINE__);
build_progress("{$ligne["servername"]}: Microsoft Exchange Configuration {done}", 80);
return true;
}
build_progress("{$ligne["servername"]}:{$ListenPort} [SSL:{$SSL}]", 20);
echo "Starting......: " . date("H:i:s") . " [INIT]: Protect remote web site `{$ligne["servername"]}:{$ListenPort} [SSL:{$SSL}]`\n";
if ($ligne["servername"] == null) {
echo "Starting......: " . date("H:i:s") . " [INIT]: skip it...\n";
return;
}
$cache_peer_id = $ligne["cache_peer_id"];
if ($cache_peer_id > 0) {
$ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `reverse_sources` WHERE `ID`='{$cache_peer_id}'"));
}
$host = new nginx($ligne["servername"]);
if ($ListenPort == 80 && $SSL == 1) {
build_progress("{$ligne["servername"]}: Building HTTP", 40);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: HTTP/HTTPS Enabled [" . __LINE__ . "]...\n";
}
$host->set_RedirectQueries($ligne["RedirectQueries"]);
$host->set_forceddomain($ligne2["forceddomain"]);
$host->set_ssl(0);
$host->set_mixed_ssl(1);
$host->set_proxy_port($ligne2["port"]);
$host->set_listen_port(80);
$host->set_poolid($ligne["poolid"]);
$host->set_owa($ligne["owa"]);
$host->set_storeid($ligne["cacheid"]);
$host->set_cache_peer_id($cache_peer_id);
$host->BackupBefore = $backupBefore;
build_progress("{$ligne["servername"]}: HTTP/HTTPS Enabled", 50);
$GLOBALS["NGINX_FATAL_ERRORS"] = array();
if (!$host->build_proxy()) {
if ($GLOBALS["NGINX_FATAL_ERROR"] != null) {
nginx_admin_mysql(0, "Fatal error on {$ligne["servername"]} <{$GLOBALS["NGINX_FATAL_ERROR"]}>", "{$GLOBALS["NGINX_FATAL_ERROR"]}\n" . @implode("\n", $GLOBALS["NGINX_FATAL_ERRORS"]));
echo "*** ***\n";
echo "*** Fatal error {$GLOBALS["NGINX_FATAL_ERROR"]} ***\n";
echo "*** ***\n";
build_progress("{$ligne["servername"]}: {failed} {$GLOBALS["NGINX_FATAL_ERROR"]}", 110);
return;
}
build_progress("{$ligne["servername"]}: {failed}", 110);
return;
//.........这里部分代码省略.........
示例12: HyperCacheScanDownload
function HyperCacheScanDownload($urikey, $TargetFile, $ID, $FileType)
{
if (!isset($GLOBALS["SIZE_DOWNLOADED"])) {
$GLOBALS["SIZE_DOWNLOADED"] = 0;
}
if (!isset($GLOBALS["FAILED_DOWNLOADED"])) {
$GLOBALS["FAILED_DOWNLOADED"] = 0;
}
if (!is_numeric($GLOBALS["SIZE_DOWNLOADED"])) {
$GLOBALS["SIZE_DOWNLOADED"] = 0;
}
if (!is_numeric($GLOBALS["FAILED_DOWNLOADED"])) {
$GLOBALS["FAILED_DOWNLOADED"] = 0;
}
$curl = new ccurl($urikey);
$FullTarGetPath = $GLOBALS["HyperCacheStoragePath"] . "/" . $TargetFile;
$GLOBALS["HITS"]++;
$parse_url = parse_url($urikey);
$hostname = $parse_url["host"];
$OriginalFile = basename($parse_url["path"]);
$t = time();
events("{downloading} {$OriginalFile} {from} {$hostname}", $ID, 3, __LINE__);
if (!$curl->GetFile($FullTarGetPath)) {
events("HyperCacheScanDownload:: Download failed with error {$curl->error}", $ID, 2, __LINE__);
$GLOBALS["FAILED_DOWNLOADED"]++;
return false;
}
$size = @filesize($FullTarGetPath);
$MD5File = md5_file($FullTarGetPath);
$sizeLog = FormatBytes($size / 1024);
events("{$hostname}: {$OriginalFile} ({$sizeLog}) {took}: " . distanceOfTimeInWords($t, time()), $ID, 2, __LINE__);
$GLOBALS["SIZE_DOWNLOADED"] = $GLOBALS["SIZE_DOWNLOADED"] + $size;
$path = HyperCacheMD5File_get($MD5File);
if ($path != null) {
if (!HyperCacheRetranslation_set($urikey, $MD5File, $FileType, $path)) {
$GLOBALS["FAILED_DOWNLOADED"]++;
return;
}
return;
}
if (!HyperCacheMD5File_set($MD5File, $TargetFile, $FileType, $size, $OriginalFile)) {
$GLOBALS["FAILED_DOWNLOADED"]++;
return;
}
if (!HyperCacheRetranslation_set($urikey, $MD5File, $FileType, $TargetFile)) {
$GLOBALS["FAILED_DOWNLOADED"]++;
return;
}
return true;
}
示例13: container_list
function container_list()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql_squid_builder();
$search = '%';
$table = "squid_storelogs";
$page = 1;
$ORDER = "ORDER BY ID DESC";
$sock = new sockets();
$t = $_GET["t"];
if (!$q->TABLE_EXISTS($table)) {
$q->CheckTables();
}
$total = 0;
if ($q->COUNT_ROWS($table, $database) == 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, $database));
if (!$q->ok) {
json_error_show($q->mysql_error);
}
$total = $ligne["TCOUNT"];
} else {
$sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
if (!$q->ok) {
json_error_show($q->mysql_error);
}
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
if ($OnlyEnabled) {
$limitSql = null;
}
$sql = "SELECT `ID`,`filename`,`fileext`,`filesize`,`Compressedsize`,`filetime` FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql);
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if (!$q->ok) {
json_error_show($q->mysql_error);
}
while ($ligne = mysql_fetch_assoc($results)) {
$color = "black";
$events = " ";
$md5 = md5(serialize($ligne) . $t);
$span = "<span style='font-size:16px'>";
$delete = imgtootltip("delete-24.png", "{delete} {$ligne['ID']}", "LogsCsvDelte{$t}('{$ligne['ID']}','{$md5}')");
$jsEdit = "Loadjs('{$MyPage}?Rotate-js=yes&ID={$ligne['taskid']}&t={$t}');";
$jstask = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$jsEdit}\"\r\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>";
$jslloop = "Loadjs('{$MyPage}?log-js=yes&filename={$ligne['filename']}&t={$t}&ID={$ligne['ID']}');";
$view = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$jslloop}\"\r\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>";
if ($ligne["filesize"] > 1024) {
$ligne["filesize"] = FormatBytes($ligne["filesize"] / 1024);
} else {
$ligne["filesize"] = $ligne["filesize"] . " Bytes";
}
if ($ligne["Compressedsize"] > 1024) {
$ligne["Compressedsize"] = FormatBytes($ligne["Compressedsize"] / 1024);
} else {
$ligne["Compressedsize"] = $ligne["Compressedsize"] . " Bytes";
}
$time = strtotime($ligne['filetime']);
$distance = distanceOfTimeInWords($time, time(), false);
$img = "ext/unknown_small.gif";
if (is_file("img/ext/{$ligne["fileext"]}_small.gif")) {
$img = "ext/{$ligne["fileext"]}_small.gif";
}
$distance = $tpl->javascript_parse_text($distance);
$data['rows'][] = array('id' => $md5, 'cell' => array("{$span}{$view}{$ligne['filetime']}</a></span>", "{$span}{$view}{$distance}</a></span>", "{$span}{$view}{$ligne["filename"]}</a></span>", "<img src='img/{$img}'>", "{$span}{$ligne["filesize"]}</a></span>", "{$span}{$ligne["Compressedsize"]}</a></span>", $delete));
}
echo json_encode($data);
}
示例14: popup_connected_search
function popup_connected_search()
{
$ocs = new ocs();
$sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["connected-search"]);
$CONFIG = $ocs->GET_SERVER_SETTINGS();
$PROLOG_FREQ = $CONFIG["PROLOG_FREQ"] * 60;
$q = new mysql();
$results = $q->QUERY_SQL($sql, "ocsweb");
if (!$q->ok) {
echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>";
return;
}
$html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n<thead class='thead'>\n<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{status}</th>\n\t\t<th>{ComputerMacAddress}</th>\n\t\t<th>{ip_address}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\t";
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($ligne["IPADDRESS"] == "0.0.0.0") {
continue;
}
if ($ligne["MACADDR"] == "00:00:00:00:00:00") {
continue;
}
if ($already[$ligne["MACADDR"]]) {
continue;
}
if ($already[$ligne["NAME"] . $ligne["IPSRC"]]) {
continue;
}
$status = null;
$already[$ligne["MACADDR"]] = true;
$already[$ligne["NAME"] . $ligne["IPADDRESS"]] = true;
$f = new computers();
$uid = $f->ComputerIDFromMAC($ligne["MACADDR"]);
if (trim($uid) != null) {
$already[$ligne["NAME"] . $ligne["IPSRC"]] = true;
}
$js = MEMBER_JS($uid, 1, 1);
$last = distanceOfTimeInWords(strtotime($ligne["LASTCOME"]), time());
$mins = distanceMinStrings($ligne["LASTCOME"]);
$js_text = "{$ligne["NAME"]}<hr>{last_com}:{$last}<hr>{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}";
if ($mins > $PROLOG_FREQ) {
$js_text = "{$ligne["NAME"]}<hr><span color:#d32d2d>{last_com}:{$last}</span>";
$status = imgtootltip('ok32-grey.png', $js_text);
} else {
$status = imgtootltip('ok32.png', "{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}<br>{$last}");
}
if ($uid == null) {
$js = null;
$status = imgtootltip("warning-panneau-32.png", "{ocs_computer_is_not_in_ldap}", "AddComputerFromOCS('{$ligne["MACADDR"]}')", null, md5($ligne["MACADDR"]) . time());
$js_text = "{ocs_computer_is_not_in_ldap}";
} else {
}
if (trim($ligne["IPADDRESS"]) != null) {
if (trim($ligne["IPSRC"]) != null) {
if (trim($ligne["IPSRC"]) != trim($ligne["IPADDRESS"])) {
$ligne["IPSRC"] = $ligne["IPSRC"] . "/" . $ligne["IPADDRESS"];
}
} else {
$ligne["IPSRC"] = $ligne["IPADDRESS"];
}
}
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
$html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>" . imgtootltip("laptop-32.png", $js_text, $js) . "</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["NAME"]}</code></td>\n\t\t\t<td width=1% align='center' valign='middle'>{$status}</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["MACADDR"]}</code></td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["IPSRC"]}</code></td>\n\t\t</tr>\n\t\t\n\t\t";
}
$html = $html . "</table>\n\t\n\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例15: squid_frontend_status
//.........这里部分代码省略.........
$TITLE_USERS = null;
$TITLE_COMPUTERS = null;
$EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth"));
if ($EnableKerbAuth == 1) {
include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
$ldap = new external_ad_search();
$NET_RPC_INFOS = $ldap->NET_RPC_INFOS();
$NumBerOfUsers = intval($NET_RPC_INFOS["Num users"]);
if ($NumBerOfUsers > 0) {
$TITLE_USERS = " | <a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:AnimateDiv('BodyContent');LoadAjax('BodyContent','squid.adker.php?tabs=yes');\" \n\t\t\tstyle='text-decoration:underline'>{$NumBerOfUsers} {members}</a>";
}
}
$q = new mysql_squid_builder();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(MAC) as tcount FROM (SELECT MAC FROM UserAutDB GROUP BY MAC) as t"));
$Nodes = $ligne["tcount"];
if ($Nodes > 0) {
$TITLE_COMPUTERS = " | <a href=\"javascript:blur();\"\n\t\tOnClick=\"Loadjs('squid.computer-browse.php')\"\n\t\tstyle='text-decoration:underline'>{$Nodes} {computers}</a>";
}
$CACHES_RATES = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/TOTAL_CACHED"));
$TOTALS_NOT_CACHED = intval($CACHES_RATES["TOTALS_NOT_CACHED"]);
$TOTALS_CACHED = intval($CACHES_RATES["TOTALS_CACHED"]);
$TOTALS_DOWNLOAD = $TOTALS_NOT_CACHED + $TOTALS_CACHED;
$TOTALS_NOT_CACHED = intval(@file_get_contents("/usr/share/artica-postfix/ressources/logs/stats/NOT_CACHED"));
if ($TOTALS_NOT_CACHED > 0) {
$TOTALS_NOT_CACHED_TEXT = " | <a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('admin.index.loadvg.squid.notcached-week.php');\"\n\t\tstyle='text-decoration:underline;font-weight:bold'>{not_cached_this_week}: " . FormatBytes($TOTALS_NOT_CACHED / 1024) . "</a>";
}
$Status_cache = " | {downloaded} " . FormatBytes($TOTALS_DOWNLOAD / 1024) . " | {cached}:" . FormatBytes($TOTALS_CACHED / 1024) . $TOTALS_NOT_CACHED_TEXT;
$RATE = $TOTALS_CACHED / $TOTALS_DOWNLOAD * 100;
$RATE = round($RATE, 1);
$TITLE_RATE = " | {cache_rate} <strong>{$RATE}%</strong>";
if (!is_numeric($server_all_kbytes_in)) {
$server_all_kbytes_in = 1000;
}
if (!is_numeric($server_all_kbytes_out)) {
$server_all_kbytes_out = 250;
}
if (!is_numeric($HttpRequests)) {
$HttpRequests = 150;
}
if (!is_numeric($ActiveRequests)) {
$ActiveRequests = 150;
}
if (!isset($squid5mn["cpu_usage"])) {
$squid5mn["cpu_usage"] = 0;
}
$squid5mn["cpu_usage"] = round($squid5mn["cpu_usage"], 2);
$squid5mn["client_http.requests"] = round($squid5mn["client_http.requests"], 2);
$squid5mn["server.all.kbytes_in"] = round($squid5mn["server.all.kbytes_in"], 2);
$squid5mn["server.all.kbytes_out"] = round($squid5mn["server.all.kbytes_out"], 2);
$ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc"));
$ActiveRequestsNumber = count($ActiveRequestsR["CON"]);
$ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]);
$ActiveRequestsMembers = count($ActiveRequestsR["USERS"]);
if ($ActiveRequestsNumber > 0) {
$TITLE_REQUESTS = " | <a href=\"javascript:blur();\"\n\t\tOnClick=\"Loadjs('squid.active.requests.php')\"\n\t\tstyle='text-decoration:underline'>{$ActiveRequestsNumber} {active_requests}</a>";
}
if (!is_numeric($ActiveRequestsNumber)) {
$ActiveRequestsNumber = 0;
}
if (!is_numeric($ActiveRequestsIpaddr)) {
$ActiveRequestsIpaddr = 0;
}
if (!is_numeric($ActiveRequestsMembers)) {
$ActiveRequestsMembers = 0;
}
$server_all_kbytes_in_text = $tpl->javascript_parse_text("{server_all_kbytes_in}");
$server_all_kbytes_out_text = $tpl->javascript_parse_text("{server_all_kbytes_out}");
$active_requests = $tpl->javascript_parse_text("{active_requests}");
$proxy_status = $tpl->javascript_parse_text("{proxy_status}");
$second = $tpl->javascript_parse_text("{second}");
$requests = $tpl->javascript_parse_text("{requests}");
$countStorages = count($StorageCapacity);
for ($i = 0; $i < $countStorages; $i++) {
$tS[] = "<div id='squid-s{$i}-{$t}' style='width:160px; height:100px'>";
$js[] = " var s{$i} = new JustGage({\n\t\tid: 'squid-s{$i}-{$t}',\n\t\tvalue: {$StorageCapacity[$i]},\n\t\tmin: 0,\n\t\tmax: 100,\n\t\ttitle: 'Storage Capacity Kid " . ($i + 1) . "',\n\t\tlabel: '%',\n\t\tlevelColorsGradient: true\n\t}); ";
}
$storages = CompileTr4($tS, true, null, true);
$ini = new Bs_IniHandler();
$color = "black";
$ini->loadFile("/usr/share/artica-postfix/ressources/databases/ALL_SQUID_STATUS");
if ($ini->_params["SQUID"]["running"] == 0) {
$color = "#d32d2d";
$status = "{stopped}";
} else {
if ($ini->_params["SQUID"]["master_time"]) {
$status2 = " {running} {since} " . distanceOfTimeInWords($ini->_params["SQUID"]["master_time"], time());
}
}
$version = @file_get_contents("/usr/share/artica-postfix/ressources/databases/SQUID.version");
if ($version != null) {
$version = " v.{$version}";
}
if ($SquidCacheLevel == 0) {
$nocache = " <span style='color:#d32d2d'>{no_cached_sites_warn}</span>";
}
$squi1_text = $tpl->javascript_parse_text("{monitor}");
$squi1_onmouse = "OnMouseOver=\"javascript:AffBulle('{$squi1_text}');this.style.cursor='pointer'\" OnMouseOut=\"javascript:HideBulle();this.style.cursor='default'\"";
$squi1_onClick = "OnClick=\"javascript:Loadjs('squid.task.monitor.php')\"";
echo $tpl->_ENGINE_parse_body("\n<table style='width:99%' >\n\t<tr>\n\t\t<td colspan=4 style='font-size:22px'>\n\t\t\t<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:LoadAjax('BodyContent','squid.caches.status.php?tabs=yes')\" \n\t\t\tstyle='text-decoration:underline;color:{$color}'>{$proxy_status} {$status} {$version}</a>\n\t\t\t{$TITLE_RATE}{$TITLE_USERS}{$TITLE_REQUESTS}{$TITLE_COMPUTERS}\n\t\t\t<br>\n\t\t\t<div style='font-size:11px'><i>{$status2}{$nocache}{$Status_cache}</i></div>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t\t<td valign='top' width=25%>\n\t\t\t\t<div id='squid-1-{$t}' style='width:160px; height:100px' {$squi1_onmouse} {$squi1_onClick}></div>\n\t\t\t\n\t\t\t</td>\n\t\t\t<td valign='top' width=25%><div id='squid-2-{$t}' style='width:170px; height:100px'></div></td>\n\t\t\t<td valign='top' width=25%><div id='squid-3-{$t}' style='width:170px; height:100px'></div></td>\n\t\t\t<td valign='top' width=25%><div id='squid-4-{$t}' style='width:170px; height:100px'></div></td>\n\t</tr>\n\t\n</table>{$storages}\n\t\t\t\n" . "<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjaxTiny('squid-front-end-status','{$page}?squid-front-end-status=yes');") . "</div>\n<script>\nvar g = new JustGage({\n\tid: 'squid-1-{$t}',\n\tvalue: {$squid5mn["cpu_usage"]},\n\tmin: 0.1,\n\tmax: 100,\n\ttitle: 'Proxy CPU Usage',\n\tlabel: '%',\n\tlevelColorsGradient: true\n});\n\t\nvar g2 = new JustGage({\n\tid: 'squid-2-{$t}',\n\tvalue: {$squid5mn["client_http.requests"]},\n\tmin: 0.1,\n\tmax: {$HttpRequests},\n\ttitle: 'HTTP {$requests}/{$second}',\n\tlabel: 'RQ/s',\n\tlevelColorsGradient: true\n});\n\nvar g3 = new JustGage({\n\tid: 'squid-3-{$t}',\n\tvalue: {$squid5mn["server.all.kbytes_in"]},\n\tmin: 0,\n\tmax: {$server_all_kbytes_in},\n\ttitle: '{$server_all_kbytes_in_text}',\n\tlabel: 'KB',\n\tlevelColorsGradient: true\n\t});\nvar g4 = new JustGage({\n\tid: 'squid-4-{$t}',\n\tvalue: {$squid5mn["server.all.kbytes_out"]},\n\tmin: 0,\n\tmax: {$server_all_kbytes_out},\n\ttitle: '{$server_all_kbytes_out_text}',\n\tlabel: 'KB',\n\tlevelColorsGradient: true\n});\n" . @implode("\n", $js) . "\nif(document.getElementById('squid-rttrqs-status')){\n\tLoadAjaxSilent('squid-rttrqs-status','admin.index.loadavg.squidrtt.php');\n}\n\n\t</script>\n\t");
}