ftimme
2012-05-18 2a189307eb0a6693a8d64b62e3845ca87c58d1eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
 
/******************************************
* Begin Form configuration
******************************************/
 
$list_def_file = "list/user_quota_stats.list.php";
 
/******************************************
* End Form configuration
******************************************/
 
//* Check permissions for module
$app->auth->check_module_permissions('mail');
 
$app->load('listform_actions');
 
// $tmp_rec = $app->db->queryOneRecord("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
// $monitor_data = unserialize($app->db->unquote($tmp_rec['data']));
$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
$monitor_data = array();
if(is_array($tmp_rec)) {
    foreach ($tmp_rec as $tmp_mon) {
        $monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
    }
}
 
 
class list_action extends listform_actions {
    
    function prepareDataRow($rec)
    {
        global $app,$monitor_data;
        
        $rec = $app->listform->decode($rec);
 
        //* Alternating datarow colors
        $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
        $rec['bgcolor'] = $this->DataRowColor;
        $email = $rec['email'];
        
        $rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
        
        if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
 
        $rec['quota'] = round($rec['quota'] / 1048576,2).' MB';
        if($rec['quota'] == "0 MB") $rec['quota'] = $app->lng('unlimited');
 
 
        if($rec['used'] < 1544000) {
            $rec['used'] = round($rec['used'] / 1024,2).' KB';
        } else {
            $rec['used'] = round($rec['used'] / 1048576,2).' MB';
        }   
 
        //* The variable "id" contains always the index variable
        $rec['id'] = $rec[$this->idx_key];
        return $rec;
    }
}
 
$list = new list_action;
$list->SQLExtWhere = "";
 
$list->onLoad();
 
 
?>