diff --git a/interface/web/sites/templates/web_sites_stats_list.htm b/interface/web/sites/templates/web_sites_stats_list.htm index 2fbf8723ac97b47ffcbbabfaa2ee1d30c40b6e7d..f721dfbd215cafc2ed13eadb351c1971b47930d6 100644 --- a/interface/web/sites/templates/web_sites_stats_list.htm +++ b/interface/web/sites/templates/web_sites_stats_list.htm @@ -30,10 +30,10 @@ <tmpl_loop name="records"> <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> <td class="tbl_col_domain"><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td> - <td class="tbl_col_this_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_month"} MB</a></td> - <td class="tbl_col_last_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_month"} MB</a></td> - <td class="tbl_col_this_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_year"} MB</a></td> - <td class="tbl_col_last_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_year"} MB</a></td> + <td class="tbl_col_this_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_month"}</a></td> + <td class="tbl_col_last_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_month"}</a></td> + <td class="tbl_col_this_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_year"}</a></td> + <td class="tbl_col_last_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_year"}</a></td> <td class="tbl_col_buttons"></td> </tr> </tmpl_loop> @@ -60,4 +60,4 @@ </fieldset> </div> -</div> \ No newline at end of file +</div> diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php index f5eb9278c5b496da05fcb21796f086380a4d8abe..9bf96cb6a7e973e20e9ab6be9f0aab073605c1f1 100644 --- a/interface/web/sites/web_sites_stats.php +++ b/interface/web/sites/web_sites_stats.php @@ -15,6 +15,8 @@ $list_def_file = "list/web_sites_stats.list.php"; //* Check permissions for module $app->auth->check_module_permissions('sites'); +$app->uses('functions'); + $app->load('listform_actions'); class list_action extends listform_actions { @@ -39,26 +41,35 @@ class list_action extends listform_actions { $tmp_year = date('Y'); $tmp_month = date('m'); $tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); - $rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); - $this->sum_this_month += ($tmp_rec['t']/1024/1024); +// $rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_this_month += ($tmp_rec['t']/1024/1024); + $rec['this_month'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_month += $app->functions->formatBytes($tmp_rec['t']); + //** Traffic of the current year $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); - $rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); - $this->sum_this_year += ($tmp_rec['t']/1024/1024); +// $rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_this_year += ($tmp_rec['t']/1024/1024); + $rec['this_year'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_year += $app->functions->formatBytes($tmp_rec['t']); //** Traffic of the last month $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); - $rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); - $this->sum_last_month += ($tmp_rec['t']/1024/1024); +// $rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_last_month += ($tmp_rec['t']/1024/1024); + $rec['last_month'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_month += $app->functions->formatBytes($tmp_rec['t']); //** Traffic of the last year $tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); - $rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); - $this->sum_last_year += ($tmp_rec['t']/1024/1024); +// $rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); +// $this->sum_last_year += ($tmp_rec['t']/1024/1024); + $rec['last_year'] = $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_year += $app->functions->formatBytes($tmp_rec['t']); //* The variable "id" contains always the index variable $rec['id'] = $rec[$this->idx_key];