X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fgoogleapps.inc.php;h=43025931549a30992ccf32990822f8ffc19a3fdc;hb=dfcccfc0f277d90e5ef4af1e6b33ef3e1e76d6e2;hp=45337d43d9be7d794ec56a064ef9bfc7cd329919;hpb=5316f275c197ec7057457131e4aa5e0249c739fc;p=platal.git diff --git a/include/googleapps.inc.php b/include/googleapps.inc.php index 45337d4..4302593 100644 --- a/include/googleapps.inc.php +++ b/include/googleapps.inc.php @@ -1,6 +1,6 @@ activate_mail_redirection) { require_once('emails.inc.php'); - $storage = new EmailStorage($user->id(), 'googleapps'); + $storage = new EmailStorage($user, 'googleapps'); $storage->activate(); } // Sends the 'account created' email to the user, with basic documentation. - $res = XDB::query( - "SELECT FIND_IN_SET('femme', u.flags), prenom - FROM auth_user_md5 AS u - WHERE u.user_id = {?}", $user->id()); - list($sexe, $prenom) = $res->fetchOneRow(); - $mailer = new PlMailer('googleapps/create.mail.tpl'); $mailer->assign('account', $account); $mailer->assign('email', $user->bestEmail()); $mailer->assign('googleapps_domain', $globals->mailstorage->googleapps_domain); - $mailer->assign('prenom', $prenom); - $mailer->assign('sexe', $sexe); + $mailer->assign('prenom', $user->displayName()); + $mailer->assign('sexe', $user->isFemale()); $mailer->send(); } @@ -74,22 +68,16 @@ function post_queue_u_update($job) { if ($account->active()) { // Re-adds the email redirection (if the user did request it). if ($account->activate_mail_redirection) { - $storage = new EmailStorage($user->id, 'googleapps'); + $storage = new EmailStorage($user, 'googleapps'); $storage->activate(); } // Sends an email to the account owner. - $res = XDB::query( - "SELECT FIND_IN_SET('femme', u.flags), prenom - FROM auth_user_md5 AS u - WHERE u.user_id = {?}", $user->id()); - list($sexe, $prenom) = $res->fetchOneRow(); - $mailer = new PlMailer('googleapps/unsuspend.mail.tpl'); $mailer->assign('account', $account); $mailer->assign('email', $user->bestEmail()); - $mailer->assign('prenom', $prenom); - $mailer->assign('sexe', $sexe); + $mailer->assign('prenom', $user->displayName()); + $mailer->assign('sexe', $user->isFemale()); $mailer->send(); } } @@ -101,7 +89,7 @@ function post_queue_u_update($job) { // TODO(vincent.zanotti): add the url of gappsd, when available. class GoogleAppsAccount { - // User identification: user id, and forlife. + // User identification: user id, and hruid. private $user; public $g_account_name; @@ -336,7 +324,7 @@ class GoogleAppsAccount if (!$this->pending_update_suspension && !$this->pending_validation_unsuspend) { require_once('validations.inc.php'); - $unsuspend = new GoogleAppsUnsuspendReq($this->user->id()); + $unsuspend = new GoogleAppsUnsuspendReq($this->user); $unsuspend->submit(); $this->pending_validation_unsuspend = true; } @@ -353,8 +341,8 @@ class GoogleAppsAccount if ($this->sync_password) { $res = XDB::query( "SELECT password - FROM auth_user_md5 - WHERE user_id = {?}", $this->user->id()); + FROM accounts + WHERE uid = {?}", $this->user->id()); $password = ($res->numRows() > 0 ? $res->fetchOneCell() : false); } else { $password = false; @@ -379,6 +367,7 @@ class GoogleAppsAccount if (!$this->pending_create) { // Retrieves information on the new account. + // TODO: retreive first_name and last_name from the profile. $res = XDB::query( "SELECT nom, nom_usage, prenom FROM auth_user_md5