Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Template Shares (http://www.bvlist.com/forumdisplay.php?f=26)
-   -   [FIX] TSSE v5.4.1 - BBcodes Fix (http://www.bvlist.com/showthread.php?t=2896)

mmisu120000 29th June 2009 11:26

[FIX] TSSE v5.4.1 - BBcodes Fix
 
Finally, i've managed to fix the bbcodes in comments, forums, etc.....

Here it is:

in globalfunctions.php, find:
PHP Code:

  function format_comment ($s$htmlspecialchars_uni true$noshoutbox true$xss_clean true$show_smilies true$imagerel 'posts')
  {
    global 
$smilies;
    global 
$CURUSER;
    global 
$BASEURL;
    global 
$redirect;
    global 
$rootpath;
    global 
$pic_base_url;
    global 
$lang;
    global 
$cache;
    if (!
defined ('NcodeImageResizer'))
    {
      
define ('NcodeImageResizer'true);
    }

    
$target = ($noshoutbox '_self' '_blank');
    
$s str_replace ('
'
''$s);
    if (
$htmlspecialchars_uni)
    {
      
$s htmlspecialchars_uni ($s);
    }

    
$s ts_remove_badwords ($s);
    if (
$xss_clean)
    {
      
$s xss_clean ($s);
    }

    if (
$noshoutbox)
    {
      
preg_match_all ('#\\[(code|php|sql)\\](.*?)\\[/\\1\\](
?|
?)#si'
$s$code_matchesPREG_SET_ORDER);
      
$s preg_replace ('#\\[(code|php|sql)\\](.*?)\\[/\\1\\](
?|
?)#si'
'{{ts-code}}
'
$s);
    }

    if ((!
preg_match ('/\\[nfo\\](.*?)\\[\\/nfo\\]/is'$s) AND $show_smilies))
    {
      require_once 
$rootpath '/' $cache '/smilies.php';
      @
reset ($smilies);
      while (list (
$code$url) = @each ($smilies))
      {
        
$s str_replace ($code'<img border="0" src="' $BASEURL '/' $pic_base_url 'smilies/' $url '" alt="' htmlspecialchars ($code) . '">'$s);
      }
    }

    if (
$noshoutbox)
    {
      while (
preg_match ('#\\[list\\](.*?)\\[/list\\]#esi'$s))
      {
        
$s preg_replace ('#\\[list\\](.*?)\\[/list\\](
?|
?)#esi'
'' 'parse_list(\'$1\')
'
$s);
      }

      while (
preg_match ('#\\[list=(a|A|i|I|1)\\](.*?)\\[/list\\](
?|
?)#esi'
$s))
      {
        
$s preg_replace ('#\\[list=(a|A|i|I|1)\\](.*?)\\[/list\\]#esi''' 'parse_list(\'$2\', \'$1\')
'
$s);
      }
    }

    
$simple_search = array ('/\\[b\\]((\\s|.)+?)\\[\\/b\\]/is''/\\[i\\]((\\s|.)+?)\\[\\/i\\]/is''/\\[h\\]((\\s|.)+?)\\[\\/h\\]/is''/\\[u\\]((\\s|.)+?)\\[\\/u\\]/is''/\\[img\\]((http|https):\\/\\/[^\\s\'"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/is''/\\[img=((http|https):\\/\\/[^\\s\'"<>]+(\\.(gif|jpg|png)))\\]/is''/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/is''/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/is''/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/is''/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/is''/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/is''/\\[pre\\](.*?)\\[\\/pre\\]/is''/\\[nfo\\](.*?)\\[\\/nfo\\]/is''#\\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\\](.*?)\\[/size\\]#si''#\\[align=(left|center|right|justify)\\](.*?)\\[/align\\]#si''#\\[email\\](.*?)\\[/email\\]#ei''#\\[email=(.*?)\\](.*?)\\[/email\\]#ei''#\\[youtube\\](.*?)\\[/youtube\\]#i');
    
$imgtag = ($noshoutbox '<a href="\\1" rel="gallery.' . ($imagerel == 'signatures' 'signatures' 'posts') . '"><img border="0" src="\\1" alt="" title="" onload="NcodeImageResizer.' . ($imagerel == 'signatures' 'createOnSigs' 'createOn') . '(this);" /></a>' htmlspecialchars_uni ('\\1'));
    
