Пример #1
0
 /**
  * Action detail
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_detail($slug = null)
 {
     $content_page = Model_ContentPage::check_authority4unique_key('slug', $slug);
     $this->check_browse_authority(\Site_Util::convert_is_secure2public_flag($content_page->is_secure));
     $this->set_title_and_breadcrumbs($content_page->title);
     $this->template->content = \View::forge('page/detail', array('content_page' => $content_page));
     if (Site_Util::check_editor_enabled()) {
         $this->template->content->set_safe('html_body', $content_page->body);
     }
 }
Пример #2
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);
     }
 }