Version 2.1.7
This commit is contained in:
1 parent
0eecc172d9
commit
f73f8bff6d
941 files changed
+215301
-103093
No files matched your search
@@ -0,0 +1,712 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-03-06 14:58:13 +0000 (Mon, 06 Mar 2006) $
|
||||
| > $Revision: 161 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > BB Code NEWER Module
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 9th March 2005 11:31
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* BBCode Parsing: Core class
|
||||
*
|
||||
* This child class contains all methods
|
||||
* specific to the new parsing methods
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage BBCodeParser
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
* @since 2.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* BBCode Parsing: Core class
|
||||
*
|
||||
* This child class contains all methods
|
||||
* specific to the new parsing methods
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage BBCodeParser
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
* @since 2.1.0
|
||||
*/
|
||||
class class_bbcode extends class_bbcode_core
|
||||
{
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTOR
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function class_bbcode( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Manage the raw text before inserting into the DB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Manage the raw text before inserting into the DB
|
||||
*
|
||||
* @param string Raw text
|
||||
* @return string Converted text
|
||||
*/
|
||||
function pre_db_parse( $txt="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Reset
|
||||
//-----------------------------------------
|
||||
|
||||
$this->quote_open = 0;
|
||||
$this->quote_closed = 0;
|
||||
$this->quote_error = 0;
|
||||
$this->error = '';
|
||||
$this->image_count = 0;
|
||||
$this->emoticon_count = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove session id's from any post
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\?|&|;|&)s=([0-9a-zA-Z]){32}(&|;|&|$)?#e", "\$this->regex_bash_session('\\1', '\\3')", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// convert <br> to \n
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->parse_nl2br )
|
||||
{
|
||||
$txt = str_replace( "\n", "", $txt );
|
||||
}
|
||||
|
||||
$txt = preg_replace( "/<br>|<br \/>/", "\n", $txt );
|
||||
|
||||
# XSS Clean
|
||||
/*if( $this->strip_hex_entity )
|
||||
{
|
||||
while( preg_match( "/[&|&\;]#x(\w+?);/i", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "/[&|&\;]#x(\w+?);/ies" , "\$this->regex_bash_hex( '\\1' )" , $txt );
|
||||
}
|
||||
$txt = preg_replace( "#&(?!\;)#", "", $txt );
|
||||
}*/
|
||||
|
||||
$txt = preg_replace( "#javascript\:#is" , "java script:", $txt );
|
||||
$txt = preg_replace( "#vb(.+?)?script\:#is", "vb script:" , $txt );
|
||||
$txt = str_replace( "`" , "`" , $txt );
|
||||
$txt = preg_replace( "#moz\-binding:#is" , "moz binding:", $txt );
|
||||
$txt = str_replace( "<script" , "<script" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we parsing bbcode?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_bbcode )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do [CODE] tag
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag( '\\1' )", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do [QUOTE(name,date)] tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\[quote(.+?)?\].*\[/quote\])#ies" , "\$this->regex_parse_quotes('\\1')" , $txt );
|
||||
|
||||
// Quote changes \n to br
|
||||
$txt = preg_replace( "/<br>|<br \/>/", "\n", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Auto parse URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(^|\s|>)((http|https|news|ftp)://\w+[^\s\[\]\<]+)#ie" , "\$this->regex_build_url(array('html' => '\\2', 'show' => '\\2', 'st' => '\\1'))", $txt );
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// If we are not parsing a siggie, lets have a bash
|
||||
// at the [PHP] [SQL] and [HTML] tags.
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
$txt = preg_replace( "#\[sql\](.+?)\[/sql\]#ies" , "\$this->regex_sql_tag('\\1')" , $txt );
|
||||
$txt = preg_replace( "#\[html\](.+?)\[/html\]#ies" , "\$this->regex_html_tag('\\1')" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// left, right, center
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[(left|right|center)\](.+?)\[/\\1\]#is" , "<div align=\"\\1\">\\2</div>", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Indent => Block quote
|
||||
//-----------------------------------------
|
||||
|
||||
while( preg_match( "#\[indent\](.+?)\[/indent\]#is" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[indent\](.+?)\[/indent\]#is" , "<blockquote>\\1</blockquote>", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// [LIST] [*] [/LIST]
|
||||
//-----------------------------------------
|
||||
|
||||
while( preg_match( "#\n?\[list\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\1')" , $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\2','\\1')" , $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do [IMG] [FLASH] tags
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['allow_images'] )
|
||||
{
|
||||
$txt = preg_replace( "#\[img\](.+?)\[/img\]#ie" , "\$this->regex_check_image('\\1')" , $txt );
|
||||
$txt = preg_replace( "#(\[flash=)(\S+?)(\,)(\S+?)(\])(\S+?)(\[\/flash\])#ie", "\$this->regex_check_flash('\\2','\\4','\\6')", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Start off with the easy stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $txt );
|
||||
$txt = preg_replace( "#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $txt );
|
||||
$txt = preg_replace( "#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $txt );
|
||||
$txt = preg_replace( "#\[s\](.+?)\[/s\]#is", "<strike>\\1</strike>", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// (c) (r) and (tm)
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\(c\)#i" , "©" , $txt );
|
||||
$txt = preg_replace( "#\(tm\)#i" , "™" , $txt );
|
||||
$txt = preg_replace( "#\(r\)#i" , "®" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// [email]matt@index.com[/email]
|
||||
// [email=matt@index.com]Email me[/email]
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[email\](\S+?)\[/email\]#i" , "<a href=\"mailto:\\1\">\\1</a>", $txt );
|
||||
$txt = preg_replace( "#\[email\s*=\s*\"\;([\.\w\-]+\@[\.\w\-]+\.[\.\w\-]+)\s*\"\;\s*\](.*?)\[\/email\]#i" , "<a href=\"mailto:\\1\">\\2</a>", $txt );
|
||||
$txt = preg_replace( "#\[email\s*=\s*([\.\w\-]+\@[\.\w\-]+\.[\w\-]+)\s*\](.*?)\[\/email\]#i" , "<a href=\"mailto:\\1\">\\2</a>", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// [url]http://www.index.com[/url]
|
||||
// [url=http://www.index.com]ibforums![/url]
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[url\](\S+?)\[/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\1'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// font size, colour and font style
|
||||
// [font=courier]Text here[/font]
|
||||
// [size=6]Text here[/size]
|
||||
// [color=red]Text here[/color]
|
||||
// [background=color]Text here[/background]
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#\[background=([^\]]+)\](.+?)\[/background\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[background=([^\]]+)\](.+?)\[/background\]#ies", "\$this->regex_font_attr(array('s'=>'background','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#\[size=([^\]]+)\](.+?)\[/size\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[size=([^\]]+)\](.+?)\[/size\]#ies" , "\$this->regex_font_attr(array('s'=>'size','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#\[font=([^\]]+)\](.+?)\[/font\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[font=([^\]]+)\](.+?)\[/font\]#ies" , "\$this->regex_font_attr(array('s'=>'font','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\[color=([^\]]+)\](.+?)\[/color\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[color=([^\]]+)\](.+?)\[/color\]#ies" , "\$this->regex_font_attr(array('s'=>'col' ,'1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Swap \n back to <br>
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "/\n/", "<br />", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Unicode?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->allow_unicode )
|
||||
{
|
||||
$txt = preg_replace("/&#([0-9]+);/s", "&#\\1;", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse smilies (disallow smilies in siggies, or we'll have to query the DB for each post
|
||||
// and each signature when viewing a topic, not something that we really want to do.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_smilies )
|
||||
{
|
||||
$txt = ' '.$txt.' ';
|
||||
|
||||
usort( $this->ipsclass->cache['emoticons'] , array( 'class_bbcode_core', 'smilie_length_sort' ) );
|
||||
|
||||
if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $a_id => $row)
|
||||
{
|
||||
if ( $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$code = $row['typed'];
|
||||
$image = $row['image'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Make safe for regex
|
||||
//-----------------------------------------
|
||||
$code = preg_quote($code, "/");
|
||||
|
||||
$txt = preg_replace( "!(?<=[^\w&;/\"])$code(?=.\W|\"|\W.|\W$)!ei", "\$this->convert_emoticon('$code', '$image')", $txt );
|
||||
}
|
||||
}
|
||||
|
||||
$txt = trim($txt);
|
||||
|
||||
if ( $this->ipsclass->vars['max_emos'] )
|
||||
{
|
||||
if ($this->emoticon_count > $this->ipsclass->vars['max_emos'])
|
||||
{
|
||||
$this->error = 'too_many_emoticons';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Badwords
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = $this->bad_words($txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check BBcode
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = $this->bbcode_check($txt);
|
||||
|
||||
return $txt;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// This function processes the DB post before printing as output
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* This function processes the DB post before printing as output
|
||||
*
|
||||
* @param string Raw text
|
||||
* @return string Converted text
|
||||
*/
|
||||
function pre_display_parse($t="")
|
||||
{
|
||||
if ( $this->parse_html )
|
||||
{
|
||||
$t = $this->post_db_parse_html( $t );
|
||||
}
|
||||
else
|
||||
{
|
||||
//$t = $this->my_strip_tags( $t );
|
||||
}
|
||||
|
||||
if ( $this->parse_wordwrap > 0 )
|
||||
{
|
||||
$t = $this->my_wordwrap( $t, $this->parse_wordwrap );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up <br /> in URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#(<a href=[\"'])(.+?)([\"'])#ise", "\$this->_clean_long_url('\\1', '\\2', '\\3')", $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Custom BB code
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( $t, '[/' ) )
|
||||
{
|
||||
$t = $this->post_db_parse_bbcode($t);
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// This function processes the text before showing for editing, etc
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* This function processes the text before showing for editing, etc
|
||||
*
|
||||
* @param string Raw text
|
||||
* @return string Converted text
|
||||
*/
|
||||
function pre_edit_parse($txt="")
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Clean up BR tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = str_replace( "<br>" , "\n", $txt );
|
||||
$txt = str_replace( "<br />", "\n", $txt );
|
||||
|
||||
# Make EMO_DIR safe so the ^> regex works
|
||||
$txt = str_replace( "<#EMO_DIR#>", "<#EMO_DIR>", $txt );
|
||||
|
||||
# New emo
|
||||
$txt = preg_replace( "#<([^>]+?)emoid=\"(.+?)\"([^>]+?)".">#is", "\\2", $txt );
|
||||
|
||||
# And convert it back again...
|
||||
$txt = str_replace( "<#EMO_DIR>", "<#EMO_DIR#>", $txt );
|
||||
|
||||
# Legacy
|
||||
$txt = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Clean up nbsp
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = str_replace( ' ', "\t", $txt );
|
||||
$txt = str_replace( ' ' , " ", $txt );
|
||||
|
||||
if ( $this->parse_bbcode )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// SQL
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#eis", "\$this->unconvert_sql(\"\\2\")", $txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// HTML
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#ise", "\$this->unconvert_htm(\"\\2\")", $txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// Images / Flash
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e", "\$this->unconvert_flash('\\1')", $txt );
|
||||
$txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Email, URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "\[email=\\1\]\\2\[/email\]" , $txt );
|
||||
$txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|news://)?(\S+?)['\"].+?".">(.+?)</a>#" , "\[url=\\1\\2\]\\3\[/url\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Quote
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , '[quote]' , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteBegin-{1,2}([^>]+?)\+([^>]+?)-->(.+?)<!--QuoteEBegin-->#", "[quote=\\1,\\2]" , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteBegin-{1,2}([^>]+?)\+-->(.+?)<!--QuoteEBegin-->#" , "[quote=\\1]" , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , '[/quote]' , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// New quote
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--quoteo([^>]+?)?-->(.+?)<!--quotec-->#sie", "\$this->_parse_new_quote('\\1', '\\2' )" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// left, right, center
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<div align=\"(left|right|center)\">(.+?)</div>#is" , "[\\1]\\2[/\\1]", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Ident => Block quote
|
||||
//-----------------------------------------
|
||||
|
||||
while( preg_match( "#<blockquote>(.+?)</blockquote>#is" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<blockquote>(.+?)</blockquote>#is" , "[indent]\\1[/indent]", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// CODE
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", '[code]' , $txt );
|
||||
$txt = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '[/code]', $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Easy peasy
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<i>(.+?)</i>#is" , "\[i\]\\1\[/i\]" , $txt );
|
||||
$txt = preg_replace( "#<b>(.+?)</b>#is" , "\[b\]\\1\[/b\]" , $txt );
|
||||
$txt = preg_replace( "#<strike>(.+?)</strike>#is" , "\[s\]\\1\[/s\]" , $txt );
|
||||
$txt = preg_replace( "#<u>(.+?)</u>#is" , "\[u\]\\1\[/u\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// List headache
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\n){0,}<ul>#" , "\\1\[list\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<ol type='(a|A|i|I|1)'>#" , "\\1\[list=\\2\]\n" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<li>#" , "\n\[*\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ul>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ol>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Opening style attributes
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--sizeo:(.+?)-->(.+?)<!--/sizeo-->#" , "[size=\\1]" , $txt );
|
||||
$txt = preg_replace( "#<!--coloro:(.+?)-->(.+?)<!--/coloro-->#" , "[color=\\1]", $txt );
|
||||
$txt = preg_replace( "#<!--fonto:(.+?)-->(.+?)<!--/fonto-->#" , "[font=\\1]" , $txt );
|
||||
$txt = preg_replace( "#<!--backgroundo:(.+?)-->(.+?)<!--/backgroundo-->#" , "[background=\\1]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Closing style attributes
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--sizec-->(.+?)<!--/sizec-->#" , "[/size]" , $txt );
|
||||
$txt = preg_replace( "#<!--colorc-->(.+?)<!--/colorc-->#" , "[/color]", $txt );
|
||||
$txt = preg_replace( "#<!--fontc-->(.+?)<!--/fontc-->#" , "[/font]" , $txt );
|
||||
$txt = preg_replace( "#<!--backgroundc-->(.+?)<!--/backgroundc-->#", "[/background]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// LEGACY SPAN TAGS
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#ise" , "\$this->unconvert_size('\\1', '\\2')", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is" , "\[color=\\1\]\\2\[/color\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", "\[font=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", "\[background=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
# Legacy <strike>
|
||||
$txt = preg_replace( "#<s>(.+?)</s>#is" , "\[s\]\\1\[/s\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Tidy up the end quote stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\[/QUOTE\])\s*?<br />\s*#si", "\\1\n", $txt );
|
||||
$txt = preg_replace( "#(\[/QUOTE\])\s*?<br>\s*#si" , "\\1\n", $txt );
|
||||
|
||||
$txt = preg_replace( "#<!--EDIT\|.+?\|.+?-->#" , "" , $txt );
|
||||
$txt = str_replace( "</li>", "", $txt );
|
||||
|
||||
$txt = str_replace( "™", "(tm)", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse html
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_html )
|
||||
{
|
||||
$txt = str_replace( "'", "'", $txt);
|
||||
}
|
||||
|
||||
return trim(stripslashes($txt));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// OVERWRITE DEFAULT: convert_emoticon:
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Convert emoticons: New method
|
||||
*
|
||||
* @param string Emo code :)
|
||||
* @param string Emo Image URL
|
||||
* @return string Converted text
|
||||
*/
|
||||
function convert_emoticon($code="", $image="")
|
||||
{
|
||||
if ( ! $code or ! $image )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove slashes added by preg_quote
|
||||
//-----------------------------------------
|
||||
|
||||
$code = stripslashes($code);
|
||||
|
||||
$this->emoticon_count++;
|
||||
|
||||
return "<img src=\"{$this->ipsclass->vars['EMOTICONS_URL']}/$image\" style=\"vertical-align:middle\" emoid=\"".trim($code)."\" border=\"0\" alt=\"$image\" />";
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// OVERWRITE DEFAULT: regex_font_attr:
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Convert FONT / SIZE / COLOR tags: New method
|
||||
*
|
||||
* @param array Input vars
|
||||
* @return string Converted text
|
||||
*/
|
||||
function regex_font_attr( $IN )
|
||||
{
|
||||
if ( ! is_array($IN) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT (It is!)
|
||||
//-----------------------------------------
|
||||
|
||||
$style = $IN['1'];
|
||||
$text = stripslashes($IN['2']);
|
||||
$type = $IN['s'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove "
|
||||
//-----------------------------------------
|
||||
|
||||
$style = str_replace( '"', '', $style );
|
||||
|
||||
//-----------------------------------------
|
||||
// Make safe
|
||||
//-----------------------------------------
|
||||
|
||||
$style = preg_replace( "/[&\(\)\.\%\[\]<>\'\"]/", "", preg_replace( "#^(.+?)(?:;|$)#", "\\1", $style ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Size
|
||||
//-----------------------------------------
|
||||
|
||||
if ($type == 'size')
|
||||
{
|
||||
$style = intval($style);
|
||||
$real = $this->convert_bbsize_to_realsize( $style );
|
||||
|
||||
return "<!--sizeo:{$style}--><span style=\"font-size:".$real."pt;line-height:100%\"><!--/sizeo-->".$text."<!--sizec--></span><!--/sizec-->";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// BACKGROUND
|
||||
//-----------------------------------------
|
||||
|
||||
else if ($type == 'background')
|
||||
{
|
||||
$style = preg_replace( "/[^\d\w\#\s]/s", "", $style );
|
||||
return "<!--backgroundo:{$style}--><span style=\"background-color:".$style."\"><!--/backgroundo-->".$text."<!--backgroundc--></span><!--/backgroundc-->";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// COLOR
|
||||
//-----------------------------------------
|
||||
|
||||
else if ($type == 'col')
|
||||
{
|
||||
$style = preg_replace( "/[^\d\w\#\s]/s", "", $style );
|
||||
return "<!--coloro:{$style}--><span style=\"color:".$style."\"><!--/coloro-->".$text."<!--colorc--></span><!--/colorc-->";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// FONT
|
||||
//-----------------------------------------
|
||||
|
||||
else if ($type == 'font')
|
||||
{
|
||||
$style = preg_replace( "/[^\d\w\#\-\_\s]/s", "", $style );
|
||||
return "<!--fonto:{$style}--><span style=\"font-family:".$style."\"><!--/fonto-->".$text."<!--fontc--></span><!--/fontc-->";
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Clean up URL
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Clean up long URLs
|
||||
*
|
||||
* @param string BEFORE URL
|
||||
* @param string URL
|
||||
* @param string SANS URL
|
||||
* @return string Converted text
|
||||
*/
|
||||
function _clean_long_url( $before, $url, $after )
|
||||
{
|
||||
$before = stripslashes( $before );
|
||||
$url = stripslashes( $url );
|
||||
$after = stripslashes( $after );
|
||||
|
||||
return $before . str_replace( '<br />', '', str_replace( "? ", "?", $url ) ) . $after;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,455 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
|
||||
| > $Revision: 64 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > BB Code LEGACY Module
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 9th March 2005 11:31
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* BBCode Parsing: Legacy sub class
|
||||
*
|
||||
* Sub class
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage BBCodeParser
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* BBCode Parsing: Legacy sub class
|
||||
*
|
||||
* Sub class
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage BBCodeParser
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
* @ignore
|
||||
*/
|
||||
class class_bbcode extends class_bbcode_core
|
||||
{
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTOR
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function class_bbcode( )
|
||||
{
|
||||
$this->strip_quotes = $this->ipsclass->vars['strip_quotes'];
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Manage the raw text before inserting into the DB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function pre_db_parse( $txt="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Remove session id's from any post
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\?|&|;|&)s=([0-9a-zA-Z]){32}(&|;|&|$)?#e", "\$this->regex_bash_session('\\1', '\\3')", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// convert <br> to \n
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "/<br>|<br \/>/", "\n", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we parsing bbcode?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_bbcode )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do [CODE] tag
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag( '\\1' )", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Auto parse URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(^|\s)((http|https|news|ftp)://\w+[^\s\[\]]+)#ie" , "\$this->regex_build_url(array('html' => '\\2', 'show' => '\\2', 'st' => '\\1'))", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do [QUOTE(name,date)] tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\[quote(.+?)?\].*\[/quote\])#ies" , "\$this->regex_parse_quotes('\\1')" , $txt );
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// If we are not parsing a siggie, lets have a bash
|
||||
// at the [PHP] [SQL] and [HTML] tags.
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
$txt = preg_replace( "#\[sql\](.+?)\[/sql\]#ies" , "\$this->regex_sql_tag('\\1')" , $txt );
|
||||
$txt = preg_replace( "#\[html\](.+?)\[/html\]#ies" , "\$this->regex_html_tag('\\1')" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// [LIST] [*] [/LIST]
|
||||
//-----------------------------------------
|
||||
|
||||
while( preg_match( "#\n?\[list\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\1')" , $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\2','\\1')" , $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do [IMG] [FLASH] tags
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['allow_images'] )
|
||||
{
|
||||
$txt = preg_replace( "#\[img\](.+?)\[/img\]#ie" , "\$this->regex_check_image('\\1')" , $txt );
|
||||
$txt = preg_replace( "#(\[flash=)(\S+?)(\,)(\S+?)(\])(\S+?)(\[\/flash\])#ie", "\$this->regex_check_flash('\\2','\\4','\\6')", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Start off with the easy stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $txt );
|
||||
$txt = preg_replace( "#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $txt );
|
||||
$txt = preg_replace( "#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $txt );
|
||||
$txt = preg_replace( "#\[s\](.+?)\[/s\]#is", "<s>\\1</s>", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// (c) (r) and (tm)
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\(c\)#i" , "©" , $txt );
|
||||
$txt = preg_replace( "#\(tm\)#i" , "™" , $txt );
|
||||
$txt = preg_replace( "#\(r\)#i" , "®" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// [email]matt@index.com[/email]
|
||||
// [email=matt@index.com]Email me[/email]
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[email\](\S+?)\[/email\]#i" , "<a href='mailto:\\1'>\\1</a>", $txt );
|
||||
$txt = preg_replace( "#\[email\s*=\s*\"\;([\.\w\-]+\@[\.\w\-]+\.[\.\w\-]+)\s*\"\;\s*\](.*?)\[\/email\]#i" , "<a href='mailto:\\1'>\\2</a>", $txt );
|
||||
$txt = preg_replace( "#\[email\s*=\s*([\.\w\-]+\@[\.\w\-]+\.[\w\-]+)\s*\](.*?)\[\/email\]#i" , "<a href='mailto:\\1'>\\2</a>", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// [url]http://www.index.com[/url]
|
||||
// [url=http://www.index.com]ibforums![/url]
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[url\](\S+?)\[/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\1'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// font size, colour and font style
|
||||
// [font=courier]Text here[/font]
|
||||
// [size=6]Text here[/size]
|
||||
// [color=red]Text here[/color]
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#\[size=([^\]]+)\](.+?)\[/size\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[size=([^\]]+)\](.+?)\[/size\]#ies" , "\$this->regex_font_attr(array('s'=>'size','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#\[font=([^\]]+)\](.*?)\[/font\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[font=([^\]]+)\](.*?)\[/font\]#ies" , "\$this->regex_font_attr(array('s'=>'font','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\[color=([^\]]+)\](.+?)\[/color\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[color=([^\]]+)\](.+?)\[/color\]#ies" , "\$this->regex_font_attr(array('s'=>'col' ,'1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\[background=([^\]]+)\](.+?)\[/background\]#ies", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[background=([^\]]+)\](.+?)\[/background\]#ies" , "\$this->regex_font_attr(array('s'=>'background' ,'1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Swap \n back to <br>
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "/\n/", "<br />", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Unicode?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->allow_unicode )
|
||||
{
|
||||
$txt = preg_replace("/&#([0-9]+);/s", "&#\\1;", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse smilies (disallow smilies in siggies, or we'll have to query the DB for each post
|
||||
// and each signature when viewing a topic, not something that we really want to do.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_smilies )
|
||||
{
|
||||
$txt = ' '.$txt.' ';
|
||||
|
||||
usort( $this->ipsclass->cache['emoticons'] , array( 'post_parser', 'smilie_length_sort' ) );
|
||||
|
||||
if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $a_id => $row)
|
||||
{
|
||||
if ( $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$code = $row['typed'];
|
||||
$image = $row['image'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Make safe for regex
|
||||
//-----------------------------------------
|
||||
|
||||
$code = preg_quote($code, "/");
|
||||
|
||||
$txt = preg_replace( "!(?<=[^\w&;/])$code(?=.\W|\W.|\W$)!ei", "\$this->convert_emoticon('$code', '$image')", $txt );
|
||||
}
|
||||
}
|
||||
|
||||
$txt = trim($txt);
|
||||
|
||||
if ( $this->ipsclass->vars['max_emos'] )
|
||||
{
|
||||
if ($this->emoticon_count > $this->ipsclass->vars['max_emos'])
|
||||
{
|
||||
$this->error = 'too_many_emoticons';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Badwords
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = $this->bad_words($txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check BBcode
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = $this->bbcode_check($txt);
|
||||
|
||||
return trim($txt);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// This function processes the DB post before printing as output
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function pre_display_parse($t="")
|
||||
{
|
||||
if ( $this->parse_html )
|
||||
{
|
||||
$t = $this->post_db_parse_html( $t );
|
||||
}
|
||||
else
|
||||
{
|
||||
//$t = $this->my_strip_tags( $t );
|
||||
}
|
||||
|
||||
if ( $this->parse_wordwrap > 0 )
|
||||
{
|
||||
$t = $this->my_wordwrap( $t, $this->parse_wordwrap );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Custom BB code
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( $t, '[/' ) )
|
||||
{
|
||||
$t = $this->post_db_parse_bbcode($t);
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// This function processes the text before showing for editing, etc
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function pre_edit_parse($txt="")
|
||||
{
|
||||
$txt = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $txt );
|
||||
|
||||
if ( $this->parse_bbcode )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// SQL
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#eis", "\$this->unconvert_sql(\"\\2\")", $txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// HTML
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#e", "\$this->unconvert_htm(\"\\2\")", $txt);
|
||||
|
||||
//-----------------------------------------
|
||||
// Images / Flash
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e", "\$this->unconvert_flash('\\1')", $txt );
|
||||
$txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Email, URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "\[email=\\1\]\\2\[/email\]" , $txt );
|
||||
$txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|news://)?(\S+?)['\"].+?".">(.+?)</a>#" , "\[url=\\1\\2\]\\3\[/url\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Quote
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , '[quote]' , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteBegin-{1,2}([^>]+?)\+([^>]+?)-->(.+?)<!--QuoteEBegin-->#", "[quote=\\1,\\2]" , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteBegin-{1,2}([^>]+?)\+-->(.+?)<!--QuoteEBegin-->#" , "[quote=\\1]" , $txt );
|
||||
$txt = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , '[/quote]' , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// CODE
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", '[code]' , $txt );
|
||||
$txt = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '[/code]', $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Easy peasy
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<i>(.+?)</i>#is" , "\[i\]\\1\[/i\]" , $txt );
|
||||
$txt = preg_replace( "#<b>(.+?)</b>#is" , "\[b\]\\1\[/b\]" , $txt );
|
||||
$txt = preg_replace( "#<s>(.+?)</s>#is" , "\[s\]\\1\[/s\]" , $txt );
|
||||
$txt = preg_replace( "#<u>(.+?)</u>#is" , "\[u\]\\1\[/u\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// List headache
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\n){0,}<ul>#" , "\\1\[list\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<ol type='(a|A|i|I|1)'>#" , "\\1\[list=\\2\]\n" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<li>#" , "\n\[*\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ul>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ol>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// SPAN
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#ise" , "\$this->unconvert_size('\\1', '\\2')", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is" , "\[color=\\1\]\\2\[/color\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", "\[font=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", "\[background=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Tidy up the end quote stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\[/QUOTE\])\s*?<br />\s*#si", "\\1\n", $txt );
|
||||
$txt = preg_replace( "#(\[/QUOTE\])\s*?<br>\s*#si" , "\\1\n", $txt );
|
||||
|
||||
$txt = preg_replace( "#<!--EDIT\|.+?\|.+?-->#" , "" , $txt );
|
||||
$txt = str_replace( "</li>", "", $txt );
|
||||
$txt = str_replace( "™", "(tm)", $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse html
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->parse_html )
|
||||
{
|
||||
$txt = str_replace( "'", "'", $txt);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Clean up BR tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = str_replace( "<br>" , "\n", $txt );
|
||||
$txt = str_replace( "<br />", "\n", $txt );
|
||||
|
||||
|
||||
return trim(stripslashes($txt));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user