From be51bbe42b3ca03fe2dcc57205ab5853bf5955cd Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 22 Jul 2009 16:39:26 +0000 Subject: [PATCH] fall back to bbcode-less quotes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9835 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 10 +++- phpBB/styles/prosilver/template/editor.js | 51 ++++++++++++++++++- .../template/posting_topic_review.html | 5 ++ 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 53746437ba..9f7fefd81c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1187,7 +1187,15 @@ $message_parser->decode_message($post_data['bbcode_uid']); if ($mode == 'quote' && !$submit && !$preview && !$refresh) { - $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + if ($config['allow_bbcode']) + { + $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + } + else + { + $message = '> ' . utf8_wordwrap(censor_text(trim($message_parser->message)), 75, "\n> "); + $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n"; + } } if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 9610cf91d1..639b87e3ee 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -7,6 +7,7 @@ var imageTag = false; var theSelection = false; +var bbcodeEnabled = true; // 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 @@ -14,7 +15,6 @@ var clientVer = parseInt(navigator.appVersion); // Get browser version var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1)); var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); - var baseHeight; /** @@ -250,12 +250,59 @@ function addquote(post_id, username) if (theSelection) { - insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + if (bbcodeEnabled) + { + insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + } + else + { + var lines = split_lines(theSelection); + for (i = 0; i < lines.length; i++) + { + insert_text('> ' + lines[i] + '\n') + } + } } return; } +function split_lines(text) +{ + var lines = text.split('\n'); + var splitLines = new Array(); + var j = 0; + for(i = 0; i < lines.length; i++) + { + if (lines[i].length <= 80) + { + splitLines[j] = lines[i]; + j++; + } + else + { + var line = lines[i]; + do + { + var splitAt = line.indexOf(' ', 80); + + if (splitAt == -1) + { + splitLines[j] = line; + j++ + } + else + { + splitLines[j] = line.substring(0, splitAt); + line = line.substring(splitAt); + j++; + } + } + while(splitAt != -1) + } + } + return splitLines; +} /** * From http://www.massless.org/mozedit/ */ diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 428a830ef3..a408b54185 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -5,6 +5,11 @@
+