Exemplo n.º 1
0
 static function DisplayUsagepChart()
 {
     global $zdbh;
     global $controller;
     $currentuser = ctrl_users::GetUserDetail();
     self::$diskquota = $currentuser['diskquota'];
     self::$diskspace = ctrl_users::GetQuotaUsages('diskspace', $currentuser['userid']);
     self::$bandwidthquota = module_controller::empty_as_0($currentuser['bandwidthquota']);
     self::$bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']);
     self::$domainsquota = module_controller::empty_as_0($currentuser['domainquota']);
     self::$domains = ctrl_users::GetQuotaUsages('domains', $currentuser['userid']);
     self::$subdomainsquota = module_controller::empty_as_0($currentuser['subdomainquota']);
     self::$subdomains = ctrl_users::GetQuotaUsages('subdomains', $currentuser['userid']);
     self::$parkeddomainsquota = module_controller::empty_as_0($currentuser['parkeddomainquota']);
     self::$parkeddomains = ctrl_users::GetQuotaUsages('parkeddomains', $currentuser['userid']);
     self::$mysqlquota = module_controller::empty_as_0($currentuser['mysqlquota']);
     self::$mysql = ctrl_users::GetQuotaUsages('mysql', $currentuser['userid']);
     self::$ftpaccountsquota = module_controller::empty_as_0($currentuser['ftpaccountsquota']);
     self::$ftpaccounts = ctrl_users::GetQuotaUsages('ftpaccounts', $currentuser['userid']);
     self::$mailboxquota = module_controller::empty_as_0($currentuser['mailboxquota']);
     self::$mailboxes = ctrl_users::GetQuotaUsages('mailboxes', $currentuser['userid']);
     self::$forwardersquota = module_controller::empty_as_0($currentuser['forwardersquota']);
     self::$forwarders = ctrl_users::GetQuotaUsages('forwarders', $currentuser['userid']);
     self::$distlistsquota = $currentuser['distlistsquota'];
     self::$distlists = module_controller::empty_as_0(ctrl_users::GetQuotaUsages('distlists', $currentuser['userid']));
     $maximum = self::$diskquota;
     $used = self::$diskspace;
     if ($maximum == 0) {
         if (sys_versions::ShowOSPlatformVersion() != 'Windows') {
             // We'll specify the full path to the hsoted directory to ensure that NFS mounts etc are taken into account.
             $free = disk_free_space(ctrl_options::GetOption('hosted_dir'));
         } else {
             // On Windows we'll check the disk (partition) that is configured for the 'hostdata' directory.
             $free = disk_free_space(substr(ctrl_options::GetOption('hosted_dir'), 0, 2));
         }
         $freeLabel = fs_director::ShowHumanFileSize($free) . ' (' . ui_language::translate('Server disk') . ')';
     } else {
         $free = max($maximum - $used, 0);
         $freeLabel = fs_director::ShowHumanFileSize($free);
     }
     $usedLabel = fs_director::ShowHumanFileSize($used);
     $line = '<table class="none" cellpadding="0" cellspacing="0">' . '<tr>' . '<td align="left" valign="top" width="350px">' . '<h2>' . ui_language::translate('Disk Usage Total') . '</h2>' . '<img src="etc/lib/pChart2/MADmin/z3DPie.php?score=' . $free . '::' . $used . '&amp;imagesize=350::250&amp;chartsize=150::120&amp;radius=150' . '&amp;labels=Free_Space: ' . $freeLabel . '::Used_Space: ' . $usedLabel . '&amp;legendfont=verdana&amp;legendfontsize=8&amp;legendsize=10::220"/>' . '</td>' . '<td align="left" valign="top">' . '<h2>' . ui_language::translate('Package Usage Total') . '</h2>' . '<table class="table table-striped" border="0" cellspacing="0" cellpadding="0">' . module_controller::build_row_usage('Disk space', self::$diskspace, self::$diskquota == 0 ? -1 : self::$diskquota, true) . module_controller::build_row_usage('Bandwidth', self::$bandwidth, self::$bandwidthquota == 0 ? -1 : self::$bandwidthquota, true) . module_controller::build_row_usage('Domains', self::$domains, self::$domainsquota) . module_controller::build_row_usage('Sub-domains', self::$subdomains, self::$subdomainsquota) . module_controller::build_row_usage('Parked domains', self::$parkeddomains, self::$parkeddomainsquota) . module_controller::build_row_usage('FTP accounts', self::$ftpaccounts, self::$ftpaccountsquota) . module_controller::build_row_usage('MySQL&reg databases', self::$mysql, self::$mysqlquota) . module_controller::build_row_usage('Mailboxes', self::$mailboxes, self::$mailboxquota) . module_controller::build_row_usage('Mail forwarders', self::$forwarders, self::$forwardersquota) . module_controller::build_row_usage('Distribution lists', self::$distlists, self::$distlistsquota) . '</table>' . '</td>' . '</tr>' . '</table>';
     return $line;
 }