Page 1 of 1

bbcode buttons don't work

Posted: Wed Aug 22, 2007 8:28 am
by orij1nal
For some reason my bbcode buttons don't work, I clicked on them and they don't work at all. Anyone know why this is happening? http://www.hkmediaonline.com/forum is my site .

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 8:36 am
by karlsemple
orij1nal wrote:For some reason my bbcode buttons don't work, I clicked on them and they don't work at all. Anyone know why this is happening? http://www.hkmediaonline.com/forum is my site .

Have you installed any mods which have edited the bbcode.php or bbcode.html?

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 2:24 pm
by orij1nal
yeah I installed the hide bbcode mod, how should the normal bbcode.php should look like?

heres my bbcode.php

Code: Select all

<?php
/***************************************************************************
 *                              bbcode.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: bbcode.php,v 1.36.2.41 2006/02/26 17:34:50 grahamje Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

define("BBCODE_UID_LEN", 10);

// global that holds loaded-and-prepared bbcode templates, so we only have to do
// that stuff once.

$bbcode_tpl = null;

/**
 * Loads bbcode templates from the bbcode.tpl file of the current template set.
 * Creates an array, keys are bbcode names like "b_open" or "url", values
 * are the associated template.
 * Probably pukes all over the place if there's something really screwed
 * with the bbcode.tpl file.
 *
 * Nathan Codding, Sept 26 2001.
 */
function load_bbcode_template()
{
	global $template;
	$tpl_filename = $template->make_filename('bbcode.tpl');
	$tpl = fread(fopen($tpl_filename, 'r'), filesize($tpl_filename));

	// replace \ with \\ and then ' with \'.
	$tpl = str_replace('\\', '\\\\', $tpl);
	$tpl  = str_replace('\'', '\\\'', $tpl);

	// strip newlines.
	$tpl  = str_replace("\n", '', $tpl);

	// Turn template blocks into PHP assignment statements for the values of $bbcode_tpls..
	$tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . '$bbcode_tpls[\'\\1\'] = \'\\2\';', $tpl);

	$bbcode_tpls = array();

	eval($tpl);

	return $bbcode_tpls;
}


/**
 * Prepares the loaded bbcode templates for insertion into preg_replace()
 * or str_replace() calls in the bbencode_second_pass functions. This
 * means replacing template placeholders with the appropriate preg backrefs
 * or with language vars. NOTE: If you change how the regexps work in
 * bbencode_second_pass(), you MUST change this function.
 *
 * Nathan Codding, Sept 26 2001
 *
 */
function prepare_bbcode_template($bbcode_tpl)
{
	global $lang;

	$bbcode_tpl['olist_open'] = str_replace('{LIST_TYPE}', '\\1', $bbcode_tpl['olist_open']);

	$bbcode_tpl['color_open'] = str_replace('{COLOR}', '\\1', $bbcode_tpl['color_open']);

	$bbcode_tpl['size_open'] = str_replace('{SIZE}', '\\1', $bbcode_tpl['size_open']);

	$bbcode_tpl['quote_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_open']);

	$bbcode_tpl['quote_username_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_username_open']);
	$bbcode_tpl['quote_username_open'] = str_replace('{L_WROTE}', $lang['wrote'], $bbcode_tpl['quote_username_open']);
	$bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\\1', $bbcode_tpl['quote_username_open']);

	$bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']);

	$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);

	// We do URLs in several different ways..
	$bbcode_tpl['url1'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']);
	$bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url1']);

	$bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
	$bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']);

	$bbcode_tpl['url3'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']);
	$bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url3']);

	$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
	$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']);

	$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);

	$bbcode_tpl['show'] = str_replace('{HTEXTE}', '\\1', $bbcode_tpl['show']);

	define("BBCODE_TPL_READY", true);

	return $bbcode_tpl;
}

function hide_in_quote($text)
{
        $text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","--- phpBB : The Protected Message is not copied in this quote ---", $text);
        return $text;
}

function bbencode_third_pass($text, $uid, $deprotect)
{
        global $bbcode_tpl;

        // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
        // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
        $text = " " . $text;

        // First: If there isn't a "[" and a "]" in the message, don't bother.
        if (! (strpos($text, "[") && strpos($text, "]")) )
        {
                // Remove padding, return.
                $text = substr($text, 1);
                return $text;
        }
        // Patterns and replacements for URL and email tags..
        $patterns = array();
        $replacements = array();
 
        if ( $deprotect ) {
        $patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
        $replacements[0] = $bbcode_tpl['show'];
        }
        else
        {
        $patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
        $replacements[0] = $bbcode_tpl['hide'];
        }

        $text = preg_replace($patterns, $replacements, $text);
 
        // Remove our padding from the string..
        $text = substr($text, 1);

        return $text;
}

