function handler_map($page) { if (Get::b('ajax')) { self::assign_json_to_map($page); return PL_JSON; } else { self::prepare_map($page); } }
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); }
public function apply(PlPage $page) { Platal::load('geoloc'); if (Get::b('ajax')) { $uids = $this->set->getIds(new PlLimit()); $pids = Profile::getPIDsFromUIDs($uids); GeolocModule::assign_json_to_map($page, $pids); $page->runJSON(); exit; } else { GeolocModule::prepare_map($page); return 'geoloc/index.tpl'; } }