예제 #1
0
function modifyDomainPerm($domainId, $userId, $admin)
{
    if (!$domainId || !$userId) {
        return FALSE;
    }
    if (!isDomainAdmin()) {
        return FALSE;
    }
    if ($userId == $_SESSION['user']['user_id']) {
        return FALSE;
    }
    if (!userIsActive($userId)) {
        return FALSE;
    }
    $user = getUserEmail($userId);
    if (!$user) {
        return FALSE;
    }
    $domain = getDomain($domainId);
    if (!$domain) {
        return FALSE;
    }
    $adminDomains = getAdminDomains();
    if (!in_array($domain, $adminDomains)) {
        return FALSE;
    }
    $params = array('user_id' => $userId, 'domain_id' => $domainId);
    if ($admin) {
        return db_insert('domain_administrators', $params, 'admin_id');
    } else {
        return db_delete('domain_administrators', $params);
    }
}
예제 #2
0
function removeForward($aliasId)
{
    if (!$aliasId) {
        return FALSE;
    }
    $email = getAliasEmail($aliasId);
    if (!$email) {
        return FALSE;
    }
    if ($email != $_SESSION['user']['email']) {
        $adminDomains = getAdminDomains();
        $emailParts = split('@', $email);
        $domain = $emailParts[1];
        if (!in_array($domain, $adminDomains)) {
            return FALSE;
        }
    }
    $conditions = array('alias_id' => $aliasId);
    beginTransaction();
    $ret = db_delete('virtual_aliases', $conditions);
    setUserLocalIfNecessary($email);
    endTransaction();
    return $ret;
}
예제 #3
0
function quotedAdminDomainString()
{
    return join(',', db_quotearray(getAdminDomains()));
}
예제 #4
0
function removeAlias($aliasId)
{
    if (!$aliasId) {
        return FALSE;
    }
    if (!isDomainAdmin()) {
        return FALSE;
    }
    $alias = loadAlias($aliasId);
    if (!$alias) {
        return FALSE;
    }
    $domain = $alias['domain'];
    $adminDomains = getAdminDomains();
    if (!in_array($domain, $adminDomains)) {
        return FALSE;
    }
    $destinationParts = split('@', $alias['destination']);
    $destinationDomain = $destinationParts[1];
    if (!in_array($destinationDomain, $adminDomains)) {
        return FALSE;
    }
    $conditions = array('alias_id' => $aliasId);
    return db_delete('virtual_aliases', $conditions);
}