/**
 * Does second-pass bbencoding. This should be used before displaying the message in
 * a thread. Assumes the message is already first-pass encoded, and we are given the
 * correct UID as used in first-pass encoding.
 */
function bbencode_second_pass($text, $uid)
{
	global $lang, $bbcode_tpl;

	$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);

	// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
	// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
	$text = " " . $text;

	// First: If there isn't a "[" and a "]" in the message, don't bother.
	if (! (strpos($text, "[") && strpos($text, "]")) )
	{
		// Remove padding, return.
		$text = substr($text, 1);
		return $text;
	}

	// Only load the templates ONCE..
	if (!defined("BBCODE_TPL_READY"))
	{
		// load templates from file into array.
		$bbcode_tpl = load_bbcode_template();

		// prepare array for use in regexps.
		$bbcode_tpl = prepare_bbcode_template($bbcode_tpl);
	}

	// [CODE] and 
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);

// [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff.
$text = str_replace("[quote:$uid]", $bbcode_tpl['quote_open'], $text);
$text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text);

// New one liner to deal with opening quotes with usernames...
// replaces the two line version that I had here before..
$text = preg_replace("/\[quote:$uid=\"(.*?)\"\]/si", $bbcode_tpl['quote_username_open'], $text);

//
  • and
    • for (un)ordered lists.
      // unordered lists
      $text = str_replace("[list:$uid]", $bbcode_tpl['ulist_open'], $text);
      // li tags
      $text = str_replace("[*:$uid]", $bbcode_tpl['listitem'], $text);
      // ending tags
      $text = str_replace("[/list:u:$uid]", $bbcode_tpl['ulist_close'], $text);
      $text = str_replace("[/list:o:$uid]", $bbcode_tpl['olist_close'], $text);
      // Ordered lists
      $text = preg_replace("/\
      • ):$uid\]/si", $bbcode_tpl['olist_open'], $text);

        // colours
        $text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$uid\]/si", $bbcode_tpl['color_open'], $text);
        $text = str_replace("[/color:$uid]", $bbcode_tpl['color_close'], $text);

        // size
        $text = preg_replace("/\[size=([1-2]?[0-9]):$uid\]/si", $bbcode_tpl['size_open'], $text);
        $text = str_replace("[/size:$uid]", $bbcode_tpl['size_close'], $text);


        // and for bolding text.
        $text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text);
        $text = str_replace("[/b:$uid]", $bbcode_tpl['b_close'], $text);

        // and for underlining text.
        $text = str_replace("[u:$uid]", $bbcode_tpl['u_open'], $text);
        $text = str_replace("[/u:$uid]", $bbcode_tpl['u_close'], $text);

        // and for italicizing text.
        $text = str_replace("[i:$uid]", $bbcode_tpl['i_open'], $text);
        $text = str_replace("[/i:$uid]", $bbcode_tpl['i_close'], $text);

        // Patterns and replacements for URL and email tags..
        $patterns = array();
        $replacements = array();

        // [img]image_url_here[/img] code..
        // This one gets first-passed..
        $patterns[] = "#\[img:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/img:$uid\]#i";
        $replacements[] = $bbcode_tpl['img'];

        // matches a [url]xxxx://www.phpbb.com[/url] code..
        $patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        $replacements[] = $bbcode_tpl['url1'];

        // www.phpbb.com code.. (no xxxx:// prefix).
        $patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        $replacements[] = $bbcode_tpl['url2'];

        // [url=xxxx://www.phpbb.com]phpBB[/url] code..
        $patterns[] = "#\+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        $replacements[] = $bbcode_tpl['url3'];

        // [url=www.phpbb.com]phpBB
        code.. (no xxxx:// prefix).
        $patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        $replacements[] = $bbcode_tpl['url4'];

        // user@domain.tld code..
        $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
        $replacements[] = $bbcode_tpl['email'];

        $text = preg_replace($patterns, $replacements, $text);

        // Remove our padding from the string..
        $text = substr($text, 1);

        return $text;

        } // bbencode_second_pass()

        // Need to initialize the random numbers only ONCE
        mt_srand( (double) microtime() * 1000000);

        function make_bbcode_uid()
        {
        // Unique ID for this message..

        $uid = dss_rand();
        $uid = substr($uid, 0, BBCODE_UID_LEN);

        return $uid;
        }

        function bbencode_first_pass($text, $uid)
        {
        // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
        // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
        $text = " " . $text;

        //

        Code: Select all

         and 
        for posting code (HTML, PHP, C etc etc) in your posts.
        $text = bbencode_first_pass_pda($text, $uid, '

        Code: Select all

        ', '
        ', '', true, '');

        // [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff.
        $text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, '');
        $text = bbencode_first_pass_pda($text, $uid, '/\[quote=\\\\"(.*?)\\\\"\]/is', '[/quote]', '', false, '', "[quote:$uid=\\\"\\1\\\"]");

        //
        • and
          • for (un)ordered lists.
            $open_tag = array();
            $open_tag[0] = "
            • ";

              // unordered..
              $text = bbencode_first_pass_pda($text, $uid, $open_tag, "
            ", "[/list:u]", false, 'replace_listitems');

            $open_tag[0] = "
            1. ";
              $open_tag[1] = "
              1. ";

                // ordered.
                $text = bbencode_first_pass_pda($text, $uid, $open_tag, "
              ", "[/list:o]", false, 'replace_listitems');

              // [color] and [/color] for setting text color
              $text = preg_replace("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "[color=\\1:$uid]\\2[/color:$uid]", $text);

              // [size] and [/size] for setting text size
              $text = preg_replace("#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si", "[size=\\1:$uid]\\2[/size:$uid]", $text);


              // and for bolding text.
              $text = preg_replace("#\[b\](.*?)\[/b\]#si", "[b:$uid]\\1[/b:$uid]", $text);

              // and for underlining text.
              $text = preg_replace("#\[u\](.*?)\[/u\]#si", "[u:$uid]\\1[/u:$uid]", $text);

              // and for italicizing text.
              $text = preg_replace("#\[i\](.*?)\[/i\]#si", "[i:$uid]\\1[/i:$uid]", $text);

              // [img]image_url_here[/img] code..
              $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
              //[hide]message[/hide]
              $text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[hide:$uid]\\1[/hide:$uid]", $text);

              // Remove our padding from the string..
              return substr($text, 1);;

              } // bbencode_first_pass()

              /**
              * $text - The text to operate on.
              * $uid - The UID to add to matching tags.
              * $open_tag - The opening tag to match. Can be an array of opening tags.
              * $close_tag - The closing tag to match.
              * $close_tag_new - The closing tag to replace with.
              * $mark_lowest_level - boolean - should we specially mark the tags that occur
              * at the lowest level of nesting? (useful for

              Code: Select all

              , because
               *						we need to match these tags first and transform HTML tags
               *						in their contents..
               * $func - This variable should contain a string that is the name of a function.
               *				That function will be called when a match is found, and passed 2
               *				parameters: ($text, $uid). The function should return a string.
               *				This is used when some transformation needs to be applied to the
               *				text INSIDE a pair of matching tags. If this variable is FALSE or the
               *				empty string, it will not be executed.
               * If open_tag is an array, then the pda will try to match pairs consisting of
               * any element of open_tag followed by close_tag. This allows us to match things
               * like [list=A]...[/list] and [list=1]...[/list] in one pass of the PDA.
               *
               * NOTES:	- this function assumes the first character of $text is a space.
               *				- every opening tag and closing tag must be of the [...] format.
               */
              function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_new, $mark_lowest_level, $func, $open_regexp_replace = false)
              {
              	$open_tag_count = 0;
              
              	if (!$close_tag_new || ($close_tag_new == ''))
              	{
              		$close_tag_new = $close_tag;
              	}
              
              	$close_tag_length = strlen($close_tag);
              	$close_tag_new_length = strlen($close_tag_new);
              	$uid_length = strlen($uid);
              
              	$use_function_pointer = ($func && ($func != ''));
              
              	$stack = array();
              
              	if (is_array($open_tag))
              	{
              		if (0 == count($open_tag))
              		{
              			// No opening tags to match, so return.
              			return $text;
              		}
              		$open_tag_count = count($open_tag);
              	}
              	else
              	{
              		// only one opening tag. make it into a 1-element array.
              		$open_tag_temp = $open_tag;
              		$open_tag = array();
              		$open_tag[0] = $open_tag_temp;
              		$open_tag_count = 1;
              	}
              
              	$open_is_regexp = false;
              
              	if ($open_regexp_replace)
              	{
              		$open_is_regexp = true;
              		if (!is_array($open_regexp_replace))
              		{
              			$open_regexp_temp = $open_regexp_replace;
              			$open_regexp_replace = array();
              			$open_regexp_replace[0] = $open_regexp_temp;
              		}
              	}
              
              	if ($mark_lowest_level && $open_is_regexp)
              	{
              		message_die(GENERAL_ERROR, "Unsupported operation for bbcode_first_pass_pda().");
              	}
              
              	// Start at the 2nd char of the string, looking for opening tags.
              	$curr_pos = 1;
              	while ($curr_pos && ($curr_pos < strlen($text)))
              	{
              		$curr_pos = strpos($text, "[", $curr_pos);
              
              		// If not found, $curr_pos will be 0, and the loop will end.
              		if ($curr_pos)
              		{
              			// We found a [. It starts at $curr_pos.
              			// check if it's a starting or ending tag.
              			$found_start = false;
              			$which_start_tag = "";
              			$start_tag_index = -1;
              
              			for ($i = 0; $i < $open_tag_count; $i++)
              			{
              				// Grab everything until the first "]"...
              				$possible_start = substr($text, $curr_pos, strpos($text, ']', $curr_pos + 1) - $curr_pos + 1);
              
              				//
              				// We're going to try and catch usernames with "[' characters.
              				//
              				if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) )
              				{
              					// OK we are in a quote tag that probably contains a ] bracket.
              					// Grab a bit more of the string to hopefully get all of it..
              					if ($close_pos = strpos($text, '"]', $curr_pos + 14))
              					{
              						if (strpos(substr($text, $curr_pos + 14, $close_pos - ($curr_pos + 14)), '[quote') === false)
              						{
              							$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 7);
              						}
              					}
              				}
              
              				// Now compare, either using regexp or not.
              				if ($open_is_regexp)
              				{
              					$match_result = array();
              					if (preg_match($open_tag[$i], $possible_start, $match_result))
              					{
              						$found_start = true;
              						$which_start_tag = $match_result[0];
              						$start_tag_index = $i;
              						break;
              					}
              				}
              				else
              				{
              					// straightforward string comparison.
              					if (0 == strcasecmp($open_tag[$i], $possible_start))
              					{
              						$found_start = true;
              						$which_start_tag = $open_tag[$i];
              						$start_tag_index = $i;
              						break;
              					}
              				}
              			}
              
              			if ($found_start)
              			{
              				// We have an opening tag.
              				// Push its position, the text we matched, and its index in the open_tag array on to the stack, and then keep going to the right.
              				$match = array("pos" => $curr_pos, "tag" => $which_start_tag, "index" => $start_tag_index);
              				array_push($stack, $match);
              				//
              				// Rather than just increment $curr_pos
              				// Set it to the ending of the tag we just found
              				// Keeps error in nested tag from breaking out
              				// of table structure..
              				//
              				$curr_pos += strlen($possible_start);
              			}
              			else
              			{
              				// check for a closing tag..
              				$possible_end = substr($text, $curr_pos, $close_tag_length);
              				if (0 == strcasecmp($close_tag, $possible_end))
              				{
              					// We have an ending tag.
              					// Check if we've already found a matching starting tag.
              					if (sizeof($stack) > 0)
              					{
              						// There exists a starting tag.
              						$curr_nesting_depth = sizeof($stack);
              						// We need to do 2 replacements now.
              						$match = array_pop($stack);
              						$start_index = $match['pos'];
              						$start_tag = $match['tag'];
              						$start_length = strlen($start_tag);
              						$start_tag_index = $match['index'];
              
              						if ($open_is_regexp)
              						{
              							$start_tag = preg_replace($open_tag[$start_tag_index], $open_regexp_replace[$start_tag_index], $start_tag);
              						}
              
              						// everything before the opening tag.
              						$before_start_tag = substr($text, 0, $start_index);
              
              						// everything after the opening tag, but before the closing tag.
              						$between_tags = substr($text, $start_index + $start_length, $curr_pos - $start_index - $start_length);
              
              						// Run the given function on the text between the tags..
              						if ($use_function_pointer)
              						{
              							$between_tags = $func($between_tags, $uid);
              						}
              
              						// everything after the closing tag.
              						$after_end_tag = substr($text, $curr_pos + $close_tag_length);
              
              						// Mark the lowest nesting level if needed.
              						if ($mark_lowest_level && ($curr_nesting_depth == 1))
              						{
              							if ($open_tag[0] == '[code]')
              							{
              								$code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#');
              								$code_entities_replace = array('<', '>', '"', '&#58;', '&#91;', '&#93;', '&#40;', '&#41;', '&#123;', '&#125;');
              								$between_tags = preg_replace($code_entities_match, $code_entities_replace, $between_tags);
              							}
              							$text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$curr_nesting_depth:$uid]";
              							$text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$curr_nesting_depth:$uid]";
              						}
              						else
              						{
              							if ($open_tag[0] == '[code]')
              							{
              								$text = $before_start_tag . '&#91;code&#93;';
              								$text .= $between_tags . '&#91;/code&#93;';
              							}
              							else
              							{
              								if ($open_is_regexp)
              								{
              									$text = $before_start_tag . $start_tag;
              								}
              								else
              								{
              									$text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]";
              								}
              								$text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]";
              							}
              						}
              
              						$text .= $after_end_tag;
              
              						// Now.. we've screwed up the indices by changing the length of the string.
              						// So, if there's anything in the stack, we want to resume searching just after it.
              						// otherwise, we go back to the start.
              						if (sizeof($stack) > 0)
              						{
              							$match = array_pop($stack);
              							$curr_pos = $match['pos'];
              //							bbcode_array_push($stack, $match);
              //							++$curr_pos;
              						}
              						else
              						{
              							$curr_pos = 1;
              						}
              					}
              					else
              					{
              						// No matching start tag found. Increment pos, keep going.
              						++$curr_pos;
              					}
              				}
              				else
              				{
              					// No starting tag or ending tag.. Increment pos, keep looping.,
              					++$curr_pos;
              				}
              			}
              		}
              	} // while
              
              	return $text;
              
              } // bbencode_first_pass_pda()
              
              /**
               * Does second-pass bbencoding of the [code] tags. This includes
               * running htmlspecialchars() over the text contained between
               * any pair of [code] tags that are at the first level of
               * nesting. Tags at the first level of nesting are indicated
               * by this format: [code:1:$uid] ... [/code:1:$uid]
               * Other tags are in this format: [code:$uid] ... [/code:$uid]
               */
              function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
              {
              	global $lang;
              
              	$code_start_html = $bbcode_tpl['code_open'];
              	$code_end_html =  $bbcode_tpl['code_close'];
              
              	// First, do all the 1st-level matches. These need an htmlspecialchars() run,
              	// so they have to be handled differently.
              	$match_count = preg_match_all("#\[code:1:$uid\](.*?)\[/code:1:$uid\]#si", $text, $matches);
              
              	for ($i = 0; $i < $match_count; $i++)
              	{
              		$before_replace = $matches[1][$i];
              		$after_replace = $matches[1][$i];
              
              		// Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
              		$after_replace = str_replace("  ", "&nbsp; ", $after_replace);
              		// now Replace 2 spaces with " &nbsp;" to catch odd #s of spaces.
              		$after_replace = str_replace("  ", " &nbsp;", $after_replace);
              
              		// Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
              		$after_replace = str_replace("\t", "&nbsp; &nbsp;", $after_replace);
              
              		// now Replace space occurring at the beginning of a line
              		$after_replace = preg_replace("/^ {1}/m", '&nbsp;', $after_replace);
              
              		$str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]";
              
              		$replacement = $code_start_html;
              		$replacement .= $after_replace;
              		$replacement .= $code_end_html;
              
              		$text = str_replace ($to_match, $replacement, $text);
              	}
              
              	// Now, do all the non-first-level matches. These are simple.
              	$text = str_replace("[code:$uid]", $code_start_html, $text);
              	$text = str_replace("[/code:$uid]", $code_end_html, $text);
              
              	return $text;
              
              } // bbencode_second_pass_code()
              
              /**
               * Rewritten by Nathan Codding - Feb 6, 2001.
               * - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking
               * 	to that URL
               * - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking
               * 	to http://www.xxxx.yyyy[/zzzz]
               * - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking
               *		to that email address
               * - Only matches these 2 patterns either after a space, or at the beginning of a line
               *
               * Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
               * have it require something like xxxx@yyyy.zzzz or such. We'll see.
               */
               function make_clickable($text)
              {
              	$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);
              
              	// pad it with a space so we can match things at the start of the 1st line.
              	$ret = ' ' . $text;
              
              	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
              	// xxxx can only be alpha characters.
              	// yyyy is anything up to the first space, newline, comma, double quote or <
              	$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
              
              	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
              	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
              	// zzzz is optional.. will contain everything up to the first space, newline,
              	// comma, double quote or <.
              	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
              
              	// matches an email@domain type address at the start of a line, or after a space.
              	// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
              	$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
              
              	// Remove our padding..
              	$ret = substr($ret, 1);
              
              	return($ret);
              }
              
              /**
               * Nathan Codding - Feb 6, 2001
               * Reverses the effects of make_clickable(), for use in editpost.
               * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.
               *
               */
              function undo_make_clickable($text)
              {
              	$text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text);
              	$text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text);
              
              	return $text;
              
              }
              
              /**
               * Nathan Codding - August 24, 2000.
               * Takes a string, and does the reverse of the PHP standard function
               * htmlspecialchars().
               */
              function undo_htmlspecialchars($input)
              {
              	$input = preg_replace("/>/i", ">", $input);
              	$input = preg_replace("/</i", "<", $input);
              	$input = preg_replace("/"/i", "\"", $input);
              	$input = preg_replace("/&/i", "&", $input);
              
              	return $input;
              }
              
              /**
               * This is used to change a [*] tag into a [*:$uid] tag as part
               * of the first-pass bbencoding of [list] tags. It fits the
               * standard required in order to be passed as a variable
               * function into bbencode_first_pass_pda().
               */
              function replace_listitems($text, $uid)
              {
              	$text = str_replace("[*]", "[*:$uid]", $text);
              
              	return $text;
              }
              
              /**
               * Escapes the "/" character with "\/". This is useful when you need
               * to stick a runtime string into a PREG regexp that is being delimited
               * with slashes.
               */
              function escape_slashes($input)
              {
              	$output = str_replace('/', '\/', $input);
              	return $output;
              }
              
              /**
               * This function does exactly what the PHP4 function array_push() does
               * however, to keep phpBB compatable with PHP 3 we had to come up with our own
               * method of doing it.
               * This function was deprecated in phpBB 2.0.18
               */
              function bbcode_array_push(&$stack, $value)
              {
                 $stack[] = $value;
                 return(sizeof($stack));
              }
              
              /**
               * This function does exactly what the PHP4 function array_pop() does
               * however, to keep phpBB compatable with PHP 3 we had to come up with our own
               * method of doing it.
               * This function was deprecated in phpBB 2.0.18
               */
              function bbcode_array_pop(&$stack)
              {
                 $arrSize = count($stack);
                 $x = 1;
              
                 while(list($key, $val) = each($stack))
                 {
                    if($x < count($stack))
                    {
              	 		$tmpArr[] = $val;
                    }
                    else
                    {
              	 		$return_val = $val;
                    }
                    $x++;
                 }
                 $stack = $tmpArr;
              
                 return($return_val);
              }
              
              //
              // Smilies code ... would this be better tagged on to the end of bbcode.php?
              // Probably so and I'll move it before B2
              //
              function smilies_pass($message)
              {
              	static $orig, $repl;
              
              	if (!isset($orig))
              	{
              		global $db, $board_config;
              		$orig = $repl = array();
              
              		$sql = 'SELECT * FROM ' . SMILIES_TABLE;
              		if( !$result = $db->sql_query($sql) )
              		{
              			message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
              		}
              		$smilies = $db->sql_fetchrowset($result);
              
              		if (count($smilies))
              		{
              			usort($smilies, 'smiley_sort');
              		}
              
              		for ($i = 0; $i < count($smilies); $i++)
              		{
              			$orig[] = "/(?<=.\W|\W.|^\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
              			$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
              		}
              	}
              
              	if (count($orig))
              	{
              		$message = preg_replace($orig, $repl, ' ' . $message . ' ');
              		$message = substr($message, 1, -1);
              	}
              
              	return $message;
              }
              
              function smiley_sort($a, $b)
              {
              	if ( strlen($a['code']) == strlen($b['code']) )
              	{
              		return 0;
              	}
              
              	return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1;
              }
              
              ?>

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 2:43 pm
by Brf
The bbcode buttons have nothing to do with bbcode.php. Those buttons are in posting_body.tpl

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 2:47 pm
by orij1nal
yeah I figured,

