Commit 9d4f8e23 authored by domi's avatar domi
Browse files

Remove direct 'mysql_query' for domain list ; Somme comestic changes ; REdintening of the code

parent 698930f5
......@@ -3,19 +3,27 @@
require_once("../class/config.php");
if (!defined("QUOTASONE")) return;
?><!-- Les Mails -->
?>
<center>
<p><h3><center><?php __("Account"); ?> <span style="font-weight: bold;"><?php echo $c["login"]; ?></span></center></h3></p>
<p><h3><center><?php __("Account"); ?> <span style="font-weight: bold;"><?php echo $c["login"]; ?></span></center></h3></p>
<div style="width: 550px">
<!-- Les esapces web -->
<?php
$totalweb = $quota->get_size_web_sum_user($c["uid"]);
$totalweb = $quota->get_size_web_sum_user($c["uid"]);
echo "<p>"._("Web Space:")." ";
echo sprintf("%.1f", $totalweb / 1024)."&nbsp;"._("MB");
echo "</p>";
echo "<p>"._("Web Space:")." ";
echo sprintf("%.1f", $totalweb / 1024)."&nbsp;"._("MB");
echo "</p>";
?>
<div style="width: 550px">
<!-- Les mails -->
<table class="tedit">
<thead>
<tr>
......@@ -27,11 +35,10 @@ if (!defined("QUOTASONE")) return;
<tbody>
<?php
$s=mysql_query("SELECT * FROM domaines WHERE compte='".$c["uid"]."';");
$domaines_user = $dom->enum_domains($c["uid"]);
$totalmail=0;
while ($d=mysql_fetch_array($s)) {
$mstmp = $quota->get_size_mail_sum_domain($d["domaine"]);
foreach ($domaines_user as $domaine) {
$mstmp = $quota->get_size_mail_sum_domain($domaine);
$totalmail+=$mstmp;
}
......@@ -39,37 +46,50 @@ if (!defined("QUOTASONE")) return;
echo sprintf("%.1f", $totalmail / 1024)."&nbsp;"._("MB");
echo "</p>";
$s=mysql_query("SELECT * FROM domaines WHERE compte='".$c["uid"]."';");
while ($d=mysql_fetch_array($s)) {
$alias_sizes = $quota->get_size_mail_details_domain($d["domaine"]);
foreach ($domaines_user as $domaine) {
$alias_sizes = $quota->get_size_mail_details_domain($domaine);
$domsize = 0;
foreach ($alias_sizes as $e) {
echo "<tr><td>".$d["domaine"]."</td>";
$domsize += $e['size'];
echo "<tr><td>{$domaine}</td>";
echo "<td>".str_replace("_","@",$e["alias"])."</td>";
echo "<td";
if ($mode!=2) echo " style=\"text-align: right\"";
echo ">";
echo "<td"; if ($mode!=2) echo " style=\"text-align: right\""; echo ">";
$ms=$e["size"];
if ($totalmail)
$pc=intval(100*$ms/$totalmail);
else
$pc=0;
if ($totalmail) {
$pc=intval(100*$ms/$totalmail);
} else {
$pc=0;
}
if ($mode==0) {
echo sprintf("%.1f", $ms / 1024)."&nbsp;"._("MB");
echo sprintf("%.1f", $ms / 1024)."&nbsp;"._("MB");
} elseif ($mode==1) {
echo sprintf("%.1f", $pc)."&nbsp;%";
echo sprintf("%.1f", $pc)."&nbsp;%";
} else {
echo "<img src=\"hippo_bleue.gif\" style=\"width: ".(2*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."\"/>";
echo "<img src=\"hippo_bleue.gif\" style=\"width: ".(2*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."\"/>";
}
echo "</td></tr>";
}
$tpc = intval(100 * $domsize / $totalmail);
echo "<tr><td><i>". _('Total'). " {$domaine}</i></td><td></td>";
echo "<td";
if ($mode!=2) echo " style=\"text-align: right\"";
echo "><i>";
if ($mode==0) {
echo sprintf("%.1f", $domsize / 1024)."&nbsp;"._("MB");
} elseif ($mode==1) {
echo sprintf("%.1f", $tpc)."&nbsp;%";
} else {
echo "<img src=\"hippo_bleue.gif\" style=\"width: ".(2*$tpc)."px; height: 16px\" alt=\"".$tpc."%\" title=\"".$tpc."\"/>";
}
echo "</i></td></tr>";
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<!-- Les bases -->
<?php
// Espace DB :
$totaldb = $quota->get_size_db_sum_user($c["login"]);
echo "<p>"._("Databases:")." ";
......@@ -93,10 +113,11 @@ if (!defined("QUOTASONE")) return;
if ($mode!=2) echo " style=\"text-align: right\"";
echo ">";
$ds=$d["size"];
if ($totaldb)
$pc=intval(100*$ds/$totaldb);
else
$pc=0;
if ($totaldb) {
$pc=intval(100*$ds/$totaldb);
} else {
$pc=0;
}
if (isset($mode) && $mode==0) {
echo sprintf("%.1f", $ds / 1024/1024)."&nbsp;"._("MB");
} elseif (isset($mode) &&$mode==1) {
......@@ -110,18 +131,19 @@ if (!defined("QUOTASONE")) return;
</tbody>
</table>
<!-- Les listes -->
<?php
$totallist = $quota->get_size_mailman_sum_user($c["uid"]);
$totallist = $quota->get_size_mailman_sum_user($c["uid"]);
if ($totallist) {
?>
<p>&nbsp;</p>
?>
<?php
echo "<p>"._("Mailman lists:")." ";
echo sprintf("%.1f", $totallist/1024)."&nbsp;"._("MB");
echo "</p>";
?>
<table class="tedit">
<thead>
<tr>
......@@ -132,17 +154,17 @@ if (!defined("QUOTASONE")) return;
<tbody>
<?php
// Espace Liste :
$mailman_size = $quota->get_size_mailman_details_user($c["uid"]);
foreach ($mailman_size as $d) {
echo "<tr><td>".$d["list"]."</td><td";
if ($mode!=2) echo " style=\"text-align: right\"";
echo ">";
$ds=$d["size"];
if ($totallist)
$pc=intval(100*$ds/$totallist);
else
$pc=0;
if ($totallist) {
$pc=intval(100*$ds/$totallist);
} else {
$pc=0;
}
if ($mode==0) {
echo sprintf("%.1f", $ds / 1024)."&nbsp;"._("MB");
} elseif ($mode==1) {
......@@ -156,6 +178,6 @@ if (!defined("QUOTASONE")) return;
</tbody>
</table>
<?php } ?>
<?php } /* totallist */ ?>
</div>
</center>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment