Пример #1
0
 private function _getShareData($shareInfo)
 {
     $data = array('title' => '', 'source' => '', 'content' => array());
     $shareInfo = !empty($shareInfo['body']['shareInfo']) ? $shareInfo['body']['shareInfo'] : array();
     if (!empty($shareInfo)) {
         $sid = $shareInfo['shareId'];
         $type = $shareInfo['shareType'];
         switch ($type) {
             case 'topic':
                 $info = ForumUtils::getTopicInfo($sid);
                 $content = ForumUtils::getTopicContent($sid);
                 $data['title'] = !empty($info['subject']) ? $info['subject'] : '';
                 $data['source'] = !empty($info['dateline']) ? date('Y-m-d H:i:s', $info['dateline']) : '';
                 $data['content'] = $this->_getPostContent($content);
                 break;
             case 'news':
                 $info = PortalUtils::getNewsInfo($sid);
                 $content = PortalUtils::getNewsContent($info);
                 $data['title'] = !empty($info['title']) ? $info['title'] : '';
                 $data['source'] = !empty($info['dateline']) ? date('Y-m-d H:i:s', $info['dateline']) : '';
                 $data['content'] = $this->_filterContent($content);
                 break;
             default:
                 break;
         }
     }
     return $data;
 }
Пример #2
0
 private function _getNewsInfo($article, $page)
 {
     global $_G;
     $newsInfo = array();
     $aid = $article['aid'];
     $articleUrl = $this->_fetchArticleUrl($aid);
     // 门户静态化,暂时去掉这个跳转,因为有些用户不支持wap版的门户页面
     /*
     if(!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade'] && !isset($_G['makehtml']) && empty($_GET['diy']) && empty($article['url'])) {
         // dheader('location:'. fetch_article_url($article));
         $newsInfo['redirectUrl'] = $articleUrl;
         return $newsInfo;
     }
     */
     $article_count = C::t('portal_article_count')->fetch($aid);
     if ($article_count) {
         $article = array_merge($article_count, $article);
     }
     if ($article_count) {
         C::t('portal_article_count')->increase($aid, array('viewnum' => 1));
         unset($article_count);
     } else {
         C::t('portal_article_count')->insert(array('aid' => $aid, 'catid' => $article['catid'], 'viewnum' => 1));
     }
     if ($article['url']) {
         // if(!isset($_G['makehtml'])) {
         //     dheader("location:{$article['url']}");
         // }
         // exit();
         $newsInfo['redirectUrl'] = $article['url'];
         return $newsInfo;
     }
     $cat = category_remake($article['catid']);
     $article['pic'] = pic_get($article['pic'], '', $article['thumb'], $article['remote'], 1, 1);
     if ($page < 1) {
         $page = 1;
     }
     $org = array();
     if ($article['idtype'] == 'blogid') {
         $org = C::t('home_blog')->fetch($article['id']);
         if (empty($org)) {
             C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => ''));
             // dheader('location: '.  fetch_article_url($article));
             // exit();
             $newsInfo['redirectUrl'] = $articleUrl;
             return $newsInfo;
         }
     }
     $article['allowcomment'] = !empty($cat['allowcomment']) && !empty($article['allowcomment']) ? 1 : 0;
     $article['timestamp'] = $article['dateline'];
     $article['dateline'] = dgmdate($article['dateline']);
     $newsInfo['redirectUrl'] = '';
     $newsInfo['catName'] = WebUtils::t('文章详情');
     $newsInfo['title'] = WebUtils::emptyHtml($article['title']);
     $newsInfo['dateline'] = $article['dateline'];
     $newsInfo['author'] = $article['username'];
     $newsInfo['viewNum'] = (int) $article['viewnum'];
     $newsInfo['commentNum'] = (int) $article['commentnum'];
     $newsInfo['allowComment'] = $article['allowcomment'] ? 1 : 0;
     $newsInfo['summary'] = $article['summary'];
     $newsInfo['pageCount'] = (int) $article['contents'];
     $newsInfo['from'] = $article['from'];
     $newsInfo['articleUrl'] = $articleUrl;
     $newsInfo['content'] = $this->_transContent(PortalUtils::getNewsContent($article, $page));
     return $newsInfo;
 }