Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Template Shares
Reply
  #1  
Old 29th June 2009, 11:26
mmisu120000's Avatar
mmisu120000 mmisu120000 is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 202
Default [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*<br>#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>');
  }

?> 
Reply With Quote
The Following 6 Users Say Thank You to mmisu120000 For This Useful Post:
Fynnon (29th June 2009), KingCobra (14th August 2009), konvar (29th June 2009), Marco (5th April 2013), Terminator (29th June 2009), Virusache (29th June 2009)
  #2  
Old 29th June 2009, 12:07
Terminator's Avatar
Terminator Terminator is offline
Senior Member
 
Join Date: Sep 2008
Iraq
Posts: 45
Default
awesome work and solid effort buddy

we'll replace them with the properly working and fixed ones for sure!
__________________
http://hqanime4arab.com
The Home of HQ Hand Dubbed Arabic Anime for Arabs!

Last edited by Terminator; 29th June 2009 at 12:08. Reason: the server went bazooka and i had to delete 1 post!
Reply With Quote
  #3  
Old 29th June 2009, 13:39
mmisu120000's Avatar
mmisu120000 mmisu120000 is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 202
Default
btw, i forgot to put the entire "include/globalfunctions.php", modified (for the "lazy" ones :sleep:) :
Here it is:
globalfunctions.php

Good luck!

I'll see what other fixes I can work out ...
Reply With Quote
The Following User Says Thank You to mmisu120000 For This Useful Post:
Virusache (29th June 2009)
  #4  
Old 29th June 2009, 14:42
Muikku Muikku is offline
Senior Member
 
Join Date: Aug 2008
Posts: 68
Default
Quote:
Originally Posted by mmisu120000 View Post
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
Reply With Quote
  #5  
Old 29th June 2009, 14:58
mmisu120000's Avatar
mmisu120000 mmisu120000 is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 202
Default
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?
Reply With Quote
  #6  
Old 29th June 2009, 17:49
Muikku Muikku is offline
Senior Member
 
Join Date: Aug 2008
Posts: 68
Default
Quote:
Originally Posted by mmisu120000 View Post
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!!
Reply With Quote
  #7  
Old 29th June 2009, 18:32
mmisu120000's Avatar
mmisu120000 mmisu120000 is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 202
Default
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
Reply With Quote
  #8  
Old 14th September 2010, 21:04
Ingvar Ingvar is offline
Senior Member
 
Join Date: Mar 2009
Iceland
Posts: 28
Default
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?
Reply With Quote
  #9  
Old 4th March 2012, 18:46
Adey Adey is offline
Member
 
Join Date: Feb 2012
P2P
Posts: 9
Default
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.
Reply With Quote
  #10  
Old 4th March 2012, 19:27
x360zone's Avatar
x360zone x360zone is offline
Senior Member
 
Join Date: Jul 2011
United Kingdom
Posts: 915
Default 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
__________________

7.5 tsse
future tracker source & hosting, vps
trackers installs + Themes
http://www.foxyhosting.co.uk
http://www.downmy.top testing zone
offshore vps & cpanel hosting & Shoutcast & VPN
STOP cyberbullying
any setups tracker installs vps hosting vps setups themes mods hit me up
over the last three months ive become a snake breeder,pythons,hogs,boa,corn,rat,king,carpet and what joy it is


Reply With Quote
The Following User Says Thank You to x360zone For This Useful Post:
batuo76 (9th December 2019)
Reply

Tags
bbcodes , fix , tsse

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Youtube Tag - bbcodes christyz89 Free Torrent Source 2 20th September 2009 15:05
BBCodes in Polls sammygo Mods & Themes 1 21st July 2009 21:41
bbcodes [img][url] in shoutbox TS SE 4.3 Verix Template Shares 1 10th June 2009 05:04
Enable HTML and bbcodes epas Torrent Strike 2 23rd March 2009 14:15



All times are GMT +2. The time now is 23:01. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.