sn_types = build_types(); $this->sn_old = build_sn_pub(); $this->sn_new = $_search_names; $this->new_alias = true; $this->display_names = array(); build_display_names($this->display_names, $_search_names, $_private_name_end, $this->new_alias); foreach ($this->sn_new AS $key => &$sn) { if (!isset($sn['pub'])) { unset($this->sn_new[$key]); } } $res = XDB::query("SELECT alias FROM aliases WHERE id = {?} AND type = 'alias' AND FIND_IN_SET('usage', flags)", $this->user->id()); $this->old_alias = $res->fetchOneCell(); if ($this->old_alias != $this->new_alias) { $res = XDB::query("SELECT id FROM aliases WHERE alias = {?}", $this->new_alias); if ($res->fetchOneCell()) { $this->new_alias = null; } } } // }}} // {{{ function formu() public function formu() { return 'include/form.valid.names.tpl'; } // }}} // {{{ function _mail_subj() protected function _mail_subj() { return "[Polytechnique.org/NOMS] Changement de noms"; } // }}} // {{{ function _mail_body protected function _mail_body($isok) { global $globals; if ($isok) { $res = " Le changement de nom que tu as demandé vient d'être effectué."; if ($this->old_alias != $this->new_alias) { if ($this->old_alias) { $res .= "\n\n Les alias {$this->old_alias}@{$globals->mail->domain} et @{$globals->mail->domain2} ont été supprimés."; } if ($this->new_alias) { $res .= "\n\n Les alias {$this->new_alias}@{$globals->mail->domain} et @{$globals->mail->domain2} sont maintenant à ta disposition !"; } } if ($globals->mailstorage->googleapps_domain) { require_once 'googleapps.inc.php'; $account = new GoogleAppsAccount($this->user); if ($account->active()) { $res .= "\n\n Si tu utilises Google Apps, tu peux changer ton nom d'usage sur https://mail.google.com/a/polytechnique.org/#settings/accounts."; } } return $res; } else { return " La demande de changement de nom que tu avais faite a été refusée."; } } // }}} // {{{ function commit() public function commit() { require_once 'notifs.inc.php'; require_once 'name.func.inc.php'; register_watch_op($this->user->id(), WATCH_FICHE, '', 'search_names'); set_profile_display($this->display_names); set_alias_names($this->sn_new, $this->sn_old, true, $this->new_alias); // Update the local User object, to pick up the new bestalias. $this->user = User::getSilent($this->user->id()); return true; } // }}} } // }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>