Example #1
0
    $smarty->assign('tab', $_GET['tab']);
} else {
    $smarty->assign('tab', 0);
}
if ($address_id == 0) {
    // for user addresslist display only - domains now have this set nonzero, ie, this also means domain_user == false
    $smarty->assign("auth_method", $auth_method);
    if ($auth_method == "pop3" && !empty($routing_domain) || $auth_method == "ldap" || $auth_method == "exchange" || $auth_method == "sql" || $auth_method == "internal" || $auth_method == "external") {
        $smarty->assign('login', $lang['text_username']);
    } else {
        $smarty->assign('login', $lang['text_email_address']);
    }
    // get primary address
    $primary_email_id = get_primary_email_id($euid);
    $smarty->assign('primary_email_id', $primary_email_id);
    $smarty->assign('address', get_email_address_by_id($primary_email_id));
    // get the rest of the addresses
    $sth = $dbh->prepare("SELECT id, email FROM users WHERE maia_user_id = ? AND email NOT LIKE '@%' AND id <> ?");
    $res = $sth->execute(array($euid, $primary_email_id));
    $user_addr = array();
    while ($row = $res->fetchRow()) {
        $smarty->assign('atleastone', true);
        $user_addr[] = array('addid' => $row["id"], 'address' => $row["email"]);
    }
    $smarty->assign('user_addr', $user_addr);
    $sth->free();
    if ($auth_method == "internal") {
        $smarty->assign('user_name', get_user_name($euid));
    }
}
if ($address_id == 0 || $domain_user) {
Example #2
0
} elseif (isset($_POST["button_link"])) {
    $button = "link";
    if (isset($_POST["email"]) && isset($_POST["user"])) {
        $smarty->assign('email', 1);
        $smarty->assign('user', 1);
        // Note that $email is an array
        $email = $_POST["email"];
        $new_owner_id = trim($_POST["user"]);
        $lang['text_address_linked_array'] = array();
        if (is_a_domain_default_user($new_owner_id)) {
            //cannot link to domain deault accounts
            $lang['text_address_linked_array'][] = $lang['text_address_not_linked'];
        } else {
            foreach ($email as $address_id) {
                $old_owner_id = get_email_address_owner($address_id);
                $email_address = get_email_address_by_id($address_id);
                transfer_email_address_to_user($old_owner_id, $new_owner_id, $email_address);
                $lang['text_address_linked_array'][] = sprintf($lang['text_address_linked'], $email_address, get_user_name($new_owner_id));
            }
        }
    }
} elseif (isset($_POST["button_find"])) {
    $button = "find";
    if (isset($_POST["lookup"])) {
        $smarty->assign('lookup', 1);
        $lookup = trim($_POST["lookup"]);
        $lookup = str_replace("*", ".*", $lookup);
        $lookup = "/^" . $lookup . "\$/";
        $domain_name = array();
        $user = array();
        if (!$super) {