Ejemplo n.º 1
0
 private function _getInfoList($uid, $puid)
 {
     $list = array();
     $topicList = array();
     if ($uid == $puid) {
         $topicList = DzUserInfo::getFavouriteTopics($uid);
     } else {
         $topicList = DzUserInfo::getTopicsByUid($puid);
     }
     foreach ($topicList as $topic) {
         $topicSummary = ForumUtils::getTopicSummary((int) $topic['tid']);
         $tmpTopic['board_id'] = (int) $topic['fid'];
         $tmpTopic['board_name'] = ForumUtils::getForumName((int) $topic['fid']);
         $tmpTopic['topic_id'] = (int) $topic['tid'];
         $tmpTopic['title'] = $topic['subject'];
         $tmpTopic['user_id'] = (int) $topic['authorid'];
         $tmpTopic['lastpost'] = $topic['lastpost'] . "000";
         $tmpTopic['user_nick_name'] = $topic['author'];
         $tmpTopic['hits'] = (int) $topic['views'];
         $tmpTopic['content'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' ');
         $tmpTopic['replies'] = (int) $topic['replies'];
         $tmpTopic['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']);
         $list[] = $tmpTopic;
     }
     return $list;
 }
Ejemplo n.º 2
0
 protected function transCommentMessage($message)
 {
     $contents = array();
     $message = WebUtils::emptyReturnLine($message);
     $message = explode('</blockquote></div>', $message);
     foreach ($message as $line) {
         $matches = array();
         preg_match('/(.*?)<div class="quote"><blockquote>(.*)/', $line, $matches);
         if (!empty($matches)) {
             $matches[1] != '' && ($contents[] = $this->_makeContent('text', $matches[1]));
             $contents[] = $this->_makeContent('quoteText', $matches[2]);
         } else {
             $line != '' && ($contents[] = $this->_makeContent('text', $line));
         }
     }
     return $contents;
 }
Ejemplo n.º 3
0
 private function _transTopicList($topicList, $type)
 {
     $list = array();
     global $_G;
     $forum = $_G['forum'];
     foreach ($topicList as $topic) {
         $tmpTopicInfo = ForumUtils::getTopicInfo((int) $topic);
         $topicSummary = ForumUtils::getTopicSummary((int) $topic);
         $topicInfo['board_id'] = (int) $tmpTopicInfo['fid'];
         $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpTopicInfo['fid']);
         $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']);
         $topicInfo['topic_id'] = (int) $topic;
         $topicInfo['type_id'] = (int) $tmpTopicInfo['typeid'];
         $topicInfo['sort_id'] = (int) $tmpTopicInfo['sortid'];
         $topicInfo['title'] = WebUtils::emptyHtml($tmpTopicInfo['subject']);
         $topicSummary['msg'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' ');
         $topicInfo['subject'] = $topicSummary['msg'];
         $topicInfo['user_id'] = (int) $tmpTopicInfo['authorid'];
         if ($type = 'favorite' && empty($tmpTopicInfo['author'])) {
             $dateline = UserTopicInfo::getUserfavorite($_G['uid'], $topic);
             $topicInfo['last_reply_date'] = $dateline . '000';
             $topicInfo['user_nick_name'] = UserUtils::getUserName($dateline['uid']);
         } else {
             $topicInfo['last_reply_date'] = $tmpTopicInfo['dateline'] . '000';
             $topicInfo['user_nick_name'] = (string) $tmpTopicInfo['author'];
         }
         $topicInfo['hits'] = (int) $tmpTopicInfo['views'];
         $topicInfo['replies'] = (int) $tmpTopicInfo['replies'];
         $topicInfo['top'] = (int) ForumUtils::isTopTopic($topic) ? 1 : 0;
         $topicInfo['status'] = (int) $tmpTopicInfo['status'];
         $topicInfo['essence'] = (int) $tmpTopicInfo['digest'] ? 1 : 0;
         $topicInfo['hot'] = (int) $tmpTopicInfo['highlight'] ? 1 : 0;
         $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']);
         $list[] = $topicInfo;
     }
     return $list;
 }
