Marius Cramer
2015-01-06 d2713e4bf2090bcd85e0c1d7b99f08575d12f133
interface/lib/classes/quota_lib.inc.php
@@ -13,12 +13,9 @@
      }
      //print_r($monitor_data);
      
      if($clientid != null){
         $sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
      }
      // select all websites or websites belonging to client
      $sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".(($clientid != null)?" AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)":''), $clientid);
      
      // select websites belonging to client
      $sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".$sql_where);
      //print_r($sites);
      if(is_array($sites) && !empty($sites)){
         for($i=0;$i<sizeof($sites);$i++){
@@ -38,7 +35,13 @@
            if (!is_numeric($sites[$i]['soft'])) $sites[$i]['soft']=$sites[$i]['soft'][1];
            if (!is_numeric($sites[$i]['hard'])) $sites[$i]['hard']=$sites[$i]['hard'][1];
            if (!is_numeric($sites[$i]['files'])) $sites[$i]['files']=$sites[$i]['files'][1];
            $sites[$i]['used_raw'] = $sites[$i]['used'];
            $sites[$i]['soft_raw'] = $sites[$i]['soft'];
            $sites[$i]['hard_raw'] = $sites[$i]['hard'];
            $sites[$i]['files_raw'] = $sites[$i]['files'];
            $sites[$i]['used_percentage'] = ($sites[$i]['soft'] > 0 && $sites[$i]['used'] > 0 ? round($sites[$i]['used'] * 100 / $sites[$i]['soft']) : 0);
            if ($readable) {
               // colours
               $sites[$i]['display_colour'] = '#000000';
@@ -111,13 +114,9 @@
      }
      //print_r($monitor_data);
      
      if($clientid != null){
         $sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
      }
      // select all email accounts or email accounts belonging to client
      $emails = $app->db->queryAllRecords("SELECT * FROM mail_user".(($clientid != null)? " WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)" : ''), $clientid);
      
      // select email accounts belonging to client
      $emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE 1".$sql_where);
      //print_r($emails);
      if(is_array($emails) && !empty($emails)){
         for($i=0;$i<sizeof($emails);$i++){
@@ -127,6 +126,11 @@
      
            if (!is_numeric($emails[$i]['used'])) $emails[$i]['used']=$emails[$i]['used'][1];
            
            $emails[$i]['quota_raw'] = $emails[$i]['quota'];
            $emails[$i]['used_raw'] = $emails[$i]['used'];
            $emails[$i]['used_percentage'] = ($emails[$i]['quota'] > 0 && $emails[$i]['used'] > 0 ? round($emails[$i]['used'] * 100 / $emails[$i]['quota']) : 0);
            if ($readable) {
               // colours
               $emails[$i]['display_colour'] = '#000000';