','>',str_replace('
',\"\n\",'$1')))).'[/nohtml]'",$text); $text = " ".$text." "; $text = str_replace("<"," <",$text); $text = str_replace(">","> ",$text); $text = preg_replace("/\n/","",$text); $text = preg_replace("/\r/","",$text); // $text = preg_replace("/(\s+)([^:\t \n\[\"']+?\@[^\t \n\[\"']+?)([\s\"']+)/is","$1 $2 $3",$text); $text = preg_replace("/(\s+)(http:\/\/[^\s\"'\[,!]+)([\s\"'\[,!]+)/is","$1 $2 $3",$text); // $text = preg_replace("/(\s+)(www\.[^\s\"']+?)([\s\"']+)/is","$1 $2 $3",$text); // $text = preg_replace("/(\s+)([^\s\"'\[]+?\.ru)([\s\"'\[]+)/is","$1 $2 $3",$text); // $text = preg_replace("/(\s+)([^\s\"'\[]+?\.com)([\s\"'\[]+)/is","$1 $2 $3",$text); // $text = preg_replace("/(\s+)([^\s\"'\[]+?\.net)([\s\"'\[]+)/is","$1 $2 $3",$text); // $text = preg_replace("/(\s+)([^\s\"'\[]+?\.org)([\s\"'\[]+)/is","$1 $2 $3",$text); $text = str_replace(" <","<",$text); $text = str_replace("> ",">",$text); $text = preg_replace('/\[nohtml\](.*?)\[\/nohtml\]/ise',"strip_tags('$1')",$text); } function check_hidden($posts,$text) { if (!$GLOBALS['inuserposts'] && $GLOBALS['inuserid']>3) { global $link; $sql = "SELECT COUNT(*) FROM ".$GLOBALS['DBprefix']."Post WHERE p_uid=".$GLOBALS['inuserid']." AND p__premoderate=0"; $res =&db_query($sql,$link); list($count)=db_fetch_row($res); db_free_result($res); $GLOBALS['inuserposts']=$count; } if ($posts<=$GLOBALS['inuserposts']) return $text; else return "
".MSG_p_posthide." ".format_word($posts,MSG_p1,MSG_p2,MSG_p3).".
"; } function check_level($level,$text) { if ($level<=$GLOBALS['inuserlevel']) return $text; else return "
".MSG_p_levelhide.".
"; } function check_url($url) { $url=strtolower($url); $res=1; if (strpos($url,"script:")!==false) $res=0; if (strpos($url,"/admin")===0) $res=0; $forumurl=strtolower($GLOBALS['opt_url']); $forumurl=str_replace("www.","",$forumurl); $forumurl=preg_replace("|/$|s","",$forumurl); $url=str_replace("www.","",$url); if (strpos($url,$forumurl."/admin")!==false) $res=0; if (strpos($url,"a=do_logout")!==false) $res=0; if (strpos($url,"\"")!==false) $res=0; return $res; } function check_img($imgtext) { preg_match("/src=\"([^\"]+?)\"[\s>]/is",$imgtext,$matches); if (!$matches[1]) preg_match("/src='([^']+?)'[\s>]/is",$imgtext,$matches); if (!$matches[1]) preg_match("/src=(\S+?)/is",$imgtext,$matches); $tmptext=str_replace($matches[1],"",$imgtext); if (preg_match("/\Won\w+?=/is",$tmptext) || preg_match("/\Wurl\(/is",$tmptext)) { $GLOBALS['hackattempt']++; return "
HACK ATTEMPT: ".htmlspecialchars($imgtext)."
"; } // if (strpos($matches[1],$GLOBALS['opt_url']."/smiles")===false) $imgtext=preg_replace("|<(img .*?)>|is","<$1 onLoad=\"ch_img(this)\">",$imgtext); if (check_url($matches[1])) return $imgtext; else { $GLOBALS['hackattempt']++; return "
HACK ATTEMPT: ".$matches[1]."
"; } } function check_link($linktext) { preg_match("/href=\"([^\"]+?)\"[\s>]/is",$linktext,$matches); if (!$matches[1]) preg_match("/href='([^']+?)'[\s>]/is",$linktext,$matches); if (!$matches[1]) preg_match("/href=(\S+?)[\s>]/is",$linktext,$matches); $tmptext=str_replace($matches[1],"",$linktext); if (preg_match("/\Won\w+?=/is",$tmptext) || preg_match("/\Wurl\(/is",$tmptext)) { $GLOBALS['hackattempt']++; return "
HACK ATTEMPT: ".htmlspecialchars($linktext)."
"; } if (check_url($matches[1])) return $linktext; else { $GLOBALS['hackattempt']++; return "
HACK ATTEMPT: ".substr($matches[1],0,50)."
"; } } function process_code($text,$html) { if ($html) $text=str_replace("
","\n",$text); $text=str_replace(" ","  ",$text); $text=str_replace('\\"','"',$text); $text=str_replace("\t","  ",$text); if ($html) { $text=str_replace("<","<",$text); $text=str_replace(">",">",$text); } $text="$text"; $text=str_replace("[","[",$text); $text=str_replace("]","]",$text); if (is_array($GLOBALS['smiles'])) foreach ($GLOBALS['smiles'] as $sm_code=>$sm_file) if ($GLOBALS['smileshow'][$sm_code]) { $text=str_replace("\"$sm_code\"",$sm_code,$text); } $text=nl2br($text); return $text; } function process_php($text,$html) { $text=str_replace("
","\n",$text); $text=str_replace('\\"','"',$text); $text=str_replace('<?','',$text); if (strpos($text,''; $text = highlight_string($text,true); $text=str_replace("[","[",$text); $text=str_replace("]","]",$text); if (!$html) { $text=str_replace('&','&',$text); } return $text; } function table_parse($text,$params) { preg_match_all('|(\w+)=(["].*?["])|is',$params,$matches); $count=count($matches[1]); $width='"90%"'; $align='"center"'; for ($i=0; $i<$count; $i++) { if ($matches[1][$i]=='width') $width=$matches[2][$i]; if ($matches[1][$i]=='align') $align=$matches[2][$i]; } $text ="".$text; $text = str_replace('[/tr]','',$text); $text = str_replace('[/td]','',$text); $text = str_replace("[tr]","",$text); $text = str_replace("[td]","
",$text); $text = preg_replace("/\[td colspan=(\d+)\]/is","",$text); $text.="
"; return $text; } function boardcode(&$text,$html=0,$tid,$pid) { if (strpos($text,"[")!==false) { $cutid=&getvar('cutid'); if ($pid==$cutid || $tid==0 || $GLOBALS['action']=="do_print") { $text=preg_replace("/\[cut\](.*?)\[\/cut\]/is","$1",$text); $text=preg_replace("/\[cut=\".*?\"\](.*?)\[\/cut\]/is","$1",$text); } else { $tdata['t_id']=$tid; $tdata['t_link']=$GLOBALS['intopic']['t_link']; $tdata['f_id']=$GLOBALS['forum']; $tdata['f_link']=$GLOBALS['inforum']['f_link']; $text=preg_replace("/\[cut\](.*?)\[\/cut\]/ise",'\''.MSG_p_uncut.'\'',$text); $text=preg_replace("/\[cut=\"(.*?)\"\](.*?)\[\/cut\]/ise",'\'$1\'',$text); // 'return \'",$text); $text = str_replace("[br]","
",$text); $text = str_replace('[quote]','
[q]
',$text); $text = str_replace('[/quote]','
[/q]
',$text); $text = str_replace('[q]','
[q]
',$text); $text = str_replace('[/q]','
[/q]
',$text); $text = preg_replace("/\[quote=(.+?)\]/is","
$1 ".MSG_written.":
[q]
",$text);//.short_date_out($2)." $text = preg_replace("/\[q=(.+?)\]/is","
$1 ".MSG_written.":
[q]
",$text); $text = preg_replace("/\[url\](\w+?:\/\/[^\"]+?)\[\/url\]/is","
$1",$text); $text = preg_replace("/\[url\]([^\"]+?)\[\/url\]/is","$1",$text); $text = preg_replace("/\[url=(\w+?:\/\/[^\"]+?)\](.+?)\[\/url\]/is","$2",$text); $text = preg_replace("/\[url=([^\"]+?)\]([^\"]+?)\[\/url\]/is","$2",$text); $text = preg_replace("/\[url2=([^\"]+?)\](.+?)\[\/url2\]/is","$2",$text); $text = preg_replace("/\[email\](\S+?\@\S+?)\[\/email\]/is","$1",$text); $text = preg_replace("/\[email=(\S+?\@\S+?)\](.+?)\[\/email\]/is","$2",$text); $text = str_replace("[b]","",$text); $text = str_replace("[/b]","",$text); $text = str_replace("[i]","",$text); $text = str_replace("[/i]","",$text); $text = str_replace("[u]","",$text); $text = str_replace("[/u]","",$text); $text = str_replace("[s]","",$text); $text = str_replace("[/s]","",$text); $text = preg_replace("/\[font=([\w ]+?)\]/is","",$text); $text = preg_replace("/\[color=([#\w\d]+?)\]/is","",$text); $text = preg_replace("/\[size=(\d+?)\]/is","",$text); $text = str_replace("[/font]","",$text); $text = str_replace("[/color]","",$text); $text = str_replace("[/size]","",$text); $text = str_replace("[list]","",$text); $text = preg_replace("/\[video=([\w\d\/?&:.]+?)\]/is","",$text); if (!$GLOBALS['opt_imgtag']) { $text = preg_replace("/\[img\](.+?)\[\/img\]/is","\"\"",$text); $text = preg_replace("/\[img=(.+?)\]/is","\"\"",$text); } else { $text = preg_replace("/\[img\](\S+?)\[\/img\]/is","\"".MSG_image."\"",$text); $text = preg_replace("/\[img=(\S+?)\]/is","\"".MSG_image."\"",$text); } $text = preg_replace("/\[off\](.*?)\[\/off\]/is","
".MSG_offtopic.": $1
",$text); $text = preg_replace("/\[center\](.*?)\[\/center\]/is","
$1
",$text); $text = preg_replace("/\[right\](.*)\[\/right\]/is","
$1
",$text); $text = preg_replace("/\[translit\](.*)\[\/translit\]/esi","untransliterate(\"$1\")",$text); $text = preg_replace("/\[hide=(\d+?)\](.*?)\[\/hide\]/esi","check_hidden($1,\"$2\")",$text); $text = preg_replace("/\[level=(\d+?)\](.*?)\[\/level\]/esi","check_level($1,\"$2\")",$text); if (!$GLOBALS['boardcodes'] && file_exists($GLOBALS['opt_dir'].'/config/bcodes.txt')) { $GLOBALS['boardcodes']=file($GLOBALS['opt_dir'].'/config/bcodes.txt'); } if (is_array($GLOBALS['boardcodes'])) foreach ($GLOBALS['boardcodes'] as $curcode) { list($str1,$str2)=explode(' ::: ',trim($curcode)); $str1=str_replace('[','\\[',str_replace(']','\\]',str_replace('/','\\/',addslashes($str1)))); if ($str1) $text=preg_replace("/$str1/is",$str2,$text); } $text = preg_replace("/()/ise","check_img(\"$1\")",$text); if (!$html) $text = preg_replace("/()/ise","check_link(\"$1\")",$text); $text = preg_replace("/()/ise","\"
HACK ATTEMPT: \".htmlspecialchars(\"$1\").\"
\"",$text); } } ?>