public static function create($usertype, $userid, $credentials) { $user = new User(); $user->usertype = $usertype; $user->userid = $userid; $user->credentials = crypt($credentials, '$6$rounds=5000$' . substr(md5(mt_rand()), rand(0, 8), rand(16, 24))); // just bein' random! OrmManager::save($user); return self::auth($usertype, $userid, $credentials); }
function controller_create($args, $output = "inline") { if (!empty($args["blog"])) { $vars["blog"] = new Blog(); $vars["blog"]->blogname = $args["blog"]["blogname"]; $vars["blog"]->title = $args["blog"]["title"]; $vars["blog"]->subtitle = $args["blog"]["subtitle"]; $vars["blog"]->owner = $args["blog"]["owner"]; try { OrmManager::save($vars["blog"]); $vars["success"] = true; header("Location: /demo/blog#blog_create_success:" . $vars["blog"]->blogname); } catch (Exception $e) { $vars["success"] = false; print_pre($e); } } return $this->GetComponentResponse("./create.tpl", $vars); }