PageRenderTime 55ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/source/function/function_followcode.php

https://github.com/kuaileshike/upload
PHP | 457 lines | 428 code | 23 blank | 6 comment | 32 complexity | 95c9daba5adbffec16c67397441699f6 MD5 | raw file
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: function_followcode.php 29566 2012-04-19 03:28:14Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $_G['post_attach'] = array();
  12. function fcodedisp($code, $type='codehtml') {
  13. global $_G;
  14. $_G['forum_discuzcode']['pcodecount']++;
  15. $_G['forum_discuzcode'][$type][$_G['forum_discuzcode']['pcodecount']] = $code;
  16. $_G['forum_discuzcode']['codecount']++;
  17. return "[\tD_".$_G['forum_discuzcode']['pcodecount']."\t]";
  18. }
  19. function followcode($message, $tid = 0, $pid = 0, $length = 0, $allowimg = true) {
  20. global $_G;
  21. if((strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) {
  22. $message = preg_replace("/\s?\[code\](.+?)\[\/code\]\s?/ies", "", $message);
  23. }
  24. $msglower = strtolower($message);
  25. $htmlon = 0;
  26. $message = dhtmlspecialchars($message);
  27. if($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
  28. $_G['discuzcodemessage'] = & $message;
  29. $param = func_get_args();
  30. hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode');
  31. }
  32. $_G['delattach'] = array();
  33. $message = fparsesmiles($message);
  34. if(strpos($msglower, 'attach://') !== FALSE) {
  35. $message = preg_replace("/attach:\/\/(\d+)\.?(\w*)/ie", '', $message);
  36. }
  37. if(strpos($msglower, 'ed2k://') !== FALSE) {
  38. $message = preg_replace("/ed2k:\/\/(.+?)\//e", '', $message);
  39. }
  40. if(strpos($msglower, '[/i]') !== FALSE) {
  41. $message = preg_replace("/\s*\[i=s\][\n\r]*(.+?)[\n\r]*\[\/i\]\s*/is", '', $message);
  42. }
  43. $message = str_replace('[/p]', "\n", $message);
  44. $message = str_replace(array(
  45. '[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]',
  46. '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
  47. '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'
  48. ), '', preg_replace(array(
  49. "/\[color=([#\w]+?)\]/i",
  50. "/\[color=(rgb\([\d\s,]+?\))\]/i",
  51. "/\[backcolor=([#\w]+?)\]/i",
  52. "/\[backcolor=(rgb\([\d\s,]+?\))\]/i",
  53. "/\[size=(\d{1,2}?)\]/i",
  54. "/\[size=(\d{1,2}(\.\d{1,2}+)?(px|pt)+?)\]/i",
  55. "/\[font=([^\[\<]+?)\]/i",
  56. "/\[align=(left|center|right)\]/i",
  57. "/\[float=left\]/i",
  58. "/\[float=right\]/i"
  59. ), '', $message));
  60. if(strpos($msglower, '[/p]') !== FALSE) {
  61. $message = preg_replace("/\[p=(\d{1,2}|null), (\d{1,2}|null), (left|center|right)\]/i", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:left;\">", $message);
  62. $message = str_replace('[/p]', '</p>', $message);
  63. }
  64. if(strpos($msglower, '[/quote]') !== FALSE) {
  65. $message = preg_replace("/\s?\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s?/is", '', $message);
  66. }
  67. if(strpos($msglower, '[/free]') !== FALSE) {
  68. $message = preg_replace("/\s*\[free\][\n\r]*(.+?)[\n\r]*\[\/free\]\s*/is", '', $message);
  69. }
  70. if(isset($_G['cache']['bbcodes'][-$allowbbcode])) {
  71. $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], '', $message);
  72. }
  73. if(strpos($msglower, '[/hide]') !== FALSE) {
  74. preg_replace("/\[hide.*?\]\s*(.*?)\s*\[\/hide\]/ies", "hideattach('\\1')", $message);
  75. if(strpos($msglower, '[hide]') !== FALSE) {
  76. $message = preg_replace("/\[hide\]\s*(.*?)\s*\[\/hide\]/is", '', $message);
  77. }
  78. if(strpos($msglower, '[hide=') !== FALSE) {
  79. $message = preg_replace("/\[hide=(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/ies", '', $message);
  80. }
  81. }
  82. if(strpos($msglower, '[/url]') !== FALSE) {
  83. $message = preg_replace("/\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.|mailto:)?([^\r\n\[\"']+?))?\](.+?)\[\/url\]/ies", "fparseurl('\\1', '\\5', '\\2')", $message);
  84. }
  85. if(strpos($msglower, '[/email]') !== FALSE) {
  86. $message = preg_replace("/\[email(=([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+))?\](.+?)\[\/email\]/ies", "fparseemail('\\1', '\\4')", $message);
  87. }
  88. $nest = 0;
  89. while(strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE){
  90. $message = preg_replace("/\[table(?:=(\d{1,4}%?)(?:,([\(\)%,#\w ]+))?)?\]\s*(.+?)\s*\[\/table\]/ies", "fparsetable('\\1', '\\2', '\\3')", $message);
  91. if(++$nest > 4) break;
  92. }
  93. if(strpos($msglower, '[/media]') !== FALSE) {
  94. $message = preg_replace("/\[media=([\w,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/ies", "fparsemedia('\\1', '\\2')", $message);
  95. }
  96. if(strpos($msglower, '[/audio]') !== FALSE) {
  97. $message = preg_replace("/\[audio(=1)*\]\s*([^\[\<\r\n]+?)\s*\[\/audio\]/ies", "fparseaudio('\\2')", $message);
  98. }
  99. if(strpos($msglower, '[/flash]') !== FALSE) {
  100. $message = preg_replace("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/ies", "fparseflash('\\4');", $message);
  101. }
  102. if($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) {
  103. $message = preg_replace("/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message);
  104. }
  105. $flag = $length ? 1 : 0;
  106. if($tid) {
  107. $extra = "onclick=\"changefeed($tid, $pid, $flag, this)\"";
  108. }
  109. if(strpos($msglower, '[/img]') !== FALSE) {
  110. $message = preg_replace(array(
  111. "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
  112. "/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"
  113. ), $allowimg ? array(
  114. "fparseimg('\\1', '$extra')",
  115. "fparseimg('\\3', '$extra')"
  116. ) : '', $message);
  117. }
  118. if($tid && $pid) {
  119. $_G['post_attach'] = C::t('forum_attachment_n')->fetch_all_by_id(getattachtableid($tid), 'pid', $pid);
  120. foreach($_G['post_attach'] as $aid => $attach) {
  121. if(!empty($_G['delattach']) && in_array($aid, $_G['delattach'])) {
  122. continue;
  123. }
  124. $message .= "[attach]$attach[aid][/attach]";
  125. $message = preg_replace("/\[attach\]$attach[aid]\[\/attach\]/i", fparseattach($attach['aid'], $length, $extra), $message, 1);
  126. }
  127. }
  128. if(strpos($msglower, '[/attach]') !== FALSE) {
  129. $message = preg_replace("/\[attach\]\s*([^\[\<\r\n]+?)\s*\[\/attach\]/ies", '', $message);
  130. }
  131. $message = clearnl($message);
  132. if($length) {
  133. $sppos = strpos($message, chr(0).chr(0).chr(0));
  134. if($sppos !== false) {
  135. $message = substr($message, 0, $sppos);
  136. }
  137. $checkstr = cutstr($message, $length, '');
  138. if(strpos($checkstr, '[') && strpos(strrchr($checkstr, "["), ']') === FALSE) {
  139. $length = strpos($message, ']', strrpos($checkstr, strrchr($checkstr, "[")));
  140. }
  141. $message = cutstr($message, $length+1, ' <a href="javascript:;" class="flw_readfull xi2 xs1"'.$extra.'>'.lang('space', 'follow_view_fulltext').'</a>');
  142. } elseif($allowimg && !empty($extra)) {
  143. $message .= '<div class="ptm cl"><a href="javascript:;" class="flw_readfull y xi2 xs1"'.$extra.'>'.lang('space', 'follow_retract').'</a></div>';
  144. }
  145. for($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
  146. $code = '';
  147. if(isset($_G['forum_discuzcode']['codehtml'][$i]) && !empty($_G['forum_discuzcode']['codehtml'][$i])) {
  148. $code = $_G['forum_discuzcode']['codehtml'][$i];
  149. } elseif(!$length) {
  150. if(isset($_G['forum_discuzcode']['audio'][$i]) && !empty($_G['forum_discuzcode']['audio'][$i])) {
  151. $code = $_G['forum_discuzcode']['audio'][$i];
  152. } elseif(isset($_G['forum_discuzcode']['video'][$i]) && !empty($_G['forum_discuzcode']['video'][$i])) {
  153. $code = $_G['forum_discuzcode']['video'][$i];
  154. } elseif(isset($_G['forum_discuzcode']['media'][$i]) && !empty($_G['forum_discuzcode']['media'][$i])) {
  155. $code = $_G['forum_discuzcode']['media'][$i];
  156. } elseif(isset($_G['forum_discuzcode']['image'][$i]) && !empty($_G['forum_discuzcode']['image'][$i])) {
  157. $code = $_G['forum_discuzcode']['image'][$i];
  158. } elseif(isset($_G['forum_discuzcode']['attach'][$i]) && !empty($_G['forum_discuzcode']['attach'][$i])) {
  159. $code = $_G['forum_discuzcode']['attach'][$i];
  160. }
  161. }
  162. $message = str_replace("[\tD_$i\t]", $code, $message);
  163. }
  164. $message = clearnl($message);
  165. if(!empty($_GET['highlight'])) {
  166. $highlightarray = explode('+', $_GET['highlight']);
  167. $sppos = strrpos($message, chr(0).chr(0).chr(0));
  168. if($sppos !== FALSE) {
  169. $specialextra = substr($message, $sppos + 3);
  170. $message = substr($message, 0, $sppos);
  171. }
  172. $message = preg_replace(array("/(^|>)([^<]+)(?=<|$)/sUe", "/<highlight>(.*)<\/highlight>/siU"), array("highlightword('\\2', \$highlightarray, '\\1')", "<strong><font color=\"#FF0000\">\\1</font></strong>"), $message);
  173. if($sppos !== FALSE) {
  174. $message = $message.chr(0).chr(0).chr(0).$specialextra;
  175. }
  176. }
  177. unset($msglower);
  178. if($length) {
  179. $count = 0;
  180. $imagecode = $mediacode = $videocode = $audiocode = $mediahtml = '';
  181. for($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
  182. if(isset($_G['forum_discuzcode']['audio'][$i]) && !empty($_G['forum_discuzcode']['audio'][$i])) {
  183. $audiocode .= '<li>'.$_G['forum_discuzcode']['audio'][$attachcodei].'</li>';
  184. } elseif(isset($_G['forum_discuzcode']['video'][$i]) && !empty($_G['forum_discuzcode']['video'][$i])) {
  185. $videocode .= '<li>'.$_G['forum_discuzcode']['video'][$i].'</li>';
  186. } elseif(isset($_G['forum_discuzcode']['media'][$i]) && !empty($_G['forum_discuzcode']['media'][$i])) {
  187. $mediacode .= '<li>'.$_G['forum_discuzcode']['media'][$i].'</li>';
  188. } elseif(isset($_G['forum_discuzcode']['image'][$i]) && !empty($_G['forum_discuzcode']['image'][$i]) && $count < 4) {
  189. $imagecode .= '<li>'.$_G['forum_discuzcode']['image'][$i].'</li>';
  190. $count++;
  191. } elseif(isset($_G['forum_discuzcode']['attach'][$i]) && !empty($_G['forum_discuzcode']['attach'][$i])) {
  192. $attachcode .= '<li>'.$_G['forum_discuzcode']['attach'][$i].'</li>';
  193. }
  194. }
  195. if(!empty($audiocode)) {
  196. $message .= '<div class="flw_music"><ul>'.$audiocode.'</ul></div>';
  197. }
  198. if(!empty($videocode)) {
  199. $message .= '<div class="flw_video"><ul>'.$videocode.'</ul></div>';
  200. }
  201. if(!empty($mediacode)) {
  202. $message .= '<div class="flw_video"><ul>'.$mediacode.'</ul></div>';
  203. }
  204. if(!empty($imagecode)) {
  205. $message = '<div class="flw_image'.($count < 2 ? ' flw_image_1' : '').'"><ul>'.$imagecode.'</ul></div>'.$message;
  206. }
  207. if(!empty($attachcode)) {
  208. $message .= '<div class="flw_attach"><ul>'.$attachcode.'</ul></div>';
  209. }
  210. }
  211. return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), ' ', $message));
  212. }
  213. function clearnl($message) {
  214. $message = preg_replace("/[\r\n|\n|\r]\s*[\r\n|\n|\r]/i", "\n", $message);
  215. $message = preg_replace("/^[\r\n|\n|\r]{1,}/i", "", $message);
  216. $message = preg_replace("/[\r\n|\n|\r]{2,}/i", "\n", $message);
  217. return $message;
  218. }
  219. function hideattach($hidestr) {
  220. global $_G;
  221. preg_match_all("/\[attach\]\s*(.*?)\s*\[\/attach\]/is", $hidestr, $del);
  222. foreach($del[1] as $aid) {
  223. $_G['delattach'][$aid] = $aid;
  224. }
  225. }
  226. function fparseurl($url, $text, $scheme) {
  227. global $_G;
  228. $html = '';
  229. if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.)[^\[\"']+/i", trim($text), $matches)) {
  230. $url = $matches[0];
  231. $length = 65;
  232. if(strlen($url) > $length) {
  233. $text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
  234. }
  235. $html = '<a href="'.(substr(strtolower($url), 0, 4) == 'www.' ? 'http://'.$url : $url).'" target="_blank">'.$text.'</a>';
  236. } else {
  237. $url = substr($url, 1);
  238. if(substr(strtolower($url), 0, 4) == 'www.') {
  239. $url = 'http://'.$url;
  240. }
  241. $url = !$scheme ? $_G['siteurl'].$url : $url;
  242. $atclass = substr(strtolower($text), 0, 1) == '@' ? ' class="xi2" ' : '';
  243. $html = '<a href="'.$url.'" target="_blank" '.$atclass.'>'.$text.'</a>';
  244. }
  245. return fcodedisp($html);
  246. }
  247. function fparseattach($aid, $length = 0, $extra = '') {
  248. global $_G;
  249. $html = '';
  250. if(!empty($_G['post_attach']) && !empty($_G['post_attach'][$aid])) {
  251. $attach = $_G['post_attach'][$aid];
  252. unset($_G['post_attach'][$attach['aid']]);
  253. $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
  254. $attach['isimage'] = $attach['isimage'] && !$attach['price'] ? $attach['isimage'] : 0;
  255. $attach['refcheck'] = (!$attach['remote'] && $_G['setting']['attachrefcheck']) || ($attach['remote'] && ($_G['setting']['ftp']['hideurl'] || ($attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp')));
  256. $rimg_id = random(5).$attach['aid'];
  257. if($attach['isimage'] && !$attach['price'] && !$attach['readperm']) {
  258. $nothumb = $length ? 0 : 1;
  259. $src = $attach['url'].(!$attach['thumb'] ? $attach['attachment'] : getimgthumbname($attach['attachment']));
  260. $html = bbcodeurl($src, '<img id="aimg_'.$rimg_id.'" src="'.$src.'" border="0" alt="'.$attach['filename'].'" '.$extra.' style="cursor: pointer;" />');
  261. return fcodedisp($html, 'image');
  262. } else {
  263. if($attach['price'] || $attach['readperm']) {
  264. $html = '<a href="forum.php?mod=viewthread&tid='.$attach['tid'].'" id="attach_'.$rimg_id.'" target="_blank" class="flw_attach_price"><strong>'.$attach['filename'].'</strong><span>'.sizecount($attach['filesize']).'</span></a>';
  265. } else {
  266. require_once libfile('function/attachment');
  267. $aidencode = packaids($attach);
  268. $attachurl = "forum.php?mod=attachment&aid=$aidencode";
  269. $html = '<a href="'.$attachurl.'" id="attach_'.$rimg_id.'"><strong>'.$attach['filename'].'</strong><span>'.sizecount($attach['filesize']).'</span></a>';
  270. }
  271. return fcodedisp($html, 'attach');
  272. }
  273. }
  274. return '';
  275. }
  276. function fparseflash($url) {
  277. preg_match("/((https?){1}:\/\/|www\.)[^\[\"']+/i", $url, $matches);
  278. $url = $matches[0];
  279. if(fileext($url) != 'flv') {
  280. $rimg_id = 'swf_'.random(5);
  281. $html = bbcodeurl($url, '<img src="'.IMGDIR.'/flash.gif" alt="'.lang('space', 'follow_click_play').'" onclick="javascript:showFlash(\'flash\', \''.$url.'\', this, \''.$rimg_id.'\');" class="tn" style="cursor: pointer;" />');
  282. return fcodedisp($html, 'media');
  283. } else {
  284. $url = STATICURL.'image/common/flvplayer.swf?&autostart=true&file='.urlencode($matches[0]);
  285. return fmakeflv($url);
  286. }
  287. }
  288. function fparseemail($email, $text) {
  289. global $_G;
  290. $text = str_replace('\"', '"', $text);
  291. $html = '';
  292. if(!$email && preg_match("/\s*([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\s*/i", $text, $matches)) {
  293. $email = trim($matches[0]);
  294. $html = '<a href="mailto:'.$email.'">'.$email.'</a>';
  295. } else {
  296. $html = '<a href="mailto:'.substr($email, 1).'">'.$text.'</a>';
  297. }
  298. return fcodedisp($html);
  299. }
  300. function fparsetable($width, $bgcolor, $message) {
  301. global $_G;
  302. $html = '';
  303. if(strpos($message, '[/tr]') === FALSE && strpos($message, '[/td]') === FALSE) {
  304. $rows = explode("\n", $message);
  305. $html = '<table cellspacing="0" class="t_table" '.
  306. ($width == '' ? NULL : 'style="width:'.$width.'"').
  307. ($bgcolor ? ' bgcolor="'.$bgcolor.'">' : '>');
  308. foreach($rows as $row) {
  309. $html .= '<tr><td>'.str_replace(array('\|', '|', '\n'), array('&#124;', '</td><td>', "\n"), $row).'</td></tr>';
  310. }
  311. $html .= '</table>';
  312. } else {
  313. if(!preg_match("/^\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td([=\d,%]+)?\]/", $message) && !preg_match("/^<tr[^>]*?>\s*<td[^>]*?>/", $message)) {
  314. return str_replace('\\"', '"', preg_replace("/\[tr(?:=([\(\)\s%,#\w]+))?\]|\[td([=\d,%]+)?\]|\[\/td\]|\[\/tr\]/", '', $message));
  315. }
  316. if(substr($width, -1) == '%') {
  317. $width = substr($width, 0, -1) <= 98 ? intval($width).'%' : '98%';
  318. } else {
  319. $width = intval($width);
  320. $width = $width ? ($width <= 560 ? $width.'px' : '98%') : '';
  321. }
  322. $html = '<table cellspacing="0" class="t_table" '.
  323. ($width == '' ? NULL : 'style="width:'.$width.'"').
  324. ($bgcolor ? ' bgcolor="'.$bgcolor.'">' : '>').
  325. str_replace('\\"', '"', preg_replace(array(
  326. "/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,4}%?))?\]/ie",
  327. "/\[\/td\]\s*\[td(?:=(\d{1,4}%?))?\]/ie",
  328. "/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ie",
  329. "/\[\/td\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ie",
  330. "/\[\/td\]\s*\[\/tr\]\s*/i"
  331. ), array(
  332. "parsetrtd('\\1', '0', '0', '\\2')",
  333. "parsetrtd('td', '0', '0', '\\1')",
  334. "parsetrtd('\\1', '\\2', '\\3', '\\4')",
  335. "parsetrtd('td', '\\1', '\\2', '\\3')",
  336. '</td></tr>'
  337. ), $message)
  338. ).'</table>';
  339. }
  340. return fcodedisp($html);
  341. }
  342. function fparseaudio($url) {
  343. if(fileext($url) == 'mp3') {
  344. $randomid = 'music_'.random(3);
  345. $html = '<img src="'.IMGDIR.'/music.gif" alt="'.lang('space', 'follow_click_play').'" onclick="javascript:showFlash(\'music\', \''.$url.'\', this, \''.$randomid.'\');" class="tn" style="cursor: pointer;" />';
  346. return fcodedisp($html, 'audio');
  347. } else {
  348. $html = '<a href="'.$url.'" target="_blank">'.$url.'</a>';
  349. return $html;
  350. }
  351. }
  352. function fmakeflv($flv) {
  353. $randomid = 'video_'.random(3);
  354. $flv = is_array($flv) ? $flv : array('flv' => $flv);
  355. if(!empty($flv['imgurl'])) {
  356. $html = '<table class="mtm" title="'.lang('space', 'follow_click_play').'" onclick="javascript:showFlash(\'flash\', \''.$flv['flv'].'\', this, \''.$randomid.'\');"><tr><td class="vdtn hm" style="background: url('.$flv['imgurl'].') no-repeat; border: 1px solid #CDCDCD; cursor: pointer; height: 95px; width: 126px;"><img src="'.IMGDIR.'/vds.png" alt="'.lang('space', 'follow_click_play').'" /> </td></tr></table>';
  357. } else {
  358. $html = '<img src="'.IMGDIR.'/vd.gif" alt="'.lang('space', 'follow_click_play').'" onclick="javascript:showFlash(\'flash\', \''.$flv['flv'].'\', this, \''.$randomid.'\');" class="tn" style="cursor: pointer;" />';
  359. }
  360. return fcodedisp($html, 'video');
  361. }
  362. function fparsemedia($params, $url) {
  363. $params = explode(',', $params);
  364. $url = addslashes($url);
  365. $html = '';
  366. if($flv = parseflv($url, 0, 0)) {
  367. return fmakeflv($flv);
  368. }
  369. if(in_array(count($params), array(3, 4))) {
  370. $type = $params[0];
  371. $url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
  372. switch($type) {
  373. case 'mp3':
  374. return fparseaudio($url);
  375. break;
  376. case 'flv':
  377. $url = STATICURL.'image/common/flvplayer.swf?&autostart=true&file='.urlencode($url);
  378. return fmakeflv($url);
  379. break;
  380. case 'swf':
  381. return fparseflash($url);
  382. break;
  383. default:
  384. $html = '<a href="'.$url.'" target="_blank">'.$url.'</a>';
  385. break;
  386. }
  387. }
  388. return fcodedisp($html, 'media');
  389. }
  390. function fparseimg($src, $extra = '') {
  391. global $_G;
  392. $rimg_id = random(5);
  393. $html = bbcodeurl($src, '<img id="iimg_'.$rimg_id.'" src="'.$src.'" border="0" alt="" '.$extra.' style="cursor: pointer;" />');
  394. return fcodedisp($html, 'image');
  395. }
  396. function fparsesmiles(&$message) {
  397. global $_G;
  398. static $enablesmiles;
  399. if($enablesmiles === null) {
  400. $enablesmiles = false;
  401. if(!empty($_G['cache']['smilies']) && is_array($_G['cache']['smilies'])) {
  402. foreach($_G['cache']['smilies']['replacearray'] AS $key => $smiley) {
  403. $_G['cache']['smilies']['replacearray'][$key] = '<img src="'.STATICURL.'image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'].'/'.$smiley.'" smilieid="'.$key.'" border="0" class="s" alt="" />';
  404. }
  405. $enablesmiles = true;
  406. }
  407. }
  408. $enablesmiles && $message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message, $_G['setting']['maxsmilies']);
  409. return $message;
  410. }
  411. ?>