diff --git a/inc/webadmin.php b/inc/webadmin.php index 1fec4c7..ad3ec23 100644 --- a/inc/webadmin.php +++ b/inc/webadmin.php @@ -1,11 +1,11 @@ * @author Thomas Martin @@ -33,47 +33,58 @@ if (!$conf['cluster']) { foreach($data_output as $data_line) { $data_split = explode(':', $data_line); - if (strstr($data_split[4],'K')) { - $taille_utilise = number_format(($data_split[4]/1024), 2, '.', '').'M'; - $taille_utilise_mo = $taille_utilise; - if ($taille_utilise >= 1024) { - $taille_utilise = number_format(($taille_utilise/1024), 2, '.', '').'G'; - } - } else if ($data_split[4] >= 1024) { - $taille_utilise_mo = $data_split[4]; - $taille_utilise = number_format(($data_split[4]/1024), 2, '.', '').'G'; - } else { - $taille_utilise_mo = $data_split[4]; - $taille_utilise = $data_split[4]; - } - - $quota_bas_mo = $data_split[5]; - $quota_bas = number_format(($data_split[5]/1024), 2, '.', '').'G'; - $quota_haut = number_format(($data_split[6]/1024), 2, '.', '').'G'; - $occupation = number_format((($taille_utilise_mo/$quota_bas_mo)*100), 2, '.', ''); - if ($occupation >= 90) { - $occupation = ''.$occupation.'%'; - } else if ($occupation >= 80) { - $occupation = ''.$occupation.'%'; - } else if ($occupation >= 70) { - $occupation = ''.$occupation.'%'; - } else { - $occupation = $occupation.'%'; - } - array_push($vhost_list, array( - 'owner' => $data_split[0], - 'configid' => $data_split[1], - 'server_name' => $data_split[2], - 'server_alias' => $data_split[3], - 'size' => $taille_utilise, - 'quota_soft' => $quota_bas, - 'quota_hard' => $quota_haut, - 'occupation' => $occupation, - 'php_version' => $data_split[7], - 'is_enabled' => $data_split[8]) - ); - } + if(isset($conf['quota']) && $conf['quota'] === true) { + if (strstr($data_split[4],'K')) { + $taille_utilise = number_format(($data_split[4]/1024), 2, '.', '').'M'; + $taille_utilise_mo = $taille_utilise; + + if ($taille_utilise >= 1024) { + $taille_utilise = number_format(($taille_utilise/1024), 2, '.', '').'G'; + } + } else if ($data_split[4] >= 1024) { + $taille_utilise_mo = $data_split[4]; + $taille_utilise = number_format(($data_split[4]/1024), 2, '.', '').'G'; + } else { + $taille_utilise_mo = $data_split[4]; + $taille_utilise = $data_split[4]; + } + + $quota_bas_mo = $data_split[5]; + $quota_bas = number_format(($data_split[5]/1024), 2, '.', '').'G'; + $quota_haut = number_format(($data_split[6]/1024), 2, '.', '').'G'; + $occupation = number_format((($taille_utilise_mo/$quota_bas_mo)*100), 2, '.', ''); + + if ($occupation >= 90) { + $occupation = ''.$occupation.'%'; + } else if ($occupation >= 80) { + $occupation = ''.$occupation.'%'; + } else if ($occupation >= 70) { + $occupation = ''.$occupation.'%'; + } else { + $occupation = $occupation.'%'; + } + } + else { + $taille_utilise =""; + $quota_bas = ""; + $quota_haut = ""; + $occupation = ""; + } + + array_push($vhost_list, array( + 'owner' => $data_split[0], + 'configid' => $data_split[1], + 'server_name' => $data_split[2], + 'server_alias' => $data_split[3], + 'size' => $taille_utilise, + 'quota_soft' => $quota_bas, + 'quota_hard' => $quota_haut, + 'occupation' => $occupation, + 'php_version' => $data_split[7], + 'is_enabled' => $data_split[8]) + ); + } } else { @@ -98,13 +109,12 @@ else { if (!empty($accounts)) { foreach($accounts as $account) { - $master = $bdd->get_server_from_roleid($account['id_master']); - + $slave = ''; - if (!empty($account['id_slave'])) - $slave = $bdd->get_server_from_roleid($account['id_slave']); - + if (!empty($account['id_slave'])) + $slave = $bdd->get_server_from_roleid($account['id_slave']); + array_push($vhost_list, array( 'owner' => $account['name'], 'server_name'=> $account['domain'], @@ -113,14 +123,11 @@ else { 'replication' => $account['replication'], 'master' => $master, 'slave' => $slave) - ); - + ); } } - } - include_once EVOADMIN_BASE . '../tpl/header.tpl.php'; include_once EVOADMIN_BASE . '../tpl/menu.tpl.php'; include_once EVOADMIN_BASE . '../tpl/webadmin.tpl.php';