/** * Execute the controller. * * @return mixed Return executed result. * * @throws \LogicException * @throws \RuntimeException */ public function execute() { $ctrl = new \Admin\Controller\Blog\SaveController($this->input, $this->app); if (!$ctrl->execute()) { list($url, $msg, $type) = $ctrl->getRedirect(true); $this->setRedirect($url, $msg, $type); return false; } list($url, $msg, $type) = $ctrl->getRedirect(true); $this->setRedirect(Router::buildHttp('admin:settings'), $msg, $type); return true; }
/** * createBlog * * @param Data $user * * @return \Admin\Controller\Blog\SaveController * * @throws \Exception */ protected function createBlog(Data $user) { $blog['owner'] = $user->id; $blog['title'] = $user->fullname . "'s Blog"; $blog['alias'] = $this->createBlogAlias($user->username); $blog['state'] = 1; $blog['timezone'] = 'UTC'; $this->input->set('blog', $blog); $this->input->set('user_id', $user->id); $blogCtrl = new \Admin\Controller\Blog\SaveController($this->input, $this->app); try { $blogCtrl->execute(); } catch (\OutOfRangeException $e) { // Nothing have to do... } return $blogCtrl; }