@chinmo 版主关键是我找到discuzcode()、parseattach()解析函数后,似乎没用。目前还在找原因。

解决方案 »

  1.   

    @chinmo大版主呀,帖子内容应该是source\module\forum\forum_viewthread.php这个文件可我找来找去,感觉就只有这两个函数相关。但还没有起到作用。找了两天,晕死
      

  2.   

    你再他模板找干嘛,DZ的他基本都是用$post这个数组保存数据的,你在他的控制器文件里输出这个数组就知道是哪个字段保存着文章内容了,然后你在在他的控制器里查找他对这个字段所用的处理函数不就可以了做程序这点最起码的查找能力应该有的吧
      

  3.   

    @chinmo大版主呀,我肯定不会去模板层找了,真的没有你想象的那么简单,我用的是discuz X3.1utf8版本。帖子内容应该是source\module\forum\forum_viewthread.php这个文件大概903行左右:
    parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids);用来解析附件的。大概是在1228行:
            $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $forum_allowbbcode, ($_G['forum']['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0), $_G['forum']['allowhtml'], ($_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0), 0, $post['authorid'], $_G['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_G['forum']['allowmediacode'], $post['pid'], $_G['setting']['lazyload'], $post['dbdateline'], $post['first']);用来解析内容的但不晓得为什么就是不成功。
      

  4.   

    discuzcode 就是了用的这个函数
    不成功的话
    最简单的排查就是在这个函数里断句输出,看看他在那里替换不成功
      

  5.   

    各路PHP牛人,我把代码奉上:
    <?php
    define('APPTYPEID', 2);
    define('CURSCRIPT', 'forum');require './source/class/class_core.php';
    require './source/function/function_forum.php';$cachelist = array();
    C::app()->cachelist = $cachelist;
    C::app()->init();//$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);
    //$_G['setting']['threadhidethreshold'] = 1;
    //$query = C::t('forum_thread')->fetch_all_for_guide1($view, $limittid, $tids, $_G['setting']['heatthread']['guidelimit'], $dateline); //$query = C::t('forum_thread')->fetch_all_search('', 'forum_thread', 0,'', '', '');;
    //print_r($query);require_once libfile('function/discuzcode');
    require_once libfile('function/attachment');
    require_once libfile('function/forum');
       $sql = "SELECT a.*, b.message,b.htmlon,b.bbcodeoff,b.smileyoff,b.parseurloff,b.pid,b.first FROM ".DB::table('forum_thread')." a left join ".DB::table('forum_post')." b on a.authorid=b.authorid and a.tid=b.tid and b.first=1  WHERE 1=1 AND a.heats>=1" ;
       $sql = "SELECT a.*, b.message,b.htmlon,b.bbcodeoff,b.smileyoff,b.parseurloff,b.pid,b.first FROM ".DB::table('forum_thread')." a left join ".DB::table('forum_post')." b on a.authorid=b.authorid and a.tid=b.tid and b.first=1 WHERE a.tid>0 AND a.heats>=0  ORDER BY a.lastpost DESC LIMIT 600";
      $query = DB::fetch_all($sql);
      $postlist     = array();
      foreach($query as $post){
          $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $forum_allowbbcode, ($_G['forum']['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0), $_G['forum']['allowhtml'], ($_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0), 0, $post['authorid'], $_G['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_G['forum']['allowmediacode'], $post['pid'], $_G['setting']['lazyload'], $post['dbdateline'], $post['first']);
          
          $_G['forum_attachpids'][] = $post['pid'];
          if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
       $_G['forum_attachtags'][$post['pid']] = $matchaids[1];
          }
          $postlist[$post['pid']] = $post;
      }
        
      parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist);
      
      print_r($postlist);
      
    ?>死活找不到那里有问题。
      

  6.   

    $forum_allowbbcode = $_G['forum']['allowbbcode'] ? -$post['groupid'] : 0;少了一个变量。
    会discuz X3.1的大虾们,都过来看看呀,搞不定的,也帮我顶两下吧。
      

  7.   

    形如
    这样的是 ubb 代码
    你可以找到 ubb 解码程序相关的部分切入
    他好像是 bbcode 类
      

  8.   

    @xuzuning
    我已经试过N次了,要是找到的话,早就找到了。我是实在找不到,才来CSDN找更厉害的高手。毕竟这里是技术高手的集聚地。