public function edit_post($post) { $post = $this->getPost($post); if (!$post->canEdit()) { throw new NotFoundException('Editable post # ' . $post->post_id); } $validator = models\Post::validator('edit'); if (!empty($_POST)) { if ($validator->validate($_POST)) { if ($post->update($validator->output)) { Session::success('Post updated =) woohooo'); $this->_redirect($post->url()); } Session::error('Couldn\'t save... =( Try again!?'); } } $categories = models\Category::all(); $messages = Session::messages(); return $this->tpl->display('blog/post_form', get_defined_vars()); }