Ejemplo n.º 1
0
 /**
  * Get allowed maximum quota for a mailbox
  *
  * @param String $domain
  * @param Integer $current_user_quota (in bytes)
  * @return Integer allowed maximum quota (in MB)
  */
 protected function allowed_quota($domain, $current_user_quota)
 {
     if (!Config::bool('quota')) {
         return 0;
         # quota disabled means no limits - no need for more checks
     }
     $domain_properties = get_domain_properties($domain);
     $tMaxquota = $domain_properties['maxquota'];
     if (Config::bool('domain_quota') && $domain_properties['quota']) {
         $dquota = $domain_properties['quota'] - $domain_properties['total_quota'] + divide_quota($current_user_quota);
         if ($dquota < $tMaxquota) {
             $tMaxquota = $dquota;
         }
         if ($tMaxquota == 0) {
             $tMaxquota = $dquota;
         }
     }
     return $tMaxquota;
 }
Ejemplo n.º 2
0
    $limit['aliases'] = eval_size($limit['aliases']);
    $limit['mailboxes'] = eval_size($limit['mailboxes']);
    if (Config::bool('quota')) {
        $limit['maxquota'] = eval_size($limit['maxquota']);
    }
}
$gen_show_status_mailbox = array();
$divide_quota = array('current' => array(), 'quota' => array());
if (is_array($tMailbox) and sizeof($tMailbox) > 0) {
    for ($i = 0; $i < sizeof($tMailbox); $i++) {
        $gen_show_status_mailbox[$i] = gen_show_status($tMailbox[$i]['username']);
        if (isset($tMailbox[$i]['current'])) {
            $divide_quota['current'][$i] = divide_quota($tMailbox[$i]['current']);
        }
        if (isset($tMailbox[$i]['quota'])) {
            $divide_quota['quota'][$i] = divide_quota($tMailbox[$i]['quota']);
        }
        if (isset($tMailbox[$i]['quota']) && isset($tMailbox[$i]['current'])) {
            $divide_quota['percent'][$i] = min(100, round($divide_quota['current'][$i] / max(1, $divide_quota['quota'][$i]) * 100));
            $divide_quota['quota_width'][$i] = $divide_quota['percent'][$i] / 100 * 120;
        } else {
            $divide_quota['current'][$i] = Config::Lang('unknown');
            $divide_quota['quota_width'][$i] = 0;
            # TODO: use special value?
        }
    }
}
class cNav_bar
{
    var $count, $title, $limit, $page_size, $pages, $search;
    //* arguments
Ejemplo n.º 3
0
 for ($i = 0; $i < sizeof($tMailbox); $i++) {
     if (is_array($tMailbox) and sizeof($tMailbox) > 0) {
         print "   <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
         $tMailbox[$i]['display_username'] = $tMailbox[$i]['username'];
         if (stristr($tMailbox[$i]['display_username'], $fSearch)) {
             $new_name = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" . $fSearch . "</span>", $tMailbox[$i]['display_username']);
             $tMailbox[$i]['display_username'] = $new_name;
         }
         print "      <td>" . $tMailbox[$i]['display_username'] . "</td>\n";
         if (stristr($tMailbox[$i]['name'], $fSearch)) {
             $new_name = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" . $fSearch . "</span>", $tMailbox[$i]['name']);
             $tMailbox[$i]['name'] = $new_name;
         }
         print "      <td>" . $tMailbox[$i]['name'] . "</td>\n";
         if ($CONF['quota'] == 'YES') {
             print "      <td>" . divide_quota($tMailbox[$i]['quota']) . "</td>\n";
         }
         print "      <td>" . $tMailbox[$i]['modified'] . "</td>\n";
         $active = $tMailbox[$i]['active'] == 1 ? $PALANG['YES'] : $PALANG['NO'];
         print "      <td><a href=\"edit-active.php?username="******"&domain=" . $tMailbox[$i]['domain'] . "&return=search.php?search=" . urlencode($fSearch) . "\">" . $active . "</a></td>\n";
         $has_alias_control = 0;
         # temporary variable to simplify admin vs. superadmin code
         if (authentication_has_role('global-admin')) {
             if ($CONF['alias_control'] == 'YES') {
                 $has_alias_control = 1;
             }
         } else {
             if ($CONF['alias_control_admin'] == 'YES') {
                 $has_alias_control = 1;
             }
             if ($CONF['vacation_control_admin'] == 'YES') {
Ejemplo n.º 4
0
if (!(check_owner($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin'))) {
    $error = 1;
    $tName = $fName;
    $tQuota = $fQuota;
    $tActive = $fActive;
    $tMessage = $PALANG['pEdit_mailbox_domain_error'] . "{$fDomain}</span>";
}
$result = db_query("SELECT * FROM {$table_mailbox} WHERE username = '******' AND domain = '{$fDomain}'");
if ($result['rows'] != 1) {
    die("Invalid username chosen; user does not exist in mailbox table");
}
$user_details = db_array($result['result']);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if (check_owner($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin')) {
        $tName = $user_details['name'];
        $tQuota = divide_quota($user_details['quota']);
        $tActive = $user_details['active'];
        if ('pgsql' == $CONF['database_type']) {
            $tActive = 't' == $user_details['active'] ? 1 : 0;
        }
        $result = db_query("SELECT * FROM {$table_domain} WHERE domain='{$fDomain}'");
        if ($result['rows'] == 1) {
            $row = db_array($result['result']);
            $tMaxquota = $row['maxquota'];
        }
    }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['cancel'])) {
    header("Location: list-virtual.php?domain={$fDomain}");
    exit(0);
}
Ejemplo n.º 5
-1
 for ($i = 0; $i < sizeof($tMailbox); $i++) {
     if (is_array($tMailbox) and sizeof($tMailbox) > 0) {
         print "   <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
         if ($CONF['show_status'] == 'YES') {
             print "  <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
         }
         print "      <td>" . $tMailbox[$i]['username'] . "</td>\n";
         print "      <td>" . $tMailbox[$i]['name'] . "</td>\n";
         if ($CONF['quota'] == 'YES') {
             print "      <td>";
             if ($tMailbox[$i]['quota'] == 0) {
                 print $PALANG['pOverview_unlimited'];
             } elseif ($tMailbox[$i]['quota'] < 0) {
                 print $PALANG['pOverview_disabled'];
             } else {
                 print divide_quota($tMailbox[$i]['quota']);
             }
             print "</td>\n";
         }
         print "      <td>" . $tMailbox[$i]['modified'] . "</td>\n";
         $active = $tMailbox[$i]['active'] == 1 ? $PALANG['YES'] : $PALANG['NO'];
         print "      <td><a href=\"edit-active.php?username="******"&domain={$fDomain}" . "\">" . $active . "</a></td>\n";
         if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == 'YES') {
             $v_active_int = $tMailbox[$i]['v_active'];
             if ($v_active_int !== -1) {
                 if ($v_active_int == 1) {
                     $v_active = $PALANG['pOverview_vacation_edit'];
                 } else {
                     $v_active = $PALANG['pOverview_vacation_option'];
                 }
                 print "<td><a href=\"edit-vacation.php?username="******"&domain={$fDomain}" . "\">" . $v_active . "</a></td>\n";