/** * Updates the user password, this is only a smart reference * @param $user * @param $user_password * @return unknown_type * @throws AppKitException * @author Marius Hein */ public function updateUserPassword(NsmUser &$user, $user_password) { AppKitRandomUtil::initRand(); $user->updatePassword($user_password); $user->save(); return true; }
/** * Returns a simple id string based on letters and numbers * @param unknown_type $length * @param unknown_type $prefix */ public static function genSimpleId($length = 5, $prefix = "") { static $chars = null; if ($chars === null) { $chars = array_merge(range(48, 57, 1), range(65, 90, 1), range(97, 122, 1)); shuffle($chars); // MIX THE CHARS } $o = null; for ($i = 0; $i < $length; $i++) { $o .= chr($chars[mt_rand(0, count($chars) - 1)]); } return $prefix . $o; } /** * Generate a unique continuous html id string * @param unknown_type $prefix */ public static function htmlId($prefix = 'appkit-htmlid') { return sprintf('%s-%04d', $prefix, ++self::$htmlid_counter); } } // Lazy initialising AppKitRandomUtil::initRand();