Ejemplo n.º 1
0
 /**
  * News preview
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_preview($slug = null)
 {
     if (!($news = Model_News::get4slug($slug, false))) {
         throw new \HttpNotFoundException();
     }
     $token = \Input::get('token');
     if (!$token || $token != $news->token) {
         throw new \HttpNotFoundException();
     }
     $images = \Config::get('news.image.isEnabled') ? \News\Model_NewsImage::get4news_id($news->id) : array();
     $files = \Config::get('news.file.isEnabled') ? \News\Model_NewsFile::get4news_id($news->id) : array();
     $tags = \Config::get('news.tags.isEnabled') ? \News\Model_NewsTag::get_names4news_id($news->id) : array();
     $title = array('name' => $news->title);
     $header_info = self::get_prview_header_info($news->is_published, $news->published_at);
     $this->set_title_and_breadcrumbs($title, null, null, null, $header_info, true);
     $this->template->subtitle = \View::forge('_parts/news_subinfo', array('news' => $news));
     $this->template->content = \View::forge('detail', array('news' => $news, 'images' => $images, 'files' => $files, 'tags' => $tags));
     if (Site_Util::check_editor_enabled()) {
         $this->template->content->set_safe('html_body', $news->body);
     }
 }