当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::modify_one_email方法代码示例

本文整理汇总了PHP中Redirect::modify_one_email方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::modify_one_email方法的具体用法?PHP Redirect::modify_one_email怎么用?PHP Redirect::modify_one_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redirect的用法示例。


在下文中一共展示了Redirect::modify_one_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GoogleAppsAccount

 function handler_index($page, $action = null)
 {
     require_once 'emails.inc.php';
     require_once 'googleapps.inc.php';
     $page->changeTpl('googleapps/index.tpl');
     $page->setTitle('Compte Google Apps');
     $user = S::user();
     $account = new GoogleAppsAccount($user);
     // Fills up the 'is Google Apps redirection active' variable.
     $redirect_active = false;
     $redirect_unique = true;
     $gapps_email = '';
     if ($account->active()) {
         $redirect = new Redirect($user);
         foreach ($redirect->emails as $email) {
             if ($email->type == 'googleapps') {
                 $gapps_email = $email->email;
                 $redirect_active = $email->active;
                 $redirect_unique = !$redirect->other_active($email->email);
             }
         }
     }
     $page->assign('redirect_active', $redirect_active);
     $page->assign('redirect_unique', $redirect_unique);
     // Updates the Google Apps account as required.
     if ($action) {
         if ($action == 'password' && Post::has('pwsync')) {
             S::assert_xsrf_token();
             if (Post::v('pwsync') == 'sync') {
                 $account->set_password_sync(true);
                 $account->set_password($user->password());
             } else {
                 $account->set_password_sync(false);
             }
         } elseif ($action == 'password' && Post::has('pwhash') && Post::t('pwhash') && !$account->sync_password) {
             S::assert_xsrf_token();
             $account->set_password(Post::t('pwhash'));
         }
         if ($action == 'suspend' && Post::has('suspend') && $account->active()) {
             S::assert_xsrf_token();
             if ($account->pending_update_suspension) {
                 $page->trigWarning("Ton compte est déjà en cours de désactivation.");
             } else {
                 if (!$redirect_active || $redirect->modify_one_email($gapps_email, false) == SUCCESS) {
                     $account->suspend();
                     $page->trigSuccess("Ton compte Google Apps est dorénavant désactivé.");
                 } else {
                     $page->trigError("Ton compte Google Apps est ta seule adresse de redirection. Ton compte ne peux pas être désactivé.");
                 }
             }
         } elseif ($action == 'unsuspend' && Post::has('unsuspend') && $account->suspended()) {
             $account->unsuspend(Post::b('redirect_mails', true));
             $page->trigSuccess("Ta demande de réactivation a bien été prise en compte.");
         }
         if ($action == 'create') {
             $page->assign('has_password_sync', Get::has('password_sync'));
             $page->assign('password_sync', Get::b('password_sync', true));
         }
         if ($action == 'create' && Post::has('password_sync') && Post::has('redirect_mails')) {
             S::assert_xsrf_token();
             $password_sync = Post::b('password_sync');
             $redirect_mails = Post::b('redirect_mails');
             if ($password_sync) {
                 $password = $user->password();
             } else {
                 $password = Post::t('pwhash');
             }
             $account->create($password_sync, $password, $redirect_mails);
             $page->trigSuccess("La demande de création de ton compte Google Apps a bien été enregistrée.");
         }
     }
     $page->assign('account', $account);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:73,代码来源:googleapps.php

示例2: 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'));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:76,代码来源:email.php


注:本文中的Redirect::modify_one_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。