Пример #1
0
function GetHasRuleAccess($domainid, $accountid)
{
    global $hmail_config;
    if (hmailGetAdminLevel() == ADMIN_SERVER) {
        // server admin always have access.
        return true;
    } else {
        if (hmailGetAdminLevel() == ADMIN_DOMAIN) {
            // Domain admin has access if domain access is enabled.
            if ($hmail_config['rule_editing_level'] == ADMIN_DOMAIN && hmailGetDomainID() == $domainid && $accountid != 0) {
                return true;
            }
            // Domain admin has access if user-level is permitted and the account
            // is under the domain admins control.
            if ($hmail_config['rule_editing_level'] == ADMIN_USER && hmailGetDomainID() == $domainid) {
                return true;
            }
        } else {
            if (hmailGetAdminLevel() == ADMIN_USER) {
                // user has access if enabled and the rule is connected to his account.
                if ($hmail_config['rule_editing_level'] == ADMIN_USER && hmailGetDomainID() == $domainid && hmailGetAccountID() == $accountid) {
                    return true;
                }
            }
        }
    }
    return false;
}
Пример #2
0
    exit;
}
?>

<h1><?php 
EchoTranslation("Accounts");
?>
</h1>

<?php 
$domainid = hmailGetVar("domainid", null);
if (hmailGetAdminLevel() == 0) {
    hmailHackingAttemp();
}
// Users are not allowed to show this page.
if (hmailGetAdminLevel() == 1 && $domainid != hmailGetDomainID()) {
    hmailHackingAttemp();
}
// Domain admin but not for this domain.
echo '<table border="0" width="100%" cellpadding="5">';
$bgcolor = "#EEEEEE";
$obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
$obAccounts = $obDomain->Accounts();
$Count = $obAccounts->Count();
$str_delete = $obLanguage->String("Remove");
$currentaccountid = hmailGetAccountID();
$str_accountaddress = $obLanguage->String("Address");
$str_maxsizemb = $obLanguage->String("Maximum size (MB)");
echo "<tr bgcolor=\"#CCCCCC\">";
echo "<td width=\"60%\">{$str_accountaddress}</td>";
echo "<td width=\"20%\">{$str_maxsizemb}</td>";
$MaxNumberOfAccounts = hmailGetVar("MaxNumberOfAccounts", "0");
$MaxNumberOfAliases = hmailGetVar("MaxNumberOfAliases", "0");
$MaxNumberOfDistributionLists = hmailGetVar("MaxNumberOfDistributionLists", "0");
$MaxNumberOfAccountsEnabled = hmailGetVar("MaxNumberOfAccountsEnabled", "0");
$MaxNumberOfAliasesEnabled = hmailGetVar("MaxNumberOfAliasesEnabled", "0");
$MaxNumberOfDistributionListsEnabled = hmailGetVar("MaxNumberOfDistributionListsEnabled", "0");
$DKIMSignEnabled = hmailGetVar("DKIMSignEnabled", "0");
$DKIMPrivateKeyFile = hmailGetVar("DKIMPrivateKeyFile", "");
$DKIMSelector = hmailGetVar("DKIMSelector", "");
$DKIMHeaderCanonicalizationMethod = hmailGetVar("DKIMHeaderCanonicalizationMethod", "2");
$DKIMBodyCanonicalizationMethod = hmailGetVar("DKIMBodyCanonicalizationMethod", "2");
$DKIMSigningAlgorithm = hmailGetVar("DKIMSigningAlgorithm", "2");
if ($domainactive == "") {
    $domainactive = 0;
}
if (hmailGetAdminLevel() == 1 && ($domainid != hmailGetDomainID() || $action != "edit")) {
    hmailHackingAttemp();
}
// Domain admin but not for this domain.
if ($action == "edit") {
    $obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
} elseif ($action == "add") {
    $obDomain = $obBaseApp->Domains->Add();
} elseif ($action == "delete") {
    $obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
    $obDomain->Delete();
    header("Location: index.php?page=domains");
    exit;
}
$obDomain->Postmaster = $domainpostmaster;
$obDomain->PlusAddressingEnabled = $domainplusaddressingenabled == "1";