From e2fcbef1c38ec116f9f12c1f4124fe221703332d Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 2 Feb 2007 17:54:41 +0000 Subject: [PATCH] Import make_firstname_case from diogenes git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1467 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/user.func.inc.php | 2 +- include/xorg.misc.inc.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 75f38c5..9d23e74 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -693,7 +693,7 @@ function _user_reindex($uid, $keys, $muls) { while ($toks) { $token = strtolower(replace_accent(array_pop($toks) . $token)); $score = ($toks ? 0 : 10 + $first) * $muls[$i]; - mysql_query("REPLACE INTO search_name (token, uid, score) VALUES('$token',$uid,$score)"); + XDB::execute("REPLACE INTO search_name (token, uid, score) VALUES({?}, {?}, {?})", $token, $uid, $score); $first = 0; } } diff --git a/include/xorg.misc.inc.php b/include/xorg.misc.inc.php index 52faed6..ba3e281 100644 --- a/include/xorg.misc.inc.php +++ b/include/xorg.misc.inc.php @@ -140,6 +140,25 @@ function soundex_fr($sIn) return substr( $sIn . ' ', 0, 4); } +/** met les majuscules au debut de chaque atome du prénom + * @param $prenom le prénom à formater + * return STRING le prénom avec les majuscules + */ +function make_firstname_case($prenom) { + $prenom = strtolower($prenom); + $pieces = explode('-',$prenom); + + foreach ($pieces as $piece) { + $subpieces = explode("'",$piece); + $usubpieces=""; + foreach ($subpieces as $subpiece) + $usubpieces[] = ucwords($subpiece); + $upieces[] = implode("'",$usubpieces); + } + return implode('-',$upieces); +} + + function make_forlife($prenom,$nom,$promo) { $prenomUS = replace_accent(trim($prenom)); $nomUS = replace_accent(trim($nom)); -- 2.1.4