$youtubetag = ($noshoutbox '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' htmlspecialchars_uni ('' '$1') . '"></param><embed src="http://www.youtube.com/v/' htmlspecialchars_uni ('' '$1') . '" type="application/x-shockwave-flash" width="425" height="350"></embed></object>' htmlspecialchars_uni ('' 'http://www.youtube.com/v/$1'));
    
$simple_replace = array ('<b>\\1</b>''<i>\\1</i>''<h3>\\1</h3>''<u>\\1</u>'$imgtag$imgtag'<font color="\\1">\\2</font>''<font color="\\1">\\2</font>''' '<a href="\\1" target="' $target '">\\2</a>''' '<a href="\\1" target="' $target '">\\1</a>''<font face="\\1">\\2</font>''<pre>' htmlspecialchars_uni ('\\1') . '</pre>''<tt><span style="white-space: nowrap;"><font face="MS Linedraw" size="2" style="font-size: 10pt; line-height: 10pt">\\1</font></span></tt>''' '<span style="font-size: $1;">$2</span>''' '<p style="text-align: $1;">$2</p>''' 'parse_email(\'$1\')''' 'parse_email(\'$1\', \'$2\')'$youtubetag);
    
$s preg_replace ($simple_search$simple_replace$s);
    if (!
defined ('TS_CUSTOM_BBCODE'))
    {
      
define ('TS_CUSTOM_BBCODE'true);
    }

    include_once 
INC_PATH '/ts_custom_bbcode.php';
    
$s ts_custom_bbcode ($s);
    if (
$noshoutbox)
    {
      
$s parse_quotes ($s);
    }

    
$s format_urls ($s$target);
    
$s anonymize ($s$target);
    if (((isset (
$code_matches) AND count ($code_matches)) AND $noshoutbox))
    {
      foreach (
$code_matches as $text)
      {
        if (
strtolower ($text[1]) == 'code')
        {
          
$code code_tag ($text[2]);
        }
        else
        {
          if (
strtolower ($text[1]) == 'php')
          {
            
$code php_tag ($text[2]);
          }
          else
          {
            if (
strtolower ($text[1]) == 'sql')
            {
              
$code sql_tag ($text[2]);
            }
          }
        }

        
$s preg_replace ('#\\{\\{ts-code\\}\\}
?#'
$code$s1);
      }
    }

    
$s nl2br ($s);
    
$s preg_replace ('#(</?(?:html|head|body|form|div|p|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p)[^>]*>)\\s*#i''' '$1'$s);
    
$s preg_replace ('#(&nbsp;)+(</?(?:html|head|body|form|div|p|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p)[^>]*>)#i''' '$2'$s);
    
$s ts_wordwrap ($s);
    return 
$s;
  }

  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ('error_reporting'E_ALL & ~E_NOTICE);
  @
ini_set ('display_errors''0');
  @
ini_set ('log_errors''1');
  if (!
defined ('IN_SCRIPT_TSSEv53'))
  {
    exit (
'<font face=\'verdana\' size=\'2\' color=\'darkred\'><b>Error!</b> Direct initialization of this file is not allowed.</font>');
  }

?> 

and replace it with:

PHP Code:

  function format_comment ($s$htmlspecialchars_uni true$noshoutbox true$xss_clean true$show_smilies true$imagerel 'posts')
  {
    global 
$smilies;
    global 
$CURUSER;
    global 
$BASEURL;
    global 
$redirect;
    global 
$rootpath;
    global 
$pic_base_url;
    global 
$lang;
    global 
$cache;
    if (!
defined ('NcodeImageResizer'))
    {
      
define ('NcodeImageResizer'true);
    }

    
$target = ($noshoutbox '_self' '_blank');
    
$s ts_remove_badwords ($s);
    if (
$htmlspecialchars_uni)
    {
      
$s htmlspecialchars_uni ($s);
    }

    if (
$xss_clean)
    {
      
$s xss_clean ($s);
    }

    if (
$noshoutbox)
    {
      
preg_match_all ('#\\[(code|php|sql)\\](.*?)\\[/\\1\\](
?|
?)#si'
$s$code_matchesPREG_SET_ORDER);
      
$s preg_replace ('#\\[(code|php|sql)\\](.*?)\\[/\\1\\](
?|
?)#si'
'{{ts-code}}
'
$s);
    }

    if ((!
preg_match ('/\\[nfo\\](.*?)\\[\\/nfo\\]/is'$s) AND $show_smilies))
    {
      require_once 
$rootpath '/' $cache '/smilies.php';
      @
reset ($smilies);
      while (list (
$code$url) = @each ($smilies))
      {
        
$s str_replace ($code'<img border="0" src="' $BASEURL '/' $pic_base_url 'smilies/' $url '" alt="' htmlspecialchars ($code) . '" class="inlineimg" />'$s);
      }
    }

    
