From: Stéphane Jacob Date: Thu, 18 Feb 2010 17:51:32 +0000 (+0100) Subject: Moves makeForlife to PlUser. X-Git-Tag: core/1.1.0~78 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;ds=inline;h=0be5c71cbe61952dd302aa11d5acf1ace292aaf3;p=platal.git Moves makeForlife to PlUser. Signed-off-by: Stéphane Jacob --- diff --git a/classes/pluser.php b/classes/pluser.php index ba82b8d..84bcc60 100644 --- a/classes/pluser.php +++ b/classes/pluser.php @@ -369,6 +369,26 @@ abstract class PlUser * served locally by plat/al. */ abstract public static function isForeignEmailAddress($email); + + /** + * Creates a user forlive identifier from: + * @param $firstname User's firstname + * @param $lasttname User's lastname + * @param $category User's promotion or type of account + */ + public static function makeHrid($firstname, $lastname, $category) + { + assert(trim($category)); + $plainFirstname = replace_accent(trim($firstname)); + $plainLastname = replace_accent(trim($lastname)); + + $hrid = strtolower($plainFirstname . '.' . $plainLastname . '.' . trim($category)); + $hrid = str_replace(' ', '-', $hrid); + $hrid = str_replace("'", '', $hrid); + return $hrid; + } + + } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/include/misc.inc.php b/include/misc.inc.php index 3b98f09..831685e 100644 --- a/include/misc.inc.php +++ b/include/misc.inc.php @@ -208,18 +208,6 @@ function make_firstname_case($prenom) return implode('-',$upieces); } - -function make_forlife($prenom, $nom, $promo) -{ - $prenomUS = replace_accent(trim($prenom)); - $nomUS = replace_accent(trim($nom)); - - $forlife = strtolower($prenomUS.".".$nomUS.".".$promo); - $forlife = str_replace(" ","-",$forlife); - $forlife = str_replace("'","",$forlife); - return $forlife; -} - /** Convert ip to uint (to store it in a database) */ function ip_to_uint($ip)