本文整理汇总了PHP中FormatNumber函数的典型用法代码示例。如果您正苦于以下问题:PHP FormatNumber函数的具体用法?PHP FormatNumber怎么用?PHP FormatNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FormatNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: table
function table()
{
$page = CurrentPageName();
$tpl = new templates();
$t = time();
$explain_section = $tpl->_ENGINE_parse_body("{routes_center_explain}");
$t = time();
$type = $tpl->_ENGINE_parse_body("{type}");
$gateway = $tpl->_ENGINE_parse_body("{gateway}");
$items = $tpl->_ENGINE_parse_body("{items}");
$nic = $tpl->javascript_parse_text("{nic}");
$order = $tpl->javascript_parse_text("{order}");
$title = $tpl->javascript_parse_text("{boots}");
$ttl = $tpl->_ENGINE_parse_body("{ttl}");
$date = $tpl->_ENGINE_parse_body("{date}");
$subject = $tpl->_ENGINE_parse_body("{infos}");
$q = new mysql();
$sys_alerts = FormatNumber($q->COUNT_ROWS("last_boot", "artica_events"));
// $sql="INSERT INTO nic_routes (`type`,`gateway`,`pattern`,`zmd5`,`nic`)
// VALUES('$type','$gw','$pattern/$cdir','$md5','$route_nic');";
$buttons = "\n\tbuttons : [\n\t{name: '{$new_route}', bclass: 'add', onpress : Add{$t}},\n\t{name: '{$test_a_route}', bclass: 'Search', onpress : TestRoute{$t}},\n\t{name: '{$apply}', bclass: 'apply', onpress : Apply{$t}},\n\n\n\t],";
$buttons = null;
$html = "\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\n\t<script>\n\tvar rowid=0;\n\t\$(document).ready(function(){\n\t\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?search=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$date}', name : 'zDate', width : 450, sortable : true, align: 'left'},\n\t{display: '{$subject}', name : 'subject', width : 341, sortable : true, align: 'left'},\n\t{display: '{$ttl}', name : 'load', width : 312, sortable : true, align: 'right'},\n\t\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$date}', name : 'zDate'},\n\t{display: '{$subject}', name : 'subject'},\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}:: {$sys_alerts}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 450,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\n\nfunction Add{$t}(){\nLoadjs('{$page}?route-js=yes&zmd5=&t={$t}');\n}\nfunction TestRoute{$t}(){\n\tLoadjs('{$page}?test-route-js=yes');\n}\n\nfunction Apply{$t}(){\n\tLoadjs('network.restart.php?t={$t}')\n\n}\n\nvar x_DansGuardianDelGroup= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\t\$('#row'+rowid).remove();\n}\n\nfunction DansGuardianDelGroup(ID){\n\tif(confirm('{$do_you_want_to_delete_this_group} ?')){\n\t\trowid=ID;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Delete-Group', ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DansGuardianDelGroup);\n\t}\n}\n</script>\n";
echo $html;
}
示例3: status
function status(){
$q=new mysql();
$page=CurrentPageName();
$tpl=new templates();
$total=FormatNumber($q->COUNT_ROWS("dansguardian_community_categories","artica_backup"),0,'.',' ',3);
$sql="SELECT count(*) as tcount FROM `dansguardian_sitesinfos` WHERE `dbpath` = ''";
$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
$pp=Paragraphe("64-categories.png",$ligne["tcount"]." {websites_not_categorized}",
"{websites_not_categorized_text}","javascript:Loadjs('squid.visited.php')",null,300,76);
$html="
<table style='width:100%'>
<tr>
<td valign='top'><img src='img/webfilter-community-128.png'></td>
<td valign='top' width=99%'>
<div class=explain>{APP_WEBFILTER_COMMUNITY_EXPLAIN}</div>
<div style='font-size:14px;font-weight:bold'>$total {websites} ({community})</div>
$pp
</td>
</tr>
</table>
";
echo $tpl->_ENGINE_parse_body($html);
}
示例4: 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);
}
示例5: popup
function popup()
{
$tpl = new templates();
$page = CurrentPageName();
$q = new postgres_sql();
$ligne = pg_fetch_assoc($q->QUERY_SQL("SELECT * FROM suricata_sig WHERE signature='{$_GET["sig"]}'"));
$ligne2 = pg_fetch_assoc($q->QUERY_SQL("SELECT SUM(xcount) as tcount FROM suricata_events WHERE signature='{$_GET["sig"]}'"));
$sum = FormatNumber($ligne2["tcount"]);
$t = time();
$html = "<div style='font-size:30px;margin-bottom:8px;'>{signature} {ID} <strong>{$_GET["sig"]}</strong></div>\n\t<div style='font-size:18px;margin-bottom:30px;border-top:1px solid #CCCCCC;padding-top:8px'><i>{$ligne["description"]}</i></div>\n\t<div style='width:98%' class=form>\n\t\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{events}:</td>\n\t\t\t<td style='font-size:22px'>{$sum}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{enabled}:</td>\n\t\t\t<td>" . Field_checkbox_design("enabled-{$t}", 1, $ligne["enabled"]) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>" . texttooltip("{firewall}", "{suricata_firewall}") . ":</td>\n\t\t\t<td>" . Field_checkbox_design("firewall-{$t}", 1, $ligne["firewall"]) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 30) . "</td>\n\t</table>\n\t</div>\t\t\t\n\t<script>\n\tvar xSave{$t}=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\t\$('#TABLE_SURICATA_EVENTS').flexReload();\n\t\tYahooWinHide();\n\t\tLoadjs('suricata.progress.php');\n\t}\t\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tvar enabled=0;\n\t\tvar firewall=0;\n\t\tif(document.getElementById('enabled-{$t}').checked){enabled=1;}\n\t\tif(document.getElementById('firewall-{$t}').checked){firewall=1;}\n\t\tXHR.appendData('enabled',enabled);\n\t\tXHR.appendData('firewall',firewall);\n\t\tXHR.appendData('sig','{$_GET["sig"]}');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\t\n\n\t</script>\t\t\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例6: popup
function popup()
{
$tpl = new templates();
$page = CurrentPageName();
$sock = new sockets();
$ini = new Bs_IniHandler();
$users = new usersMenus();
$sock->getFrameWork("clamav.php?sigtool=yes");
$bases = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/ClamAVBases"));
if (count($bases) > 0) {
$DBS[] = "<table style='width:100%; -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;border:2px solid #CCCCCC'>\n\t\t\t<tr style='height:80px'>\n\t\t\t\t\t\t<td style='font-size:26px' colspan=2><strong>{clamav_antivirus_patterns_status}</td>\n\t\t\t\t</tr>\n\t\t\t</table>";
while (list($db, $MAIN) = each($bases)) {
$DBS[] = "\n\t\t\t<table style='width:100%;margin-top:15px;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;border:2px solid #CCCCCC'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:24px' colspan=2><strong>{$db}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:22px' class=legend>{date}:</td>\n\t\t\t\t<td style='font-size:22px'><strong>{$MAIN["zDate"]}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:22px' class=legend>{version}:</td>\n\t\t\t\t<td style='font-size:22px'><strong>{$MAIN["version"]}</strong></td>\n\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:22px' class=legend>{signatures}:</td>\n\t\t\t\t\t<td style='font-size:22px'><strong>" . FormatNumber($MAIN["signatures"]) . "</strong></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t";
}
} else {
$DBS[] = FATAL_ERROR_SHOW_128("{missing_clamav_pattern_databases}");
}
$DBS[] = "\n\t<table style='width:100%'>\n\t<tr style='height:80px'>\n\t\t<td align='right'><hr>" . button("{update_now}", "Loadjs('clamav.update.progress.php')", 42) . "</td>\n\t</tr>\n\t</table>";
$html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{clamav_antivirus_databases}</div>\t\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top' style='width:600px'>\n\t\t\t\t<div id='FreshClamOptions'></div>\n\t\t\t</td>\n\t\t\t<td valign='top' style='width:600px'>\n\t\t\t" . @implode("\n", $DBS) . "</td>\n\t\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\tLoadAjax('FreshClamOptions','{$page}?FreshClamOptions=yes');\n\t</script>\t\t\t\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例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: BACKUP_EMAIL_BEHAVIOR_DASHBOARD
function BACKUP_EMAIL_BEHAVIOR_DASHBOARD()
{
$tpl = new templates();
$ou = $_SESSION["ou"];
@mkdir("/usr/share/artica-postfix/ressources/web/cache_{$ou}", 0755, true);
$filebackup = "/usr/share/artica-postfix/ressources/web/cache_{$ou}/BACKUP_EMAIL_BEHAVIOR_DASHBOARD";
if (file_time_min_Web($filebackup) > 30) {
$q = new postgres_sql();
$ldap = new clladp();
$domains = $ldap->hash_get_domains_ou($ou);
while (list($domain, $MAIN) = each($domains)) {
$domain = trim(strtolower($domain));
if ($domain == null) {
continue;
}
$FDOMS[] = "domainto='{$domain}'";
$FDOMS2[] = "domainfrom='{$domain}'";
}
$imploded1 = @implode(" OR ", $FDOMS);
$imploded2 = @implode(" OR ", $FDOMS2);
$sql = "select count(*) as tcount, SUM(size) as size FROM backupmsg WHERE ({$imploded1}) OR ({$imploded2})";
$ligne = pg_fetch_array($q->QUERY_SQL($sql));
@unlink($filebackup);
@file_put_contents($filebackup, serialize($ligne));
}
$ligne = unserialize(@file_get_contents($filebackup));
$tcount = $ligne["tcount"];
$size = $ligne["size"];
if ($tcount == 0) {
echo $tpl->_ENGINE_parse_body("0 {message}");
return;
}
$size = FormatBytes($size / 1024);
$tcount = FormatNumber($tcount);
echo $tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoBackupMails()\"\n\t\tstyle='text-decoration:underline'>{$tcount} {messages}</a> ({$size})");
}
示例9: EditCustomerGroup
/**
* EditCustomerGroup
* Load up a customer group's details for editing. Why am I working on this at 11:10pm on a Saturday night?! - Mitch
*
* @param string $MsgDesc The optional message to display
* @param string $MsgStatus The optional status of the message
* @param bool $PreservePost TRUE to use the REQUEST variable, FALSE to read from the database. Default is FALSE
* @return Void
*/
private function EditCustomerGroup($MsgDesc = "", $MsgStatus = "", $PreservePost = false)
{
$groupId = 0;
if (isset($_GET['groupId']) && is_numeric($_GET['groupId'])) {
$groupId = (int)$_GET['groupId'];
}
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
if ($PreservePost) {
$data = $this->GetCustomerGroupData(0);
} else {
$data = $this->GetCustomerGroupData($groupId);
}
if (!$data) {
return $this->ManageCustomerGroups();
}
$GLOBALS['GroupId'] = $groupId;
$GLOBALS['GroupName'] = isc_html_escape($data['groupname']);
if ($data['discountmethod'] == 'percent') {
$GLOBALS['Discount'] = FormatNumber($data['discount']);
}
else {
$GLOBALS['Discount'] = FormatPrice($data['discount'], false, false);
}
if ($data['discountmethod'] == '') {
$data['discountmethod'] = 'price';
}
$GLOBALS['StoreDiscountMethod' . ucfirst(isc_strtolower($data['discountmethod']))] = 'selected';
if ($data['isdefault']) {
$GLOBALS['IsDefault'] = "checked='checked'";
}
$access_cats = array();
if ($data['categoryaccesstype'] == "all") {
$GLOBALS['AccessAllCategories'] = "checked='checked'";
$GLOBALS['HideAccessCategories'] = "none";
$GLOBALS['HideAccessCatLinks'] = "none";
}
$GLOBALS['FormAction'] = "editCustomerGroup2";
$GLOBALS['Title'] = GetLang("EditACustomerGroup");
// Reuse them for the categories which the group has access to and make them all selected by default
$GLOBALS['AccessCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($data['accesscategorieslist'], "<option %s value='%d'>%s</option>", 'selected="selected"', "", false);
$GLOBALS['HiddenDiscounts'] = $this->buildHiddenDiscountFields($data['discountlist'], $products, $categories);
$GLOBALS['HideNoCatgeory'] = '';
$GLOBALS['HideNoProduct'] = '';
$GLOBALS['HideCategoryGridContainer'] = '';
$GLOBALS['HideProductGridContainer'] = '';
if (empty($categories['items'])) {
$GLOBALS['HideCategoryGridContainer'] = 'none';
} else {
$GLOBALS['HideNoCatgeory'] = 'none';
}
if (empty($products['items'])) {
$GLOBALS['HideProductGridContainer'] = 'none';
} else {
$GLOBALS['HideNoProduct'] = 'none';
}
/**
* Add in the category and product items
*/
$GLOBALS['DiscountsPerPage'] = ISC_GROUPDISCOUNT_ITEMS_PER_PAGE;
$GLOBALS['CategoryDataGrid'] = $this->ManageGroupDiscountGrid($categories);
$GLOBALS['ProductDataGrid'] = $this->ManageGroupDiscountGrid($products);
if (GetConfig('CurrencyLocation') == 'right') {
$GLOBALS['AmountPrefix'] = '';
$GLOBALS['AmountPostfix'] = GetConfig('CurrencyToken');
} else {
$GLOBALS['AmountPrefix'] = GetConfig('CurrencyToken');
$GLOBALS['AmountPostfix'] = '';
}
$this->template->display('customers.group.form.tpl');
}
示例10: table3
function table3()
{
$page = CurrentPageName();
$q = new postgres_sql();
$tpl = new templates();
$zmd5 = $_GET["zmd5"];
if ($zmd5 == null) {
echo "alert('no key sended');UnlockPage();";
die;
}
$table = "{$zmd5}report";
$results = $q->QUERY_SQL("SELECT SUM(rqs) as rqs, category FROM \"{$table}\" GROUP BY category order by rqs DESC LIMIT 15");
$html[] = "<table style='width:100%'>";
$html[] = $tpl->_ENGINE_parse_body("<tr><th style='font-size:18px;padding:8px'>{categories}</td>\n\t\t\t<th style='font-size:18px'>{hits}</th></tr>");
while ($ligne = @pg_fetch_assoc($results)) {
$siteENC = urlencode($ligne["category"]);
$href = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('squid.statistics.report.category.php?from-zmd5={$zmd5}&USER_DATA={$siteENC}');\"\n\t\tstyle='font-size:18px;text-decoration:underline'>";
$site = $ligne["category"];
if ($site == null) {
$site = "unknown";
}
$size = FormatNumber($ligne["rqs"]);
//$js="Loadjs('squid.statistics.report.member.php?from-zmd5=$zmd5&USER_DATA=".urlencode($site)."');";
$html[] = "<tr><td style='font-size:18px;padding:8px'>{$href}{$site}</a></td>\n\t\t<td style='font-size:18px'>" . FormatNumber($size) . "</td></tr>";
}
$html[] = "</table>";
$html[] = "<script>";
$html[] = "Loadjs('{$page}?graph4=yes&zmd5={$_GET["zmd5"]}&t={$_GET["t"]}')";
$html[] = "</script>";
echo @implode("", $html);
}
示例11: search
function search()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql_squid_builder();
$t = $_GET["t"];
$total = 0;
if ($q->COUNT_ROWS("dashboard_user_day", "artica_backup") == 0) {
json_error_show("no data [" . __LINE__ . "]", 0);
}
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
$table = "(SELECT SUM(RQS) as RQS, SUM(SIZE) as SIZE,USER FROM dashboard_user_day GROUP BY USER ) as t";
$searchstring = string_to_flexquery();
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
if (!is_numeric($rp)) {
$rp = 100;
}
$pageStart = ($page - 1) * $rp;
if ($pageStart < 0) {
$pageStart = 0;
}
$limitSql = "LIMIT {$pageStart}, {$rp}";
$sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$results = $q->QUERY_SQL($sql, "artica_events");
$total = mysql_num_rows($results);
if (!$q->ok) {
json_error_show($q->mysql_error . "<br>{$sql}", 0);
}
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
$CurrentPage = CurrentPageName();
if (mysql_num_rows($results) == 0) {
json_error_show("no data");
}
$searchstring = string_to_flexquery();
$results = $q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
json_error_show($q->mysql_error . "<br>{$sql}");
}
$q1 = new mysql();
$t = time();
$fontsize = 22;
$span = "<span style='font-size:{$fontsize}px'>";
$IPTCP = new IP();
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$zmd5 = $ligne["zmd5"];
$member_value = trim($ligne["USER"]);
$hits = FormatNumber($ligne["RQS"]);
$size = FormatBytes($ligne["SIZE"] / 1024);
$ahref = null;
$member_assoc = null;
$graph = imgtootltip("graph2-48.png", "{statistics}", "Loadjs('{$MyPage}?graph-js=yes&uid=" . urlencode($member_value) . "')");
$graph2 = imgtootltip("graphs-48.png", "{statistics}", "Loadjs('{$MyPage}?graph2-js=yes&uid=" . urlencode($member_value) . "')");
if ($IPTCP->IsvalidMAC($member_value)) {
$mac_encoded = urlencode($member_value);
$uid = $q->MacToUid($member_value);
if ($uid != null) {
$member_assoc = " ({$uid})";
}
$ahref = "<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$mac_encoded}');\"\n\t\t\t\t\tstyle='font-size:{$fontsize};text-decoration:underline'>";
}
$data['rows'][] = array('id' => $member_value, 'cell' => array("{$span}{$ahref}{$member_value}</a>{$member_assoc}</span>", "{$span}{$hits}</a></span>", "{$span}{$size}</a></span>", "<center>{$graph}</center>", "<center>{$graph2}</center>"));
}
echo json_encode($data);
}
示例12: community_status
function community_status(){
$page=CurrentPageName();
$tpl=new templates();
$q=new mysql_squid_builder();
$all_count=FormatNumber($q->COUNT_ROWS("dansguardian_community_categories","artica_backup"),0,'.',' ',3);
$artica_community=Paragraphe('webfilter-community-64.png','{community}','{webfilter_community_text}',"javascript:Loadjs('webfilter.community.php')");
if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
$html="
<table style='width:100%'>
<tr>
<td width=99% valign='top'>
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
<thead class='thead'>
<tr>
<th colspan=2></th>
<th> </th>
</tr>
</thead>
<tbody class='tbody'>
<tr class=$classtr>
<td style='font-size:14px' colspan=2><i>{websites_number}:</i> <strong>$all_count</i></td>
</tr>
";
$array=unserialize(@file_get_contents("ressources/logs/web.community.db.status.txt"));
while (list ($num, $ligne) = each ($array) ){
if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
$f=FormatNumber($ligne,0,'.',' ',3);
$html=$html."<tr class=$classtr>
<td style='font-size:14px;text-align:right' width=1% nowrap><strong>$num:</td>
<td style='font-size:14px' width=99%><strong>$f</strong></td>
</tr>";
}
$html=$html."</table>
</td>
<td valign='top' width=1%>$artica_community</td>
</tr>
</table>
";
echo $tpl->_ENGINE_parse_body($html);
}
示例13: category_list
//.........这里部分代码省略.........
}
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
$searchstring = string_to_flexquery();
if ($searchstring != null) {
$sql = "SELECT COUNT(*) as TCOUNT FROM `webfilters_categories_caches` WHERE 1 {$FORCE_FILTER} {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
$data['rows'][] = array('id' => $ligne[time()], 'cell' => array($q->mysql_error, "", "", ""));
json_encode($data);
return;
}
$total = $ligne["TCOUNT"];
writelogs("{$sql} = {$total} rows", __FUNCTION__, __FILE__, __LINE__);
} else {
$sql = "SELECT COUNT(*) as TCOUNT FROM `webfilters_categories_caches` WHERE 1 {$FORCE_FILTER}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
$data['rows'][] = array('id' => $ligne[time()], 'cell' => array($q->mysql_error, "", "", ""));
json_encode($data);
return;
}
$total = $ligne["TCOUNT"];
}
if ($OnlyEnabled) {
$limitSql = null;
}
$sql = "SELECT * FROM `webfilters_categories_caches` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
$data['rows'][] = array('id' => $ligne[time()], 'cell' => array($q->mysql_error, "", "", ""));
json_encode($data);
return;
}
$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, "", "", ""));
}
$items = $tpl->_ENGINE_parse_body("{items}");
$compile = $tpl->_ENGINE_parse_body("{compile}");
$catz = new mysql_catz();
while ($ligne = mysql_fetch_assoc($results)) {
if ($ligne["picture"] == null) {
$ligne["picture"] = "20-categories-personnal.png";
}
$category_table = "category_" . $q->category_transform_name($ligne['categorykey']);
$category_table_elements = $q->COUNT_ROWS($category_table);
$DBTXT = array();
$database_items = null;
if ($category_table_elements > 0) {
$category_table_elements = FormatNumber($category_table_elements);
$DBTXT[] = "<a href=\"javascript:blurt();\" OnClick=\"javascript:Loadjs('squid.categories.php?category=" . urlencode($ligne['categorykey']) . "',true)\"\n\t\t\tstyle='font-size:11px;font-weight:bold;text-decoration:underline'>{$category_table_elements}</a> {$items}";
$DBTXT[] = "<a href=\"javascript:blurt();\" OnClick=\"javascript:Loadjs('ufdbguard.compile.category.php?category=" . urlencode($ligne['categorykey']) . "',true)\"\n\t\t\tstyle='font-size:11px;font-weight:bold;text-decoration:underline'>{$compile}</a>";
}
$ligneTLS = mysql_fetch_array($q->QUERY_SQL("SELECT websitesnum FROM univtlse1fr WHERE category='{$ligne['categorykey']}'"));
$category_table_elements_tlse = $ligneTLS["websitesnum"];
if ($category_table_elements_tlse > 0) {
$category_table_elements_tlse = FormatNumber($category_table_elements_tlse);
$DBTXT[] = "{$category_table_elements_tlse} Toulouse University {$items}";
}
$catz = new mysql_catz();
$category_table_elements_artica = $catz->COUNT_ROWS($category_table);
if ($category_table_elements_artica > 0) {
$category_table_elements_artica = FormatNumber($category_table_elements_artica);
$DBTXT[] = "{$category_table_elements_artica} Artica {$items} <i style='font-size:10px;font-weight:normal'>{$text_license}</i>";
}
if (count($DBTXT) > 0) {
$database_items = "<span style='font-size:11px;font-weight:bold'>" . @implode(" | ", $DBTXT) . "</span>";
}
$img = "img/{$ligne["picture"]}";
$val = 0;
if ($cats[$ligne['categorykey']]) {
$val = 1;
}
if ($OnlyEnabled) {
if ($val == 0) {
continue;
}
}
$disable = Field_checkbox("cats_{$_GET['RULEID']}_{$_GET['bltype']}_{$ligne['categorykey']}", 1, $val, "Loadjs('{$MyPage}?category-enable-js={$ligne['categorykey']}&mainid={$_GET["mainid"]}&bltype={$_GET["bltype"]}')");
$ligne['description'] = utf8_encode($ligne['description']);
$data['rows'][] = array('id' => $ligne['categorykey'], 'cell' => array("<img src='{$img}'>", "{$js}{$ligne['categorykey']}</a>", $ligne['description'] . "<br>\n\t\t\t\t{$database_items}", $disable));
}
echo json_encode($data);
}
示例14: snort_query_search
function snort_query_search(){
$page=CurrentPageName();
$tpl=new templates();
include_once(dirname(__FILE__) . '/ressources/class.rtmm.tools.inc');
$limit=100;
if(isset($_GET["zoom"])){$limit=200;}
if(strlen($_GET["snort-query-search"])>1){
$search=$_GET["snort-query-search"];
$search="*$search*";
$search=str_replace("*","%",$search);
$search=str_replace("%%","%",$search);
}
if(is_numeric($_GET["prio"])){$prio=" AND priority={$_GET["prio"]}";}
if(strlen($_GET["classification"])>5){$classification=" AND classification='{$_GET["classification"]}'";}
if($search<>null){
$quersearch="AND (hostname LIKE '$search'$prio$classification)
OR (ipaddr LIKE '$search'$prio$classification)
OR (port LIKE '$search'$prio$classification)
OR (infos LIKE '$search'$prio$classification)";
}else{
$quersearch="$classification$prio";
}
$sql="SELECT * FROM snort WHERE 1 $quersearch ORDER BY zDate DESC LIMIT 0,$limit";
$q=new mysql();
$results=$q->QUERY_SQL($sql,"artica_events");
if(!$q->ok){echo "<H2>$q->mysql_error</H2>";}
$events=$q->COUNT_ROWS("snort","artica_events");
$events=FormatNumber($events,0,'.',' ',3);
$html="
<p> </p>
<div style='text-align:right'><i style='font-size:13px;font-weight:bold'>$events {events} | {your_ip_address}:{$_SERVER["REMOTE_ADDR"]} (".gethostbyaddr($_SERVER["REMOTE_ADDR"]).") </i></div>
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
<thead class='thead'>
<tr>
<th width=1%> </th>
<th width=1%>{date}</th>
<th>PRIO</th>
<th>{hostname} $search</th>
<th>{proto}</th>
</tr>
</thead>
<tbody class='tbody'>";
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
if($ligne["success"]==1){$img='fleche-20-right.png';}else{$img='fleche-20-red-right.png';}
$flag=imgtootltip(GetFlags($ligne["country"]),$ligne["country"],null);
$html=$html."
<tr class=$classtr>
<td style='font-size:12px;font-weight:bold' width=1%>$flag</td>
<td style='font-size:12px;font-weight:bold' width=1% nowrap>{$ligne["zDate"]}</a></td>
<td style='font-size:12px;font-weight:bold' width=1% align='center'>{$ligne["priority"]}</a></td>
<td style='font-size:12px;font-weight:bold' nowrap>{$ligne["hostname"]} [{$ligne["ipaddr"]}]</a></td>
<td style='font-size:12px;font-weight:bold' nowrap>{port}:{$ligne["port"]} [{$ligne["proto"]}]</a></td>
</tr>
<tr class=$classtr>
<td> </td>
<td colspan=4 style='font-size:12px'>({$ligne["classification"]}) <i>{$ligne["infos"]}</i></td>
</tr>";
}
$html=$html."</table>\n";
echo $tpl->_ENGINE_parse_body($html);return;
}
示例15: www_requests_search
function www_requests_search()
{
$page = CurrentPageName();
$tpl = new templates();
$t = time();
$boot = new boostrap_form();
$search = string_to_flexquery("requests-search");
$xtime = $_GET["xtime"];
$dansguardian_table = "dansguardian_events_" . date("Ymd", $xtime);
$q = new mysql_squid_builder();
if (!$q->TABLE_EXISTS($dansguardian_table)) {
echo "<p class=text-error>No table «{$dansguardian_table}» for {$_GET["uid"]}</p>";
return;
}
$sql = "SELECT * FROM (SELECT hits as hits,QuerySize as size,uri,HOUR(zDate) as `hour`,\n\tsitename FROM `{$dansguardian_table}` WHERE uid='{$_GET["uid"]}'\n\tAND sitename LIKE '%{$_GET["familysite"]}' \n\tAND LENGTH(uri)>4\n\tORDER BY zDate LIMIT 0,250) as t WHERE 1 {$search}";
$results = $q->QUERY_SQL($sql);
$_GET["uid"] = urlencode($_GET["uid"]);
if (!$q->ok) {
echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>";
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$size = FormatBytes($ligne["size"] / 1024);
$hits = FormatNumber($ligne["hits"]);
$link = $boot->trswitch("blur()");
$date = $ligne["hour"];
$uri = $ligne["uri"];
$urilenth = strlen($ligne["uri"]);
if ($urilenth > 80) {
$uri = substr($uri, 0, 77) . "...";
}
$tr[] = "\n\t<tr id='{$id}'>\n\t\t<td {$link} nowrap><i class='icon-clock'></i> {$date}H</td>\n\t\t<td {$link}><i class='icon-globe'></i> <a href=\"{$ligne["uri"]}\" target=_new>{$uri}</a></a></td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$size}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$hits}</td>\n\t</tr>";
}
echo $tpl->_ENGINE_parse_body("\n\t\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{hour}</th>\n\t\t\t\t\t<th>{url}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}