commit | author | age
|
446416
|
1 |
<?php |
b1a6a5
|
2 |
require_once '../../lib/config.inc.php'; |
MC |
3 |
require_once '../../lib/app.inc.php'; |
446416
|
4 |
|
T |
5 |
/****************************************** |
|
6 |
* Begin Form configuration |
|
7 |
******************************************/ |
|
8 |
|
|
9 |
$list_def_file = "list/user_quota_stats.list.php"; |
|
10 |
|
|
11 |
/****************************************** |
|
12 |
* End Form configuration |
|
13 |
******************************************/ |
|
14 |
|
|
15 |
//* Check permissions for module |
|
16 |
$app->auth->check_module_permissions('sites'); |
|
17 |
|
e7bb41
|
18 |
$app->uses('functions'); |
FS |
19 |
|
446416
|
20 |
$app->load('listform_actions'); |
T |
21 |
|
9f56bd
|
22 |
$tmp_rec = $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC"); |
T |
23 |
$monitor_data = array(); |
|
24 |
if(is_array($tmp_rec)) { |
|
25 |
foreach ($tmp_rec as $tmp_mon) { |
b1a6a5
|
26 |
$monitor_data = array_merge_recursive($monitor_data, unserialize($app->db->unquote($tmp_mon['data']))); |
9f56bd
|
27 |
} |
T |
28 |
} |
|
29 |
|
446416
|
30 |
|
T |
31 |
class list_action extends listform_actions { |
b1a6a5
|
32 |
|
446416
|
33 |
function prepareDataRow($rec) |
b1a6a5
|
34 |
{ |
MC |
35 |
global $app, $monitor_data; |
|
36 |
|
446416
|
37 |
$rec = $app->listform->decode($rec); |
T |
38 |
|
|
39 |
//* Alternating datarow colors |
|
40 |
$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; |
|
41 |
$rec['bgcolor'] = $this->DataRowColor; |
|
42 |
$username = $rec['system_user']; |
b1a6a5
|
43 |
|
2af58c
|
44 |
$server = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $rec['server_id']); |
79edee
|
45 |
$rec['domain'] = $rec['domain'].($server['server_name'] != '' ? ' ('.$server['server_name'].')' : ''); |
FT |
46 |
|
9f56bd
|
47 |
$rec['used'] = $monitor_data['user'][$username]['used']; |
T |
48 |
$rec['soft'] = $monitor_data['user'][$username]['soft']; |
|
49 |
$rec['hard'] = $monitor_data['user'][$username]['hard']; |
b4daeb
|
50 |
$rec['files'] = $monitor_data['user'][$username]['files']; |
b1a6a5
|
51 |
|
08a328
|
52 |
if (!is_numeric($rec['used'])){ |
T |
53 |
if ($rec['used'][0] > $rec['used'][1]){ |
|
54 |
$rec['used'] = $rec['used'][0]; |
|
55 |
} else { |
|
56 |
$rec['used'] = $rec['used'][1]; |
|
57 |
} |
|
58 |
} |
4a596d
|
59 |
$rec['used_sort'] = $rec['used']; |
1ca823
|
60 |
if (!is_numeric($rec['soft'])) $rec['soft']=$rec['soft'][1]; |
T |
61 |
if (!is_numeric($rec['hard'])) $rec['hard']=$rec['hard'][1]; |
b4daeb
|
62 |
if (!is_numeric($rec['files'])) $rec['files']=$rec['files'][1]; |
e7bb41
|
63 |
$rec['used']=$app->functions->formatBytes($rec['used']*1024); |
FS |
64 |
$rec['soft']=$app->functions->formatBytes($rec['soft']*1024); |
|
65 |
$rec['hard']=$app->functions->formatBytes($rec['hard']*1024); |
|
66 |
if($rec['soft'] == "NAN") $rec['soft'] = $app->lng('unlimited'); |
|
67 |
if($rec['hard'] == "NAN") $rec['hard'] = $app->lng('unlimited'); |
|
68 |
/* |
9f56bd
|
69 |
if($rec['used'] > 1024) { |
b1a6a5
|
70 |
$rec['used'] = round($rec['used'] / 1024, 2).' MB'; |
9f56bd
|
71 |
} else { |
72695f
|
72 |
if ($rec['used'] != '') $rec['used'] .= ' KB'; |
9f56bd
|
73 |
} |
b1a6a5
|
74 |
|
9f56bd
|
75 |
if($rec['soft'] > 1024) { |
b1a6a5
|
76 |
$rec['soft'] = round($rec['soft'] / 1024, 2).' MB'; |
9f56bd
|
77 |
} else { |
T |
78 |
$rec['soft'] .= ' KB'; |
|
79 |
} |
b1a6a5
|
80 |
|
9f56bd
|
81 |
if($rec['hard'] > 1024) { |
b1a6a5
|
82 |
$rec['hard'] = round($rec['hard'] / 1024, 2).' MB'; |
9f56bd
|
83 |
} else { |
T |
84 |
$rec['hard'] .= ' KB'; |
|
85 |
} |
b1a6a5
|
86 |
|
72695f
|
87 |
if($rec['soft'] == " KB") $rec['soft'] = $app->lng('unlimited'); |
T |
88 |
if($rec['hard'] == " KB") $rec['hard'] = $app->lng('unlimited'); |
e7bb41
|
89 |
*/ |
b1a6a5
|
90 |
|
9f56bd
|
91 |
/* |
T |
92 |
if(!strstr($rec['used'],'M') && !strstr($rec['used'],'K')) $rec['used'].= ' B'; |
|
93 |
if(!strstr($rec['soft'],'M') && !strstr($rec['soft'],'K')) $rec['soft'].= ' B'; |
|
94 |
if(!strstr($rec['hard'],'M') && !strstr($rec['hard'],'K')) $rec['hard'].= ' B'; |
|
95 |
*/ |
e7bb41
|
96 |
/* |
9f56bd
|
97 |
if($rec['soft'] == '0 B' || $rec['soft'] == '0 KB' || $rec['soft'] == '0') $rec['soft'] = $app->lng('unlimited'); |
T |
98 |
if($rec['hard'] == '0 B' || $rec['hard'] == '0 KB' || $rec['hard'] == '0') $rec['hard'] = $app->lng('unlimited'); |
e7bb41
|
99 |
*/ |
446416
|
100 |
//* The variable "id" contains always the index variable |
T |
101 |
$rec['id'] = $rec[$this->idx_key]; |
|
102 |
return $rec; |
|
103 |
} |
b1a6a5
|
104 |
|
446416
|
105 |
} |
T |
106 |
|
|
107 |
$list = new list_action; |
615a0a
|
108 |
$list->SQLExtWhere = "web_domain.type = 'vhost'"; |
T |
109 |
$list->SQLOrderBy = 'ORDER BY web_domain.domain'; |
446416
|
110 |
$list->onLoad(); |
T |
111 |
|
|
112 |
|
b1a6a5
|
113 |
?> |