From 851f8cc3206818e4df961f1d900492d242a7ef2e Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Tue, 13 Nov 2007 07:38:55 +0000 Subject: [PATCH] Bugfix: internal link detection was failing. Also added support for [link=url rel=internal] for overriding default preference. --- e107_files/bbcode/link.bb | 11 +++++++++-- e107_handlers/bbcode_handler.php | 8 +++++--- e107_handlers/e_parse_class.php | 20 ++++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/e107_files/bbcode/link.bb b/e107_files/bbcode/link.bb index cc742b53a..aeca5ace6 100644 --- a/e107_files/bbcode/link.bb +++ b/e107_files/bbcode/link.bb @@ -12,6 +12,7 @@ global $pref; [link=external=http://mysite.com]My text[/link] */ + $parm = trim($parm); /* Fix for people using link=external= */ @@ -38,8 +39,14 @@ global $pref; $extras = "rel=external"; } - $insert = (($pref['links_new_window'] || $extras == "external" || strpos($extras,"rel=external")!==FALSE) && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#") ? "rel='external' " : ""; - + if($extras == "external" || strpos($extras,"rel=external")!==FALSE) + { + $insert = "rel='external' "; + } + else + { + $insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : ""; + } if (strtolower(substr($link,0,11)) == 'javascript:') return ''; return "".$code_text.""; diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index 01ada6ce3..df147bb55 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $ -| $Revision: 1.12 $ -| $Date: 2007-11-13 07:34:40 $ +| $Revision: 1.13 $ +| $Date: 2007-11-13 07:38:55 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -66,6 +66,7 @@ class e_bbcode global $postID; $postID = $p_ID; + if (strlen($value) <= 6) return $value; // Don't waste time on trivia! if ($force_lower == 'default') $force_lower = TRUE; // Set the default behaviour if not overridden $code_stack = array(); // Stack for unprocessed bbcodes and text @@ -254,7 +255,8 @@ class e_bbcode { global $tp, $postID, $code_text, $parm; $parm = $param1; - $code_text = $tp->replaceConstants($code_text_par); + + $code_text = $code_text_par; if (E107_DEBUG_LEVEL) { diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index a4a57abfd..87523ee0c 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $ -| $Revision: 1.21 $ -| $Date: 2007-11-10 19:24:42 $ -| $Author: mcfly_e107 $ +| $Revision: 1.22 $ +| $Date: 2007-11-13 07:38:55 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } @@ -475,11 +475,7 @@ class e_parse } - // replace all {e_XXX} constants with their e107 value - if ($opts['constants']) - { - $text = $this->replaceConstants($text); - } + if ($opts['no_tags']) { @@ -562,6 +558,8 @@ class e_parse } + + // Start parse [bb][/bb] codes if ($parseBB === TRUE) { @@ -574,6 +572,12 @@ class e_parse // End parse [bb][/bb] codes + // replace all {e_XXX} constants with their e107 value AFTER the bbcodes have been parsed. + if ($opts['constants']) + { + $text = $this->replaceConstants($text); + } + // profanity filter if ($pref['profanity_filter']) { if (!is_object($this->e_pf)) {