コード例 #1
0
ファイル: monitor.php プロジェクト: jeremy-cayrasso/dtc
function drawAdminMonitor()
{
    global $pro_mysql_client_table;
    global $pro_mysql_admin_table;
    global $conf_mysql_db;
    global $adm_realpass;
    global $adm_pass;
    global $adm_random_pass;
    $out = "";
    // For each clients
    $q = "SELECT * FROM {$pro_mysql_client_table} WHERE 1 ORDER BY familyname,christname";
    $r = mysql_query($q) or die("Cannot query: \"{$q}\" !" . mysql_error() . " line " . __LINE__ . " in file " . __FILE__);
    $nr = mysql_num_rows($r);
    $out .= '<br><table border="1" width="100%" height="1" cellpadding="1" cellspacing="1">';
    $out .= "<tr><td><b>" . _("User") . "</b></td><td><b>" . _("Transfer") . " / " . _("BW Quota") . "</b></td><td><b>" . _("Transfer per month") . "</b></td><td><b>" . _("Disk usage") . " / " . _("Quota") . "</b></td></tr>";
    $total_box_transfer = 0;
    $total_box_hits = 0;
    for ($i = 0; $i < $nr; $i++) {
        $ar = mysql_fetch_array($r);
        $transfer = 0;
        $total_hits = 0;
        $du = 0;
        // make sure we are selecting the correct DB
        // there is a condition where we have lost the link to the main DB
        // this may hide another bug, but at least it will show things to the user
        mysql_select_db($conf_mysql_db);
        // For each of it's admins
        $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE id_client='" . $ar["id"] . "';";
        $r2 = mysql_query($q2) or die("Cannot query: \"{$q2}\" !" . mysql_error() . " line " . __LINE__ . " in file " . __FILE__);
        $nr2 = mysql_num_rows($r2);
        $admin = array();
        $admin_stats = array();
        for ($j = 0; $j < $nr2; $j++) {
            $ar2 = mysql_fetch_array($r2);
            $adm_realpass = $ar2["adm_pass"];
            $adm_pass = $ar2["adm_pass"];
            $adm_random_pass = $ar2["adm_pass"];
            $oneadmin = fetchAdmin($ar2["adm_login"], $ar2["adm_pass"]);
            $admin_stats = fetchAdminStats($oneadmin);
            $admin = array_merge($admin, $oneadmin);
            if (isset($admin_stats["total_transfer"])) {
                $transfer += $admin_stats["total_transfer"];
            }
            if (isset($admin_stats["total_du"])) {
                $du += $admin_stats["total_du"];
            }
            if (isset($admin_stats["total_hit"])) {
                $hits = $admin_stats["total_hit"];
                $total_hits += $hits;
            }
        }
        if ($i % 2) {
            $back = " bgcolor=\"#000000\" style=\"white-space:nowrap;color:#FFFFFF\" nowrap";
        } else {
            $back = " style=\"white-space:nowrap;\" nowrap";
        }
        $nbr_row = 0;
        if (!isset($admin["vps"])) {
            $nbr_vps = 0;
        } else {
            $nbr_vps = sizeof($admin["vps"]);
            $nbr_row += $nbr_vps;
        }
        if (isset($admin["data"])) {
            $nbr_row += 1;
        }
        if ($nbr_row > 1) {
            $rowspan_entry = "rowspan=\"{$nbr_row}\"";
        } else {
            $rowspan_entry = "";
        }
        // Admin name
        $out .= "<tr><td{$back} {$rowspan_entry}><u>" . $ar["company_name"] . ":</u><br>\n" . $ar["familyname"] . ", " . $ar["christname"] . "</td>";
        if (isset($admin["data"])) {
            // Transfer this month
            $out .= "<td{$back}>" . drawPercentBar($transfer, $ar["bw_quota_per_month_gb"] * 1024 * 1024 * 1024, "no") . "<br>\n" . smartByte($transfer) . " / " . smartByte($ar["bw_quota_per_month_gb"] * 1024 * 1024 * 1024) . " ({$total_hits} hits)</td>";
            // Per month transfer graph
            $out .= "<td{$back}><img width=\"120\" height=\"48\" src=\"bw_per_month.php?cid=" . $ar["id"] . "\"></td>";
            // Share hosing hard disk space
            $out .= "<td{$back}>" . drawPercentBar($du, $ar["disk_quota_mb"] * 1024 * 1024, "no") . "<br>\n" . smartByte($du) . " / " . smartByte($ar["disk_quota_mb"] * 1024 * 1024) . "</td></tr>";
        }
        for ($j = 0; $j < $nbr_vps; $j++) {
            if (isset($admin["data"]) || $j > 1) {
                $out .= "<tr>";
            }
            $out .= "<td {$back} colspan=\"3\">" . $admin["vps"][$j]["vps_server_hostname"] . ":" . $admin["vps"][$j]["vps_xen_name"];
            $out .= "<table border=\"1\" width=\"100%\" height=\"1\" cellpadding=\"1\" cellspacing=\"1\">";
            $out .= "<tr><td {$back}>" . _("Network") . "</td><td {$back}>" . _("HDD") . "</td><td {$back}>" . _("Swap") . "</td><td {$back}>" . _("CPU") . "</td></tr>";
            $out .= "<tr><td {$back}><img width=\"120\" height=\"48\" src=\"vps_stats_network.php?vps_node=" . $admin["vps"][$j]["vps_server_hostname"] . "&vps_name=" . $admin["vps"][$j]["vps_xen_name"] . "\"></td>\n<td {$back}><img width=\"120\" height=\"48\" src=\"vps_stats_hdd.php?vps_node=" . $admin["vps"][$j]["vps_server_hostname"] . "&vps_name=" . $admin["vps"][$j]["vps_xen_name"] . "\"></td>\n<td {$back}><img width=\"120\" height=\"48\" src=\"vps_stats_swap.php?vps_node=" . $admin["vps"][$j]["vps_server_hostname"] . "&vps_name=" . $admin["vps"][$j]["vps_xen_name"] . "\"></td>\n<td {$back}><img width=\"120\" height=\"48\" src=\"vps_stats_cpu.php?vps_node=" . $admin["vps"][$j]["vps_server_hostname"] . "&vps_name=" . $admin["vps"][$j]["vps_xen_name"] . "\"></td>";
            $out .= "</tr>";
            $out .= "</table>";
            $out .= "</td></tr>";
        }
        $total_box_transfer += $transfer;
        $total_box_hits += $total_hits;
        //fetchAdminStats($admin)
    }
    $out .= "</table>";
    $out .= _("Server accounted transfers this month: ") . smartByte($total_box_transfer) . " ({$total_box_hits} hits)";
    return $out;
}
コード例 #2
0
ファイル: my_account.php プロジェクト: jeremy-cayrasso/dtc
function drawAdminTools_MyAccount($admin)
{
    global $PHP_SELF;
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $dtcshared_path;
    global $pro_mysql_pay_table;
    global $pro_mysql_client_table;
    global $pro_mysql_ssl_ips_table;
    global $pro_mysql_product_table;
    global $secpayconf_currency_letters;
    global $cc_code_array;
    get_secpay_conf();
    $frm_start = "<form action=\"{$PHP_SELF}\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n";
    $out = "";
    $id_client = $admin["info"]["id_client"];
    $stats = fetchAdminStats($admin);
    if (isset($_REQUEST["action"]) && $id_client != 0 && $_REQUEST["action"] == "upgrade_myaccount") {
        return draw_UpgradeAccount($admin);
    }
    if (isset($_REQUEST["action"]) && $id_client != 0 && $_REQUEST["action"] == "refund_myaccount") {
        if (isset($_REQUEST["inneraction"]) && $_REQUEST["inneraction"] == "return_from_paypal_refund_my_account") {
            $ze_refund = isPayIDValidated(addslashes($_REQUEST["payid"]));
            if ($ze_refund == 0) {
                $out .= "<font color=\"red\">The transaction failed, please try again!</font>";
                return $out;
            } else {
                $out .= "<font color=\"green\">Funds added to your account!</font><br><br>";
                $q = "UPDATE {$pro_mysql_client_table} SET dollar = dollar+" . $ze_refund . " WHERE id='" . $admin["info"]["id_client"] . "';";
                $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
                $admin["client"]["dollar"] += $ze_refund;
                $out .= "Your account now has \$" . $admin["client"]["dollar"];
                return $out;
            }
        } else {
            $payid = createCreditCardPaiementID(addslashes($_REQUEST["refund_amount"]), $admin["info"]["id_client"], "Refund my account", "no");
            $return_url = $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}" . "&addrlink={$addrlink}&action=refund_myaccount&inneraction=return_from_paypal_refund_my_account&payid={$payid}";
            $paybutton = paynowButton($payid, addslashes($_REQUEST["refund_amount"]), "Refund my account", $return_url);
            $out .= "<b><u>Pay \$" . $_REQUEST["refund_amount"] . " on my account:</u></b><br>";
            $out .= " Please click on the button below to pay your acount.<br><br>{$paybutton}";
            return $out;
        }
    }
    if ($id_client != 0) {
        $client = $admin["client"];
    }
    if (isset($admin["data"])) {
        $out .= "<br><h3>" . _("Transfer and disk usage:") . "</h3>";
        // Draw overall this month usage
        // if there is no usage, set to 0
        if (!isset($stats["total_transfer"])) {
            $stats["total_transfer"] = 0;
        }
        $overall = "<br>" . _("Transfer this month:") . smartByte($stats["total_transfer"]);
        if ($id_client != 0) {
            $bw_quota = $admin["info"]["bandwidth_per_month_mb"] * 1024 * 1024;
            $overall .= " / " . smartByte($bw_quota) . "<br>";
            $overall .= drawPercentBar($stats["total_transfer"], $bw_quota);
        }
        $overall .= "<br>" . _("Total disk usage:") . smartByte($stats["total_du"]);
        if ($id_client != 0 && isset($admin["data"])) {
            $du_quota = $admin["info"]["quota"] * 1024 * 1024;
            $overall .= " / " . smartByte($du_quota) . "<br>";
            $overall .= drawPercentBar($stats["total_du"], $du_quota);
        }
        if ($id_client != 0) {
            $out .= '<table><td>' . $overall . '</td><td><img src="bw_per_month.php?cid=' . $id_client . '&adm_login='******'"></td></tr></table>';
        } else {
            $out .= $overall;
        }
    }
    $out .= "<h3>" . _("Export configuration:") . "</h3>";
    $out .= "<a href=\"?adm_login={$adm_login}&adm_pass={$adm_pass}&action=export_my_account&addrlink=" . $_REQUEST["addrlink"] . "\" target=\"_blank\">" . _("Export all my domains configuration to a file") . "</a>";
    if ($id_client != 0) {
        // If the customer has domains (he could have only a VPS...).
        if (isset($admin["data"])) {
            $out .= "<br><h3>" . _("Your hosting account:") . "</h3>";
            $out .= "<table width=\"100%\" height=\"1\" cellpadding=\"4\" cellspacing=\"0\" border=\"1\">\n<tr>\n\t<td><b>" . _("Storage space") . "</b></td><td><b>" . _("Allowed bandwidth per month") . "</b></td><td><b>" . _("Expiry date") . "</b></td>\n</tr>\n<tr>\n\t<td>" . smartByte($du_quota) . "</td><td>" . smartByte($bw_quota) . "</td><td>" . $admin["info"]["expire"] . "</td>\n</tr>\n</table>";
            if (file_exists($dtcshared_path . "/dtcrm")) {
                $out .= "<br><center>{$frm_start}<input type=\"hidden\" name=\"action\" value=\"upgrade_myaccount\">\n<input type=\"submit\" value=\"" . _("Upgrade my account") . "\">\n</form>";
                $out .= "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"shared\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $admin["info"]["prod_id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"" . _("Renew my account") . "\">\n</form></center><br>";
            }
            $out .= "<h3>" . _("SSL tokens") . "</h3><br>";
            $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE adm_login='******' AND available='no';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n == 0) {
                $out .= _("You currently don't have any SSL tokens.") . "<br><br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">";
                $out .= "<tr><td>" . _("IP address") . "</td><td>" . _("Used by") . "</td><td>" . _("Expire") . "</td><td>" . _("Action") . "</td></tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $nbr_domains = sizeof($admin["data"]);
                    $used_by = "Not used";
                    for ($j = 0; $j < $nbr_domains; $j++) {
                        $nbr_subdomains = sizeof($admin["data"][$j]["subdomains"]);
                        for ($k = 0; $k < $nbr_subdomains; $k++) {
                            if ($admin["data"][$j]["subdomains"][$k]["ssl_ip"] == $a["ip_addr"]) {
                                $used_by = $admin["data"][$j]["subdomains"][$k]["name"] . "." . $admin["data"][$j]["name"];
                            }
                        }
                    }
                    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE heb_type='ssl';";
                    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n = mysql_num_rows($r);
                    if ($n != 1) {
                        $ssl_renew_form = _("No ssl product defined.");
                    } else {
                        $prod = mysql_fetch_array($r);
                        $ssl_renew_form = "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"ssl_renew\">\n<input type=\"hidden\" name=\"ssl_ip_id\" value=\"" . $a["id"] . "\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $prod["id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"Renew SSL IP\"></form>";
                    }
                    $out .= "<tr><td>" . $a["ip_addr"] . "</td><td>{$used_by}</td><td>" . $a["expire"] . "</td><td>{$ssl_renew_form}</td></tr>";
                }
                $out .= "</table><br><br>";
            }
            $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE available='yes';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n == 0) {
                $out .= _("No SSL token available: contact your administrator to request it.") . "<br><br>";
            } else {
                $q = "SELECT * FROM {$pro_mysql_product_table} WHERE heb_type='ssl';";
                $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n = mysql_num_rows($r);
                if ($n != 1) {
                    $out .= _("No ssl product defined.");
                } else {
                    $prod = mysql_fetch_array($r);
                    $out .= "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"ssl\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $prod["id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"Buy an SSL IP\">\n</form></center><br>";
                }
            }
            $out .= "<h3>" . _("Remaining money on my account:") . "</h3>";
            $out .= dtcFormTableAttrs();
            $out .= dtcFormLineDraw(_("Money remaining: "), $client["dollar"] . " {$secpayconf_currency_letters}", 1);
            $out .= dtcFormLineDraw(_("Refund my account:"), "{$frm_start}<input type=\"hidden\" name=\"action\" value=\"refund_myaccount\">\n<input size=\"8\" type=\"text\" name=\"refund_amount\" value=\"\"> {$secpayconf_currency_letters}", 0);
            $out .= dtcFormLineDraw("", submitButtonStart() . _("Add money") . submitButtonEnd() . "</form>", 1);
            $out .= "</table>";
        }
        $out .= "<h3>" . _("Your address (please tell us if the following is not correct):") . "</h3>";
        if ($client["is_company"] == "yes") {
            $out .= _("Company name:") . $client["company_name"] . "<br>";
            $out .= _("VAT / GST number:") . $client["vat_num"] . "<br>";
        }
        $out .= _("First name:") . $client["christname"] . "<br>";
        $out .= _("Family name:") . $client["familyname"] . "<br>";
        $out .= _("Address:") . $client["addr1"] . "<br>";
        $out .= $client["addr2"] . "<br>";
        $out .= _("Zipcode:") . $client["zipcode"] . "<br>";
        $out .= _("City:") . $client["city"] . "<br>";
        $out .= _("State:") . $client["state"] . "<br>";
        $out .= _("Country:") . $cc_code_array[$client["country"]] . "<br>";
        $out .= _("Phone number:") . $client["phone"] . "<br>";
        $out .= _("Fax:") . $client["fax"] . "<br>";
        $out .= _("Email:") . $client["email"] . "<br>";
        $sql = "SELECT SUM(kickback) as kickbacks FROM affiliate_payments WHERE adm_login = '******' and date_paid IS NULL; ";
        $result = mysql_query($sql);
        $row = mysql_fetch_array($result);
        $afftotal = $row["kickbacks"];
        if ($afftotal) {
            global $pro_mysql_completedorders_table;
            $sql = "SELECT * FROM affiliate_payments INNER JOIN {$pro_mysql_completedorders_table} on (affiliate_payments.order_id = {$pro_mysql_completedorders_table}.id) WHERE adm_login = '******' and date_paid IS NULL; ";
            $result = mysql_query($sql);
            $out .= "" . _("Outstanding payments:") . "<br><table><tr><th>" . _("Date") . "</th><th>" . _("Amount") . "</th></tr>";
            while ($row = mysql_fetch_array($result)) {
                $out .= "<tr><td>{$row['date']}</td><td>{$row['kickback']}</td></tr>";
            }
            $out .= "<tr><td></td><th>{$afftotal}</th></tr>";
            $out .= "</table>";
        }
        $out .= "<h3>" . _("Affiliation") . "</h3>";
        $out .= _("If you want to earn money, all you have to do is place a link on your site, pointing to:") . "<pre>https://{$_SERVER['SERVER_NAME']}/dtc/affiliation.php?affiliate={$adm_login}&amp;return=/hosting-vps.html</pre>" . _("You can customize the <code>return</code> variable to redirect the user to any particular landing page that exists on our Web site (though we recommend the product page as per the example).  Then, when one of your visitors clicks on that link to buy a product from us, he will be redirected to our Web site.  Once he buys, you will automatically be credited a payment depending on the product that your visitor bought.");
    } else {
        $out .= "<br>" . _("You do not have a client account, so there is no money in your account.");
    }
    return $out;
}
コード例 #3
0
ファイル: admin_stats.php プロジェクト: jeremy-cayrasso/dtc
function drawAdminTools_AdminStats($admin)
{
    global $adm_login;
    global $conf_mysql_db;
    global $pro_mysql_domain_table;
    global $pro_mysql_acc_http_table;
    global $pro_mysql_acc_ftp_table;
    $out = "";
    $nowrap = " style=\"white-space:nowrap\" nowrap";
    $stats = fetchAdminStats($admin);
    // ["domains"][]["name"]
    //              ["du"]
    //              ["ftp"]
    //              ["http"]
    //              ["smtp"]
    //              ["pop"]
    //              ["total_transfer"]
    // ["total_http"]
    // ["total_ftp"]
    // ["total_email"]
    // ["total_transfer"]
    // ["total_du_domains"]
    // ["db"][]["name"]
    //         ["du"]
    // ["total_db_du"]
    // ["total_du"]
    $id_client = $admin["info"]["id_client"];
    // Print the transfer overall total for this month
    $out .= "<h3>" . _("Total transfered bytes this month:") . "</h3>";
    if (!isset($stats["total_http"])) {
        $stats["total_http"] = 0;
    }
    $out .= "<br>HTTP: " . smartByte($stats["total_http"]) . " " . $stats["total_hit"] . " " . _("hits");
    if (!isset($stats["total_ftp"])) {
        $stats["total_ftp"] = 0;
    }
    $out .= "<br>FTP: " . smartByte($stats["total_ftp"]);
    if (!isset($stats["total_email"])) {
        $stats["total_email"] = 0;
    }
    $out .= "<br>Email: " . smartByte($stats["total_email"]);
    if (!isset($stats["total_transfer"])) {
        $stats["total_transfer"] = 0;
    }
    $out .= "<br>Total: " . smartByte($stats["total_transfer"]);
    if ($id_client != 0) {
        $bw_quota = $admin["info"]["bandwidth_per_month_mb"] * 1024 * 1024;
        $out .= " / " . smartByte($bw_quota) . "<br>";
        $out .= drawPercentBar($stats["total_transfer"], $bw_quota);
    }
    // Print disk usage
    $out .= "<br><h3>" . _("Total disk usage:") . "</h3>";
    if (!isset($stats["total_du_domains"])) {
        $stats["total_du_domains"] = 0;
    }
    $out .= "<br>" . _("Domain name files:") . " " . smartByte($stats["total_du_domains"]);
    if (isset($stats["total_du_db"])) {
        $out .= "<br>" . _("Database files:") . " " . smartByte($stats["total_du_db"]);
    } else {
        $out .= "<br>" . _("Database files:") . " " . smartByte(0);
    }
    $out .= "<br>" . _("Total disk usage:") . " " . smartByte($stats["total_du"]);
    if ($id_client != 0) {
        $du_quota = $admin["info"]["quota"] * 1024 * 1024;
        $out .= " / " . smartByte($du_quota) . "<br>";
        $out .= drawPercentBar($stats["total_du"], $du_quota);
    }
    $out .= "<br><br><h3>" . _("Databases disk usage:") . "</h3>";
    $out .= '<br><table border="1" width="100%" height="1" cellpadding="0" cellspacing="1">';
    $out .= "<tr><td{$nowrap} class=\"dtcDatagrid_table_titles\"><b>" . _("Database Name") . "</b></td><td{$nowrap} class=\"dtcDatagrid_table_titles\"><b>" . _("Disk usage") . "</b></tr>";
    if (isset($stats["db"])) {
        $n = sizeof($stats["db"]);
    } else {
        $n = 0;
    }
    for ($i = 0; $i < $n; $i++) {
        if ($i % 2) {
            $bgcolor = "{$nowrap} ";
        } else {
            $bgcolor = "{$nowrap} class=\"alternatecolorline\" ";
        }
        $out .= "<tr>";
        $out .= "<td{$bgcolor}>" . $stats["db"][$i]["name"] . "</td>";
        $out .= "<td{$bgcolor}>" . smartByte($stats["db"][$i]["du"]) . "</td>";
        $out .= "</tr>";
    }
    $out .= '</table>';
    $out .= "<br><br><h3>" . _("Domain name traffic and disk usage:") . "</h3>";
    $out .= '<br><table border="1" width="100%" height="1" cellpadding="0" cellspacing="1">';
    $out .= "<tr><td class=\"dtcDatagrid_table_titles\"><b>" . _("Domain name") . "</b></td><td{$nowrap} class=\"dtcDatagrid_table_titles\"><b>" . _("Disk usage") . "</b></td>\n\t<td class=\"dtcDatagrid_table_titles\"><b>POP3</b></td><td class=\"dtcDatagrid_table_titles\"><b>IMAP</b></td><td class=\"dtcDatagrid_table_titles\"><b>SMTP</b></td><td class=\"dtcDatagrid_table_titles\"><b>FTP</b></td><td class=\"dtcDatagrid_table_titles\"><b>HTTP</b></td>\n\t<td{$nowrap} class=\"dtcDatagrid_table_titles\"><b>HTTP HITS</b></td>\n\t<td{$nowrap} class=\"dtcDatagrid_table_titles\"><b>" . _("Total traffic") . "</b></td></tr>";
    if (isset($stats["domains"])) {
        for ($ad = 0; $ad < sizeof($stats["domains"]); $ad++) {
            if ($ad % 2) {
                $bgcolor = "{$nowrap} ";
            } else {
                $bgcolor = "{$nowrap} class=\"alternatecolorline\" ";
            }
            $out .= "<tr>";
            $out .= "<td{$bgcolor}>" . $stats["domains"][$ad]["name"] . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["du"]) . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["pop"]) . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["imap"]) . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["smtp"]) . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["ftp"]) . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["http"]) . "</td>";
            $out .= "<td{$bgcolor}>" . $stats["domains"][$ad]["hit"] . "</td>";
            $out .= "<td{$bgcolor}>" . smartByte($stats["domains"][$ad]["total_transfer"]) . "</td>";
            $out .= "</tr>";
        }
    }
    $out .= '</table>';
    return $out;
}