* Profile:
- Better checks on image type for photos -FRU
+ - #646: Don't send a mail to an invalid address -FRU
* Lists:
- #407: RSS feed -FRU
// }}}
// {{{ function set_new_usage()
-function set_new_usage($uid, $usage, $alias=false) {
+function set_new_usage($uid, $usage, $alias=false)
+{
XDB::execute("UPDATE auth_user_md5 set nom_usage={?} WHERE user_id={?}",$usage ,$uid);
XDB::execute("DELETE FROM aliases WHERE FIND_IN_SET('usage',flags) AND id={?}", $uid);
if ($alias && $usage) {
$alias, $uid);
}
$r = XDB::query("SELECT alias FROM aliases WHERE FIND_IN_SET('bestalias', flags) AND id = {?}", $uid);
- if ($r->fetchOneCell() == "") {
+ if ($r->numRows() == "") {
XDB::execute("UPDATE aliases SET flags = 1 | flags WHERE id = {?} LIMIT 1", $uid);
+ $r = XDB::query("SELECT alias FROM aliases WHERE FIND_IN_SET('bestalias', flags) AND id = {?}", $uid);
}
- require_once 'user.func.inc.php';
user_reindex($uid);
+ return $r->fetchOneCell();
}
// }}}
$this->Validate($_uid, true, 'usage');
$this->nom_usage = $_usage;
$this->reason = $_reason;
+ require_once 'xorg.misc.inc.php';
$this->alias = make_username($this->prenom, $this->nom_usage);
if (!$this->nom_usage) $this->alias = "";
function commit()
{
require_once('user.func.inc.php');
- set_new_usage($this->uid, $this->nom_usage, $this->alias);
+ $this->bestalias = set_new_usage($this->uid, $this->nom_usage, $this->alias);
return true;
}
return strtr($string, $uc_convert);
}
+/** creates a username from a first and last name
+*
+* @param $prenom the firstname
+* @param $nom the last name
+*
+* return STRING the corresponding username
+*/
+function make_username($prenom,$nom) {
+ /* on traite le prenom */
+ $prenomUS=replace_accent(trim($prenom));
+ $prenomUS=stripslashes($prenomUS);
+
+ /* on traite le nom */
+ $nomUS=replace_accent(trim($nom));
+ $nomUS=stripslashes($nomUS);
+
+ // calcul du login
+ $username = strtolower($prenomUS.".".$nomUS);
+ $username = str_replace(" ","-",$username);
+ $username = str_replace("'","",$username);
+ return $username;
+}
+
/* Un soundex en français posté par Frédéric Bouchery
Voici une adaptation en PHP de la fonction soundex2 francisée de Frédéric BROUARD (http://sqlpro.developpez.com/Soundex/).
C'est une bonne démonstration de la force des expressions régulières compatible Perl.
$page->trig("updaté correctement.");
}
if (Env::v('nomusageN') != $mr['nom_usage']) {
+ require_once "xorg.misc.inc.php";
set_new_usage($mr['user_id'], Env::v('nomusageN'), make_username(Env::v('prenomN'), Env::v('nomusageN')));
}
if (Env::v('decesN') != $mr['deces']) {
{
extract ($sub);
+ require_once "xorg.misc.inc.php";
$mailorg = make_username($prenom, $nom);
$mailorg2 = $mailorg.sprintf(".%02u", ($promo%100));
$forlife = make_forlife($prenom, $nom, $promo);