$simple_search = array ('/\\[b\\]((\\s|.)+?)\\[\\/b\\]/is''/\\[i\\]((\\s|.)+?)\\[\\/i\\]/is''/\\[h\\]((\\s|.)+?)\\[\\/h\\]/is''/\\[u\\]((\\s|.)+?)\\[\\/u\\]/is''/\\[img\\]((http|https):\\/\\/[^\\s\'"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/is''/\\[img=((http|https):\\/\\/[^\\s\'"<>]+(\\.(gif|jpg|png)))\\]/is''/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/is''/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/is''/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/is''/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/is''/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/is''/\\[pre\\](.*?)\\[\\/pre\\]/is''/\\[nfo\\](.*?)\\[\\/nfo\\]/is''#\\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\\](.*?)\\[/size\\]#si''#\\[align=(left|center|right|justify)\\](.*?)\\[/align\\]#si''#\\[email\\](.*?)\\[/email\\]#ei''#\\[email=(.*?)\\](.*?)\\[/email\\]#ei''#\\[youtube\\](.*?)\\[/youtube\\]#i');
    
$imgtag = ($noshoutbox '<a href="\\1" rel="gallery.' . ($imagerel == 'signatures' 'signatures' 'posts') . '"><img border="0" src="\\1" alt="" title="" onload="NcodeImageResizer.' . ($imagerel == 'signatures' 'createOnSigs' 'createOn') . '(this);" /></a>' '\\1');
    
$youtubetag = ($noshoutbox '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . ('' '$1') . '"></param><embed src="http://www.youtube.com/v/' . ('' '$1') . '" type="application/x-shockwave-flash" width="425" height="350"></embed></object>' '' 'http://www.youtube.com/v/$1');
    
$simple_replace = array ('<b>\\1</b>''<i>\\1</i>''<h3>\\1</h3>''<u>\\1</u>'$imgtag$imgtag'<font color="\\1">\\2</font>''<font color="\\1">\\2</font>''' '<a href="\\1" target="' $target '">\\2</a>''' '<a href="\\1" target="' $target '">\\1</a>''<font face="\\1">\\2</font>''<pre>' '\\1' '</pre>''<tt><span style="white-space: nowrap;"><font face="MS Linedraw" size="2" style="font-size: 10pt; line-height: 10pt">\\1</font></span></tt>''' '<span style="font-size: $1;">$2</span>''' '<p style="text-align: $1;">$2</p>''' 'parse_email(\'$1\')''' 'parse_email(\'$1\', \'$2\')'$youtubetag);
    
$s preg_replace ($simple_search$simple_replace$s);
    if (!
defined ('TS_CUSTOM_BBCODE'))
    {
      
define ('TS_CUSTOM_BBCODE'true);
    }

    include_once 
INC_PATH '/ts_custom_bbcode.php';
    
$s ts_custom_bbcode ($s);
    if (
$noshoutbox)
    {
      
$s parse_quotes ($s);
    }

    
$s format_urls ($s$target);
    
$s anonymize ($s$target);
    
$s nl2br ($s);
    if (((isset (
$code_matches) AND count ($code_matches)) AND $noshoutbox))
    {
      foreach (
$code_matches as $text)
      {
        if (
strtolower ($text[1]) == 'code')
        {
          
$code code_tag ($text[2]);
        }
        else
        {
          if (
strtolower ($text[1]) == 'php')
          {
            
$code php_tag ($text[2]);
          }
          else
          {
            if (
strtolower ($text[1]) == 'sql')
            {
              
$code sql_tag ($text[2]);
            }
          }
        }

        
$s preg_replace ('#\\{\\{ts-code\\}\\}
?#'
$code$s1);
      }
    }

    if (
$noshoutbox)
    {
      while (
preg_match ('#\\[list\\](.*?)\\[/list\\]#esi'$s))
      {
        
$s preg_replace ('#\\[list\\](.*?)\\[/list\\](
?|
?)#esi'
'' 'parse_list(\'$1\')
'
$s);
      }

      while (
preg_match ('#\\[list=(a|A|i|I|1)\\](.*?)\\[/list\\](
?|
?)#esi'
$s))
      {
        
$s preg_replace ('#\\[list=(a|A|i|I|1)\\](.*?)\\[/list\\]#esi''' 'parse_list(\'$2\', \'$1\')
'
$s);
      }
    }

    
