PageRenderTime 48ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/source/function/function_discuzcode.php

https://github.com/jinbo51/DiscuzX
PHP | 760 lines | 718 code | 36 blank | 6 comment | 165 complexity | 5ad0c432091483c105cfaf0777e3e7d9 MD5 | raw file
Possible License(s): BSD-3-Clause
  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_discuzcode.php 33443 2013-06-18 01:28:27Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. include template('forum/discuzcode');
  12. $_G['forum_discuzcode'] = array(
  13. 'pcodecount' => -1,
  14. 'codecount' => 0,
  15. 'codehtml' => '',
  16. 'passwordlock' => array(),
  17. 'smiliesreplaced' => 0,
  18. 'seoarray' => array(
  19. 0 => '',
  20. 1 => $_SERVER['HTTP_HOST'],
  21. 2 => $_G['setting']['bbname'],
  22. 3 => str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']),
  23. 4 => $_G['setting']['seokeywords'],
  24. 5 => $_G['setting']['seodescription']
  25. )
  26. );
  27. if(!isset($_G['cache']['bbcodes']) || !is_array($_G['cache']['bbcodes']) || !is_array($_G['cache']['smilies'])) {
  28. loadcache(array('bbcodes', 'smilies', 'smileytypes'));
  29. }
  30. function creditshide($creditsrequire, $message, $pid, $authorid) {
  31. global $_G;
  32. if($_G['member']['credits'] >= $creditsrequire || $_G['forum']['ismoderator'] || $_G['uid'] && $authorid == $_G['uid']) {
  33. return tpl_hide_credits($creditsrequire, str_replace('\\"', '"', $message));
  34. } else {
  35. return tpl_hide_credits_hidden($creditsrequire);
  36. }
  37. }
  38. function expirehide($expiration, $creditsrequire, $message, $dateline) {
  39. $expiration = $expiration ? substr($expiration, 1) : 0;
  40. if($expiration && $dateline && (TIMESTAMP - $dateline) / 86400 > $expiration) {
  41. return str_replace('\\"', '"', $message);
  42. }
  43. return '[hide'.($creditsrequire ? "=$creditsrequire" : '').']'.str_replace('\\"', '"', $message).'[/hide]';
  44. }
  45. function codedisp($code) {
  46. global $_G;
  47. $_G['forum_discuzcode']['pcodecount']++;
  48. $code = dhtmlspecialchars(str_replace('\\"', '"', $code));
  49. $code = str_replace("\n", "<li>", $code);
  50. $_G['forum_discuzcode']['codehtml'][$_G['forum_discuzcode']['pcodecount']] = tpl_codedisp($code);
  51. $_G['forum_discuzcode']['codecount']++;
  52. return "[\tDISCUZ_CODE_".$_G['forum_discuzcode']['pcodecount']."\t]";
  53. }
  54. function karmaimg($rate, $ratetimes) {
  55. $karmaimg = '';
  56. if($rate && $ratetimes) {
  57. $image = $rate > 0 ? 'agree.gif' : 'disagree.gif';
  58. for($i = 0; $i < ceil(abs($rate) / $ratetimes); $i++) {
  59. $karmaimg .= '<img src="'.$_G['style']['imgdir'].'/'.$image.'" border="0" alt="" />';
  60. }
  61. }
  62. return $karmaimg;
  63. }
  64. function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0', $allowmediacode = '0', $pid = 0, $lazyload = 0, $pdateline = 0, $first = 0) {
  65. global $_G;
  66. static $authorreplyexist;
  67. if($pid && strpos($message, '[/password]') !== FALSE) {
  68. if($authorid != $_G['uid'] && !$_G['forum']['ismoderator']) {
  69. $message = preg_replace("/\s?\[password\](.+?)\[\/password\]\s?/ie", "parsepassword('\\1', \$pid)", $message);
  70. if($_G['forum_discuzcode']['passwordlock'][$pid]) {
  71. return '';
  72. }
  73. } else {
  74. $message = preg_replace("/\s?\[password\](.+?)\[\/password\]\s?/ie", "", $message);
  75. $_G['forum_discuzcode']['passwordauthor'][$pid] = 1;
  76. }
  77. }
  78. if($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) {
  79. $message = preg_replace("/\s?\[code\](.+?)\[\/code\]\s?/ies", "codedisp('\\1')", $message);
  80. }
  81. $msglower = strtolower($message);
  82. $htmlon = $htmlon && $allowhtml ? 1 : 0;
  83. if(!$htmlon) {
  84. $message = dhtmlspecialchars($message);
  85. } else {
  86. $message = preg_replace("/<script[^\>]*?>(.*?)<\/script>/i", '', $message);
  87. }
  88. if($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
  89. $_G['discuzcodemessage'] = & $message;
  90. $param = func_get_args();
  91. hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode');
  92. }
  93. if(!$smileyoff && $allowsmilies) {
  94. $message = parsesmiles($message);
  95. }
  96. if($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) {
  97. $message = preg_replace("/attach:\/\/(\d+)\.?(\w*)/ie", "parseattachurl('\\1', '\\2', 1)", $message);
  98. }
  99. if($allowbbcode) {
  100. if(strpos($msglower, 'ed2k://') !== FALSE) {
  101. $message = preg_replace("/ed2k:\/\/(.+?)\//e", "parseed2k('\\1')", $message);
  102. }
  103. }
  104. if(!$bbcodeoff && $allowbbcode) {
  105. if(strpos($msglower, '[/url]') !== FALSE) {
  106. $message = preg_replace("/\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.|mailto:)?([^\r\n\[\"']+?))?\](.+?)\[\/url\]/ies", "parseurl('\\1', '\\5', '\\2')", $message);
  107. }
  108. if(strpos($msglower, '[/email]') !== FALSE) {
  109. $message = preg_replace("/\[email(=([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+))?\](.+?)\[\/email\]/ies", "parseemail('\\1', '\\4')", $message);
  110. }
  111. $nest = 0;
  112. while(strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE){
  113. $message = preg_replace("/\[table(?:=(\d{1,4}%?)(?:,([\(\)%,#\w ]+))?)?\]\s*(.+?)\s*\[\/table\]/ies", "parsetable('\\1', '\\2', '\\3')", $message);
  114. if(++$nest > 4) break;
  115. }
  116. $message = str_replace(array(
  117. '[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]',
  118. '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
  119. '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'
  120. ), array(
  121. '</font>', '</font>', '</font>', '</font>', '</div>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>',
  122. '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">',
  123. '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'
  124. ), preg_replace(array(
  125. "/\[color=([#\w]+?)\]/i",
  126. "/\[color=((rgb|rgba)\([\d\s,]+?\))\]/i",
  127. "/\[backcolor=([#\w]+?)\]/i",
  128. "/\[backcolor=((rgb|rgba)\([\d\s,]+?\))\]/i",
  129. "/\[size=(\d{1,2}?)\]/i",
  130. "/\[size=(\d{1,2}(\.\d{1,2}+)?(px|pt)+?)\]/i",
  131. "/\[font=([^\[\<]+?)\]/i",
  132. "/\[align=(left|center|right)\]/i",
  133. "/\[p=(\d{1,2}|null), (\d{1,2}|null), (left|center|right)\]/i",
  134. "/\[float=left\]/i",
  135. "/\[float=right\]/i"
  136. ), array(
  137. "<font color=\"\\1\">",
  138. "<font style=\"color:\\1\">",
  139. "<font style=\"background-color:\\1\">",
  140. "<font style=\"background-color:\\1\">",
  141. "<font size=\"\\1\">",
  142. "<font style=\"font-size:\\1\">",
  143. "<font face=\"\\1\">",
  144. "<div align=\"\\1\">",
  145. "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:\\3\">",
  146. "<span style=\"float:left;margin-right:5px\">",
  147. "<span style=\"float:right;margin-left:5px\">"
  148. ), $message));
  149. if($pid && !defined('IN_MOBILE')) {
  150. $message = preg_replace("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/ies", "parsepostbg('\\1', '$pid')", $message);
  151. } else {
  152. $message = preg_replace("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/is", "", $message);
  153. }
  154. if($parsetype != 1) {
  155. if(strpos($msglower, '[/quote]') !== FALSE) {
  156. $message = preg_replace("/\s?\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s?/is", tpl_quote(), $message);
  157. }
  158. if(strpos($msglower, '[/free]') !== FALSE) {
  159. $message = preg_replace("/\s*\[free\][\n\r]*(.+?)[\n\r]*\[\/free\]\s*/is", tpl_free(), $message);
  160. }
  161. }
  162. if(!defined('IN_MOBILE')) {
  163. if(strpos($msglower, '[/media]') !== FALSE) {
  164. $message = preg_replace("/\[media=([\w,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/ies", $allowmediacode ? "parsemedia('\\1', '\\2')" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
  165. }
  166. if(strpos($msglower, '[/audio]') !== FALSE) {
  167. $message = preg_replace("/\[audio(=1)*\]\s*([^\[\<\r\n]+?)\s*\[\/audio\]/ies", $allowmediacode ? "parseaudio('\\2', 400)" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
  168. }
  169. if(strpos($msglower, '[/flash]') !== FALSE) {
  170. $message = preg_replace("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/ies", $allowmediacode ? "parseflash('\\2', '\\3', '\\4');" : "bbcodeurl('\\4', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
  171. }
  172. } else {
  173. if(strpos($msglower, '[/media]') !== FALSE) {
  174. $message = preg_replace("/\[media=([\w,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/is", "[media]\\2[/media]", $message);
  175. }
  176. if(strpos($msglower, '[/audio]') !== FALSE) {
  177. $message = preg_replace("/\[audio(=1)*\]\s*([^\[\<\r\n]+?)\s*\[\/audio\]/is", "[media]\\2[/media]", $message);
  178. }
  179. if(strpos($msglower, '[/flash]') !== FALSE) {
  180. $message = preg_replace("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", "[media]\\4[/media]", $message);
  181. }
  182. }
  183. if($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) {
  184. $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message);
  185. }
  186. if($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) {
  187. if($_G['setting']['hideexpiration'] && $pdateline && (TIMESTAMP - $pdateline) / 86400 > $_G['setting']['hideexpiration']) {
  188. $message = preg_replace("/\[hide[=]?(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/is", "\\3", $message);
  189. $msglower = strtolower($message);
  190. }
  191. if(strpos($msglower, '[hide=d') !== FALSE) {
  192. $message = preg_replace("/\[hide=(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/ies", "expirehide('\\1','\\2','\\3', $pdateline)", $message);
  193. $msglower = strtolower($message);
  194. }
  195. if(strpos($msglower, '[hide]') !== FALSE) {
  196. if($authorreplyexist === null) {
  197. if(!$_G['forum']['ismoderator']) {
  198. if($_G['uid']) {
  199. $authorreplyexist = C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']);
  200. }
  201. } else {
  202. $authorreplyexist = TRUE;
  203. }
  204. }
  205. if($authorreplyexist) {
  206. $message = preg_replace("/\[hide\]\s*(.*?)\s*\[\/hide\]/is", tpl_hide_reply(), $message);
  207. } else {
  208. $message = preg_replace("/\[hide\](.*?)\[\/hide\]/is", tpl_hide_reply_hidden(), $message);
  209. $message = '<script type="text/javascript">replyreload += \',\' + '.$pid.';</script>'.$message;
  210. }
  211. }
  212. if(strpos($msglower, '[hide=') !== FALSE) {
  213. $message = preg_replace("/\[hide=(\d+)\]\s*(.*?)\s*\[\/hide\]/ies", "creditshide(\\1,'\\2', $pid, $authorid)", $message);
  214. }
  215. }
  216. }
  217. if(!$bbcodeoff) {
  218. if($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) {
  219. $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);
  220. }
  221. if(defined('IN_MOBILE') && !defined('TPL_DEFAULT') && !defined('IN_MOBILE_API')) {
  222. $allowimgcode = false;
  223. }
  224. $attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src';
  225. if(strpos($msglower, '[/img]') !== FALSE) {
  226. $message = preg_replace(array(
  227. "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
  228. "/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"
  229. ), $allowimgcode ? array(
  230. "parseimg(0, 0, '\\1', ".intval($lazyload).", ".intval($pid).", 'onmouseover=\"img_onmouseoverfunc(this)\" ".($lazyload ? "lazyloadthumb=\"1\"" : "onload=\"thumbImg(this)\"")."')",
  231. "parseimg('\\1', '\\2', '\\3', ".intval($lazyload).", ".intval($pid).")"
  232. ) : ($allowbbcode ? array(
  233. (!defined('IN_MOBILE') ? "bbcodeurl('\\1', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\1', '')"),
  234. (!defined('IN_MOBILE') ? "bbcodeurl('\\3', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\3', '')"),
  235. ) : array("bbcodeurl('\\1', '{url}')", "bbcodeurl('\\3', '{url}')")), $message);
  236. }
  237. }
  238. for($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
  239. $message = str_replace("[\tDISCUZ_CODE_$i\t]", $_G['forum_discuzcode']['codehtml'][$i], $message);
  240. }
  241. unset($msglower);
  242. if($jammer) {
  243. $message = preg_replace("/\r\n|\n|\r/e", "jammer()", $message);
  244. }
  245. if($first) {
  246. if(helper_access::check_module('group')) {
  247. $message = preg_replace("/\[groupid=(\d+)\](.*)\[\/groupid\]/i", lang('forum/template', 'fromgroup').': <a href="forum.php?mod=forumdisplay&fid=\\1" target="_blank">\\2</a>', $message);
  248. } else {
  249. $message = preg_replace("/(\[groupid=\d+\].*\[\/groupid\])/i", '', $message);
  250. }
  251. }
  252. return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), array('&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $message));
  253. }
  254. function parseurl($url, $text, $scheme) {
  255. global $_G;
  256. if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.)[^\[\"']+/i", trim($text), $matches)) {
  257. $url = $matches[0];
  258. $length = 65;
  259. if(strlen($url) > $length) {
  260. $text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
  261. }
  262. return '<a href="'.(substr(strtolower($url), 0, 4) == 'www.' ? 'http://'.$url : $url).'" target="_blank">'.$text.'</a>';
  263. } else {
  264. $url = substr($url, 1);
  265. if(substr(strtolower($url), 0, 4) == 'www.') {
  266. $url = 'http://'.$url;
  267. }
  268. $url = !$scheme ? $_G['siteurl'].$url : $url;
  269. return '<a href="'.$url.'" target="_blank">'.$text.'</a>';
  270. }
  271. }
  272. function parseflash($w, $h, $url) {
  273. $w = !$w ? 550 : $w;
  274. $h = !$h ? 400 : $h;
  275. preg_match("/((https?){1}:\/\/|www\.)[^\[\"'\?]+(\.swf|\.flv)(\?.+)?/i", $url, $matches);
  276. $url = $matches[0];
  277. $randomid = 'swf_'.random(3);
  278. if(fileext($url) != 'flv') {
  279. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$w.'\', \'height\', \''.$h.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', encodeURI(\''.$url.'\'), \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  280. } else {
  281. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$w.'\', \'height\', \''.$h.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.STATICURL.'image/common/flvplayer.swf\', \'flashvars\', \'file='.rawurlencode($url).'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  282. }
  283. }
  284. function parseed2k($url) {
  285. global $_G;
  286. list(,$type, $name, $size,) = explode('|', $url);
  287. $url = 'ed2k://'.$url.'/';
  288. $name = addslashes($name);
  289. if($type == 'file') {
  290. $ed2kid = 'ed2k_'.random(3);
  291. return '<a id="'.$ed2kid.'" href="'.$url.'" target="_blank">'.dhtmlspecialchars(urldecode($name)).' ('.sizecount($size).')</a><script language="javascript">$(\''.$ed2kid.'\').innerHTML=htmlspecialchars(unescape(decodeURIComponent(\''.$name.'\')))+\' ('.sizecount($size).')\';</script>';
  292. } else {
  293. return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
  294. }
  295. }
  296. function parseattachurl($aid, $ext, $ignoretid = 0) {
  297. global $_G;
  298. $_G['forum_skipaidlist'][] = $aid;
  299. return $_G['siteurl'].'forum.php?mod=attachment&aid='.aidencode($aid, $ext, $ignoretid ? '' : $_G['tid']).($ext ? '&request=yes&_f=.'.$ext : '');
  300. }
  301. function parseemail($email, $text) {
  302. $text = str_replace('\"', '"', $text);
  303. if(!$email && preg_match("/\s*([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\s*/i", $text, $matches)) {
  304. $email = trim($matches[0]);
  305. return '<a href="mailto:'.$email.'">'.$email.'</a>';
  306. } else {
  307. return '<a href="mailto:'.substr($email, 1).'">'.$text.'</a>';
  308. }
  309. }
  310. function parsetable($width, $bgcolor, $message) {
  311. if(strpos($message, '[/tr]') === FALSE && strpos($message, '[/td]') === FALSE) {
  312. $rows = explode("\n", $message);
  313. $s = !defined('IN_MOBILE') ? '<table cellspacing="0" class="t_table" '.
  314. ($width == '' ? NULL : 'style="width:'.$width.'"').
  315. ($bgcolor ? ' bgcolor="'.$bgcolor.'">' : '>') : '<table>';
  316. foreach($rows as $row) {
  317. $s .= '<tr><td>'.str_replace(array('\|', '|', '\n'), array('&#124;', '</td><td>', "\n"), $row).'</td></tr>';
  318. }
  319. $s .= '</table>';
  320. return $s;
  321. } else {
  322. if(!preg_match("/^\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td([=\d,%]+)?\]/", $message) && !preg_match("/^<tr[^>]*?>\s*<td[^>]*?>/", $message)) {
  323. return str_replace('\\"', '"', preg_replace("/\[tr(?:=([\(\)\s%,#\w]+))?\]|\[td([=\d,%]+)?\]|\[\/td\]|\[\/tr\]/", '', $message));
  324. }
  325. if(substr($width, -1) == '%') {
  326. $width = substr($width, 0, -1) <= 98 ? intval($width).'%' : '98%';
  327. } else {
  328. $width = intval($width);
  329. $width = $width ? ($width <= 560 ? $width.'px' : '98%') : '';
  330. }
  331. return (!defined('IN_MOBILE') ? '<table cellspacing="0" class="t_table" '.
  332. ($width == '' ? NULL : 'style="width:'.$width.'"').
  333. ($bgcolor ? ' bgcolor="'.$bgcolor.'">' : '>') : '<table>').
  334. str_replace('\\"', '"', preg_replace(array(
  335. "/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,4}%?))?\]/ie",
  336. "/\[\/td\]\s*\[td(?:=(\d{1,4}%?))?\]/ie",
  337. "/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ie",
  338. "/\[\/td\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/ie",
  339. "/\[\/td\]\s*\[\/tr\]\s*/i"
  340. ), array(
  341. "parsetrtd('\\1', '0', '0', '\\2')",
  342. "parsetrtd('td', '0', '0', '\\1')",
  343. "parsetrtd('\\1', '\\2', '\\3', '\\4')",
  344. "parsetrtd('td', '\\1', '\\2', '\\3')",
  345. '</td></tr>'
  346. ), $message)
  347. ).'</table>';
  348. }
  349. }
  350. function parsetrtd($bgcolor, $colspan, $rowspan, $width) {
  351. return ($bgcolor == 'td' ? '</td>' : '<tr'.($bgcolor && !defined('IN_MOBILE') ? ' style="background-color:'.$bgcolor.'"' : '').'>').'<td'.($colspan > 1 ? ' colspan="'.$colspan.'"' : '').($rowspan > 1 ? ' rowspan="'.$rowspan.'"' : '').($width && !defined('IN_MOBILE') ? ' width="'.$width.'"' : '').'>';
  352. }
  353. function parseaudio($url, $width = 400) {
  354. $ext = strtolower(substr(strrchr($url, '.'), 1, 5));
  355. switch($ext) {
  356. case 'mp3':
  357. $randomid = 'mp3_'.random(3);
  358. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'FlashVars\', \'soundFile='.urlencode($url).'\', \'width\', \'290\', \'height\', \'24\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.STATICURL.'image/common/player.swf\', \'quality\', \'high\', \'bgcolor\', \'#FFFFFF\', \'menu\', \'false\', \'wmode\', \'transparent\', \'allowscriptaccess\', \'none\', \'allowNetworking\', \'internal\');</script>';
  359. case 'wma':
  360. case 'mid':
  361. case 'wav':
  362. return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="64"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="0" type="application/x-mplayer2" width="'.$width.'" height="64"></embed></object>';
  363. case 'ra':
  364. case 'rm':
  365. case 'ram':
  366. $mediaid = 'media_'.random(3);
  367. return '<object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'" height="32"><param name="autostart" value="0" /><param name="src" value="'.$url.'" /><param name="controls" value="controlpanel" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" autostart="0" type="audio/x-pn-realaudio-plugin" controls="ControlPanel" console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';
  368. }
  369. }
  370. function parsemedia($params, $url) {
  371. $params = explode(',', $params);
  372. $width = intval($params[1]) > 800 ? 800 : intval($params[1]);
  373. $height = intval($params[2]) > 600 ? 600 : intval($params[2]);
  374. $url = addslashes($url);
  375. if($flv = parseflv($url, $width, $height)) {
  376. return $flv;
  377. }
  378. if(in_array(count($params), array(3, 4))) {
  379. $type = $params[0];
  380. $url = htmlspecialchars(str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url)));
  381. switch($type) {
  382. case 'mp3':
  383. case 'wma':
  384. case 'ra':
  385. case 'ram':
  386. case 'wav':
  387. case 'mid':
  388. return parseaudio($url, $width);
  389. case 'rm':
  390. case 'rmvb':
  391. case 'rtsp':
  392. $mediaid = 'media_'.random(3);
  393. return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'" height="'.$height.'"><param name="autostart" value="0" /><param name="src" value="'.$url.'" /><param name="controls" value="imagewindow" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" autostart="0" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="'.$mediaid.'_" width="'.$width.'" height="'.$height.'"></embed></object><br /><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'" height="32"><param name="src" value="'.$url.'" /><param name="controls" value="controlpanel" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" autostart="0" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';
  394. case 'flv':
  395. $randomid = 'flv_'.random(3);
  396. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.STATICURL.'image/common/flvplayer.swf\', \'flashvars\', \'file='.rawurlencode($url).'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  397. case 'swf':
  398. $randomid = 'swf_'.random(3);
  399. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', encodeURI(\''.$url.'\'), \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  400. case 'asf':
  401. case 'asx':
  402. case 'wmv':
  403. case 'mms':
  404. case 'avi':
  405. case 'mpg':
  406. case 'mpeg':
  407. return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="'.$height.'"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="0" type="application/x-mplayer2" width="'.$width.'" height="'.$height.'"></embed></object>';
  408. case 'mov':
  409. return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'" height="'.$height.'"><param name="autostart" value="false" /><param name="src" value="'.$url.'" /><embed src="'.$url.'" autostart="false" type="video/quicktime" controller="true" width="'.$width.'" height="'.$height.'"></embed></object>';
  410. default:
  411. return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
  412. }
  413. }
  414. return;
  415. }
  416. function bbcodeurl($url, $tags) {
  417. if(!preg_match("/<.+?>/s", $url)) {
  418. if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\//', $url) && !preg_match('/^data\//', $url)) {
  419. $url = 'http://'.$url;
  420. }
  421. return str_replace(array('submit', 'member.php?mod=logging'), array('', ''), str_replace('{url}', addslashes($url), $tags));
  422. } else {
  423. return '&nbsp;'.$url;
  424. }
  425. }
  426. function jammer() {
  427. $randomstr = '';
  428. for($i = 0; $i < mt_rand(5, 15); $i++) {
  429. $randomstr .= chr(mt_rand(32, 59)).' '.chr(mt_rand(63, 126));
  430. }
  431. return mt_rand(0, 1) ? '<font class="jammer">'.$randomstr.'</font>'."\r\n" :
  432. "\r\n".'<span style="display:none">'.$randomstr.'</span>';
  433. }
  434. function highlightword($text, $words, $prepend) {
  435. $text = str_replace('\"', '"', $text);
  436. foreach($words AS $key => $replaceword) {
  437. $text = str_replace($replaceword, '<highlight>'.$replaceword.'</highlight>', $text);
  438. }
  439. return "$prepend$text";
  440. }
  441. function parseflv($url, $width = 0, $height = 0) {
  442. $lowerurl = strtolower($url);
  443. $flv = '';
  444. $imgurl = '';
  445. if($lowerurl != str_replace(array('player.youku.com/player.php/sid/','tudou.com/v/','player.ku6.com/refer/'), '', $lowerurl)) {
  446. $flv = $url;
  447. } elseif(strpos($lowerurl, 'v.youku.com/v_show/') !== FALSE) {
  448. $ctx = stream_context_create(array('http' => array('timeout' => 10)));
  449. if(preg_match("/http:\/\/v.youku.com\/v_show\/id_([^\/]+)(.html|)/i", $url, $matches)) {
  450. $flv = 'http://player.youku.com/player.php/sid/'.$matches[1].'/v.swf';
  451. if(!$width && !$height) {
  452. $api = 'http://v.youku.com/player/getPlayList/VideoIDS/'.$matches[1];
  453. $str = stripslashes(file_get_contents($api, false, $ctx));
  454. if(!empty($str) && preg_match("/\"logo\":\"(.+?)\"/i", $str, $image)) {
  455. $url = substr($image[1], 0, strrpos($image[1], '/')+1);
  456. $filename = substr($image[1], strrpos($image[1], '/')+2);
  457. $imgurl = $url.'0'.$filename;
  458. }
  459. }
  460. }
  461. } elseif(strpos($lowerurl, 'tudou.com/programs/view/') !== FALSE) {
  462. if(preg_match("/http:\/\/(www.)?tudou.com\/programs\/view\/([^\/]+)/i", $url, $matches)) {
  463. $flv = 'http://www.tudou.com/v/'.$matches[2];
  464. if(!$width && !$height) {
  465. $str = file_get_contents($url, false, $ctx);
  466. if(!empty($str) && preg_match("/<span class=\"s_pic\">(.+?)<\/span>/i", $str, $image)) {
  467. $imgurl = trim($image[1]);
  468. }
  469. }
  470. }
  471. } elseif(strpos($lowerurl, 'v.ku6.com/show/') !== FALSE) {
  472. if(preg_match("/http:\/\/v.ku6.com\/show\/([^\/]+).html/i", $url, $matches)) {
  473. $flv = 'http://player.ku6.com/refer/'.$matches[1].'/v.swf';
  474. if(!$width && !$height) {
  475. $api = 'http://vo.ku6.com/fetchVideo4Player/1/'.$matches[1].'.html';
  476. $str = file_get_contents($api, false, $ctx);
  477. if(!empty($str) && preg_match("/\"picpath\":\"(.+?)\"/i", $str, $image)) {
  478. $imgurl = str_replace(array('\u003a', '\u002e'), array(':', '.'), $image[1]);
  479. }
  480. }
  481. }
  482. } elseif(strpos($lowerurl, 'v.ku6.com/special/show_') !== FALSE) {
  483. if(preg_match("/http:\/\/v.ku6.com\/special\/show_\d+\/([^\/]+).html/i", $url, $matches)) {
  484. $flv = 'http://player.ku6.com/refer/'.$matches[1].'/v.swf';
  485. if(!$width && !$height) {
  486. $api = 'http://vo.ku6.com/fetchVideo4Player/1/'.$matches[1].'.html';
  487. $str = file_get_contents($api, false, $ctx);
  488. if(!empty($str) && preg_match("/\"picpath\":\"(.+?)\"/i", $str, $image)) {
  489. $imgurl = str_replace(array('\u003a', '\u002e'), array(':', '.'), $image[1]);
  490. }
  491. }
  492. }
  493. } elseif(strpos($lowerurl, 'www.youtube.com/watch?') !== FALSE) {
  494. if(preg_match("/http:\/\/www.youtube.com\/watch\?v=([^\/&]+)&?/i", $url, $matches)) {
  495. $flv = 'http://www.youtube.com/v/'.$matches[1].'&hl=zh_CN&fs=1';
  496. if(!$width && !$height) {
  497. $str = file_get_contents($url, false, $ctx);
  498. if(!empty($str) && preg_match("/'VIDEO_HQ_THUMB':\s'(.+?)'/i", $str, $image)) {
  499. $url = substr($image[1], 0, strrpos($image[1], '/')+1);
  500. $filename = substr($image[1], strrpos($image[1], '/')+3);
  501. $imgurl = $url.$filename;
  502. }
  503. }
  504. }
  505. } elseif(strpos($lowerurl, 'tv.mofile.com/') !== FALSE) {
  506. if(preg_match("/http:\/\/tv.mofile.com\/([^\/]+)/i", $url, $matches)) {
  507. $flv = 'http://tv.mofile.com/cn/xplayer.swf?v='.$matches[1];
  508. if(!$width && !$height) {
  509. $str = file_get_contents($url, false, $ctx);
  510. if(!empty($str) && preg_match("/thumbpath=\"(.+?)\";/i", $str, $image)) {
  511. $imgurl = trim($image[1]);
  512. }
  513. }
  514. }
  515. } elseif(strpos($lowerurl, 'v.mofile.com/show/') !== FALSE) {
  516. if(preg_match("/http:\/\/v.mofile.com\/show\/([^\/]+).shtml/i", $url, $matches)) {
  517. $flv = 'http://tv.mofile.com/cn/xplayer.swf?v='.$matches[1];
  518. if(!$width && !$height) {
  519. $str = file_get_contents($url, false, $ctx);
  520. if(!empty($str) && preg_match("/thumbpath=\"(.+?)\";/i", $str, $image)) {
  521. $imgurl = trim($image[1]);
  522. }
  523. }
  524. }
  525. } elseif(strpos($lowerurl, 'video.sina.com.cn/v/b/') !== FALSE) {
  526. if(preg_match("/http:\/\/video.sina.com.cn\/v\/b\/(\d+)-(\d+).html/i", $url, $matches)) {
  527. $flv = 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid='.$matches[1];
  528. if(!$width && !$height) {
  529. $api = 'http://interface.video.sina.com.cn/interface/common/getVideoImage.php?vid='.$matches[1];
  530. $str = file_get_contents($api, false, $ctx);
  531. if(!empty($str)) {
  532. $imgurl = str_replace('imgurl=', '', trim($str));
  533. }
  534. }
  535. }
  536. } elseif(strpos($lowerurl, 'you.video.sina.com.cn/b/') !== FALSE) {
  537. if(preg_match("/http:\/\/you.video.sina.com.cn\/b\/(\d+)-(\d+).html/i", $url, $matches)) {
  538. $flv = 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid='.$matches[1];
  539. if(!$width && !$height) {
  540. $api = 'http://interface.video.sina.com.cn/interface/common/getVideoImage.php?vid='.$matches[1];
  541. $str = file_get_contents($api, false, $ctx);
  542. if(!empty($str)) {
  543. $imgurl = str_replace('imgurl=', '', trim($str));
  544. }
  545. }
  546. }
  547. } elseif(strpos($lowerurl, 'http://my.tv.sohu.com/u/') !== FALSE) {
  548. if(preg_match("/http:\/\/my.tv.sohu.com\/u\/[^\/]+\/(\d+)/i", $url, $matches)) {
  549. $flv = 'http://v.blog.sohu.com/fo/v4/'.$matches[1];
  550. if(!$width && !$height) {
  551. $api = 'http://v.blog.sohu.com/videinfo.jhtml?m=view&id='.$matches[1].'&outType=3';
  552. $str = file_get_contents($api, false, $ctx);
  553. if(!empty($str) && preg_match("/\"cutCoverURL\":\"(.+?)\"/i", $str, $image)) {
  554. $imgurl = str_replace(array('\u003a', '\u002e'), array(':', '.'), $image[1]);
  555. }
  556. }
  557. }
  558. } elseif(strpos($lowerurl, 'http://v.blog.sohu.com/u/') !== FALSE) {
  559. if(preg_match("/http:\/\/v.blog.sohu.com\/u\/[^\/]+\/(\d+)/i", $url, $matches)) {
  560. $flv = 'http://v.blog.sohu.com/fo/v4/'.$matches[1];
  561. if(!$width && !$height) {
  562. $api = 'http://v.blog.sohu.com/videinfo.jhtml?m=view&id='.$matches[1].'&outType=3';
  563. $str = file_get_contents($api, false, $ctx);
  564. if(!empty($str) && preg_match("/\"cutCoverURL\":\"(.+?)\"/i", $str, $image)) {
  565. $imgurl = str_replace(array('\u003a', '\u002e'), array(':', '.'), $image[1]);
  566. }
  567. }
  568. }
  569. } elseif(strpos($lowerurl, 'http://www.ouou.com/fun_funview') !== FALSE) {
  570. $str = file_get_contents($url, false, $ctx);
  571. if(!empty($str) && preg_match("/var\sflv\s=\s'(.+?)';/i", $str, $matches)) {
  572. $flv = $_G['style']['imgdir'].'/flvplayer.swf?&autostart=true&file='.urlencode($matches[1]);
  573. if(!$width && !$height && preg_match("/var\simga=\s'(.+?)';/i", $str, $image)) {
  574. $imgurl = trim($image[1]);
  575. }
  576. }
  577. } elseif(strpos($lowerurl, 'http://www.56.com') !== FALSE) {
  578. if(preg_match("/http:\/\/www.56.com\/\S+\/play_album-aid-(\d+)_vid-(.+?).html/i", $url, $matches)) {
  579. $flv = 'http://player.56.com/v_'.$matches[2].'.swf';
  580. $matches[1] = $matches[2];
  581. } elseif(preg_match("/http:\/\/www.56.com\/\S+\/([^\/]+).html/i", $url, $matches)) {
  582. $flv = 'http://player.56.com/'.$matches[1].'.swf';
  583. }
  584. if(!$width && !$height && !empty($matches[1])) {
  585. $api = 'http://vxml.56.com/json/'.str_replace('v_', '', $matches[1]).'/?src=out';
  586. $str = file_get_contents($api, false, $ctx);
  587. if(!empty($str) && preg_match("/\"img\":\"(.+?)\"/i", $str, $image)) {
  588. $imgurl = trim($image[1]);
  589. }
  590. }
  591. }
  592. if($flv) {
  593. if(!$width && !$height) {
  594. return array('flv' => $flv, 'imgurl' => $imgurl);
  595. } else {
  596. $width = addslashes($width);
  597. $height = addslashes($height);
  598. $flv = addslashes($flv);
  599. $randomid = 'flv_'.random(3);
  600. return '<span id="'.$randomid.'"></span><script type="text/javascript" reload="1">$(\''.$randomid.'\').innerHTML=AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.$flv.'\', \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
  601. }
  602. } else {
  603. return FALSE;
  604. }
  605. }
  606. function parseimg($width, $height, $src, $lazyload, $pid, $extra = '') {
  607. global $_G;
  608. static $styleoutput = null;
  609. if($_G['setting']['domainwhitelist_affectimg']) {
  610. $tmp = parse_url($src);
  611. if(!empty($tmp['host']) && !iswhitelist($tmp['host'])) {
  612. return $src;
  613. }
  614. }
  615. if(strstr($src, 'file:') || substr($src, 1, 1) == ':') {
  616. return $src;
  617. }
  618. if($width > $_G['setting']['imagemaxwidth']) {
  619. $height = intval($_G['setting']['imagemaxwidth'] * $height / $width);
  620. $width = $_G['setting']['imagemaxwidth'];
  621. if(defined('IN_MOBILE')) {
  622. $extra = '';
  623. } else {
  624. $extra = 'onmouseover="img_onmouseoverfunc(this)" onclick="zoom(this)" style="cursor:pointer"';
  625. }
  626. }
  627. $attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src';
  628. $rimg_id = random(5);
  629. $GLOBALS['aimgs'][$pid][] = $rimg_id;
  630. $guestviewthumb = !empty($_G['setting']['guestviewthumb']['flag']) && empty($_G['uid']);
  631. $img = '';
  632. if($guestviewthumb) {
  633. if(!isset($styleoutput)) {
  634. $img .= guestviewthumbstyle();
  635. $styleoutput = true;
  636. }
  637. $img .= '<div class="guestviewthumb"><img id="aimg_'.$rimg_id.'" class="guestviewthumb_cur" onclick="showWindow(\'login\', \'{loginurl}\'+\'&referer=\'+encodeURIComponent(location))" '.$attrsrc.'="{url}" border="0" alt="" />
  638. <br><a href="{loginurl}" onclick="showWindow(\'login\', this.href+\'&referer=\'+encodeURIComponent(location));">'.lang('forum/template', 'guestviewthumb').'</a></div>';
  639. } else {
  640. if(defined('IN_MOBILE')) {
  641. $img = '<img'.($width > 0 ? 'width="'.$width.'"' : '').($height > 0 ? ' height="'.$height.'"' : '').' src="{url}" border="0" alt="" />';
  642. } else {
  643. $img = '<img id="aimg_'.$rimg_id.'" onclick="zoom(this, this.src, 0, 0, '.($_G['setting']['showexif'] ? 1 : 0).')" class="zoom"'.($width > 0 ? ' width="'.$width.'"' : '').($height > 0 ? ' height="'.$height.'"' : '').' '.$attrsrc.'="{url}" '.($extra ? $extra.' ' : '').'border="0" alt="" />';
  644. }
  645. }
  646. $code = bbcodeurl($src, $img);
  647. if($guestviewthumb) {
  648. $code = str_replace('{loginurl}', 'member.php?mod=logging&action=login', $code);
  649. }
  650. return $code;
  651. }
  652. function parsesmiles(&$message) {
  653. global $_G;
  654. static $enablesmiles;
  655. if($enablesmiles === null) {
  656. $enablesmiles = false;
  657. if(!empty($_G['cache']['smilies']) && is_array($_G['cache']['smilies'])) {
  658. foreach($_G['cache']['smilies']['replacearray'] AS $key => $smiley) {
  659. $_G['cache']['smilies']['replacearray'][$key] = '<img src="'.STATICURL.'image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'].'/'.$smiley.'" smilieid="'.$key.'" border="0" alt="" />';
  660. }
  661. $enablesmiles = true;
  662. }
  663. }
  664. $enablesmiles && $message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message, $_G['setting']['maxsmilies']);
  665. return $message;
  666. }
  667. function parsepostbg($bgimg, $pid) {
  668. global $_G;
  669. static $postbg;
  670. if($postbg[$pid]) {
  671. return '';
  672. }
  673. loadcache('postimg');
  674. foreach($_G['cache']['postimg']['postbg'] as $postbg) {
  675. if($postbg['url'] != $bgimg) {
  676. continue;
  677. }
  678. $bgimg = dhtmlspecialchars(basename($bgimg), ENT_QUOTES);
  679. $postbg[$pid] = true;
  680. $_G['forum_posthtml']['header'][$pid] .= '<style type="text/css">#pid'.$pid.'{background-image:url("'.STATICURL.'image/postbg/'.$bgimg.'");}</style>';
  681. break;
  682. }
  683. return '';
  684. }
  685. function parsepassword($password, $pid) {
  686. global $_G;
  687. static $postpw;
  688. if($postpw[$pid]) {
  689. return '';
  690. }
  691. $postpw[$pid] = true;
  692. if(empty($_G['cookie']['postpw_'.$pid]) || $_G['cookie']['postpw_'.$pid] != md5($password)) {
  693. $_G['forum_discuzcode']['passwordlock'][$pid] = 1;
  694. }
  695. return '';
  696. }
  697. function guestviewthumbstyle() {
  698. static $styleoutput = null;
  699. $return = '';
  700. if ($styleoutput === null) {
  701. global $_G;
  702. $return = '<style>.guestviewthumb {margin:10px auto; text-align:center;}.guestviewthumb a {font-size:12px;}.guestviewthumb_cur {cursor:url('.IMGDIR.'/scf.cur), default; max-width:'.$_G['setting']['guestviewthumb']['width'].'px;}.ie6 .guestviewthumb_cur { width:'.$_G['setting']['guestviewthumb']['width'].'px !important;}</style>';
  703. $styleoutput = true;
  704. }
  705. return $return;
  706. }
  707. ?>