aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_ext_list.html4
-rw-r--r--phpBB/docs/INSTALL.html6
-rw-r--r--phpBB/docs/events.md12
-rw-r--r--phpBB/download/file.php2
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/info/acp_logs.php27
-rw-r--r--phpBB/includes/functions_content.php2
-rw-r--r--phpBB/includes/functions_display.php4
-rw-r--r--phpBB/includes/functions_posting.php2
-rw-r--r--phpBB/includes/functions_user.php12
-rw-r--r--phpBB/includes/mcp/mcp_main.php2
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php4
-rw-r--r--phpBB/includes/ucp/ucp_profile.php2
-rw-r--r--phpBB/language/en/help/bbcode.php2
-rw-r--r--phpBB/phpbb/event/php_exporter.php4
-rw-r--r--phpBB/phpbb/template/base.php8
-rw-r--r--phpBB/phpbb/template/context.php152
-rw-r--r--phpBB/phpbb/template/template.php17
-rw-r--r--phpBB/posting.php17
-rw-r--r--phpBB/styles/prosilver/template/display_options.html2
-rw-r--r--phpBB/styles/prosilver/template/forumlist_body.html4
-rw-r--r--phpBB/styles/prosilver/template/jumpbox.html2
-rw-r--r--phpBB/styles/prosilver/template/pagination.html4
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css19
-rw-r--r--phpBB/styles/prosilver/theme/colours.css7
-rw-r--r--phpBB/styles/prosilver/theme/stylesheet.css24
-rw-r--r--phpBB/viewforum.php6
-rw-r--r--phpBB/viewonline.php4
-rw-r--r--phpBB/viewtopic.php14
-rw-r--r--tests/bbcode/parser_test.php5
-rw-r--r--tests/event/fixtures/trigger_many_vars.test2
-rw-r--r--tests/template/template_test.php168
33 files changed, 428 insertions, 116 deletions
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html
index ccc39ea76d..af9e00a614 100644
--- a/phpBB/adm/style/acp_ext_list.html
+++ b/phpBB/adm/style/acp_ext_list.html
@@ -48,7 +48,7 @@
</tr>
<!-- BEGIN enabled -->
<tr class="ext_enabled row-highlight">
- <td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong></td>
+ <td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_enabled_name_after --></td>
<td style="text-align: center;">
<!-- IF enabled.S_VERSIONCHECK -->
<strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong>
@@ -73,7 +73,7 @@
</tr>
<!-- BEGIN disabled -->
<tr class="ext_disabled row-highlight">
- <td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong></td>
+ <td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_disabled_name_after --></td>
<td style="text-align: center;">
<!-- IF disabled.S_VERSIONCHECK -->
<strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong>
diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html
index 748ae69cf7..704a9f13a7 100644
--- a/phpBB/docs/INSTALL.html
+++ b/phpBB/docs/INSTALL.html
@@ -265,7 +265,7 @@
<p>If you are currently using a stable release of phpBB, updating to this version is straightforward. You would have downloaded one of four packages and your choice determines what you need to do. <strong>Note</strong>: Before updating, we heavily recommend you do a <em>full backup of your database and existing phpBB files</em>! If you are unsure how to achieve this please ask your hosting provider for advice.</p>
-<p><strong>Please make sure you update your phpBB source files too, even if you run the <code>database_update.php</code> file.</strong> If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
+<p><strong>Please make sure you update your phpBB source files too, even if you just run the database updater.</strong> If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
<a name="update_full"></a><h3>4.i. Full package</h3>
@@ -285,7 +285,7 @@
<p>The directory structure has been preserved, enabling you (if you wish) to simply upload the uncompressed contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any modifications (MODs) these files will overwrite the originals, possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.</p>
- <p>As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
+ <p>As for the other update procedures, you should go to <code>/install/app.php/update</code>, select "Update database only" and submit the page after you have finished updating the files. This will update your database schema and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
<a name="update_patch"></a><h3>4.iii. Patch file</h3>
@@ -297,7 +297,7 @@
<p>If you do get failures, you should look at using the <a href="#update_files">Changed Files</a> package to replace the files which failed to patch. Please note that you will need to manually re-add any MODs to these particular files. Alternatively, if you know how, you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p>
- <p>You should, of course, delete the patch file (or files) after use. As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
+ <p>You should, of course, delete the patch file (or files) after use. As for the other update procedures, you should navigate to <code>/install/app.php/update</code>, select "Update database only" and submit the page after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p>
<a name="update_auto"></a><h3>4.iv. Automatic update package</h3>
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index ce77c63397..9b0d70b46b 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -64,12 +64,24 @@ acp_ext_details_end
* Since: 3.1.11-RC1
* Purpose: Add more detailed information on extension after the available information.
+acp_ext_list_disabled_name_after
+===
+* Location: adm/style/acp_ext_list.html
+* Since: 3.1.11-RC1
+* Purpose: Add content after the name of disabled extensions in the list
+
acp_ext_list_disabled_title_after
===
* Location: adm/style/acp_ext_list.html
* Since: 3.1.11-RC1
* Purpose: Add text after disabled extensions section title.
+acp_ext_list_enabled_name_after
+===
+* Location: adm/style/acp_ext_list.html
+* Since: 3.1.11-RC1
+* Purpose: Add content after the name of enabled extensions in the list
+
acp_ext_list_enabled_title_after
===
* Location: adm/style/acp_ext_list.html
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index 7a20145968..a9cd4a3b3c 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -272,7 +272,7 @@ else
* @var string mode Download mode
* @var bool thumbnail Flag indicating if the file is a thumbnail
* @since 3.1.6-RC1
- * @change 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
+ * @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
*/
$vars = array(
'attach_id',
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 1f9c15dbd0..05a8b79137 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -323,7 +323,7 @@ class acp_board
'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false),
'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
- 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true),
+ 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
'cookie_notice' => array('lang' => 'COOKIE_NOTICE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
)
);
diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php
index efa35b2118..1be7b2883d 100644
--- a/phpBB/includes/acp/info/acp_logs.php
+++ b/phpBB/includes/acp/info/acp_logs.php
@@ -15,15 +15,30 @@ class acp_logs_info
{
function module()
{
+ global $phpbb_dispatcher;
+
+ $modes = array(
+ 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ );
+
+ /**
+ * Event to add or modify ACP log modulemodes
+ *
+ * @event core.acp_logs_info_modify_modes
+ * @var array modes Array with modes info
+ * @since 3.1.11-RC1
+ * @since 3.2.1-RC1
+ */
+ $vars = array('modes');
+ extract($phpbb_dispatcher->trigger_event('core.acp_logs_info_modify_modes', compact($vars)));
+
return array(
'filename' => 'acp_logs',
'title' => 'ACP_LOGGING',
- 'modes' => array(
- 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- ),
+ 'modes' => $modes,
);
}
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 9ec965a6a1..387606a300 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -686,7 +686,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
* @var bool allow_url_bbcode Whether or not to parse the [url] BBCode
* @var string mode Mode to parse text as, e.g. post or sig
* @since 3.1.0-a1
- * @changed 3.2.0-a1
+ * @changed 3.2.0-a1 Added mode
*/
$vars = array(
'text',
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 326378d815..c8b5ec8b1a 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -442,7 +442,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
* @var array root_data Array with the root forum data
* @var array row The data of the 'category'
* @since 3.1.0-RC4
- * @change 3.1.7-RC1 Removed undefined catless variable
+ * @changed 3.1.7-RC1 Removed undefined catless variable
*/
$vars = array(
'cat_row',
@@ -648,7 +648,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
* @var array row The data of the forum
* @var array subforums_row Template data of subforums
* @since 3.1.0-a1
- * @change 3.1.0-b5 Added var subforums_row
+ * @changed 3.1.0-b5 Added var subforums_row
*/
$vars = array('forum_row', 'row', 'subforums_row');
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 551165c558..0edf9304a3 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2386,7 +2386,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
* @var string url The "Return to topic" URL
*
* @since 3.1.0-a3
- * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
+ * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* poll, update_message, update_search_index
*/
$vars = array(
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 8e1a9007e3..3dd4b3c2e5 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -272,13 +272,15 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
* Use this event to modify the values to be inserted when a user is added
*
* @event core.user_add_modify_data
- * @var array user_row Array of user details submited to user_add
- * @var array cp_data Array of Custom profile fields submited to user_add
- * @var array sql_ary Array of data to be inserted when a user is added
+ * @var array user_row Array of user details submited to user_add
+ * @var array cp_data Array of Custom profile fields submited to user_add
+ * @var array sql_ary Array of data to be inserted when a user is added
+ * @var array notifications_data Array of notification data to be inserted when a user is added
* @since 3.1.0-a1
- * @change 3.1.0-b5
+ * @changed 3.1.0-b5 Added user_row and cp_data
+ * @changed 3.1.11-RC1 Added notifications_data
*/
- $vars = array('user_row', 'cp_data', 'sql_ary');
+ $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data');
extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 5786aa343a..971982e4fc 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -164,7 +164,7 @@ class mcp_main
* @var string action Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4
- * @change 3.1.0-RC4 Added variables: action, quickmod
+ * @changed 3.1.0-RC4 Added variables: action, quickmod
*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index c68ff87cd7..d6e36fec39 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1219,7 +1219,7 @@ class parse_message extends bbcode_firstpass
* @var bool return Do we return after the event is triggered if $warn_msg is not empty
* @var array warn_msg Array of the warning messages
* @since 3.1.2-RC1
- * @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
+ * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
*/
$message = $this->message;
$warn_msg = $this->warn_msg;
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b3c0752a2f..06f76aa01a 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -280,7 +280,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var bool delete Whether the user is deleting the PM
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.0-RC5
- * @change 3.2.0-a1 Removed undefined variables
+ * @changed 3.2.0-a1 Removed undefined variables
*/
$vars = array(
'sql',
@@ -345,7 +345,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var bool delete If deleting message
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.0-RC5
- * @change 3.2.0-a1 Removed undefined variables
+ * @changed 3.2.0-a1 Removed undefined variables
*/
$vars = array(
'sql',
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index 3356195dd6..b7f8501fe4 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -508,7 +508,7 @@ class ucp_profile
* @var bool submit Whether or not the form has been sumitted
* @var bool preview Whether or not the signature is being previewed
* @since 3.1.10-RC1
- * @change 3.2.0-RC2 Removed message parser
+ * @changed 3.2.0-RC2 Removed message parser
*/
$vars = array(
'enable_bbcode',
diff --git a/phpBB/language/en/help/bbcode.php b/phpBB/language/en/help/bbcode.php
index dc39749963..aa5bc1666a 100644
--- a/phpBB/language/en/help/bbcode.php
+++ b/phpBB/language/en/help/bbcode.php
@@ -52,7 +52,7 @@ $lang = array_merge($lang, array(
'HELP_BBCODE_OTHERS_CUSTOM_ANSWER' => 'If you are an administrator on this board and have the proper permissions, you can add further BBCodes through the Custom BBCodes section.',
'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => 'Can I add my own tags?',
- 'HELP_BBCODE_QUOTES_CODE_ANSWER' => 'If you want to output a piece of code or in fact anything that requires a fixed width, e.g. Courier type font you should enclose the text in <strong>[code][/code]</strong> tags, e.g.<br /><br /><strong>[code]</strong>echo &quot;This is some code&quot;;<strong>[/code]</strong><br /><br />All formatting used within <strong>[code][/code]</strong> tags is retained when you later view it. PHP syntax highlighting can be enabled using <strong>[code=php][/code]</strong> and is recommended when posting PHP code samples as it improves readability.',
+ 'HELP_BBCODE_QUOTES_CODE_ANSWER' => 'If you want to output a piece of code or in fact anything that requires a fixed width, e.g. Courier type font you should enclose the text in <strong>[code][/code]</strong> tags, e.g.<br /><br /><strong>[code]</strong>echo &quot;This is some code&quot;;<strong>[/code]</strong><br /><br />All formatting used within <strong>[code][/code]</strong> tags is retained when you later view it.',
'HELP_BBCODE_QUOTES_CODE_QUESTION' => 'Outputting code or fixed width data',
'HELP_BBCODE_QUOTES_TEXT_ANSWER' => 'There are two ways you can quote text, with a reference or without.<ul><li>When you utilise the Quote function to reply to a post on the board you should notice that the post text is added to the message window enclosed in a <strong>[quote=&quot;&quot;][/quote]</strong> block. This method allows you to quote with a reference to a person or whatever else you choose to put! For example to quote a piece of text Mr. Blobby wrote you would enter:<br /><br /><strong>[quote=&quot;Mr. Blobby&quot;]</strong>The text Mr. Blobby wrote would go here<strong>[/quote]</strong><br /><br />The resulting output will automatically add &quot;Mr. Blobby wrote:&quot; before the actual text. Remember you <strong>must</strong> include the quotation marks &quot;&quot; around the name you are quoting, they are not optional.</li><li>The second method allows you to blindly quote something. To utilise this enclose the text in <strong>[quote][/quote]</strong> tags. When you view the message it will simply show the text within a quotation block.</li></ul>',
'HELP_BBCODE_QUOTES_TEXT_QUESTION' => 'Quoting text in replies',
diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php
index d2ab0595c0..ae3553c558 100644
--- a/phpBB/phpbb/event/php_exporter.php
+++ b/phpBB/phpbb/event/php_exporter.php
@@ -510,7 +510,7 @@ class php_exporter
/**
* Find the "@changed" Information lines
*
- * @param string $tag_name Should be 'changed' or 'change'
+ * @param string $tag_name Should be 'change', not 'changed'
* @return array Absolute line numbers
* @throws \LogicException
*/
@@ -658,7 +658,7 @@ class php_exporter
{
$match = array();
$line = str_replace("\t", ' ', ltrim($line, "\t "));
- preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
+ preg_match('#^\* @changed (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
if (!isset($match[2]))
{
throw new \LogicException("Invalid '@changed' information for event "
diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php
index 9a40702ba8..41c0a01ba8 100644
--- a/phpBB/phpbb/template/base.php
+++ b/phpBB/phpbb/template/base.php
@@ -133,6 +133,14 @@ abstract class base implements template
}
/**
+ * {@inheritdoc}
+ */
+ public function find_key_index($blockname, $key)
+ {
+ return $this->context->find_key_index($blockname, $key);
+ }
+
+ /**
* Calls hook if any is defined.
*
* @param string $handle Template handle being displayed.
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index 8bf6c10e2d..5d04a09865 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -264,6 +264,89 @@ class context
}
/**
+ * Find the index for a specified key in the innermost specified block
+ *
+ * @param string $blockname the blockname, for example 'loop'
+ * @param mixed $key Key to search for
+ *
+ * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
+ *
+ * int: Position [the position to search for]
+ *
+ * If key is false the position is set to 0
+ * If key is true the position is set to the last entry
+ *
+ * @return mixed false if not found, index position otherwise; be sure to test with ===
+ */
+ public function find_key_index($blockname, $key)
+ {
+ // For nested block, $blockcount > 0, for top-level block, $blockcount == 0
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ $block = $this->tpldata;
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ if (($pos = strpos($blocks[$i], '[')) !== false)
+ {
+ $name = substr($blocks[$i], 0, $pos);
+
+ if (strpos($blocks[$i], '[]') === $pos)
+ {
+ $index = sizeof($block[$name]) - 1;
+ }
+ else
+ {
+ $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);
+ }
+ }
+ else
+ {
+ $name = $blocks[$i];
+ $index = sizeof($block[$name]) - 1;
+ }
+ if (!isset($block[$name]))
+ {
+ return false;
+ }
+ $block = $block[$name];
+ if (!isset($block[$index]))
+ {
+ return false;
+ }
+ $block = $block[$index];
+ }
+
+ if (!isset($block[$blocks[$i]]))
+ {
+ return false;
+ }
+ $block = $block[$blocks[$i]]; // Traverse the last block
+
+ // Change key to zero (change first position) if false and to last position if true
+ if ($key === false || $key === true)
+ {
+ return ($key === false) ? 0 : sizeof($block) - 1;
+ }
+
+ // Get correct position if array given
+ if (is_array($key))
+ {
+ // Search array to get correct position
+ list($search_key, $search_value) = @each($key);
+ foreach ($block as $i => $val_ary)
+ {
+ if ($val_ary[$search_key] === $search_value)
+ {
+ return $i;
+ }
+ }
+ }
+
+ return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false;
+ }
+
+ /**
* Change already assigned key variable pair (one-dimensional - single loop entry)
*
* An example of how to use this function:
@@ -293,45 +376,49 @@ class context
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
$this->num_rows_is_set = false;
- if (strpos($blockname, '.') !== false)
- {
- // Nested block.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
- $block = &$this->tpldata;
- for ($i = 0; $i < $blockcount; $i++)
+ // For nested block, $blockcount > 0, for top-level block, $blockcount == 0
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ $block = &$this->tpldata;
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ if (($pos = strpos($blocks[$i], '[')) !== false)
{
- if (($pos = strpos($blocks[$i], '[')) !== false)
+ $name = substr($blocks[$i], 0, $pos);
+
+ if (strpos($blocks[$i], '[]') === $pos)
{
- $name = substr($blocks[$i], 0, $pos);
-
- if (strpos($blocks[$i], '[]') === $pos)
- {
- $index = sizeof($block[$name]) - 1;
- }
- else
- {
- $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);
- }
+ $index = sizeof($block[$name]) - 1;
}
else
{
- $name = $blocks[$i];
- $index = sizeof($block[$name]) - 1;
+ $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);
}
- $block = &$block[$name];
- $block = &$block[$index];
}
-
- $block = &$block[$blocks[$i]]; // Traverse the last block
+ else
+ {
+ $name = $blocks[$i];
+ $index = sizeof($block[$name]) - 1;
+ }
+ $block = &$block[$name];
+ $block = &$block[$index];
}
- else
+ $name = $blocks[$i];
+
+ // If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do
+ if (!isset($block[$name]))
{
- // Top-level block.
- $block = &$this->tpldata[$blockname];
+ if ($mode != 'insert' || is_array($key))
+ {
+ return false;
+ }
+ $block[$name] = array();
}
+ $block = &$block[$name]; // Now we can traverse the last block
+
// Change key to zero (change first position) if false and to last position if true
if ($key === false || $key === true)
{
@@ -371,14 +458,15 @@ class context
unset($block[($key - 1)]['S_LAST_ROW']);
$vararray['S_LAST_ROW'] = true;
}
- else if ($key === 0)
+ if ($key <= 0)
{
+ $key = 0;
unset($block[0]['S_FIRST_ROW']);
$vararray['S_FIRST_ROW'] = true;
}
// Assign S_BLOCK_NAME
- $vararray['S_BLOCK_NAME'] = $blockname;
+ $vararray['S_BLOCK_NAME'] = $name;
// Re-position template blocks
for ($i = sizeof($block); $i > $key; $i--)
@@ -398,6 +486,12 @@ class context
// Which block to change?
if ($mode == 'change')
{
+ // If key is out of bounds, do not change anything
+ if ($key > sizeof($block) || $key < 0)
+ {
+ return false;
+ }
+
if ($key == sizeof($block))
{
$key--;
diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php
index 041ecb12e4..9e3d658ca8 100644
--- a/phpBB/phpbb/template/template.php
+++ b/phpBB/phpbb/template/template.php
@@ -173,6 +173,23 @@ interface template
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert');
/**
+ * Find the index for a specified key in the innermost specified block
+ *
+ * @param string $blockname the blockname, for example 'loop'
+ * @param mixed $key Key to search for
+ *
+ * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
+ *
+ * int: Position [the position to search for]
+ *
+ * If key is false the position is set to 0
+ * If key is true the position is set to the last entry
+ *
+ * @return mixed false if not found, index position otherwise; be sure to test with ===
+ */
+ public function find_key_index($blockname, $key);
+
+ /**
* Get path to template for handle (required for BBCode parser)
*
* @param string $handle Handle to retrieve the source file
diff --git a/phpBB/posting.php b/phpBB/posting.php
index aa10059796..21783b070b 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -84,7 +84,7 @@ $current_time = time();
* NOTE: Should be actual language strings, NOT
* language keys.
* @since 3.1.0-a1
-* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
+* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
*/
$vars = array(
'post_id',
@@ -945,7 +945,9 @@ if ($submit || $preview || $refresh)
* is posting a new topic or editing a post)
* @var bool refresh Whether or not to retain previously submitted data
* @var object message_parser The message parser object
+ * @var array error Array of errors
* @since 3.1.2-RC1
+ * @changed 3.1.11-RC1 Added error
*/
$vars = array(
'post_data',
@@ -960,6 +962,7 @@ if ($submit || $preview || $refresh)
'cancel',
'refresh',
'message_parser',
+ 'error',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars)));
@@ -1267,8 +1270,8 @@ if ($submit || $preview || $refresh)
* @var array error Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5
- * @change 3.1.5-RC1 Added poll array to the event
- * @change 3.2.0-a1 Removed undefined page_title
+ * @changed 3.1.5-RC1 Added poll array to the event
+ * @changed 3.2.0-a1 Removed undefined page_title
*/
$vars = array(
'post_data',
@@ -1885,13 +1888,13 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_
* posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1
-* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
+* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser
-* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
-* @change 3.1.5-RC1 Added poll variables to the page_data array
-* @change 3.1.6-RC1 Added 'draft_id' var
+* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
+* @changed 3.1.5-RC1 Added poll variables to the page_data array
+* @changed 3.1.6-RC1 Added 'draft_id' var
*/
$vars = array(
'post_data',
diff --git a/phpBB/styles/prosilver/template/display_options.html b/phpBB/styles/prosilver/template/display_options.html
index d1ec3dcef1..a426d08845 100644
--- a/phpBB/styles/prosilver/template/display_options.html
+++ b/phpBB/styles/prosilver/template/display_options.html
@@ -1,4 +1,4 @@
-<div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_BEGIN} dropdown-button-control sort-tools">
+<div class="dropdown-container dropdown-container-left dropdown-button-control sort-tools">
<span title="{L_SORT_OPTIONS}" class="button button-secondary dropdown-trigger dropdown-select">
<i class="icon fa-sort-amount-asc fa-fw" aria-hidden="true"></i>
<span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span>
diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html
index 0d6e930d60..4ab6de250f 100644
--- a/phpBB/styles/prosilver/template/forumlist_body.html
+++ b/phpBB/styles/prosilver/template/forumlist_body.html
@@ -53,9 +53,7 @@
<br /><strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong>
<!-- BEGIN subforum -->
<a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">
- <i class="icon <!-- IF forumrow.subforum.IS_LINK -->fa-external-link<!-- ELSE -->fa-file-o<!-- ENDIF --> fa-fw <!-- IF forumrow.subforum.S_UNREAD --> icon-red<!-- ELSE --> icon-blue<!-- ENDIF --> icon-md" aria-hidden="true"></i>{forumrow.subforum.SUBFORUM_NAME}
- </a>
- <!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF -->
+ <i class="icon <!-- IF forumrow.subforum.IS_LINK -->fa-external-link<!-- ELSE -->fa-file-o<!-- ENDIF --> fa-fw <!-- IF forumrow.subforum.S_UNREAD --> icon-red<!-- ELSE --> icon-blue<!-- ENDIF --> icon-md" aria-hidden="true"></i>{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF -->
<!-- END subforum -->
<!-- EVENT forumlist_body_subforums_after -->
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html
index 724a963264..284334defd 100644
--- a/phpBB/styles/prosilver/template/jumpbox.html
+++ b/phpBB/styles/prosilver/template/jumpbox.html
@@ -37,7 +37,7 @@
<ul class="dropdown-contents">
<!-- BEGIN jumpbox_forums -->
<!-- IF jumpbox_forums.FORUM_ID neq -1 -->
- <li><a href="{jumpbox_forums.LINK}" class="<!-- IF jumpbox_forums.level -->jumpbox-sub-link<!-- ELSEIF jumpbox_forums.S_IS_CAT -->jumpbox-cat-link<!-- ELSE -->jumpbox-forum-link<!-- ENDIF -->"><!-- BEGIN level --><span class="spacer"></span><!-- END level --> <span><!-- IF jumpbox_forums.level --> &#8627; &nbsp;<!-- ENDIF --> {jumpbox_forums.FORUM_NAME}</span></a></li>
+ <li><a href="{jumpbox_forums.LINK}" class="<!-- IF jumpbox_forums.level -->jumpbox-sub-link<!-- ELSEIF jumpbox_forums.S_IS_CAT -->jumpbox-cat-link<!-- ELSE -->jumpbox-forum-link<!-- ENDIF -->"><!-- BEGIN level --><span class="spacer"></span><!-- END level --> <span><!-- IF jumpbox_forums.level --><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->&#8626;<!-- ELSE -->&#8627;<!-- ENDIF --> &nbsp;<!-- ENDIF --> {jumpbox_forums.FORUM_NAME}</span></a></li>
<!-- ENDIF -->
<!-- END jumpbox_forums -->
</ul>
diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html
index 78b0df84e0..5d484517ad 100644
--- a/phpBB/styles/prosilver/template/pagination.html
+++ b/phpBB/styles/prosilver/template/pagination.html
@@ -16,13 +16,13 @@
<!-- ENDIF -->
<!-- BEGIN pagination -->
<!-- IF pagination.S_IS_PREV -->
- <li class="arrow previous"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="prev" role="button"><i class="icon fa-chevron-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_PREVIOUS}</span></a></li>
+ <li class="arrow previous"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="prev" role="button"><i class="icon fa-chevron-{S_CONTENT_FLOW_BEGIN} fa-fw" aria-hidden="true"></i><span class="sr-only">{L_PREVIOUS}</span></a></li>
<!-- ELSEIF pagination.S_IS_CURRENT -->
<li class="active"><span>{pagination.PAGE_NUMBER}</span></li>
<!-- ELSEIF pagination.S_IS_ELLIPSIS -->
<li class="ellipsis" role="separator"><span>{L_ELLIPSIS}</span></li>
<!-- ELSEIF pagination.S_IS_NEXT -->
- <li class="arrow next"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="next" role="button"><i class="icon fa-chevron-right fa-fw" aria-hidden="true"></i><span class="sr-only">{L_NEXT}</span></a></li>
+ <li class="arrow next"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="next" role="button"><i class="icon fa-chevron-{S_CONTENT_FLOW_END} fa-fw" aria-hidden="true"></i><span class="sr-only">{L_NEXT}</span></a></li>
<!-- ELSE -->
<li><a class="button" href="{pagination.PAGE_URL}" role="button">{pagination.PAGE_NUMBER}</a></li>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index f23af1b5fc..860c2f6cb4 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -13,6 +13,10 @@
text-align: left;
}
+.rtl p.jumpbox-return {
+ float: right;
+}
+
.rtl div.rules ul {
margin-left: 0;
margin-right: 20px;
@@ -118,6 +122,11 @@
float: left;
}
+.rtl .jumpbox .dropdown-contents a {
+ margin-right: 0;
+ margin-left: 20px;
+}
+
/* Notifications
-----------------------------------------*/
.rtl .notification_list ul li img {
@@ -595,11 +604,12 @@ li.breadcrumbs span:first-child > a {
*/
.rtl .caret {
- float: right;
+ border-right: 1px solid;
+ border-right-color: inherit;
+ border-left: none;
+ right: 6px;
}
-
-
/* Post control buttons
--------------------------------------------- */
.rtl .post-buttons {
@@ -914,7 +924,8 @@ li.breadcrumbs span:first-child > a {
float: right;
}
-.button-search-end {
+.rtl .button-search-end {
+ border-radius: 4px 0 0 4px;
border-left-width: 1px;
border-right-width: 0;
}
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index cf21ac216b..35490c9338 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -441,13 +441,6 @@ blockquote blockquote blockquote {
color: #2E8B57;
}
-.syntaxbg { color: #FFFFFF; }
-.syntaxcomment { color: #FF8000; }
-.syntaxdefault { color: #0000BB; }
-.syntaxhtml { color: #000000; }
-.syntaxkeyword { color: #007700; }
-.syntaxstring { color: #DD0000; }
-
/* Attachments
----------------------------------------*/
.attachbox {
diff --git a/phpBB/styles/prosilver/theme/stylesheet.css b/phpBB/styles/prosilver/theme/stylesheet.css
index 1faab8bbd2..45eb5b6fc9 100644
--- a/phpBB/styles/prosilver/theme/stylesheet.css
+++ b/phpBB/styles/prosilver/theme/stylesheet.css
@@ -7,15 +7,15 @@
--------------------------------------------------------------
*/
-@import url("normalize.css");
-@import url("base.css");
-@import url("utilities.css");
-@import url("common.css");
-@import url("links.css");
-@import url("content.css");
-@import url("buttons.css");
-@import url("cp.css");
-@import url("forms.css");
-@import url("icons.css");
-@import url("colours.css");
-@import url("responsive.css");
+@import url("normalize.css?v=3.2");
+@import url("base.css?v=3.2");
+@import url("utilities.css?v=3.2");
+@import url("common.css?v=3.2");
+@import url("links.css?v=3.2");
+@import url("content.css?v=3.2");
+@import url("buttons.css?v=3.2");
+@import url("cp.css?v=3.2");
+@import url("forms.css?v=3.2");
+@import url("icons.css?v=3.2");
+@import url("colours.css?v=3.2");
+@import url("responsive.css?v=3.2");
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 0ab29315ee..03388c6454 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -435,9 +435,9 @@ $sql_array = array(
* Author, Post time, Replies, Subject, Views
* @var string sort_dir Either "a" for ascending or "d" for descending
* @since 3.1.0-a1
-* @change 3.1.0-RC4 Added forum_data var
-* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars
-* @change 3.1.9-RC1 Fix types of properties
+* @changed 3.1.0-RC4 Added forum_data var
+* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars
+* @changed 3.1.9-RC1 Fix types of properties
*/
$vars = array(
'forum_data',
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 85eb653b5a..624fe4ca9c 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -171,7 +171,7 @@ $sql_ary = array(
* @var int guest_counter Number of guests displayed
* @var array forum_data Array with forum data
* @since 3.1.0-a1
-* @change 3.1.0-a2 Added vars guest_counter and forum_data
+* @changed 3.1.0-a2 Added vars guest_counter and forum_data
*/
$vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data');
extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars)));
@@ -396,7 +396,7 @@ while ($row = $db->sql_fetchrow($result))
* @var string location_url Page url to displayed in the list
* @var array forum_data Array with forum data
* @since 3.1.0-a1
- * @change 3.1.0-a2 Added var forum_data
+ * @changed 3.1.0-a2 Added var forum_data
*/
$vars = array('on_page', 'row', 'location', 'location_url', 'forum_data');
extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars)));
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 01c5f9ed42..7510a1281d 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -703,7 +703,7 @@ $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=
* @var int total_posts Topic total posts count
* @var string viewtopic_url URL to the topic page
* @since 3.1.0-RC4
-* @change 3.1.2-RC1 Added viewtopic_url
+* @changed 3.1.2-RC1 Added viewtopic_url
*/
$vars = array(
'base_url',
@@ -1203,7 +1203,7 @@ $sql_ary = array(
* @var int start Pagination information
* @var array sql_ary The SQL array to get the data of posts and posters
* @since 3.1.0-a1
-* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start
+* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start
*/
$vars = array(
'forum_id',
@@ -2015,9 +2015,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a1
- * @change 3.1.0-a3 Added vars start, current_row_number, end, attachments
- * @change 3.1.0-b3 Added topic_data array, total_posts
- * @change 3.1.0-RC3 Added poster_id
+ * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments
+ * @changed 3.1.0-b3 Added topic_data array, total_posts
+ * @changed 3.1.0-RC3 Added poster_id
*/
$vars = array(
'start',
@@ -2115,7 +2115,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a3
- * @change 3.1.0-b3 Added topic_data array, total_posts
+ * @changed 3.1.0-b3 Added topic_data array, total_posts
*/
$vars = array(
'start',
@@ -2278,7 +2278,7 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang
* @var int start Start offset used to calculate the page
* @var array post_list Array with post_ids we are going to display
* @since 3.1.0-a1
-* @change 3.1.0-RC4 Added post_list var
+* @changed 3.1.0-RC4 Added post_list var
*/
$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars)));
diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php
index 5677e49636..4e85737c4f 100644
--- a/tests/bbcode/parser_test.php
+++ b/tests/bbcode/parser_test.php
@@ -66,11 +66,6 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case
'[code:]unparsed code[/code:]',
),
array(
- 'Test default bbcodes: simple php code',
- '[code=php]unparsed code[/code]',
- '[code=php:]<span class="syntaxdefault">unparsed&nbsp;code</span>[/code:]',
- ),
- array(
'Test default bbcodes: simple list',
'[list]no item[/list]',
'[list:]no item[/list:u:]',
diff --git a/tests/event/fixtures/trigger_many_vars.test b/tests/event/fixtures/trigger_many_vars.test
index a624138588..5e0720d13b 100644
--- a/tests/event/fixtures/trigger_many_vars.test
+++ b/tests/event/fixtures/trigger_many_vars.test
@@ -34,7 +34,7 @@
* posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1
- * @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
+ * @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 63e7cb869a..ca1414ec45 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -680,22 +680,139 @@ EOT
),
array(
'outer',
+ array('VARIABLE' => 'changed'),
+ 0,
+ 'change',
+ <<<EOT
+outer - 0 - changed
+middle - 0
+middle - 1
+outer - 1
+middle - 0
+middle - 1
+outer - 2
+middle - 0
+middle - 1
+EOT
+,
+ 'Test changing at 0 on top level block',
+ ),
+ array(
+ 'outer',
+ array('VARIABLE' => 'changed'),
+ array('S_ROW_NUM' => 2),
+ 'change',
+ <<<EOT
+outer - 0
+middle - 0
+middle - 1
+outer - 1
+middle - 0
+middle - 1
+outer - 2 - changed
+middle - 0
+middle - 1
+EOT
+,
+ 'Test changing at KEY on top level block',
+ ),
+ array(
+ 'outer.middle',
+ array('VARIABLE' => 'before'),
+ false,
+ 'insert',
+ <<<EOT
+outer - 0
+middle - 0
+middle - 1
+outer - 1
+middle - 0
+middle - 1
+outer - 2
+middle - 0 - before
+middle - 1
+middle - 2
+EOT
+,
+ 'Test inserting before on middle level block',
+ ),
+ array(
+ 'outer.middle',
+ array('VARIABLE' => 'after'),
+ true,
+ 'insert',
+ <<<EOT
+outer - 0
+middle - 0
+middle - 1
+outer - 1
+middle - 0
+middle - 1
+outer - 2
+middle - 0
+middle - 1
+middle - 2 - after
+EOT
+,
+ 'Test inserting after on middle level block',
+ ),
+ array(
+ 'outer[1].middle',
array('VARIABLE' => 'pos #1'),
+ 1,
+ 'insert',
+ <<<EOT
+outer - 0
+middle - 0
+middle - 1
+outer - 1
+middle - 0
+middle - 1 - pos #1
+middle - 2
+outer - 2
+middle - 0
+middle - 1
+EOT
+,
+ 'Test inserting at 1 on middle level block',
+ ),
+ array(
+ 'outer[].middle',
+ array('VARIABLE' => 'changed'),
0,
'change',
<<<EOT
-outer - 0 - pos #1
+outer - 0
middle - 0
middle - 1
outer - 1
middle - 0
middle - 1
outer - 2
+middle - 0 - changed
+middle - 1
+EOT
+,
+ 'Test changing at beginning of last top level block',
+ ),
+ array(
+ 'outer.middle',
+ array('VARIABLE' => 'changed'),
+ array('S_ROW_NUM' => 1),
+ 'change',
+ <<<EOT
+outer - 0
+middle - 0
+middle - 1
+outer - 1
middle - 0
middle - 1
+outer - 2
+middle - 0
+middle - 1 - changed
EOT
,
- 'Test inserting at 1 on top level block',
+ 'Test changing at beginning of last top level block',
),
);
}
@@ -753,8 +870,55 @@ EOT
$expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]';
$this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification');
+
+ $this->template->alter_block_array('outer.middle', array());
+
+ $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2[middle|4]middle - 3[middle|4]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion at middle level');
+
+ $this->template->alter_block_array('outer.middle', array('VARIABLE' => 'test'), 2, 'change');
+
+ $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2 - test[middle|4]middle - 3[middle|4]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification at middle level');
}
+ public function test_find_key_index()
+ {
+ $this->template->set_filenames(array('test' => 'loop_nested.html'));
+
+ $this->template->assign_var('TEST_MORE', true);
+
+ // @todo Change this
+ $this->template->assign_block_vars('outer', array('VARIABLE' => 'zero'));
+ $this->template->assign_block_vars('outer', array('VARIABLE' => 'one'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '1A'));
+ $this->template->assign_block_vars('outer', array('VARIABLE' => 'two'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2A'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2B'));
+ $this->template->assign_block_vars('outer', array('VARIABLE' => 'three'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3A'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3B'));
+ $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3C'));
+
+ $expect = 'outer - 0 - zero[outer|4]outer - 1 - one[outer|4]middle - 0 - 1A[middle|1]outer - 2 - two[outer|4]middle - 0 - 2A[middle|2]middle - 1 - 2B[middle|2]outer - 3 - three[outer|4]middle - 0 - 3A[middle|3]middle - 1 - 3B[middle|3]middle - 2 - 3C[middle|3]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring template is built correctly before modification');
+
+ $this->template->find_key_index('outer', false);
+
+ $this->assertEquals(0, $this->template->find_key_index('outer', false), 'Find index at the beginning of outer loop');
+ $this->assertEquals(1, $this->template->find_key_index('outer', 1), 'Find index by index in outer loop');
+ $this->assertEquals(2, $this->template->find_key_index('outer', array('VARIABLE' => 'two')), 'Find index by key in outer loop');
+ $this->assertEquals(3, $this->template->find_key_index('outer', true), 'Find index at the end of outer loop');
+ $this->assertEquals(false, $this->template->find_key_index('outer', 7), 'Find index out of bounds of outer loop');
+
+ $this->assertEquals(false, $this->template->find_key_index('outer[0].middle', false), 'Find index at the beginning of middle loop, no middle block');
+ $this->assertEquals(false, $this->template->find_key_index('outer[1].middle', 1), 'Find index by index in inner loop, out of bounds');
+ $this->assertEquals(1, $this->template->find_key_index('outer[2].middle', array('VARIABLE' => '2B')), 'Find index by key in middle loop');
+ $this->assertEquals(2, $this->template->find_key_index('outer.middle', true), 'Find index at the end of middle loop');
+
+ $this->assertEquals(false, $this->template->find_key_index('outer.wrong', true), 'Wrong middle block name');
+ $this->assertEquals(false, $this->template->find_key_index('wrong.middle', false), 'Wrong outer block name');
+ }
public function assign_block_vars_array_data()
{
return array(