示例#1
0
function recTablesTotal($tables)
{
    $total = 0;
    $t = explode(',', $tables);
    for ($i = 0; $i < count($t); $i++) {
        $total += count_items($t[$i]);
    }
    return $total;
}
示例#2
0
function create_lang_switcher($lang)
{
    if (count_items("languages") > 1) {
        echo "<div class='lang_switcher' >" . switch_Lang . " " . createComboBoxScript("languages", "lang", "lang_name", $lang, "lang", "", "", "window.location='?lang='+this.value") . "</div>";
    }
}
示例#3
0
    }
} else {
    //ERROR?
    $protection_mode = "ERROR";
}
$smarty->assign("protection", $protection_mode);
if (isset($_SESSION["firsttime"])) {
    $smarty->assign("firsttime", true);
} else {
    $smarty->assign("firsttime", false);
}
$smarty->assign("lang", $lang);
//	$smarty->assign("enable_false_negative_management", "T");
//	$smarty->assign("showmail","T");
$smarty->assign("maxitemid", $maxitemid);
$smarty->assign("msid", $msid);
$smarty->assign("hamcount", $hamcount);
$smarty->assign("spamcount", $spamcount);
$smarty->assign("bannedcount", $bannedcount);
$smarty->assign("headercount", $headercount);
$smarty->assign("viruscount", $viruscount);
$smarty->assign("hamtext", sprintf($lang['text_cache_ham'], $hamcount, "list-cache.php{$msid}cache_type=ham"));
$smarty->assign("spamtext", sprintf($lang['text_cache_spam'], $spamcount, "list-cache.php{$msid}cache_type=spam"));
$smarty->assign("virustext", sprintf($lang['text_cache_virus'], $viruscount, "list-cache.php{$msid}cache_type=virus"));
$smarty->assign("bannedtext", sprintf($lang['text_cache_banned'], $bannedcount, "list-cache.php{$msid}cache_type=attachment"));
$smarty->assign("headertext", sprintf($lang['text_cache_header'], $headercount, "list-cache.php{$msid}cache_type=header"));
$smarty->assign("spam_for_user", count_items($euid, "spam"));
$smarty->assign("virus_for_user", count_items($euid, "virus"));
$smarty->assign("spam_for_system", count_items(0, "spam"));
$smarty->assign("virus_for_system", count_items(0, "virus"));
$smarty->display("welcome.tpl");
示例#4
0
function get_item_row($user_id, $type)
{
    global $dbh;
    global $lang;
    $bandwidth_cost = get_config_value("bandwidth_cost");
    $items = count_items($user_id, $type);
    if ($items > 0) {
        $ret = array();
        $ret['items'] = $items;
        $total_mail = count_total_mail($user_id);
        if ($total_mail > 0) {
            $ret['pct'] = sprintf("%.1f%%", 100 * $items / $total_mail);
        } else {
            $ret['pct'] = "0.0%";
        }
        $item_size = total_item_size($user_id, $type);
        $item_days = count_item_days($user_id, $type);
        if ($item_days > 0) {
            if ($item_days >= 1) {
                $ret['rate'] = sprintf("%.1f", $items / $item_days);
                $bandwidth_per_day = $item_size / $item_days;
            } else {
                $ret['rate'] = $items;
                $bandwidth_per_day = $item_size;
            }
        } else {
            $ret['rate'] = "-";
            $bandwidth_per_day = 0;
        }
        if ($type == "ham" || $type == "spam" || $type == "suspected_spam" || $type == "suspected_ham" || $type == "fp" || $type == "fn") {
            $ret['minscore'] = sprintf("%.3f", lowest_item_score($user_id, $type));
            $ret['maxscore'] = sprintf("%.3f", highest_item_score($user_id, $type));
            $ret['avgscore'] = sprintf("%.3f", total_item_score($user_id, $type) / $items);
        } else {
            $ret['minscore'] = "-";
            $ret['maxscore'] = "-";
            $ret['avgscore'] = "-";
        }
        $ret['minsize'] = sprintf("%.1f", smallest_item_size($user_id, $type) / KILOBYTE);
        $ret['maxsize'] = sprintf("%.1f", largest_item_size($user_id, $type) / KILOBYTE);
        $ret['avgsize'] = sprintf("%.1f", $item_size / $items / KILOBYTE);
        if ($bandwidth_per_day > 0) {
            $ret['bandwidth'] = sprintf("%.2f", $bandwidth_per_day / MEGABYTE);
        } else {
            $ret['bandwidth'] = "-";
        }
        $ret['cost'] = sprintf("%.3f", $bandwidth_cost * $bandwidth_per_day / GIGABYTE);
    } else {
        $ret = array('items' => "-", 'rate' => "-", 'minscore' => "-", 'maxscore' => "-", 'avgscore' => "-", 'minsize' => "-", 'maxsize' => "-", 'avgsize' => "-", 'bandwidth' => "-", 'cost' => "-", 'pct' => "-");
    }
    return $ret;
}
<?php

$inc_path = $_SERVER['DOCUMENT_ROOT'] . "/basket/inc/";
require_once $inc_path . 'cart_functions.php';
$count = count_items();
if (isset($page_name) && $page_name == 'cart') {
    $body_tag = '<body onload="loadCart();">';
} else {
    $body_tag = '<body>';
}
print $body_tag;
?>
			
	<header class="animated fadeIn"> <!-- Start of header -->
		<section id="logo-container">
			<a href="/index.php">
				<img id="logo" src="/images/housestyle/pixel.gif" alt="logo" title="Home">
			</a>
		</section>
		<a href="/basket/">
			<section id="cart-container">
				<p class="cart-num"><?php 
print $count;
?>
</p>
				<img src="/images/housestyle/cart-icon.png" width="30"/>
				<p>Basket</p>
			</section>
		</a>	
		<nav> <!-- Start of Nav -->
			<ul id="globalnav">