heres my posting_body.tpl

Code: Select all

<script language="JavaScript" type="text/javascript">
<!--
// bbCode control by
// subBlue design
// www.subBlue.com

// Startup variables
var imageTag = false;
var theSelection = false;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

// Helpline messages
b_help = "{L_BBCODE_B_HELP}";
i_help = "{L_BBCODE_I_HELP}";
u_help = "{L_BBCODE_U_HELP}";
q_help = "{L_BBCODE_Q_HELP}";
c_help = "{L_BBCODE_C_HELP}";
l_help = "{L_BBCODE_L_HELP}";
o_help = "{L_BBCODE_O_HELP}";
p_help = "{L_BBCODE_P_HELP}";
w_help = "{L_BBCODE_W_HELP}";
a_help = "{L_BBCODE_A_HELP}";
s_help = "{L_BBCODE_S_HELP}";
f_help = "{L_BBCODE_F_HELP}";
h_help = "Hide: [hide]message[/hide] (alt+h)";  


// Define the bbCode tags
bbcode = new Array();
Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','','[hide]','[/hide]');imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
document.post.helpbox.value = eval(help + "_help");
}


// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray == "undefined") || (thearray == "") || (thearray == null))
return i;
}
return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}


function checkForm() {

formErrors = false;

if (document.post.message.value.length < 2) {
formErrors = "{L_EMPTY_MESSAGE}";
}

if (formErrors) {
alert(formErrors);
return false;
} else {
bbstyle(-1);
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}

function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}

