本文整理汇总了PHP中Redirect::other_active方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::other_active方法的具体用法?PHP Redirect::other_active怎么用?PHP Redirect::other_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::other_active方法的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);
}
示例2: check_redirect
function check_redirect($red = null)
{
require_once 'emails.inc.php';
if (is_null($red)) {
$user = S::user();
$red = new Redirect($user);
}
if ($red->get_uid() == S::v('uid')) {
$_SESSION['no_redirect'] = !$red->other_active('');
$_SESSION['mx_failures'] = $red->get_broken_mx();
}
}