'8', 2 => '10', 3 => '12', 4 => '14', 5 => '18', 6 => '24', 7 => '36' ); function ParseFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) { for($i = 0; $i < count( $tagsArray ); $i ++) $tagsArray[$i] = strtolower( $tagsArray[$i] ); for($i = 0; $i < count( $attrArray ); $i ++) $attrArray[$i] = strtolower( $attrArray[$i] ); $this->tagsArray = ( array ) $tagsArray; $this->attrArray = ( array ) $attrArray; $this->tagsMethod = $tagsMethod; $this->attrMethod = $attrMethod; $this->xssAuto = $xssAuto; } function process($source) { if( function_exists( "get_magic_quotes_gpc" ) && get_magic_quotes_gpc() ) $source = stripslashes( $source ); $source = $this->remove( $this->decode( $source ) ); if( $this->code_count ) { foreach ( $this->code_text as $key_find => $key_replace ) { $find[] = $key_find; $replace[] = $key_replace; } $source = str_replace( $find, $replace, $source ); } $this->code_count = 0; $this->code_text = array (); $source = preg_replace( "#\{include#i", "{include", $source ); $source = preg_replace( "#", "?>", $source ); $source = addslashes( $source ); return $source; } function remove($source) { $loopCounter = 0; while ( $source != $this->filterTags( $source ) ) { $source = $this->filterTags( $source ); $loopCounter ++; } return $source; } function filterTags($source) { $preTag = NULL; $postTag = $source; $tagOpen_start = strpos( $source, '<' ); while ( $tagOpen_start !== FALSE ) { $preTag .= substr( $postTag, 0, $tagOpen_start ); $postTag = substr( $postTag, $tagOpen_start ); $fromTagOpen = substr( $postTag, 1 ); $tagOpen_end = strpos( $fromTagOpen, '>' ); if( $tagOpen_end === false ) break; $tagOpen_nested = strpos( $fromTagOpen, '<' ); if( ($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end) ) { $preTag .= substr( $postTag, 0, ($tagOpen_nested + 1) ); $postTag = substr( $postTag, ($tagOpen_nested + 1) ); $tagOpen_start = strpos( $postTag, '<' ); continue; } $tagOpen_nested = (strpos( $fromTagOpen, '<' ) + $tagOpen_start + 1); $currentTag = substr( $fromTagOpen, 0, $tagOpen_end ); $tagLength = strlen( $currentTag ); if( ! $tagOpen_end ) { $preTag .= $postTag; $tagOpen_start = strpos( $postTag, '<' ); } $tagLeft = $currentTag; $attrSet = array (); $currentSpace = strpos( $tagLeft, ' ' ); if( substr( $currentTag, 0, 1 ) == "/" ) { $isCloseTag = TRUE; list ( $tagName ) = explode( ' ', $currentTag ); $tagName = substr( $tagName, 1 ); } else { $isCloseTag = FALSE; list ( $tagName ) = explode( ' ', $currentTag ); } if( (! preg_match( "/^[a-z][a-z0-9]*$/i", $tagName )) || (! $tagName) || ((in_array( strtolower( $tagName ), $this->tagBlacklist )) && ($this->xssAuto)) ) { $postTag = substr( $postTag, ($tagLength + 2) ); $tagOpen_start = strpos( $postTag, '<' ); continue; } while ( $currentSpace !== FALSE ) { $fromSpace = substr( $tagLeft, ($currentSpace + 1) ); $nextSpace = strpos( $fromSpace, ' ' ); $openQuotes = strpos( $fromSpace, '"' ); $closeQuotes = strpos( substr( $fromSpace, ($openQuotes + 1) ), '"' ) + $openQuotes + 1; if( strpos( $fromSpace, '=' ) !== FALSE ) { if( ($openQuotes !== FALSE) && (strpos( substr( $fromSpace, ($openQuotes + 1) ), '"' ) !== FALSE) ) $attr = substr( $fromSpace, 0, ($closeQuotes + 1) ); else $attr = substr( $fromSpace, 0, $nextSpace ); } else $attr = substr( $fromSpace, 0, $nextSpace ); if( ! $attr ) $attr = $fromSpace; $attrSet[] = $attr; $tagLeft = substr( $fromSpace, strlen( $attr ) ); $currentSpace = strpos( $tagLeft, ' ' ); } $tagFound = in_array( strtolower( $tagName ), $this->tagsArray ); if( (! $tagFound && $this->tagsMethod) || ($tagFound && ! $this->tagsMethod) ) { if( ! $isCloseTag ) { $attrSet = $this->filterAttr( $attrSet, strtolower( $tagName ) ); $preTag .= '<' . $tagName; for($i = 0; $i < count( $attrSet ); $i ++) $preTag .= ' ' . $attrSet[$i]; if( strpos( $fromTagOpen, "'; else $preTag .= ' />'; } else $preTag .= ''; } $postTag = substr( $postTag, ($tagLength + 2) ); $tagOpen_start = strpos( $postTag, '<' ); } $preTag .= $postTag; return $preTag; } function filterAttr($attrSet, $tagName) { global $config; $newSet = array (); for($i = 0; $i < count( $attrSet ); $i ++) { if( ! $attrSet[$i] ) continue; $attrSet[$i] = trim( $attrSet[$i] ); $exp = strpos( $attrSet[$i], '=' ); if( $exp === false ) $attrSubSet = Array ($attrSet[$i] ); else { $attrSubSet = Array (); $attrSubSet[] = substr( $attrSet[$i], 0, $exp ); $attrSubSet[] = substr( $attrSet[$i], $exp + 1 ); } $attrSubSet[1] = stripslashes( $attrSubSet[1] ); list ( $attrSubSet[0] ) = explode( ' ', $attrSubSet[0] ); $attrSubSet[0] = strtolower( $attrSubSet[0] ); if( (! preg_match( "/^[a-z]*$/i", $attrSubSet[0] )) || (($this->xssAuto) && ((in_array( $attrSubSet[0], $this->attrBlacklist )) || (substr( $attrSubSet[0], 0, 2 ) == 'on'))) ) continue; if( $attrSubSet[1] ) { $attrSubSet[1] = str_replace( '&#', '', $attrSubSet[1] ); $attrSubSet[1] = preg_replace( '/\s+/', ' ', $attrSubSet[1] ); $attrSubSet[1] = str_replace( '"', '', $attrSubSet[1] ); if( (substr( $attrSubSet[1], 0, 1 ) == "'") && (substr( $attrSubSet[1], (strlen( $attrSubSet[1] ) - 1), 1 ) == "'") ) $attrSubSet[1] = substr( $attrSubSet[1], 1, (strlen( $attrSubSet[1] ) - 2) ); } if( ((strpos( strtolower( $attrSubSet[1] ), 'expression' ) !== false) && ($attrSubSet[0] == 'style')) || (strpos( strtolower( $attrSubSet[1] ), 'javascript:' ) !== false) || (strpos( strtolower( $attrSubSet[1] ), 'behaviour:' ) !== false) || (strpos( strtolower( $attrSubSet[1] ), 'vbscript:' ) !== false) || (strpos( strtolower( $attrSubSet[1] ), 'mocha:' ) !== false) || (strpos( strtolower( $attrSubSet[1] ), 'data:' ) !== false and $attrSubSet[0] == "href") || (strpos( strtolower( $attrSubSet[1] ), 'data:' ) !== false and $attrSubSet[0] == "src") || ($attrSubSet[0] == "href" and strpos( strtolower( $attrSubSet[1] ), $config['admin_path'] ) !== false and preg_match( "/[?&%<\[\]]/", $attrSubSet[1] )) || (strpos( strtolower( $attrSubSet[1] ), 'livescript:' ) !== false) ) continue; $attrFound = in_array( $attrSubSet[0], $this->attrArray ); if( (! $attrFound && $this->attrMethod) || ($attrFound && ! $this->attrMethod) ) { if( $attrSubSet[1] ) $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"'; elseif( $attrSubSet[1] == "0" ) $newSet[] = $attrSubSet[0] . '="0"'; else $newSet[] = $attrSubSet[0] . '=""'; } } ; return $newSet; } function decode($source) { global $config; if( $this->allow_code ) $source = preg_replace_callback( "#\[code\](.+?)\[/code\]#is", array( &$this, 'code_tag'), $source ); if( $this->safe_mode AND !$this->wysiwyg ) { $source = htmlspecialchars( $source, ENT_QUOTES, $config['charset'] ); $source = str_replace( '&', '&', $source ); } else { $source = str_replace( "<>", "<>", str_replace( ">>", ">>", str_replace( "<<", "<<", $source ) ) ); $source = str_replace( "\"$smile\""; } $source = preg_replace( $find, $replace, $source ); $source = preg_replace( "#allow_php ) { $source = str_replace( "", "?>", $source ); } //if ($config['parse_links']) { // $source = preg_replace("#(^|\s|>)((http|https|ftp)://\w+[^\s\[\]\<]+)#i", '\\1[leech]\\2[/leech]', $source); //} $count_start = substr_count ($source, "[quote"); $count_end = substr_count ($source, "[/quote]"); if ($count_start AND $count_start == $count_end) { $source = preg_replace( "#\[quote\]#i", "
", $source ); $source = preg_replace( "#\[quote=(.+?)\]#i", "
{$lang['i_quote']} \\1
", $source ); $source = preg_replace( "#\[/quote\]#i", "
", $source ); } $count_start = substr_count ($source, "[screens"); $count_end = substr_count ($source, "[/screens]"); if ($count_start AND $count_start == $count_end) { $source = preg_replace( "#\[screens\]#i", "
", $source ); $source = preg_replace( "#\[/screens\]#i", "
", $source ); } $count_start = substr_count ($source, "[spoiler"); $count_end = substr_count ($source, "[/spoiler]"); if ($count_start AND $count_start == $count_end) { $source = preg_replace( "#\[spoiler\]#ie", "\$this->build_spoiler('')", $source ); $source = preg_replace( "#\[spoiler=(.+?)\]#ie", "\$this->build_spoiler('\\1')", $source ); $source = preg_replace( "#\[/spoiler\]#i", "
", $source ); } $source = preg_replace( "#\[code\](.+?)\[/code\]#is", "
\\1
", $source ); $source = preg_replace( "#\[(left|right|center)\](.+?)\[/\\1\]#is", "
\\2
", $source ); $source = preg_replace( "#\[b\](.+?)\[/b\]#is", "\\1", $source ); $source = preg_replace( "#\[i\](.+?)\[/i\]#is", "\\1", $source ); $source = preg_replace( "#\[u\](.+?)\[/u\]#is", "\\1", $source ); $source = preg_replace( "#\[s\](.+?)\[/s\]#is", "\\1", $source ); $source = preg_replace( "#\[kp=(.+?)\]#is", "", $source ); $source = preg_replace( "#\[game=(.+?)\]#is", "", $source ); if( $this->allow_url ) { $source = preg_replace( "#\[url\](\S.+?)\[/url\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\1'))", $source ); $source = preg_replace( "#\[url\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/url\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\2'))", $source ); $source = preg_replace( "#\[url\s*=\s*(\S.+?)\s*\](.*?)\[\/url\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\2'))", $source ); $source = preg_replace( "#\[leech\](\S.+?)\[/leech\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\1', 'leech' => '1'))", $source ); $source = preg_replace( "#\[leech\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/leech\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\2', 'leech' => '1'))", $source ); $source = preg_replace( "#\[leech\s*=\s*(\S.+?)\s*\](.*?)\[\/leech\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\2', 'leech' => '1'))", $source ); } else { if( stristr( $source, "[url" ) !== false ) $this->not_allowed_tags = true; if( stristr( $source, "[leech" ) !== false ) $this->not_allowed_tags = true; if( stristr( $source, "<a" ) !== false ) $this->not_allowed_tags = true; } if( $this->allow_image ) { $source = preg_replace( "#\[img\](.+?)\[/img\]#ie", "\$this->build_image('\\1')", $source ); $source = preg_replace( "#\[img=(.+?)\](.+?)\[/img\]#ie", "\$this->build_image('\\2', '\\1')", $source ); } else { if( stristr( $source, "[img" ) !== false ) $this->not_allowed_tags = true; if( stristr( $source, "<img" ) !== false ) $this->not_allowed_tags = true; } $source = preg_replace( "#\[email\s*=\s*\"\;([\.\w\-]+\@[\.\w\-]+\.[\.\w\-]+)\s*\"\;\s*\](.*?)\[\/email\]#ie", "\$this->build_email(array('html' => '\\1', 'show' => '\\2'))", $source ); $source = preg_replace( "#\[email\s*=\s*([\.\w\-]+\@[\.\w\-]+\.[\w\-]+)\s*\](.*?)\[\/email\]#ie", "\$this->build_email(array('html' => '\\1', 'show' => '\\2'))", $source ); if( ! $this->safe_mode ) { $source = preg_replace( "'\[thumb\]([^\[]*)([/\\\\])(.*?)\[/thumb\]'ie", "\$this->build_thumb('\$1\$2\$3', '\$1\$2thumbs\$2\$3')", $source ); $source = preg_replace( "'\[thumb=(.*?)\]([^\[]*)([/\\\\])(.*?)\[/thumb\]'ie", "\$this->build_thumb('\$2\$3\$4', '\$2\$3thumbs\$3\$4', '\$1')", $source ); $source = preg_replace( "#\[video\s*=\s*(\S.+?)\s*\]#ie", "\$this->build_video('\\1')", $source ); $source = preg_replace( "#\[audio\s*=\s*(\S.+?)\s*\]#ie", "\$this->build_audio('\\1')", $source ); $source = preg_replace( "#\[flash=([^\]]+)\](.+?)\[/flash\]#ies", "\$this->build_flash('\\1', '\\2')", $source ); $source = preg_replace( "#\[media=([^\]]+)\]#ies", "\$this->build_media('\\1')", $source ); $source = preg_replace( "#\[size=([^\]]+)\]#ie", "\$this->font_change(array('tag'=>'size','1'=>'\\1'))", $source ); $source = preg_replace( "#\[font=([^\]]+)\]#ie", "\$this->font_change(array('tag'=>'font','1'=>'\\1'))", $source ); $source = str_replace("[/size]", "", $source); $source = str_replace("[/font]", "", $source); } $source = preg_replace( "#\[color=([^\]]+)\]#ie", "\$this->font_change(array('tag'=>'color','1'=>'\\1'))", $source ); $source = str_replace("[/color]", "", $source); $source = str_replace( "__CODENR__", "\r", $source ); $source = str_replace( "__CODENN__", "\n", $source ); if( $this->filter_mode ) $source = $this->word_filter( $source ); return trim( $source ); } function decodeBBCodes($txt, $use_html = TRUE, $wysiwig = "no") { global $config; $find = array (); $result = array (); $txt = stripslashes( $txt ); if( $this->filter_mode ) $txt = $this->word_filter( $txt, false ); $txt = preg_replace( "#(.+?)#ie", "\$this->decode_thumb('\\1')", $txt ); $txt = preg_replace( "#(.+?)#ie", "\$this->decode_newthumb('\\1')", $txt ); $txt = preg_replace( "#(.+?)#", '[screens]', $txt ); $txt = preg_replace( "#(.+?)#", '[/screens]', $txt ); $txt = preg_replace( "#(.+?)#", '[quote]', $txt ); $txt = preg_replace( "#(.+?)#", "[quote=\\1]", $txt ); $txt = preg_replace( "#(.+?)#", '[/quote]', $txt ); $txt = preg_replace( "#(.+?)#", '[code]', $txt ); $txt = preg_replace( "#(.+?)#", '[/code]', $txt ); $txt = preg_replace( "#(.+?)#ie", "\$this->decode_leech('\\1\\2', '\\3')", $txt ); $txt = preg_replace( "#(.+?)src=\"(.+?)\"(.+?)#is", '[video=\\2]', $txt ); $txt = preg_replace( "#(.+?)#is", '[video=\\1]', $txt ); $txt = preg_replace( "#(.+?)#is", '[audio=\\1]', $txt ); $txt = preg_replace( "#(.+?)#ies", "\$this->decode_dle_img('\\1')", $txt ); $txt = preg_replace( "#(.+?)#is", '[media=\\1]', $txt ); $txt = preg_replace( "#(.+?)#is", '[media=\\1]', $txt ); $txt = preg_replace( "#(.+?)#ies", "\$this->decode_flash('\\1')", $txt ); $txt = preg_replace( "#(.+?)#is", '[spoiler]', $txt ); $txt = preg_replace( "#(.+?)#is", '[spoiler=\\1]', $txt ); $txt = str_replace( "", '[/spoiler]', $txt ); $txt = preg_replace( "#(.+?)#is", "[kp=\\1]", $txt ); $txt = preg_replace( "#(.+?)#is", "[game=\\1]", $txt ); $txt = preg_replace( "#(.+?)#is", "[i]\\1[/i]", $txt ); $txt = preg_replace( "#(.+?)#is", "[b]\\1[/b]", $txt ); $txt = preg_replace( "#(.+?)#is", "[s]\\1[/s]", $txt ); $txt = preg_replace( "#(.+?)#is", "[u]\\1[/u]", $txt ); $txt = preg_replace( "#
(.+?)
#is", "[center]\\1[/center]", $txt ); $txt = preg_replace( "##ie", "\$this->decode_img('\\1', '\\2')", $txt ); $txt = preg_replace( "#(.+?)#", "[email=\\1]\\2[/email]", $txt ); $txt = preg_replace( "#(.+?)#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt ); $txt = preg_replace( "#(.+?)#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt ); $txt = preg_replace( "#(.+?)#", "[size=\\1]", $txt ); $txt = preg_replace( "#(.+?)#", "[color=\\1]", $txt ); $txt = preg_replace( "#(.+?)#", "[font=\\1]", $txt ); $txt = str_replace( "", "[/size]", $txt ); $txt = str_replace( "", "[/color]", $txt ); $txt = str_replace( "", "[/font]", $txt ); while ( preg_match( "#
(.+?)
#is", $txt ) ) { $txt = preg_replace( "#
(.+?)
#is", "[left]\\1[/left]", $txt ); } while ( preg_match( "#
(.+?)
#is", $txt ) ) { $txt = preg_replace( "#
(.+?)
#is", "[right]\\1[/right]", $txt ); } while ( preg_match( "#
(.+?)
#is", $txt ) ) { $txt = preg_replace( "#
(.+?)
#is", "[center]\\1[/center]", $txt ); } $txt = preg_replace( "#(.+?)#is", ':\\1:', $txt ); $smilies_arr = explode( ",", $config['smilies'] ); foreach ( $smilies_arr as $smile ) { $smile = trim( $smile ); $replace[] = ":$smile:"; $find[] = "#['\"]"#is"; } $txt = preg_replace( $find, $replace, $txt ); if( ! $use_html ) { $txt = str_ireplace( "
", "\n", $txt ); $txt = str_ireplace( "
", "\n", $txt ); } if (!$this->safe_mode) $txt = htmlspecialchars( $txt, ENT_QUOTES ); $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->decode_code('\\1', '{$use_html}')", $txt ); return trim( $txt ); } function font_change($tags) { if( ! is_array( $tags ) ) {return;} $style = $tags['1']; $type = $tags['tag']; $style = str_replace( '"', '', $style ); $style = preg_replace( "/[&\(\)\.\%\[\]<>\'\"]/", "", preg_replace( "#^(.+?)(?:;|$)#", "\\1", $style ) ); if( $type == 'size' ) { $style = intval( $style ); if( $this->font_sizes[$style] ) { $real = $this->font_sizes[$style]; } else {$real = 12;} return ""; } if( $type == 'font' ) { $style = preg_replace( "/[^\d\w\#\-\_\s]/s", "", $style ); return ""; } $style = preg_replace( "/[^\d\w\#\s]/s", "", $style ); return ""; } function build_email($url = array()) { $url['html'] = $this->clear_url( $url['html'] ); $url['show'] = stripslashes( $url['show'] ); return "{$url['show']}"; } function build_flash($size, $url) { $size = explode(",", $size); $width = trim(intval($size[0])); $height = trim(intval($size[1])); if (!$width OR !$height) return "[flash=".implode(",",$size)."]".$url."[/flash]"; $url = $this->clear_url( urldecode( $url ) ); if( $url == "" ) return; $type = explode( ".", $url ); $type = strtolower( end( $type ) ); if ( strtolower($type) != "swf" ){return "[flash=".implode(",",$size)."]".$url."[/flash]";} return ""; } function decode_flash($url) { $url = explode( "||", $url ); return '[flash='.$url[0].','.$url[1].']'.$url[2].'[/flash]'; } function build_media($url) { $url = $this->clear_url( urldecode( $url ) ); $url = str_replace("&","&", $url ); if( $url == "" ) return; $source = @parse_url ( $url ); $source['host'] = str_replace( "www.", "", strtolower($source['host']) ); if ($source['host'] != "youtube.com" AND $source['host'] != "vk.com") return "[media=".$url."]"; if ($source['host'] == "youtube.com") { $a = explode('&', $source['query']); $i = 0; while ($i < count($a)) { $b = explode('=', $a[$i]); if ($b[0] == "v") $video_link = $b[1]; $i++; } return ''; } elseif ($source['host'] == "vk.com") { return ''; } } function build_url($url = array()) { global $config; $skip_it = 0; if( preg_match( "/([\.,\?]|!)$/", $url['show'], $match ) ) { $url['end'] .= $match[1]; $url['show'] = preg_replace( "/([\.,\?]|!)$/", "", $url['show'] ); } $url['html'] = $this->clear_url( $url['html'] ); $url['show'] = stripslashes( $url['show'] ); if( $this->safe_mode ) { $url['show'] = str_replace( " ", " ", $url['show'] ); if (strlen(trim($url['show'])) < 3 ) return "[url=" . $url['html'] . "]" . $url['show'] . "[/url]"; } if( strpos( $url['html'], $config['http_home_url'] ) !== false AND strpos( $url['html'], $config['admin_path'] ) !== false ) { return "[url=" . $url['html'] . "]" . $url['show'] . "[/url]"; } if( ! preg_match( "#^(http|news|https|ed2k|ftp|aim|mms)://|(magnet:?)#", $url['html'] ) AND $url['html'][0] != "/" AND $url['html'][0] != "#") { $url['html'] = 'http://' . $url['html']; } if ($url['html'] == 'http://' ) return "[url=" . $url['html'] . "]" . $url['show'] . "[/url]"; $url['show'] = str_replace( "&amp;", "&", $url['show'] ); $url['show'] = preg_replace( "/javascript:/i", "javascript: ", $url['show'] ); if( preg_match( "/^check_home( $url['html'] ) OR $url['html'][0] == "/" OR $url['html'][0] == "#"){ return "" . $show . "" . $url['end']; }else{ $url['html'] = $config['http_home_url'] . "out.php?url=" . rawurlencode( base64_encode( $url['html'] ) ); return "" . $show . "" . $url['end']; } } function code_tag($txt = "") { if( $txt == "" ) { return; } $this->code_count ++; $txt = str_replace( "&", "&", $txt ); $txt = str_replace( "<", "<", $txt ); $txt = str_replace( "'", "'", $txt ); $txt = str_replace( ">", ">", $txt ); $txt = str_replace( "<", "<", $txt ); $txt = str_replace( ">", ">", $txt ); $txt = str_replace( """, """, $txt ); $txt = str_replace( "\\\"", """, $txt ); $txt = str_replace( ":", ":", $txt ); $txt = str_replace( "[", "[", $txt ); $txt = str_replace( "]", "]", $txt ); $txt = str_replace( ")", ")", $txt ); $txt = str_replace( "(", "(", $txt ); $txt = str_replace( "\r", "", $txt ); $txt = str_replace( "\n", "
", $txt ); $txt = preg_replace( "#\s{1};#", ";", $txt ); $txt = preg_replace( "#\t#", "    ", $txt ); $txt = preg_replace( "#\s{2}#", "  ", $txt ); $p = "[code]{" . $this->code_count . "}[/code]"; $this->code_text[$p] = "[code]{$txt}[/code]"; return $p; } function decode_code($txt = "", $use_html) { // $txt = stripslashes( $txt ); $txt = str_replace( "&", "&", $txt ); if( $use_html ) { $txt = str_replace( "<br />", "\n", $txt ); } return "[code]".$txt."[/code]"; } function build_video($url) { global $config; $option = explode( "|", trim( $url ) ); $url = $this->clear_url( urldecode( $option[0] ) ); $type = explode( ".", $url ); $type = strtolower( end( $type ) ); if( preg_match( "/[?&;%<\[\]]/", $url ) ) { return "[video=" . $url . "]"; } if( $option[1] != "" ) { $option[1] = htmlspecialchars( strip_tags( stripslashes( $option[1] ) ), ENT_QUOTES ); $decode_url = $url . "|" . $option[1]; } else $decode_url = $url; if( $type == "flv" or $type == "f4v" or $type == "mp4" or $type == "mov" or $type == "m4a" or $type == "mp4v" or $type == "3gp" or $type == "3g2" ) { $url = array (); $url = implode( ", ", $url ); return "
"; } elseif( $type == "avi" or $type == "divx" ) { return "video_config['width']}\" height=\"{$this->video_config['height']}\" codebase=\"http://go.divx.com/plugin/DivXBrowserPlugin.cab\"> video_config['play']}\" /> video_config['width']}\" height=\"{$this->video_config['height']}\" mode=\"zero\" autoPlay=\"{$this->video_config['play']}\" previewImage=\"{$option[1]}\" pluginspage=\"http://go.divx.com/plugin/download/\"> "; } else { return "video_config['width']}\" height=\"{$this->video_config['height']}\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\"> video_config['play']}\" /> video_config['width']}\" height=\"{$this->video_config['height']}\" type=\"application/x-mplayer2\" autorewind=\"1\" showstatusbar=\"1\" showcontrols=\"1\" autostart=\"{$this->video_config['play']}\" allowchangedisplaysize=\"1\" volume=\"70\" stretchtofit=\"1\"> "; } } function build_audio($url) { global $config; if( $url == "" ) return; if( preg_match( "/[?&;%<\[\]]/", $url ) ) { return "[audio=" . $url . "]"; } $url = $this->clear_url( urldecode( $url ) ); $list = explode( ",", $url ); $url = urlencode(trim($list[0])); $list = implode( ",", $list ); $id_player = md5( microtime() ); $color = array (); return ""; } function build_image($url = "", $align = "") { global $config; $url = trim( $url ); $url = urldecode( $url ); $option = explode( "|", trim( $align ) ); $align = $option[0]; if( $align != "left" and $align != "right" ) $align = ''; if( preg_match( "/[?&;%<\[\]]/", $url ) ) { if( $align != "" ) return "[img=" . $align . "]" . $url . "[/img]"; else return "[img]" . $url . "[/img]"; } $url = $this->clear_url( urldecode( $url ) ); $info = $url; $info = $info."|".$align; if( $url == "" ) return; if( $option[1] != "" ) { $alt = htmlspecialchars( strip_tags( stripslashes( $option[1] ) ), ENT_QUOTES ); $info = $info."|".$alt; $caption = "" . $alt . ""; $alt = "alt=\"" . $alt . "\" title=\"" . $alt . "\" "; } else { $alt = htmlspecialchars( strip_tags( stripslashes( $_POST['title'] ) ), ENT_QUOTES ); $caption = ""; $alt = "alt=\"" . $alt . "\" title=\"" . $alt . "\" "; } if( intval( $config['tag_img_width'] ) ) { if (clean_url( $config['http_home_url'] ) != clean_url ( $url ) ) { $img_info = @getimagesize( $url ); if( $img_info[0] > $config['tag_img_width'] ) { $out_heigh = ($img_info[1] / 100) * ($config['tag_img_width'] / ($img_info[0] / 100)); $out_heigh = floor( $out_heigh ); if( $align == '' ) return "{$caption}"; else return "{$caption}"; } } } if( $align == '' ) return ""; else return ""; } function decode_dle_img($txt) { $txt = stripslashes( $txt ); $txt = explode("|", $txt ); $url = $txt[0]; $align = $txt[1]; $alt = $txt[2]; $extra = ""; if( ! $align and ! $alt ) return "[img]" . $url . "[/img]"; if( $align ) $extra = $align; if( $alt ) { $alt = str_replace("'", "'", $alt); $alt = str_replace(""", '"', $alt); $alt = str_replace("&", '&', $alt); $extra .= "|" . $alt; } return "[img=" . $extra . "]" . $url . "[/img]"; } function build_thumb($gurl = "", $url = "", $align = "") { $url = trim( $url ); $gurl = trim( $gurl ); $option = explode( "|", trim( $align ) ); $align = $option[0]; if( $align != "left" and $align != "right" ) $align = ''; if( preg_match( "/[?&;%<\[\]]/", $gurl ) ) { if( $align != "" ) return "[thumb=" . $align . "]" . $gurl . "[/thumb]"; else return "[thumb]" . $gurl . "[/thumb]"; } $url = $this->clear_url( urldecode( $url ) ); $gurl = $this->clear_url( urldecode( $gurl ) ); if( $gurl == "" or $url == "" ) return; if( $option[1] != "" ) { $alt = htmlspecialchars( strip_tags( stripslashes( $option[1] ) ), ENT_QUOTES ); $caption = "" . $alt . ""; $alt = "alt=\"" . $alt . "\" title=\"" . $alt . "\" "; } else { $alt = htmlspecialchars( strip_tags( stripslashes( $_POST['title'] ) ), ENT_QUOTES ); $alt = "alt='" . $alt . "' title='" . $alt . "' "; $caption = ""; } if( $align == '' ) return "{$caption}"; else return "{$caption}"; } function build_spoiler($title = "") { global $lang; $title = trim( $title ); $title = stripslashes( $title ); $title = str_replace( "&amp;", "&", $title ); $title = preg_replace( "/javascript:/i", "javascript: ", $title ); $id_spoiler = "sp".md5( microtime() ); if( ! $title ) {return "
\"\" " . $lang['spoiler_title'] . "
"; } else {return "
\"\" " . $title . "
";} } function clear_url($url) { $url = strip_tags( trim( stripslashes( $url ) ) ); $url = str_replace( '\"', '"', $url ); $url = str_replace( "'", "", $url ); $url = str_replace( '"', "", $url ); if( ! $this->safe_mode or $this->wysiwyg ) {$url = htmlspecialchars( $url, ENT_QUOTES );} $url = str_ireplace( "document.cookie", "document.cookie", $url ); $url = str_replace( " ", "%20", $url ); $url = str_replace( "<", "<", $url ); $url = str_replace( ">", ">", $url ); $url = preg_replace( "/javascript:/i", "javascript:", $url ); $url = preg_replace( "/data:/i", "data:", $url ); return $url; } function decode_leech($url = "", $show = "") { $show = stripslashes( $show ); if( $this->leech_mode ) return "[url=" . $url . "]" . $show . "[/url]"; $url = explode( "url=", $url ); $url = end( $url ); $url = rawurldecode( $url ); $url = base64_decode( $url ); $url = str_replace("&","&", $url ); return "[url=" . $url . "]" . $show . "[/url]"; } function decode_url($url = "", $show = "") { $show = stripslashes( $show ); $url = str_replace("&","&", $url ); return "[url=" . $url . "]" . $show . "[/url]"; } function decode_thumb($txt) { $align = false; $alt = false; $extra = ""; $txt = stripslashes( $txt ); $url = str_replace( "safe_mode ) $allow_find = false; if ( $word_arr[5] == 2 AND !$this->safe_mode ) $allow_find = false; if ( $allow_find ) { if( $word_arr[3] ) { $find_text = "#(^|\b|\s|\
)" . preg_quote( $word_arr[1], "#" ) . "(\b|!|\?|\.|,|$)#".$register; if( $word_arr[2] == "" ) $replace_text = "\\1"; else $replace_text = "\\1" . $word_arr[2] . ""; } else { $find_text = "#(" . preg_quote( $word_arr[1], "#" ) . ")#".$register; if( $word_arr[2] == "" ) $replace_text = ""; else $replace_text = "" . $word_arr[2] . ""; } if ( $word_arr[6] ) { if ( preg_match($find_text, $source) ) { $this->not_allowed_text = true; return $source; } } else { $find[] = $find_text; $replace[] = $replace_text; } } } if( !count( $find ) ) return $source; $source = preg_split( '((>)|(<))', $source, - 1, PREG_SPLIT_DELIM_CAPTURE ); $count = count( $source ); for($i = 0; $i < $count; $i ++) { if( $source[$i] == "<" or $source[$i] == "[" ) { $i ++; continue; } if( $source[$i] != "" ) $source[$i] = preg_replace( $find, $replace, $source[$i] ); } $source = join( "", $source ); } else { $source = preg_replace( "#(.+?)#", "\\1", $source ); } return $source; } } ?>