09 TextBBcode Modification

Started by Mindless, July 21, 2012, 07:36:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mysql

Also don`t forget to add this in include/bbcode_functions.php

  //=== smilie function
  function get_smile()
  {
  global $CURUSER;
  return $CURUSER["smile_until"];
  }

costy27vs

here is my bbcode file i cant do it work

[attachment deleted by admin]

Jctheboss

@ file include/bbcode_functions.php find line 203 :
    foreach($smilies as $code => $url) {
          $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s);
    }
       return $s;
       }


replace it with this :

if (isset($smilies))
   foreach($smilies as $code => $url) {
    $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s);
    }
    if (isset($customsmilies))
    foreach($customsmilies as $code => $url) {
    $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s);
    }
    return $s;
    }


in the code you use $INSTALLER09


Mindless

#1
Here it is :-P

//== Credits to putyn for the awesome job on the textbbcode function - ensure you back up your files before attempting this if you need. The textbbcode function has just been re-written by putyn - Its all Xhtml valid.

@ file include/bbcode_functions.php Add this function above function format urls - note this is optional and not required - if you dont want it then dont add it, then remove the sql/php/html tags from the textbbcode function:

Code (php) Select
//== Geshi highlighter by putyn
   function source_highlighter($code)
    {
    require_once ROOT_PATH."/include/geshi/geshi.php";
    $source = str_replace(array("&..#..0..3..9;", ">", "<", """, "&"), array("'", ">", "<", "\"", "&"), $code[1]);
     
      if(false!==stristr($code[0],"[php]"))
         $lang2geshi = "php";
      elseif (false!==stristr($code[0],"[sql]"))
         $lang2geshi = "sql";
      elseif (false!==stristr($code[0],"[html]"))
         $lang2geshi = "html4strict";
      else
         $lang2geshi = "txt";
         
      $geshi = new GeSHi($source,$lang2geshi);
      $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
      $geshi->set_overall_style('font: normal normal 100% monospace; color: #000066;', false);
        $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
      $geshi->set_code_style('color: #000020;font-family:monospace; font-size:12px;line-height:6px;', true);
      //$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
      $geshi->enable_classes(false);
      $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
      $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
      $return = "<div class=\"codetop\">Code</div><div class=\"codemain\">\n";
      $return .= $geshi->parse_code();
      $return .= "\n</div>\n";
         return  $return;
   
   }



In the above function ensure you remove all the .. in between the first html character in the str_replace line - the forum converts it to raw :)
Code (php) Select
$source = str_replace(array("&..#..0..3..9;", ">", "<", """, "&"), array("'", ">", "<", "\"", "&"), $code[1]);


For the codeboxes add this to both style sheets 1.css and 2.css
Code (html) Select
.codetop {
    background: #0099FF url(../pic/bbcode/code.jpg) no-repeat right;
    color: #000;
    font-weight: bold;
    margin: 0 auto 0 auto;
    padding: 3px;
    border: 1px solid #000;
    width:500px;
}
.codemain {
    background: #FFF;
    border: 1px solid #000;
    color: #000;
    margin: 0 auto 0 auto;
    padding: 3px;
    width:500px;
    overflow:auto;
    height:150px;
}



@ file include/bbcode_functions.php find line 95 :
Code (php) Select
global $smilies, $TBDEV;


Change to :
Code (php) Select
global $smilies, $customsmilies, $TBDEV;


Thanks to pdq for providing improved regex - default ones were no use for code and buffer would max out leaving you with the good ole white screen.

Add these beside the other preg functions :
Code (php) Select
// [mcom]Text[/mcom]
    if (stripos($s, '[mcom]') !== false)
    $s = preg_replace("/\[mcom\](.+?)\[\/mcom\]/is","<div style=\"font-size: 18pt; line-height: 50%;\">
    <div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\"><b>\\1</b></div></div>", $s);
    // [php]php code[/php]
    if (stripos($s, '[php]') !== false)
    $s = preg_replace_callback( "/\[php\](.+?)\[\/php\]/ims", "source_highlighter", $s );
    // [sql]sql code[/sql]
    if (stripos($s, '[sql]') !== false)
    $s = preg_replace_callback( "/\[sql\](.+?)\[\/sql\]/ims", "source_highlighter", $s );
    // [html]html code[/html]
    if (stripos($s, '[html]') !== false)
    $s = preg_replace_callback( "/\[html\](.+?)\[\/html\]/ims", "source_highlighter", $s ); 
     //[mail]mail[/mail]
    if (stripos($s, '[mail]') !== false)
    $s = preg_replace("/\[mail\](.+?)\[\/mail\]/is","<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s);
     //[align=(center|left|right|justify)]text[/align]
    if (stripos($s, '[align=') !== false)
    $s = preg_replace("/\[align=([a-zA-Z]+)\](.+?)\[\/align\]/is","<div style=\"text-align:\\1\">\\2</div>", $s);



@ file include/bbcode_functions.php find line 203 :
Code (php) Select
foreach($smilies as $code => $url) {
      $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s);
}
   return $s;
   }



replace it with this :
Code (php) Select
if (isset($smilies))
   foreach($smilies as $code => $url)
   {
   $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"\" />", $s);
   }
   if (isset($customsmilies))
   foreach($customsmilies as $code => $url)
   {
   $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"\" />", $s);
   }



Note it has the custom smilies code there from sir_snugglebunnys seedbonus mod which i posted and i'll make the relevant changes on that thread - If you dont use it skip above part or comment out custom :)

@ file include/bbcode_functions.php Right underneath the above code add :

Code (php) Select
////////////09 bbcode function by putyn///////////////
function textbbcode($form,$text,$content="") {
global $CURUSER, $TBDEV;
$custombutton = '';
if(get_smile() != '0')
$custombutton .=" <span style='font-weight:bold;font-size:8pt;'><a href=\"javascript:PopCustomSmiles('".$form."','".$text."')\">[ Custom Smilies ]</a></span>";
$smilebutton = "<a href=\"javascript:PopMoreSmiles('".$form."','".$text."')\">[ More Smilies ]</a>";
$bbcodebody =<<<HTML
<script type="text/javascript">
   var textBBcode = "{$text}";
</script>
<script type="text/javascript" src="./scripts/textbbcode.js"></script>
<div id="hover_pick" style="width:25px; height:25px; position:absolute; border:1px solid #333333; display:none; z-index:20;"></div>
<div id="pickerholder"></div>
<table cellpadding="5" cellspacing="0" align="center"  border="1" class="bb_holder">
  <tr>
    <td width="100%" style="background:#CCCCCC; padding:0" colspan="2"><div style="float:left;padding:4px 0px 0px 2px;">
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/bold.png" onclick="tag('b')" title="Bold" alt="B" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/italic.png" onclick="tag('i')" title="Italic" alt="I" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/underline.png" onclick="tag('u')" title="Underline" alt="U" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/strike.png" onclick="tag('s')" title="Strike" alt="S" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/link.png" onclick="clink()" title="Link" alt="Link" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/picture.png" onclick="cimage()" title="Add image" alt="Image"/>
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/colors.png" onclick="colorpicker();" title="Select Color" alt="Colors" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/email.png" onclick="mail()" title="Add email" alt="Email" />
HTML;
if($CURUSER['class'] >= UC_MODERATOR)
$bbcodebody .=<<<HTML
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/php.png" onclick="tag('php')" title="Add php" alt="Php" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/sql.png" onclick="tag('sql')" title="Add sql" alt="Sql" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/script.png" onclick="tag('html')" title="Add html" alt="Html" />
   <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/modcom.png" onclick="tag('mcom')" title="Mod comment" alt="Mod comment" />
HTML;
$bbcodebody .=<<<HTML
</div>
      <div style="float:right;padding:4px 2px 0px 0px;"> <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/align_center.png" onclick="wrap('align','','center')" title="Align - center" alt="Center" /> <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/align_left.png" onclick="wrap('align','','left')" title="Align - left" alt="Left" /> <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/align_justify.png" onclick="wrap('align','','justify')" title="Align - justify" alt="justify" /> <img class="bb_icon" src="{$TBDEV['pic_base_url']}bbcode/align_right.png" onclick="wrap('align','','right')" title="Align - right" alt="Right" /> </div></td>
  </tr>
  <tr>
    <td width="100%" style="background:#CCCCCC; padding:0;" colspan="2"><div style="float:left;padding:4px 0px 0px 2px;">
        <select name="fontfont" id="fontfont"  class="bb_icon" onchange="font('font',this.value);" title="Font face">
          <option value="0">Font</option>
          <option value="Arial" style="font-family: Arial;">Arial</option>
          <option value="Arial Black" style="font-family: Arial Black;">Arial Black</option>
          <option value="Comic Sans MS" style="font-family: Comic Sans MS;">Comic Sans MS</option>
          <option value="Courier New" style="font-family: Courier New;">Courier New</option>
          <option value="Franklin Gothic Medium" style="font-family: Franklin Gothic Medium;">Franklin Gothic Medium</option>
          <option value="Georgia" style="font-family: Georgia;">Georgia</option>
          <option value="Helvetica" style="font-family: Helvetica;">Helvetica</option>
          <option value="Impact" style="font-family: Impact;">Impact</option>
          <option value="Lucida Console" style="font-family: Lucida Console;">Lucida Console</option>
          <option value="Lucida Sans Unicode" style="font-family: Lucida Sans Unicode;">Lucida Sans Unicode</option>
          <option value="Microsoft Sans Serif" style="font-family: Microsoft Sans Serif;">Microsoft Sans Serif</option>
          <option value="Palatino Linotype" style="font-family: Palatino Linotype;">Palatino Linotype</option>
          <option value="Tahoma" style="font-family: Tahoma;">Tahoma</option>
          <option value="Times New Roman" style="font-family: Times New Roman;">Times New Roman</option>
          <option value="Trebuchet MS" style="font-family: Trebuchet MS;">Trebuchet MS</option>
          <option value="Verdana" style="font-family: Verdana;">Verdana</option>
          <option value="Symbol" style="font-family: Symbol;">Symbol</option>
        </select>
        <select name="fontsize" id="fontsize" class="bb_icon" style="padding-bottom:3px;" onchange="font('size',this.value);" title="Font size">
          <option value="0">Font size</option>
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="6">6</option>
          <option value="7">7</option>
        </select>
      </div>
      <div style="float:right;padding:4px 2px 0px 0px;"> <img class="bb_icon" src="pic/bbcode/text_uppercase.png" onclick="text('up')" title="To Uppercase" alt="Up" /> <img class="bb_icon" src="pic/bbcode/text_lowercase.png" onclick="text('low')" title="To Lowercase" alt="Low" /> <img class="bb_icon" src="pic/bbcode/zoom_in.png" onclick="fonts('up')" title="Font size up" alt="S up" /> <img class="bb_icon" src="pic/bbcode/zoom_out.png" onclick="fonts('down')" title="Font size up" alt="S down" /> </div></td>
  </tr>
  <tr>
    <td><textarea id="{$text}" name="{$text}" rows="2" cols="2" style="width:530px; height:250px;font-size:12px;">{$content}</textarea></td>
    <td align="center" valign="top"><table width="0" cellpadding="2" border="1" class="em_holder" cellspacing="2">
         <tr>
          <td align="center"><a href="javascript:em(':-)');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/smile1.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':smile:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/smile2.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':-D');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/grin.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':w00t:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/w00t.gif" width="18" height="20" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':-P');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/tongue.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(';-)');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/wink.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':-|');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/noexpression.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':-/');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/confused.gif" width="18" height="18" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':-(');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/sad.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':baby:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/baby.gif" width="20" height="22" /></a></td>
          <td align="center"><a href="javascript:em(':-O');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/ohmy.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em('|-)');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/sleeping.gif" width="20" height="27" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':innocent:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/innocent.gif" width="18" height="22" /></a></td>
          <td align="center"><a href="javascript:em(':unsure:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/unsure.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':closedeyes:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/closedeyes.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':cool:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/cool2.gif" width="20" height="20" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':thumbsdown:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/thumbsdown.gif" width="27" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':blush:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/blush.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':yes:');"><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/yes.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':no:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/no.gif" width="20" height="20" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':love:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/love.gif" width="19" height="19" /></a></td>
          <td align="center"><a href="javascript:em(':?:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/question.gif" width="19" height="19" /></a></td>
          <td align="center"><a href="javascript:em(':!:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/excl.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':idea:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/idea.gif" width="19" height="19" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':arrow:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/arrow.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':arrow2:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/arrow2.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':hmm:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/hmm.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':hmmm:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/hmmm.gif" width="25" height="23" /></a></td>
        </tr>
        <tr>
          <td align="center"><a href="javascript:em(':huh:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/huh.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':rolleyes:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/rolleyes.gif" width="20" height="20" /></a></td>
          <td align="center"><a href="javascript:em(':kiss:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/kiss.gif" width="18" height="18" /></a></td>
          <td align="center"><a href="javascript:em(':shifty:');" ><img border="0" alt="Smilies" src="{$TBDEV['pic_base_url']}smilies/shifty.gif" width="20" height="20" /></a></td>
        </tr>
        <tr>
          <td colspan="4" align="center" style="white-space:nowrap;"><span style='font-weight:bold;font-size:8pt;'>{$smilebutton}</span>{$custombutton}</td>
        </tr>
      </table></td></tr></table>
HTML;
   return $bbcodebody;
}



@ file include/emoticons.php make sure you add this array - just add your smilies to the array in the format its in :
Code (php) Select
$customsmilies = array( 
":fart:" => "fart.gif",);



@ file comment.php - Make sure you have :
Code (php) Select
require_once "include/bbcode_functions.php";


At the top beside the other required once files.

@ file comment line 44 or similiar find :
Code (php) Select
$text = trim($_POST["text"]);


Replace with :
Code (php) Select
$text = trim($_POST["body"]);


@ file comment.php line 69 find :
Code (php) Select
$HTMLOUT = '';


Under it add this :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file comment.php line 72 find :
Code (php) Select
<form method='post' action='comment.php?action=add'>


change to
Code (php) Select
<form name='compose' method='post' action='comment.php?action=add'>


@file comment.php line 74 find :
Code (php) Select
<textarea name='text' rows='10' cols='60'></textarea>


Replace with this :
Code (php) Select
".textbbcode("compose", "body") . "


@ file comment line 110 find :
Code (php) Select
$text = trim($_POST["text"]);


Replace with :
Code (php) Select
$text = trim($_POST["body"]);


@ file comment.php line 130 find :
Code (php) Select
$HTMLOUT = '';


Under it add this :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@file comment.php line 132 will actually be 133 now as you added the above line.. find :
Code (php) Select
<form method='post' action='comment.php?action=edit&cid=$commentid'>


Replace with this :
Code (php) Select
<form name='compose' method='post' action='comment.php?action=edit&cid=$commentid'>


@ file comment.php line 135 will actually be 136 now as you added the above line.. find:
Code (php) Select
<textarea name='text' rows='10' cols='60'>" . htmlspecialchars($arr["text"]) . "</textarea>


Replace with this :
Code (php) Select
".textbbcode("compose", "body", htmlspecialchars($arr["text"])) . "


Move onto forum/forum_functions.php - Find line 158 :
Code (php) Select
$htmlout = '';


Under it add :
Code (php) Select
$htmlout .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file forum/forum_functions.php find line 183 :
Code (php) Select
$htmlout .= "<form method='post' action='forums.php?action=post'>\n";


Change to :
Code (php) Select
$htmlout .= "<form name='compose' method='post' action='forums.php?action=post'>\n";


@ file forum/forum_functions.php find line 212 :
Code (php) Select
$htmlout .= "<tr><td class='rowhead'>{$lang['forum_functions_body']}</td><td align='left' style='padding: 0px'>" .
    "<textarea name='body' cols='100' rows='20' style='border: 0px'>".
    ($quote?(("[quote=".htmlspecialchars($arr["username"])."]".htmlspecialchars($arr["body"])."[/quote]\n")):"").
    "</textarea></td></tr>\n";



Replace it with this :
Code (php) Select
$htmlout .= "<tr><td class='rowhead'>{$lang['forum_functions_body']}</td><td align='left' style='padding: 0px'>".
    textbbcode("compose", "body",($quote?(("[quote=".htmlspecialchars($arr["username"])."]".htmlspecialchars($arr["body"])."[/quote]\n")):""))."</td></tr>\n";



@ file forum/forum_user_options.php line 78 find :
Code (php) Select
$HTMLOUT = '';


Under it add
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file forum/forum_user_options.php line 82 find :
Code (php) Select
<form method='post' action='forums.php?action=editpost&postid=$postid'>


Replace it with this
Code (php) Select
<form method='post' name='compose' action='forums.php?action=editpost&postid=$postid'>


@ file forum/forum_user_options.php line 88 find :
Code (php) Select
<textarea name='body' cols='100' rows='20' style='border: 0px'>" . htmlspecialchars($arr["body"]) . "</textarea>


Replace it with this :
Code (php) Select
".textbbcode("compose", "body", htmlspecialchars($arr["body"])) . "


@ file forums.php make sure that the require once is uncommented - i see people failing to check this :)
Code (php) Select
require_once "include/bbcode_functions.php";


@ file admin/news line 39 find :
Code (php) Select
$HTMLOUT = '';


Under it add :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file admin/news line 166 find :
Code (php) Select
<form method='post' action='admin.php?action=news'>


Replace with :
Code (php) Select
<form name='compose' method='post' action='admin.php?action=news'>


@ file admin/news line 180 or similiar find this :
Code (php) Select
<textarea style='width:650px;' name='body' cols='55' rows='10'>" . htmlentities($arr['body'], ENT_QUOTES) . "</textarea>


Replace it with this :
Code (php) Select
".textbbcode("compose", "body", htmlspecialchars($arr["body"], ENT_QUOTES)) . "


@ file admin/news line 206 find :
Code (php) Select
$HTMLOUT .= "<form method='post' action='admin.php?action=news'>


Replace with this :
Code (php) Select
$HTMLOUT .= "<form name='compose' method='post' action='admin.php?action=news'>


@ file admin/news line 216 find :
Code (php) Select
<textarea style='width:650px;' name='body' cols='55' rows='10'></textarea>


Replace it with this :
Code (php) Select
".textbbcode("compose", "body")."


@ file admin/news line 233 find :
Code (php) Select
$HTMLOUT .= begin_main_frame();


Replace it with this
Code (php) Select
$HTMLOUT .= begin_main_frame("Compose", true);


@ file admin/news line 234 find :
Code (php) Select
$HTMLOUT .= "<form method='post' action='admin.php?action=news'>


Replace it with this :
Code (php) Select
$HTMLOUT .= "<form method='post' name='compose' action='admin.php?action=news'>


@ file admin/news line 256 find :
Code (php) Select
$HTMLOUT .= begin_main_frame();


Replace it with this
Code (php) Select
$HTMLOUT .= begin_main_frame("Compose", true);


@ file edit.php make sure that the require once added at the top beside the others:)
Code (php) Select
require_once "include/bbcode_functions.php";


@ file edit.php line 49 or similiar find :
Code (php) Select
$HTMLOUT = '';


Under it add :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file edit.php line 51 or similiar find :
Code (php) Select
$HTMLOUT  .= "<form method='post' action='takeedit.php' enctype='multipart/form-data'>
    <input type='hidden' name='id' value='$id' />";



Replace with :
Code (php) Select
$HTMLOUT  .= "<form name='compose' method='post' action='takeedit.php' enctype='multipart/form-data'>
    <input type='hidden' name='id' value='$id' />";



@ file edit.php line 70 or similiar find :
Code (php) Select
$HTMLOUT  .= tr($lang['edit_description'], "<textarea name='descr' rows='10' cols='80'>" . htmlspecialchars($row["ori_descr"]) . "</textarea><br />({$lang['edit_tags']})", 1);


Replace it with this :
Code (php) Select
$HTMLOUT  .= tr($lang['edit_description'], "". textbbcode("compose","descr","".htmlspecialchars($row['ori_descr'])."")."<br />({$lang['edit_tags']})", 1);


@ file upload.php make sure that the require once added at the top beside the others:)
Code (php) Select
require_once "include/bbcode_functions.php";


@ file upload.php line 29 or similiar find :
Code (php) Select
$HTMLOUT = '';


Under it add :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file upload.php line 38 or similiar find :
Code (php) Select
<form enctype='multipart/form-data' action='takeupload.php' method='post'>


Replace it with this :
Code (php) Select
<form name='compose' enctype='multipart/form-data' action='./takeupload.php' method='post'>


@ file upload.php line 58 or similiar find :
Code (php) Select
<textarea name='descr' rows='10' cols='80'></textarea>


Replace it with this :
Code (php) Select
". textbbcode("compose","descr")."


@ file sendmessage.php make sure that the require once added at the top beside the others:)
Code (php) Select
require_once "include/bbcode_functions.php";


@ file sendmessage.php line 40 or similiar find :
Code (php) Select
$HTMLOUT = '';


Under it add :
Code (php) Select
$HTMLOUT .="<script type=\"text/javascript\" src=\"./scripts/shout.js\"></script>";


@ file sendmessage.php line 61 or similiar find :
Code (php) Select
$HTMLOUT .= "<h1>{$mass_msg_pm_to}</h1>
      <form method='post' action='takemessage.php'>";



Replace it with this :
Code (php) Select
$HTMLOUT .= "<h1>{$mass_msg_pm_to}</h1>
      <form name='compose' method='post' action='takemessage.php'>";



@ file sendmessage.php line 76 or similiar find :
Code (php) Select
<textarea style='width: 650px;' name='msg' cols='55' rows='15'>$this_body</textarea>


Replace it with this
Code (php) Select
". textbbcode("compose","body","$this_body")."


@ file sendmessage.php line 165 or similiar find :
Code (php) Select
<form method='post' action='takemessage.php'>


Replace it with this :
Code (php) Select
<form name='compose' method='post' action='takemessage.php'>


@ file sendmessage.php line 178 or similiar find :
Code (php) Select
<textarea name='msg' cols='80' rows='15'>".(isset($body) ? htmlspecialchars($body) : '')."</textarea>


Replace it with this :
Code (php) Select
".textbbcode("compose", "body", isset($body) ? htmlspecialchars($body) : '')."


@ file takemessage.php line 31 to 33 or similiar find - just adding a global :
Code (php) Select
function ratios($up, $down)
  {
  if ($down > 0)



Replace with :
 
Code (php) Select
function ratios($up, $down)
  {
  global $lang;
  if ($down > 0)



@ file takemessage.php line 54 or similiar find :
Code (php) Select
$msg = trim($_POST["msg"]);


Replace it with this :
Code (php) Select
$msg = trim($_POST["body"]);


@ file takemessage.php line 122 or similiar find :
Code (php) Select
$msg = trim($_POST["msg"]);


Replace it with this :
Code (php) Select
$msg = trim($_POST["body"]);


@ file lang/en/lang_takemessage.php add :
Code (php) Select
'takemessage_sent' => 'Sent',


At the very top of both style sheets 1.css and 2.css add :
Code (php) Select
@import "bbcode.css";


Inside bbcode rar find the following files and move them : Upload the bbcode folder to pic folder - moresmilies.php and custom_moresmilies.php and bbcode.css to root - shout.js and textbbcode.js to scripts folder and geshi to the include folder if you use it.

Thats it all done - now you should have working textbbcode on forums,comments,news,upload,messages and edit. Again Huge thanks to putyn for writing the new textbbcode function.

As usual post any errors/improvements ect so i can update the main post.

[attachment deleted by admin]