本文整理汇总了PHP中Redirect::add_email方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::add_email方法的具体用法?PHP Redirect::add_email怎么用?PHP Redirect::add_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::add_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
function handler_redirect($page, $action = null, $email = null, $rewrite = null)
{
global $globals;
require_once 'emails.inc.php';
$page->changeTpl('emails/redirect.tpl');
$user = S::user();
$page->assign_by_ref('user', $user);
$page->assign('eleve', $user->promo() >= date("Y") - 5);
$redirect = new Redirect($user);
// FS#703 : $_GET is urldecoded twice, hence
// + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
// Since there can be no spaces in emails, we can fix this with :
$email = str_replace(' ', '+', $email);
// Apply email redirection change requests.
$result = SUCCESS;
if ($action == 'remove' && $email) {
$result = $redirect->delete_email($email);
}
if ($action == 'active' && $email) {
$redirect->modify_one_email($email, true);
}
if ($action == 'inactive' && $email) {
$redirect->modify_one_email($email, false);
}
if ($action == 'rewrite' && $email) {
$redirect->modify_one_email_redirect($email, $rewrite);
}
if (Env::has('emailop')) {
S::assert_xsrf_token();
$actifs = Env::v('emails_actifs', array());
if (Env::v('emailop') == "ajouter" && Env::has('email')) {
$error_email = false;
$new_email = Env::v('email');
if ($new_email == "new@example.org") {
$new_email = Env::v('email_new');
}
$result = $redirect->add_email($new_email);
if ($result == ERROR_INVALID_EMAIL) {
$error_email = true;
$page->assign('email', $new_email);
}
$page->assign('retour', $result);
$page->assign('error_email', $error_email);
} elseif (empty($actifs)) {
$result = ERROR_INACTIVE_REDIRECTION;
} elseif (is_array($actifs)) {
$result = $redirect->modify_email($actifs, Env::v('emails_rewrite', array()));
}
}
switch ($result) {
case ERROR_INACTIVE_REDIRECTION:
$page->trigError('Tu ne peux pas avoir aucune adresse de redirection active, sinon ton adresse ' . $user->forlifeEmail() . ' ne fonctionnerait plus.');
break;
case ERROR_INVALID_EMAIL:
$page->trigError('Erreur : l\'email n\'est pas valide.');
break;
case ERROR_LOOP_EMAIL:
$page->trigError('Erreur : ' . $user->forlifeEmail() . ' ne doit pas être renvoyé vers lui-même, ni vers son équivalent en ' . $globals->mail->domain2 . ' ni vers polytechnique.edu.');
break;
}
// Fetch existing email aliases.
$alias = XDB::query('SELECT CONCAT(s.email, \'@\', d.name) AS email, s.expire
FROM email_source_account AS s
INNER JOIN email_virtual_domains AS m ON (s.domain = m.id)
INNER JOIN email_virtual_domains AS d ON (m.id = d.aliasing)
WHERE s.uid = {?}
ORDER BY NOT(s.type = \'alias_aux\'), s.email, d.name', $user->id());
$page->assign('alias', $alias->fetchAllAssoc());
$page->assign('best_email', $user->bestEmail());
$page->assign('emails', $redirect->emails);
// Display GoogleApps acount information.
require_once 'googleapps.inc.php';
$page->assign('googleapps', GoogleAppsAccount::account_status($user->id()));
require_once 'emails.combobox.inc.php';
fill_email_combobox($page, array('job', 'stripped_directory'));
}
示例2: array
function handler_end($page, $hash = null)
{
global $globals;
$_SESSION['subState'] = array('step' => 5);
// Reject registration requests from unsafe IP addresses (and remove the
// registration information from the database, to prevent IP changes).
if (check_ip('unsafe')) {
send_warning_mail('Une IP surveillée a tenté de finaliser son inscription.');
XDB::execute("DELETE FROM register_pending\n WHERE hash = {?} AND hash != 'INSCRIT'", $hash);
return PL_FORBIDDEN;
}
// Retrieve the pre-registration information using the url-provided
// authentication token.
$res = XDB::query("SELECT r.uid, p.pid, r.forlife, r.bestalias, r.mailorg2,\n r.password, r.email, r.services, r.naissance,\n ppn.lastname_initial, ppn.firstname_initial, pe.promo_year,\n pd.promo, p.sex, p.birthdate_ref, a.type, a.email AS old_account_email\n FROM register_pending AS r\n INNER JOIN accounts AS a ON (r.uid = a.uid)\n INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms))\n INNER JOIN profiles AS p ON (p.pid = ap.pid)\n INNER JOIN profile_public_names AS ppn ON (ppn.pid = p.pid)\n INNER JOIN profile_display AS pd ON (p.pid = pd.pid)\n INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET('primary', pe.flags))\n WHERE hash = {?} AND hash != 'INSCRIT' AND a.state = 'pending'", $hash);
if (!$hash || $res->numRows() == 0) {
$page->kill("<p>Cette adresse n'existe pas, ou plus, sur le serveur.</p>\n <p>Causes probables :</p>\n <ol>\n <li>Vérifie que tu visites l'adresse du dernier\n email reçu s'il y en a eu plusieurs.</li>\n <li>Tu as peut-être mal copié l'adresse reçue par\n email, vérifie-la à la main.</li>\n <li>Tu as peut-être attendu trop longtemps pour\n confirmer. Les pré-inscriptions sont annulées\n tous les 30 jours.</li>\n <li>Tu es en fait déjà inscrit.</li>\n </ol>");
}
list($uid, $pid, $forlife, $bestalias, $emailXorg2, $password, $email, $services, $birthdate, $lastname, $firstname, $yearpromo, $promo, $sex, $birthdate_ref, $type, $old_account_email) = $res->fetchOneRow();
$isX = $type == 'x';
$mail_domain = User::$sub_mail_domains[$type] . $globals->mail->domain;
// Prepare the template for display.
$page->changeTpl('register/end.tpl');
$page->assign('forlife', $forlife);
$page->assign('firstname', $firstname);
// Check if the user did enter a valid password; if not (or if none is found),
// get her an information page.
if (Post::has('response')) {
$expected_response = sha1("{$forlife}:{$password}:" . S::v('challenge'));
if (Post::v('response') != $expected_response) {
$page->trigError("Mot de passe invalide.");
S::logger($uid)->log('auth_fail', 'bad password (register/end)');
return;
}
} else {
return;
}
//
// Create the user account.
//
XDB::startTransaction();
XDB::execute("UPDATE accounts\n SET password = {?}, state = 'active',\n registration_date = NOW(), email = NULL\n WHERE uid = {?}", $password, $uid);
XDB::execute("UPDATE profiles\n SET birthdate = {?}, last_change = NOW()\n WHERE pid = {?}", $birthdate, $pid);
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'forlife\', \'\', id
FROM email_virtual_domains
WHERE name = {?}', $forlife, $uid, $mail_domain);
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'alias\', \'bestalias\', id
FROM email_virtual_domains
WHERE name = {?}', $bestalias, $uid, $mail_domain);
if ($emailXorg2) {
XDB::execute('INSERT INTO email_source_account (email, uid, type, flags, domain)
SELECT {?}, {?}, \'alias\', \'\', id
FROM email_virtual_domains
WHERE name = {?}', $emailXorg2, $uid, $mail_domain);
}
XDB::commit();
// Try to start a session (so the user don't have to log in); we will use
// the password available in Post:: to authenticate the user.
Platal::session()->start(AUTH_PASSWD);
// Add the registration email address as first and only redirection.
require_once 'emails.inc.php';
$user = User::getSilentWithUID($uid);
$redirect = new Redirect($user);
$redirect->add_email($email);
fix_bestalias($user);
// If the user was registered to some aliases and MLs, we must change
// the subscription to her forlife email.
if ($old_account_email) {
$listClient = new MMList($user);
$listClient->change_user_email($old_account_email, $user->forlifeEmail());
update_alias_user($old_account_email, $user->forlifeEmail());
}
// Subscribe the user to the services she did request at registration time.
require_once 'newsletter.inc.php';
foreach (explode(',', $services) as $service) {
switch ($service) {
case 'ax_letter':
/* This option is deprecated by 'com_letters' */
NewsLetter::forGroup(NewsLetter::GROUP_AX)->subscribe($user);
break;
case 'com_letters':
NewsLetter::forGroup(NewsLetter::GROUP_AX)->subscribe($user);
NewsLetter::forGroup(NewsLetter::GROUP_EP)->subscribe($user);
NewsLetter::forGroup(NewsLetter::GROUP_FX)->subscribe($user);
break;
case 'nl':
NewsLetter::forGroup(NewsLetter::GROUP_XORG)->subscribe($user);
break;
case 'imap':
Email::activate_storage($user, 'imap', Bogo::IMAP_DEFAULT);
break;
case 'ml_promo':
if ($isX) {
$r = XDB::query('SELECT id FROM groups WHERE diminutif = {?}', $yearpromo);
if ($r->numRows()) {
$asso_id = $r->fetchOneCell();
XDB::execute('INSERT IGNORE INTO group_members (uid, asso_id)
VALUES ({?}, {?})', $uid, $asso_id);
try {
//.........这里部分代码省略.........