Exemplo n.º 1
0
 function __construct()
 {
     Form::Form('NewsDetailForm');
     $id = Url::get('news_id', 0);
     if ($id) {
         if (!CGlobal::$news_details) {
             CGlobal::$news_details = DB::select("news", "id={$id}");
         }
         if (CGlobal::$news_details && (CGlobal::$news_details['status'] == 1 || CGlobal::$news_details['status'] == 0 && User::have_permit(ADMIN_NEWS))) {
             $this->news = CGlobal::$news_details;
         }
     }
     if (!$this->news) {
         Url::redirect('news_list', array('news_catid', 'azname'));
     } else {
         DB::query("UPDATE news SET view_num=view_num+1 WHERE id =" . $this->news['id']);
     }
     $news_title = $this->news['title'];
     $catid = $this->news['news_catid'];
     $str_keywords = '';
     $str_catSub = '';
     $meta_keywords = '';
     $meta_desc = '';
     if (isset(CGlobal::$allNewsCategories[$catid])) {
         $news_title .= " - " . CGlobal::$allNewsCategories[$catid]['name'];
         $curMainCat = CGlobal::$allNewsCategories[$catid];
         $str_catSub = $curMainCat['name'];
         if ($curMainCat['keywords']) {
             $meta_keywords .= ($meta_keywords ? ', ' : '') . $curMainCat['keywords'];
         }
         if ($curMainCat['description']) {
             $meta_desc .= ($meta_desc ? ', ' : '') . $curMainCat['description'];
         }
     }
     if ($this->news['brief']) {
         CGlobal::$meta_desc = AZLib::cleanHtml($this->news['brief']);
     } elseif ($meta_desc != '') {
         CGlobal::$meta_desc = $meta_desc;
     }
     if ($meta_keywords != '') {
         CGlobal::$keywords = $meta_keywords;
     } elseif ($str_catSub != '') {
         CGlobal::$keywords = $str_catSub;
     }
     CGlobal::$website_title = stripslashes($news_title) . ' - Tin tức';
     //CGlobal::$website_title = AznetLib::subString($news_title,0,100,true);
     //		$this->link_css('style/aznet/jquery.lightbox.css');
     //		$this->link_js('javascript/jquery/lightbox/jquery.lightbox.js');
 }