function bbfontstyle(bbopen, bbclose) {
var txtarea = document.post.message;

if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
txtarea.value += bbopen + bbclose;
txtarea.focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
txtarea.focus();
return;
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbopen, bbclose);
return;
}
else
{
txtarea.value += bbopen + bbclose;
txtarea.focus();
}
storeCaret(txtarea);
}


function bbstyle(bbnumber) {
var txtarea = document.post.message;

txtarea.focus();
donotinsert = false;
theSelection = false;
bblast = 0;

if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false; // All tags are closed including image tags :D
txtarea.focus();
return;
}

if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
txtarea.focus();
theSelection = '';
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
return;
}

// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}

if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
imageTag = false;
}
txtarea.focus();
return;
} else { // Open tags

if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
txtarea.value += bbtags[15];
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.post.addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}

// Open tag
txtarea.value += bbtags[bbnumber];
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
arraypush(bbcode,bbnumber+1);
eval('document.post.addbbcode'+bbnumber+'.value += "*"');
txtarea.focus();
return;
}
storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;

var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/vie ... 52/fid/130
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

//-->
</script>

<!-- BEGIN privmsg_extensions -->
<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
<tr>
<td valign="top" align="center" width="100%">
<table height="40" cellspacing="2" cellpadding="2" border="0">
<tr valign="middle">
<td>{INBOX_IMG}</td>
<td><span class="cattitle">{INBOX_LINK}&nbsp;&nbsp;</span></td>
<td>{SENTBOX_IMG}</td>
<td><span class="cattitle">{SENTBOX_LINK}&nbsp;&nbsp;</span></td>
<td>{OUTBOX_IMG}</td>
<td><span class="cattitle">{OUTBOX_LINK}&nbsp;&nbsp;</span></td>
<td>{SAVEBOX_IMG}</td>
<td><span class="cattitle">{SAVEBOX_LINK}&nbsp;&nbsp;</span></td>
</tr>
</table>
</td>
</tr>
</table>