$s ts_wordwrap ($s);
    if (
preg_match ('/\\[hide\\](.*?)\\[\\/hide\\]/is'$s))
    {
      while (
preg_match ('#\\[hide\\](.*?)\\[\\/hide\\](
?|
?)#si'
$s))
      {
        if (!
defined ('IS_THIS_USER_POSTED'))
        {
          
$s preg_replace ('#\\[hide\\](.*?)\\[\\/hide\\](
?|
?)#si'
show_notice ($lang->global['h1'], true$lang->global['h2'], ''), $s);
          continue;
        }
        else
        {
          
$s preg_replace ('#\\[hide\\](.*?)\\[\\/hide\\](
?|
?)#si'
show_notice ('$1'false$lang->global['h3'], ''), $s);
          continue;
        }
      }
    }

    return 
$s;
  }

  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ('error_reporting'E_ALL & ~E_NOTICE);
  @
ini_set ('display_errors''0');
  @
ini_set ('log_errors''1');
  if (!
defined ('IN_SCRIPT_TSSEv53'))
  {
    exit (
'<font face=\'verdana\' size=\'2\' color=\'darkred\'><b>Error!</b> Direct initialization of this file is not allowed.</font>');
  }

?> 


Terminator 29th June 2009 12:07

awesome work and solid effort buddy :muscle:

we'll replace them with the properly working and fixed ones for sure!

mmisu120000 29th June 2009 13:39

1 Attachment(s)
btw, i forgot to put the entire "include/globalfunctions.php", modified (for the "lazy" ones :sleep:) :
Here it is:
Attachment 1473

Good luck!

I'll see what other fixes I can work out ...

Muikku 29th June 2009 14:42

Quote:

Originally Posted by mmisu120000 (Post 12790)
btw, i forgot to put the entire "include/globalfunctions.php", modified (for the "lazy" ones :sleep:) :
Here it is:
Attachment 1473

Good luck!

I'll see what other fixes I can work out ...


When i put that glopalfunctions.php my tracker then my user can

mmisu120000 29th June 2009 14:58

what version of TSSE you're using?


did you put the entire globalfunctions.php, or did you change only the part of the code I've showed?

Muikku 29th June 2009 17:49

Quote:

Originally Posted by mmisu120000 (Post 12797)
what version of TSSE you're using?


did you put the entire globalfunctions.php, or did you change only the part of the code I've showed?

i use TSSe 5.4.1 and i put only the part of the code i try whole php script


now its work i put whole php code now

THANX!!

mmisu120000 29th June 2009 18:32

you're wellcome, I'm glad it worked amd I could help you ...

This fix works only on TSSE v5.4.1 , in 5.6 there is no such error, i don't know in 5.1, maybe the bbcodes work there too

Ingvar 14th September 2010 21:04

Doesnt work for me, i got 5.4 and every time i use BBCodes, my server stops responding (only when BBCodes are used on this website.)

Anyone got a fix?

Adey 4th March 2012 18:46

hey , is it posibble to change bbcodes? If you could help me out with it or give a clue ,cause I have changed it on quickeditor and its puting new tags , but they arent recognized by server. :sos:

x360zone 4th March 2012 19:27

update
 
why not update to v 5.6 which is better than the older version just a tip
i know i had same issues with the none nulled/ original one also

Adey 5th March 2012 08:45

Problems with tracker : Tracker Sending Inncorect Data, that's why i didnt update it. I have always problems with 5.6 ,i have tried 20x and nothing (added fixes from forum). :)
Also i ve seen file ,"custombbtags" or something like that but its an empty, any clue how to fill it with 1 example tag?

mmisu120000 5th March 2012 13:52

You have allways problems with 5.6 because you are not installing all mods corectly, or you didn't made all mods ...

There are many of us that run the 5.6 version without any error or problem ...
TSSE 5.6 from here is NOT for beginners! You have to know a little ,at least, of php coding ... but when it's all done, it will run very smooth, fast and secure!

Zohaib 22nd September 2012 15:38

I have installed this script but i don't know which file i add my website url when the script run on my website plz tell me plz , now my website showing this error after installed
http://i.imgur.com/429Hq.jpg


All times are GMT +2. The time now is 08:55.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.