X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fgoogleapps.php;h=0a22f86cbdd7a1e5eb1b2478a662b37d654cd62e;hb=21c7c593d7100a887f984c49a82c03eb32169fc4;hp=eeaffb6536f4115151ba3e256edb5b88a374719b;hpb=de08a5eb35a0daa5ea1817532f02367e0f0edbec;p=platal.git diff --git a/modules/googleapps.php b/modules/googleapps.php index eeaffb6..0a22f86 100644 --- a/modules/googleapps.php +++ b/modules/googleapps.php @@ -42,16 +42,16 @@ class GoogleAppsModule extends PLModule require_once("googleapps.inc.php"); $page->changeTpl('googleapps/index.tpl'); $page->addJsLink('motdepasse.js'); - $page->assign('pl_title', 'Polytechnique.org - Compte Google Apps'); + $page->setTitle('Compte Google Apps'); - $account = new GoogleAppsAccount(S::v('uid'), S::v('forlife')); + $account = new GoogleAppsAccount(S::user()); // Fills up the 'is Google Apps redirection active' variable. $page->assign('redirect_active', false); $page->assign('redirect_unique', true); if ($account->active()) { - $redirect = new Redirect(S::v('uid')); + $redirect = new Redirect(S::user()); $page->assign('redirect_unique', !$redirect->other_active('googleapps')); $storage = new EmailStorage(S::v('uid'), 'googleapps'); @@ -117,7 +117,7 @@ class GoogleAppsModule extends PLModule function handler_admin(&$page, $action = null) { require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.tpl'); - $page->assign('pl_title', 'Polytechnique.org - Administration Google Apps'); + $page->setTitle('Administration Google Apps'); $page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid'))); if ($action == 'ack') { @@ -163,7 +163,7 @@ class GoogleAppsModule extends PLModule function handler_admin_job(&$page, $job = null) { require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.job.tpl'); - $page->assign('pl_title', 'Polytechnique.org - Administration Google Apps'); + $page->setTitle('Administration Google Apps'); $page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid'))); if ($job) { @@ -183,40 +183,37 @@ class GoogleAppsModule extends PLModule require_once("emails.inc.php"); require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.user.tpl'); - $page->assign('pl_title', 'Polytechnique.org - Administration Google Apps'); + $page->setTitle('Administration Google Apps'); $page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid'))); if (!$user && Post::has('login')) { $user = Post::v('login'); } - if ($user && !is_numeric($user)) { - $res = XDB::query("SELECT id FROM aliases WHERE alias = {?} AND type != 'homonyme'", $user); - $user = $res->fetchOneCell(); - } + $user = User::get($user); if ($user) { $account = new GoogleAppsAccount($user); - $storage = new EmailStorage($user, 'googleapps'); + $storage = new EmailStorage($user->id(), 'googleapps'); // Force synchronization of plat/al and Google Apps passwords. if ($action == 'forcesync' && $account->sync_password) { - $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id = {?}", $user); + $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id = {?}", $user->id()); $account->set_password($res->fetchOneCell()); $page->trigSuccess('Le mot de passe a été synchronisé.'); } // Displays basic account information. $page->assign('account', $account); - $page->assign('admin_account', GoogleAppsAccount::is_administrator($user)); + $page->assign('admin_account', GoogleAppsAccount::is_administrator($user->id())); $page->assign('googleapps_storage', $storage->active); - $page->assign('user', $user); + $page->assign('user', $user->id()); // Retrieves user's pending requests. $res = XDB::iterator( "SELECT q_id, q_recipient_id, p_status, j_type, UNIX_TIMESTAMP(p_entry_date) AS p_entry_date FROM gapps_queue WHERE q_recipient_id = {?} - ORDER BY p_entry_date DESC", $user); + ORDER BY p_entry_date DESC", $user->id()); $page->assign('requests', $res); } }