<br clear="all" />
<!-- END privmsg_extensions -->

<form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)">

{POST_PREVIEW_BOX}
{ERROR_BOX}

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
<!-- BEGIN switch_not_privmsg -->
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a> <!-- ENDIF -->


|| <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
<!-- END switch_not_privmsg -->
</tr>
</table>

<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumborder">
<tr>
<th class="forumtitle" colspan="2"><b>{L_POST_A}</b></th>
</tr>
<!-- BEGIN switch_username_select -->
<tr>
<td class="row1"><span class="gen"><b>{L_USERNAME}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" class="post" tabindex="1" name="username" size="25" maxlength="25" value="{USERNAME}" /></span></td>
</tr>
<!-- END switch_username_select -->
<!-- BEGIN switch_privmsg -->
<tr>
<td class="row1"><span class="gen"><b>{L_USERNAME}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" class="post" name="username" maxlength="25" size="25" tabindex="1" value="{USERNAME}" />&nbsp;<input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></span></td>
</tr>
<!-- END switch_privmsg -->
<tr>
<td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td>
<td class="row2" width="78%"> <span class="gen">
<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
</span> </td>
</tr>
<tr>
<td class="row1" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td><span class="gen"><b>{L_MESSAGE_BODY}</b></span> </td>
</tr>
<tr>
<td valign="middle" align="center"> <br />
<table width="100" border="0" cellspacing="0" cellpadding="5">
<tr align="center">
<td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>
</tr>
<!-- BEGIN smilies_row -->
<tr align="center" valign="middle">
<!-- BEGIN smilies_col -->
<td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
<!-- END smilies_col -->
</tr>
<!-- END smilies_row -->
<!-- BEGIN switch_smilies_extra -->
<tr align="center">
<td colspan="{S_SMILIES_COLSPAN}"><span class="nav"><a href="{U_MORE_SMILIES}" class="grey" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=250');return false;" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td>
</tr>
<!-- END switch_smilies_extra -->
</table>
</td>
</tr>
</table>
</td>
<td class="row2" valign="top"><span class="gen"> <span class="genmed"> </span>
<table width="450" border="0" cellspacing="0" cellpadding="2">
<tr align="center" valign="middle">
<td><span class="genmed">
<input type="button" class="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onClick="bbstyle(0)" onMouseOver="helpline('b')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onClick="bbstyle(2)" onMouseOver="helpline('i')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onClick="bbstyle(4)" onMouseOver="helpline('u')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onClick="bbstyle(6)" onMouseOver="helpline('q')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onClick="bbstyle(8)" onMouseOver="helpline('c')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onClick="bbstyle(10)" onMouseOver="helpline('l')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onClick="bbstyle(12)" onMouseOver="helpline('o')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onClick="bbstyle(14)" onMouseOver="helpline('p')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="h" name="addbbcode18" value="Hide" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td>

