<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
public static function getSilentWithUID($uid)
{
- return User::getWithValues($uid, array('User', '_silent_user_callback'));
+ return User::getWithValues(null, array('user_id' => $uid), array('User', '_silent_user_callback'));
}
/**
if (($user = User::get($login, $callback))) {
$list[$i] = $user->$property();
- } else if (!$strict || User::isForeignEmailAddress($login)) {
+ } else if (!$strict || (User::isForeignEmailAddress($login) && isvalid_email($login))) {
$list[$i] = $login;
}
}
* 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: