diff options
-rw-r--r-- | build/build.xml | 10 | ||||
-rwxr-xr-x | build/build_changelog.php | 53 | ||||
-rw-r--r-- | phpBB/adm/style/editor.js | 68 | ||||
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 2 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 11 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 9 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 | ||||
-rw-r--r-- | phpBB/posting.php | 7 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/editor.js | 81 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/editor.js | 96 | ||||
-rw-r--r-- | phpBB/viewforum.php | 9 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 9 |
13 files changed, 219 insertions, 140 deletions
diff --git a/build/build.xml b/build/build.xml index 18b03243c2..bf4c97297b 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ <project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <!-- a few settings for the build --> - <property name="newversion" value="3.0.10-RC2" /> + <property name="newversion" value="3.0.10-RC3" /> <property name="prevversion" value="3.0.9" /> - <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.10-RC1" /> + <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.10-RC1, 3.0.10-RC2" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> @@ -138,6 +138,12 @@ save/save_${prevversion}_to_${newversion}/phpbb-${prevversion}_to_${newversion}_git_diffstat.txt" /> </target> + <target name="changelog" depends="prepare"> + <exec dir="build" escape="false" + command="php -f build_changelog.php '${newversion}' > + save/changelog_${newversion}.html" /> + </target> + <!-- This target can be called using phingcall to retrieve a clean checkout of a commit from git. It will only export the phpBB directory. diff --git a/build/build_changelog.php b/build/build_changelog.php new file mode 100755 index 0000000000..4eb5ebd83b --- /dev/null +++ b/build/build_changelog.php @@ -0,0 +1,53 @@ +#!/usr/bin/env php +<?php +/** +* +* @package build +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU General Public License +* +*/ + +if ($_SERVER['argc'] != 2) +{ + echo "Please specify the new version as argument (e.g. build_changelog.php '1.0.2').\n"; + exit(1); +} + +$fixVersion = $_SERVER['argv'][1]; + +$query = 'project = PHPBB3 + AND resolution = Fixed + AND fixVersion = "' . $fixVersion . '" + AND status IN ("Unverified Fix", Closed)'; + +$url = 'http://tracker.phpbb.com/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=' . urlencode($query) . '&tempMax=1000'; +$xml = simplexml_load_string(file_get_contents($url)); + +foreach ($xml->xpath('//item') as $item) +{ + $key = (string) $item->key; + + $keyUrl = 'http://tracker.phpbb.com/browse/' . $key; + $keyLink = '<a href="' . $keyUrl . '">' . $key . '</a>'; + + $value = str_replace($key, $keyLink, htmlspecialchars($item->title)); + $value = str_replace(']', '] -', $value); + + $types[(string) $item->type][$key] = $value; +} + +ksort($types); +foreach ($types as $type => $tickets) +{ + echo "<h4>$type</h4>\n"; + echo "<ul>\n"; + + uksort($tickets, 'strnatcasecmp'); + + foreach ($tickets as $ticket) + { + echo "<li>$ticket</li>\n"; + } + echo "</ul>\n"; +} diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 600fa254cf..217aa699e2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; if(document.forms[form_name]) @@ -66,7 +66,7 @@ function bbstyle(bbnumber) else { insert_text('[*]'); - document.forms[form_name].elements[text_name].focus(); + document.forms[form_name].elements[text_name].focus(); } } @@ -76,7 +76,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -84,10 +84,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -98,10 +102,10 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; - var new_pos = caret_pos + bbopen.length; + var new_pos = caret_pos + bbopen.length; // Open tag insert_text(bbopen + bbclose); @@ -112,12 +116,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", bbopen.length); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -132,7 +136,7 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - + if (!popup) { textarea = document.forms[form_name].elements[text_name]; @@ -155,18 +159,18 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } - + } + else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); } var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; - + } else { @@ -229,7 +233,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(/<br\/>/ig, '\n'); theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); - theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/&\;/ig, '&'); theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) @@ -264,7 +268,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -288,17 +292,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -334,7 +328,7 @@ function colorPalette(dir, width, height) { document.writeln('<tr>'); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -374,9 +368,9 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if (txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; @@ -390,19 +384,19 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; - caretPos.end = txtarea.sel_start; + caretPos.end = txtarea.sel_start; } return caretPos; diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 39d3e24b13..a4bbfb7d7f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -178,7 +178,7 @@ <h4>Improvement</h4> <ul> <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8616">PHPBB3-8616</a>] - Add direct link to PM to notification message</li> -<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9036">PHPBB3-9036</a>] - Forums that can be listed but not red expose forum information</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9036">PHPBB3-9036</a>] - Forums that can be listed but not read expose forum information</li> <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9297">PHPBB3-9297</a>] - Add support for Extended Passive Mode (EPSV) in class ftp_fsock to better support IPv6 connections.</li> <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9307">PHPBB3-9307</a>] - Mass email $max_chunk_size</li> <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9361">PHPBB3-9361</a>] - Edit account settings - Improved clarification needed</li> diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 2ade1ac95e..3a798fc1ce 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-RC2'); +define('PHPBB_VERSION', '3.0.10-RC3'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7ce83b871a..01b3ca92a9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4378,7 +4378,7 @@ function phpbb_http_login($param) */ function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') { - global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path; + global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; if (defined('HEADER_INC')) { @@ -4531,6 +4531,15 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 $s_search_hidden_fields['sid'] = $_SID; } + if (!empty($_EXTRA_URL)) + { + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } + } + // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( 'SITENAME' => $config['sitename'], diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index bbc4261adc..eeadc9f862 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-RC2'); +define('UPDATES_TO_VERSION', '3.0.10-RC3'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -989,7 +989,8 @@ function database_update_info() '3.0.9' => array(), // No changes from 3.0.10-RC1 to 3.0.10-RC2 '3.0.10-RC1' => array(), - + // No changes from 3.0.10-RC2 to 3.0.10-RC3 + '3.0.10-RC2' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); @@ -2013,6 +2014,10 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.10-RC1 to 3.0.10-RC2 case '3.0.10-RC1': break; + + // No changes from 3.0.10-RC2 to 3.0.10-RC3 + case '3.0.10-RC2': + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5cbaba3d1f..eb90d3a06d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC2'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/posting.php b/phpBB/posting.php index ea3b53e939..76c8100c78 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -895,7 +895,7 @@ if ($submit || $preview || $refresh) $message_parser->parse_poll($poll); - $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : ''; + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; /* We reset votes, therefore also allow removing options @@ -918,7 +918,8 @@ if ($submit || $preview || $refresh) 'poll_options' => array(), ); - $post_data['poll_options'] = $post_data['poll_title'] = ''; + $post_data['poll_options'] = array(); + $post_data['poll_title'] = ''; $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; } else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != '')) @@ -934,7 +935,7 @@ if ($submit || $preview || $refresh) $message_parser->parse_poll($poll); - $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : ''; + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; } else diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 5aa486d320..cfdb54f54b 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -37,7 +37,7 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -86,10 +86,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -100,10 +104,10 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; - var new_pos = caret_pos + bbopen.length; + var new_pos = caret_pos + bbopen.length; // Open tag insert_text(bbopen + bbclose); @@ -114,12 +118,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -134,16 +138,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -161,7 +165,7 @@ function insert_text(text, spaces, popup) } else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); @@ -174,7 +178,7 @@ function insert_text(text, spaces, popup) { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); } @@ -291,7 +295,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -319,7 +323,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -343,17 +347,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -389,7 +383,7 @@ function colorPalette(dir, width, height) { document.writeln('<tr>'); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -429,35 +423,36 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if(txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if (document.selection) + else if(document.selection) { + // get current selection var range = document.selection.createRange(); // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; - caretPos.end = txtarea.sel_start; + caretPos.end = txtarea.sel_start; } return caretPos; diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 5aa486d320..7cc5de9034 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -6,8 +6,8 @@ // Startup variables 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 @@ -15,6 +15,7 @@ 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; /** @@ -28,8 +29,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -37,15 +38,14 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } var textarea = doc.forms[form_name].elements[text_name]; - if (is_ie && typeof(baseHeight) != 'number') - { + { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -78,7 +78,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -86,10 +86,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -100,7 +104,7 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; var new_pos = caret_pos + bbopen.length; @@ -114,12 +118,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -134,16 +138,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -158,26 +162,28 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } + } + else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); - } - + } var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; + } else { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); - } + } + } /** @@ -273,6 +279,7 @@ function addquote(post_id, username, l_wrote) return; } + function split_lines(text) { var lines = text.split('\n'); @@ -291,7 +298,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -309,6 +316,7 @@ function split_lines(text) } return splitLines; } + /** * From http://www.massless.org/mozedit/ */ @@ -319,7 +327,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -343,17 +351,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -389,7 +387,7 @@ function colorPalette(dir, width, height) { document.writeln('<tr>'); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -429,15 +427,15 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if(txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if (document.selection) + else if(document.selection) { // get current selection var range = document.selection.createRange(); @@ -445,16 +443,16 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; caretPos.end = txtarea.sel_start; diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 8a6b777bea..588f60b589 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -273,6 +273,15 @@ if ($_SID) $s_search_hidden_fields['sid'] = $_SID; } +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + $template->assign_vars(array( 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index df631a474c..01cd6a28a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -602,6 +602,15 @@ if ($_SID) $s_search_hidden_fields['sid'] = $_SID; } +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, |