</tr>
<tr>
<td colspan="9">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="genmed"> &nbsp;{L_FONT_COLOR}:
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">
<option style="color:black; background-color: {T_TD_COLOR1}" value="{T_FONTCOLOR1}" class="genmed">{L_COLOR_DEFAULT}</option>
<option style="color:darkred; background-color: {T_TD_COLOR1}" value="darkred" class="genmed">{L_COLOR_DARK_RED}</option>
<option style="color:red; background-color: {T_TD_COLOR1}" value="red" class="genmed">{L_COLOR_RED}</option>
<option style="color:orange; background-color: {T_TD_COLOR1}" value="orange" class="genmed">{L_COLOR_ORANGE}</option>
<option style="color:brown; background-color: {T_TD_COLOR1}" value="brown" class="genmed">{L_COLOR_BROWN}</option>
<option style="color:yellow; background-color: {T_TD_COLOR1}" value="yellow" class="genmed">{L_COLOR_YELLOW}</option>
<option style="color:green; background-color: {T_TD_COLOR1}" value="green" class="genmed">{L_COLOR_GREEN}</option>
<option style="color:olive; background-color: {T_TD_COLOR1}" value="olive" class="genmed">{L_COLOR_OLIVE}</option>
<option style="color:cyan; background-color: {T_TD_COLOR1}" value="cyan" class="genmed">{L_COLOR_CYAN}</option>
<option style="color:blue; background-color: {T_TD_COLOR1}" value="blue" class="genmed">{L_COLOR_BLUE}</option>
<option style="color:darkblue; background-color: {T_TD_COLOR1}" value="darkblue" class="genmed">{L_COLOR_DARK_BLUE}</option>
<option style="color:indigo; background-color: {T_TD_COLOR1}" value="indigo" class="genmed">{L_COLOR_INDIGO}</option>
<option style="color:violet; background-color: {T_TD_COLOR1}" value="violet" class="genmed">{L_COLOR_VIOLET}</option>
<option style="color:white; background-color: {T_TD_COLOR1}" value="white" class="genmed">{L_COLOR_WHITE}</option>
<option style="color:black; background-color: {T_TD_COLOR1}" value="black" class="genmed">{L_COLOR_BLACK}</option>
</select> &nbsp;{L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
<option value="7" class="genmed">{L_FONT_TINY}</option>
<option value="9" class="genmed">{L_FONT_SMALL}</option>
<option value="12" selected class="genmed">{L_FONT_NORMAL}</option>
<option value="18" class="genmed">{L_FONT_LARGE}</option>
<option value="24" class="genmed">{L_FONT_HUGE}</option>
</select>
</span></td>
<td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onMouseOver="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="9"> <span class="gensmall">
<input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" />
</span></td>
</tr>
<tr>
<td colspan="9"><span class="gen">
<textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>
</span></td>
</tr>
</table>
</span></td>
</tr>
<tr>
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span><br /><span class="gensmall">{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
<td class="row2"><span class="gen"> </span>
<table cellspacing="0" cellpadding="1" border="0">
<!-- BEGIN switch_html_checkbox -->
<tr>
<td>
<input type="checkbox" name="disable_html" {S_HTML_CHECKED} />
</td>
<td><span class="gen">{L_DISABLE_HTML}</span></td>
</tr>
<!-- END switch_html_checkbox -->
<!-- BEGIN switch_bbcode_checkbox -->
<tr>
<td>
<input type="checkbox" name="disable_bbcode" {S_BBCODE_CHECKED} />
</td>
<td><span class="gen">{L_DISABLE_BBCODE}</span></td>
</tr>
<!-- END switch_bbcode_checkbox -->
<!-- BEGIN switch_smilies_checkbox -->
<tr>
<td>
<input type="checkbox" name="disable_smilies" {S_SMILIES_CHECKED} />
</td>
<td><span class="gen">{L_DISABLE_SMILIES}</span></td>
</tr>
<!-- END switch_smilies_checkbox -->
<!-- BEGIN switch_signature_checkbox -->
<tr>
<td>
<input type="checkbox" name="attach_sig" {S_SIGNATURE_CHECKED} />
</td>
<td><span class="gen">{L_ATTACH_SIGNATURE}</span></td>
</tr>
<!-- END switch_signature_checkbox -->
<!-- BEGIN switch_notify_checkbox -->
<tr>
<td>
<input type="checkbox" name="notify" {S_NOTIFY_CHECKED} />
</td>
<td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td>
</tr>
<!-- END switch_notify_checkbox -->
<!-- BEGIN switch_delete_checkbox -->
<tr>
<td>
<input type="checkbox" name="delete" />
</td>
<td><span class="gen">{L_DELETE_POST}</span></td>
</tr>
<!-- END switch_delete_checkbox -->
<!-- BEGIN switch_type_toggle -->
<tr>
<td></td>
<td><span class="gen">{S_TYPE_TOGGLE}</span></td>
</tr>
<!-- END switch_type_toggle -->
</table>
</td>
</tr>
{POLLBOX}
<tr>
<td class="menu" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" />&nbsp;<input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>
</tr>
</table>

<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
</form>

<table width="100%" cellspacing="2" border="0" align="center">
<tr>
<td valign="top" align="right">{JUMPBOX}</td>
</tr>
</table>

{TOPIC_REVIEW_BOX}
[/code]

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 2:53 pm
by Brf
Here is your problem:

Code: Select all

Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','','[hide]','[/hide]');imageTag = false;[/code]
should be

Code: Select all

bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','','[hide]','[/hide]');
imageTag = false;[/code]

Re: bbcode buttons don't work

Posted: Wed Aug 22, 2007 2:57 pm
by orij1nal
thanks a lot for the help, made a stupid mistake lol :)