$page->trig("updaté correctement.");
}
+ if (Env::get('nomusageN') != $mr['nom_usage']) {
+ require_once('nomusage.inc.php');
+ set_new_usage($mr['user_id'], Env::get('nomusageN'), make_username(Env::get('prenomN'), Env::get('nomusageN')));
+ }
$r = $globals->xdb->query("SELECT *, a.alias AS forlife
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON (u.user_id=a.id)
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+function set_new_usage($uid, $usage, $alias=false) {
+ global $globals;
+
+ $globals->xdb->execute("UPDATE auth_user_md5 set nom_usage={?} WHERE user_id={?}",$usage ,$uid);
+ $globals->xdb->execute("DELETE FROM aliases WHERE FIND_IN_SET('usage',flags) AND id={?}", $uid);
+ if ($alias && $usage) {
+ $globals->xdb->execute("UPDATE aliases SET flags=flags & 255-1 WHERE id={?}", $uid);
+ $globals->xdb->execute("INSERT INTO aliases VALUES({?}, 'alias', 'usage,bestalias', {?}, null)",
+ $alias, $uid);
+ }
+ $r = $globals->xdb->query("SELECT alias FROM aliases WHERE FIND_IN_SET('bestalias', flags) AND id = {?}", $uid);
+ if ($r->fetchOneCell() == "") {
+ $globals->xdb->execute("UPDATE aliases SET flags = 1 | flags WHERE id = {?} LIMIT 1", $uid);
+ }
+ require_once 'user.func.inc.php';
+ user_reindex($uid);
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
function commit()
{
- global $globals;
-
- $globals->xdb->execute("UPDATE auth_user_md5 set nom_usage={?} WHERE user_id={?}",$this->nom_usage ,$this->uid);
- $globals->xdb->execute("DELETE FROM aliases WHERE FIND_IN_SET('usage',flags) AND id={?}", $this->uid);
- if ($this->alias) {
- $globals->xdb->execute("UPDATE aliases SET flags=flags & 255-1 WHERE id={?}", $this->uid);
- $globals->xdb->execute("INSERT INTO aliases VALUES({?}, 'alias', 'usage,bestalias', {?}, null)",
- $this->alias, $this->uid);
- }
- $r = $globals->xdb->query("SELECT alias FROM aliases WHERE FIND_IN_SET('bestalias', flags) AND id = {?}", $this->uid);
- if ($r->fetchOneCell() == "") {
- $globals->xdb->execute("UPDATE aliases SET flags = 1 | flags WHERE id = {?} LIMIT 1", $this->uid);
- }
- require_once 'user.func.inc.php';
- user_reindex($this->uid);
+ require_once('nomusage.inc.php');
+ set_new_usage($this->uid, $this->nom_usage, $this->alias);
return true;
}