public function view($post)
 {
     is_object($post) or $post = $this->getPost((int) $post);
     // might throw a NotFound, which is caught outside the application
     //		$post->_fill(array('oele' => 'boele'));
     if (!empty($_POST['body'])) {
         $post->update(array('body' => $_POST['body']));
         return Output::markdown($post->body);
     }
     if (!empty($_GET['json'])) {
         return json_encode(Output::filter($post, array('title', 'body')));
     }
     $messages = Session::messages();
     return $this->tpl->display(__METHOD__, get_defined_vars());
 }
 public function _url($action = '', $more = '', $query = array())
 {
     $x = explode('/', ltrim($this->dispatcher->requestPath, '/'));
     $query = $query + $_GET;
     $uri = Output::url($x[0] . ($action ? '/' . $action . ($more ? '/' . $more : '') : ''), array('get' => $query));
     return $uri;
 }
 public function _redirect($location, $exit = true)
 {
     $goto = 0 === strpos($location, '/') || in_array(substr($location, 0, 6), array('http:/', 'https:')) ? $location : Output::url($location);
     header('Location: ' . $goto);
     if ($exit) {
         exit;
     }
 }
Example #4
0
 protected function _init()
 {
     parent::_init();
     $this->assign('Application', $this::$application);
     $this->assign('User', $this::$application->user);
 }