国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > Discuz > 正文

discuz x帖子內容[attach]轉html

2024-09-11 09:04:39
字體:
來源:轉載
供稿:網友
之前用過
{echo discuzcode($value['message'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);}
或者
require_once libfile('function/discuzcode');
{echo discuzcode($value['message']);}

能轉大部分UBB,但是[attach]轉不了。

下面是來自網絡的代碼,針對attach。
我用的時候做了一些修改。

<?php$thread_info = DB::fetch_first ( "select a.`tid`, a.`authorid`, a.`author`,a.`dateline`, a.`subject`, b.`message`,b.`pid`, c.`attachment` as thumb, c.`remote` from " . DB::table ( 'forum_thread' ) . " a left join " . DB::table ( 'forum_post' ) . " b on b.tid=a.tid left join " . DB::table ( 'forum_threadimage' ) . " c on c.tid=a.tid where b.pid=$pid");require_once libfile ( 'function/discuzcode' );$thread_info ['dateline'] = date ( "Y-m-d H:i:s", $thread_info ['dateline'] );$thread_info ['message'] = discuzcode ( $thread_info ['message'] );if (preg_match_all ( "//[attach/](/d+)/[//attach/]/i", $thread_info ['message'], $matchaids )) {$attach_ids = $matchaids [1];}$attach_list = array ();foreach ( $attach_ids as $aid ) {$find = "//[attach/]$aid/[//attach/]/i";$thread_info ['message'] = preg_replace ( $find, get_lw_attach_path ( $aid ), $thread_info ['message'], 1 );$thread_info ['message'] = preg_replace ( $find, '', $thread_info ['message'] );}function get_lw_attach_path($aid) {global $_G;$return = $filename = '';if ($attach = C::t ( 'forum_attachment_n' )->fetch ( 'aid:' . $aid, $aid, array (1,- 1) )) {return get_lw_attach_path_str ( $attach );}return $filename;}function get_lw_attach_path_str($attach) {global $_G;if (! $attach ['isimage']) {return '<a href="' . $_G ['siteurl'] . 'forum.php?mod=attachment&aid=' . aidencode ( $attach ['aid'] ) . '">' . $attach ['filename'] . '</a>';}if ($attach ['remote']) {$imgurl = $_G ['setting'] ['ftp'] ['attachurl'] . 'forum/' . $attach ['attachment'];return '<p><img onclick="viewimage(this);" src="' . $imgurl . '" style="max-width:834px"/></p>';} else {if (preg_match ( '/^(?!http:)/', $attach ['url'] )) {$attach ['url'] = $_G ['siteurl'] . 'data/attachment/forum/' . $attach ['url'];}$imgurl = $attach ['url'] . $attach ['attachment'] . ($_G ['gp_width'] ? '&width=' . $_G ['gp_width'] : '') . ($_G ['gp_height'] ? '&height=' . $_G ['gp_height'] : '');return '<p><a href="' . $imgurl . '" target="_blank"><img height="320" width="320" src="' . $imgurl . '" /></a></p>';}}?>

條件where b.pid=$pid,如果只調用主題帖內容,改為where a.tid=$tid and b.first=1。
$pid或$tid使用時需要先獲得。

在調用帖子內容時,另外涉及到權限問題,如密碼、隱藏內容、查看權限、主題售價等等。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广丰县| 普兰店市| 舞钢市| 宜兰县| 巨鹿县| 马山县| 东乌珠穆沁旗| 息烽县| 凤翔县| 龙山县| 邳州市| 桐乡市| 祁东县| 巧家县| 林周县| 陆川县| 南皮县| 渭源县| 新乡县| 宝坻区| 安多县| 芷江| 咸丰县| 邳州市| 平陆县| 衢州市| 泗洪县| 都昌县| 阳东县| 宁乡县| 大英县| 花垣县| 临安市| 板桥市| 南京市| 景泰县| 汤阴县| 信丰县| 安溪县| 通城县| 镇平县|