Ejemplo n.º 4
0
 /**
  * 获取获取设置客户端尾巴
  */
 public static function getMobileSign($status)
 {
     if (!WebUtils::getDzPluginAppbymeAppConfig('mobile_allow_app_sign')) {
         return '';
     }
     $postSigns = array('android' => WebUtils::t('来自安卓手机客户端'), 'apple' => WebUtils::t('来自苹果手机客户端'));
     $postSignText = WebUtils::getDzPluginAppbymeAppConfig('mobile_sign_post');
     $postSignText = WebUtils::emptyReturnLine($postSignText);
     $matches = array();
     preg_match_all('/\\[title_(all|android|apple)\\](.*?)\\[\\/title_\\1\\]/', $postSignText, $matches, PREG_SET_ORDER);
     foreach ($matches as $matche) {
         if ($matche[1] == 'all') {
             $postSigns['android'] = $postSigns['apple'] = $matche[2];
             break;
         } else {
             if ($matche[1] == 'android' || $matche[1] == 'apple') {
                 $postSigns[$matche[1]] = $matche[2];
             }
         }
     }
     $postSign = '';
     // if ($status & DzForumPost::STATUS_SEND_FROM_APP_ANDROID) {
     if (getstatus($status, 16)) {
         $postSign = $postSigns['android'];
         // } else if ($status & DzForumPost::STATUS_SEND_FROM_APP_APPLE) {
     } else {
         if (getstatus($status, 15)) {
             $postSign = $postSigns['apple'];
         } else {
             $postSign = '';
         }
     }
     return WebUtils::emptyHtml($postSign);
 }
 private function _getCommentMessage($quoteComment)
 {
     $quoteComment['message'] = WebUtils::emptyReturnLine($quoteComment['message'], ' ');
     $quoteComment['message'] = preg_replace('/<blockquote>.*?<\\/blockquote>/s', '', $quoteComment['message']);
     $quoteComment['message'] = preg_replace('/<div class="quote">.*?<\\/div>/s', '', $quoteComment['message']);
     $quoteComment['message'] = WebUtils::emptyHtml($quoteComment['message']);
     $quoteComment['message'] = $quoteComment['username'] . ': ' . $quoteComment['message'];
     $quoteComment['message'] = '[quote]' . $quoteComment['message'] . "[/quote]\r\n";
     return $quoteComment['message'];
 }
Ejemplo n.º 6
0
    public static function preParseArticleContent($content)
    {
        $content = WebUtils::emptyReturnLine($content);
        $content = $content . PortalUtils::CONTENT_DELIMITER;
        // 转换视音频,为了不走 discuz 原先的流程
        $content = preg_replace_callback('/\\[flash(.*?)\\](.*?)\\[\\/flash\\]/s', create_function('$matches', '
                $string = "";
                switch ($matches[1]) {
                    case "=mp3":
                        $string = "[mobcent_audio={$matches[2]}]";
                        break;
                    default:
                        $videoUrl = $matches[2];

                        // 转换优酷 .swf
                        $tempMatches = array();
                        preg_match("#^http://player\\.youku\\.com/player\\.php/sid/(\\w+?)/v\\.swf$#s", $matches[2], $tempMatches);
                        if (!empty($tempMatches)) {
                            $videoUrl = "http://v.youku.com/v_show/id_{$tempMatches[1]}.html";
                        }
                        // 转换56 .swf
                        $tempMatches = array();
                        preg_match("#^http://player\\.56\\.com/(\\w+?)\\.swf#s", $matches[2], $tempMatches);
                        if (!empty($tempMatches)) {
                            $videoUrl = "http://www.56.com/u/{$tempMatches[1]}.html";
                        }

                        $string = "[mobcent_video={$videoUrl}]";
                        break;
                }
                return PortalUtils::CONTENT_DELIMITER.$string.PortalUtils::CONTENT_DELIMITER;
            '), $content);
        // 处理url
        $content = preg_replace_callback('/<a href="(.*?)".*?>(.*?)<\\/a>/is', create_function('$matches', '
                $string = "";
                $matches[1] = WebUtils::getHttpFileName($matches[1]);
                // 处理是图片的链接
                if (stripos($matches[2], "<img") !== false) {
                    $string = $matches[2];
                } else {
                    $string = sprintf("[mobcent_url=%s]%s[/mobcent_url]", $matches[1], $matches[2]);
                }
                return $string;
            '), $content);
        return $content;
    }
Ejemplo n.º 7
0
 private function _fieldInfo($topics)
 {
     $row = $rows = array();
     foreach ($topics as $v) {
         $topicSummary = ForumUtils::getTopicSummary($v['tid']);
         $row['board_id'] = (int) $v['fid'];
         $row['topic_id'] = (int) $v['tid'];
         $row['type_id'] = (int) $v['typeid'];
         $row['sort_id'] = (int) $v['sortid'];
         $row['vote'] = ForumUtils::isVoteTopic($v['tid']) ? 1 : 0;
         $row['title'] = (string) WebUtils::emptyHtml($v['subject']);
         $row['subject'] = (string) WebUtils::emptyReturnLine($topicSummary['msg']);
         $row['user_id'] = (int) $v['authorid'];
         $row['last_reply_date'] = $v['lastpost'] . "000";
         if ($row['last_reply_date'] == '000') {
             $row['last_reply_date'] = $v['dateline'] . "000";
         }
         $row['user_nick_name'] = (string) $v['author'];
         $row['hits'] = (int) $v['views'];
         $row['replies'] = (int) $v['replies'];
         $row['top'] = ForumUtils::isTopTopic($v['tid']) ? 1 : 0;
         $row['status'] = (int) $v['status'];
         $row['essence'] = (int) $v['digest'];
         $row['hot'] = ForumUtils::isHotTopic($v['tid']) ? 1 : 0;
         $row['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']);
         $rows[] = $row;
     }
     return $rows;
 }