Example #1
0
            if ($row['v_active'] == NULL) {
                $row['v_active'] = 'f';
            }
            $row['v_active'] = 't' == $row['v_active'] ? 1 : 0;
        }
        $tMailbox[] = $row;
    }
}
$alias_data['msg']['can_create'] = false;
$tCanAddMailbox = false;
$tDisplay_back = "";
$tDisplay_back_show = "";
$tDisplay_up_show = "";
$tDisplay_next = "";
$tDisplay_next_show = "";
$limit = get_domain_properties($fDomain);
if (isset($limit)) {
    if ($fDisplay >= $page_size) {
        $tDisplay_back_show = 1;
        $tDisplay_back = $fDisplay - $page_size;
    }
    if ($limit['alias_count'] > $page_size or $limit['mailbox_count'] > $page_size) {
        $tDisplay_up_show = 1;
    }
    if ($fDisplay + $page_size < $limit['alias_count'] or $fDisplay + $page_size < $limit['mailbox_count']) {
        $tDisplay_next_show = 1;
        $tDisplay_next = $fDisplay + $page_size;
    }
    if ($limit['aliases'] == 0) {
        $alias_data['msg']['can_create'] = true;
    } elseif ($limit['alias_count'] < $limit['aliases']) {
 /**
  * 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;
 }
 * tActive
 *
 * Form POST \ GET Variables:
 *
 * fDescription
 * fAliases
 * fMailboxes
 * fMaxquota
 * fActive
 */
require_once 'common.php';
authentication_require_role('global-admin');
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if (isset($_GET['domain'])) {
        $domain = escape_string($_GET['domain']);
        $domain_properties = get_domain_properties($domain);
        $tDescription = $domain_properties['description'];
        $tAliases = $domain_properties['aliases'];
        $tMailboxes = $domain_properties['mailboxes'];
        $tMaxquota = $domain_properties['maxquota'];
        $tTransport = $domain_properties['transport'];
        $tBackupmx = $domain_properties['backupmx'];
        $tActive = $domain_properties['active'];
    }
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isset($_GET['domain'])) {
        $domain = escape_string($_GET['domain']);
    }
    if (isset($_POST['fDescription'])) {
        $fDescription = escape_string($_POST['fDescription']);
    }
} else {
    $list_admins = array(authentication_get_username());
    $is_superadmin = 0;
    $fUsername = "";
}
if (isset($admin_properties) && $admin_properties['domain_count'] == 'ALL') {
    # list all domains for superadmins
    $list_domains = list_domains();
} elseif (!empty($fUsername)) {
    $list_domains = list_domains_for_admin($fUsername);
} elseif ($is_superadmin) {
    $list_domains = list_domains();
} else {
    $list_domains = list_domains_for_admin(authentication_get_username());
}
if (!empty($list_domains)) {
    for ($i = 0; $i < sizeof($list_domains); $i++) {
        $domain_properties[$i] = get_domain_properties($list_domains[$i]);
    }
}
#}
include "templates/header.php";
include "templates/menu.php";
if ($is_superadmin) {
    include "templates/admin_list-domain.php";
} else {
    include "templates/overview-get.php";
}
include "templates/footer.php";
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
Example #5
0
 /**
  * check number of existing aliases for this domain - is one more allowed?
  */
 private function create_allowed($domain)
 {
     if ($this->called_by == 'MailboxHandler') {
         return true;
     }
     # always allow creating an alias for a mailbox
     $limit = get_domain_properties($domain);
     if ($limit['aliases'] == 0) {
         return true;
     }
     # unlimited
     if ($limit['aliases'] < 0) {
         return false;
     }
     # disabled
     if ($limit['alias_count'] >= $limit['aliases']) {
         return false;
     }
     return true;
 }
function check_quota($quota, $domain)
{
    $limit = get_domain_properties($domain);
    if ($limit['maxquota'] == 0) {
        return true;
    }
    if ($limit['maxquota'] < 0 and $quota < 0) {
        return true;
    }
    if ($limit['maxquota'] > 0 and $quota == 0) {
        return false;
    }
    if ($quota > $limit['maxquota']) {
        return false;
    } else {
        return true;
    }
}
<?php 
print "<table id=\"overview_table\">\n";
print "   <tr>\n";
print "      <td colspan=\"5\"><h3>" . $PALANG['pOverview_title'] . "</h3></td>";
print "   </tr>";
print "   <tr class=\"header\">\n";
print "      <td>" . $PALANG['pOverview_get_domain'] . "</td>\n";
print "      <td>" . $PALANG['pOverview_get_aliases'] . "</td>\n";
print "      <td>" . $PALANG['pOverview_get_mailboxes'] . "</td>\n";
if ($CONF['quota'] == 'YES') {
    print "      <td>" . $PALANG['pOverview_get_quota'] . "</td>\n";
}
print "   </tr>\n";
for ($i = 0; $i < sizeof($list_domains); $i++) {
    if (is_array($list_domains) and sizeof($list_domains) > 0) {
        $limit = get_domain_properties($list_domains[$i]);
        if ($limit['aliases'] == 0) {
            $limit['aliases'] = $PALANG['pOverview_unlimited'];
        }
        if ($limit['mailboxes'] == 0) {
            $limit['mailboxes'] = $PALANG['pOverview_unlimited'];
        }
        if ($limit['maxquota'] == 0) {
            $limit['maxquota'] = $PALANG['pOverview_unlimited'];
        }
        if ($limit['aliases'] < 0) {
            $limit['aliases'] = $PALANG['pOverview_disabled'];
        }
        if ($limit['mailboxes'] < 0) {
            $limit['mailboxes'] = $PALANG['pOverview_disabled'];
        }