From b9c88c6cd08c63f4f9e60be05f28f65d5ebdc612 Mon Sep 17 00:00:00 2001 From: x2000bedo Date: Fri, 3 Sep 2004 00:15:46 +0000 Subject: [PATCH] make_username -> make_forlife --- htdocs/epouse.php | 6 +++--- htdocs/marketing/utilisateurs_identification.php | 4 ++-- htdocs/marketing/utilisateurs_marketing.php | 4 ++-- include/xorg.misc.inc.php | 20 ++++++++++++++++++-- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/epouse.php b/htdocs/epouse.php index 1a1b3d1..821919f 100644 --- a/htdocs/epouse.php +++ b/htdocs/epouse.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: epouse.php,v 1.7 2004-09-02 23:06:10 x2000habouzit Exp $ + $Id: epouse.php,v 1.8 2004-09-03 00:15:46 x2000bedo Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -45,8 +45,8 @@ if (!empty($_REQUEST['submit']) && ($epouse != $epouse_old)) { } else { // le nom de mariage est distinct du nom à l'X // on calcule l'alias pour l'afficher $myepouse = new EpouseReq($_SESSION['uid'], $_SESSION['forlife'], $epouse); - list($prenom_username,) = explode('.',$_SESSION['forlife']); - $alias_old=make_username($prenom_username,$epouse_old); + list($prenom_forlife,$nom_forlife,$promo) = explode('.',$_SESSION['forlife']); + $alias_old=make_forlife($prenom_forlife,$epouse_old,$promo); $myepouse->submit(); $page->assign('epouse_old',$epouse_old); diff --git a/htdocs/marketing/utilisateurs_identification.php b/htdocs/marketing/utilisateurs_identification.php index 9a1d78b..d7115db 100644 --- a/htdocs/marketing/utilisateurs_identification.php +++ b/htdocs/marketing/utilisateurs_identification.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: utilisateurs_identification.php,v 1.4 2004-09-02 23:57:48 x2000bedo Exp $ + $Id: utilisateurs_identification.php,v 1.5 2004-09-03 00:15:49 x2000bedo Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -60,7 +60,7 @@ case "Inscrire": new_admin_page('marketing/utilisateurs_inscrire.tpl'); $page->assign('row', $myrow); //calcul du login de l'inscrit - $page->assign('mailorg',make_username($myrow['prenom'],$myrow['nom'])); + $page->assign('mailorg',make_forlife($myrow['prenom'],$myrow['nom'],$myrow['promo'])); $page->run(); break; diff --git a/htdocs/marketing/utilisateurs_marketing.php b/htdocs/marketing/utilisateurs_marketing.php index 00745f4..736e4c7 100644 --- a/htdocs/marketing/utilisateurs_marketing.php +++ b/htdocs/marketing/utilisateurs_marketing.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: utilisateurs_marketing.php,v 1.5 2004-09-02 23:57:48 x2000bedo Exp $ + $Id: utilisateurs_marketing.php,v 1.6 2004-09-03 00:15:49 x2000bedo Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -87,7 +87,7 @@ switch ($_REQUEST["submit"]) { $num_users=mysql_result($result,0,"count(*)"); // calcul du login - $mailorg = make_username($prenom,$nom); + $mailorg = make_forlife($prenom,$nom,$promo); $globals->db->query("UPDATE identification SET last_known_email='{$_REQUEST['mail']}' diff --git a/include/xorg.misc.inc.php b/include/xorg.misc.inc.php index 1e71221..464e9f6 100644 --- a/include/xorg.misc.inc.php +++ b/include/xorg.misc.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.misc.inc.php,v 1.5 2004-09-02 18:37:15 x2000habouzit Exp $ + $Id: xorg.misc.inc.php,v 1.6 2004-09-03 00:15:51 x2000bedo Exp $ ***************************************************************************/ /** vérifie si une adresse email (sans @) correspond à un alias (FIXME ou une liste)... @@ -87,5 +87,21 @@ function soundex_fr($sIn) $sIn = preg_replace( '`(.)\1`', '$1', $sIn ); // on ne retient que 4 caractères ou on complète avec des blancs return substr( $sIn . ' ', 0, 4); -} +} + +function make_forlife($prenom,$nom,$promo) { + /* 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 + $forlife = strtolower($prenomUS.".".$nomUS.".".$promo); + $forlife = str_replace(" ","-",$forlife); + $forlife = str_replace("'","",$forlife); + return $forlife; +} ?> -- 2.1.4