include/discuzcode.func.php
不能Find:
[Copy to clipboard]CODE:
return ($htmlon || $allowhtml) && $parsetype != 1 ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));
我的discuzcode.func.php,请老大帮我修改一下,谢谢
<?php
/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: discuzcode.func.php,v $
$Revision: 1.38.2.2 $
$Date: 2006/09/05 07:15:57 $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$discuzcodes = array(
'pcodecount' => -1,
'codecount' => 0,
'codehtml' => '',
'searcharray' => array(),
'replacearray' => array(),
'seoarray' => array(
0 => '',
1 => $_SERVER['HTTP_HOST'],
2 => $bbname,
3 => $seotitle,
4 => $seokeywords,
5 => $seodescription
)
);
if(!is_array($_DCACHE['bbcodes']) || !is_array($_DCACHE['smilies'])) {
@include DISCUZ_ROOT.'./forumdata/cache/cache_bbcodes.php';
}
foreach($_DCACHE['smilies']['replacearray'] as $key => $smiley) {
$_DCACHE['smilies']['replacearray'][$key] = '<img src="'.SMDIR.'/'.$smiley.'" smilieid="'.$key.'" border="0" alt="" />';
}
mt_srand((double)microtime() * 1000000);
function attachtag($pid, $aid, &$postlist) {
global $language, $attachrefcheck, $attachurl;
if(isset($postlist[$pid]['attachments'][$aid])) {
include_once language('misc');
$attach = $postlist[$pid]['attachments'][$aid];
unset($postlist[$pid]['attachments'][$aid]);
$replacement = "<br><br>$attach[attachicon] ";
if($attach['attachimg']) {
$replacement .= "<a href=\"member.php?action=credits&view=getattach\" title=\"$language[attach_credits_policy]\" target=\"_blank\">$language[attach_img]</a>: ".
($attach['readperm'] ? ", $language[attach_readperm] $attach[readperm]" : '').
($attach['description'] ? "[{$attach[description]}]" : '').
" <a href=\"attachment.php?aid=$attach[aid]\" target=\"_blank\" class=\"bold\">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>".
($attachrefcheck ? "<img src=\"attachment.php?aid=$attach[aid]&noupdate=yes\" border=\"0\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='$language[attach_img_zoom]';}\" onmouseover=\"if(this.resized) this.style.cursor='hand';\" onclick=\"if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}\" onmousewheel=\"return imgzoom(this);\">" : "<img src=\"$attachurl/$attach[attachment]\" border=\"0\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='$language[attach_img_zoom]';}\" onmouseover=\"if(this.resized) this.style.cursor='hand';\" onclick=\"if(!this.resized) {return false;} else {window.open('".addslashes("$attachurl/$attach[attachment]")."');}\" onmousewheel=\"return imgzoom(this);\" alt=\"\" />");
} else {
$replacement .= "<a href=\"member.php?action=credits&view=getattach\" title=\"$language[attach_credits_policy]\" target=\"_blank\">$language[attach]</a>: ".
($attach['description'] ? "[{$attach[description]}]" : '').
" <a href=\"attachment.php?aid=$attach[aid]\" target=\"_blank\" class=\"bold\">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><span class=\"smalltxt\">$language[attach_download_count] $attach[downloads]".
($attach['readperm'] ? ", $language[attach_readperm] $attach[readperm]" : '').
"</span><br>";
}
return $replacement;
} else {
return '<strike>[attach]'.$aid.'[/attach]</strike>';
}
}
function censor($message) {
global $_DCACHE;
require_once(DISCUZ_ROOT.'/forumdata/cache/cache_censor.php');
if($_DCACHE['censor']['banned'] && preg_match($_DCACHE['censor']['banned'], $message)) {
showmessage('word_banned');
} else {
return empty($_DCACHE['censor']['filter']) ? $message :
@preg_replace($_DCACHE['censor']['filter']['find'], $_DCACHE['censor']['filter']['replace'], $message);
}
}
function censormod($message) {
global $_DCACHE;
require_once(DISCUZ_ROOT.'/forumdata/cache/cache_censor.php');
return $_DCACHE['censor']['mod'] && preg_match($_DCACHE['censor']['mod'], $message);
}
function creditshide($creditsrequire, $message) {
global $language, $ishide;
include_once language('misc');
if($GLOBALS['credits'] < $creditsrequire && !$GLOBALS['forum']['ismoderator']) {
$ishide = TRUE;
return '<b>'.eval("return \"$language[post_hide_credits_hidden]\";").'</b>';
} else {
$ishide = FALSE;
return '<b>'.eval("return \"$language[post_hide_credits]\";").'</b><br>'.
'==============================<br><br>'.
str_replace('\\"', '"', $message).'<br><br>'.
'==============================';
}
}
function codedisp($code) {
global $discuzcodes;
$discuzcodes['pcodecount']++;
$code = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)));
$discuzcodes['codehtml'][$discuzcodes['pcodecount']] = "<br><br><div class=\"msgheader\"><div class=\"right\"><a href=\"###\" class=\"smalltxt\" onclick=\"copycode($('code$discuzcodes[codecount]'));\">[Copy to clipboard]</a></div>CODE:</div><div class=\"msgborder\" id=\"code$discuzcodes[codecount]\">$code</div><br>";
$discuzcodes['codecount']++;
return "[\tDISCUZ_CODE_$discuzcodes[pcodecount]\t]";
}
function karmaimg($rate, $ratetimes) {
$karmaimg = '';
if($rate && $ratetimes) {
$image = $rate > 0 ? 'agree.gif' : 'disagree.gif';
for($i = 0; $i < ceil(abs($rate) / $ratetimes); $i++) {
$karmaimg .= '<img src="'.IMGDIR.'/'.$image.'" border="0" align="right" alt="" />';
}
}
return $karmaimg;
}
function parseurl($message) {
return preg_match("/\[code\].+?\[\/code\]/is", $message) ? $message :
substr(preg_replace( array(
"/(?<=[^\]a-z0-9-=\"'\\/])(http:\/\/[a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+\.(jpg|gif|png|bmp))/i",
"/(?<=[^\]\)a-z0-9-=\"'\\/])((https?|ftp|gopher|news|telnet|rtsp|mms|callto):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i",
"/(?<=[^\]\)a-z0-9\/\-_.~?=:.])([_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i"
), array(
"",
"\\1\\3",
"\\0"
), ' '.$message), 1);
}
function parsetable($width, $message) {
$width = substr($width, -1) == '%' ? (substr($width, 0, -1) <= 98 ? $width : '98%') : ($width <= 560 ? $width : '98%');
return '<table '.
($width == '' ? NULL : 'width="'.$width.'" ').
'align="center" class="t_table">'.
str_replace(array('[tr]', '[td]', '[/td]', '[/tr]', '\\"'), array('<tr>', '<td>', '</td>', '</tr>', '"'), preg_replace("/\[td=(\d{1,2}),(\d{1,2})(,(\d{1,3}%?))?\]/is", '<td colspan="\\1" rowspan="\\2" width="\\4">', $message)).
'</table>';
}
function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0') {
global $discuzcodes, $credits, $tid, $discuz_uid, $highlight, $maxsmilies, $db, $tablepre, $ishide, $nopay, $pricepay, $paytimes;
if($parsetype != 1 && !$bbcodeoff && $allowbbcode) {
$message = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "codedisp('\\1')", $message);
$message = preg_replace("/\s*\[emule\](.+?)\[\/emule\]\s*/ies", "emu('\\1')", $message);
}
if(!$htmlon && !$allowhtml) {
$message = $jammer ? preg_replace("/\r\n|\n|\r/e", "jammer()", dhtmlspecialchars($message)) : dhtmlspecialchars($message);
}
if(!$smileyoff && $allowsmilies && !empty($GLOBALS['_DCACHE']['smilies']) && is_array($GLOBALS['_DCACHE']['smilies'])) {
$message = preg_replace($GLOBALS['_DCACHE']['smilies']['searcharray'], $GLOBALS['_DCACHE']['smilies']['replacearray'], $message, $maxsmilies);
}
//--------------------- 出售内容开始 -------------------------
if($pricepay && preg_match("/\[sell=\d*\].+?\[\/sell\]/is", $message)) {
if($pricepay == '-1' && preg_match("/\[sell=\d*\].+?\[\/sell\]/is", $message)) {
$message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/is", "<fieldset style=\"padding: 5px;width:97%;border:1px solid ".BORDERCOLOR."\" align=\"center\"><legend> <span class='outertxt'>出 售 无 效</span> </legend><table align='center' border='0' width='97%' cellspacing='6' cellpadding='0'><tr><td>本主题被 [强制退款],所有付费者已得到退款。</td></tr></table></fieldset><br><br>\\2", $message);
}elseif($pricepay == '-2' && preg_match("/\[sell=\d*\].+?\[\/sell\]/is", $message)) {
$message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/is", "<br><TABLE cellPadding='3' cellSpacing='1' width='97%' align='center' class='tableborder'><TR><TD class='header' align='center'>超 过 出 售 时 限<TR><TD align='center' class='altbg2'><table border='0' width='100%' cellspacing='3' cellpadding='0'><tr align='center'><td>编号 : <input type='text' value='$tid' size='8'></td><td>价格 : <input type='text' value='0' size='6'></td><td>出售时限己过期 : <input type='text' value='0' size='6'> 小时</td><td><a href='misc.php?action=viewpayments&tid=$tid'>[ 付费名单 ]</a></td></tr><tr><td colspan='4'><FIELDSET style='width:100%;border:1px double ".BORDERCOLOR."'><LEGEND> <span class='outertxt'>感 谢 所 有 己 付 费 者</span> </LEGEND><br> 本主题自发表起已超过最长出售时限,现已免费查看。<br><br></FIELDSET></td></tr></table></td></tr></table><br>\\2", $message);
}elseif($pricepay == '-3' && preg_match("/\[sell=\d*\].+?\[\/sell\]/is", $message)) {
$message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/is", "<br><TABLE cellPadding='3' cellSpacing='1' width='97%' align='center' class='tableborder'><TR><TD class='header' align='center'>终 止 出 售<TR><TD align='center' class='altbg2'><table border='0' width='100%' cellspacing='3' cellpadding='0'><tr align='center'><td>编号 : <input type='text' value='$tid' size='8'></td><td>价格 : <input type='text' value='0' size='6'></td><td>出售时限剩余 : <input type='text' value='0' size='6'> 小时</td><td><a href='misc.php?action=viewpayments&tid=$tid'>[ 付费名单 ]</a></td></tr><tr><td colspan='4'><FIELDSET style='width:100%;border:1px double ".BORDERCOLOR."'><LEGEND> <span class='outertxt'>感 谢 所 有 己 付 费 者</span> </LEGEND><br> 本主题被 [终止出售],现已免费查看。<br><br></FIELDSET></td></tr></table></td></tr></table><br>\\2", $message);
}else{
if($nopay == '1') {
if(!$discuz_uid) {
$paymessage = "非论坛会员无权购买,请 [ <a href='logging.php?action=login'>登陆</a> ] 或者 [ <a href='register.php'>注册</a> ]。";
}else{
$paymessage = "请付费查看本帖出售内容 <a href=\"viewthread.php?tid=$tid&pay=pay\">[ 我要付费 ]</a>";
}
$message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/is", "<br><TABLE cellPadding='3' cellSpacing='1' width='97%' align='center' class='tableborder'><TR><TD class='header' align='center'>收 费 单<TR><TD align='center' class='altbg2'><table border='0' width='100%' cellspacing='3' cellpadding='0'><tr align='center'><td>编号 : <input type='text' value='$tid' size='8'></td><td>价格 : <input type='text' value='$pricepay' size='6'></td><td>出售时限剩余 : <input type='text' value='$paytimes' size='6'> 小时</td><td><a href='misc.php?action=viewpayments&tid=$tid'>[ 付费名单 ]</a></td></tr><tr><td colspan='4'><FIELDSET style='width:100%;border:1px double ".BORDERCOLOR."'><LEGEND> <span class='outertxt'>收 费 单</span> </LEGEND><br> $paymessage<br><br></FIELDSET></td></tr></table></td></tr></table><br>", $message);
}else{
$message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/is", "<br><TABLE cellPadding='3' cellSpacing='1' width='97%' align='center' class='tableborder'><TR><TD class='header' align='center'>付 费 证 明<TR><TD align='center' class='altbg2'><table border='0' width='100%' cellspacing='3' cellpadding='0'><tr align='center'><td>编号 : <input type='text' value='$tid' size='8'></td><td>价格 : <input type='text' value='$pricepay' size='6'></td><td>出售时限剩余 : <input type='text' value='$paytimes' size='6'> 小时</td><td><a href='misc.php?action=viewpayments&tid=$tid'>[ 付费名单 ]</a></td></tr><tr><td colspan='4'><FIELDSET style='width:100%;border:1px double ".BORDERCOLOR."'><LEGEND> <span class='outertxt'>感 谢 您 的 付 费</span> </LEGEND><br> 您可以查看以下内容。如发现非法骗财、可以向 版主投诉。<br> 经查证骗财、会被强制退款,将全数款项退还所有已付费者。<br><br></FIELDSET></td></tr></table></td></tr></table><br>\\2", $message);
}
}
}
//--------------------- 出售内容结束 -------------------------
if(!$bbcodeoff && $allowbbcode) {
if(empty($discuzcodes['searcharray'])) {
$discuzcodes['searcharray']['bbcode_regexp'] = array(
"/\[url\]\s*(www.|https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|ed2k:\/\/){1}([^\[\"']+?)\s*\[\/url\]/ie",
"/\[url=www.([^\[\"']+?)\](.+?)\[\/url\]/is",
"/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/is",
"/\[email\]\s*([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\s*\[\/email\]/i",
"/\[email=([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\](.+?)\[\/email\]/is",
"/\[color=([^\[\<]+?)\]/i",
"/\[size=(\d+?)\]/i",
"/\[size=(\d+(px|pt|in|cm|mm|pc|em|ex|%)+?)\]/i",
"/\[font=([^\[\<]+?)\]/i",
"/\[align=([^\[\<]+?)\]/i"
);
$discuzcodes['replacearray']['bbcode_regexp'] = array(
"cuturl('\\1\\2')",
"<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>",
"<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>",
"<a href=\"mailto:\\1@\\2\">\\1@\\2</a>",
"<a href=\"mailto:\\1@\\2\">\\3</a>",
"<font color=\"\\1\">",
"<font size=\"\\1\">",
"<font style=\"font-size: \\1\">",
"<font face=\"\\1\">",
"<p align=\"\\1\">"
);
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\s*\[table(=(\d{1,3}%?))?\][\n\r]*(.+?)[\n\r]*\[\/table\]\s*/ies";
$discuzcodes['replacearray']['bbcode_regexp'][] = "parsetable('\\2', '\\3')";
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\s*\[table(=(\d{1,3}%?))?\][\n\r]*(.+?)[\n\r]*\[\/table\]\s*/ies";
$discuzcodes['replacearray']['bbcode_regexp'][] = "parsetable('\\2', '\\3')";
if($parsetype != 1) {
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is";
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\s*\[free\][\n\r]*(.+?)[\n\r]*\[\/free\]\s*/is";
$discuzcodes['replacearray']['bbcode_regexp'][] = "<br><br><div class=\"msgheader\">QUOTE:</div><div class=\"msgborder\">\\1</div><br>";
$discuzcodes['replacearray']['bbcode_regexp'][] = "<br><br><div class=\"msgheader\">FREE:</div><div class=\"msgborder\">\\1</div><br>";
}
$discuzcodes['searcharray']['bbcode_regexp'] = array_merge($discuzcodes['searcharray']['bbcode_regexp'], $discuzcodes['searcharray']['bbcode_regexp']);
$discuzcodes['replacearray']['bbcode_regexp'] = array_merge($discuzcodes['replacearray']['bbcode_regexp'], $discuzcodes['replacearray']['bbcode_regexp']);
$discuzcodes['searcharray']['bbcode_str'] = array(
'', '', '', '', '', '',
'', '', '', '', '', '', '',
'', '', ' '
);
$discuzcodes['replacearray']['bbcode_str'] = array(
'</font>', '</font>', '</font>', '</p>', '<b>', '</b>', '<i>',
'</i>', '<u>', '</u>', '<ul>', '<ol type=1>', '<ol type=a>',
'<ol type=A>', '<li>', '</ul></ol>', '<blockquote>', '</blockquote>'
);
}
if($parsetype != 1) {
$discuzcodes['searcharray']['bbcode_regexp'][100] = "/\[payto\]\s*\(seller\)(.*)\(\/seller\)\s*(\(subject\)(.*)\(\/subject\))?\s*(\(body\)(.*)\(\/body\))?\s*(\(gross\)(.*)\(\/gross\))?\s*(\(price\)(.*)\(\/price\))?\s*(\(url\)(.*)\(\/url\))?\s*(\(type\)(.*)\(\/type\))?\s*(\(transport\)(.*)\(\/transport\))?\s*(\(ordinary_fee\)(.*)\(\/ordinary_fee\))?\s*(\(express_fee\)(.*)\(\/express_fee\))?\s*\[\/payto\]/iesU";
$discuzcodes['replacearray']['bbcode_regexp'][100] = "payto('\\1',array('subject'=>'\\3','body'=>'\\5','price'=>'\\7','price'=>'\\9','url'=>'\\11','type'=>'\\13','transport'=>'\\15','ordinary_fee'=>'\\17','express_fee'=>'\\19','authorid'=>'$authorid'))";
}
@$message = str_replace($discuzcodes['searcharray']['bbcode_str'], $discuzcodes['replacearray']['bbcode_str'],
preg_replace(
($parsetype != 1 && $allowbbcode == 2 && $GLOBALS['_DCACHE']['bbcodes'] ? array_merge($discuzcodes['searcharray']['bbcode_regexp'], $GLOBALS['_DCACHE']['bbcodes']['searcharray']) : $discuzcodes['searcharray']['bbcode_regexp']),
($parsetype != 1 && $allowbbcode == 2 && $GLOBALS['_DCACHE']['bbcodes'] ? array_merge($discuzcodes['replacearray']['bbcode_regexp'], $GLOBALS['_DCACHE']['bbcodes']['replacearray']) : $discuzcodes['replacearray']['bbcode_regexp']),
$message));
if(!in_array($parsetype, array(1, 2)) && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", $message)) {
if(stristr($message, '[hide]')) {
global $language;
include_once language('misc');
$query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$discuz_uid' LIMIT 1");
if($GLOBALS['forum']['ismoderator'] || $db->result($query, 0)) {
$message = preg_replace("/\[hide\]\s*(.+?)\s*\[\/hide\]/is",
'<span class="bold">'.$language['post_hide_reply'].'</span><br>'.
'==============================<br><br>'.
'\\1<br><br>'.
'==============================',
$message);
$ishide = FALSE;
} else {
$message = preg_replace("/\[hide\](.+?)\[\/hide\]/is", '<b>'.$language['post_hide_reply_hidden'].'</b>', $message);
$ishide = TRUE;
}
}
$message = preg_replace("/\[hide=(\d+)\]\s*(.+?)\s*\[\/hide\]/ies", "creditshide(\\1,'\\2')", $message);
}
}
if(!$bbcodeoff) {
if(empty($discuzcodes['searcharray']['imgcode'])) {
$discuzcodes['searcharray']['imgcode'] = array(
"/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/ies",
"/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
"/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"
);
$discuzcodes['replacearray']['imgcode'] = $allowimgcode ? array(
"bbcodeurl('\\1', ' <img src=\"images/attachicons/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"%s\" target=\"_blank\">Flash: %s</a> ')",
"bbcodeurl('\\1', '<img src=\"%s\" border=\"0\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\\nCTRL+Mouse wheel to zoom in/out\';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=\'hand\'; this.alt=\'Click here to open new window\\nCTRL+Mouse wheel to zoom in/out\';}\" onclick=\"if(!this.resized) {return true;} else {window.open(\'%s\');}\" onmousewheel=\"return imgzoom(this);\" alt=\"\" />')",
"bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\" alt=\"\" />')"
) : array(
"bbcodeurl('\\1', ' <img src=\"images/attachicons/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"%s\" target=\"_blank\">Flash: %s</a> ')",
"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">%s</a>')",
"bbcodeurl('\\3', '<a href=\"%s\" target=\"_blank\">%s</a>')"
);
}
$message = preg_replace($discuzcodes['searcharray']['imgcode'], $discuzcodes['replacearray']['imgcode'], $message);
}
for($i = 0; $i <= $discuzcodes['pcodecount']; $i++) {
$message = str_replace("[\tDISCUZ_CODE_$i\t]", $discuzcodes['codehtml'][$i], $message);
}
if($highlight) {
foreach(explode('+', $highlight) as $ret) {
if($ret) {
$message = preg_replace("/(?<=[\s\"\]>()]|[\x7f-\xff]|^)(".preg_quote($ret, '/').")(([.,:;-?!()\s\"<\[]|[\x7f-\xff]|$))/siU", "<u><b><font color=\"#FF0000\">\\1</font></b></u>\\2", $message);
}
}
}
$message = $htmlon || $allowhtml ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));
return str_replace("/<br />","/\n",$message);
}
function cuturl($url) {
$length = 65;
$urllink = "<a href=\"".(substr(strtolower($url), 0, 4) == 'www.' ? "http://$url" : $url).'" target="_blank">';
if(strlen($url) > $length) {
$url = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
}
$urllink .= $url.'</a>';
return $urllink;
}
function bbcodeurl($url, $tags) {
if(!preg_match("/<.+?>/s", $url)) {
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'ftp://', 'rtsp:/', 'mms://'))) {
$url = 'http://'.$url;
}
return str_replace(array('submit', 'logging.php'), array('', ''), sprintf($tags, $url, addslashes($url)));
} else {
return ' '.$url;
}
}
function jammer() {
$randomstr = '';
for($i = 0; $i < mt_rand(5, 15); $i++) {
$randomstr .= chr(mt_rand(0, 59)).chr(mt_rand(63, 126));
}
if($GLOBALS['thisbg'] == 'altbg1') {
$thisbg = ALTBG1;
} elseif($GLOBALS['thisbg'] == 'altbg2') {
$thisbg = ALTBG2;
} else {
$thisbg = $GLOBALS['thisbg'];
}
return mt_rand(0, 1) ? '<font style="font-size:0px;color:'.$thisbg.'">'.$GLOBALS['discuzcodes']['seoarray'][mt_rand(0, 5)].$randomstr.'</font>'."\r\n" :
"\r\n".'<span style="display:none">'.$randomstr.$GLOBALS['discuzcodes']['seoarray'][mt_rand(0, 5)].'</span>';
}
function emu($code) {
global $discuzcodes;
$discuzcodes['pcodecount']++;
$codecount=$discuzcodes['pcodecount'];
$code = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)));
$view = '';$temp = $total = 0;
$searcharray = explode("\n",$code);
$view = "<br><br><table width=80% align=center cellspacing=1 cellpadding=5 class=tableborder><tr><td colspan=2 align=center class=header>下面是eMule专用的下载链接,您必须安装eMule才能点击下载</td></tr>";
foreach($searcharray as $emule) {
if($emule!='' && eregi("^ed2k:\/\/",$emule)){
$temp++;
$emule = dhtmlspecialchars(trim($emule));
$emule_array = explode("|",$emule);
$total += $emule_array[3];
$totalper = esizecount($emule_array[3]);
$view.="<tr class=category><td class=smalltxt width=88%><input type=\"checkbox\" name=\"em$codecount\" value=\"$emule\" onclick=\"em_size('em$codecount');\" checked=\"checked\"><a href=\"$emule\"><script language=\"javascript\">document.write(unescape(decodeURIComponent(\"$emule_array[2]\")));</script></a></td><td class=smalltxt align=center>$totalper</td></tr>";
} else {
$view.="<tr class=category><td colspan=2 class=smalltxt align=center>地址不正确</td></tr>";
}
}
$total=esizecount($total);
$view.="<tr><td align=left><input type=\"checkbox\" id=\"checkall_em$codecount\" onclick=\"echeckAll('em$codecount',this.checked)\" checked=\"checked\"/> <label for=\"checkall_em$codecount\">全选</label> <input type=\"button\" value=\"下载选中的文件\" onclick=\"download('em$codecount',0,1)\"> <input type=\"button\" value=\"复制选中的链接\" onclick=\"copy('em$codecount')\"><div id=\"ed2kcopy_em$codecount\" style=\"position:absolute;height:0px;width:0px;overflow:hidden;\"></div></td><td class=smalltxt align=center id=\"size_em$codecount\">$total</div></table><br>";
$discuzcodes['codehtml'][$discuzcodes['pcodecount']] = "<div class=\"eMuleMain\">$view</div></div>";
$discuzcodes['codecount']++;
return "[\tDISCUZ_CODE_$discuzcodes[pcodecount]\t]";
}
function esizecount($filesize) {
if($filesize >= 1073741824) {
$filesize = round($filesize / 1073741824 * 100) / 100 . ' G';
} elseif($filesize >= 1048576) {
$filesize = round($filesize / 1048576 * 100) / 100 . ' M';
} elseif($filesize >= 1024) {
$filesize = round($filesize / 1024 * 100) / 100 . ' K';
} else {
$filesize = $filesize . ' bytes';
}
return $filesize;
}
?> |