sn_types = build_types(); $this->sn_old = build_sn_pub($this->profile->id()); $this->sn_new = $_search_names; $this->new_alias = true; $this->display_names = array(); build_display_names($this->display_names, $_search_names, $this->profile->isFemale(), $_private_name_end, $this->new_alias); foreach ($this->sn_new AS $key => &$sn) { if (!isset($sn['pub'])) { unset($this->sn_new[$key]); } } if (!is_null($this->profileOwner)) { $res = XDB::query("SELECT alias FROM aliases WHERE uid = {?} AND type = 'alias' AND FIND_IN_SET('usage', flags)", $this->profileOwner->id()); $this->old_alias = $res->fetchOneCell(); if ($this->old_alias != $this->new_alias) { $res = XDB::query("SELECT uid 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 (!is_null($this->profileOwner)) { 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->profileOwner); 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 'name.func.inc.php'; set_profile_display($this->display_names, $this->profile); if (!is_null($this->profileOwner)) { set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(), $this->profileOwner->id(), true, $this->new_alias); // Update the local User object, to pick up the new bestalias. $this->profileOwner = User::getSilentWithUID($this->profileOwner->id()); } return true; } // }}} } // }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>