From d69ff9623655b6950ffde408213d02baccd8a9f0 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sun, 9 Jul 2017 20:07:16 +0200 Subject: [ticket/15266] Fix events in content_visibility Fixes core.phpbb_content_visibility_get_visibility_sql_before, core.phpbb_content_visibility_get_forums_visibility_before, core.phpbb_content_visibility_get_global_visibility_before Does not modify the events, but fixes some comments, and changes the rest of the function to allow (at least) the documented event functionality. PHPBB3-15266 --- phpBB/phpbb/content_visibility.php | 70 ++++++++++++++------------------------ 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index bf7dc2c703..bbff7a1fae 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -176,10 +176,14 @@ class content_visibility if ($this->auth->acl_get('m_approve', $forum_id)) { - return $where_sql . '1 = 1'; + $where_sql .= '1 = 1'; + } + else + { + $where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; } - return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; + return '(' . $where_sql . ')'; } /** @@ -195,16 +199,21 @@ class content_visibility */ public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '') { - $where_sql = '('; + $where_sql = ''; - $approve_forums = array_intersect($forum_ids, array_keys($this->auth->acl_getf('m_approve', true))); + $approve_forums = array_keys($this->auth->acl_getf('m_approve', true)); + if ($forum_ids && $approve_forums) + { + $approve_forums = array_intersect($forum_ids, $approve_forums); + $forum_ids = array_diff($forum_ids, $approve_forums); + } $get_forums_visibility_sql_overwrite = false; /** * Allow changing the result of calling get_forums_visibility_sql * * @event core.phpbb_content_visibility_get_forums_visibility_before - * @var string where_sql The action the user tried to execute + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" * @var string mode Either "topic" or "post" depending on the query this is being used in * @var array forum_ids Array of forum ids which the posts/topics are limited to * @var string table_alias Table alias to prefix in SQL queries @@ -229,33 +238,13 @@ class content_visibility return $get_forums_visibility_sql_overwrite; } - if (sizeof($approve_forums)) - { - // Remove moderator forums from the rest - $forum_ids = array_diff($forum_ids, $approve_forums); - - if (!sizeof($forum_ids)) - { - // The user can see all posts/topics in all specified forums - return $where_sql . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ')'; - } - else - { - // Moderator can view all posts/topics in some forums - $where_sql .= $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ' OR '; - } - } - else - { - // The user is just a normal user - return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' - AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . ')'; - } - + // Moderator can view all posts/topics in the moderated forums + $where_sql .= '(' . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums, false, true) . ' OR '; + // Normal user can view approved items only $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' - AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids) . '))'; + AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . '))'; - return $where_sql; + return '(' . $where_sql . ')'; } /** @@ -281,12 +270,12 @@ class content_visibility * Allow changing the result of calling get_global_visibility_sql * * @event core.phpbb_content_visibility_get_global_visibility_before - * @var array where_sqls The action the user tried to execute + * @var array where_sqls Array of extra visibility conditions. Will be joined by imploding with "OR". * @var string mode Either "topic" or "post" depending on the query this is being used in * @var array exclude_forum_ids Array of forum ids the current user doesn't have access to * @var string table_alias Table alias to prefix in SQL queries * @var array approve_forums Array of forums where the user has m_approve permissions - * @var string visibility_sql_overwrite Forces the function to return an implosion of where_sqls (joined by "OR") + * @var string visibility_sql_overwrite If a string, forces the function to return visibility_sql_overwrite after executing the event * @since 3.1.3-RC1 */ $vars = array( @@ -304,24 +293,17 @@ class content_visibility return $visibility_sql_overwrite; } - if (sizeof($exclude_forum_ids)) - { - $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . ' - AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; - } - else - { - $where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; - } + // Include approved items in all forums but the excluded + $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true, true) . ' + AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; + // If user has moderator permissions, add everything in the moderated forums if (sizeof($approve_forums)) { $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); - return '(' . implode(' OR ', $where_sqls) . ')'; } - // There is only one element, so we just return that one - return $where_sqls[0]; + return '(' . implode(' OR ', $where_sqls) . ')'; } /** -- cgit v1.2.1 From 31b93280ee906f7ac4052540cffc210bf323f056 Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 10 Jul 2017 15:11:22 +0200 Subject: [ticket/15266] Fix events in content_visibility Additional errors found. The event parameter 'timestamp' does not exist, it is really called 'time'. Affects four events: core.set_post_visibility_before_sql core.set_post_visibility_after core.set_topic_visibility_before_sql core.set_topic_visibility_after PHPBB3-15266 --- phpBB/phpbb/content_visibility.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index bbff7a1fae..6abf8f996e 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -419,7 +419,7 @@ class content_visibility * @var int topic_id Topic of the post IDs to be modified. * @var int forum_id Forum ID that the topic_id resides in. * @var int user_id User ID doing this action. - * @var int timestamp Timestamp of this action. + * @var int time Timestamp of this action. * @var string reason Reason specified by the user for this change. * @var bool is_starter Are we changing the topic's starter? * @var bool is_latest Are we changing the topic's latest post? @@ -432,7 +432,7 @@ class content_visibility 'topic_id', 'forum_id', 'user_id', - 'timestamp', + 'time', 'reason', 'is_starter', 'is_latest', @@ -604,7 +604,7 @@ class content_visibility * @var int topic_id Topic of the post IDs to be modified. * @var int forum_id Forum ID that the topic_id resides in. * @var int user_id User ID doing this action. - * @var int timestamp Timestamp of this action. + * @var int time Timestamp of this action. * @var string reason Reason specified by the user for this change. * @var bool is_starter Are we changing the topic's starter? * @var bool is_latest Are we changing the topic's latest post? @@ -617,7 +617,7 @@ class content_visibility 'topic_id', 'forum_id', 'user_id', - 'timestamp', + 'time', 'reason', 'is_starter', 'is_latest', @@ -691,7 +691,7 @@ class content_visibility * @var int topic_id Topic of the post IDs to be modified. * @var int forum_id Forum ID that the topic_id resides in. * @var int user_id User ID doing this action. - * @var int timestamp Timestamp of this action. + * @var int time Timestamp of this action. * @var string reason Reason specified by the user for this change. * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. * @var array data The data array for this action. @@ -702,7 +702,7 @@ class content_visibility 'topic_id', 'forum_id', 'user_id', - 'timestamp', + 'time', 'reason', 'force_update_all', 'data', @@ -740,7 +740,7 @@ class content_visibility * @var int topic_id Topic of the post IDs to be modified. * @var int forum_id Forum ID that the topic_id resides in. * @var int user_id User ID doing this action. - * @var int timestamp Timestamp of this action. + * @var int time Timestamp of this action. * @var string reason Reason specified by the user for this change. * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. * @var array data The data array for this action. @@ -751,7 +751,7 @@ class content_visibility 'topic_id', 'forum_id', 'user_id', - 'timestamp', + 'time', 'reason', 'force_update_all', 'data', -- cgit v1.2.1 From 882a3c383103802c491404032c5d267e4f5271a0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 22 Jul 2017 17:26:41 +0200 Subject: [ticket/security/211] Make sure website URL only uses http & https schemes SECURITY-211 --- phpBB/includes/functions.php | 5 +++++ phpBB/includes/functions_convert.php | 2 +- phpBB/phpbb/profilefields/type/type_url.php | 2 +- tests/profilefields/type_url_test.php | 13 +++++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 84178f74e4..7aa63f2e0c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3409,6 +3409,11 @@ function get_preg_expression($mode) return "[a-z][a-z\d+\-.]*:/{2}(?:(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; + case 'url_http': + // generated with regex_idn.php file in the develop folder + return "http[s]?:/{2}(?:(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + break; + case 'url_inline': // generated with regex_idn.php file in the develop folder return "[a-z][a-z\d+]*:/{2}(?:(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?"; diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index da4820134d..ba354d39ef 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -249,7 +249,7 @@ function validate_website($url) { return ''; } - else if (!preg_match('#^[a-z0-9]+://#i', $url) && strlen($url) > 0) + else if (!preg_match('#^http[s]?://#i', $url) && strlen($url) > 0) { return 'http://' . $url; } diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php index 375cf5b19a..2bc0002262 100644 --- a/phpBB/phpbb/profilefields/type/type_url.php +++ b/phpBB/phpbb/profilefields/type/type_url.php @@ -64,7 +64,7 @@ class type_url extends type_string return false; } - if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $field_value)) + if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $field_value)) { return $this->user->lang('FIELD_INVALID_URL', $this->get_field_name($field_data['lang_name'])); } diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index cc37f04f30..aaba227348 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -89,6 +89,19 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case 'FIELD_INVALID_URL-field', 'Field should reject invalid URL having multi value parameters', ), + // Not allowed schemes + array( + 'ftp://example.com/', + array(), + 'FIELD_INVALID_URL-field', + 'Field should reject invalid URL having multi value parameters', + ), + array( + 'javascript://alert.com', + array(), + 'FIELD_INVALID_URL-field', + 'Field should reject invalid URL having multi value parameters', + ), // IDN url type profilefields array( -- cgit v1.2.1 From 2749bfe26ccae7db4174cdd83453d79366113c28 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 23 Jul 2017 10:40:30 +0200 Subject: [ticket/security/211] Only run make_clickable() on URL type profile fields SECURITY-211 --- phpBB/phpbb/profilefields/type/type_string_common.php | 1 - phpBB/phpbb/profilefields/type/type_url.php | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index f5e1992044..2648d03930 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -108,7 +108,6 @@ abstract class type_string_common extends type_base return null; } - $field_value = make_clickable($field_value); $field_value = censor_text($field_value); $field_value = bbcode_nl2br($field_value); return $field_value; diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php index 2bc0002262..7bdd60e19d 100644 --- a/phpBB/phpbb/profilefields/type/type_url.php +++ b/phpBB/phpbb/profilefields/type/type_url.php @@ -71,4 +71,19 @@ class type_url extends type_string return false; } + + /** + * {@inheritDoc} + */ + public function get_profile_value($field_value, $field_data) + { + if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $field_value)) + { + return null; + } + + $field_value = make_clickable($field_value); + + return parent::get_profile_value($field_value, $field_data); + } } -- cgit v1.2.1 From 91f9050a70d95a472daf9f6fa15187c195f05909 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 23 Jul 2017 11:18:07 +0200 Subject: [ticket/security/211] Extend tests for profile field values SECURITY-211 --- tests/profilefields/type_string_test.php | 12 +++++++ tests/profilefields/type_url_test.php | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index 0417afbfab..43f88c01ae 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -270,6 +270,18 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case null, 'Field should simply output null for empty vlaue', ), + array( + 'http://foobar.com', + array('field_show_novalue' => false), + 'http://foobar.com', + 'Field should output the given value but not make it clickable', + ), + array( + 'javascript://foobar.com', + array('field_show_novalue' => true), + 'javascript://foobar.com', + 'Field should output the given value but not make it clickable', + ), ); } diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index aaba227348..af17cc125a 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -12,6 +12,8 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_profilefield_type_url_test extends phpbb_test_case { @@ -26,6 +28,9 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case */ public function setUp() { + global $request, $user, $cache; + + $cache = new phpbb_mock_cache; $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime')); $user->expects($this->any()) ->method('lang') @@ -175,6 +180,55 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ); } + public function profile_value_data() + { + return array( + array( + 'http://foobar.com', + array('field_show_novalue' => true), + 'foobar.com', + 'Field should output the given value', + ), + array( + 'http://foobar.com', + array('field_show_novalue' => false), + 'foobar.com', + 'Field should output the given value', + ), + array( + 'test', + array('field_show_novalue' => true), + null, + 'Field should output nothing for empty value', + ), + array( + 'test', + array('field_show_novalue' => false), + null, + 'Field should simply output null for empty value', + ), + array( + 'javascript://foobar.com', + array('field_show_novalue' => true), + null, + 'Field should output nothing for empty value', + ), + ); + } + + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + /** * @dataProvider profile_value_raw_data */ -- cgit v1.2.1 From 0aba1faa0803af6013c9ac2071e87f117e9c4835 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 26 Jul 2017 21:14:05 +0200 Subject: [ticket/security/211] Do not match javascript URIs with URL regexes SECURITY-211 --- phpBB/develop/regex_idn.php | 2 +- phpBB/includes/functions.php | 4 ++-- tests/functions/make_clickable_test.php | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/phpBB/develop/regex_idn.php b/phpBB/develop/regex_idn.php index d871695c50..30373f8de3 100644 --- a/phpBB/develop/regex_idn.php +++ b/phpBB/develop/regex_idn.php @@ -120,7 +120,7 @@ do $pct_encoded = "%[\dA-F]{2}"; $unreserved = "$add_chars\pL0-9\-._~"; $sub_delims = ($inline) ? '!$&\'(*+,;=' : '!$&\'()*+,;='; - $scheme = ($inline) ? '[a-z][a-z\d+]*': '[a-z][a-z\d+\-.]*' ; // avoid automatic parsing of "word" in "last word.http://..." + $scheme = ($inline) ? '[a-z][a-z\d+]*(?viewtopic.php?t=1' ), + array( + 'javascript://testhost/viewtopic.php?t=1', + 'javascript://testhost/viewtopic.php?t=1' + ), array( 'email@domain.com', 'email@domain.com' @@ -92,6 +96,10 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case 'ftp://ftp.täst.de/', 'ftp://ftp.täst.de/' ), + array( + 'javascript://täst.de/', + 'javascript://täst.de/' + ), array( 'sip://bantu@täst.de', 'sip://bantu@täst.de' -- cgit v1.2.1 From f7d387f93c421e93ef13375bd5e0fb408e921598 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 27 Jul 2017 18:23:43 +0200 Subject: [ticket/security/211] Add test for line breaks in URL SECURITY-211 --- tests/functions/make_clickable_test.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php index 2cdefe689d..2bb7721d21 100644 --- a/tests/functions/make_clickable_test.php +++ b/tests/functions/make_clickable_test.php @@ -59,6 +59,10 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case 'javascript://testhost/viewtopic.php?t=1', 'javascript://testhost/viewtopic.php?t=1' ), + array( + "java\nscri\npt://testhost/viewtopic.php?t=1", + "java\nscri\npt://testhost/viewtopic.php?t=1" + ), array( 'email@domain.com', 'email@domain.com' -- cgit v1.2.1 From 342a7cbd55829283663ad6ba29f924eeb53fca38 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Aug 2017 22:20:33 +0200 Subject: [ticket/security/211] Allow make_clickable() again after change to regex SECURITY-211 --- phpBB/phpbb/profilefields/type/type_string_common.php | 1 + phpBB/phpbb/profilefields/type/type_url.php | 2 -- tests/profilefields/type_string_test.php | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index 2648d03930..f5e1992044 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -108,6 +108,7 @@ abstract class type_string_common extends type_base return null; } + $field_value = make_clickable($field_value); $field_value = censor_text($field_value); $field_value = bbcode_nl2br($field_value); return $field_value; diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php index 7bdd60e19d..37815b66a5 100644 --- a/phpBB/phpbb/profilefields/type/type_url.php +++ b/phpBB/phpbb/profilefields/type/type_url.php @@ -82,8 +82,6 @@ class type_url extends type_string return null; } - $field_value = make_clickable($field_value); - return parent::get_profile_value($field_value, $field_data); } } diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index 43f88c01ae..9709b48470 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -273,8 +273,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case array( 'http://foobar.com', array('field_show_novalue' => false), - 'http://foobar.com', - 'Field should output the given value but not make it clickable', + 'foobar.com', + 'Field should output the given value and make it clickable', ), array( 'javascript://foobar.com', -- cgit v1.2.1 From 0ced93ccd5cb3de54f51ead46d4ab87a0ce67dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 28 Apr 2017 04:04:36 +0200 Subject: [ticket/15201] Set user style to default style when it is disabled or uninstalled PHPBB3-15201 --- phpBB/includes/acp/acp_styles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index b954f90451..a57c509abe 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -398,7 +398,7 @@ class acp_styles // Reset default style for users who use selected styles $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = 0 + SET user_style = ' . $this->default_style . ' WHERE user_style IN (' . implode(', ', $ids) . ')'; $this->db->sql_query($sql); @@ -1249,7 +1249,7 @@ class acp_styles // Change default style for users $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = 0 + SET user_style = ' . $this->default_style . ' WHERE user_style = ' . $id; $this->db->sql_query($sql); -- cgit v1.2.1 From b0a22163261075932a92c6c46b36c57c104c3493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 28 Apr 2017 12:01:51 +0200 Subject: [ticket/15201] Castings PHPBB3-15201 --- phpBB/includes/acp/acp_styles.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index a57c509abe..fc6cf26f70 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -398,7 +398,9 @@ class acp_styles // Reset default style for users who use selected styles $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $this->default_style . ' + SET user_style = ' . (int) $this->default_style +. +' WHERE user_style IN (' . implode(', ', $ids) . ')'; $this->db->sql_query($sql); @@ -1249,7 +1251,9 @@ class acp_styles // Change default style for users $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $this->default_style . ' + SET user_style = ' . (int) $this->default_style +. +' WHERE user_style = ' . $id; $this->db->sql_query($sql); -- cgit v1.2.1 From 48a3bd1a9e1fe9c6a761b43a1058b4d3c1b6641b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 28 Apr 2017 12:03:52 +0200 Subject: [ticket/15201] Fix PHPBB3-15201 --- phpBB/includes/acp/acp_styles.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index fc6cf26f70..5b31417b83 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -398,9 +398,7 @@ class acp_styles // Reset default style for users who use selected styles $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . (int) $this->default_style -. -' + SET user_style = ' . (int) $this->default_style . ' WHERE user_style IN (' . implode(', ', $ids) . ')'; $this->db->sql_query($sql); @@ -1251,9 +1249,7 @@ class acp_styles // Change default style for users $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . (int) $this->default_style -. -' + SET user_style = ' . (int) $this->default_style . ' WHERE user_style = ' . $id; $this->db->sql_query($sql); -- cgit v1.2.1 From 4719f94cecd8a3f585c9ca1c75336aa109849844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 28 Apr 2017 22:41:07 +0200 Subject: [ticket/15201] Remove wrong user style check PHPBB3-15201 --- phpBB/phpbb/db/migration/data/v310/style_update_p1.php | 8 ++++---- phpBB/phpbb/user.php | 18 ------------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index 2c7b7edf2e..dcf031a7a7 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -165,7 +165,7 @@ class style_update_p1 extends \phpbb\db\migration\migration $this->config->set('default_style', $default_style); - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0'; + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . $default_style; $this->sql_query($sql); } else @@ -183,9 +183,9 @@ class style_update_p1 extends \phpbb\db\migration\migration } // Reset styles for users - $this->sql_query('UPDATE ' . USERS_TABLE . ' - SET user_style = 0 - WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true)); + $this->sql_query('UPDATE ' . USERS_TABLE . " + SET user_style = '" . $valid_styles[0] . "' + WHERE " . $this->db->sql_in_set('user_style', $valid_styles, true)); } } } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index d4097f53ee..5899dff2f5 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -278,24 +278,6 @@ class user extends \phpbb\session $db->sql_freeresult($result); } - // User has wrong style - if (!$this->style && $style_id == $this->data['user_style']) - { - $style_id = $this->data['user_style'] = $config['default_style']; - - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_style = $style_id - WHERE user_id = {$this->data['user_id']}"; - $db->sql_query($sql); - - $sql = 'SELECT * - FROM ' . STYLES_TABLE . " s - WHERE s.style_id = $style_id"; - $result = $db->sql_query($sql, 3600); - $this->style = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - } - if (!$this->style) { trigger_error('NO_STYLE_DATA', E_USER_ERROR); -- cgit v1.2.1 From 13b0f399612bf3c3f6ce04bda46429dab572e590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 29 Apr 2017 09:47:48 +0200 Subject: [ticket/15201] Migration to fix current invalid styles PHPBB3-15201 --- .../db/migration/data/v32x/fix_user_styles.php | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php diff --git a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php new file mode 100644 index 0000000000..e0caae812a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php @@ -0,0 +1,50 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class fix_user_styles extends \phpbb\db\migration\migration +{ + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\v320', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'styles_fix'))), + ); + } + + public function styles_fix() + { + $default_style = (int) $this->config['default_style']; + + // Get enabled styles + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_active = 1'; + $result = $this->db->sql_query($sql); + $enabled_styles = $result->fetch_array(); + $this->db->sql_freeresult($result); + + // Set the default style to users who have an invalid style + $this->sql_query('UPDATE ' . USERS_TABLE . " + SET user_style = $default_style + WHERE " . $this->db->sql_in_set('user_style', $enabled_styles, true)); + } +} -- cgit v1.2.1 From 4b1ec6abb7b2d2daa320ac5e2872e055bc5b07d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 8 Sep 2017 10:59:47 +0200 Subject: [ticket/15201] Fix tests PHPBB3-15201 --- phpBB/phpbb/db/migration/data/v310/style_update_p1.php | 4 ++-- tests/test_framework/phpbb_functional_test_case.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index dcf031a7a7..3e28e8747d 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -160,7 +160,7 @@ class style_update_p1 extends \phpbb\db\migration\migration FROM ' . STYLES_TABLE . " WHERE style_name = 'prosilver'"; $result = $this->sql_query($sql); - $default_style = $this->db->sql_fetchfield('style_id'); + $default_style = (int) $this->db->sql_fetchfield('style_id'); $this->db->sql_freeresult($result); $this->config->set('default_style', $default_style); @@ -184,7 +184,7 @@ class style_update_p1 extends \phpbb\db\migration\migration // Reset styles for users $this->sql_query('UPDATE ' . USERS_TABLE . " - SET user_style = '" . $valid_styles[0] . "' + SET user_style = '" . (int) $valid_styles[0] . "' WHERE " . $this->db->sql_in_set('user_style', $valid_styles, true)); } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index eb56049515..c9943c4302 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -572,6 +572,9 @@ class phpbb_functional_test_case extends phpbb_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; + // Prevent new user to have an invalid style + $config['default_style'] = 1; + // Required by user_add global $db, $cache, $phpbb_dispatcher, $phpbb_container; $db = $this->get_db(); -- cgit v1.2.1 From bace8dd31f0a5c2f95ae612e7e1b2e6d3083613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 8 Sep 2017 15:02:29 +0200 Subject: [ticket/15201] Add casting PHPBB3-15201 --- phpBB/phpbb/db/migration/data/v310/style_update_p1.php | 2 +- phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index 3e28e8747d..f50ab33830 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -165,7 +165,7 @@ class style_update_p1 extends \phpbb\db\migration\migration $this->config->set('default_style', $default_style); - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . $default_style; + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . (int) $default_style; $this->sql_query($sql); } else diff --git a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php index e0caae812a..282c6bef2f 100644 --- a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php +++ b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php @@ -43,8 +43,8 @@ class fix_user_styles extends \phpbb\db\migration\migration $this->db->sql_freeresult($result); // Set the default style to users who have an invalid style - $this->sql_query('UPDATE ' . USERS_TABLE . " - SET user_style = $default_style - WHERE " . $this->db->sql_in_set('user_style', $enabled_styles, true)); + $this->sql_query('UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $default_style . ' + WHERE ' . $this->db->sql_in_set('user_style', $enabled_styles, true)); } } -- cgit v1.2.1 From f8f985c099225700a888a91c34f0481910e08378 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 10 Sep 2017 12:50:06 +0200 Subject: [ticket/15353] Make sure users can continue update after merging file diff PHPBB3-15353 --- phpBB/adm/style/installer_form.html | 7 ++-- .../install/helper/iohandler/ajax_iohandler.php | 6 +++ .../module/update_filesystem/task/diff_files.php | 43 ++++++++++++++++++---- .../task/download_updated_files.php | 5 ++- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html index a38f33c7c2..592d361d1e 100644 --- a/phpBB/adm/style/installer_form.html +++ b/phpBB/adm/style/installer_form.html @@ -1,3 +1,4 @@ +

{FORM_TITLE}

@@ -8,9 +9,9 @@ - -
+
+ {options.LEGEND}
@@ -49,7 +50,7 @@
{L_SUBMIT} - disabled="disabled" /> + disabled="disabled" />
diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index bce0149890..dd584eff30 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -187,6 +187,7 @@ class ajax_iohandler extends iohandler_base $tpl_ary['KEY'] = $input_name; $tpl_ary['S_EXPLAIN'] = false; $tpl_ary['DISABLED'] = isset($input_options['disabled']) ? $input_options['disabled'] : false; + $tpl_ary['IS_SECONDARY'] = isset($input_options['is_secondary']) ? $input_options['is_secondary'] : false; if (isset($input_options['default'])) { @@ -218,6 +219,11 @@ class ajax_iohandler extends iohandler_base $this->template->assign_block_vars($block_name, $tpl_ary); } + if (isset($form['database_update_submit']) && !$form['database_update_submit']['disabled']) + { + $this->template->assign_var('FORM_TITLE', $this->language->lang('UPDATE_CONTINUE_UPDATE_PROCESS')); + } + $this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form); if (!$not_button_form) diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 1792a3b723..b15e32cc82 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -103,8 +103,8 @@ class diff_files extends task_base $old_path = $this->update_helper->get_path_to_old_update_files(); $new_path = $this->update_helper->get_path_to_new_update_files(); - $files_to_diff = $this->installer_config->get('update_files', array()); - $files_to_diff = $files_to_diff['update_with_diff']; + $update_files = $this->installer_config->get('update_files', array()); + $files_to_diff = $update_files['update_with_diff']; // Set progress bar $this->iohandler->set_task_count(count($files_to_diff), true); @@ -154,7 +154,6 @@ class diff_files extends task_base } $diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]); - unset($file_contents); // Handle conflicts if ($diff->get_num_conflicts() !== 0) @@ -162,12 +161,20 @@ class diff_files extends task_base $merge_conflicts[] = $filename; } - // Save merged output - $this->cache->put( - '_file_' . md5($filename), - base64_encode(implode("\n", $diff->merged_output())) - ); + if ($diff->merged_output() !== $file_contents[1]) + { + // Save merged output + $this->cache->put( + '_file_' . md5($filename), + base64_encode(implode("\n", $diff->merged_output())) + ); + } + else + { + unset($update_files['update_with_diff'][$key]); + } + unset($file_contents); unset($diff); } else @@ -199,6 +206,16 @@ class diff_files extends task_base $this->installer_config->set('merge_conflict_list', $merge_conflicts); $this->installer_config->set('file_diff_update_count', $progress_count); + foreach ($update_files as $type => $files) + { + if (count($files) < 1) + { + unset($update_files[$type]); + } + } + + $this->installer_config->set('update_files', $update_files); + // Request refresh throw new resource_limit_reached_exception(); } @@ -206,6 +223,16 @@ class diff_files extends task_base $this->iohandler->finish_progress('ALL_FILES_DIFFED'); $this->installer_config->set('merge_conflict_list', $merge_conflicts); + + foreach ($update_files as $type => $files) + { + if (count($files) < 1) + { + unset($update_files[$type]); + } + } + + $this->installer_config->set('update_files', $update_files); } /** diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php index 21aa93b7ea..2fc756c20a 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -99,8 +99,9 @@ class download_updated_files extends task_base // Add form to continue update $this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array( 'update_recheck_files_submit' => array( - 'label' => 'UPDATE_RECHECK_UPDATE_FILES', - 'type' => 'submit', + 'label' => 'UPDATE_RECHECK_UPDATE_FILES', + 'type' => 'submit', + 'is_secondary' => count($file_update_info) < 1, ), 'database_update_submit' => array( 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', -- cgit v1.2.1 From 6e86cd9e15241e9d1ce5fc3eaaf3844c155cc3e9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 10 Sep 2017 12:54:10 +0200 Subject: [ticket/15298] Never suppress exception trace when using CLI PHPBB3-15298 --- phpBB/config/default/container/services_console.yml | 1 - phpBB/phpbb/console/exception_subscriber.php | 13 ++----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml index 697e147d85..a327b74ac4 100644 --- a/phpBB/config/default/container/services_console.yml +++ b/phpBB/config/default/container/services_console.yml @@ -3,7 +3,6 @@ services: class: phpbb\console\exception_subscriber arguments: - '@language' - - '%debug.exceptions%' tags: - { name: kernel.event_subscriber } diff --git a/phpBB/phpbb/console/exception_subscriber.php b/phpBB/phpbb/console/exception_subscriber.php index b920d4abae..b240993203 100644 --- a/phpBB/phpbb/console/exception_subscriber.php +++ b/phpBB/phpbb/console/exception_subscriber.php @@ -29,12 +29,10 @@ class exception_subscriber implements EventSubscriberInterface * Construct method * * @param \phpbb\language\language $language Language object - * @param bool $debug Debug mode */ - public function __construct(\phpbb\language\language $language, $debug = false) + public function __construct(\phpbb\language\language $language) { $this->language = $language; - $this->debug = $debug; } /** @@ -52,14 +50,7 @@ class exception_subscriber implements EventSubscriberInterface $parameters = array_merge(array($original_exception->getMessage()), $original_exception->get_parameters()); $message = call_user_func_array(array($this->language, 'lang'), $parameters); - if ($this->debug) - { - $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); - } - else - { - $exception = new \RuntimeException($message , $original_exception->getCode()); - } + $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); $event->setException($exception); } -- cgit v1.2.1 From 27ae01c27a99b0f0674ad4f0e82f1b018365926d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 22 Sep 2017 13:03:14 +0200 Subject: [ticket/15245] Fix images in feeds when accessing via app.php PHPBB3-15245 --- phpBB/config/default/container/services_feed.yml | 1 + phpBB/phpbb/feed/helper.php | 19 ++++++++++++------- tests/feed/attachments_base_test.php | 11 ++++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/phpBB/config/default/container/services_feed.yml b/phpBB/config/default/container/services_feed.yml index d3e7924f2f..b7ef1f9b6d 100644 --- a/phpBB/config/default/container/services_feed.yml +++ b/phpBB/config/default/container/services_feed.yml @@ -18,6 +18,7 @@ services: class: phpbb\feed\helper arguments: - '@config' + - '@path_helper' - '@user' - '%core.root_path%' - '%core.php_ext%' diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index e15d1e131e..2d9a623895 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -21,6 +21,9 @@ class helper /** @var \phpbb\config\config */ protected $config; + /** @var \phpbb\path_helper */ + protected $path_helper; + /** @var \phpbb\user */ protected $user; @@ -33,14 +36,16 @@ class helper /** * Constructor * - * @param \phpbb\config\config $config Config object - * @param \phpbb\user $user User object - * @param string $phpbb_root_path Root path - * @param string $phpEx PHP file extension + * @param \phpbb\config\config $config Config object + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Root path + * @param string $phpEx PHP file extension */ - public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx) + public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\user $user, $phpbb_root_path, $phpEx) { $this->config = $config; + $this->path_helper = $path_helper; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; @@ -113,7 +118,7 @@ class helper $content = str_replace('
', '
' . "\n", $content); // Convert smiley Relative paths to Absolute path, Windows style - $content = str_replace($this->phpbb_root_path . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content); + $content = str_replace($this->path_helper->get_web_root_path() . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content); // Remove "Select all" link and mouse events $content = str_replace('' . $this->user->lang['SELECT_ALL_CODE'] . '', '', $content); @@ -152,7 +157,7 @@ class helper $content .= implode('
', $post_attachments); // Convert attachments' relative path to absolute path - $content = str_replace($this->phpbb_root_path . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content); + $content = str_replace($this->path_helper->get_web_root_path() . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content); } // Remove Comments from inline attachments [ia] diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php index dd432d13f5..f5c79bd6b4 100644 --- a/tests/feed/attachments_base_test.php +++ b/tests/feed/attachments_base_test.php @@ -31,13 +31,22 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case $this->filesystem = new \phpbb\filesystem(); $config = new \phpbb\config\config(array()); + $path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + 'php' + ); $user = new \phpbb\user( new \phpbb\language\language( new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx) ), '\phpbb\datetime' ); - $feed_helper = new \phpbb\feed\helper($config, $user, $phpbb_root_path, $phpEx); + $feed_helper = new \phpbb\feed\helper($config, $path_helper, $user, $phpbb_root_path, $phpEx); $db = $this->new_dbal(); $cache = new \phpbb_mock_cache(); $auth = new \phpbb\auth\auth(); -- cgit v1.2.1 From 2592d597652242cc5e1299e3dcde53d31f35c4f1 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 22 Sep 2017 14:34:38 +0200 Subject: [ticket/15339] Use manual method when adding modules This will fix cases where the module is deleted in later versions and the migrator thus cannot retrieve the info. PHPBB3-15339 --- .../db/migration/data/v30x/release_3_0_6_rc1.php | 41 +++++++++++++++++++--- .../db/migration/data/v30x/release_3_0_8_rc1.php | 4 ++- .../db/migration/data/v310/auth_provider_oauth.php | 4 ++- .../data/v310/contact_admin_acp_module.php | 4 ++- phpBB/phpbb/db/migration/data/v310/dev.php | 25 ++++++++++--- phpBB/phpbb/db/migration/data/v310/extensions.php | 4 ++- .../phpbb/db/migration/data/v310/notifications.php | 7 ++-- .../migration/data/v310/softdelete_mcp_modules.php | 8 +++-- .../db/migration/data/v320/add_help_phpbb.php | 4 ++- 9 files changed, 83 insertions(+), 18 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php index faef68121d..08b8979e00 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -153,7 +153,9 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'ACP_BOARD_CONFIGURATION', array( 'module_basename' => 'acp_board', - 'modes' => array('feed'), + 'module_langname' => 'ACP_FEED_SETTINGS', + 'module_mode' => 'feed', + 'module_auth' => 'acl_a_board', ), )), array('module.add', array( @@ -161,7 +163,10 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'ACP_CAT_USERS', array( 'module_basename' => 'acp_users', - 'modes' => array('warnings'), + 'module_langname' => 'ACP_USER_WARNINGS', + 'module_mode' => 'warnings', + 'module_auth' => 'acl_a_user', + 'module_display' => false, ), )), array('module.add', array( @@ -169,7 +174,9 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'ACP_SERVER_CONFIGURATION', array( 'module_basename' => 'acp_send_statistics', - 'modes' => array('send_statistics'), + 'module_langname' => 'ACP_SEND_STATISTICS', + 'module_mode' => 'send_statistics', + 'module_auth' => 'acl_a_server', ), )), array('module.add', array( @@ -177,7 +184,9 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'ACP_FORUM_BASED_PERMISSIONS', array( 'module_basename' => 'acp_permissions', - 'modes' => array('setting_forum_copy'), + 'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY', + 'module_mode' => 'setting_forum_copy', + 'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', ), )), array('module.add', array( @@ -185,7 +194,29 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'MCP_REPORTS', array( 'module_basename' => 'mcp_pm_reports', - 'modes' => array('pm_reports','pm_reports_closed','pm_report_details'), + 'module_langname' => 'MCP_PM_REPORTS_OPEN', + 'module_mode' => 'pm_reports', + 'module_auth' => 'acl_m_pm_report', + ), + )), + array('module.add', array( + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'mcp_pm_reports', + 'module_langname' => 'MCP_PM_REPORTS_CLOSED', + 'module_mode' => 'pm_reports_closed', + 'module_auth' => 'acl_m_pm_report', + ), + )), + array('module.add', array( + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'mcp_pm_reports', + 'module_langname' => 'MCP_PM_REPORT_DETAILS', + 'module_mode' => 'pm_report_details', + 'module_auth' => 'acl_m_pm_report', ), )), array('custom', array(array(&$this, 'add_newly_registered_group'))), diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php index 22fd51543b..0190eeb1af 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -36,7 +36,9 @@ class release_3_0_8_rc1 extends \phpbb\db\migration\migration 'ACP_MESSAGES', array( 'module_basename' => 'acp_board', - 'modes' => array('post'), + 'module_langname' => 'ACP_POST_SETTINGS', + 'module_mode' => 'post', + 'module_auth' => 'acl_a_board', ), )), array('config.add', array('load_unreads_search', 1)), diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php index 2d51bd53e4..508a31fba9 100644 --- a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php +++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php @@ -69,7 +69,9 @@ class auth_provider_oauth extends \phpbb\db\migration\migration 'UCP_PROFILE', array( 'module_basename' => 'ucp_auth_link', - 'modes' => array('auth_link'), + 'module_langname' => 'UCP_AUTH_LINK_MANAGE', + 'module_mode' => 'auth_link', + 'module_auth' => 'authmethod_oauth', ), )), ); diff --git a/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php index 20bd547ac3..e48a9a1d3d 100644 --- a/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php +++ b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php @@ -23,7 +23,9 @@ class contact_admin_acp_module extends \phpbb\db\migration\migration 'ACP_BOARD_CONFIGURATION', array( 'module_basename' => 'acp_contact', - 'modes' => array('contact'), + 'module_langname' => 'ACP_CONTACT_SETTINGS', + 'module_mode' => 'contact', + 'module_auth' => 'acl_a_board', ), )), ); diff --git a/phpBB/phpbb/db/migration/data/v310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php index 250258eea7..9cc953ad8d 100644 --- a/phpBB/phpbb/db/migration/data/v310/dev.php +++ b/phpBB/phpbb/db/migration/data/v310/dev.php @@ -125,7 +125,9 @@ class dev extends \phpbb\db\migration\container_aware_migration 'ACP_GROUPS', array( 'module_basename' => 'acp_groups', - 'modes' => array('position'), + 'module_langname' => 'ACP_GROUPS_POSITION', + 'module_mode' => 'position', + 'module_auth' => 'acl_a_group', ), )), array('module.add', array( @@ -133,7 +135,9 @@ class dev extends \phpbb\db\migration\container_aware_migration 'ACP_ATTACHMENTS', array( 'module_basename' => 'acp_attachments', - 'modes' => array('manage'), + 'module_langname' => 'ACP_MANAGE_ATTACHMENTS', + 'module_mode' => 'manage', + 'module_auth' => 'acl_a_attach', ), )), array('module.add', array( @@ -141,7 +145,19 @@ class dev extends \phpbb\db\migration\container_aware_migration 'ACP_STYLE_MANAGEMENT', array( 'module_basename' => 'acp_styles', - 'modes' => array('install', 'cache'), + 'module_langname' => 'ACP_STYLES_INSTALL', + 'module_mode' => 'install', + 'module_auth' => 'acl_a_styles', + ), + )), + array('module.add', array( + 'acp', + 'ACP_STYLE_MANAGEMENT', + array( + 'module_basename' => 'acp_styles', + 'module_langname' => 'ACP_STYLES_CACHE', + 'module_mode' => 'cache', + 'module_auth' => 'acl_a_styles', ), )), array('module.add', array( @@ -149,7 +165,8 @@ class dev extends \phpbb\db\migration\container_aware_migration 'UCP_PROFILE', array( 'module_basename' => 'ucp_profile', - 'modes' => array('autologin_keys'), + 'module_langname' => 'UCP_PROFILE_AUTOLOGIN_KEYS', + 'module_mode' => 'autologin_keys', ), )), // Module will be renamed later diff --git a/phpBB/phpbb/db/migration/data/v310/extensions.php b/phpBB/phpbb/db/migration/data/v310/extensions.php index 3171435482..2e7c5c5316 100644 --- a/phpBB/phpbb/db/migration/data/v310/extensions.php +++ b/phpBB/phpbb/db/migration/data/v310/extensions.php @@ -66,7 +66,9 @@ class extensions extends \phpbb\db\migration\migration 'ACP_EXTENSION_MANAGEMENT', array( 'module_basename' => 'acp_extensions', - 'modes' => array('main'), + 'module_langname' => 'ACP_EXTENSIONS', + 'module_mode' => 'main', + 'module_auth' => 'acl_a_extensions', ), )), array('permission.add', array('a_extensions', true, 'a_styles')), diff --git a/phpBB/phpbb/db/migration/data/v310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php index f4d012b5ac..789aaa3ba9 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications.php @@ -85,7 +85,9 @@ class notifications extends \phpbb\db\migration\migration 'UCP_MAIN', array( 'module_basename' => 'ucp_notifications', - 'modes' => array('notification_list'), + 'module_langname' => 'UCP_NOTIFICATION_LIST', + 'module_mode' => 'notification_list', + 'module_auth' => 'cfg_allow_board_notifications', ), )), array('module.add', array( @@ -93,7 +95,8 @@ class notifications extends \phpbb\db\migration\migration 'UCP_PREFS', array( 'module_basename' => 'ucp_notifications', - 'modes' => array('notification_options'), + 'module_langname' => 'UCP_NOTIFICATION_OPTIONS', + 'module_mode' => 'notification_options', ), )), array('config.add', array('load_notifications', 1)), diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php index 5e68db5889..90dab991e1 100644 --- a/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php @@ -45,7 +45,9 @@ class softdelete_mcp_modules extends \phpbb\db\migration\migration 'MCP_QUEUE', array( 'module_basename' => 'mcp_queue', - 'modes' => array('deleted_topics'), + 'module_langname' => 'MCP_QUEUE_DELETED_TOPICS', + 'module_mode' => 'deleted_topics', + 'module_auth' => 'aclf_m_approve', ), )), array('module.add', array( @@ -53,7 +55,9 @@ class softdelete_mcp_modules extends \phpbb\db\migration\migration 'MCP_QUEUE', array( 'module_basename' => 'mcp_queue', - 'modes' => array('deleted_posts'), + 'module_langname' => 'MCP_QUEUE_DELETED_POSTS', + 'module_mode' => 'deleted_posts', + 'module_auth' => 'aclf_m_approve', ), )), ); diff --git a/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php index 8fadb4bde4..a52067f484 100644 --- a/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php +++ b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php @@ -41,7 +41,9 @@ class add_help_phpbb extends \phpbb\db\migration\migration 'ACP_SERVER_CONFIGURATION', array( 'module_basename' => 'acp_help_phpbb', - 'modes' => array('help_phpbb'), + 'module_langname' => 'ACP_HELP_PHPBB', + 'module_mode' => 'help_phpbb', + 'module_auth' => 'acl_a_server', ), )), ); -- cgit v1.2.1 From ae02cf785a3cd2dc76a871ee08571be712493562 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 22 Sep 2017 19:33:53 +0700 Subject: [ticket/15374] Add core event to modify page title in viewforum.php PHPBB3-15374 --- phpBB/viewforum.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 9cc75988f7..ce3f066a57 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -161,7 +161,22 @@ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id); $start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); -page_header($forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''), true, $forum_id); +$page_title = $forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''); + +/** +* You can use this event to modify the page title of the viewforum page +* +* @event core.viewforum_modify_page_title +* @var string page_title Title of the viewforum page +* @var array forum_data Array with forum data +* @var int forum_id The forum ID +* @var int start Start offset used to calculate the page +* @since 3.2.2-RC1 +*/ +$vars = array('page_title', 'forum_data', 'forum_id', 'start'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_page_title', compact($vars))); + +page_header($page_title, true, $forum_id); $template->set_filenames(array( 'body' => 'viewforum_body.html') -- cgit v1.2.1 From 4a7ead0239179d4257c074b755cd4a5f765a513b Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 22 Sep 2017 13:33:42 +0200 Subject: [ticket/15245] Remove unnecessary arguments and fix whitespace PHPBB3-15245 --- phpBB/phpbb/feed/helper.php | 22 ++++++---------------- tests/feed/attachments_base_test.php | 4 ++-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 2d9a623895..3bca8598a5 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -27,28 +27,18 @@ class helper /** @var \phpbb\user */ protected $user; - /** @var string */ - protected $phpbb_root_path; - - /** @var string */ - protected $phpEx; - /** * Constructor * - * @param \phpbb\config\config $config Config object - * @param \phpbb\path_helper $path_helper Path helper object - * @param \phpbb\user $user User object - * @param string $phpbb_root_path Root path - * @param string $phpEx PHP file extension + * @param \phpbb\config\config $config Config object + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\user $user User object */ - public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\user $user, $phpbb_root_path, $phpEx) + public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\user $user) { $this->config = $config; $this->path_helper = $path_helper; $this->user = $user; - $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; } /** @@ -110,7 +100,7 @@ class helper } // Prepare some bbcodes for better parsing - $content = preg_replace("#\[quote(=".*?")?:$uid\]\s*(.*?)\s*\[/quote:$uid\]#si", "[quote$1:$uid]
$2
[/quote:$uid]", $content); + $content = preg_replace("#\[quote(=".*?")?:$uid\]\s*(.*?)\s*\[/quote:$uid\]#si", "[quote$1:$uid]
$2
[/quote:$uid]", $content); $content = generate_text_for_display($content, $uid, $bitfield, $options); @@ -157,7 +147,7 @@ class helper $content .= implode('
', $post_attachments); // Convert attachments' relative path to absolute path - $content = str_replace($this->path_helper->get_web_root_path() . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content); + $content = str_replace($this->path_helper->get_web_root_path() . 'download/file.' . $this->path_helper->get_php_ext(), $this->get_board_url() . '/download/file.' . $this->path_helper->get_php_ext(), $content); } // Remove Comments from inline attachments [ia] diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php index f5c79bd6b4..2ee1cc16e7 100644 --- a/tests/feed/attachments_base_test.php +++ b/tests/feed/attachments_base_test.php @@ -35,7 +35,7 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem\filesystem(), + $this->filesystem, $this->getMock('\phpbb\request\request'), $phpbb_root_path, 'php' @@ -46,7 +46,7 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case ), '\phpbb\datetime' ); - $feed_helper = new \phpbb\feed\helper($config, $path_helper, $user, $phpbb_root_path, $phpEx); + $feed_helper = new \phpbb\feed\helper($config, $path_helper, $user); $db = $this->new_dbal(); $cache = new \phpbb_mock_cache(); $auth = new \phpbb\auth\auth(); -- cgit v1.2.1 From 402b7a09737a44262403dadbfccf1fbf6c749b9f Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Thu, 28 Sep 2017 13:53:59 +0200 Subject: [ticket/15273] Better explain cookie path PHPBB3-15273 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8bb5327028..ee5e82b89f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -352,7 +352,7 @@ $lang = array_merge($lang, array( 'COOKIE_NAME' => 'Cookie name', 'COOKIE_NAME_EXPLAIN' => 'This can be anything what you want, make it original. Whenever the cookie settings are changed the name of the cookie should be changed.', 'COOKIE_PATH' => 'Cookie path', - 'COOKIE_PATH_EXPLAIN' => 'Note that this is always a slash, it does not matter what your board URL is.', + 'COOKIE_PATH_EXPLAIN' => 'This will usually be the same as your script path or simply a slash to make the cookie accessible across the site domain.', 'COOKIE_SECURE' => 'Cookie secure', 'COOKIE_SECURE_EXPLAIN' => 'If your server is running via SSL set this to enabled else leave as disabled. Having this enabled and not running via SSL will result in server errors during redirects.', 'ONLINE_LENGTH' => 'View online time span', -- cgit v1.2.1 From 3da67ce581d35f53b1b7e0ef7bce10f9261f8c6c Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 28 Sep 2017 20:02:15 +0200 Subject: [ticket/15245] Configure TextFormatter before rendering feeds PHPBB3-15245 --- phpBB/config/default/container/services_feed.yml | 3 +- phpBB/phpbb/feed/feed_quote_helper.php | 35 ++++++++++++++++++++++++ phpBB/phpbb/feed/helper.php | 25 +++++++++-------- 3 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 phpBB/phpbb/feed/feed_quote_helper.php diff --git a/phpBB/config/default/container/services_feed.yml b/phpBB/config/default/container/services_feed.yml index b7ef1f9b6d..20ed193e96 100644 --- a/phpBB/config/default/container/services_feed.yml +++ b/phpBB/config/default/container/services_feed.yml @@ -19,9 +19,8 @@ services: arguments: - '@config' - '@path_helper' + - '@text_formatter.renderer' - '@user' - - '%core.root_path%' - - '%core.php_ext%' feed.forum: class: phpbb\feed\forum diff --git a/phpBB/phpbb/feed/feed_quote_helper.php b/phpBB/phpbb/feed/feed_quote_helper.php new file mode 100644 index 0000000000..02a9b35dc0 --- /dev/null +++ b/phpBB/phpbb/feed/feed_quote_helper.php @@ -0,0 +1,35 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed; + +/** + * Modified quote_helper for feeds (basically just removing all attributes) + */ +class feed_quote_helper extends \phpbb\textformatter\s9e\quote_helper +{ + /** + * {@inheritdoc} + */ + public function inject_metadata($xml) + { + // In feeds we don't want any attributes, so delete all of them + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function () { + return []; + } + ); + } +} diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 3bca8598a5..df7388331c 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -24,20 +24,25 @@ class helper /** @var \phpbb\path_helper */ protected $path_helper; + /** @var \phpbb\textformatter\s9e\renderer */ + protected $renderer; + /** @var \phpbb\user */ protected $user; /** * Constructor * - * @param \phpbb\config\config $config Config object - * @param \phpbb\path_helper $path_helper Path helper object - * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\textformatter\s9e\renderer $renderer TextFormatter renderer object + * @param \phpbb\user $user User object */ - public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\user $user) + public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\textformatter\s9e\renderer $renderer, \phpbb\user $user) { $this->config = $config; $this->path_helper = $path_helper; + $this->renderer = $renderer; $this->user = $user; } @@ -99,16 +104,12 @@ class helper return ''; } - // Prepare some bbcodes for better parsing - $content = preg_replace("#\[quote(=".*?")?:$uid\]\s*(.*?)\s*\[/quote:$uid\]#si", "[quote$1:$uid]
$2
[/quote:$uid]", $content); - - $content = generate_text_for_display($content, $uid, $bitfield, $options); + // Setup our own quote_helper to remove all attributes from quotes + $this->renderer->configure_quote_helper(new feed_quote_helper($this->user, $this->path_helper->get_phpbb_root_path(), $this->path_helper->get_php_ext())); - // Add newlines - $content = str_replace('
', '
' . "\n", $content); + $this->renderer->set_smilies_path($this->get_board_url() . '/' . $this->config['smilies_path']); - // Convert smiley Relative paths to Absolute path, Windows style - $content = str_replace($this->path_helper->get_web_root_path() . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content); + $content = generate_text_for_display($content, $uid, $bitfield, $options); // Remove "Select all" link and mouse events $content = str_replace('' . $this->user->lang['SELECT_ALL_CODE'] . '', '', $content); -- cgit v1.2.1 From 221e5a01b1cf3369fcb7807c30a8f05ead20076d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 28 Sep 2017 23:55:28 +0200 Subject: [ticket/15245] Fix comments, class names and code style PHPBB3-15245 --- phpBB/config/default/container/services_feed.yml | 5 ++++ phpBB/phpbb/feed/feed_quote_helper.php | 35 ----------------------- phpBB/phpbb/feed/helper.php | 33 ++++++++++++++-------- phpBB/phpbb/feed/quote_helper.php | 36 ++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 46 deletions(-) delete mode 100644 phpBB/phpbb/feed/feed_quote_helper.php create mode 100644 phpBB/phpbb/feed/quote_helper.php diff --git a/phpBB/config/default/container/services_feed.yml b/phpBB/config/default/container/services_feed.yml index 20ed193e96..e8bac4b5ce 100644 --- a/phpBB/config/default/container/services_feed.yml +++ b/phpBB/config/default/container/services_feed.yml @@ -18,6 +18,7 @@ services: class: phpbb\feed\helper arguments: - '@config' + - '@service_container' - '@path_helper' - '@text_formatter.renderer' - '@user' @@ -78,6 +79,10 @@ services: - '@dispatcher' - '%core.php_ext%' + feed.quote_helper: + class: phpbb\feed\quote_helper + parent: text_formatter.s9e.quote_helper + feed.topic: class: phpbb\feed\topic shared: false diff --git a/phpBB/phpbb/feed/feed_quote_helper.php b/phpBB/phpbb/feed/feed_quote_helper.php deleted file mode 100644 index 02a9b35dc0..0000000000 --- a/phpBB/phpbb/feed/feed_quote_helper.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\feed; - -/** - * Modified quote_helper for feeds (basically just removing all attributes) - */ -class feed_quote_helper extends \phpbb\textformatter\s9e\quote_helper -{ - /** - * {@inheritdoc} - */ - public function inject_metadata($xml) - { - // In feeds we don't want any attributes, so delete all of them - return \s9e\TextFormatter\Utils::replaceAttributes( - $xml, - 'QUOTE', - function () { - return []; - } - ); - } -} diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index df7388331c..7d50b7ce7d 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -13,41 +13,52 @@ namespace phpbb\feed; +use phpbb\config\config; +use phpbb\path_helper; +use phpbb\textformatter\s9e\renderer; +use phpbb\user; +use Symfony\Component\DependencyInjection\ContainerInterface; + /** * Class with some helpful functions used in feeds */ class helper { - /** @var \phpbb\config\config */ + /** @var config */ protected $config; - /** @var \phpbb\path_helper */ + /** @var ContainerInterface */ + protected $container; + + /** @var path_helper */ protected $path_helper; - /** @var \phpbb\textformatter\s9e\renderer */ + /** @var renderer */ protected $renderer; - /** @var \phpbb\user */ + /** @var user */ protected $user; /** * Constructor * - * @param \phpbb\config\config $config Config object - * @param \phpbb\path_helper $path_helper Path helper object - * @param \phpbb\textformatter\s9e\renderer $renderer TextFormatter renderer object - * @param \phpbb\user $user User object + * @param config $config Config object + * @param ContainerInterface $container Service container object + * @param path_helper $path_helper Path helper object + * @param renderer $renderer TextFormatter renderer object + * @param user $user User object */ - public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\textformatter\s9e\renderer $renderer, \phpbb\user $user) + public function __construct(config $config, ContainerInterface $container, path_helper $path_helper, renderer $renderer, user $user) { $this->config = $config; + $this->container = $container; $this->path_helper = $path_helper; $this->renderer = $renderer; $this->user = $user; } /** - * Run links through append_sid(), prepend generate_board_url() and remove session id + * Returns the board url (and caches it in the function) */ public function get_board_url() { @@ -105,7 +116,7 @@ class helper } // Setup our own quote_helper to remove all attributes from quotes - $this->renderer->configure_quote_helper(new feed_quote_helper($this->user, $this->path_helper->get_phpbb_root_path(), $this->path_helper->get_php_ext())); + $this->renderer->configure_quote_helper($this->container->get('feed.quote_helper')); $this->renderer->set_smilies_path($this->get_board_url() . '/' . $this->config['smilies_path']); diff --git a/phpBB/phpbb/feed/quote_helper.php b/phpBB/phpbb/feed/quote_helper.php new file mode 100644 index 0000000000..843d075028 --- /dev/null +++ b/phpBB/phpbb/feed/quote_helper.php @@ -0,0 +1,36 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed; + +/** + * Modified quote_helper for feeds (basically just removing all attributes) + */ +class quote_helper extends \phpbb\textformatter\s9e\quote_helper +{ + /** + * {@inheritdoc} + */ + public function inject_metadata($xml) + { + // In feeds we don't want any attributes, so delete all of them + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function () + { + return []; + } + ); + } +} -- cgit v1.2.1 From 886089d28e45eab8003a7e9ba2ac0132e186cc29 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sun, 1 Oct 2017 19:14:12 +0200 Subject: [ticket/15245] Fix tests PHPBB3-15245 --- tests/feed/attachments_base_test.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php index 2ee1cc16e7..573218be42 100644 --- a/tests/feed/attachments_base_test.php +++ b/tests/feed/attachments_base_test.php @@ -46,7 +46,10 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case ), '\phpbb\datetime' ); - $feed_helper = new \phpbb\feed\helper($config, $path_helper, $user); + $container = new phpbb_mock_container_builder(); + $this->get_test_case_helpers()->set_s9e_services($container); + $container->set('feed.quote_helper', new \phpbb\feed\quote_helper($user, $phpbb_root_path, 'php')); + $feed_helper = new \phpbb\feed\helper($config, $container, $path_helper, $container->get('text_formatter.renderer'), $user); $db = $this->new_dbal(); $cache = new \phpbb_mock_cache(); $auth = new \phpbb\auth\auth(); -- cgit v1.2.1 From c5e8b759c169dfa37b7e78796f604a8a6418a804 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 2 Oct 2017 10:55:25 +0700 Subject: [ticket/15384] Add linebreaks to SMTP/Jabber configuration option explanations PHPBB3-15384 --- phpBB/language/en/acp/board.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e6c56a5bbb..414498e0b2 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -573,7 +573,7 @@ $lang = array_merge($lang, array( 'SEND_TEST_EMAIL' => 'Send a test email', 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', - 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.Warning: Allowing self-signed SSL certificates may cause security implications.', + 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', @@ -591,9 +591,9 @@ $lang = array_merge($lang, array( 'SMTP_USERNAME' => 'SMTP username', 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', 'SMTP_VERIFY_PEER' => 'Verify SSL certificate', - 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', 'SMTP_VERIFY_PEER_NAME' => 'Verify SMTP peer name', - 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.Warning: Connecting to unverified peers may cause security implications.', + 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', 'TEST_EMAIL_SENT' => 'The test email has been sent.
If you don’t receive it, please check your emails configuration.

If you require assistance, please visit the phpBB support forums.', 'USE_SMTP' => 'Use SMTP server for email', @@ -605,7 +605,7 @@ $lang = array_merge($lang, array( 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Please be sure to enter already registered account details - phpBB will use the details you enter here as is.', 'JAB_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', - 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.Warning: Allowing self-signed SSL certificates may cause security implications.', + 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', 'JAB_ENABLE' => 'Enable Jabber', 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the dns_get_record function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', @@ -623,7 +623,7 @@ $lang = array_merge($lang, array( 'JAB_USERNAME' => 'Jabber username or JID', 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', 'JAB_VERIFY_PEER' => 'Verify SSL certificate', - 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', 'JAB_VERIFY_PEER_NAME' => 'Verify Jabber peer name', - 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.Warning: Connecting to unverified peers may cause security implications.', + 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', )); -- cgit v1.2.1 From 8f97887683581555187caf6bfe4d1f21c5780341 Mon Sep 17 00:00:00 2001 From: ftc2 Date: Sun, 1 Oct 2017 22:57:21 -0600 Subject: [ticket/15385] nginx.sample.conf: www redirection, security regex according to the latest wiki info: http://wiki.nginx.org/Pitfalls#Taxing_Rewrites `return 301` is preferred over a rewrite. also, the 'security' regex breaks some official extensions because it will match and deny access to `/ext/phpbb`. looking through the names of dirs and files containing `phpbb`, it looks like the intent of the regex was to only disallow the folder `phpbb` in the root dir and not other `/phpbb` matches. a negative lookbehind was added to specifically not match `/ext/phpbb` but still match other occurrences of `/phpbb`. Tracker ticket: https://tracker.phpbb.com/browse/PHPBB3-15385 --- phpBB/docs/nginx.sample.conf | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/phpBB/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf index ce929b6e54..55c01a1fc9 100644 --- a/phpBB/docs/nginx.sample.conf +++ b/phpBB/docs/nginx.sample.conf @@ -18,11 +18,11 @@ http { gzip_vary on; gzip_http_version 1.1; gzip_min_length 700; - + # Compression levels over 6 do not give an appreciable improvement # in compression ratio, but take more resources. gzip_comp_level 6; - + # IE 6 and lower do not support gzip with Vary correctly. gzip_disable "msie6"; # Before nginx 0.7.63: @@ -49,9 +49,7 @@ http { server_name myforums.com; # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites: - rewrite ^ http://www.myforums.com$request_uri permanent; - # Equivalent to: - #rewrite ^(.*)$ http://www.myforums.com$1 permanent; + return 301 http://www.myforums.com$request_uri; } # The actual board domain. @@ -72,7 +70,7 @@ http { } # Deny access to internal phpbb files. - location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|phpbb|store|vendor) { + location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(? Date: Mon, 2 Oct 2017 12:17:04 +0200 Subject: [ticket/15381] Better explain CONTACT_US_ENABLE_EXPLAIN PHPBB3-15381 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e6c56a5bbb..13613fcf06 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -371,7 +371,7 @@ $lang = array_merge($lang, array( 'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Here you can enable and disable the contact page and also add a text that is displayed on the page.', 'CONTACT_US_ENABLE' => 'Enable contact page', - 'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators', + 'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators. Please note that board-wide emails option must be enabled as well. You can find this option in General > Client Communication > Email settings.', 'CONTACT_US_INFO' => 'Contact information', 'CONTACT_US_INFO_EXPLAIN' => 'The message is displayed on the contact page', -- cgit v1.2.1 From 7fcb07572b1dc69b93bcb599b518bbd5f34dc504 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Tue, 3 Oct 2017 11:43:29 +0200 Subject: [ticket/15111] Fix the typo in ucp_pm_view_messsage PHPBB3-15111 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 48d14a133c..cf767a7cce 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -267,6 +267,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array user_info User data of the sender * @since 3.1.0-a1 * @changed 3.1.6-RC1 Added user_info into event + * @changed 3.2.2-RC1 Deprecated + * @deprecated 4.0.0 Event name is misspelled and is replaced with new event with correct name */ $vars = array( 'id', @@ -281,6 +283,34 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) ); extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_messsage', compact($vars))); + /** + * Modify pm and sender data before it is assigned to the template + * + * @event core.ucp_pm_view_message + * @var mixed id Active module category (can be int or string) + * @var string mode Active module + * @var int folder_id ID of the folder the message is in + * @var int msg_id ID of the private message + * @var array folder Array with data of user's message folders + * @var array message_row Array with message data + * @var array cp_row Array with senders custom profile field data + * @var array msg_data Template array with message data + * @var array user_info User data of the sender + * @since 3.2.2-RC1 + */ + $vars = array( + 'id', + 'mode', + 'folder_id', + 'msg_id', + 'folder', + 'message_row', + 'cp_row', + 'msg_data', + 'user_info', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_message', compact($vars))); + $template->assign_vars($msg_data); $contact_fields = array( -- cgit v1.2.1 From f788b7384b14914d38788a1ff8b9e35384206aff Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 4 Oct 2017 04:52:41 +0200 Subject: [ticket/15389] Allow arrays in event dispatcher PHPBB3-15389 --- phpBB/phpbb/event/dispatcher.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 1c4abeb108..1ba2ab8987 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -57,7 +57,12 @@ class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_int return $event; } - return parent::dispatch($eventName, $event); + foreach ((array) $eventName as $name) + { + $event = parent::dispatch($name, $event); + } + + return $event; } /** -- cgit v1.2.1 From 6c04a6715c08c1e224aeea8c4889c0258a832524 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 4 Oct 2017 20:12:34 +0200 Subject: [ticket/15389] Match multiple events in dispatcher in php_exporter I've also improved some regular expressions PHPBB3-15389 --- phpBB/phpbb/event/php_exporter.php | 36 +++++++++++++++---------------- tests/event/dispatcher_test.php | 16 ++++++++++++++ tests/event/fixtures/event_migration.test | 30 ++++++++++++++++++++++++++ tests/event/php_exporter_test.php | 19 ++++++++++++++++ 4 files changed, 83 insertions(+), 18 deletions(-) create mode 100644 tests/event/fixtures/event_migration.test diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 26d7e2b426..7b80863305 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -196,13 +196,13 @@ class php_exporter $content = file_get_contents($this->path . $this->current_file); $num_events_found = 0; - if (strpos($content, "dispatcher->trigger_event('") || strpos($content, "dispatcher->dispatch('")) + if (strpos($content, 'dispatcher->trigger_event(') || strpos($content, 'dispatcher->dispatch(')) { $this->set_content(explode("\n", $content)); for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++) { $event_line = false; - $found_trigger_event = strpos($this->file_lines[$i], "dispatcher->trigger_event('"); + $found_trigger_event = strpos($this->file_lines[$i], 'dispatcher->trigger_event('); $arguments = array(); if ($found_trigger_event !== false) { @@ -216,7 +216,7 @@ class php_exporter } else { - $found_dispatch = strpos($this->file_lines[$i], "dispatcher->dispatch('"); + $found_dispatch = strpos($this->file_lines[$i], 'dispatcher->dispatch('); if ($found_dispatch !== false) { $event_line = $i; @@ -316,17 +316,17 @@ class php_exporter if ($is_dispatch) { - $regex = '#\$([a-z](?:[a-z0-9_]|->)*)'; - $regex .= '->dispatch\('; - $regex .= '\'' . $this->preg_match_event_name() . '\''; - $regex .= '\);#'; + $regex = '#\$[a-z](?:[a-z0-9_]|->)*'; + $regex .= '->dispatch\((\[)?'; + $regex .= '\'' . $this->preg_match_event_name() . '(?(1)\', \'(?2))+\''; + $regex .= '(?(1)\])\);#'; } else { - $regex = '#extract\(\$([a-z](?:[a-z0-9_]|->)*)'; - $regex .= '->trigger_event\('; - $regex .= '\'' . $this->preg_match_event_name() . '\''; - $regex .= ', compact\(\$vars\)\)\);#'; + $regex = '#extract\(\$[a-z](?:[a-z0-9_]|->)*'; + $regex .= '->trigger_event\((\[)?'; + $regex .= '\'' . $this->preg_match_event_name() . '(?(1)\', \'(?2))+\''; + $regex .= '(?(1)\]), compact\(\$vars\)\)\);#'; } $match = array(); @@ -359,7 +359,7 @@ class php_exporter public function get_vars_from_array() { $line = ltrim($this->file_lines[$this->current_event_line - 1], "\t"); - if ($line === ');') + if ($line === ');' || $line === '];') { $vars_array = $this->get_vars_from_multi_line_array(); } @@ -370,7 +370,7 @@ class php_exporter foreach ($vars_array as $var) { - if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + if (!preg_match('#^[a-z_][a-z0-9_]*$#i', $var)) { throw new \LogicException("Found invalid var '{$var}' in array for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 3); } @@ -392,11 +392,11 @@ class php_exporter public function get_vars_from_single_line_array($line, $throw_multiline = true) { $match = array(); - preg_match('#^\$vars = (?:\[|array\()\'([a-zA-Z0-9_\' ,]+)\'[\)\]];$#', $line, $match); + preg_match('#^\$vars = (?:(\[)|array\()\'([a-z0-9_\' ,]+)\'(?(1)\]|\));$#i', $line, $match); - if (isset($match[1])) + if (isset($match[2])) { - $vars_array = explode("', '", $match[1]); + $vars_array = explode("', '", $match[2]); if ($throw_multiline && sizeof($vars_array) > 6) { throw new \LogicException('Should use multiple lines for $vars definition ' @@ -420,7 +420,7 @@ class php_exporter { $current_vars_line = 2; $var_lines = array(); - while (ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t") !== '$vars = array(') + while (!in_array(ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t"), ['$vars = array(', '$vars = ['])) { $var_lines[] = substr(trim($this->file_lines[$this->current_event_line - $current_vars_line]), 0, -1); @@ -485,7 +485,7 @@ class php_exporter foreach ($doc_vars as $var) { - if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + if (!preg_match('#^[a-z_][a-z0-9_]*$#i', $var)) { throw new \LogicException("Found invalid @var '{$var}' in docblock for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 4); diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php index 7bba5bf337..da28d24daa 100644 --- a/tests/event/dispatcher_test.php +++ b/tests/event/dispatcher_test.php @@ -29,5 +29,21 @@ class phpbb_event_dispatcher_test extends phpbb_test_case $result = $dispatcher->trigger_event('core.test_event', compact($vars)); $this->assertSame(array('foo' => 'foo2', 'bar' => 'bar2'), $result); + + // Test migrating events + $dispatcher->addListener('core.foo_br', function(\phpbb\event\data $event) { + $event['pi'] = '3.14159'; + }); + $dispatcher->addListener('core.foo_bar', function(\phpbb\event\data $event) { + $event['pi'] = '3.1'; + }); + + + $pi = '3'; + + $vars = array('pi'); + $result = $dispatcher->trigger_event(['core.foo_bar', 'core.foo_br'], compact($vars)); + + $this->assertSame(array('pi' => '3.14159'), $result); } } diff --git a/tests/event/fixtures/event_migration.test b/tests/event/fixtures/event_migration.test new file mode 100644 index 0000000000..b2df9f95df --- /dev/null +++ b/tests/event/fixtures/event_migration.test @@ -0,0 +1,30 @@ +trigger_event(['core.ucp_pm_view_message', 'core.ucp_pm_view_messsage'], compact($vars))); diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index 692a57f93c..21dbb1e1d4 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -37,6 +37,18 @@ class phpbb_event_php_exporter_test extends phpbb_test_case ), ), ), + array( + 'event_migration.test', + array( + 'core.ucp_pm_view_message' => array( + 'event' => 'core.ucp_pm_view_message', + 'file' => 'event_migration.test', + 'arguments' => array('cp_row', 'folder', 'folder_id', 'id', 'message_row', 'mode', 'msg_data', 'msg_id', 'user_info'), + 'since' => '3.1.0-a1', + 'description' => 'Modify pm and sender data before it is assigned to the template', + ), + ), + ), array( 'extra_description.test', array( @@ -240,6 +252,8 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array("\t\$phpbb_dispatcher->dispatch('dispatch.one2.thr_ee4');", 'dispatch.one2.thr_ee4'), array("\$this->dispatcher->dispatch('dispatch.one2');", 'dispatch.one2'), array("\$phpbb_dispatcher->dispatch('dis_patch.one');", 'dis_patch.one'), + array("\$phpbb_dispatcher->dispatch(['dis_patch.one', 'dis_patch.one2']);", 'dis_patch.one'), + array("\$phpbb_dispatcher->dispatch(['dis_patch.one', 'dis_patch.one2', 'dis_patch.two3']);", 'dis_patch.one'), ); } @@ -259,6 +273,8 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array("\$phpbb_dispatcher->dispatch('');"), array("\$phpbb_dispatcher->dispatch('dispatch.2one');"), array("\$phpbb_dispatcher->dispatch('dispatch');"), + array("\$phpbb_dispatcher->dispatch(['dispatch.one']);"), + array("\$phpbb_dispatcher->dispatch(array('dispatch.one', 'dispatch.one2'));"), ); } @@ -279,6 +295,8 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array("\textract(\$phpbb_dispatcher->trigger_event('dispatch.one2.thr_ee4', compact(\$vars)));", 'dispatch.one2.thr_ee4'), array("extract(\$this->dispatcher->trigger_event('dispatch.one2', compact(\$vars)));", 'dispatch.one2'), array("extract(\$phpbb_dispatcher->trigger_event('dis_patch.one', compact(\$vars)));", 'dis_patch.one'), + array("extract(\$phpbb_dispatcher->trigger_event(['dis_patch.one', 'dis_patch.one2'], compact(\$vars)));", 'dis_patch.one'), + array("extract(\$phpbb_dispatcher->trigger_event(['dis_patch.one', 'dis_patch.one2', 'dis_patch.two3'], compact(\$vars)));", 'dis_patch.one'), ); } @@ -301,6 +319,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', \$vars));"), array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', compact(\$var)));"), array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', compact(\$array)));"), + array("extract(\$phpbb_dispatcher->trigger_event(['dispatch.one'], compact(\$vars)));"), array("\$phpbb_dispatcher->trigger_event('dis_patch.one', compact(\$vars));", 'dis_patch.one'), ); } -- cgit v1.2.1 From 4a8aa339d0c0cea719ed235a7a8bd2e00efdb544 Mon Sep 17 00:00:00 2001 From: Sophist Date: Thu, 5 Oct 2017 22:19:08 +0100 Subject: [ticket/15390] Fix vertical bar permission tooltip Fix a vertical bar and menu text running through the Admin Permission Role Tooltip pop-up caused by z-index on menu div (and opacity of the popup of .95 rather than 1). PHPBB3-15390 --- phpBB/adm/style/admin.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 2322b3da88..df47e63096 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -525,7 +525,6 @@ li { padding: 0; border-right: 1px solid #CCCFD3; position: relative; - z-index: 1; } .rtl #menu { @@ -1891,7 +1890,6 @@ li.pagination ul { color: #000; text-align: center; border: 1px solid #AAA; - opacity: .95; } .tooltip span.top { -- cgit v1.2.1 From 4d333e7f706530839b784bb3ef99cd3d6d247593 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Tue, 3 Oct 2017 15:05:21 +0200 Subject: [ticket/13150] Add core.phpbb_log_get_topic_auth_sql_after PHPBB3-13150 --- phpBB/phpbb/log/log.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 8f199cd931..9b93c6a2db 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -928,6 +928,20 @@ class log implements \phpbb\log\log_interface $forum_auth['f_read'][$row['topic_id']] = $row['forum_id']; } + /** + * Allow modifying SQL query after topic data is retrieved (inside loop). + * + * @event core.phpbb_log_get_topic_auth_sql_after + * @var array forum_auth Forum permissions + * @var array row One row of data from SQL query + * @since 3.2.2-RC1 + */ + $vars = array( + 'forum_auth', + 'row', + ); + extract($this->dispatcher->trigger_event('core.phpbb_log_get_topic_auth_sql_after', compact($vars))); + if ($this->auth->acl_gets('a_', 'm_', $row['forum_id'])) { $forum_auth['m_'][$row['topic_id']] = $row['forum_id']; -- cgit v1.2.1 From f57e3778470ad7df2e69b839fd329e53eb524481 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 12 Oct 2017 21:56:59 +0200 Subject: [ticket/15353] Use empty where applicable PHPBB3-15353 --- phpBB/phpbb/install/module/update_filesystem/task/diff_files.php | 4 ++-- .../install/module/update_filesystem/task/download_updated_files.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index b15e32cc82..8151a24f2d 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -208,7 +208,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (count($files) < 1) + if (empty($files)) { unset($update_files[$type]); } @@ -226,7 +226,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (count($files) < 1) + if (empty($files)) { unset($update_files[$type]); } diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php index 2fc756c20a..0b83e9a79d 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -101,12 +101,12 @@ class download_updated_files extends task_base 'update_recheck_files_submit' => array( 'label' => 'UPDATE_RECHECK_UPDATE_FILES', 'type' => 'submit', - 'is_secondary' => count($file_update_info) < 1, + 'is_secondary' => empty($file_update_info), ), 'database_update_submit' => array( 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', 'type' => 'submit', - 'disabled' => count($file_update_info) > 0, + 'disabled' => !empty($file_update_info), ), )); -- cgit v1.2.1 From 3f95d49fee64d05ad03fab9ea1363de7e2fad4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 17 Oct 2017 18:45:56 +0200 Subject: [ticket/15041] Add pagination to orphaned attachments PHPBB3-15041 --- phpBB/adm/style/acp_attachments.html | 24 +++++++++++++++++++++-- phpBB/includes/acp/acp_attachments.php | 35 +++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index e1f7f140c9..5e0c841d2b 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -329,6 +329,17 @@
{L_TITLE} + + @@ -359,7 +370,16 @@
-
+ + +

  @@ -440,7 +460,7 @@

{L_MARK_ALL} • - {L_UNMARK_ALL} + {L_UNMARK_ALL}

diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 3cfe5de293..2480f1f025 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -922,6 +922,9 @@ class acp_attachments case 'orphan': + /* @var $pagination \phpbb\pagination */ + $pagination = $this->phpbb_container->get('pagination'); + if ($submit) { $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); @@ -1064,13 +1067,29 @@ class acp_attachments 'S_ORPHAN' => true) ); + $attachments_per_page = (int) $config['topics_per_page']; + + // Get total number or orphans older than 3 hours + $sql = 'SELECT COUNT(attach_id) as num_files, SUM(filesize) as total_size + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $num_files = (int) $row['num_files']; + $total_size = (int) $row['total_size']; + $this->db->sql_freeresult($result); + + $start = $request->variable('start', 0); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + // Just get the files with is_orphan set and older than 3 hours $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 1 AND filetime < ' . (time() - 3*60*60) . ' ORDER BY filetime DESC'; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, $attachments_per_page, $start); while ($row = $db->sql_fetchrow($result)) { @@ -1086,6 +1105,20 @@ class acp_attachments } $db->sql_freeresult($result); + $pagination->generate_template_pagination( + $this->u_action, + 'pagination', + 'start', + $num_files, + $attachments_per_page, + $start + ); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + )); + break; case 'manage': -- cgit v1.2.1 From cc361144f9d53890f3a846df2e1ccc8e7544f849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 17 Oct 2017 18:56:00 +0200 Subject: [ticket/15041] Show error if there are not attachments PHPBB3-15041 --- phpBB/adm/style/acp_attachments.html | 71 ++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 5e0c841d2b..2baca09f5e 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -340,35 +340,41 @@ - - - - - - - - - - - - - + +
{L_FILENAME}{L_FILEDATE}{L_FILESIZE}{L_ATTACH_POST_ID}{L_ATTACH_TO_POST}{L_DELETE}
+ - - - - - - + + + + + + - - - - - - - -
{orphan.REAL_FILENAME}{orphan.FILETIME}{orphan.FILESIZE}{L_ATTACH_ID}{L_COLON} {L_FILENAME}{L_FILEDATE}{L_FILESIZE}{L_ATTACH_POST_ID}{L_ATTACH_TO_POST}{L_DELETE}
 {L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
+ + + + + {orphan.REAL_FILENAME} + {orphan.FILETIME} + {orphan.FILESIZE} + {L_ATTACH_ID}{L_COLON} + + + + + +   + {L_MARK_ALL} :: {L_UNMARK_ALL} + {L_MARK_ALL} :: {L_UNMARK_ALL} + + + + +
+

{L_NO_ATTACHMENTS}

+
+ -

-   - -

+ +

+   + +

+ + {S_FORM_TOKEN}
-- cgit v1.2.1 From 60596eb6756e3d2181ee6670cd123911b04524bf Mon Sep 17 00:00:00 2001 From: kasimi Date: Mon, 23 Oct 2017 22:36:29 +0200 Subject: [ticket/15060] Set correct forum id in user session data if f= is missing PHPBB3-15060 --- phpBB/viewtopic.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c94675a741..3f117eef6b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -263,6 +263,10 @@ if (!$topic_data) $forum_id = (int) $topic_data['forum_id']; +// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment. +// Let's fix that now so that the user can't hide from the forum's Who Is Online list. +$user->page['forum'] = $forum_id; + // Now we know the forum_id and can check the permissions if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id)) { -- cgit v1.2.1 From 4f0b736f14e6d51dcf19e93897fe5386023369e7 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 24 Oct 2017 20:35:25 +0700 Subject: [ticket/15419] Fix Sphinx UTF8 search in delta index PHPBB3-15419 --- phpBB/phpbb/search/fulltext_sphinx.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 59c3d55076..a20e3ad4b5 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -304,7 +304,7 @@ class fulltext_sphinx array('sql_attr_string', 'post_subject'), ), 'source source_phpbb_' . $this->id . '_delta : source_phpbb_' . $this->id . '_main' => array( - array('sql_query_pre', ''), + array('sql_query_pre', 'SET NAMES \'utf8\''), array('sql_query_range', ''), array('sql_range_step', ''), array('sql_query', 'SELECT @@ -324,6 +324,7 @@ class fulltext_sphinx WHERE p.topic_id = t.topic_id AND p.post_id >= ( SELECT max_doc_id FROM ' . SPHINX_TABLE . ' WHERE counter_id=1 )'), + array('sql_query_post_index', ''), ), 'index index_phpbb_' . $this->id . '_main' => array( array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_main'), -- cgit v1.2.1 From dc5267728bd3352e3546ac9819365cadf5aaaae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Sun, 24 Sep 2017 21:21:01 -0400 Subject: [ticket/15372] Add and handle f_list_topics permission --- phpBB/includes/functions_display.php | 2 +- phpBB/language/en/acp/permissions_phpbb.php | 1 + phpBB/language/en/viewforum.php | 2 +- phpBB/phpbb/permissions.php | 1 + phpBB/viewforum.php | 12 ++++++------ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 32bee14eef..171a73a8de 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -537,7 +537,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Create last post link information, if appropriate if ($row['forum_last_post_id']) { - if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post'])) + if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post'])) { $last_post_subject = censor_text($row['forum_last_post_subject']); $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']); diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index f986eced38..64740b311b 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -107,6 +107,7 @@ $lang = array_merge($lang, array( // Forum Permissions $lang = array_merge($lang, array( 'ACL_F_LIST' => 'Can see forum', + 'ACL_F_LIST_TOPICS' => 'Can see topics', 'ACL_F_READ' => 'Can read forum', 'ACL_F_SEARCH' => 'Can search the forum', 'ACL_F_SUBSCRIBE' => 'Can subscribe forum', diff --git a/phpBB/language/en/viewforum.php b/phpBB/language/en/viewforum.php index 9946a3eda4..cab205ddf9 100644 --- a/phpBB/language/en/viewforum.php +++ b/phpBB/language/en/viewforum.php @@ -53,7 +53,7 @@ $lang = array_merge($lang, array( 'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', // Not used anymore 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', // Not used anymore 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', // Not used anymore - 'NO_READ_ACCESS' => 'You do not have the required permissions to read topics within this forum.', + 'NO_READ_ACCESS' => 'You do not have the required permissions to view or read topics within this forum.', 'NO_UNREAD_POSTS_HOT' => 'No unread posts [ Popular ]', 'NO_UNREAD_POSTS_LOCKED' => 'No unread posts [ Locked ]', diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index c9181e6202..7697884b6a 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -260,6 +260,7 @@ class permissions // Forum Permissions 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), + 'f_list_topics' => array('lang' => 'ACL_F_LIST_TOPICS', 'cat' => 'actions'), 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 9cc75988f7..6b561dd3b2 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -87,7 +87,7 @@ if (isset($_GET['e']) && !$user->data['is_registered']) } // Permissions check -if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id))) +if (!$auth->acl_gets('f_list', 'f_list_topics', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id))) { if ($user->data['user_id'] != ANONYMOUS) { @@ -181,7 +181,7 @@ if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] & // Ok, if someone has only list-access, we only display the forum list. // We also make this circumstance available to the template in case we want to display a notice. ;) -if (!$auth->acl_get('f_read', $forum_id)) +if (!$auth->acl_gets('f_read', 'f_list_topics', $forum_id)) { $template->assign_vars(array( 'S_NO_READ_ACCESS' => true, @@ -732,7 +732,7 @@ if (sizeof($shadow_topic_list)) } // Do not include those topics the user has no permission to access - if (!$auth->acl_get('f_read', $row['forum_id'])) + if (!$auth->acl_gets('f_read', 'f_list_topics', $row['forum_id'])) { // We need to remove any trace regarding this topic. :) unset($rowset[$orig_topic_id]); @@ -875,7 +875,7 @@ if (sizeof($topic_list)) // Generate all the URIs ... $view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id; - $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); + $view_topic_url = $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params) : false; $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])); $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])); @@ -929,8 +929,8 @@ if (sizeof($topic_list)) 'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false, 'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false, - 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread', - 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], + 'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread' : false, + 'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false, 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, -- cgit v1.2.1 From e55480385b5c7d49030d3f380bf2c1349695033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Sun, 24 Sep 2017 21:32:53 -0400 Subject: [ticket/15372] Migration for adding f_list_topic permission --- .../data/v32x/f_list_topics_permission_add.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php diff --git a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php new file mode 100644 index 0000000000..175c27da03 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php @@ -0,0 +1,38 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v32x; + +class f_list_topics_permission_add extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function update_data() + { + return array( + array('permission.add', array('f_list_topics', false)), + ); + } + + public function revert_data() + { + return array( + array('permission.remove', array('f_list_topics', false)), + ); + } +} -- cgit v1.2.1 From 2ba529e144d2101ea3407d39ecd7e7a043029978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Sun, 24 Sep 2017 22:07:25 -0400 Subject: [ticket/15372] Fix pagination and don't render viewtopic link --- phpBB/phpbb/pagination.php | 5 +++++ phpBB/styles/prosilver/template/viewforum_body.html | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php index a5a95b096d..40af5eda6b 100644 --- a/phpBB/phpbb/pagination.php +++ b/phpBB/phpbb/pagination.php @@ -136,6 +136,11 @@ class pagination */ public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false) { + if (empty($base_url)) + { + return; + } + $total_pages = ceil($num_items / $per_page); $on_page = $this->get_on_page($per_page, $start); $u_previous_page = $u_next_page = ''; diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 16d972056d..e03ef412e4 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -165,7 +165,7 @@ {NEW_POST} - {topicrow.TOPIC_TITLE} + {topicrow.TOPIC_TITLE}{topicrow.TOPIC_TITLE} {L_TOPIC_UNAPPROVED} @@ -224,7 +224,7 @@
{topicrow.VIEWS} {L_VIEWS}
{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - + {VIEW_LATEST_POST} -- cgit v1.2.1 From 4ae7cb89ff55902ab50393e1f7aa81b4b055f511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Sun, 24 Sep 2017 22:48:51 -0400 Subject: [ticket/15372] Remove revert_data from migration --- .../phpbb/db/migration/data/v32x/f_list_topics_permission_add.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php index 175c27da03..e4b77d0f0f 100644 --- a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php +++ b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php @@ -28,11 +28,4 @@ class f_list_topics_permission_add extends \phpbb\db\migration\migration array('permission.add', array('f_list_topics', false)), ); } - - public function revert_data() - { - return array( - array('permission.remove', array('f_list_topics', false)), - ); - } } -- cgit v1.2.1 From 33ceceda021160b73fe9d7333e9e950308da5569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Thu, 26 Oct 2017 16:21:50 -0400 Subject: [ticket/15372] Add permission to schema and copy from f_read --- phpBB/install/schemas/schema_data.sql | 5 +++-- phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ca0e8bd614..fa61f45366 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -328,6 +328,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_icons', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_ignoreflood', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_img', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_list', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_list_topics', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_noapprove', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_poll', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_post', 1); @@ -565,13 +566,13 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_'; # Read Only Access (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_list_topics', 'f_read', 'f_search', 'f_subscribe', 'f_print'); # Limited Access (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg'); # Bot Access (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_print'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_list_topics', 'f_read', 'f_print'); # On Moderation Queue (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove'); diff --git a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php index e4b77d0f0f..49727e5a62 100644 --- a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php +++ b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php @@ -25,7 +25,7 @@ class f_list_topics_permission_add extends \phpbb\db\migration\migration public function update_data() { return array( - array('permission.add', array('f_list_topics', false)), + array('permission.add', array('f_list_topics', false, 'f_read')), ); } } -- cgit v1.2.1 From a35a225adfbf1cc8f9aa20f9db11103e8124d395 Mon Sep 17 00:00:00 2001 From: kasimi Date: Fri, 27 Oct 2017 11:04:22 +0200 Subject: [ticket/15423] Fix wrong title for topic's "Unappproved posts" icon PHPBB3-15423 --- phpBB/styles/prosilver/template/viewforum_body.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 16d972056d..7291e3a617 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -167,8 +167,8 @@ {topicrow.TOPIC_TITLE} - - {L_TOPIC_UNAPPROVED} + + {L_TOPIC_UNAPPROVED}{L_POSTS_UNAPPROVED} -- cgit v1.2.1 From dcf33148a70dc4812f08e84b9d5ed3105272ff10 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sat, 28 Oct 2017 03:46:43 +0200 Subject: [ticket/15195] Fix code block in rtl print version PHPBB3-15195 --- phpBB/styles/prosilver/template/viewtopic_print.html | 3 ++- phpBB/styles/prosilver/theme/print.css | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 3c1ed4c3f1..b504949053 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -8,9 +8,10 @@ {SITENAME} • {PAGE_TITLE} + - +
diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index a83270b742..9445279773 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -133,6 +133,8 @@ ol, ul { /* Misc page elements */ div.spacer { clear: both; } +code { display: block; } + /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } -- cgit v1.2.1 From 9c8eb3de900553f334cf5280ea0a00070489e9cf Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Oct 2017 11:04:47 +0100 Subject: [ticket/15133] Update fast-image-size to 1.1.4 Fixes various issues with JPEG, TIFF, and adds WebP support. PHPBB3-15133 --- phpBB/composer.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 9345d07dbf..0e042c3b2d 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -346,19 +346,20 @@ }, { "name": "marc1706/fast-image-size", - "version": "v1.1.3", + "version": "v1.1.4", "source": { "type": "git", "url": "https://github.com/marc1706/fast-image-size.git", - "reference": "5f7e8377746524e2b8a49a631c1fc9afeb9d8bee" + "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/5f7e8377746524e2b8a49a631c1fc9afeb9d8bee", - "reference": "5f7e8377746524e2b8a49a631c1fc9afeb9d8bee", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/c4ded0223a4e49ae45a2183a69f6afac5baf7250", + "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250", "shasum": "" }, "require": { + "ext-mbstring": "*", "php": ">=5.3.0" }, "require-dev": { @@ -393,7 +394,7 @@ "php", "size" ], - "time": "2017-03-26 12:48:28" + "time": "2017-10-23 18:52:01" }, { "name": "ocramius/proxy-manager", -- cgit v1.2.1 From e32324c72a33b9ef5baf5233a88963bc13066f8e Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 12 Jan 2017 21:54:40 +0100 Subject: [ticket/14994] Refactor template->assign_block_var Refactor assign_block_var to use the same block selection mechanism as is used in alter_block_array. This allows creating new blocks at any position in the template structure, not only on the last block. Allows selecting a block as outer[2].middle. PHPBB3-14994 --- phpBB/phpbb/template/context.php | 97 +++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 392efd5933..55d7b9c861 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -190,70 +190,65 @@ class context public function assign_block_vars($blockname, array $vararray) { $this->num_rows_is_set = false; - if (strpos($blockname, '.') !== false) - { - // Nested block. - $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; - - $str = &$this->tpldata; - for ($i = 0; $i < $blockcount; $i++) - { - $str = &$str[$blocks[$i]]; - $str = &$str[sizeof($str) - 1]; - } - $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0; - $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; - // Assign S_FIRST_ROW - if (!$s_row_count) + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) { - $vararray['S_FIRST_ROW'] = true; - } - - // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blocks[$blockcount]; + $name = substr($blocks[$i], 0, $pos); - // Now the tricky part, we always assign S_LAST_ROW and remove the entry before - // This is much more clever than going through the complete template data on display (phew) - $vararray['S_LAST_ROW'] = true; - if ($s_row_count > 0) + 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 { - unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']); + $name = $blocks[$i]; + $index = sizeof($block[$name]) - 1; } - - // Now we add the block that we're actually assigning to. - // We're adding a new iteration to this block with the given - // variable assignments. - $str[$blocks[$blockcount]][] = $vararray; + $block = &$block[$name]; + $block = &$block[$index]; } - else - { - // Top-level block. - $s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0; - $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; - // Assign S_FIRST_ROW - if (!$s_row_count) - { - $vararray['S_FIRST_ROW'] = true; - } + // $block = &$block[$blocks[$i]]; // Do not traverse the last block as it might be empty + $name = $blocks[$i]; - // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blockname; + // Assign S_ROW_COUNT and S_ROW_NUM + $s_row_count = isset($block[$name]) ? sizeof($block[$name]) : 0; + $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; - // We always assign S_LAST_ROW and remove the entry before - $vararray['S_LAST_ROW'] = true; - if ($s_row_count > 0) - { - unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); - } + // Assign S_FIRST_ROW + if (!$s_row_count) + { + $vararray['S_FIRST_ROW'] = true; + } - // Add a new iteration to this block with the variable assignments we were given. - $this->tpldata[$blockname][] = $vararray; + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; + + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + { + unset($block[$name][($s_row_count - 1)]['S_LAST_ROW']); } + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $block[$name][] = $vararray; + return true; } -- cgit v1.2.1 From 53e8e1262152c06a5692ae2d6ea47647ddf8e3e4 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Oct 2017 11:24:50 +0100 Subject: [ticket/15133] Update other dependencies to latest versions as well PHPBB3-15133 --- phpBB/composer.lock | 267 +++++++++++++++++++++++++++------------------------- 1 file changed, 137 insertions(+), 130 deletions(-) diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 0e042c3b2d..c1bdf26e02 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -661,16 +661,16 @@ }, { "name": "s9e/text-formatter", - "version": "0.11.0", + "version": "0.11.2", "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "664b3eaf52baaae4d93548f5e20246fa5942b2b9" + "reference": "735a56076e29348d838ce6c2658996daae86718f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/664b3eaf52baaae4d93548f5e20246fa5942b2b9", - "reference": "664b3eaf52baaae4d93548f5e20246fa5942b2b9", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/735a56076e29348d838ce6c2658996daae86718f", + "reference": "735a56076e29348d838ce6c2658996daae86718f", "shasum": "" }, "require": { @@ -722,20 +722,20 @@ "parser", "shortcodes" ], - "time": "2017-08-04 23:06:38" + "time": "2017-10-02 16:58:51" }, { "name": "symfony/config", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "0b8541d18507d10204a08384640ff6df3c739ebe" + "reference": "1dbeaa8e2db4b29159265867efff075ad961558c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe", - "reference": "0b8541d18507d10204a08384640ff6df3c739ebe", + "url": "https://api.github.com/repos/symfony/config/zipball/1dbeaa8e2db4b29159265867efff075ad961558c", + "reference": "1dbeaa8e2db4b29159265867efff075ad961558c", "shasum": "" }, "require": { @@ -778,20 +778,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-10-04 18:56:36" }, { "name": "symfony/console", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "efa4d466b67c2fc9bf9419a981e683e1f99fa029" + "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/efa4d466b67c2fc9bf9419a981e683e1f99fa029", - "reference": "efa4d466b67c2fc9bf9419a981e683e1f99fa029", + "url": "https://api.github.com/repos/symfony/console/zipball/f81549d2c5fdee8d711c9ab3c7e7362353ea5853", + "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853", "shasum": "" }, "require": { @@ -839,20 +839,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:07:33" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/debug", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f" + "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/344f50ce827413b3640bfcb1e37386a67d06ea1f", - "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f", + "url": "https://api.github.com/repos/symfony/debug/zipball/eaaec993ca5e8067e204b2ee653cdd142961f33e", + "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e", "shasum": "" }, "require": { @@ -896,20 +896,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-04-19 19:56:30" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/dependency-injection", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "155b770e68150139779295864d6b6cb3172cd821" + "reference": "2562562610dbdabbb98c6ceb60459a351811c734" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/155b770e68150139779295864d6b6cb3172cd821", - "reference": "155b770e68150139779295864d6b6cb3172cd821", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2562562610dbdabbb98c6ceb60459a351811c734", + "reference": "2562562610dbdabbb98c6ceb60459a351811c734", "shasum": "" }, "require": { @@ -959,20 +959,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-05-25 22:57:22" + "time": "2017-10-02 07:17:52" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531" + "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fc8e2b4118ff316550596357325dfd92a51f531", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fe089232554357efb8d4af65ce209fc6e5a2186", + "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186", "shasum": "" }, "require": { @@ -1019,20 +1019,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26 16:56:54" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/filesystem", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c" + "reference": "5e3af878f144089faddd4060a48cadae4fc44dee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5e3af878f144089faddd4060a48cadae4fc44dee", + "reference": "5e3af878f144089faddd4060a48cadae4fc44dee", "shasum": "" }, "require": { @@ -1068,20 +1068,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:07:33" + "time": "2017-10-02 08:46:46" }, { "name": "symfony/finder", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b058a6f0cb6ee9b6b727aae03d5a62474a308528" + "reference": "a945724b201f74d543e356f6059c930bb8d10c92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b058a6f0cb6ee9b6b727aae03d5a62474a308528", - "reference": "b058a6f0cb6ee9b6b727aae03d5a62474a308528", + "url": "https://api.github.com/repos/symfony/finder/zipball/a945724b201f74d543e356f6059c930bb8d10c92", + "reference": "a945724b201f74d543e356f6059c930bb8d10c92", "shasum": "" }, "require": { @@ -1117,20 +1117,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-05-25 22:57:22" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/http-foundation", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "03bf5ded5a4b54473e7551df5cfab854f7434ed4" + "reference": "e6e0170e134bf25d03030b71a19ca409e036157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/03bf5ded5a4b54473e7551df5cfab854f7434ed4", - "reference": "03bf5ded5a4b54473e7551df5cfab854f7434ed4", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e6e0170e134bf25d03030b71a19ca409e036157a", + "reference": "e6e0170e134bf25d03030b71a19ca409e036157a", "shasum": "" }, "require": { @@ -1172,20 +1172,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-05-19 11:49:58" + "time": "2017-10-05 23:06:47" }, { "name": "symfony/http-kernel", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ae9dd4cfde4a3efa94475863fc330825715fe549" + "reference": "d912b76d7db324f7650da9d1132be78c5f7ceb93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ae9dd4cfde4a3efa94475863fc330825715fe549", - "reference": "ae9dd4cfde4a3efa94475863fc330825715fe549", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d912b76d7db324f7650da9d1132be78c5f7ceb93", + "reference": "d912b76d7db324f7650da9d1132be78c5f7ceb93", "shasum": "" }, "require": { @@ -1196,7 +1196,8 @@ "symfony/http-foundation": "~2.7.20|~2.8.13|~3.1.6" }, "conflict": { - "symfony/config": "<2.7" + "symfony/config": "<2.7", + "twig/twig": "<1.34|<2.4,>=2" }, "require-dev": { "symfony/browser-kit": "~2.3|~3.0.0", @@ -1254,20 +1255,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-05-29 19:14:58" + "time": "2017-10-05 23:24:02" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -1279,7 +1280,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1313,20 +1314,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/polyfill-php54", - "version": "v1.3.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + "reference": "d7810a14b2c6c1aff415e1bb755f611b3d5327bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/d7810a14b2c6c1aff415e1bb755f611b3d5327bc", + "reference": "d7810a14b2c6c1aff415e1bb755f611b3d5327bc", "shasum": "" }, "require": { @@ -1335,7 +1336,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1371,20 +1372,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/polyfill-php55", - "version": "v1.3.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" + "reference": "b64e7f0c37ecf144ecc16668936eef94e628fbfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/b64e7f0c37ecf144ecc16668936eef94e628fbfd", + "reference": "b64e7f0c37ecf144ecc16668936eef94e628fbfd", "shasum": "" }, "require": { @@ -1394,7 +1395,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1427,20 +1428,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/proxy-manager-bridge", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "991c0fcd1d461ee9c7cde7d2c44d1ed7f4cc36ae" + "reference": "2513b97c244414c45d2c64e2f421b718daacebaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/991c0fcd1d461ee9c7cde7d2c44d1ed7f4cc36ae", - "reference": "991c0fcd1d461ee9c7cde7d2c44d1ed7f4cc36ae", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/2513b97c244414c45d2c64e2f421b718daacebaa", + "reference": "2513b97c244414c45d2c64e2f421b718daacebaa", "shasum": "" }, "require": { @@ -1481,20 +1482,20 @@ ], "description": "Symfony ProxyManager Bridge", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/routing", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "a8f328c7e701b7bb05a93fca62a5ab2b6b3e500e" + "reference": "74808bc927c173935edc31e331d742698b055d0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/a8f328c7e701b7bb05a93fca62a5ab2b6b3e500e", - "reference": "a8f328c7e701b7bb05a93fca62a5ab2b6b3e500e", + "url": "https://api.github.com/repos/symfony/routing/zipball/74808bc927c173935edc31e331d742698b055d0a", + "reference": "74808bc927c173935edc31e331d742698b055d0a", "shasum": "" }, "require": { @@ -1556,32 +1557,35 @@ "uri", "url" ], - "time": "2017-04-12 14:07:15" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/twig-bridge", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "362aa855b5819355811b58f8b5f15679196a181e" + "reference": "624cfc984d47ac5d3a940ba53bd14c4550c8a9e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/362aa855b5819355811b58f8b5f15679196a181e", - "reference": "362aa855b5819355811b58f8b5f15679196a181e", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/624cfc984d47ac5d3a940ba53bd14c4550c8a9e4", + "reference": "624cfc984d47ac5d3a940ba53bd14c4550c8a9e4", "shasum": "" }, "require": { "php": ">=5.3.9", - "twig/twig": "~1.28|~2.0" + "twig/twig": "~1.34|~2.4" + }, + "conflict": { + "symfony/form": "<2.8.23" }, "require-dev": { "symfony/asset": "~2.7|~3.0.0", "symfony/console": "~2.8|~3.0.0", "symfony/expression-language": "~2.4|~3.0.0", "symfony/finder": "~2.3|~3.0.0", - "symfony/form": "^2.8.19", + "symfony/form": "^2.8.23", "symfony/http-kernel": "~2.8|~3.0.0", "symfony/polyfill-intl-icu": "~1.0", "symfony/routing": "~2.2|~3.0.0", @@ -1637,20 +1641,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/yaml", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" + "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "url": "https://api.github.com/repos/symfony/yaml/zipball/842fb6df22180244b4c65935ce1a88d324e5ff9e", + "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e", "shasum": "" }, "require": { @@ -1686,24 +1690,24 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-10-05 14:38:30" }, { "name": "twig/twig", - "version": "v1.33.2", + "version": "v1.35.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927" + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/dd6ca96227917e1e85b41c7c3cc6507b411e0927", - "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/daa657073e55b0a78cce8fdd22682fddecc6385f", + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f", "shasum": "" }, "require": { - "php": ">=5.2.7" + "php": ">=5.3.3" }, "require-dev": { "psr/container": "^1.0", @@ -1713,12 +1717,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.33-dev" + "dev-master": "1.35-dev" } }, "autoload": { "psr-0": { "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1748,7 +1755,7 @@ "keywords": [ "templating" ], - "time": "2017-04-20 17:39:48" + "time": "2017-09-27 18:06:46" }, { "name": "zendframework/zend-code", @@ -2295,22 +2302,22 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "v1.7.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -2321,7 +2328,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -2354,7 +2361,7 @@ "spy", "stub" ], - "time": "2017-03-02 20:05:34" + "time": "2017-09-04 11:05:03" }, { "name": "phpunit/dbunit", @@ -2665,16 +2672,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.35", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -2733,7 +2740,7 @@ "testing", "xunit" ], - "time": "2017-02-06 05:18:07" + "time": "2017-06-21 08:07:12" }, { "name": "phpunit/phpunit-mock-objects", @@ -3346,16 +3353,16 @@ }, { "name": "symfony/browser-kit", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "4386755566fc8d29bddf89694663b0e96cb01e61" + "reference": "87a03da13c5110e6638e874803437dcd5c76d472" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/4386755566fc8d29bddf89694663b0e96cb01e61", - "reference": "4386755566fc8d29bddf89694663b0e96cb01e61", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/87a03da13c5110e6638e874803437dcd5c76d472", + "reference": "87a03da13c5110e6638e874803437dcd5c76d472", "shasum": "" }, "require": { @@ -3399,20 +3406,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/css-selector", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "ba3204654efa779691fac9e948a96b4a7067e4ab" + "reference": "ef01ca1352deb0c029cf496a89a6b175659c1ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/ba3204654efa779691fac9e948a96b4a7067e4ab", - "reference": "ba3204654efa779691fac9e948a96b4a7067e4ab", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/ef01ca1352deb0c029cf496a89a6b175659c1ec3", + "reference": "ef01ca1352deb0c029cf496a89a6b175659c1ec3", "shasum": "" }, "require": { @@ -3452,20 +3459,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/dom-crawler", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "b19d01ec41c704497b0bee78bce8bf97619c0649" + "reference": "6433e25f338ff174dc9429283354faf06df05f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b19d01ec41c704497b0bee78bce8bf97619c0649", - "reference": "b19d01ec41c704497b0bee78bce8bf97619c0649", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6433e25f338ff174dc9429283354faf06df05f67", + "reference": "6433e25f338ff174dc9429283354faf06df05f67", "shasum": "" }, "require": { @@ -3508,20 +3515,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-05-25 22:57:22" + "time": "2017-10-01 21:00:16" }, { "name": "symfony/process", - "version": "v2.8.21", + "version": "v2.8.28", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" + "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", + "url": "https://api.github.com/repos/symfony/process/zipball/26c9fb02bf06bd6b90f661a5bd17e510810d0176", + "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176", "shasum": "" }, "require": { @@ -3557,7 +3564,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-08 01:19:21" + "time": "2017-10-01 21:00:16" } ], "aliases": [], -- cgit v1.2.1 From 508caa9bd49a09bed3f09c31c1e5d78584b388a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sun, 1 Oct 2017 17:41:08 +0200 Subject: [ticket/15171] Replace all BBCode templates by default PHPBB3-15171 --- phpBB/includes/acp/acp_styles.php | 22 +++++++++++----------- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/styles/prosilver/style.cfg | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5b31417b83..7acb635195 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1355,18 +1355,18 @@ class acp_styles } // Hardcoded template bitfield to add for new templates + $default_bitfield = '1111111111111'; + $bitfield = new bitfield(); - $bitfield->set(0); - $bitfield->set(1); - $bitfield->set(2); - $bitfield->set(3); - $bitfield->set(4); - $bitfield->set(8); - $bitfield->set(9); - $bitfield->set(11); - $bitfield->set(12); - $value = $bitfield->get_base64(); - return $value; + for ($i = 0; $i < strlen($default_bitfield); $i++) + { + if($default_bitfield[$i] == '1') + { + $bitfield->set($i); + } + } + + return $bitfield->get_base64(); } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ca0e8bd614..6ddf3d7ad8 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -477,7 +477,7 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10); # -- phpbb_styles -INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', 'kNg=', 0, ''); +INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', '//g=', 0, ''); # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, ''); diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 2deceef788..ea4e899109 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -25,7 +25,7 @@ style_version = 3.2.1 phpbb_version = 3.2.1 # Defining a different template bitfield -# template_bitfield = lNg= +# template_bitfield = //g= # Parent style # Set value to empty or to this style's name if this style does not have a parent style -- cgit v1.2.1 From 3bfd006e77853d5a84f822269601d41d152fe89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 2 Oct 2017 16:01:14 +0200 Subject: [ticket/15171] Fix texformatter PHPBB3-15171 --- phpBB/phpbb/textformatter/s9e/factory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index d5ad8283d9..15d0a5e3e5 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -78,7 +78,7 @@ class factory implements \phpbb\textformatter\cache_interface 'b' => '[B]{TEXT}[/B]', 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', - 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT;optional;postFilter=rawurlencode} body={TEXT;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT1;optional;postFilter=rawurlencode} body={TEXT2;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', 'i' => '[I]{TEXT}[/I]', 'img' => '[IMG src={IMAGEURL;useContent}]', -- cgit v1.2.1 From a0ba57dc4f39804cd52f69b6342c1e2f5f1acea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 2 Oct 2017 16:29:53 +0200 Subject: [ticket/15171] Fix test PHPBB3-15171 --- phpBB/includes/acp/acp_styles.php | 2 +- tests/functional/posting_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 7acb635195..4c390c5f0e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1360,7 +1360,7 @@ class acp_styles $bitfield = new bitfield(); for ($i = 0; $i < strlen($default_bitfield); $i++) { - if($default_bitfield[$i] == '1') + if ($default_bitfield[$i] == '1') { $bitfield->set($i); } diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 8e6328d1d3..764376a945 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -235,7 +235,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case )); $crawler = self::submit($form); $this->assertContains( - 'My signature', + 'My signature', $crawler->filter('#preview .signature')->html() ); } -- cgit v1.2.1 From 4bf0f4a50f34e00fb80299119f98c23ee426dc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 31 Oct 2017 14:37:36 +0100 Subject: [ticket/15171] Add migration PHPBB3-15171 --- .../data/v32x/update_prosilver_bitfield.php | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php diff --git a/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php new file mode 100644 index 0000000000..6e51a01834 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php @@ -0,0 +1,39 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class update_prosilver_bitfield extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_bbcode_bitfield'))), + ); + } + + public function update_bbcode_bitfield() + { + $sql = 'UPDATE ' . STYLES_TABLE . " + SET bbcode_bitfield = '//g=' + WHERE style_path = 'prosilver'"; + $this->sql_query($sql); + } +} -- cgit v1.2.1 From be15e26e5f4ee19fa6b40994b50875674f92e963 Mon Sep 17 00:00:00 2001 From: kasimi Date: Tue, 31 Oct 2017 14:56:41 +0100 Subject: [ticket/15431] Add event core.ucp_register_modify_template_data PHPBB3-15431 --- phpBB/includes/ucp/ucp_register.php | 41 ++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 594100ac65..83966cdaae 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -528,10 +528,7 @@ class ucp_register break; } - // Assign template vars for timezone select - phpbb_timezone_select($template, $user, $data['tz'], true); - - $template->assign_vars(array( + $template_vars = array( 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], @@ -552,7 +549,37 @@ class ucp_register 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path'], - )); + ); + + $tpl_name = 'ucp_register'; + $page_title = 'UCP_REGISTRATION'; + + /** + * Modify template data on the registration page + * + * @event core.ucp_register_modify_template_data + * @var array template_vars Array with template data + * @var array data Array with user data + * @var array error Array with errors + * @var array s_hidden_fields Array hidden form fields + * @var string tpl_name Template name + * @var string page_title Page title + * @since 3.2.2-RC1 + */ + $vars = array( + 'template_vars', + 'data', + 'error', + 's_hidden_fields', + 'tpl_name', + 'page_title', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); + + // Assign template vars for timezone select + phpbb_timezone_select($template, $user, $data['tz'], true); + + $template->assign_vars($template_vars); // $user->profile_fields = array(); @@ -561,8 +588,8 @@ class ucp_register $cp->generate_profile_fields('register', $user->get_iso_lang_id()); // - $this->tpl_name = 'ucp_register'; - $this->page_title = 'UCP_REGISTRATION'; + $this->tpl_name = $tpl_name; + $this->page_title = $page_title; } /** -- cgit v1.2.1 From 8df79ba5a44eb96545306f90b49207acb99dbce4 Mon Sep 17 00:00:00 2001 From: kasimi Date: Tue, 31 Oct 2017 17:36:29 +0100 Subject: [ticket/15432] Don't remove dark background if fadedark is false PHPBB3-15432 --- phpBB/assets/javascript/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index a88719f1df..359afb1ec4 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -179,7 +179,7 @@ phpbb.alert.close = function($alert, fadedark) { phpbb.confirm = function(msg, callback, fadedark) { var $confirmDiv = $('#phpbb_confirm'); $confirmDiv.find('.alert_text').html(msg); - fadedark = fadedark !== 'undefined' ? fadedark : true; + fadedark = typeof fadedark !== 'undefined' ? fadedark : true; $(document).on('keydown.phpbb.alert', function(e) { if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { -- cgit v1.2.1 From a6b994d95e8f395a3608d0a60dc9d20285cee86c Mon Sep 17 00:00:00 2001 From: Sophist Date: Tue, 3 Oct 2017 09:23:34 +0100 Subject: [ticket/15387] Make vertical bars full height on board index forum rows Make vertical left border bars for height for Topics and Posts columns in board index forum rows when these columns have less height than e.g. the Last Post column. PHPBB3-15387 --- phpBB/styles/prosilver/theme/content.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 3040282b90..3d0d0c0bf8 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -64,7 +64,8 @@ ul.topiclist.two-columns dt .list-inner { ul.topiclist dd { border-left: 1px solid transparent; - padding: 4px 0; + padding: 4px 0 99999px 0; + margin-bottom: -99995px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -- cgit v1.2.1 From 44a0a9e3e0f47906ef56ec29cce913774650bb74 Mon Sep 17 00:00:00 2001 From: Sophist Date: Tue, 3 Oct 2017 17:18:36 +0100 Subject: [ticket/15387] Make vertical bars full height on forum topic rows - consistency Make extra size consistent with immediately following css i.e. use 999px not 99999px as v. large to exceed possible box size. PHPBB3-15387 --- phpBB/styles/prosilver/theme/content.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 3d0d0c0bf8..a92434a9be 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -64,8 +64,8 @@ ul.topiclist.two-columns dt .list-inner { ul.topiclist dd { border-left: 1px solid transparent; - padding: 4px 0 99999px 0; - margin-bottom: -99995px; + padding: 4px 0 999px 0; + margin-bottom: -995px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -- cgit v1.2.1 From e5860288be774e9919cb45c29383aabfda545808 Mon Sep 17 00:00:00 2001 From: Sophist Date: Tue, 3 Oct 2017 18:22:22 +0100 Subject: [ticket/15387] Make vertical bars full height - fix 1 Fix issue with 2px gap at the bottom of the bars. PHPBB3-15387 --- phpBB/styles/prosilver/theme/content.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index a92434a9be..e51aaa5600 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -18,7 +18,7 @@ ul.topiclist dl { } ul.topiclist li.row dl { - padding: 2px 0; + margin: 2px 0; } ul.topiclist dt, ul.topiclist dd { -- cgit v1.2.1 From ab83b2585733a65fec6205faaa5a4bac726804c5 Mon Sep 17 00:00:00 2001 From: Sophist Date: Thu, 5 Oct 2017 18:35:20 +0100 Subject: [ticket/15387] Make vertical bars full height - fix MCP Fix issue where changes were half applied to MCP creating c. 990px of whitespace. PHPBB3-15387 --- phpBB/styles/prosilver/theme/content.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index e51aaa5600..6d332eb9ea 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -64,13 +64,17 @@ ul.topiclist.two-columns dt .list-inner { ul.topiclist dd { border-left: 1px solid transparent; - padding: 4px 0 999px 0; - margin-bottom: -995px; + padding: 4px 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } +ul.topiclist li.row dd { + padding: 4px 0 999px 0; + margin-bottom: -995px; +} + ul.topiclist dfn { /* Labels for post/view counts */ position: absolute; -- cgit v1.2.1 From bf882826e48d4f29ca4c48ecb7d65cbdf459d5fb Mon Sep 17 00:00:00 2001 From: javiexin Date: Sun, 21 May 2017 14:57:40 +0200 Subject: [ticket/14994] Refactor template->assign_block_var Refactor assign_block_var to use the same block selection mechanism as is used in alter_block_array. This allows creating new blocks at any position in the template structure, not only on the last block. Allows selecting a block as outer[2].middle. Added tests. PHPBB3-14994 --- tests/template/template_test.php | 40 +++++++++++++++++++++++++++++++ tests/template/templates/loop_nested.html | 3 +++ 2 files changed, 43 insertions(+) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 9f2124418d..0f761abc76 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -998,6 +998,46 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Deleting by index out of bounds, ignored'); } + public function test_indexed_assign_block_vars() + { + $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()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + + $expect = 'outer - 0[outer|3]middle - 0[middle|1]outer - 1[outer|3]middle - 0[middle|2]middle - 1[middle|2]outer - 2[outer|3]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 template is built correctly before modification'); + + $this->template->assign_block_vars('outer[0].middle', array('VARIABLE' => 'test')); + + $expect = 'outer - 0[outer|3]middle - 0[middle|2]middle - 1 - test[middle|2]outer - 1[outer|3]middle - 0[middle|2]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Inserting at the first outer block'); + + $this->template->assign_block_vars('outer[1].middle[0].inner', array()); + + $expect = 'outer - 0[outer|3]middle - 0[middle|2]middle - 1 - test[middle|2]outer - 1[outer|3]middle - 0[middle|2]inner - 0[inner|1]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Creating an inner block at the first middle block in the second outer block'); + + $this->template->assign_block_vars('outer[1].middle[0].inner', array()); + + $expect = 'outer - 0[outer|3]middle - 0[middle|2]middle - 1 - test[middle|2]outer - 1[outer|3]middle - 0[middle|2]inner - 0[inner|2]inner - 1[inner|2]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Inserting another inner block in the same place'); + + $this->template->assign_block_vars('outer.middle[1].inner', array('VARIABLE' => 'test')); + + $expect = 'outer - 0[outer|3]middle - 0[middle|2]middle - 1 - test[middle|2]outer - 1[outer|3]middle - 0[middle|2]inner - 0[inner|2]inner - 1[inner|2]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]inner - 0 - test[inner|1]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Inserting another inner block in the same place'); + } public function assign_block_vars_array_data() { diff --git a/tests/template/templates/loop_nested.html b/tests/template/templates/loop_nested.html index cf099ecc15..5763262781 100644 --- a/tests/template/templates/loop_nested.html +++ b/tests/template/templates/loop_nested.html @@ -2,5 +2,8 @@ outer - {outer.S_ROW_COUNT} - {outer.VARIABLE}[{outer.S_BLOCK_NAME}|{outer.S_NUM_ROWS}] middle - {outer.middle.S_ROW_COUNT} - {outer.middle.VARIABLE}[{outer.middle.S_BLOCK_NAME}|{outer.middle.S_NUM_ROWS}] + +inner - {outer.middle.inner.S_ROW_COUNT} - {outer.middle.inner.VARIABLE}[{outer.middle.inner.S_BLOCK_NAME}|{outer.middle.inner.S_NUM_ROWS}] + -- cgit v1.2.1 From c2043e47dabc23100ecc388ae1e9d8ae20c2257e Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 31 May 2017 13:57:41 +0200 Subject: [ticket/14994] Refactor template->assign_block_var Refactor assign_block_var to use the same block selection mechanism as is used in alter_block_array. This allows creating new blocks at any position in the template structure, not only on the last block. Allows selecting a block as outer[2].middle. Added tests. Added PHP 7.2 compatibility. PHPBB3-14994 --- phpBB/phpbb/template/context.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 55d7b9c861..5a15e12582 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -193,30 +193,15 @@ class context // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($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; - } + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; $block = &$block[$name]; + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block) - 1)); $block = &$block[$index]; } -- cgit v1.2.1 From a30693a5948861cf6e1f330bc54c8c539d60cdcc Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 31 May 2017 20:24:55 +0200 Subject: [ticket/14994] Refactor template->assign_block_var Refactor assign_block_var to use the same block selection mechanism as is used in alter_block_array. This allows creating new blocks at any position in the template structure, not only on the last block. Allows selecting a block as outer[2].middle. Added tests. Added PHP 7.2 compatibility. PHPBB3-14994 --- phpBB/phpbb/template/context.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 5a15e12582..c1e971c148 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -209,7 +209,7 @@ class context $name = $blocks[$i]; // Assign S_ROW_COUNT and S_ROW_NUM - $s_row_count = isset($block[$name]) ? sizeof($block[$name]) : 0; + $s_row_count = isset($block[$name]) ? count($block[$name]) : 0; $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; // Assign S_FIRST_ROW -- cgit v1.2.1 From e86afe679966a59ec2ee1b3ce159465479b9e005 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 1 Nov 2017 20:08:45 +0100 Subject: [ticket/15384] Use html5 version of
instead of xhtml one PHPBB3-15384 --- phpBB/language/en/acp/board.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 414498e0b2..71eea31e51 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -107,7 +107,7 @@ $lang = array_merge($lang, array( 'ACP_AVATAR_SETTINGS_EXPLAIN' => 'Avatars are generally small, unique images a user can associate with themselves. Depending on the style they are usually displayed below the username when viewing topics. Here you can determine how users can define their avatars. Please note that in order to upload avatars you need to have created the directory you name below and ensure it can be written to by the web server. Please also note that file size limits are only imposed on uploaded avatars, they do not apply to remotely linked images.', 'ALLOW_AVATARS' => 'Enable avatars', - 'ALLOW_AVATARS_EXPLAIN' => 'Allow general usage of avatars;
If you disable avatars in general or avatars of a certain mode, the disabled avatars will no longer be shown on the board, but users will still be able to download their own avatars in the User Control Panel.', + 'ALLOW_AVATARS_EXPLAIN' => 'Allow general usage of avatars;
If you disable avatars in general or avatars of a certain mode, the disabled avatars will no longer be shown on the board, but users will still be able to download their own avatars in the User Control Panel.', 'ALLOW_GRAVATAR' => 'Enable gravatar avatars', 'ALLOW_LOCAL' => 'Enable gallery avatars', 'ALLOW_REMOTE' => 'Enable remote avatars', @@ -116,9 +116,9 @@ $lang = array_merge($lang, array( 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.', 'ALLOW_UPLOAD' => 'Enable avatar uploading', 'AVATAR_GALLERY_PATH' => 'Avatar gallery path', - 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. images/avatars/gallery.
Double dots like ../ will be stripped from the path for security reasons.', + 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. images/avatars/gallery.
Double dots like ../ will be stripped from the path for security reasons.', 'AVATAR_STORAGE_PATH' => 'Avatar storage path', - 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/avatars/upload.
Avatar uploading will not be available if this path is not writable.
Double dots like ../ will be stripped from the path for security reasons.', + 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/avatars/upload.
Avatar uploading will not be available if this path is not writable.
Double dots like ../ will be stripped from the path for security reasons.', 'MAX_AVATAR_SIZE' => 'Maximum avatar dimensions', 'MAX_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', 'MAX_FILESIZE' => 'Maximum avatar file size', @@ -274,7 +274,7 @@ $lang = array_merge($lang, array( 'ACP_FEED_SETTINGS_OTHER' => 'Other feeds and settings', 'ACP_FEED_ENABLE' => 'Enable feeds', - 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM feeds for the entire board.
Disabling this switches off all feeds, no matter how the options below are set.', + 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM feeds for the entire board.
Disabling this switches off all feeds, no matter how the options below are set.', 'ACP_FEED_LIMIT' => 'Number of items', 'ACP_FEED_LIMIT_EXPLAIN' => 'The maximum number of feed items to display.', @@ -290,7 +290,7 @@ $lang = array_merge($lang, array( 'ACP_FEED_TOPICS_ACTIVE' => 'Enable active topics feed', 'ACP_FEED_TOPICS_ACTIVE_EXPLAIN' => 'Enables the “Active Topics” feed, which displays the last active topics including the last post.', 'ACP_FEED_NEWS' => 'News feed', - 'ACP_FEED_NEWS_EXPLAIN' => 'Pull the first post from these forums. Select no forums to disable news feed.
Select multiple forums by holding CTRL and clicking.', + 'ACP_FEED_NEWS_EXPLAIN' => 'Pull the first post from these forums. Select no forums to disable news feed.
Select multiple forums by holding CTRL and clicking.', 'ACP_FEED_OVERALL_FORUMS' => 'Enable forums feed', 'ACP_FEED_OVERALL_FORUMS_EXPLAIN' => 'Enables the “All forums” feed, which displays a list of forums.', @@ -298,9 +298,9 @@ $lang = array_merge($lang, array( 'ACP_FEED_HTTP_AUTH' => 'Allow HTTP Authentication', 'ACP_FEED_HTTP_AUTH_EXPLAIN' => 'Enables HTTP authentication, which allows users to receive content that is hidden to guest users by adding the auth=http parameter to the feed URL. Please note that some PHP setups require additional changes to the .htaccess file. Instructions can be found in that file.', 'ACP_FEED_ITEM_STATISTICS' => 'Item statistics', - 'ACP_FEED_ITEM_STATISTICS_EXPLAIN' => 'Display individual statistics underneath feed items
(e.g. posted by, date and time, replies, views)', + 'ACP_FEED_ITEM_STATISTICS_EXPLAIN' => 'Display individual statistics underneath feed items
(e.g. posted by, date and time, replies, views)', 'ACP_FEED_EXCLUDE_ID' => 'Exclude these forums', - 'ACP_FEED_EXCLUDE_ID_EXPLAIN' => 'Content from these will be not included in feeds. Select no forum to pull data from all forums.
Select/Deselect multiple forums by holding CTRL and clicking.', + 'ACP_FEED_EXCLUDE_ID_EXPLAIN' => 'Content from these will be not included in feeds. Select no forum to pull data from all forums.
Select/Deselect multiple forums by holding CTRL and clicking.', )); // Visual Confirmation Settings @@ -351,7 +351,7 @@ $lang = array_merge($lang, array( 'ACP_COOKIE_SETTINGS_EXPLAIN' => 'These details define the data used to send cookies to your users browsers. In most cases the default values for the cookie settings should be sufficient. If you do need to change any do so with care, incorrect settings can prevent users logging in. If you have problems with users staying logging in to your board, visit the phpBB.com Knowledge Base - Fixing incorrect cookie settings.', 'COOKIE_DOMAIN' => 'Cookie domain', - 'COOKIE_DOMAIN_EXPLAIN' => 'In most cases the cookie domain is optional. Leave it blank if you are unsure.

In the case where you have a board integrated with other software or have multiple domains, then to determine the cookie domain you need to do the following. If you have something like example.com and forums.example.com, or perhaps forums.example.com and blog.example.com. Remove the subdomains until you find the common domain, example.com. Now add a dot in front of the common domain and you would enter .example.com (note the dot at the beginning).', + 'COOKIE_DOMAIN_EXPLAIN' => 'In most cases the cookie domain is optional. Leave it blank if you are unsure.

In the case where you have a board integrated with other software or have multiple domains, then to determine the cookie domain you need to do the following. If you have something like example.com and forums.example.com, or perhaps forums.example.com and blog.example.com. Remove the subdomains until you find the common domain, example.com. Now add a dot in front of the common domain and you would enter .example.com (note the dot at the beginning).', 'COOKIE_NAME' => 'Cookie name', 'COOKIE_NAME_EXPLAIN' => 'This can be anything what you want, make it original. Whenever the cookie settings are changed the name of the cookie should be changed.', 'COOKIE_NOTICE' => 'Cookie notice', @@ -430,7 +430,7 @@ $lang = array_merge($lang, array( 'AUTH_METHOD' => 'Select an authentication method', 'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.', - 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server. These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.
Any service that does not have both a key and a secret entered here will not be available for use by the forum users. Also note, that user can still register and login using the DB authentication plug-in.', + 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server. These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.
Any service that does not have both a key and a secret entered here will not be available for use by the forum users. Also note, that user can still register and login using the DB authentication plug-in.', 'AUTH_PROVIDER_OAUTH_KEY' => 'Key', 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', @@ -446,7 +446,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_EMAIL' => 'The specified email attribute does not exist.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_PASSWORD' => 'LDAP password', - 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding, otherwise fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding, otherwise fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'LDAP_PORT' => 'LDAP server port', 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', 'LDAP_SERVER' => 'LDAP server name', @@ -527,7 +527,7 @@ $lang = array_merge($lang, array( 'IP_LOGIN_LIMIT_TIME' => 'IP address login attempt expiration time', 'IP_LOGIN_LIMIT_TIME_EXPLAIN' => 'Login attempts expire after this period.', 'IP_LOGIN_LIMIT_USE_FORWARDED' => 'Limit login attempts by X_FORWARDED_FOR header', - 'IP_LOGIN_LIMIT_USE_FORWARDED_EXPLAIN' => 'Instead of limiting login attempts by IP address they are limited by X_FORWARDED_FOR values.
Warning: Only enable this if you are operating a proxy server that sets X_FORWARDED_FOR to trustworthy values.', + 'IP_LOGIN_LIMIT_USE_FORWARDED_EXPLAIN' => 'Instead of limiting login attempts by IP address they are limited by X_FORWARDED_FOR values.
Warning: Only enable this if you are operating a proxy server that sets X_FORWARDED_FOR to trustworthy values.', 'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts per username', 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'The number of login attempts allowed for a single account before the anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered for distinct user accounts.', 'NO_IP_VALIDATION' => 'None', @@ -573,14 +573,14 @@ $lang = array_merge($lang, array( 'SEND_TEST_EMAIL' => 'Send a test email', 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', - 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', 'SMTP_LOGIN' => 'LOGIN', 'SMTP_PASSWORD' => 'SMTP password', - 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'SMTP_PLAIN' => 'PLAIN', 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', @@ -591,10 +591,10 @@ $lang = array_merge($lang, array( 'SMTP_USERNAME' => 'SMTP username', 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', 'SMTP_VERIFY_PEER' => 'Verify SSL certificate', - 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', 'SMTP_VERIFY_PEER_NAME' => 'Verify SMTP peer name', - 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', - 'TEST_EMAIL_SENT' => 'The test email has been sent.
If you don’t receive it, please check your emails configuration.

If you require assistance, please visit the phpBB support forums.', + 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', + 'TEST_EMAIL_SENT' => 'The test email has been sent.
If you don’t receive it, please check your emails configuration.

If you require assistance, please visit the phpBB support forums.', 'USE_SMTP' => 'Use SMTP server for email', 'USE_SMTP_EXPLAIN' => 'Select “Yes” if you want or have to send email via a named server instead of the local mail function.', @@ -605,7 +605,7 @@ $lang = array_merge($lang, array( 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Please be sure to enter already registered account details - phpBB will use the details you enter here as is.', 'JAB_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', - 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', 'JAB_ENABLE' => 'Enable Jabber', 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the dns_get_record function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', @@ -623,7 +623,7 @@ $lang = array_merge($lang, array( 'JAB_USERNAME' => 'Jabber username or JID', 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', 'JAB_VERIFY_PEER' => 'Verify SSL certificate', - 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', 'JAB_VERIFY_PEER_NAME' => 'Verify Jabber peer name', - 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', + 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', )); -- cgit v1.2.1 From 3b977eacc173379bf881d71d5f277131abbb4a78 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 2 Nov 2017 20:23:54 +0100 Subject: [ticket/15195] Add bidi.css to ucp_pm_viewmessage_print PHPBB3-15195 --- phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 9377eeb9f5..7a8849258a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -8,6 +8,7 @@ {SITENAME} • {PAGE_TITLE} + -- cgit v1.2.1 From c67cfb2b4100e991a9ffad1ed0f54b9147bc5ab8 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 2 Nov 2017 20:24:21 +0100 Subject: [ticket/15195] Fix floatings in print view PHPBB3-15195 --- phpBB/styles/prosilver/theme/bidi.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 923ff3e792..79b769b1e7 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -239,6 +239,10 @@ /* Pagination ---------------------------------------- */ +.rtl .page-number { + float: left; +} + .rtl .pagination { text-align: left; float: left; @@ -451,6 +455,10 @@ li.breadcrumbs span:first-child > a { /* Post body styles ----------------------------------------*/ +.rtl .date { + float: left; +} + .rtl .postbody, .rtl .postbody h3 { float: right; } -- cgit v1.2.1 From 9933380d800ecc807e0d05b5c77312a8d7b395d3 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 16 Oct 2017 22:01:18 +0200 Subject: [ticket/15408] Reject duplicate BBCodes in ACP PHPBB3-15408 --- phpBB/includes/acp/acp_bbcodes.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index f958ae93c7..18d574081a 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -553,10 +553,10 @@ class acp_bbcodes } // Lowercase tags - $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match); - $bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+)=?.*/i', '$1', $bbcode_match); + $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match); + $bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match); - if (!preg_match('/^[a-zA-Z0-9_-]+=?$/', $bbcode_tag)) + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag)) { global $user; trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); -- cgit v1.2.1 From f9b9d659a1638389e6250110ce54d18e9d9bd59c Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 4 Nov 2017 19:14:04 +0700 Subject: [ticket/15224] Fix some MySQL fulltext index searching errors PHPBB3-15224 --- phpBB/phpbb/search/fulltext_mysql.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index da1aad1c3a..c8df1951e3 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -591,6 +591,7 @@ class fulltext_mysql extends \phpbb\search\base WHERE MATCH ($sql_match) AGAINST ('" . $this->db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE) $sql_where_options ORDER BY $sql_sort"; + $this->db->sql_return_on_error(true); $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); while ($row = $this->db->sql_fetchrow($result)) @@ -602,7 +603,7 @@ class fulltext_mysql extends \phpbb\search\base $id_ary = array_unique($id_ary); // if the total result count is not cached yet, retrieve it from the db - if (!$result_count) + if (!$result_count && count($id_ary)) { $sql_found_rows = 'SELECT FOUND_ROWS() as result_count'; $result = $this->db->sql_query($sql_found_rows); @@ -1004,6 +1005,11 @@ class fulltext_mysql extends \phpbb\search\base } } + if (!isset($this->stats['post_text'])) + { + $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)'); + } + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); return false; @@ -1039,6 +1045,11 @@ class fulltext_mysql extends \phpbb\search\base $alter[] = 'DROP INDEX post_content'; } + if (isset($this->stats['post_text'])) + { + $alter[] = 'DROP INDEX post_text'; + } + if (sizeof($alter)) { $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); @@ -1059,7 +1070,7 @@ class fulltext_mysql extends \phpbb\search\base $this->get_stats(); } - return isset($this->stats['post_subject']) && isset($this->stats['post_content']); + return isset($this->stats['post_subject']) && isset($this->stats['post_content']) && isset($this->stats['post_text']); } /** @@ -1103,6 +1114,10 @@ class fulltext_mysql extends \phpbb\search\base { $this->stats['post_subject'] = $row; } + else if ($row['Key_name'] == 'post_text') + { + $this->stats['post_text'] = $row; + } else if ($row['Key_name'] == 'post_content') { $this->stats['post_content'] = $row; -- cgit v1.2.1 From 288def143cb8f594fd5c58d6a6dab07263a6c60e Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 7 Nov 2017 10:34:11 +0100 Subject: [ticket/15442] Allow unsafe HTML in bbcode.html PHPBB3-15442 --- phpBB/phpbb/textformatter/s9e/factory.php | 2 +- tests/text_formatter/s9e/factory_test.php | 16 +++++++++ .../fixtures/styles/unsafe/template/bbcode.html | 40 ++++++++++++++++++++++ .../s9e/fixtures/unsafe_default_bbcodes.xml | 24 +++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html create mode 100644 tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index d5ad8283d9..3a6c6ef43f 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -271,7 +271,7 @@ class factory implements \phpbb\textformatter\cache_interface // Add default BBCodes foreach ($this->get_default_bbcodes($configurator) as $bbcode) { - $configurator->BBCodes->addCustom($bbcode['usage'], $bbcode['template']); + $configurator->BBCodes->addCustom($bbcode['usage'], new UnsafeTemplate($bbcode['template'])); } if (isset($configurator->tags['QUOTE'])) { diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index fd9b4e4c09..d35330a975 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -247,6 +247,22 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case $this->assertSame($expected, $renderer->render($parser->parse($original))); } + /** + * @testdox Accepts unsafe default BBCodes + */ + public function test_unsafe_default_bbcodes() + { + $fixture = __DIR__ . '/fixtures/unsafe_default_bbcodes.xml'; + $style_dir = __DIR__ . '/fixtures/styles/'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture, $style_dir); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $original = '[b]alert(1)[/b]'; + $expected = ''; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + /** * @testdox get_configurator() triggers events before and after configuration */ diff --git a/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html b/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html new file mode 100644 index 0000000000..f3932f9b78 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html @@ -0,0 +1,40 @@ +
    +
      +
    + +
      +
    + +
  • +
  • + +
    {USERNAME} {L_WROTE}{L_COLON} +
    +
    + +

    {L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

    +
    + +
    +
    + + + + + + + + + +{TEXT} + +{TEXT} + +{L_IMAGE} + +{DESCRIPTION} + +{DESCRIPTION} + + diff --git a/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml b/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml new file mode 100644 index 0000000000..06524a13cc --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml @@ -0,0 +1,24 @@ + + + + style_id + style_name + style_copyright + style_active + style_path + bbcode_bitfield + style_parent_id + style_parent_tree + + + 1 + unsafe + + 1 + unsafe + QA== + 0 + + +
    +
    -- cgit v1.2.1 From 0409191be99b0901b4c006aadf4fd1d3c93d0a06 Mon Sep 17 00:00:00 2001 From: kasimi Date: Wed, 8 Nov 2017 14:45:33 +0100 Subject: [ticket/15431] Fixed event argument description PHPBB3-15431 --- phpBB/includes/ucp/ucp_register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 83966cdaae..7220872cf4 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -561,7 +561,7 @@ class ucp_register * @var array template_vars Array with template data * @var array data Array with user data * @var array error Array with errors - * @var array s_hidden_fields Array hidden form fields + * @var string s_hidden_fields HTML with hidden form field elements * @var string tpl_name Template name * @var string page_title Page title * @since 3.2.2-RC1 -- cgit v1.2.1 From 0318cea91021784244abac56b87d49442a2360b7 Mon Sep 17 00:00:00 2001 From: kasimi Date: Wed, 8 Nov 2017 17:58:26 +0100 Subject: [ticket/15446] Add event core.acp_profile_action PHPBB3-15446 --- phpBB/includes/acp/acp_profile.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 18dde382ca..f22fba6404 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -738,6 +738,32 @@ class acp_profile break; } + $tpl_name = $this->tpl_name; + $page_title = $this->page_title; + $u_action = $this->u_action; + + /** + * Event to handle actions on the ACP profile fields page + * + * @event core.acp_profile_action + * @var string action Action that is being performed + * @var string tpl_name Template file to load + * @var string page_title Page title + * @var string u_action The URL we are at, read only + * @since 3.2.2-RC1 + */ + $vars = array( + 'action', + 'tpl_name', + 'page_title', + 'u_action', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_profile_action', compact($vars))); + + $this->tpl_name = $tpl_name; + $this->page_title = $page_title; + unset($u_action); + $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE . ' ORDER BY field_order'; -- cgit v1.2.1 From b9254cfda85171a70b6c93c992439ae2f492ef65 Mon Sep 17 00:00:00 2001 From: kasimi Date: Wed, 8 Nov 2017 18:00:52 +0100 Subject: [ticket/15447] Add event core.acp_profile_modify_profile_row PHPBB3-15447 --- phpBB/includes/acp/acp_profile.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 18dde382ca..d3daf63bd6 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -762,7 +762,8 @@ class acp_profile continue; } $profile_field = $this->type_collection[$row['field_type']]; - $template->assign_block_vars('fields', array( + + $field_block = array( 'FIELD_IDENT' => $row['field_ident'], 'FIELD_TYPE' => $profile_field->get_name(), @@ -774,8 +775,26 @@ class acp_profile 'U_MOVE_UP' => $this->u_action . "&action=move_up&field_id=$id" . '&hash=' . generate_link_hash('acp_profile'), 'U_MOVE_DOWN' => $this->u_action . "&action=move_down&field_id=$id" . '&hash=' . generate_link_hash('acp_profile'), - 'S_NEED_EDIT' => $s_need_edit) + 'S_NEED_EDIT' => $s_need_edit, + ); + + /** + * Event to modify profile field data before it is assigned to the template + * + * @event core.acp_profile_modify_profile_row + * @var array row Array with data for the current profile field + * @var array field_block Template data that is being assigned to the 'fields' block + * @var object profile_field A profile field instance, implements \phpbb\profilefields\type\type_base + * @since 3.2.2-RC1 + */ + $vars = array( + 'row', + 'field_block', + 'profile_field', ); + extract($phpbb_dispatcher->trigger_event('core.acp_profile_modify_profile_row', compact($vars))); + + $template->assign_block_vars('fields', $field_block); } $db->sql_freeresult($result); -- cgit v1.2.1 From da3a1a5d208ced9a5ac999083c7ec2c2f7f7edce Mon Sep 17 00:00:00 2001 From: Kailey Truscott Date: Sat, 11 Nov 2017 17:56:14 -0500 Subject: [ticket/15451] Add template event mcp_topic_postrow_attachments_before/after PHPBB3-15451 --- phpBB/docs/events.md | 14 ++++++++++++++ phpBB/styles/prosilver/template/mcp_topic.html | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 6af3f55d21..a292a44a3f 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -953,6 +953,20 @@ mcp_topic_options_before * Since: 3.1.6-RC1 * Purpose: Add some options (field, checkbox, ...) before the subject field when split a subject +mcp_topic_postrow_attachments_after +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.2.2-RC1 +* Purpose: Show additional content after attachments in mcp topic review + +mcp_topic_postrow_attachments_before +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.2.2-RC1 +* Purpose: Show additional content before attachments in mcp topic review + mcp_topic_postrow_post_details_after === * Locations: diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 35b1ecca0a..fe851883d9 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -143,6 +143,8 @@
    {postrow.MESSAGE}
    + +
    {L_ATTACHMENTS}
    @@ -152,6 +154,8 @@
    + +
-- cgit v1.2.1 From a24839d21d09a329b65799bf0de0a3d5c45e1ba1 Mon Sep 17 00:00:00 2001 From: Kailey Truscott Date: Sat, 11 Nov 2017 18:09:13 -0500 Subject: [ticket/15452] Add template event mcp_topic_postrow_post_before PHPBB3-15452 --- phpBB/docs/events.md | 7 +++++++ phpBB/styles/prosilver/template/mcp_topic.html | 1 + 2 files changed, 8 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 6af3f55d21..14183c6957 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -953,6 +953,13 @@ mcp_topic_options_before * Since: 3.1.6-RC1 * Purpose: Add some options (field, checkbox, ...) before the subject field when split a subject +mcp_topic_postrow_post_before +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.2.2-RC1 +* Purpose: Show additional content after postrow begins in mcp topic review + mcp_topic_postrow_post_details_after === * Locations: diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 35b1ecca0a..0a5fdca07c 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -94,6 +94,7 @@
+
-- cgit v1.2.1 From 5585cb79b23e43efbe8157708ed7fefbd8d8afee Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 13 Nov 2017 14:24:58 +0100 Subject: [ticket/15454] Add core.mcp_queue_approve_details_template PHPBB3-15454 --- phpBB/includes/mcp/mcp_queue.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f379392b12..58f2049449 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -280,7 +280,7 @@ class mcp_queue $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']); - $template->assign_vars(array( + $post_data = array( 'S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), @@ -324,7 +324,33 @@ class mcp_queue 'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id), 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', - )); + ); + + /** + * Alter post awaiting approval template before it is rendered + * + * @event core.mcp_queue_approve_details_template + * @var int post_id Post ID + * @var int topic_id Topic ID + * @var array topic_info Topic data + * @var array post_info Post data + * @var string message Post message + * @var string post_url Post URL + * @var string topic_url Topic URL + * @since 3.2.2-RC1 + */ + $vars = array( + 'post_id', + 'topic_id', + 'topic_info', + 'post_info', + 'message', + 'post_url', + 'topic_url', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_queue_approve_details_template', compact($vars))); + + $template->assign_vars($post_data); break; -- cgit v1.2.1 From aa961991fdafc8a0371d22c7e42f2424ee1b8898 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 17 Nov 2017 01:29:38 +0100 Subject: [ticket/15339] Allow a module to have multiple parents Also restore old behaviour from Olympus regarding re-sorting modules PHPBB3-15339 --- .../db/migration/data/v30x/release_3_0_6_rc1.php | 3 + .../db/migration/data/v30x/release_3_0_8_rc1.php | 1 + phpBB/phpbb/db/migration/tool/module.php | 255 +++++++++++---------- 3 files changed, 136 insertions(+), 123 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php index 08b8979e00..40bb58c10d 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -156,6 +156,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'module_langname' => 'ACP_FEED_SETTINGS', 'module_mode' => 'feed', 'module_auth' => 'acl_a_board', + 'after' => array('signature', 'ACP_SIGNATURE_SETTINGS'), ), )), array('module.add', array( @@ -167,6 +168,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'module_mode' => 'warnings', 'module_auth' => 'acl_a_user', 'module_display' => false, + 'after' => array('feedback', 'ACP_USER_FEEDBACK'), ), )), array('module.add', array( @@ -187,6 +189,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration 'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY', 'module_mode' => 'setting_forum_copy', 'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', + 'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS'), ), )), array('module.add', array( diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php index 0190eeb1af..c018adab46 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -39,6 +39,7 @@ class release_3_0_8_rc1 extends \phpbb\db\migration\migration 'module_langname' => 'ACP_POST_SETTINGS', 'module_mode' => 'post', 'module_auth' => 'acl_a_board', + 'after' => array('message', 'ACP_MESSAGE_SETTINGS'), ), )), array('config.add', array('load_unreads_search', 1)), diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index b47c426110..3b4728c9d7 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -84,9 +84,11 @@ class module implements \phpbb\db\migration\tool\tool_interface * Use false to ignore the parent check and check class wide. * @param int|string $module The module_id|module_langname you would like to * check for to see if it exists - * @return bool true/false if module exists + * @param bool $lazy Checks lazily if the module exists. Returns true if it exists in at + * least one given parent. + * @return bool true if module exists in *all* given parents, false if not */ - public function exists($class, $parent, $module) + public function exists($class, $parent, $module, $lazy = false) { // the main root directory should return true if (!$module) @@ -94,33 +96,44 @@ class module implements \phpbb\db\migration\tool\tool_interface return true; } - $parent_sql = ''; + $parent_sqls = []; if ($parent !== false) { - $parent = $this->get_parent_module_id($parent, $module, false); - if ($parent === false) + $parents = $this->get_parent_module_id($parent, $module, false); + if ($parents === false) { return false; } - $parent_sql = 'AND parent_id = ' . (int) $parent; + foreach ((array) $parents as $parent_id) + { + $parent_sqls[] = 'AND parent_id = ' . (int) $parent_id; + } } - $sql = 'SELECT module_id - FROM ' . $this->modules_table . " - WHERE module_class = '" . $this->db->sql_escape($class) . "' - $parent_sql - AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '" . $this->db->sql_escape($module) . "'"); - $result = $this->db->sql_query($sql); - $module_id = $this->db->sql_fetchfield('module_id'); - $this->db->sql_freeresult($result); - - if ($module_id) + foreach ($parent_sqls as $parent_sql) { - return true; + $sql = 'SELECT module_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + $parent_sql + AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '" . $this->db->sql_escape($module) . "'"); + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + if (!$lazy && !$module_id) + { + return false; + } + else if ($lazy && $module_id) + { + return true; + } } - return false; + // Returns true, if modules exist in all parents and false otherwise + return !$lazy; } /** @@ -172,7 +185,7 @@ class module implements \phpbb\db\migration\tool\tool_interface $data = array('module_langname' => $data); } - $parent = $data['parent_id'] = $this->get_parent_module_id($parent, $data); + $parents = (array) $this->get_parent_module_id($parent, $data); if (!isset($data['module_langname'])) { @@ -195,95 +208,129 @@ class module implements \phpbb\db\migration\tool\tool_interface ); // Run the "manual" way with the data we've collected. - $this->add($class, $parent, $new_module); + foreach ($parents as $parent) + { + $this->add($class, $parent, $new_module); + } } } return; } - // The "manual" way - if (!$this->exists($class, false, $parent)) + foreach ($parents as $parent) { - throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); - } + $data['parent_id'] = $parent; - if ($this->exists($class, $parent, $data['module_langname'])) - { - throw new \phpbb\db\migration\exception('MODULE_EXISTS', $data['module_langname']); - } - - $module_data = array( - 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, - 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, - 'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '', - 'module_class' => $class, - 'parent_id' => (int) $parent, - 'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '', - 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', - 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', - ); - - try - { - $this->module_manager->update_module_data($module_data); + // The "manual" way + if (!$this->exists($class, false, $parent)) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); + } - // Success - $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); - $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); + if ($this->exists($class, $parent, $data['module_langname'])) + { + throw new \phpbb\db\migration\exception('MODULE_EXISTS', $data['module_langname']); + } - // Move the module if requested above/below an existing one - if (isset($data['before']) && $data['before']) + $module_data = array( + 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, + 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, + 'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '', + 'module_class' => $class, + 'parent_id' => (int) $parent, + 'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '', + 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', + 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', + ); + + try { - $sql = 'SELECT left_id + $this->module_manager->update_module_data($module_data); + + // Success + $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); + $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); + + // Move the module if requested above/below an existing one + if (isset($data['before']) && $data['before']) + { + $before_mode = $before_langname = ''; + if (is_array($data['before'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($before_mode, $before_langname) = $data['before']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $before_langname = $data['before']; + } + + $sql = 'SELECT left_id FROM ' . $this->modules_table . " WHERE module_class = '" . $this->db->sql_escape($class) . "' AND parent_id = " . (int) $parent . " - AND module_langname = '" . $this->db->sql_escape($data['before']) . "'"; - $this->db->sql_query($sql); - $to_left = (int) $this->db->sql_fetchfield('left_id'); + AND module_langname = '" . $this->db->sql_escape($before_langname) . "'" + . (($before_mode) ? " AND module_mode = '" . $this->db->sql_escape($before_mode) . "'" : ''); + $this->db->sql_query($sql); + $to_left = (int) $this->db->sql_fetchfield('left_id'); - $sql = 'UPDATE ' . $this->modules_table . " + $sql = 'UPDATE ' . $this->modules_table . " SET left_id = left_id + 2, right_id = right_id + 2 WHERE module_class = '" . $this->db->sql_escape($class) . "' AND left_id >= $to_left AND left_id < {$module_data['left_id']}"; - $this->db->sql_query($sql); + $this->db->sql_query($sql); - $sql = 'UPDATE ' . $this->modules_table . " + $sql = 'UPDATE ' . $this->modules_table . " SET left_id = $to_left, right_id = " . ($to_left + 1) . " WHERE module_class = '" . $this->db->sql_escape($class) . "' AND module_id = {$module_data['module_id']}"; - $this->db->sql_query($sql); - } - else if (isset($data['after']) && $data['after']) - { - $sql = 'SELECT right_id + $this->db->sql_query($sql); + } + else if (isset($data['after']) && $data['after']) + { + $after_mode = $after_langname = ''; + if (is_array($data['after'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($after_mode, $after_langname) = $data['after']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $after_langname = $data['after']; + } + + $sql = 'SELECT right_id FROM ' . $this->modules_table . " WHERE module_class = '" . $this->db->sql_escape($class) . "' AND parent_id = " . (int) $parent . " - AND module_langname = '" . $this->db->sql_escape($data['after']) . "'"; - $this->db->sql_query($sql); - $to_right = (int) $this->db->sql_fetchfield('right_id'); + AND module_langname = '" . $this->db->sql_escape($after_langname) . "'" + . (($after_mode) ? " AND module_mode = '" . $this->db->sql_escape($after_mode) . "'" : ''); + $this->db->sql_query($sql); + $to_right = (int) $this->db->sql_fetchfield('right_id'); - $sql = 'UPDATE ' . $this->modules_table . " + $sql = 'UPDATE ' . $this->modules_table . " SET left_id = left_id + 2, right_id = right_id + 2 WHERE module_class = '" . $this->db->sql_escape($class) . "' AND left_id >= $to_right AND left_id < {$module_data['left_id']}"; - $this->db->sql_query($sql); + $this->db->sql_query($sql); - $sql = 'UPDATE ' . $this->modules_table . ' + $sql = 'UPDATE ' . $this->modules_table . ' SET left_id = ' . ($to_right + 1) . ', right_id = ' . ($to_right + 2) . " WHERE module_class = '" . $this->db->sql_escape($class) . "' AND module_id = {$module_data['module_id']}"; - $this->db->sql_query($sql); + $this->db->sql_query($sql); + } + } + catch (module_exception $e) + { + // Error + throw new \phpbb\db\migration\exception('MODULE_ERROR', $e->getMessage()); } - } - catch (module_exception $e) - { - // Error - throw new \phpbb\db\migration\exception('MODULE_ERROR', $e->getMessage()); } // Clear the Modules Cache @@ -334,7 +381,7 @@ class module implements \phpbb\db\migration\tool\tool_interface } else { - if (!$this->exists($class, $parent, $module)) + if (!$this->exists($class, $parent, $module, true)) { return; } @@ -342,8 +389,8 @@ class module implements \phpbb\db\migration\tool\tool_interface $parent_sql = ''; if ($parent !== false) { - $parent = $this->get_parent_module_id($parent, $module); - $parent_sql = 'AND parent_id = ' . (int) $parent; + $parents = (array)$this->get_parent_module_id($parent, $module); + $parent_sql = 'AND ' . $this->db->sql_in_set('parent_id', $parents); } $module_ids = array(); @@ -457,14 +504,11 @@ class module implements \phpbb\db\migration\tool\tool_interface * @param string|int $parent_id The parent module_id|module_langname * @param int|string|array $data The module_id, module_langname for existance checking or module data array for adding * @param bool $throw_exception The flag indicating if exception should be thrown on error - * @return mixed The int parent module_id or false + * @return mixed The int parent module_id, an array of int parent module_id values or false * @throws \phpbb\db\migration\exception */ public function get_parent_module_id($parent_id, $data = '', $throw_exception = true) { - // Initialize exception object placeholder - $exception = false; - // Allow '' to be sent as 0 $parent_id = $parent_id ?: 0; @@ -486,61 +530,26 @@ class module implements \phpbb\db\migration\tool\tool_interface { // No parent with the given module_langname exist case 0: - $exception = new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id); + if ($throw_exception) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id); + } + + return false; break; // Return the module id case 1: - $parent_id = (int) $ids[0]; + return (int) $ids[0]; break; - // Several modules with the given module_langname were found - // Try to determine the parent_id by the neighbour module parent default: - if (is_array($data) && (isset($data['before']) || isset($data['after']))) - { - $neighbour_module_langname = isset($data['before']) ? $data['before'] : $data['after']; - $sql = 'SELECT parent_id - FROM ' . $this->modules_table . " - WHERE module_langname = '" . $this->db->sql_escape($neighbour_module_langname) . "' - AND " . $this->db->sql_in_set('parent_id', $ids); - $result = $this->db->sql_query($sql); - $parent_id = (int) $this->db->sql_fetchfield('parent_id'); - if (!$parent_id) - { - $exception = new \phpbb\db\migration\exception('PARENT_MODULE_FIND_ERROR', $data['parent_id']); - } - } - else if (!empty($data) && !is_array($data)) - { - // The module_langname is set, checking for the module existance - // As more than 1 parents were found already, there's no way for null parent_id here - $sql = 'SELECT m2.module_id as module_parent_id - FROM ' . $this->modules_table . ' m1, ' . $this->modules_table . " m2 - WHERE " . ((is_numeric($data)) ? 'm1.module_id = ' . (int) $data : "m1.module_langname = '" . $this->db->sql_escape($data)) . "' - AND m2.module_id = m1.parent_id - AND " . $this->db->sql_in_set('m2.module_id', $ids); - $result = $this->db->sql_query($sql); - $parent_id = (int) $this->db->sql_fetchfield('module_parent_id'); - } - else - { - //Unable to get the parent module id, throwing an exception - $exception = new \phpbb\db\migration\exception('MODULE_EXIST_MULTIPLE', $parent_id); - } + // This represents the old behaviour of phpBB 3.0 + return $ids; break; } } - if ($exception !== false) - { - if ($throw_exception) - { - throw $exception; - } - return false; - } - return $parent_id; } } -- cgit v1.2.1 From 719a49d38793f1490988ed0fa3fea84da17d3886 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 17 Nov 2017 01:31:31 +0100 Subject: [ticket/15339] Free sql results in migration module tool PHPBB3-15339 --- phpBB/phpbb/db/migration/tool/module.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 3b4728c9d7..e1dfe40709 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -273,8 +273,9 @@ class module implements \phpbb\db\migration\tool\tool_interface AND parent_id = " . (int) $parent . " AND module_langname = '" . $this->db->sql_escape($before_langname) . "'" . (($before_mode) ? " AND module_mode = '" . $this->db->sql_escape($before_mode) . "'" : ''); - $this->db->sql_query($sql); + $result = $this->db->sql_query($sql); $to_left = (int) $this->db->sql_fetchfield('left_id'); + $this->db->sql_freeresult($result); $sql = 'UPDATE ' . $this->modules_table . " SET left_id = left_id + 2, right_id = right_id + 2 @@ -309,8 +310,9 @@ class module implements \phpbb\db\migration\tool\tool_interface AND parent_id = " . (int) $parent . " AND module_langname = '" . $this->db->sql_escape($after_langname) . "'" . (($after_mode) ? " AND module_mode = '" . $this->db->sql_escape($after_mode) . "'" : ''); - $this->db->sql_query($sql); + $result = $this->db->sql_query($sql); $to_right = (int) $this->db->sql_fetchfield('right_id'); + $this->db->sql_freeresult($result); $sql = 'UPDATE ' . $this->modules_table . " SET left_id = left_id + 2, right_id = right_id + 2 -- cgit v1.2.1 From cb0e13aa19a07e3ab17fc265bf6a8765fd32f768 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 20 Nov 2017 21:13:37 +0700 Subject: [ticket/15460] Fix group name displayed in the manage users ACP module PHPBB3-15460 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 090cb32ebb..beaa1d11f1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2497,7 +2497,7 @@ class acp_users 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', - 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], + 'GROUP_NAME' => $group_helper->get_name($data['group_name']), 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, -- cgit v1.2.1 From 57323d1650fdc39c6e4ba8e4ba44b4919f6037cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Mon, 20 Nov 2017 15:54:52 +0100 Subject: [ticket/15461] Add Derky to the list of contributors. PHPBB3-15461 --- phpBB/docs/CREDITS.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt index 2df7543ce1..b68281d15c 100644 --- a/phpBB/docs/CREDITS.txt +++ b/phpBB/docs/CREDITS.txt @@ -26,9 +26,9 @@ phpBB Lead Developer: Marc (Marc Alexander) phpBB Developers: bantu (Andreas Fischer) CHItA (Máté Bartus) + Derky (Derk Ruitenbeek) Elsensee (Oliver Schramm) Nicofuma (Tristan Darricau) - prototech (Cesar Gallegos) For a list of phpBB Team members, please see: http://www.phpbb.com/about/team/ @@ -61,6 +61,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] kellanved (Henry Sudhof) [04/2007 - 03/2011] nickvergessen (Joas Schilling)[04/2010 - 12/2015] Oleg (Oleg Pudeyev) [01/2011 - 05/2013] + prototech (Cesar Gallegos) [01/2014 - 12/2016] rxu (Ruslan Uzdenov) [04/2010 - 12/2012] TerraFrost (Jim Wigginton) [04/2009 - 01/2011] ToonArmy (Chris Smith) [06/2008 - 11/2011] -- cgit v1.2.1 From d6d77a199bb754091733225413a0b6e749b5aadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Thu, 23 Nov 2017 09:16:54 +0100 Subject: [ticket/15463] Add MichaelC and Hanakin to the dev credits PHPBB3-15463 --- phpBB/docs/CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt index b68281d15c..cb42779641 100644 --- a/phpBB/docs/CREDITS.txt +++ b/phpBB/docs/CREDITS.txt @@ -28,6 +28,8 @@ phpBB Developers: bantu (Andreas Fischer) CHItA (Máté Bartus) Derky (Derk Ruitenbeek) Elsensee (Oliver Schramm) + Hanakin (Michael Miday) + MichaelC (Michael Cullum) Nicofuma (Tristan Darricau) For a list of phpBB Team members, please see: -- cgit v1.2.1 From a7664811dd3696e17a78fd98fec49f9beaf4579d Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Thu, 23 Nov 2017 16:25:48 +0100 Subject: [ticket/15464] Detect BBCodes in uppercase when reparsing PHPBB3-15464 --- phpBB/phpbb/textreparser/base.php | 4 ++-- tests/text_reparser/base_test.php | 15 +++++++++++++++ tests/text_reparser/fixtures/base.xml | 8 ++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php index 27d7bc1f27..2ee6ea2cb3 100644 --- a/phpBB/phpbb/textreparser/base.php +++ b/phpBB/phpbb/textreparser/base.php @@ -153,8 +153,8 @@ abstract class base implements reparser_interface { // Look for the closing tag inside of a e element, in an element of the same name, e.g. // [/url] - $match = '[/' . $bbcode . ']'; - if (strpos($record['text'], $match) !== false) + $match = '[/' . $bbcode . ']'; + if (stripos($record['text'], $match) !== false) { return true; } diff --git a/tests/text_reparser/base_test.php b/tests/text_reparser/base_test.php index af2d56ea51..2c6844b063 100644 --- a/tests/text_reparser/base_test.php +++ b/tests/text_reparser/base_test.php @@ -66,4 +66,19 @@ class phpbb_textreparser_base_test extends phpbb_database_test_case $this->get_rows(array(1)) ); } + + public function test_reparse_case_insensitive() + { + $this->get_reparser()->reparse_range(2, 2); + + $this->assertEquals( + [ + [ + 'id' => '2', + 'text' => '[IMG]img.png[/IMG]' + ] + ], + $this->get_rows([2]) + ); + } } diff --git a/tests/text_reparser/fixtures/base.xml b/tests/text_reparser/fixtures/base.xml index a4921a8823..532a19a8a9 100644 --- a/tests/text_reparser/fixtures/base.xml +++ b/tests/text_reparser/fixtures/base.xml @@ -15,5 +15,13 @@ abcd1234 + + 2 + 1 + 1 + 1 + [IMG]img.png[/IMG]]]> + + -- cgit v1.2.1 From 5485563e05015b241298b49ed9439323540201e5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 26 Nov 2017 20:06:43 +0100 Subject: [ticket/15390] Prevent dropdown from being incorrectly offset PHPBB3-15390 --- phpBB/adm/style/permission_mask.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html index 017d29d832..8b3121bfa0 100644 --- a/phpBB/adm/style/permission_mask.html +++ b/phpBB/adm/style/permission_mask.html @@ -41,7 +41,7 @@
{% if p_mask.f_mask.role_options %}
-
- + + +

{S_HIDDEN_FIELDS} {S_FORM_TOKEN} diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 6af3f55d21..0a00e1644c 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -433,6 +433,13 @@ acp_prune_forums_prepend * Since: 3.1.7-RC1 * Purpose: Add content before the forum select form label +acp_prune_forums_settings_append +=== +* Locations: + + adm/style/acp_prune_forums.html +* Since: 3.2.2-RC1 +* Purpose: Add content after the prune settings + acp_prune_users_find_username_append === * Locations: diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index d37050869a..91f78bb70d 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -55,7 +55,7 @@ class acp_prune */ function prune_forums($id, $mode) { - global $db, $user, $auth, $template, $phpbb_log, $request; + global $db, $user, $auth, $template, $phpbb_log, $request, $phpbb_dispatcher; $all_forums = $request->variable('all_forums', 0); $forum_id = $request->variable('f', array(0)); @@ -165,7 +165,7 @@ class acp_prune } else { - confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields(array( + $hidden_fields = array( 'i' => $id, 'mode' => $mode, 'submit' => 1, @@ -177,7 +177,19 @@ class acp_prune 'prune_old_polls' => $request->variable('prune_old_polls', 0), 'prune_announce' => $request->variable('prune_announce', 0), 'prune_sticky' => $request->variable('prune_sticky', 0), - ))); + ); + + /** + * Use this event to pass data from the prune form to the confirmation screen + * + * @event core.prune_forums_settings_confirm + * @var int[] hidden_fields The IDs of the topics to be deleted + * @since 3.2.2-RC1 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_confirm', compact($vars))); + + confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields($hidden_fields)); } } @@ -217,13 +229,25 @@ class acp_prune $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; - $template->assign_vars(array( + $template_data = array( 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], 'U_ACTION' => $this->u_action, 'U_BACK' => $this->u_action, 'FORUM_LIST' => $forum_list, - 'S_HIDDEN_FIELDS' => $s_hidden_fields) + 'S_HIDDEN_FIELDS' => $s_hidden_fields, ); + + /** + * Event to add/modify prune forums settings template data + * + * @event core.prune_forums_settings_template_data + * @var array template_data Array with form template data + * @since 3.2.2-RC1 + */ + $vars = array('template_data'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_template_data', compact($vars))); + + $template->assign_vars($template_data); } } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1ad41156f9..96916e1e43 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2369,6 +2369,16 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $topic_list = array_unique($topic_list); } + /** + * Perform additional actions before topic deletion via pruning + * + * @event core.prune_delete_before + * @var int[] topic_list The IDs of the topics to be deleted + * @since 3.2.2-RC1 + */ + $vars = array('topic_list'); + extract($phpbb_dispatcher->trigger_event('core.prune_delete_before', compact($vars))); + return delete_topics('topic_id', $topic_list, $auto_sync, false); } -- cgit v1.2.1 From 03b3b38db17c5fc554f54aed3f3fc1941279a04e Mon Sep 17 00:00:00 2001 From: hubaishan Date: Wed, 1 Nov 2017 08:48:21 +0300 Subject: [ticket/15433] Fix phpbbcli can enable non-existent extension Fix phpbbcli can enable non-existent extension PHPBB3-15433 --- phpBB/language/en/cli.php | 1 + phpBB/phpbb/console/command/extension/enable.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 1655855edb..505d12e8ff 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -117,6 +117,7 @@ $lang = array_merge($lang, array( 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s', 'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s', 'CLI_EXTENSION_ENABLED' => 'Extension %s is already enabled', + 'CLI_EXTENSION_NOT_EXIST' => 'Extension %s does not exist', 'CLI_EXTENSION_NAME' => 'Name of the extension', 'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s', 'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s', diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index f92de0069c..a6f5b10e86 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -37,6 +37,13 @@ class enable extends command $io = new SymfonyStyle($input, $output); $name = $input->getArgument('extension-name'); + + if (!$this->manager->is_available($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name)); + return 1; + } + $extension = $this->manager->get_extension($name); if (!$extension->is_enableable()) -- cgit v1.2.1 From 65c529e66dbd4199900a2bb91a7b7ada8ccc47f0 Mon Sep 17 00:00:00 2001 From: kasimi Date: Sun, 3 Dec 2017 18:47:17 +0100 Subject: [ticket/15431] Split up $template_vars PHPBB3-15431 --- phpBB/includes/ucp/ucp_register.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index f424a4e95e..b2efedadb3 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -505,7 +505,6 @@ class ucp_register { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); } - $s_hidden_fields = build_hidden_fields($s_hidden_fields); // Visual Confirmation - Show images if ($config['enable_confirm']) @@ -529,7 +528,6 @@ class ucp_register } $template_vars = array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], @@ -544,13 +542,13 @@ class ucp_register 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, - 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path'], ); + $tz = $data['tz']; $tpl_name = 'ucp_register'; /** @@ -558,9 +556,10 @@ class ucp_register * * @event core.ucp_register_modify_template_data * @var array template_vars Array with template data - * @var array data Array with user data + * @var array data Array with user data, read only * @var array error Array with errors - * @var string s_hidden_fields HTML with hidden form field elements + * @var array s_hidden_fields Array with hidden field elements + * @var string tz The selected timezone * @var string tpl_name Template name * @since 3.2.2-RC1 */ @@ -569,12 +568,18 @@ class ucp_register 'data', 'error', 's_hidden_fields', + 'tz', 'tpl_name', ); extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); // Assign template vars for timezone select - phpbb_timezone_select($template, $user, $data['tz'], true); + phpbb_timezone_select($template, $user, $tz, true); + + $template_vars = array_merge($template_vars, array( + 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); $template->assign_vars($template_vars); -- cgit v1.2.1 From 6cc46a3d39f8c9d8d36ac3d873af5c0981cd2f88 Mon Sep 17 00:00:00 2001 From: kasimi Date: Sun, 3 Dec 2017 19:02:40 +0100 Subject: [ticket/15431] Moved phpbb_timezone_select() before the event PHPBB3-15431 --- phpBB/includes/ucp/ucp_register.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index b2efedadb3..6e010a0852 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -527,6 +527,9 @@ class ucp_register break; } + // Assign template vars for timezone select + phpbb_timezone_select($template, $user, $data['tz'], true); + $template_vars = array( 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], @@ -548,7 +551,6 @@ class ucp_register 'COOKIE_PATH' => $config['cookie_path'], ); - $tz = $data['tz']; $tpl_name = 'ucp_register'; /** @@ -559,7 +561,6 @@ class ucp_register * @var array data Array with user data, read only * @var array error Array with errors * @var array s_hidden_fields Array with hidden field elements - * @var string tz The selected timezone * @var string tpl_name Template name * @since 3.2.2-RC1 */ @@ -568,14 +569,10 @@ class ucp_register 'data', 'error', 's_hidden_fields', - 'tz', 'tpl_name', ); extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); - // Assign template vars for timezone select - phpbb_timezone_select($template, $user, $tz, true); - $template_vars = array_merge($template_vars, array( 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), -- cgit v1.2.1 From 5ab3eac014eec9c3fee2a7b7013ffa9e10534e06 Mon Sep 17 00:00:00 2001 From: Derky Date: Fri, 8 Dec 2017 23:49:49 +0100 Subject: [ticket/15475] Fix Travis pull request commit messages validation It stopped working because of Travis's default clone depth of 50. PHPBB3-15475 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fa2a86c0db..4cef1af10e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,4 +53,4 @@ script: - sh -c "if [ '$SLOWTESTS' != '1' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/phpunit tests/lint_test.php; fi" - sh -c "if [ '$NOTESTS' != '1' -a '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --verbose --stop-on-error; fi" - sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi" - - sh -c "set -x;if [ '$NOTESTS' = '1' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" + - sh -c "set -x;if [ '$NOTESTS' = '1' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git remote set-branches --add origin $TRAVIS_BRANCH && git fetch && git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..$TRAVIS_PULL_REQUEST_SHA; fi" -- cgit v1.2.1 From b4ca1bdb0050b238797431f29faaefdc3057b50a Mon Sep 17 00:00:00 2001 From: kitsiosk Date: Sat, 9 Dec 2017 16:19:41 +0200 Subject: [ticket/15322] Fix bug wrong return in emails PHPBB3-15322 --- phpBB/includes/functions_messenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ab7f00a65a..dccad1c05c 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1839,7 +1839,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) // On some PHP Versions mail() *may* fail if there are newlines within the subject. // Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8. // Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used) - $result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); + $result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, "-f" . $config['board_email']); $collector->uninstall(); $err_msg = $collector->format_errors(); -- cgit v1.2.1 From 3083dd997b0064fbaa7893ce79677da629f326c3 Mon Sep 17 00:00:00 2001 From: kasimi Date: Sat, 9 Dec 2017 15:40:55 +0100 Subject: [ticket/15476] Add event core.search_modify_post_row PHPBB3-15476 --- phpBB/search.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpBB/search.php b/phpBB/search.php index 0d9b2bbfe8..eabb1fc96e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -932,6 +932,26 @@ if ($keywords || $author || $author_id || $search_id || $submit) while ($row = $db->sql_fetchrow($result)) { + /** + * Modify the row of a post result before the post_text is trimmed + * + * @event core.search_modify_post_row + * @var string hilit String to highlight + * @var array row Array with the post data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.2.2-RC1 + */ + $vars = array( + 'hilit', + 'row', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_post_row', compact($vars))); + // We pre-process some variables here for later usage $row['post_text'] = censor_text($row['post_text']); -- cgit v1.2.1 From b9dce3fa65a508baa02bc66e86e68b931e0ba670 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 10 Dec 2017 02:54:38 +0100 Subject: [ticket/15457] Updated s9e/text-formatter dependency PHPBB3-15457 --- phpBB/composer.json | 4 +-- phpBB/composer.lock | 20 ++++++------ phpBB/phpbb/textformatter/s9e/factory.php | 5 ++- phpBB/phpbb/textformatter/s9e/parser.php | 6 ++-- .../text_formatter/s9e/default_formatting_test.php | 36 +++++++++++----------- .../text_processing/tickets_data/PHPBB3-10122.html | 2 +- .../text_processing/tickets_data/PHPBB3-10268.html | 4 +-- .../text_processing/tickets_data/PHPBB3-13641.html | 2 +- .../text_processing/tickets_data/PHPBB3-13921.html | 2 +- .../text_processing/tickets_data/PHPBB3-14706.html | 2 +- .../text_processing/tickets_data/PHPBB3-14790.html | 8 ++--- .../text_processing/tickets_data/PHPBB3-14846.html | 2 +- .../text_processing/tickets_data/PHPBB3-15348.html | 2 +- .../text_processing/tickets_data/PHPBB3-8419.html | 2 +- 14 files changed, 48 insertions(+), 49 deletions(-) diff --git a/phpBB/composer.json b/phpBB/composer.json index 5bc8f5dc0d..926fad5188 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -33,7 +33,7 @@ "marc1706/fast-image-size": "^1.1", "paragonie/random_compat": "^1.4", "patchwork/utf8": "^1.1", - "s9e/text-formatter": "~0.11.0", + "s9e/text-formatter": "~0.13.0", "symfony/config": "^2.8", "symfony/console": "^2.8", "symfony/debug": "^2.8", @@ -69,7 +69,7 @@ }, "config": { "platform": { - "php": "5.4" + "php": "5.4.7" } } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index c1bdf26e02..59143a1fa7 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "7c30306b2abcb79a206bf6497ef45a02", - "content-hash": "d559dd0af2317fb0fc15720a18834e33", + "hash": "f14915a2ccaf76ccd6d3ea725721a8a8", + "content-hash": "c843abc1344cd9df37f63c08a125cad0", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -661,27 +661,27 @@ }, { "name": "s9e/text-formatter", - "version": "0.11.2", + "version": "0.13.1", "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "735a56076e29348d838ce6c2658996daae86718f" + "reference": "804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/735a56076e29348d838ce6c2658996daae86718f", - "reference": "735a56076e29348d838ce6c2658996daae86718f", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f", + "reference": "804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f", "shasum": "" }, "require": { "ext-dom": "*", "ext-filter": "*", "lib-pcre": ">=7.2", - "php": ">=5.3.3" + "php": ">=5.4.7" }, "require-dev": { "matthiasmullie/minify": "*", - "php": ">=5.3.3", + "php": ">=5.4.7", "s9e/regexp-builder": ">=1.3.0" }, "suggest": { @@ -722,7 +722,7 @@ "parser", "shortcodes" ], - "time": "2017-10-02 16:58:51" + "time": "2017-12-10 00:55:53" }, { "name": "symfony/config", @@ -3577,6 +3577,6 @@ }, "platform-dev": [], "platform-overrides": { - "php": "5.4" + "php": "5.4.7" } } diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 15d0a5e3e5..1548b17945 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -266,7 +266,8 @@ class factory implements \phpbb\textformatter\cache_interface ->addParameterByName('logger') ->addParameterByName('max_img_height') ->addParameterByName('max_img_width') - ->markAsSafeAsURL(); + ->markAsSafeAsURL() + ->setJS('UrlFilter.filter'); // Add default BBCodes foreach ($this->get_default_bbcodes($configurator) as $bbcode) @@ -355,8 +356,6 @@ class factory implements \phpbb\textformatter\cache_interface $configurator->registeredVars['max_img_width'] = 0; // Load the Emoji plugin and modify its tag's template to obey viewsmilies - $configurator->Emoji->omitImageSize(); - $configurator->Emoji->useSVG(); $tag = $configurator->Emoji->getTag(); $tag->template = '' . str_replace('class="emoji"', 'class="emoji smilies"', $tag->template) . ''; diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php index 05ddfffa11..3698dca224 100644 --- a/phpBB/phpbb/textformatter/s9e/parser.php +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -13,7 +13,7 @@ namespace phpbb\textformatter\s9e; -use s9e\TextFormatter\Parser\BuiltInFilters; +use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter; use s9e\TextFormatter\Parser\Logger; /** @@ -196,7 +196,7 @@ class parser implements \phpbb\textformatter\parser_interface public function get_errors() { $errors = array(); - foreach ($this->parser->getLogger()->get() as $entry) + foreach ($this->parser->getLogger()->getLogs() as $entry) { list(, $msg, $context) = $entry; @@ -365,7 +365,7 @@ class parser implements \phpbb\textformatter\parser_interface static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width) { // Validate the URL - $url = BuiltInFilters::filterUrl($url, $url_config, $logger); + $url = UrlFilter::filter($url, $url_config, $logger); if ($url === false) { return false; diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index a0c57214e4..8887b9daee 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -50,27 +50,27 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case return array( array( '[b]bold[/b]', - 'bold' + 'bold' ), array( '[u]underlined[/u]', - 'underlined' + 'underlined' ), array( '[i]italic[/i]', - 'italic' + 'italic' ), array( '[color=#FF0000]colored[/color]', - 'colored' + 'colored' ), array( '[color=red]colored[/color]', - 'colored' + 'colored' ), array( '[size=75]smaller[/size]', - 'smaller' + 'smaller' ), array( '[quote]quoted[/quote]', @@ -102,31 +102,31 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( '[list=1][*]item[/list]', - '

  1. item
' + '
  1. item
' ), array( '[list=a][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=i][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=I][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=disc][*]item[/list]', - '
  • item
' + '
  • item
' ), array( '[list=circle][*]item[/list]', - '
  • item
' + '
  • item
' ), array( '[list=square][*]item[/list]', - '
  • item
' + '
  • item
' ), array( '[img]https://area51.phpbb.com/images/area51.png[/img]', @@ -180,17 +180,17 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Allow textual bbcodes in textual bbcodes '[b]bold [i]bold + italic[/i][/b]', - 'bold bold + italic' + 'bold bold + italic' ), array( // Allow textual bbcodes in url with description '[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]', - 'Area51 italic' + 'Area51 italic' ), array( // Allow url with description in textual bbcodes '[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]', - 'italic Area51' + 'italic Area51' ), array( // Do not parse textual bbcodes in code @@ -205,7 +205,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Textual bbcode nesting into textual bbcode '[b]bold [i]bold + italic[/b] italic[/i]', - 'bold bold + italic italic' + 'bold bold + italic italic' ), array( "[code]\tline1\n line2[/code]", @@ -298,7 +298,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( "Emoji: \xF0\x9F\x98\x80", - 'Emoji: ' . ' + 'Emoji: ' . ' ), array( "Emoji: \xF0\x9F\x98\x80", diff --git a/tests/text_processing/tickets_data/PHPBB3-10122.html b/tests/text_processing/tickets_data/PHPBB3-10122.html index f0fb6115b2..0803c895a8 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10122.html +++ b/tests/text_processing/tickets_data/PHPBB3-10122.html @@ -1 +1 @@ -
  • This is my indented text
\ No newline at end of file +
  • This is my indented text
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10268.html b/tests/text_processing/tickets_data/PHPBB3-10268.html index c89e63f9a3..13b71b4823 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10268.html +++ b/tests/text_processing/tickets_data/PHPBB3-10268.html @@ -1,4 +1,4 @@
-http://phpbb.com
- http://phpbb.com
+http://phpbb.com
+ http://phpbb.com
diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.html b/tests/text_processing/tickets_data/PHPBB3-13641.html index 1bd1c06dbb..2646bc0ea5 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13641.html +++ b/tests/text_processing/tickets_data/PHPBB3-13641.html @@ -1 +1 @@ -[color=#FF0000] - red \ No newline at end of file +[color=#FF0000] - red \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.html b/tests/text_processing/tickets_data/PHPBB3-13921.html index 6a9dc7f504..690668ef28 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13921.html +++ b/tests/text_processing/tickets_data/PHPBB3-13921.html @@ -1 +1 @@ -
xxx
\ No newline at end of file +
xxx
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14706.html b/tests/text_processing/tickets_data/PHPBB3-14706.html index b8f74c9e93..23b3304485 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14706.html +++ b/tests/text_processing/tickets_data/PHPBB3-14706.html @@ -1 +1 @@ -
    1. a
    2. b
    3. c
    4. d
    5. e
  • outer
\ No newline at end of file +
    1. a
    2. b
    3. c
    4. d
    5. e
  • outer
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14790.html b/tests/text_processing/tickets_data/PHPBB3-14790.html index 7624b2d36c..5384098e1b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14790.html +++ b/tests/text_processing/tickets_data/PHPBB3-14790.html @@ -1,4 +1,4 @@ -
  • text
  • -
  • text
  • -
  • text
  • -
  • text
\ No newline at end of file +
  • text
  • +
  • text
  • +
  • text
  • +
  • text
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14846.html b/tests/text_processing/tickets_data/PHPBB3-14846.html index 461ca25bc6..bd4455781b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14846.html +++ b/tests/text_processing/tickets_data/PHPBB3-14846.html @@ -1 +1 @@ -
moderator text
- Mickroz
\ No newline at end of file +
moderator text
- Mickroz
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.html b/tests/text_processing/tickets_data/PHPBB3-15348.html index e65925ec28..5d44c07899 100644 --- a/tests/text_processing/tickets_data/PHPBB3-15348.html +++ b/tests/text_processing/tickets_data/PHPBB3-15348.html @@ -1 +1 @@ -:o k: :ok: \ No newline at end of file +:o k: :ok: \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.html b/tests/text_processing/tickets_data/PHPBB3-8419.html index 38df626a94..df91e9df50 100644 --- a/tests/text_processing/tickets_data/PHPBB3-8419.html +++ b/tests/text_processing/tickets_data/PHPBB3-8419.html @@ -1 +1 @@ -przykład \ No newline at end of file +przykład \ No newline at end of file -- cgit v1.2.1 From 75e7e7b293c812645942427fd8156a160225d0d5 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 27 Nov 2017 21:12:19 +0100 Subject: [ticket/15468] Add a service to merge duplicate BBCodes PHPBB3-15468 --- .../default/container/services_text_formatter.yml | 5 + phpBB/phpbb/textformatter/s9e/bbcode_merger.php | 180 +++++++++++++ tests/text_formatter/s9e/bbcode_merger_test.php | 280 +++++++++++++++++++++ 3 files changed, 465 insertions(+) create mode 100644 phpBB/phpbb/textformatter/s9e/bbcode_merger.php create mode 100644 tests/text_formatter/s9e/bbcode_merger_test.php diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index a9f2efdb16..74624ea4e4 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -26,6 +26,11 @@ services: text_formatter.utils: alias: text_formatter.s9e.utils + text_formatter.s9e.bbcode_merger: + class: phpbb\textformatter\s9e\bbcode_merger + arguments: + - '@text_formatter.s9e.factory' + text_formatter.s9e.factory: class: phpbb\textformatter\s9e\factory arguments: diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php new file mode 100644 index 0000000000..72b1473751 --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php @@ -0,0 +1,180 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use phpbb\textformatter\s9e\factory; +use s9e\TextFormatter\Configurator\Helpers\TemplateHelper; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +class bbcode_merger +{ + /** + * @var \s9e\TextFormatter\Configurator $configurator Configurator instance used to inspect BBCodes + */ + protected $configurator; + + /** + * @param \phpbb\textformatter\s9e\factory $factory + */ + public function __construct(factory $factory) + { + $this->configurator = $factory->get_configurator(); + } + + /** + * Merge two BBCode definitions + * + * All of the arrays contain a "usage" element and a "template" element + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + public function merge_bbcodes(array $without, array $with) + { + $without = $this->create_bbcode($without); + $with = $this->create_bbcode($with); + + // Select the appropriate strategy for merging this BBCode + if ($this->is_content_bbcode($without, $with)) + { + $merged = $this->merge_content_bbcode($without, $with); + } + else + { + $merged = $this->merge_optional_bbcode($without, $with); + } + + $merged['template'] = $this->normalize_template($merged['template']); + + return $merged; + } + + /** + * Create a custom BBCode for inspection + * + * @param array $definition Original BBCode definition + * @return array Updated definition containing a BBCode object and a Tag + */ + protected function create_bbcode(array $definition) + { + $bbcode = $this->configurator->BBCodes->addCustom( + $definition['usage'], + new UnsafeTemplate($definition['template']) + ); + + $definition['bbcode'] = $bbcode; + $definition['tag'] = $this->configurator->tags[$bbcode->tagName]; + + return $definition; + } + + /** + * Indent given template for readability + * + * @param string $template + * @return string + */ + protected function indent_template($template) + { + $dom = TemplateHelper::loadTemplate($template); + $dom->formatOutput = true; + $template = TemplateHelper::saveTemplate($dom); + + // Remove the first level of indentation if the template starts with whitespace + if (preg_match('(^\\n +)', $template, $m)) + { + $template = str_replace($m[0], "\n", $template); + } + + return trim($template); + } + + /** + * Test whether the two definitions form a "content"-style BBCode + * + * Such BBCodes include the [URL] BBCode, which uses its text content as + * attribute if none is provided + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function is_content_bbcode(array $without, array $with) + { + // Test whether we find the same non-TEXT token between "]" and "[" in the usage + // as between ">" and "<" in the template + return (preg_match('(\\]\\s*(\\{(?!TEXT)[^}]+\\})\\s*\\[)', $without['usage'], $m) + && preg_match('(>[^<]*?' . preg_quote($m[1]) . '[^>]*?<)s', $without['template'])); + } + + /** + * Merge the two BBCode definitions of a "content"-style BBCode + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_content_bbcode(array $without, array $with) + { + // Convert [X={X}] into [X={X;useContent}] + $usage = preg_replace('(\\})', ';useContent}', $with['usage'], 1); + + // Use the template from the definition that uses an attribute + $template = $with['tag']->template; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Merge the two BBCode definitions of a BBCode with an optional argument + * + * Such BBCodes include the [QUOTE] BBCode, which takes an optional argument + * but otherwise does not behave differently + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_optional_bbcode(array $without, array $with) + { + // Convert [X={X}] into [X={X?}] + $usage = preg_replace('(\\})', '?}', $with['usage'], 1); + + // Build a template for both versions + $template = '' . $with['tag']->template . '' . $without['tag']->template . ''; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Normalize a template + * + * @param string $template + * @return string + */ + protected function normalize_template($template) + { + // Normalize the template to simplify it + $template = $this->configurator->templateNormalizer->normalizeTemplate($template); + + // Convert xsl:value-of elements back to {L_} tokens where applicable + $template = preg_replace('()', '{$1}', $template); + + // Beautify the template + $template = $this->indent_template($template); + + return $template; + } +} diff --git a/tests/text_formatter/s9e/bbcode_merger_test.php b/tests/text_formatter/s9e/bbcode_merger_test.php new file mode 100644 index 0000000000..815539056b --- /dev/null +++ b/tests/text_formatter/s9e/bbcode_merger_test.php @@ -0,0 +1,280 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_textformatter_s9e_bbcode_merger_test extends phpbb_test_case +{ + /** + * @dataProvider get_merge_bbcodes_tests + */ + public function test_merge_bbcodes($usage_without, $template_without, $usage_with, $template_with, $expected_usage, $expected_template) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $factory = $container->get('text_formatter.s9e.factory'); + $bbcode_merger = new \phpbb\textformatter\s9e\bbcode_merger($factory); + + $without = ['usage' => $usage_without, 'template' => $template_without]; + $with = ['usage' => $usage_with, 'template' => $template_with]; + $merged = $bbcode_merger->merge_bbcodes($without, $with); + + // Normalize the expected template's whitespace to match the default indentation + $expected_template = str_replace("\n\t\t\t\t", "\n", $expected_template); + $expected_template = str_replace("\t", ' ', $expected_template); + + $this->assertSame($expected_usage, $merged['usage']); + $this->assertSame($expected_template, $merged['template']); + } + + public function get_merge_bbcodes_tests() + { + return [ + [ + '[x]{TEXT}[/x]', + '{TEXT}', + + '[x={TEXT1}]{TEXT}[/x]', + '{TEXT}', + + '[x={TEXT1?}]{TEXT}[/x]', + ' + + + + + + + ' + ], + [ + // The tokens' numbering differs between versions + '[x]{TEXT}[/x]', + '{TEXT}', + + '[x={TEXT1}]{TEXT2}[/x]', + '{TEXT2}', + + '[x={TEXT1?}]{TEXT2}[/x]', + ' + + + + + + + ' + ], + [ + '[x]{URL}[/x]', + '{URL}', + + '[x={URL}]{TEXT}[/x]', + '{TEXT}', + + '[x={URL;useContent}]{TEXT}[/x]', + ' + + ' + ], + [ + '[x]{URL}[/x]', + '{L_GO_TO}: {URL}', + + '[x={URL}]{TEXT}[/x]', + '{L_GO_TO}: {TEXT}', + + '[x={URL;useContent}]{TEXT}[/x]', + '{L_GO_TO}: ' + ], + [ + // Test that unsafe BBCodes can still be merged + '[script]{TEXT}[/script]', + '', + + '[script={TEXT1}]{TEXT2}[/script]', + '', + + '[script={TEXT1?}]{TEXT2}[/script]', + '' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14848281#p14848281 + '[note]{TEXT}[/note]', + '{TEXT}', + + '[note={TEXT1}]{TEXT2}[/note]', + '{TEXT1}{TEXT2}', + + '[note={TEXT1?}]{TEXT2}[/note]', + ' + + + + + + + + ' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14768441#p14768441 + '[MI]{TEXT}[/MI]', + 'MI: {TEXT}', + + '[MI={TEXT2}]{TEXT1}[/MI]', + 'MI for: "{TEXT2}": {TEXT1}', + + '[MI={TEXT2?}]{TEXT1}[/MI]', + 'MI for: "": + + + + ' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14700506#p14700506 + '[spoiler]{TEXT}[/spoiler]', + ' {TEXT}', + + '[spoiler={TEXT1}]{TEXT2}[/spoiler]', + '
{TEXT1}{TEXT2}
', + + '[spoiler={TEXT1?}]{TEXT2}[/spoiler]', + ' + +
+ + + + + +
+
+ + + + + + +
' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14859676#p14859676 + '[AE]{TEXT}[/AE]', + ' + +
+ + + + +
+ + + + + + + + +
+  ACTIVE EFFECTS & CONDITIONS  
+ + + + +
+ {TEXT} +
+
+
+
+

 

', + + '[AE={TEXT1}]{TEXT2}[/AE]', + ' + +
+ + + + +
+ + + + + + + + +
+   {TEXT1}  
+ + + + +
+ {TEXT2} +
+
+
+
+

 

', + + '[AE={TEXT1?}]{TEXT2}[/AE]', + ' + + + +
+ + + + +
+ + + + + + + + +
+ + +   ACTIVE EFFECTS & CONDITIONS  + + +  
+ + + + +
+ +
+
+
+
+

 

' + ], + ]; + } +} -- cgit v1.2.1 From 485a4a75b21578cc1d2bd46b0562d704ac4ebbdb Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 28 Nov 2017 02:09:50 +0100 Subject: [ticket/15444] Add a migration to merge duplicate BBCodes PHPBB3-15444 --- .../data/v32x/merge_duplicate_bbcodes.php | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php new file mode 100644 index 0000000000..3bf442bab5 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php @@ -0,0 +1,75 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class merge_duplicate_bbcodes extends \phpbb\db\migration\migration +{ + public function update_data() + { + return [ + ['custom', [[$this, 'update_bbcodes_table']]], + ]; + } + + public function update_bbcodes_table() + { + $sql = 'SELECT bbcode_id, bbcode_tag, bbcode_helpline, bbcode_match, bbcode_tpl FROM ' . BBCODES_TABLE; + $result = $this->sql_query($sql); + $bbcodes = []; + while ($row = $this->db->sql_fetchrow($result)) + { + $variant = (substr($row['bbcode_tag'], -1) === '=') ? 'with': 'without'; + $bbcode_name = rtrim($row['bbcode_tag'], '='); + $bbcodes[$bbcode_name][$variant] = $row; + } + $this->db->sql_freeresult($result); + + foreach ($bbcodes as $bbcode_name => $variants) + { + if (count($variants) === 2) + { + $this->merge_bbcodes($variants['without'], $variants['with']); + } + } + } + + protected function merge_bbcodes(array $without, array $with) + { + $merged = $this->container->get('text_formatter.s9e.bbcode_merger')->merge_bbcodes( + [ + 'usage' => $without['bbcode_match'], + 'template' => $without['bbcode_tpl'] + ], + [ + 'usage' => $with['bbcode_match'], + 'template' => $with['bbcode_tpl'] + ] + ); + $bbcode_data = [ + 'bbcode_tag' => $without['bbcode_tag'], + 'bbcode_helpline' => $without['bbcode_helpline'] . ' | ' . $with['bbcode_helpline'], + 'bbcode_match' => $merged['usage'], + 'bbcode_tpl' => $merged['template'] + ]; + + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $bbcode_data) . ' + WHERE bbcode_id = ' . $without['bbcode_id']; + $this->sql_query($sql); + + $sql = 'DELETE FROM ' . BBCODES_TABLE . ' + WHERE bbcode_id = ' . $with['bbcode_id']; + $this->sql_query($sql); + } +} -- cgit v1.2.1 From c94b7f69b7e0d53ff4e382501ee9239ad627e55b Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Mon, 11 Dec 2017 14:31:20 -0500 Subject: [ticket/15478] Fix core.js $loadingIndicator JavaScript errors PHPBB3-15478 --- phpBB/assets/javascript/core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 359afb1ec4..069f9089c2 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -27,9 +27,9 @@ phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined'); */ phpbb.loadingIndicator = function() { if (!$loadingIndicator) { - $loadingIndicator = $('
', { - id: 'loading_indicator', - class: 'loading_indicator', + $loadingIndicator = $('
', { + 'id': 'loading_indicator', + 'class': 'loading_indicator' }); $loadingIndicator.appendTo('#page-footer'); } -- cgit v1.2.1 From 9f055e1af39f36ff18cc278093000cb30c858885 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 11 Dec 2017 21:56:21 +0100 Subject: [ticket/15322] Add config setting for -f parameter & remove mail function name The -f parameter can now be added via configuration in the ACP. Addtionally, the config setting for the mail function name has been removed. PHPBB3-15322 --- phpBB/includes/acp/acp_board.php | 9 +----- phpBB/includes/functions_messenger.php | 5 +-- phpBB/includes/questionnaire/questionnaire.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/acp/board.php | 4 +-- .../migration/data/v32x/email_envelope_sender.php | 37 ++++++++++++++++++++++ 6 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 77e6133fe6..0babe78064 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -444,7 +444,7 @@ class acp_board 'legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), + 'email_envelope_sender' => array('lang' => 'EMAIL_ENVELOPE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), @@ -532,13 +532,6 @@ class acp_board $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; - if ($config_name == 'email_function_name') - { - $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name'])); - $this->new_config['email_function_name'] = (empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name'])) ? 'mail' : $this->new_config['email_function_name']; - $config_value = $this->new_config['email_function_name']; - } - if ($submit) { if (strpos($data['type'], 'password') === 0 && $config_value === '********') diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index dccad1c05c..2447a7d9cf 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -416,7 +416,7 @@ class messenger switch ($type) { case 'EMAIL': - $message = 'EMAIL/' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP/' . $config['email_function_name'] . '()') . ''; + $message = 'EMAIL/' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP/mail()') . ''; break; default: @@ -1839,7 +1839,8 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) // On some PHP Versions mail() *may* fail if there are newlines within the subject. // Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8. // Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used) - $result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, "-f" . $config['board_email']); + $additional_parameters = $config['email_envelope_sender'] ? '-f' . $config['board_email'] : ''; + $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); $collector->uninstall(); $err_msg = $collector->format_errors(); diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 9699843db4..999200e0f2 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -337,7 +337,7 @@ class phpbb_questionnaire_phpbb_data_provider 'edit_time' => true, 'email_check_mx' => true, 'email_enable' => true, - 'email_function_name' => true, + 'email_envelope_sender' => true, 'email_package_size' => true, 'enable_confirm' => true, 'enable_pm_icons' => true, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index f97ba7ac07..743c3e30e2 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -103,7 +103,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_un INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_envelope_sender', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index f6e7a310a8..e836ae30a4 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -562,8 +562,8 @@ $lang = array_merge($lang, array( 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', 'CONTACT_EMAIL_NAME' => 'Contact name', 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', - 'EMAIL_FUNCTION_NAME' => 'Email function name', - 'EMAIL_FUNCTION_NAME_EXPLAIN' => 'The email function used to send mails through PHP.', + 'EMAIL_ENVELOPE_SENDER' => 'Set envelope sender address', + 'EMAIL_ENVELOPE_SENDER_EXPLAIN' => 'Setting the envelope sender address might be needed for a correct return address when sending mails on some hosts.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', 'EMAIL_SIG' => 'Email signature', diff --git a/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php b/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php new file mode 100644 index 0000000000..2ba83f40df --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class email_envelope_sender extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function effectively_installed() + { + return isset($this->config['email_envelope_sender']); + } + + public function update_data() + { + return array( + array('config.add', array('email_envelope_sender', '0')), + array('config.remove', array('email_function_name')), + ); + } +} -- cgit v1.2.1 From 4e045ed767603547d6aa9126d22a42bd690a1dd1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 13 Dec 2017 21:31:07 +0100 Subject: [ticket/15322] Try to make new email setting more readable PHPBB3-15322 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/questionnaire/questionnaire.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/acp/board.php | 4 +-- .../migration/data/v32x/email_envelope_sender.php | 37 ---------------------- .../db/migration/data/v32x/email_force_sender.php | 37 ++++++++++++++++++++++ 7 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php create mode 100644 phpBB/phpbb/db/migration/data/v32x/email_force_sender.php diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 0babe78064..57770f12c3 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -444,7 +444,7 @@ class acp_board 'legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'email_envelope_sender' => array('lang' => 'EMAIL_ENVELOPE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 2447a7d9cf..4eda5ac6cb 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1839,7 +1839,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) // On some PHP Versions mail() *may* fail if there are newlines within the subject. // Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8. // Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used) - $additional_parameters = $config['email_envelope_sender'] ? '-f' . $config['board_email'] : ''; + $additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : ''; $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); $collector->uninstall(); diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 999200e0f2..ee6d0ee2a6 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -337,7 +337,7 @@ class phpbb_questionnaire_phpbb_data_provider 'edit_time' => true, 'email_check_mx' => true, 'email_enable' => true, - 'email_envelope_sender' => true, + 'email_force_sender' => true, 'email_package_size' => true, 'enable_confirm' => true, 'enable_pm_icons' => true, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 743c3e30e2..9d1236f340 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -103,7 +103,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_un INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_envelope_sender', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_force_sender', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e836ae30a4..5642f8f394 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -562,8 +562,8 @@ $lang = array_merge($lang, array( 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', 'CONTACT_EMAIL_NAME' => 'Contact name', 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', - 'EMAIL_ENVELOPE_SENDER' => 'Set envelope sender address', - 'EMAIL_ENVELOPE_SENDER_EXPLAIN' => 'Setting the envelope sender address might be needed for a correct return address when sending mails on some hosts.', + 'EMAIL_FORCE_SENDER' => 'Force from email address', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'Force from email address to return email. This might be needed for a correct return address when sending mails on some hosts.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', 'EMAIL_SIG' => 'Email signature', diff --git a/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php b/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php deleted file mode 100644 index 2ba83f40df..0000000000 --- a/phpBB/phpbb/db/migration/data/v32x/email_envelope_sender.php +++ /dev/null @@ -1,37 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace phpbb\db\migration\data\v32x; - -class email_envelope_sender extends \phpbb\db\migration\migration -{ - static public function depends_on() - { - return array( - '\phpbb\db\migration\data\v32x\v321', - ); - } - - public function effectively_installed() - { - return isset($this->config['email_envelope_sender']); - } - - public function update_data() - { - return array( - array('config.add', array('email_envelope_sender', '0')), - array('config.remove', array('email_function_name')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/v32x/email_force_sender.php b/phpBB/phpbb/db/migration/data/v32x/email_force_sender.php new file mode 100644 index 0000000000..5319b7f76e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/email_force_sender.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class email_force_sender extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function effectively_installed() + { + return isset($this->config['email_force_sender']); + } + + public function update_data() + { + return array( + array('config.add', array('email_force_sender', '0')), + array('config.remove', array('email_function_name')), + ); + } +} -- cgit v1.2.1 From 4bbda5bc4551c8b7ff3755a8bdb457aa30aebc24 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 16 Dec 2017 18:32:55 +0100 Subject: [ticket/15322] Adjust email language and move force sender setting PHPBB3-15322 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/language/en/acp/board.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 57770f12c3..d2a4262e36 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -444,11 +444,11 @@ class acp_board 'legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true), diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 5642f8f394..1fd827aa98 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -553,7 +553,7 @@ $lang = array_merge($lang, array( 'ACP_EMAIL_SETTINGS_EXPLAIN' => 'This information is used when the board sends emails to your users. Please ensure the email address you specify is valid, any bounced or undeliverable messages will likely be sent to that address. If your host does not provide a native (PHP based) email service you can instead send messages directly using SMTP. This requires the address of an appropriate server (ask your provider if necessary). If the server requires authentication (and only if it does) enter the necessary username, password and authentication method.', 'ADMIN_EMAIL' => 'Return email address', - 'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the return address on all emails, the technical contact email address. It will always be used as the Return-Path and Sender address in emails.', + 'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the from address on all emails, the technical contact email address. It will always be used as the Sender address in emails.', 'BOARD_EMAIL_FORM' => 'Users send email via board', 'BOARD_EMAIL_FORM_EXPLAIN' => 'Instead of showing the users email address users are able to send emails via the board.', 'BOARD_HIDE_EMAILS' => 'Hide email addresses', @@ -563,7 +563,7 @@ $lang = array_merge($lang, array( 'CONTACT_EMAIL_NAME' => 'Contact name', 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', 'EMAIL_FORCE_SENDER' => 'Force from email address', - 'EMAIL_FORCE_SENDER_EXPLAIN' => 'Force from email address to return email. This might be needed for a correct return address when sending mails on some hosts.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'Force from email address to return email. This might be needed for a correct return address when sending mails on some hosts.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', 'EMAIL_SIG' => 'Email signature', -- cgit v1.2.1 From 79464c99511570291f16261fc1c55f095fecf01c Mon Sep 17 00:00:00 2001 From: kasimi Date: Mon, 6 Nov 2017 21:05:34 +0100 Subject: [ticket/15440] Added core.ucp_register_agreement_modify_template_data PHPBB3-15440 --- phpBB/includes/ucp/ucp_register.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 594100ac65..2fa95fc500 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -166,7 +166,7 @@ class ucp_register ->format($user->lang['DATE_FORMAT'], true); unset($now); - $template->assign_vars(array( + $template_vars = array( 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), @@ -180,11 +180,11 @@ class ucp_register 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path'], - )); + ); } else { - $template->assign_vars(array( + $template_vars = array( 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), @@ -195,11 +195,32 @@ class ucp_register 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path'], - ) ); } + + $tpl_name = 'ucp_agreement'; + + /** + * Allows to modify the agreements. + * + * @event core.ucp_register_agreement_modify_template_data + * @var string tpl_name Template file + * @var array template_vars Array with data about to be assigned to the template + * @var array s_hidden_fields Array with hidden form elements + * @var array lang_row Array with available languages, read only + * @since 3.2.2-RC1 + */ + $vars = array('tpl_name', 'template_vars', 's_hidden_fields', 'lang_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_agreement_modify_template_data', compact($vars))); + unset($lang_row); + $template_vars = array_merge($template_vars, array( + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); + + $template->assign_vars($template_vars); + /** * Allows to modify the agreements. * @@ -207,10 +228,11 @@ class ucp_register * * @event core.ucp_register_agreement * @since 3.1.6-RC1 + * @deprecated Replaced by core.ucp_register_agreement_modify_template_data */ $phpbb_dispatcher->dispatch('core.ucp_register_agreement'); - $this->tpl_name = 'ucp_agreement'; + $this->tpl_name = $tpl_name; return; } -- cgit v1.2.1 From d2dc314a30198d13436ec252e86ca120b221fa8e Mon Sep 17 00:00:00 2001 From: Derky Date: Sun, 17 Dec 2017 23:04:15 +0100 Subject: [ticket/15440] State deprecated version for core.ucp_register_agreement PHPBB3-15440 --- phpBB/includes/ucp/ucp_register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 2fa95fc500..3d70c42256 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -228,7 +228,7 @@ class ucp_register * * @event core.ucp_register_agreement * @since 3.1.6-RC1 - * @deprecated Replaced by core.ucp_register_agreement_modify_template_data + * @deprecated 3.2.2-RC1 Replaced by core.ucp_register_agreement_modify_template_data and to be removed in 3.3.0-RC1 */ $phpbb_dispatcher->dispatch('core.ucp_register_agreement'); -- cgit v1.2.1 From 5bfd609cc8f6682b48530ccd63f276ecca76aec1 Mon Sep 17 00:00:00 2001 From: vinny Date: Mon, 18 Dec 2017 02:52:35 -0300 Subject: [ticket/15485] Add template event for forum images PHPBB3-15485 --- phpBB/docs/events.md | 27 ++++++++++++++++++++++ .../styles/prosilver/template/forumlist_body.html | 6 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 6af3f55d21..2725109355 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -673,6 +673,33 @@ forumlist_body_category_header_row_prepend * Since: 3.1.5-RC1 * Purpose: Add content before the header row of the category on the forum list. +forumlist_body_forum_image_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.2.2-RC1 +* Purpose: Add content after the forum image on the forum list. + +forumlist_body_forum_image_append +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.2.2-RC1 +* Purpose: Add content at the start of the forum image on the forum list. + +forumlist_body_forum_image_before +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.2.2-RC1 +* Purpose: Add content before the forum image on the forum list. + +forumlist_body_forum_image_prepend +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.2.2-RC1 +* Purpose: Add content at the end of the forum image on the forum list. + forumlist_body_forum_row_after === * Locations: diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 621e226260..eab6528ca4 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -42,7 +42,11 @@ --> - {forumrow.FORUM_IMAGE} + + + {forumrow.FORUM_IMAGE} + + {forumrow.FORUM_NAME}
{forumrow.FORUM_DESC} -- cgit v1.2.1 From bf55546d2d1481e909b918ed6cfef16e8ebc2afa Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Mon, 18 Dec 2017 08:14:42 -0500 Subject: [ticket/15471] Fix event documentation for core.prune_forums_settings_confirm PHPBB3-15471 --- phpBB/includes/acp/acp_prune.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 91f78bb70d..a8c0dd060d 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -183,7 +183,7 @@ class acp_prune * Use this event to pass data from the prune form to the confirmation screen * * @event core.prune_forums_settings_confirm - * @var int[] hidden_fields The IDs of the topics to be deleted + * @var array hidden_fields Hidden fields that are passed through the confirm screen * @since 3.2.2-RC1 */ $vars = array('hidden_fields'); -- cgit v1.2.1 From c077b90f8ba87749d0139d8389157acfe8ba3f15 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 19 Dec 2017 00:05:58 +0700 Subject: [ticket/15486] Add core event to the user_add() to modify notifications data Additionally, fix some typos in two other events docblocks. PHPBB3-15486 --- phpBB/includes/functions_user.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c746bd0e4c..175cdeeda8 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -272,8 +272,8 @@ 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 user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted 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 @@ -376,6 +376,19 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) ); } + /** + * Modify the notifications data to be inserted in the database when a user is added + * + * @event core.user_add_modify_notifications_data + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted 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.2.2-RC1 + */ + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_modify_notifications_data', compact($vars))); + // Subscribe user to notifications if necessary if (!empty($notifications_data)) { @@ -388,12 +401,12 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) } /** - * Event that returns user id, user detals and user CPF of newly registared user + * Event that returns user id, user details and user CPF of newly registered user * * @event core.user_add_after - * @var int user_id User id of newly registared user - * @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 int user_id User id of newly registered user + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add * @since 3.1.0-b5 */ $vars = array('user_id', 'user_row', 'cp_data'); -- cgit v1.2.1 From 34d52a131b3422f6dc803ec2f46cfd5d0d8892c5 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Wed, 8 Nov 2017 09:31:47 +0300 Subject: [ticket/14857] Throw `S` from dateformat for non English languages Throw `S` (ordinal suffix) from dateformat for non English languages PHPBB3-14857 --- phpBB/phpbb/datetime.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index 63cdba90fd..4b799b6219 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -60,6 +60,12 @@ class datetime extends \DateTime public function format($format = '', $force_absolute = false) { $format = $format ? $format : $this->user->date_format; + + if (substr($this->user->lang_name, 0,2) != 'en') + { + $format = preg_replace('/([^\\\])S/','$1', $format); + } + $format = self::format_cache($format, $this->user); $relative = ($format['is_short'] && !$force_absolute); $now = new self($this->user, 'now', $this->user->timezone); -- cgit v1.2.1 From 2b16b7cada85492b6312d126afa71a8a2e50a2a3 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sun, 24 Dec 2017 19:55:03 +0100 Subject: [ticket/15339] Fix tests PHPBB3-15339 --- phpBB/phpbb/db/migration/tool/module.php | 2 +- tests/dbal/migrator_tool_module_test.php | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index e1dfe40709..238e063a87 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -391,7 +391,7 @@ class module implements \phpbb\db\migration\tool\tool_interface $parent_sql = ''; if ($parent !== false) { - $parents = (array)$this->get_parent_module_id($parent, $module); + $parents = (array) $this->get_parent_module_id($parent, $module); $parent_sql = 'AND ' . $this->db->sql_in_set('parent_id', $parents); } diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 29b21166b6..c625b93ded 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -193,25 +193,6 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case } $this->assertEquals(true, $this->tool->exists('acp', 'ACP_NEW_CAT', 'ACP_NEW_MODULE')); - // Test adding module when plural parent module_langname exists - // PHPBB3-14703 - // Adding fail - try - { - $this->tool->add('acp', 'ACP_FORUM_BASED_PERMISSIONS', array( - 'module_basename' => 'acp_new_permissions_module', - 'module_langname' => 'ACP_NEW_PERMISSIONS_MODULE', - 'module_mode' => 'test', - 'module_auth' => '', - )); - $this->fail('Exception not thrown'); - } - catch (Exception $e) - { - $this->assertEquals('phpbb\db\migration\exception', get_class($e)); - $this->assertEquals('MODULE_EXIST_MULTIPLE', $e->getMessage()); - } - // Test adding module when plural parent module_langname exists // PHPBB3-14703 // Adding success -- cgit v1.2.1 From bd81af3b9e3174d1ea2dbf405b694e535e8b1b40 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 12 Jul 2017 13:25:22 +0200 Subject: [ticket/15266] Expand functionality of content_visibility Added new function "is_visible", and replaced several immediate uses of the above, including a single event in the new function to handle change in all places consistently, and much simpler. PHPBB3-15266 --- phpBB/download/file.php | 4 +++- phpBB/includes/functions_download.php | 6 +++++- phpBB/includes/functions_mcp.php | 6 ++++-- phpBB/phpbb/content_visibility.php | 36 +++++++++++++++++++++++++++++++++++ phpBB/viewforum.php | 2 +- phpBB/viewtopic.php | 2 +- 6 files changed, 50 insertions(+), 6 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index e60ffad6b0..c0837ab7a9 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -149,6 +149,8 @@ $user->session_begin(false); $auth->acl($user->data); $user->setup('viewtopic'); +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + if (!$config['allow_attachments'] && !$config['allow_pm_attach']) { send_status_line(404, 'Not Found'); @@ -215,7 +217,7 @@ else $post_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$post_row || ($post_row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $post_row['forum_id']))) + if (!$post_row || !$phpbb_content_visibility->is_visible('post', $post_row['forum_id'], $post_row)) { // Attachment of a soft deleted post and the user is not allowed to see the post send_status_line(404, 'Not Found'); diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 053e362682..ad1762da63 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -650,6 +650,8 @@ function phpbb_increment_downloads($db, $ids) */ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) { + global $phpbb_container; + $sql_array = array( 'SELECT' => 't.topic_visibility, t.forum_id, f.forum_name, f.forum_password, f.parent_id', 'FROM' => array( @@ -665,7 +667,9 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if ($row && $row['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + if ($row && !$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) { send_status_line(404, 'Not Found'); trigger_error('ERROR_NO_ATTACHMENT'); diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php index 1e08864bdc..0e26ca9b2a 100644 --- a/phpBB/includes/functions_mcp.php +++ b/phpBB/includes/functions_mcp.php @@ -197,7 +197,7 @@ function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = fa */ function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = false) { - global $db, $auth, $config, $user; + global $db, $auth, $config, $user, $phpbb_container; $rowset = array(); @@ -246,6 +246,8 @@ function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = fals $result = $db->sql_query($sql); unset($sql_array); + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + while ($row = $db->sql_fetchrow($result)) { if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) @@ -253,7 +255,7 @@ function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = fals continue; } - if ($row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) + if (!$phpbb_content_visibility->is_visible('post', $row['forum_id'], $row)) { // Moderators without the permission to approve post should at least not see them. ;) continue; diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 6abf8f996e..be552c7761 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -131,6 +131,42 @@ class content_visibility return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; } + + /** + * Check topic/post visibility for a given forum ID + * + * Note: Read permissions are not checked. + * + * @param $mode string Either "topic" or "post" + * @param $forum_id int The forum id is used for permission checks + * @param $data array Array with item information to check visibility + * @return bool True if the item is visible, false if not + */ + public function is_visible($mode, $forum_id, $data) + { + $is_visible = $this->auth->acl_get('m_approve', $forum_id) || $data[$mode . '_visibility'] == ITEM_APPROVED; + + /** + * Allow changing the result of calling is_visible + * + * @event core.phpbb_content_visibility_is_visible + * @var bool is_visible Default visibility condition, to be modified by extensions if needed. + * @var string mode Either "topic" or "post" + * @var int forum_id Forum id of the current item + * @var array data Array of item information + * @since 3.1.12-RC1 + */ + $vars = array( + 'is_visible', + 'mode', + 'forum_id', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_is_visible', compact($vars))); + + return $is_visible; + } + /** * Create topic/post visibility SQL for a given forum ID * diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 5c51975150..5e62b3c68a 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -520,7 +520,7 @@ if ($forum_data['forum_type'] == FORUM_POST) while ($row = $db->sql_fetchrow($result)) { - if ($row['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) + if (!$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) { // Do not display announcements that are waiting for approval or soft deleted. continue; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 378e2d8f97..0dad2796b3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -262,7 +262,7 @@ if (!$topic_data) $forum_id = (int) $topic_data['forum_id']; // Now we know the forum_id and can check the permissions -if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id)) +if (!$phpbb_content_visibility->is_visible('topic', $forum_id, $topic_data)) { trigger_error('NO_TOPIC'); } -- cgit v1.2.1 From dc48f28da1d4ff4ae2956648c70b8291de1d904e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 27 Dec 2017 12:24:02 +0100 Subject: [ticket/15266] Update since, add changed, and use empty where applicable PHPBB3-15266 --- phpBB/phpbb/content_visibility.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index be552c7761..237300894b 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -154,7 +154,7 @@ class content_visibility * @var string mode Either "topic" or "post" * @var int forum_id Forum id of the current item * @var array data Array of item information - * @since 3.1.12-RC1 + * @since 3.2.2-RC1 */ $vars = array( 'is_visible', @@ -238,7 +238,7 @@ class content_visibility $where_sql = ''; $approve_forums = array_keys($this->auth->acl_getf('m_approve', true)); - if ($forum_ids && $approve_forums) + if (!empty($forum_ids) && !empty($approve_forums)) { $approve_forums = array_intersect($forum_ids, $approve_forums); $forum_ids = array_diff($forum_ids, $approve_forums); @@ -311,7 +311,7 @@ class content_visibility * @var array exclude_forum_ids Array of forum ids the current user doesn't have access to * @var string table_alias Table alias to prefix in SQL queries * @var array approve_forums Array of forums where the user has m_approve permissions - * @var string visibility_sql_overwrite If a string, forces the function to return visibility_sql_overwrite after executing the event + * @var string visibility_sql_overwrite If not empty, forces the function to return visibility_sql_overwrite after executing the event * @since 3.1.3-RC1 */ $vars = array( @@ -461,6 +461,7 @@ class content_visibility * @var bool is_latest Are we changing the topic's latest post? * @var array data The data array for this action. * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp */ $vars = array( 'visibility', @@ -646,6 +647,7 @@ class content_visibility * @var bool is_latest Are we changing the topic's latest post? * @var array data The data array for this action. * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp */ $vars = array( 'visibility', @@ -732,6 +734,7 @@ class content_visibility * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. * @var array data The data array for this action. * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp */ $vars = array( 'visibility', @@ -781,6 +784,7 @@ class content_visibility * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. * @var array data The data array for this action. * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp */ $vars = array( 'visibility', -- cgit v1.2.1 From 95671622959d20116d26ce3898069a9afaf4b85d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 27 Dec 2017 13:31:09 +0100 Subject: [ticket/15322] Adjust language variables as suggested PHPBB3-15322 --- phpBB/language/en/acp/board.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 1fd827aa98..25d70813f6 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -552,7 +552,7 @@ $lang = array_merge($lang, array( $lang = array_merge($lang, array( 'ACP_EMAIL_SETTINGS_EXPLAIN' => 'This information is used when the board sends emails to your users. Please ensure the email address you specify is valid, any bounced or undeliverable messages will likely be sent to that address. If your host does not provide a native (PHP based) email service you can instead send messages directly using SMTP. This requires the address of an appropriate server (ask your provider if necessary). If the server requires authentication (and only if it does) enter the necessary username, password and authentication method.', - 'ADMIN_EMAIL' => 'Return email address', + 'ADMIN_EMAIL' => 'From email address', 'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the from address on all emails, the technical contact email address. It will always be used as the Sender address in emails.', 'BOARD_EMAIL_FORM' => 'Users send email via board', 'BOARD_EMAIL_FORM_EXPLAIN' => 'Instead of showing the users email address users are able to send emails via the board.', @@ -563,7 +563,7 @@ $lang = array_merge($lang, array( 'CONTACT_EMAIL_NAME' => 'Contact name', 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', 'EMAIL_FORCE_SENDER' => 'Force from email address', - 'EMAIL_FORCE_SENDER_EXPLAIN' => 'Force from email address to return email. This might be needed for a correct return address when sending mails on some hosts.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'This will set the Return-Path to the from email address instead of using the local user and hostname of the server. This setting does not apply when using SMTP.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', 'EMAIL_SIG' => 'Email signature', -- cgit v1.2.1 From 69416b65f3718de4641e74798e70438539c1164b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 27 Dec 2017 20:40:55 +0100 Subject: [ticket/15485] Add missing separation below event title PHPBB3-15485 --- phpBB/docs/events.md | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 2725109355..414cb31d7d 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -695,6 +695,7 @@ forumlist_body_forum_image_before * Purpose: Add content before the forum image on the forum list. forumlist_body_forum_image_prepend +=== * Locations: + styles/prosilver/template/forumlist_body.html * Since: 3.2.2-RC1 -- cgit v1.2.1 From c906335ce42abc6b43c1d77616c2328e8e94d356 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Mon, 13 Nov 2017 13:21:33 +0300 Subject: [ticket/15453] Add core event after language deleted in acp_language.php Add core event after language deleted in acp_language.php PHPBB3-15453 --- phpBB/includes/acp/acp_language.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 4baff921b6..d81154b4ff 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -32,7 +32,7 @@ class acp_language function main($id, $mode) { global $config, $db, $user, $template, $phpbb_log, $phpbb_container; - global $phpbb_root_path, $phpEx, $request; + global $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher; if (!function_exists('validate_language_iso_name')) { @@ -229,7 +229,20 @@ class acp_language $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_DELETED', false, array($row['lang_english_name'])); - trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); + $delete_message = sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']); + $lang_iso = $row['lang_iso']; + /** + * Run code after language deleted + * + * @event core.acp_language_after_delete + * @var string lang_iso Language ISO code + * @var string delete_message Delete message appear to user + * @since 3.2.2-RC1 + */ + $vars = array('lang_iso', 'delete_message'); + extract($phpbb_dispatcher->trigger_event('core.acp_language_after_delete', compact($vars))); + + trigger_error($delete_message . adm_back_link($this->u_action)); } else { -- cgit v1.2.1 From cf1e6e5e6bd4c4ff21b992c8c97718828e59be50 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Wed, 8 Nov 2017 16:47:57 +0300 Subject: [ticket/15445] Update URIs in README.md Update Coding and Git Guidelines URIs in README.md PHPBB3-15445 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63ccfedf1b..b6c886d687 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ To be able to run an installation from the repo (and not from a pre-built packag 1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register) 2. [Create a ticket (unless there already is one)](http://tracker.phpbb.com/secure/CreateIssue!default.jspa) -3. Read our [Coding guidelines](https://wiki.phpbb.com/Coding_guidelines) and [Git Contribution Guidelines](http://wiki.phpbb.com/Git) +3. Read our [Coding guidelines](https://area51.phpbb.com/docs/dev/development/coding_guidelines.html) and [Git Contribution Guidelines](https://area51.phpbb.com/docs/dev/development/git.html) 4. Send us a pull request ## VAGRANT -- cgit v1.2.1 From b6ac183a32c54947b05aed23e514d6fe00f3fdd4 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 09:09:21 +0100 Subject: [ticket/15454] Add post template data to event PHPBB3-15454 --- phpBB/includes/mcp/mcp_queue.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 58f2049449..d489649649 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -334,6 +334,7 @@ class mcp_queue * @var int topic_id Topic ID * @var array topic_info Topic data * @var array post_info Post data + * @var array post_data Post template data * @var string message Post message * @var string post_url Post URL * @var string topic_url Topic URL @@ -344,6 +345,7 @@ class mcp_queue 'topic_id', 'topic_info', 'post_info', + 'post_data', 'message', 'post_url', 'topic_url', -- cgit v1.2.1 From e90e3ec3687b8397a8a6b2feb6f33bb1850c60be Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 13:52:51 +0100 Subject: [ticket/15179] Update dependencies for 3.2.x PHPBB3-15179 --- phpBB/composer.lock | 205 ++++++++++++++++++++++++++-------------------------- 1 file changed, 103 insertions(+), 102 deletions(-) diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 59143a1fa7..f6602ad082 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -726,16 +726,16 @@ }, { "name": "symfony/config", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "1dbeaa8e2db4b29159265867efff075ad961558c" + "reference": "f4f3f1d7090c464434bbbc3e8aa2b41149c59196" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/1dbeaa8e2db4b29159265867efff075ad961558c", - "reference": "1dbeaa8e2db4b29159265867efff075ad961558c", + "url": "https://api.github.com/repos/symfony/config/zipball/f4f3f1d7090c464434bbbc3e8aa2b41149c59196", + "reference": "f4f3f1d7090c464434bbbc3e8aa2b41149c59196", "shasum": "" }, "require": { @@ -778,20 +778,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-10-04 18:56:36" + "time": "2017-11-07 11:56:23" }, { "name": "symfony/console", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853" + "reference": "46270f1ca44f08ebc134ce120fd2c2baf5fd63de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f81549d2c5fdee8d711c9ab3c7e7362353ea5853", - "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853", + "url": "https://api.github.com/repos/symfony/console/zipball/46270f1ca44f08ebc134ce120fd2c2baf5fd63de", + "reference": "46270f1ca44f08ebc134ce120fd2c2baf5fd63de", "shasum": "" }, "require": { @@ -839,20 +839,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-29 09:33:18" }, { "name": "symfony/debug", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e" + "reference": "e72a0340dc2e273b3c4398d8eef9157ba51d8b95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eaaec993ca5e8067e204b2ee653cdd142961f33e", - "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e", + "url": "https://api.github.com/repos/symfony/debug/zipball/e72a0340dc2e273b3c4398d8eef9157ba51d8b95", + "reference": "e72a0340dc2e273b3c4398d8eef9157ba51d8b95", "shasum": "" }, "require": { @@ -896,20 +896,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-19 19:05:05" }, { "name": "symfony/dependency-injection", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "2562562610dbdabbb98c6ceb60459a351811c734" + "reference": "d3e81e5402c38500770eb5595d78a6d85ea9e412" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2562562610dbdabbb98c6ceb60459a351811c734", - "reference": "2562562610dbdabbb98c6ceb60459a351811c734", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d3e81e5402c38500770eb5595d78a6d85ea9e412", + "reference": "d3e81e5402c38500770eb5595d78a6d85ea9e412", "shasum": "" }, "require": { @@ -959,20 +959,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-10-02 07:17:52" + "time": "2017-11-23 11:13:33" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186" + "reference": "b59aacf238fadda50d612c9de73b74751872a903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fe089232554357efb8d4af65ce209fc6e5a2186", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b59aacf238fadda50d612c9de73b74751872a903", + "reference": "b59aacf238fadda50d612c9de73b74751872a903", "shasum": "" }, "require": { @@ -1019,20 +1019,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-05 15:25:56" }, { "name": "symfony/filesystem", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5e3af878f144089faddd4060a48cadae4fc44dee" + "reference": "15ceb6736a9eebd0d99f9e05a62296ab6ce1cf2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5e3af878f144089faddd4060a48cadae4fc44dee", - "reference": "5e3af878f144089faddd4060a48cadae4fc44dee", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/15ceb6736a9eebd0d99f9e05a62296ab6ce1cf2b", + "reference": "15ceb6736a9eebd0d99f9e05a62296ab6ce1cf2b", "shasum": "" }, "require": { @@ -1068,20 +1068,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-10-02 08:46:46" + "time": "2017-11-19 18:39:05" }, { "name": "symfony/finder", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "a945724b201f74d543e356f6059c930bb8d10c92" + "reference": "efeceae6a05a9b2fcb3391333f1d4a828ff44ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a945724b201f74d543e356f6059c930bb8d10c92", - "reference": "a945724b201f74d543e356f6059c930bb8d10c92", + "url": "https://api.github.com/repos/symfony/finder/zipball/efeceae6a05a9b2fcb3391333f1d4a828ff44ab8", + "reference": "efeceae6a05a9b2fcb3391333f1d4a828ff44ab8", "shasum": "" }, "require": { @@ -1117,20 +1117,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-05 15:25:56" }, { "name": "symfony/http-foundation", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "e6e0170e134bf25d03030b71a19ca409e036157a" + "reference": "8eb1d3609a13ec6fdde68b1a5b908d6cefdbef54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e6e0170e134bf25d03030b71a19ca409e036157a", - "reference": "e6e0170e134bf25d03030b71a19ca409e036157a", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8eb1d3609a13ec6fdde68b1a5b908d6cefdbef54", + "reference": "8eb1d3609a13ec6fdde68b1a5b908d6cefdbef54", "shasum": "" }, "require": { @@ -1172,20 +1172,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-10-05 23:06:47" + "time": "2017-11-29 09:33:18" }, { "name": "symfony/http-kernel", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "d912b76d7db324f7650da9d1132be78c5f7ceb93" + "reference": "aedc53f4473ec9b66e901ac8611c33560357afcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d912b76d7db324f7650da9d1132be78c5f7ceb93", - "reference": "d912b76d7db324f7650da9d1132be78c5f7ceb93", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/aedc53f4473ec9b66e901ac8611c33560357afcd", + "reference": "aedc53f4473ec9b66e901ac8611c33560357afcd", "shasum": "" }, "require": { @@ -1193,7 +1193,7 @@ "psr/log": "~1.0", "symfony/debug": "^2.6.2", "symfony/event-dispatcher": "^2.6.7|~3.0.0", - "symfony/http-foundation": "~2.7.20|~2.8.13|~3.1.6" + "symfony/http-foundation": "~2.7.36|~2.8.29|~3.1.6" }, "conflict": { "symfony/config": "<2.7", @@ -1255,7 +1255,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-10-05 23:24:02" + "time": "2017-12-04 22:02:14" }, { "name": "symfony/polyfill-mbstring", @@ -1432,16 +1432,16 @@ }, { "name": "symfony/proxy-manager-bridge", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "2513b97c244414c45d2c64e2f421b718daacebaa" + "reference": "06d007e6329675e96b42ab84780655ac3ed778ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/2513b97c244414c45d2c64e2f421b718daacebaa", - "reference": "2513b97c244414c45d2c64e2f421b718daacebaa", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/06d007e6329675e96b42ab84780655ac3ed778ae", + "reference": "06d007e6329675e96b42ab84780655ac3ed778ae", "shasum": "" }, "require": { @@ -1482,20 +1482,20 @@ ], "description": "Symfony ProxyManager Bridge", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-10 18:59:36" }, { "name": "symfony/routing", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "74808bc927c173935edc31e331d742698b055d0a" + "reference": "fa8f982682a3b65d87858be7dbf84f7f03feb616" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/74808bc927c173935edc31e331d742698b055d0a", - "reference": "74808bc927c173935edc31e331d742698b055d0a", + "url": "https://api.github.com/repos/symfony/routing/zipball/fa8f982682a3b65d87858be7dbf84f7f03feb616", + "reference": "fa8f982682a3b65d87858be7dbf84f7f03feb616", "shasum": "" }, "require": { @@ -1557,20 +1557,20 @@ "uri", "url" ], - "time": "2017-10-01 21:00:16" + "time": "2017-11-19 19:05:05" }, { "name": "symfony/twig-bridge", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "624cfc984d47ac5d3a940ba53bd14c4550c8a9e4" + "reference": "611c7994abf119adec844fdbc28721c3e3629d4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/624cfc984d47ac5d3a940ba53bd14c4550c8a9e4", - "reference": "624cfc984d47ac5d3a940ba53bd14c4550c8a9e4", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/611c7994abf119adec844fdbc28721c3e3629d4e", + "reference": "611c7994abf119adec844fdbc28721c3e3629d4e", "shasum": "" }, "require": { @@ -1586,6 +1586,7 @@ "symfony/expression-language": "~2.4|~3.0.0", "symfony/finder": "~2.3|~3.0.0", "symfony/form": "^2.8.23", + "symfony/http-foundation": "^2.8.29|~3.0.0", "symfony/http-kernel": "~2.8|~3.0.0", "symfony/polyfill-intl-icu": "~1.0", "symfony/routing": "~2.2|~3.0.0", @@ -1641,20 +1642,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-12-04 19:58:03" }, { "name": "symfony/yaml", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e" + "reference": "968ef42161e4bc04200119da473077f9e7015128" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/842fb6df22180244b4c65935ce1a88d324e5ff9e", - "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/968ef42161e4bc04200119da473077f9e7015128", + "reference": "968ef42161e4bc04200119da473077f9e7015128", "shasum": "" }, "require": { @@ -1690,7 +1691,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-10-05 14:38:30" + "time": "2017-11-29 09:33:18" }, { "name": "twig/twig", @@ -2302,16 +2303,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -2323,7 +2324,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -2361,7 +2362,7 @@ "spy", "stub" ], - "time": "2017-09-04 11:05:03" + "time": "2017-11-24 13:59:53" }, { "name": "phpunit/dbunit", @@ -2486,16 +2487,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -2529,7 +2530,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2017-11-27 13:52:08" }, { "name": "phpunit/php-text-template", @@ -2623,16 +2624,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -2668,7 +2669,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-12-04 08:55:13" }, { "name": "phpunit/phpunit", @@ -3353,16 +3354,16 @@ }, { "name": "symfony/browser-kit", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "87a03da13c5110e6638e874803437dcd5c76d472" + "reference": "f4801cce803ba76f8545190e455958f45935cd5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/87a03da13c5110e6638e874803437dcd5c76d472", - "reference": "87a03da13c5110e6638e874803437dcd5c76d472", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/f4801cce803ba76f8545190e455958f45935cd5d", + "reference": "f4801cce803ba76f8545190e455958f45935cd5d", "shasum": "" }, "require": { @@ -3406,20 +3407,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-07 14:08:47" }, { "name": "symfony/css-selector", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "ef01ca1352deb0c029cf496a89a6b175659c1ec3" + "reference": "b7b041487197fb6d803b7edbcaae7f00a793b1c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/ef01ca1352deb0c029cf496a89a6b175659c1ec3", - "reference": "ef01ca1352deb0c029cf496a89a6b175659c1ec3", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/b7b041487197fb6d803b7edbcaae7f00a793b1c4", + "reference": "b7b041487197fb6d803b7edbcaae7f00a793b1c4", "shasum": "" }, "require": { @@ -3459,20 +3460,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-05 15:25:56" }, { "name": "symfony/dom-crawler", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "6433e25f338ff174dc9429283354faf06df05f67" + "reference": "eeb78092b5cc95b9e37017887da0e39f1530b8a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6433e25f338ff174dc9429283354faf06df05f67", - "reference": "6433e25f338ff174dc9429283354faf06df05f67", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/eeb78092b5cc95b9e37017887da0e39f1530b8a8", + "reference": "eeb78092b5cc95b9e37017887da0e39f1530b8a8", "shasum": "" }, "require": { @@ -3515,20 +3516,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-05 15:25:56" }, { "name": "symfony/process", - "version": "v2.8.28", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176" + "reference": "d25449e031f600807949aab7cadbf267712f4eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/26c9fb02bf06bd6b90f661a5bd17e510810d0176", - "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176", + "url": "https://api.github.com/repos/symfony/process/zipball/d25449e031f600807949aab7cadbf267712f4eee", + "reference": "d25449e031f600807949aab7cadbf267712f4eee", "shasum": "" }, "require": { @@ -3564,7 +3565,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-10-01 21:00:16" + "time": "2017-11-05 15:25:56" } ], "aliases": [], -- cgit v1.2.1 From ca4a3f4698dfbe42f2aad4a7f4e738f13e1e4251 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 14:58:01 +0100 Subject: [prep-release-3.2.2] Update version to 3.2.2-RC1 --- build/build.xml | 2 +- phpBB/includes/constants.php | 2 +- phpBB/install/phpbbcli.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/build.xml b/build/build.xml index 42f242b59d..3ec17be78e 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,7 +2,7 @@ - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 07f9f27555..d4c14224f5 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.2.2-dev'); +@define('PHPBB_VERSION', '3.2.2-RC1'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php index afc70f3302..17b8444aa5 100755 --- a/phpBB/install/phpbbcli.php +++ b/phpBB/install/phpbbcli.php @@ -23,7 +23,7 @@ if (php_sapi_name() !== 'cli') define('IN_PHPBB', true); define('IN_INSTALL', true); define('PHPBB_ENVIRONMENT', 'production'); -define('PHPBB_VERSION', '3.2.1-RC1'); +define('PHPBB_VERSION', '3.2.2-RC1'); $phpbb_root_path = __DIR__ . '/../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 9d1236f340..de362ca475 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -279,7 +279,7 @@ 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 ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.2-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.2-RC1'); 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'); -- cgit v1.2.1 From adad3aac66d2e21f659f8ded67a0964c5a2c3a32 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 14:59:00 +0100 Subject: [prep-release-3.2.2] Update version to 3.2.2 --- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/styles/prosilver/style.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index aff9eef55b..a453e5f7ff 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -38,7 +38,7 @@ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.2.1', + 'phpbb_version' => '3.2.2', 'author' => 'phpBB Limited', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index ea4e899109..00d07fee6c 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = prosilver copyright = © phpBB Limited, 2007 -style_version = 3.2.1 -phpbb_version = 3.2.1 +style_version = 3.2.2 +phpbb_version = 3.2.2 # Defining a different template bitfield # template_bitfield = //g= -- cgit v1.2.1 From bd52c64e68f4fa5ae1a6292c61b272b6a04d2e7f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 15:02:37 +0100 Subject: [prep-release-3.2.2] Add migration for 3.2.2-RC1 --- phpBB/phpbb/db/migration/data/v32x/v321.php | 1 + phpBB/phpbb/db/migration/data/v32x/v322rc1.php | 40 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/v322rc1.php diff --git a/phpBB/phpbb/db/migration/data/v32x/v321.php b/phpBB/phpbb/db/migration/data/v32x/v321.php index 268f978b4b..fdbb5cff19 100644 --- a/phpBB/phpbb/db/migration/data/v32x/v321.php +++ b/phpBB/phpbb/db/migration/data/v32x/v321.php @@ -23,6 +23,7 @@ class v321 extends \phpbb\db\migration\migration static public function depends_on() { return array( + '\phpbb\db\migration\data\v31x\v3111', '\phpbb\db\migration\data\v32x\v321rc1', ); diff --git a/phpBB/phpbb/db/migration/data/v32x/v322rc1.php b/phpBB/phpbb/db/migration/data/v32x/v322rc1.php new file mode 100644 index 0000000000..51e9f5fcaa --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v322rc1.php @@ -0,0 +1,40 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v322rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.2-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\fix_user_styles', + '\phpbb\db\migration\data\v32x\update_prosilver_bitfield', + '\phpbb\db\migration\data\v32x\email_force_sender', + '\phpbb\db\migration\data\v32x\f_list_topics_permission_add', + '\phpbb\db\migration\data\v32x\merge_duplicate_bbcodes', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.2-RC1')), + ); + } +} -- cgit v1.2.1 From 39b142077478876b4c2ef270c081681070f264d7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 15:10:03 +0100 Subject: [prep-release-3.2.2] Update changelog for 3.2.2-RC1 --- phpBB/docs/CHANGELOG.html | 132 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 266a65a9c0..aa982ddeca 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -50,6 +50,7 @@
  1. Changelog
      +
    • Changes since 3.2.1
    • Changes since 3.2.0
    • Changes since 3.2.0-RC1
    • Changes since 3.2.0-b2
    • @@ -126,6 +127,137 @@
      +

      Changes since 3.2.1

      +

      Bug

      +
        +
      • [PHPBB3-7845] - Error on posting local image when script path is empty
      • +
      • [PHPBB3-13214] - Contact us page textarea looks narrow in responsive mode
      • +
      • [PHPBB3-14629] - acp global quick reply will not enable quick reply correctly
      • +
      • [PHPBB3-14857] - ordinal suffix in dateformat is not handled in translations
      • +
      • [PHPBB3-15041] - Cannot delete Orphaned Attachments when large number of attachments
      • +
      • [PHPBB3-15060] - Online user list fails on notifications
      • +
      • [PHPBB3-15089] - Enable/Disable settings backwards for Cookie Secure
      • +
      • [PHPBB3-15133] - Fast image size library sometimes returns no size or invalid sizes
      • +
      • [PHPBB3-15149] - Unexpected Ctrl+Enter behavior on reply
      • +
      • [PHPBB3-15171] - Confusing bitfield values
      • +
      • [PHPBB3-15172] - $request->server('server_port') is returning wrong port
      • +
      • [PHPBB3-15174] - Unable to purge cache (ext & acp)
      • +
      • [PHPBB3-15195] - Code direction in print view is not defined as "ltr"
      • +
      • [PHPBB3-15201] - Removing style sets user_style to 0
      • +
      • [PHPBB3-15224] - Advanced search in "message text only" crashes with SQL error when using Mysql fulltext search index
      • +
      • [PHPBB3-15245] - Relative URLs in atom feeds broken when accessing via app.php
      • +
      • [PHPBB3-15262] - WebFontConfig google families script issue in 3.2.1
      • +
      • [PHPBB3-15266] - Content visibility events do not allow what they describe
      • +
      • [PHPBB3-15273] - 'COOKIE_PATH_EXPLAIN' does not make sense
      • +
      • [PHPBB3-15285] - Travis tests are failing due to trusty changes
      • +
      • [PHPBB3-15292] - Retina imageset is blurry when displayed in Chrome browser
      • +
      • [PHPBB3-15297] - Current date in board index is broken into lines in RTL
      • +
      • [PHPBB3-15298] - Errors being suppressed in cli
      • +
      • [PHPBB3-15303] - Typo in memcached driver
      • +
      • [PHPBB3-15306] - Error and missing information in core.acp_users_profile_validate event
      • +
      • [PHPBB3-15309] - Improved fix for pagination layout in tables
      • +
      • [PHPBB3-15314] - Wrong class constructor definition for convertor component
      • +
      • [PHPBB3-15319] - Database update v310\style_update_p2 fails to drop sequences
      • +
      • [PHPBB3-15320] - Redis cache does not save keys with expiration date 0 (no expiration)
      • +
      • [PHPBB3-15322] - Wrong return Return-Path in emails
      • +
      • [PHPBB3-15331] - Gravatars cannot be overridden
      • +
      • [PHPBB3-15332] - Dark background is always removed after confirm popup
      • +
      • [PHPBB3-15333] - Callback isn't called when confirm dialog is canceled
      • +
      • [PHPBB3-15339] - Missing acp_send_statistics -> Upgrading to 3.2.0 fails for phpBB 3.0.5
      • +
      • [PHPBB3-15346] - The installer tries to enable all extensions even if they are not enableable
      • +
      • [PHPBB3-15347] - Password updater in cron generates invalid postgres SQL
      • +
      • [PHPBB3-15349] - Cli doesn't check if an extension is enableable before enable it
      • +
      • [PHPBB3-15350] - Links to Plural rules are outdated
      • +
      • [PHPBB3-15351] - Confirm box function does not work with symlink on server config
      • +
      • [PHPBB3-15353] - Invalid HTML in ACP board settings
      • +
      • [PHPBB3-15355] - Empty version field in versioncheck when using the latest version
      • +
      • [PHPBB3-15356] - Avatar remote upload doesn't work
      • +
      • [PHPBB3-15361] - Topic / Forum Icons Look Withered (on Safari)
      • +
      • [PHPBB3-15362] - Excessive value for {NOTIFICATION_TYPES_COLS}
      • +
      • [PHPBB3-15365] - Fix invalidating OPcache
      • +
      • [PHPBB3-15367] - Sphinx search backend doesn't escape special characters
      • +
      • [PHPBB3-15368] - Schema upgrade fails in 3.2.1 when using SQL Server
      • +
      • [PHPBB3-15379] - Reparser cron will always run
      • +
      • [PHPBB3-15381] - L_CONTACT_US_ENABLE_EXPLAIN should specify that "Enable board-wide emails" is also needed for it to work
      • +
      • [PHPBB3-15390] - Admin permissions role tooltip popup has vertical bar running through it.
      • +
      • [PHPBB3-15396] - revert_schema() steps not executed in correct order
      • +
      • [PHPBB3-15401] - Use separate constant for memcached driver config
      • +
      • [PHPBB3-15419] - Sphinx does not search UTF keywords in delta index
      • +
      • [PHPBB3-15423] - Wrong title for topic's "Unappproved posts" icon
      • +
      • [PHPBB3-15432] - Don't remove dark background if fadedark is false
      • +
      • [PHPBB3-15433] - phpbbcli can enable non-existent extension
      • +
      • [PHPBB3-15445] - Git Contribution Guidelines in README.md is outdated
      • +
      • [PHPBB3-15464] - Can't reparse [IMG] - in uppercase
      • +
      • [PHPBB3-15475] - Restore Travis PR commit message validation
      • +
      • [PHPBB3-15478] - core.js $loadingIndicator JavaScript errors
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-7488] - View Only - Categories: No Message
      • +
      • [PHPBB3-9819] - Move functions definitions out of mcp.php and includes/mcp/mcp_*.php
      • +
      • [PHPBB3-12291] - Allow extensions to use custom topic icons
      • +
      • [PHPBB3-12939] - Drop support for IE <11 on January 2016
      • +
      • [PHPBB3-14677] - Extension update check is not very colorblind / colourblind friendly.
      • +
      • [PHPBB3-14820] - Style Version Missing
      • +
      • [PHPBB3-14919] - Inconsistent use of globals vs class elements in acp_extensions
      • +
      • [PHPBB3-14927] - event core.user_add_modify_data
      • +
      • [PHPBB3-14944] - Add possibility to search for template loop indexes by key
      • +
      • [PHPBB3-14950] - Add possibility to delete a template block with alter_block_array
      • +
      • [PHPBB3-14979] - Remove underline from unread icon
      • +
      • [PHPBB3-14994] - Refactor template->assign_block_var to be consistent with alter_block_array
      • +
      • [PHPBB3-14995] - Add ACP template events acp_ext_list_*_name_after
      • +
      • [PHPBB3-15111] - Fix the typo in ucp_pm_view_messsage
      • +
      • [PHPBB3-15134] - Avatar upload driver should use filesystem service
      • +
      • [PHPBB3-15247] - Add driver for APCu v5.x cache
      • +
      • [PHPBB3-15267] - Hide birthday block if the user cannot view profile
      • +
      • [PHPBB3-15291] - Allow short array notation in event declarations
      • +
      • [PHPBB3-15293] - Prevent skipping file changes in automatic updater
      • +
      • [PHPBB3-15307] - Allow extensions to add custom modes to acp_users module
      • +
      • [PHPBB3-15328] - Disable email/jabber checkbox if notification method isn't supported
      • +
      • [PHPBB3-15340] - Update to plupload 2.3.1, stable for one year
      • +
      • [PHPBB3-15352] - Add text to clarify forum descriptions won't display on categories
      • +
      • [PHPBB3-15374] - Add core event to modify page title in viewforum.php
      • +
      • [PHPBB3-15384] - Add linebreaks to SMTP configuration option explanations
      • +
      • [PHPBB3-15385] - nginx sample config: www redirection, security regex
      • +
      • [PHPBB3-15387] - prosilver: vertical bars on forum rows on index page not full height
      • +
      • [PHPBB3-15389] - Simplify migration between event names
      • +
      • [PHPBB3-15391] - Remove not needed image rendering from topic/forum images
      • +
      • [PHPBB3-15394] - Add $user_cache and $post_edit_list to core.viewtopic_modify_post_row
      • +
      • [PHPBB3-15408] - Reject duplicate BBCodes in ACP
      • +
      • [PHPBB3-15409] - Add u_action to core.acp_users_overview_run_quicktool
      • +
      • [PHPBB3-15442] - Allow unsafe HTML in bbcode.html
      • +
      • [PHPBB3-15444] - Merge duplicate BBCodes via a migration
      • +
      • [PHPBB3-15446] - Add event core.acp_profile_action
      • +
      • [PHPBB3-15447] - Add event core.acp_profile_modify_profile_row
      • +
      • [PHPBB3-15451] - [EVENT] - mcp_topic_postrow_attachments_before/after
      • +
      • [PHPBB3-15452] - [EVENT] - mcp_topic_postrow_post_before
      • +
      • [PHPBB3-15453] - Add event in acp_language after delete language
      • +
      • [PHPBB3-15454] - event - mcp_queue_approve_details_template
      • +
      • [PHPBB3-15470] - attachment boxes need there own font-size
      • +
      • [PHPBB3-15471] - Add core events to ACP when pruning a forum
      • +
      • [PHPBB3-15476] - Add core event before search rows are edited
      • +
      • [PHPBB3-15485] - Add template event to forumlist_body > forum images
      • +
      • [PHPBB3-15486] - Add core event to the function user_add() to modify notifications data
      • +
      +

      New Feature

      + +

      Sub-task

      +
        +
      • [PHPBB3-13150] - [Event] - core.phpbb_log_get_topic_auth_sql_after
      • +
      • [PHPBB3-15468] - Add a service to merge duplicate BBCodes
      • +
      +

      Task

      +
        +
      • [PHPBB3-15179] - Update 3.2.x dependencies and fix Twig > 1.25 compatibility
      • +
      • [PHPBB3-15304] - Update s9e/text-formatter dependency
      • +
      • [PHPBB3-15455] - Margin discrepancy due to <!-- INCLUDE jumpbox.html -->
      • +
      • [PHPBB3-15457] - Update s9e/text-formatter dependency
      • +
      +

      Changes since 3.2.0

      Bug

        -- cgit v1.2.1 From 0ff5f9fa0edf9ac3125cc4e871609a90cee1cfac Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Dec 2017 22:03:10 +0100 Subject: [3.2.x] Update version number to 3.2.3-dev --- build/build.xml | 6 +++--- phpBB/includes/constants.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/build.xml b/build/build.xml index 3ec17be78e..e748aabdb7 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - - - + + + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index d4c14224f5..7eeb36595d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.2.2-RC1'); +@define('PHPBB_VERSION', '3.2.3-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index de362ca475..1f92439c70 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -279,7 +279,7 @@ 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 ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.2-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.3-dev'); 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'); -- cgit v1.2.1 From ea01890407d2e5a43fcf6107141dc85104a72441 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Sun, 31 Dec 2017 13:35:33 +0300 Subject: [ticket/15491] Fix out dated linkes in Installer support page Fix out dated linkes in Installer support page PHPBB3-15491 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f7d9f58d43..dd28c1b706 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -49,7 +49,7 @@ $lang = array_merge($lang, array( // Support page 'SUPPORT_TITLE' => 'Support', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

        • installation
        • configuration
        • technical questions
        • problems relating to potential bugs in the software
        • updating from Release Candidate (RC) versions to the latest stable version
        • converting from phpBB 2.0.x to phpBB3
        • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

        We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

        Extensions / Styles

        For issues relating to Extensions, please post in the appropriate Extensions Forum.
        For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

        If your question relates to a specific package, please post directly in the topic dedicated to the package.

        Obtaining Support

        The phpBB Welcome Package
        Support Section
        Quick Start Guide

        To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

        ', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

        • installation
        • configuration
        • technical questions
        • problems relating to potential bugs in the software
        • updating from Release Candidate (RC) versions to the latest stable version
        • converting from phpBB 2.0.x to phpBB3
        • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

        We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

        Extensions / Styles

        For issues relating to Extensions, please post in the appropriate Extensions Forum.
        For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

        If your question relates to a specific package, please post directly in the topic dedicated to the package.

        Obtaining Support

        Support Section
        Quick Start Guide

        To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

        ', // License 'LICENSE_TITLE' => 'General Public License', -- cgit v1.2.1 From 4fe09b98b0157309fc7e3da9109e30970575249a Mon Sep 17 00:00:00 2001 From: Derky Date: Sun, 31 Dec 2017 15:55:10 +0100 Subject: [ticket/15489] Remove NO_FORUMS message for categories with subforums PHPBB3-15489 --- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 994d75f244..c3547b3e16 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -250,7 +250,7 @@ {L_NO_TOPICS}

      - +
      {L_NO_FORUMS} -- cgit v1.2.1 From 949f07e8ba81f6d711b7f7fa6024a19da71dc249 Mon Sep 17 00:00:00 2001 From: abyssmedia <30393121+abyssmedia@users.noreply.github.com> Date: Mon, 24 Jul 2017 00:04:43 +0400 Subject: [ticket/15303] Correctly refer to $memcached and not $memcache PHPBB3-15303 --- phpBB/phpbb/cache/driver/memcached.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/cache/driver/memcached.php b/phpBB/phpbb/cache/driver/memcached.php index a7da22d7e8..808e15afe8 100644 --- a/phpBB/phpbb/cache/driver/memcached.php +++ b/phpBB/phpbb/cache/driver/memcached.php @@ -68,7 +68,7 @@ class memcached extends \phpbb\cache\driver\memory foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u) { preg_match('#(.*)/(\d+)#', $u, $parts); - $this->memcache->addServer(trim($parts[1]), (int) trim($parts[2])); + $this->memcached->addServer(trim($parts[1]), (int) trim($parts[2])); } } -- cgit v1.2.1 From a2daf30415b7e67439f3d41bd843a133b400b03f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 16:31:04 +0100 Subject: [prep-release-3.1.12] Update version numbers to 3.1.12 --- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/styles/prosilver/style.cfg | 4 ++-- phpBB/styles/subsilver2/style.cfg | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 4aca80188a..027627aacf 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -38,7 +38,7 @@ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.1.11', + 'phpbb_version' => '3.1.12', 'author' => 'phpBB Limited', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 019db11bc7..763c668ee3 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = prosilver copyright = © phpBB Limited, 2007 -style_version = 3.1.11 -phpbb_version = 3.1.11 +style_version = 3.1.12 +phpbb_version = 3.1.12 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 65d846402d..9a65efa87c 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Limited -style_version = 3.1.11 -phpbb_version = 3.1.11 +style_version = 3.1.12 +phpbb_version = 3.1.12 # Defining a different template bitfield # template_bitfield = lNg= -- cgit v1.2.1 From 92350db572f3814630f5bb6e609d503ffd2c4bd5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 16:36:16 +0100 Subject: [prep-release-3.1.12] Update version numbers to 3.1.12 --- build/build.xml | 2 +- phpBB/includes/constants.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/build.xml b/build/build.xml index 462983b83d..14af4b24ed 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,7 +2,7 @@ - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 0c1a0b03ba..7eae5f5be3 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.1.12-dev'); +define('PHPBB_VERSION', '3.1.12'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index cb0b06eb46..1928eca89a 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -273,7 +273,7 @@ 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 ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.12-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.12'); 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'); -- cgit v1.2.1 From 5def7e255ec46175b74a31523f89309136e78869 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 16:39:02 +0100 Subject: [prep-release-3.1.12] Add migration for 3.1.12 --- phpBB/phpbb/db/migration/data/v31x/v3112.php | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v31x/v3112.php diff --git a/phpBB/phpbb/db/migration/data/v31x/v3112.php b/phpBB/phpbb/db/migration/data/v31x/v3112.php new file mode 100644 index 0000000000..0d75d35184 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v3112.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v3112 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.12', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3111', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.12')), + ); + } +} -- cgit v1.2.1 From 0c3f7c6c8e352a73dacc1ff21a2b39a556ea6deb Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 16:41:47 +0100 Subject: [prep-release-3.1.12] Update changelog for 3.1.12 --- phpBB/docs/CHANGELOG.html | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a149e3d6c5..6914aa5060 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -50,6 +50,7 @@
      1. Changelog
          +
        • Changes since 3.1.11
        • Changes since 3.1.10
        • Changes since 3.1.9
        • Changes since 3.1.8
        • @@ -120,6 +121,49 @@
          +

          Changes since 3.1.11

          + +

          Bug

          +
            +
          • [PHPBB3-9533] - phpbb_own_realpath() doesn't always replicate realpath() behaviour
          • +
          • [PHPBB3-12835] - Jump-box dropdown menu doesn't expand with according to line length in IE8
          • +
          • [PHPBB3-13360] - rename_too_long_indexes migration never deleted the old unique index
          • +
          • [PHPBB3-13464] - problem with drop down options and Arabic letters in chrome
          • +
          • [PHPBB3-13574] - Last post not showing in "Active topics" when Prosilver goes responsive
          • +
          • [PHPBB3-15174] - Unable to purge cache (ext & acp)
          • +
          • [PHPBB3-15285] - Travis tests are failing due to trusty changes
          • +
          • [PHPBB3-15303] - Typo in memcached driver
          • +
          • [PHPBB3-15347] - Password updater in cron generates invalid postgres SQL
          • +
          • [PHPBB3-15367] - Sphinx search backend doesn't escape special characters
          • +
          +

          Improvement

          +
            +
          • [PHPBB3-10122] - [list=] - should support "none", along with CSS2 types
          • +
          • [PHPBB3-11063] - Change version check to SSL
          • +
          • [PHPBB3-14820] - Style Version Missing
          • +
          • [PHPBB3-14919] - Inconsistent use of globals vs class elements in acp_extensions
          • +
          • [PHPBB3-14927] - event core.user_add_modify_data
          • +
          • [PHPBB3-14944] - Add possibility to search for template loop indexes by key
          • +
          • [PHPBB3-14995] - Add ACP template events acp_ext_list_*_name_after
          • +
          +

          New Feature

          + +

          Sub-task

          +
            +
          • [PHPBB3-11182] - Ensure that template files use L_COLON instead of colons.
          • +
          • [PHPBB3-11676] - generate_text_for_storage on includes/acp/acp_users.php
          • +
          +

          Task

          +
            +
          • [PHPBB3-10758] - Improve Functional Test Code Coverage
          • +
          • [PHPBB3-10791] - Add a section for extensions to readme.html
          • +
          • [PHPBB3-10792] - Add a section for 3.0 to 3.1 upgrades to install.html
          • +
          • [PHPBB3-13874] - Add master to sami API docs
          • +
          +

          Changes since 3.1.10

          Bug

          -- cgit v1.2.1 From 8c3808e9e7db09531154b2520cbfcc7529a5c752 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 9 Jan 2017 00:23:08 +0700 Subject: [ticket/14972] Fix sizeof calls As of PHP 7.2, only arrays and objects implementing the Countable interface should be passed as a count() or sizeof() parameter. See https://github.com/php/php-src/blob/php-7.2.0alpha2/UPGRADING#L197-L198 Also, sizeof() seems to be sheduled for deprecation, see https://wiki.php.net/rfc/deprecations_php_7_2#suggested_deprecations PHPBB3-14972 --- phpBB/includes/functions.php | 30 ++++++------- phpBB/includes/functions_admin.php | 92 +++++++++++++++++++------------------- phpBB/includes/functions_user.php | 68 ++++++++++++++-------------- phpBB/phpbb/db/driver/driver.php | 19 ++++---- phpBB/phpbb/session.php | 20 ++++----- 5 files changed, 113 insertions(+), 116 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2cd62d7bac..e9b7d999b5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -602,7 +602,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ if ($mode == 'all') { - if ($forum_id === false || !sizeof($forum_id)) + if (empty($forum_id)) { // Mark all forums read (index page) /* @var $phpbb_notifications \phpbb\notification\manager */ @@ -727,7 +727,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $db->sql_freeresult($result); - if (sizeof($sql_update)) + if (count($sql_update)) { $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . " SET mark_time = $post_time @@ -863,7 +863,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ // We get the ten most minimum stored time offsets and its associated topic ids $time_keys = array(); - for ($i = 0; $i < 10 && sizeof($tracking['t']); $i++) + for ($i = 0; $i < 10 && count($tracking['t']); $i++) { $min_value = min($tracking['t']); $m_tkey = array_search($min_value, $tracking['t']); @@ -959,7 +959,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $ $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $mark_time = array(); @@ -1011,7 +1011,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT forum_id, mark_time FROM ' . FORUMS_TRACK_TABLE . " @@ -1038,7 +1038,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis { global $tracking_topics; - if (!isset($tracking_topics) || !sizeof($tracking_topics)) + if (!isset($tracking_topics) || !count($tracking_topics)) { $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); @@ -1065,7 +1065,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $mark_time = array(); @@ -1407,7 +1407,7 @@ function tracking_unserialize($string, $max_depth = 3) switch ($string[$i]) { case '(': - if (sizeof($stack) >= $max_depth) + if (count($stack) >= $max_depth) { die('Invalid data supplied'); } @@ -1461,7 +1461,7 @@ function tracking_unserialize($string, $max_depth = 3) } } - if (sizeof($stack) != 0 || ($mode != 0 && $mode != 3)) + if (count($stack) != 0 || ($mode != 0 && $mode != 3)) { die('Invalid data supplied'); } @@ -2676,9 +2676,9 @@ function parse_cfg_file($filename, $lines = false) { $value = ''; } - else if (($value[0] == "'" && $value[sizeof($value) - 1] == "'") || ($value[0] == '"' && $value[sizeof($value) - 1] == '"')) + else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"')) { - $value = htmlspecialchars(substr($value, 1, sizeof($value)-2)); + $value = htmlspecialchars(substr($value, 1, strlen($value)-2)); } else { @@ -3007,7 +3007,7 @@ function phpbb_inet_pton($address) if (preg_match(get_preg_expression('ipv6'), $address)) { $parts = explode(':', $address); - $missing_parts = 8 - sizeof($parts) + 1; + $missing_parts = 8 - count($parts) + 1; if (substr($address, 0, 2) === '::') { @@ -3024,7 +3024,7 @@ function phpbb_inet_pton($address) if (preg_match(get_preg_expression('ipv4'), $last_part)) { - $parts[sizeof($parts) - 1] = ''; + $parts[count($parts) - 1] = ''; $last_part = phpbb_inet_pton($last_part); $embedded_ipv4 = true; --$missing_parts; @@ -3036,7 +3036,7 @@ function phpbb_inet_pton($address) { $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); } - else if ($i && $i < sizeof($parts) - 1) + else if ($i && $i < count($parts) - 1) { $ret .= str_repeat('0000', $missing_parts); } @@ -3632,7 +3632,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' // Need caps version of $item for language-strings $item_caps = strtoupper($item); - if (sizeof($online_users['online_users'])) + if (count($online_users['online_users'])) { $sql_ary = array( 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour', diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 96916e1e43..e2cab6d4a9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -167,7 +167,7 @@ function size_select_options($size_compare) $s_size_options = ''; - for ($i = 0, $size = sizeof($size_types_text); $i < $size; $i++) + for ($i = 0, $size = count($size_types_text); $i < $size; $i++) { $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; $s_size_options .= ''; @@ -192,7 +192,7 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = /** @var \phpbb\group\helper $group_helper */ $group_helper = $phpbb_container->get('group_helper'); - $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; + $exclude_sql = ($exclude_ids !== false && count($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; @@ -747,7 +747,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s { $where_ids = (is_array($where_ids)) ? array_unique($where_ids) : array($where_ids); - if (!sizeof($where_ids)) + if (!count($where_ids)) { return array('topics' => 0, 'posts' => 0); } @@ -777,9 +777,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } $db->sql_freeresult($result); - $return['topics'] = sizeof($topic_ids); + $return['topics'] = count($topic_ids); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { return $return; } @@ -837,7 +837,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } $db->sql_freeresult($result); - if (sizeof($moved_topic_ids)) + if (count($moved_topic_ids)) { $sql = 'DELETE FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $moved_topic_ids); @@ -923,7 +923,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $where_ids = array($where_ids); } - if (!sizeof($where_ids)) + if (!count($where_ids)) { return false; } @@ -974,7 +974,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } $db->sql_freeresult($result); - if (!sizeof($post_ids)) + if (!count($post_ids)) { return false; } @@ -1018,7 +1018,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = unset($table_ary); // Adjust users post counts - if (sizeof($post_counts) && $post_count_sync) + if (count($post_counts) && $post_count_sync) { foreach ($post_counts as $poster_id => $substract) { @@ -1037,7 +1037,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Remove topics now having no posts? - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id FROM ' . POSTS_TABLE . ' @@ -1147,7 +1147,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) - if (sizeof($remove_topics) && $call_delete_topics) + if (count($remove_topics) && $call_delete_topics) { delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } @@ -1157,7 +1157,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); - return sizeof($post_ids); + return count($post_ids); } /** @@ -1232,7 +1232,7 @@ function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) $db->sql_query($sql); } } - while (sizeof($topic_ids) == $batch_size); + while (count($topic_ids) == $batch_size); if ($auto_sync) { @@ -1363,7 +1363,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // Do not sync the "global forum" $where_ids = array_diff($where_ids, array(0)); - if (!sizeof($where_ids)) + if (!count($where_ids)) { // Empty array with IDs. This means that we don't have any work to do. Just return. return; @@ -1377,7 +1377,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } else { - if (!sizeof($where_ids)) + if (!count($where_ids)) { return; } @@ -1416,7 +1416,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (!sizeof($topic_id_ary)) + if (!count($topic_id_ary)) { return; } @@ -1533,7 +1533,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $post_ids[] = $post_id; } - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_reported = 1 - post_reported @@ -1579,7 +1579,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 1 - topic_reported @@ -1638,7 +1638,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $post_ids[] = $post_id; } - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 1 - post_attachment @@ -1684,7 +1684,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_attachment = 1 - topic_attachment @@ -1736,7 +1736,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (!sizeof($forum_ids)) + if (!count($forum_ids)) { break; } @@ -1775,7 +1775,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // 3: Get post count for each forum (optional) if ($sync_extra) { - if (sizeof($forum_ids) == 1) + if (count($forum_ids) == 1) { $sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted FROM ' . TOPICS_TABLE . ' t @@ -1795,7 +1795,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, while ($row = $db->sql_fetchrow($result)) { - $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved']; $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; @@ -1805,7 +1805,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // 4: Get last_post_id for each forum - if (sizeof($forum_ids) == 1) + if (count($forum_ids) == 1) { $sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id FROM ' . TOPICS_TABLE . ' t @@ -1825,7 +1825,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, while ($row = $db->sql_fetchrow($result)) { - $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; $forum_data[$forum_id]['last_post_id'] = (int) $row['last_post_id']; @@ -1834,7 +1834,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); // 5: Retrieve last_post infos - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -1902,7 +1902,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -2025,20 +2025,20 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // Now we delete empty topics and orphan posts - if (sizeof($delete_posts)) + if (count($delete_posts)) { delete_posts('topic_id', array_keys($delete_posts), false); unset($delete_posts); } - if (!sizeof($topic_data)) + if (!count($topic_data)) { // If we get there, topic ids were invalid or topics did not contain any posts delete_topics($where_type, $where_ids, true); return; } - if (sizeof($delete_topics)) + if (count($delete_topics)) { $delete_topic_ids = array(); foreach ($delete_topics as $topic_id => $void) @@ -2081,7 +2081,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); // Make sure shadow topics do link to existing topics - if (sizeof($moved_topics)) + if (count($moved_topics)) { $delete_topics = array(); @@ -2098,7 +2098,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($delete_topics)) + if (count($delete_topics)) { delete_topics('topic_id', $delete_topics, false); } @@ -2121,7 +2121,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); $sync_shadow_topics = array(); - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -2174,7 +2174,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $shadow_topic_data = array(); // Update the information we collected - if (sizeof($sync_shadow_topics)) + if (count($sync_shadow_topics)) { foreach ($sync_shadow_topics as $sync_topic_id => $sql_ary) { @@ -2239,7 +2239,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -2256,7 +2256,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // if some topics have been resync'ed then resync parent forums // except when we're only syncing a range, we don't want to sync forums during // batch processing. - if ($resync_parents && sizeof($resync_forums) && $where_type != 'range') + if ($resync_parents && count($resync_forums) && $where_type != 'range') { sync('forum', 'forum_id', array_values($resync_forums), true, true); } @@ -2278,7 +2278,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $forum_id = array($forum_id); } - if (!sizeof($forum_id)) + if (!count($forum_id)) { return; } @@ -2451,7 +2451,7 @@ function phpbb_cache_moderators($db, $cache, $auth) $hold_ary = $auth->acl_user_raw_data(false, 'm_%', false); // Add users? - if (sizeof($hold_ary)) + if (!empty($hold_ary)) { // At least one moderative option warrants a display $ug_id_ary = array_keys($hold_ary); @@ -2496,7 +2496,7 @@ function phpbb_cache_moderators($db, $cache, $auth) } $db->sql_freeresult($result); - if (sizeof($hold_ary)) + if (count($hold_ary)) { // Get usernames... $sql = 'SELECT user_id, username @@ -2536,7 +2536,7 @@ function phpbb_cache_moderators($db, $cache, $auth) // Now to the groups... $hold_ary = $auth->acl_group_raw_data(false, 'm_%', false); - if (sizeof($hold_ary)) + if (!empty($hold_ary)) { $ug_id_ary = array_keys($hold_ary); @@ -2640,7 +2640,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) { // update foes for some user - if (is_array($user_id) && sizeof($user_id)) + if (is_array($user_id) && count($user_id)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', $user_id) . ' @@ -2650,7 +2650,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } // update foes for some group - if (is_array($group_id) && sizeof($group_id)) + if (is_array($group_id) && count($group_id)) { // Grab group settings... $sql_ary = array( @@ -2684,7 +2684,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } $db->sql_freeresult($result); - if (!sizeof($groups)) + if (!count($groups)) { return; } @@ -2714,7 +2714,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } $db->sql_freeresult($result); - if (sizeof($users)) + if (count($users)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', $users) . ' @@ -2737,7 +2737,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } } - if (sizeof($perms)) + if (count($perms)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', array_unique($perms)) . ' @@ -3000,7 +3000,7 @@ function tidy_warnings() } $db->sql_freeresult($result); - if (sizeof($warning_list)) + if (count($warning_list)) { $db->sql_transaction('begin'); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 175cdeeda8..245d263720 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -170,7 +170,7 @@ function user_update_name($old_name, $new_name) * Adds an user * * @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. -* @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array +* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array * @param array $notifications_data The notifications settings for the new user * @return the new user's ID. */ @@ -260,7 +260,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) $remaining_vars = array_diff(array_keys($user_row), array_keys($sql_ary)); // Now fill our sql array with the remaining vars - if (sizeof($remaining_vars)) + if (count($remaining_vars)) { foreach ($remaining_vars as $key) { @@ -289,7 +289,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) $user_id = $db->sql_nextid(); // Insert Custom Profile Fields - if ($cp_data !== false && sizeof($cp_data)) + if ($cp_data !== false && count($cp_data)) { $cp_data['user_id'] = (int) $user_id; @@ -481,7 +481,7 @@ function user_delete($mode, $user_ids, $retain_username = true) } $db->sql_freeresult($result); - if (sizeof($report_posts)) + if (count($report_posts)) { $report_posts = array_unique($report_posts); $report_topics = array_unique($report_topics); @@ -501,7 +501,7 @@ function user_delete($mode, $user_ids, $retain_username = true) } $db->sql_freeresult($result); - if (sizeof($keep_report_topics)) + if (count($keep_report_topics)) { $report_topics = array_diff($report_topics, $keep_report_topics); } @@ -513,7 +513,7 @@ function user_delete($mode, $user_ids, $retain_username = true) WHERE ' . $db->sql_in_set('post_id', $report_posts); $db->sql_query($sql); - if (sizeof($report_topics)) + if (count($report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 @@ -780,7 +780,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $user_id_ary = array($user_id_ary); } - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { return; } @@ -838,7 +838,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars))); - if (sizeof($sql_statements)) + if (count($sql_statements)) { foreach ($sql_statements as $user_id => $sql_ary) { @@ -916,7 +916,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas else { $ban_other = explode('-', $ban_len_other); - if (sizeof($ban_other) == 3 && ((int) $ban_other[0] < 9999) && + if (count($ban_other) == 3 && ((int) $ban_other[0] < 9999) && (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) { $ban_end = max($current_time, $user->create_datetime() @@ -984,7 +984,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas } // Make sure we have been given someone to ban - if (!sizeof($sql_usernames)) + if (!count($sql_usernames)) { trigger_error('NO_USER_SPECIFIED', E_USER_WARNING); } @@ -995,7 +995,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas // Do not allow banning yourself, the guest account, or founders. $non_bannable = array($user->data['user_id'], ANONYMOUS); - if (sizeof($founder)) + if (count($founder)) { $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), $non_bannable), true); } @@ -1135,14 +1135,14 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas continue; } - if (!sizeof($founder) || !in_array($ban_item, $founder)) + if (!count($founder) || !in_array($ban_item, $founder)) { $banlist_ary[] = $ban_item; } } } - if (sizeof($ban_list) == 0) + if (count($ban_list) == 0) { trigger_error('NO_EMAILS_DEFINED', E_USER_WARNING); } @@ -1189,7 +1189,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); - if (sizeof($banlist_ary_tmp)) + if (count($banlist_ary_tmp)) { // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1203,7 +1203,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas $db->sql_freeresult($result); // We have some entities to ban - if (sizeof($banlist_ary)) + if (count($banlist_ary)) { $sql_ary = array(); @@ -1331,7 +1331,7 @@ function user_unban($mode, $ban) $unban_sql = array_map('intval', $ban); - if (sizeof($unban_sql)) + if (count($unban_sql)) { // Grab details of bans for logging information later switch ($mode) @@ -1595,7 +1595,7 @@ function validate_num($num, $optional = false, $min = 0, $max = 1E99) function validate_date($date_string, $optional = false) { $date = explode('-', $date_string); - if ((empty($date) || sizeof($date) != 3) && $optional) + if ((empty($date) || count($date) != 3) && $optional) { return false; } @@ -1617,7 +1617,7 @@ function validate_date($date_string, $optional = false) } } - if (sizeof($date) != 3 || !checkdate($date[1], $date[0], $date[2])) + if (count($date) != 3 || !checkdate($date[1], $date[0], $date[2])) { return 'INVALID'; } @@ -1957,7 +1957,7 @@ function validate_jabber($jid) $arr = explode('.', $realm); - if (sizeof($arr) == 0) + if (count($arr) == 0) { return 'WRONG_DATA'; } @@ -2281,7 +2281,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $group_teampage = !empty($group_attributes['group_teampage']); unset($group_attributes['group_teampage']); - if (!sizeof($error)) + if (!count($error)) { $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; @@ -2354,7 +2354,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow generate_text_for_storage($sql_ary['group_desc'], $sql_ary['group_desc_uid'], $sql_ary['group_desc_bitfield'], $sql_ary['group_desc_options'], $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies); } - if (sizeof($group_attributes)) + if (count($group_attributes)) { // Merge them with $sql_ary to properly update the group $sql_ary = array_merge($sql_ary, $group_attributes); @@ -2480,7 +2480,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Set user attributes $sql_ary = array(); - if (sizeof($group_attributes)) + if (count($group_attributes)) { // Go through the user attributes array, check if a group attribute matches it and then set it. ;) foreach ($user_attribute_ary as $attribute) @@ -2500,7 +2500,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow } } - if (sizeof($sql_ary) && sizeof($user_ary)) + if (count($sql_ary) && count($user_ary)) { group_set_user_default($group_id, $user_ary, $sql_ary); } @@ -2511,7 +2511,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow group_update_listings($group_id); } - return (sizeof($error)) ? $error : false; + return (count($error)) ? $error : false; } @@ -2676,7 +2676,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USER'; } @@ -2704,7 +2704,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $add_id_ary = array_diff($user_id_ary, $add_id_ary); // If we have no users - if (!sizeof($add_id_ary) && !sizeof($update_id_ary)) + if (!count($add_id_ary) && !count($update_id_ary)) { return 'GROUP_USERS_EXIST'; } @@ -2712,7 +2712,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $db->sql_transaction('begin'); // Insert the new users - if (sizeof($add_id_ary)) + if (count($add_id_ary)) { $sql_ary = array(); @@ -2729,7 +2729,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); } - if (sizeof($update_id_ary)) + if (count($update_id_ary)) { $sql = 'UPDATE ' . USER_GROUP_TABLE . ' SET group_leader = 1 @@ -2821,7 +2821,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USER'; } @@ -2897,7 +2897,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, foreach ($special_group_data as $gid => $default_data_ary) { - if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid])) + if (isset($sql_where_ary[$gid]) && count($sql_where_ary[$gid])) { remove_default_rank($group_id, $sql_where_ary[$gid]); remove_default_avatar($group_id, $sql_where_ary[$gid]); @@ -3056,7 +3056,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USERS'; } @@ -3111,7 +3111,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna } $db->sql_freeresult($result); - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { return false; } @@ -3152,7 +3152,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna $db->sql_freeresult($result); $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (!count($user_id_ary) || $result !== false) { return 'NO_USERS'; } @@ -3515,7 +3515,7 @@ function group_update_listings($group_id) $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); - if (!sizeof($hold_ary)) + if (empty($hold_ary)) { return; } diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 214c5590e7..5851469806 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -537,7 +537,9 @@ abstract class driver implements driver_interface */ function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) { - if (!sizeof($array)) + $array = (array) $array; + + if (!count($array)) { if (!$allow_empty_set) { @@ -559,12 +561,7 @@ abstract class driver implements driver_interface } } - if (!is_array($array)) - { - $array = array($array); - } - - if (sizeof($array) == 1) + if (count($array) == 1) { @reset($array); $var = current($array); @@ -632,7 +629,7 @@ abstract class driver implements driver_interface */ function sql_multi_insert($table, $sql_ary) { - if (!sizeof($sql_ary)) + if (!count($sql_ary)) { return false; } @@ -738,7 +735,7 @@ abstract class driver implements driver_interface // We run the following code to determine if we need to re-order the table array. ;) // The reason for this is that for multi-aliased tables (two equal tables) in the FROM statement the last table need to match the first comparison. // DBMS who rely on this: Oracle, PostgreSQL and MSSQL. For all other DBMS it makes absolutely no difference in which order the table is. - if (!empty($array['LEFT_JOIN']) && sizeof($array['FROM']) > 1 && $used_multi_alias !== false) + if (!empty($array['LEFT_JOIN']) && count($array['FROM']) > 1 && $used_multi_alias !== false) { // Take first LEFT JOIN $join = current($array['LEFT_JOIN']); @@ -848,7 +845,7 @@ abstract class driver implements driver_interface default: - switch (sizeof($condition)) + switch (count($condition)) { case 3: @@ -1138,7 +1135,7 @@ abstract class driver implements driver_interface $html_table = func_get_arg(2); $row = func_get_arg(3); - if (!$html_table && sizeof($row)) + if (!$html_table && count($row)) { $html_table = true; $this->html_hold .= ''; diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 6b5b8f2625..de9345ca85 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -108,7 +108,7 @@ class session $root_dirs = array_diff_assoc($root_dirs, $intersection); $page_dirs = array_diff_assoc($page_dirs, $intersection); - $page_dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + $page_dir = str_repeat('../', count($root_dirs)) . implode('/', $page_dirs); if ($page_dir && substr($page_dir, -1, 1) == '/') { @@ -127,8 +127,8 @@ class session // The script path from the webroot to the phpBB root (for example: /phpBB3/) $script_dirs = explode('/', $script_path); - array_splice($script_dirs, -sizeof($page_dirs)); - $root_script_path = implode('/', $script_dirs) . (sizeof($root_dirs) ? '/' . implode('/', $root_dirs) : ''); + array_splice($script_dirs, -count($page_dirs)); + $root_script_path = implode('/', $script_dirs) . (count($root_dirs) ? '/' . implode('/', $root_dirs) : ''); // We are on the base level (phpBB root == webroot), lets adjust the variables a bit... if (!$root_script_path) @@ -584,12 +584,12 @@ class session $provider = $provider_collection->get_provider(); $this->data = $provider->autologin(); - if ($user_id !== false && sizeof($this->data) && $this->data['user_id'] != $user_id) + if ($user_id !== false && isset($this->data['user_id']) && $this->data['user_id'] != $user_id) { $this->data = array(); } - if (sizeof($this->data)) + if (isset($this->data['user_id'])) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $this->data['user_id']; @@ -597,7 +597,7 @@ class session // If we're presented with an autologin key we'll join against it. // Else if we've been passed a user_id we'll grab data based on that - if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && !sizeof($this->data)) + if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && empty($this->data)) { $sql = 'SELECT u.* FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k @@ -617,7 +617,7 @@ class session $db->sql_freeresult($result); } - if ($user_id !== false && !sizeof($this->data)) + if ($user_id !== false && empty($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $user_id; @@ -645,7 +645,7 @@ class session // User does not exist // User is inactive // User is bot - if (!sizeof($this->data) || !is_array($this->data)) + if (!is_array($this->data) || !count($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = ($bot) ? $bot : ANONYMOUS; @@ -1022,7 +1022,7 @@ class session } $db->sql_freeresult($result); - if (sizeof($del_user_id)) + if (count($del_user_id)) { // Delete expired sessions $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' @@ -1156,7 +1156,7 @@ class session $where_sql[] = $_sql; } - $sql .= (sizeof($where_sql)) ? implode(' AND ', $where_sql) : ''; + $sql .= (count($where_sql)) ? implode(' AND ', $where_sql) : ''; $result = $db->sql_query($sql, $cache_ttl); $ban_triggered_by = 'user'; -- cgit v1.2.1 From dec06d10fedb43bc948fe438b6f581ac7caa1916 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 7 May 2017 02:10:37 +0700 Subject: [ticket/14972] Fix use of deprecated media attachment constants PHPBB3-14972 --- .../phpbb/db/migration/data/v320/remove_outdated_media.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php index c14d31f1c0..98b1c2d039 100644 --- a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php +++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php @@ -15,10 +15,17 @@ namespace phpbb\db\migration\data\v320; class remove_outdated_media extends \phpbb\db\migration\migration { + // Following constants were deprecated in 3.2 + // and moved from constants.php to compatibility_globals.php, + // thus define them as class constants + const ATTACHMENT_CATEGORY_WM = 2; + const ATTACHMENT_CATEGORY_RM = 3; + const ATTACHMENT_CATEGORY_QUICKTIME = 6; + protected $cat_id = array( - ATTACHMENT_CATEGORY_WM, - ATTACHMENT_CATEGORY_RM, - ATTACHMENT_CATEGORY_QUICKTIME, + self::ATTACHMENT_CATEGORY_WM, + self::ATTACHMENT_CATEGORY_RM, + self::ATTACHMENT_CATEGORY_QUICKTIME, ); static public function depends_on() -- cgit v1.2.1 From e1376e14ded58c3f4135253d7329db0676e49c87 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 21 Mar 2017 22:31:18 +0700 Subject: [ticket/14972] Fix create_insert_array() declaration in admin_activate_user PHPBB3-14972 --- phpBB/phpbb/notification/type/admin_activate_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 9f2ae857ef..78c10ac36a 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -175,7 +175,7 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public function create_insert_array($user, $pre_create_data) + public function create_insert_array($user, $pre_create_data = array()) { $this->set_data('user_actkey', $user['user_actkey']); $this->notification_time = $user['user_regdate']; -- cgit v1.2.1 From 6e6195c303c23e66419ffed9fbc3b19856614afc Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 7 May 2017 03:26:01 +0700 Subject: [ticket/14972] Avoid using self as constant in tests PHPBB3-14972 --- tests/functional/extension_acp_test.php | 2 +- tests/functional/extension_controller_test.php | 2 +- tests/functional/extension_global_lang_test.php | 2 +- tests/functional/extension_module_test.php | 2 +- tests/functional/extension_permission_lang_test.php | 2 +- tests/functional/metadata_manager_test.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 8a71a5ce04..e980c5a04b 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -26,7 +26,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/../extension/ext/', self::$fixtures); } diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 18eb9ad4c6..58c3878b8b 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -34,7 +34,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index f615114c08..a1e2547745 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -30,7 +30,7 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_ { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index 95107665cd..d3a66b9b35 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -29,7 +29,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 92d8d596c7..f570d45215 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -30,7 +30,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index 0d2fdf082e..8456c40f00 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -35,7 +35,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } -- cgit v1.2.1 From 11e09f1b3c943695ff688f7a86fdebff88649cef Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 9 May 2017 02:13:24 +0700 Subject: [ticket/14972] Fix test_collection_with_mask test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In PHP 7.2, the severity of the message “Use of undefined constant” was raised from E_NOTICE to E_WARNING, so calling $array[ITEM] causes warning caught by error collector. Use undefined offset notice to get an empty message as such. PHPBB3-14972 --- tests/error_collector_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index 273284c8fc..8ed89bbe52 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -52,8 +52,8 @@ class phpbb_error_collector_test extends phpbb_test_case 1/0; $line = __LINE__; // Cause a notice - $array = array('ITEM' => 'value'); - $value = $array[ITEM]; $line2 = __LINE__; + $array = array(0 => 'value'); + $value = $array[1]; $line2 = __LINE__; $collector->uninstall(); -- cgit v1.2.1 From ff18802656e72981f6ecb613d756bc19f2462689 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 1 Jan 2018 13:48:36 +0100 Subject: [ticket/14972] Fix template context use of sizeof() PHPBB3-14972 --- phpBB/phpbb/template/context.php | 79 +++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index c1e971c148..de583d3224 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -142,7 +142,7 @@ class context */ protected function set_num_rows(&$loop_data) { - $s_num_rows = sizeof($loop_data); + $s_num_rows = count($loop_data); foreach ($loop_data as &$mod_block) { foreach ($mod_block as $sub_block_name => &$sub_block) @@ -265,7 +265,7 @@ class context { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = $this->tpldata; for ($i = 0; $i <= $blockcount; $i++) @@ -276,17 +276,17 @@ class context if (strpos($blocks[$i], '[]') === $pos) { - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } else { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); } } else { $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } $block = $block[$name]; $block = $block[$index]; @@ -335,39 +335,26 @@ class context { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = $this->tpldata; for ($i = 0; $i < $blockcount; $i++) { - if (($pos = strpos($blocks[$i], '[')) !== false) - { - $name = substr($blocks[$i], 0, $pos); + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; - 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])) + + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block[$name]) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1)); + + if (!isset($block[$name][$index])) { return false; } - $block = $block[$index]; + $block = $block[$name][$index]; } if (!isset($block[$blocks[$i]])) @@ -377,9 +364,9 @@ class context $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) + if (is_bool($key)) { - return ($key === false) ? 0 : sizeof($block) - 1; + return (!$key) ? 0 : count($block) - 1; } // Get correct position if array given @@ -396,7 +383,7 @@ class context } } - return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false; + return (is_int($key) && ((0 <= $key) && ($key < count($block)))) ? $key : false; } /** @@ -433,7 +420,7 @@ class context // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = &$this->tpldata; for ($i = 0; $i < $blockcount; $i++) @@ -444,17 +431,17 @@ class context if (strpos($blocks[$i], '[]') === $pos) { - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } else { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); } } else { $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } $block = &$block[$name]; $block = &$block[$index]; @@ -476,7 +463,7 @@ class context // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { - $key = ($key === false) ? 0 : sizeof($block); + $key = ($key === false) ? 0 : count($block); } // Get correct position if array given @@ -506,9 +493,9 @@ class context if ($mode == 'insert') { // Make sure we are not exceeding the last iteration - if ($key >= sizeof($block)) + if ($key >= count($block)) { - $key = sizeof($block); + $key = count($block); unset($block[($key - 1)]['S_LAST_ROW']); $vararray['S_LAST_ROW'] = true; } @@ -523,7 +510,7 @@ class context $vararray['S_BLOCK_NAME'] = $name; // Re-position template blocks - for ($i = sizeof($block); $i > $key; $i--) + for ($i = count($block); $i > $key; $i--) { $block[$i] = $block[$i-1]; @@ -541,12 +528,12 @@ class context if ($mode == 'change') { // If key is out of bounds, do not change anything - if ($key > sizeof($block) || $key < 0) + if ($key > count($block) || $key < 0) { return false; } - if ($key == sizeof($block)) + if ($key == count($block)) { $key--; } @@ -560,26 +547,26 @@ class context if ($mode == 'delete') { // If we are exceeding last iteration, do not delete anything - if ($key > sizeof($block) || $key < 0) + if ($key > count($block) || $key < 0) { return false; } // If we are positioned at the end, we remove the last element - if ($key == sizeof($block)) + if ($key == count($block)) { $key--; } // We are deleting the last element in the block, so remove the block - if (sizeof($block) === 1) + if (count($block) === 1) { $block = null; // unset($block); does not work on references return true; } // Re-position template blocks - for ($i = $key; $i < sizeof($block)-1; $i++) + for ($i = $key; $i < count($block)-1; $i++) { $block[$i] = $block[$i+1]; $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; @@ -590,7 +577,7 @@ class context // Set first and last elements again, in case they were removed $block[0]['S_FIRST_ROW'] = true; - $block[sizeof($block)-1]['S_LAST_ROW'] = true; + $block[count($block)-1]['S_LAST_ROW'] = true; return true; } @@ -611,13 +598,13 @@ class context { // Nested block. $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $str = &$this->tpldata; for ($i = 0; $i < $blockcount; $i++) { $str = &$str[$blocks[$i]]; - $str = &$str[sizeof($str) - 1]; + $str = &$str[count($str) - 1]; } unset($str[$blocks[$blockcount]]); -- cgit v1.2.1 From f8fbe3793680af1dae2db2829cfc84068831c52f Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [ticket/14972] replace all occurrences of sizeof() with the count() PHPBB3-14972 --- build/build_helper.php | 4 +- build/package.php | 16 ++--- phpBB/develop/add_permissions.php | 4 +- phpBB/develop/check_flash_bbcodes.php | 2 +- phpBB/develop/create_variable_overview.php | 4 +- phpBB/develop/search_fill.php | 2 +- phpBB/docs/coding-guidelines.html | 8 +-- phpBB/includes/acp/acp_attachments.php | 56 +++++++-------- phpBB/includes/acp/acp_bbcodes.php | 2 +- phpBB/includes/acp/acp_board.php | 6 +- phpBB/includes/acp/acp_bots.php | 14 ++-- phpBB/includes/acp/acp_database.php | 12 ++-- phpBB/includes/acp/acp_email.php | 14 ++-- phpBB/includes/acp/acp_forums.php | 50 ++++++------- phpBB/includes/acp/acp_groups.php | 10 +-- phpBB/includes/acp/acp_help_phpbb.php | 2 +- phpBB/includes/acp/acp_icons.php | 16 ++--- phpBB/includes/acp/acp_inactive.php | 2 +- phpBB/includes/acp/acp_language.php | 2 +- phpBB/includes/acp/acp_logs.php | 4 +- phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/acp/acp_modules.php | 8 +-- phpBB/includes/acp/acp_permission_roles.php | 4 +- phpBB/includes/acp/acp_permissions.php | 78 ++++++++++---------- phpBB/includes/acp/acp_profile.php | 28 ++++---- phpBB/includes/acp/acp_prune.php | 18 ++--- phpBB/includes/acp/acp_reasons.php | 6 +- phpBB/includes/acp/acp_search.php | 10 +-- phpBB/includes/acp/acp_users.php | 44 ++++++------ phpBB/includes/acp/auth.php | 36 +++++----- phpBB/includes/bbcode.php | 6 +- phpBB/includes/diff/diff.php | 80 ++++++++++----------- phpBB/includes/diff/engine.php | 10 +-- phpBB/includes/diff/renderer.php | 24 +++---- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_compress.php | 6 +- phpBB/includes/functions_content.php | 20 +++--- phpBB/includes/functions_convert.php | 50 ++++++------- phpBB/includes/functions_display.php | 10 +-- phpBB/includes/functions_download.php | 2 +- phpBB/includes/functions_jabber.php | 16 ++--- phpBB/includes/functions_mcp.php | 12 ++-- phpBB/includes/functions_messenger.php | 34 ++++----- phpBB/includes/functions_module.php | 6 +- phpBB/includes/functions_posting.php | 46 ++++++------ phpBB/includes/functions_privmsgs.php | 66 ++++++++--------- phpBB/includes/functions_transfer.php | 2 +- phpBB/includes/mcp/mcp_ban.php | 2 +- phpBB/includes/mcp/mcp_forum.php | 20 +++--- phpBB/includes/mcp/mcp_logs.php | 4 +- phpBB/includes/mcp/mcp_main.php | 82 +++++++++++----------- phpBB/includes/mcp/mcp_pm_reports.php | 10 +-- phpBB/includes/mcp/mcp_post.php | 10 +-- phpBB/includes/mcp/mcp_queue.php | 38 +++++----- phpBB/includes/mcp/mcp_reports.php | 32 ++++----- phpBB/includes/mcp/mcp_topic.php | 24 +++---- phpBB/includes/message_parser.php | 40 +++++------ phpBB/includes/ucp/ucp_attachments.php | 8 +-- phpBB/includes/ucp/ucp_auth_link.php | 4 +- phpBB/includes/ucp/ucp_groups.php | 18 ++--- phpBB/includes/ucp/ucp_main.php | 12 ++-- phpBB/includes/ucp/ucp_notifications.php | 2 +- phpBB/includes/ucp/ucp_pm_compose.php | 40 +++++------ phpBB/includes/ucp/ucp_pm_options.php | 2 +- phpBB/includes/ucp/ucp_pm_viewfolder.php | 8 +-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 8 +-- phpBB/includes/ucp/ucp_prefs.php | 8 +-- phpBB/includes/ucp/ucp_profile.php | 26 +++---- phpBB/includes/ucp/ucp_register.php | 10 +-- phpBB/includes/ucp/ucp_zebra.php | 26 +++---- phpBB/includes/utf/utf_tools.php | 2 +- phpBB/install/convert/controller/convertor.php | 4 +- phpBB/install/convert/convertor.php | 24 +++---- phpBB/install/convertors/functions_phpbb20.php | 8 +-- phpBB/mcp.php | 4 +- phpBB/memberlist.php | 18 ++--- phpBB/phpbb/attachment/resync.php | 4 +- phpBB/phpbb/attachment/upload.php | 2 +- phpBB/phpbb/auth/auth.php | 10 +-- phpBB/phpbb/auth/provider/ldap.php | 4 +- phpBB/phpbb/auth/provider/oauth/oauth.php | 2 +- phpBB/phpbb/avatar/driver/local.php | 2 +- phpBB/phpbb/avatar/driver/upload.php | 8 +-- phpBB/phpbb/cache/driver/base.php | 6 +- phpBB/phpbb/cache/driver/file.php | 4 +- phpBB/phpbb/cache/driver/memory.php | 2 +- phpBB/phpbb/cache/service.php | 2 +- phpBB/phpbb/captcha/char_cube3d.php | 2 +- phpBB/phpbb/captcha/colour_manager.php | 2 +- phpBB/phpbb/captcha/gd.php | 54 +++++++------- phpBB/phpbb/captcha/plugins/captcha_abstract.php | 2 +- phpBB/phpbb/captcha/plugins/qa.php | 16 ++--- phpBB/phpbb/console/command/thumbnail/delete.php | 2 +- phpBB/phpbb/content_visibility.php | 4 +- phpBB/phpbb/db/driver/mssqlnative.php | 2 +- phpBB/phpbb/db/driver/oracle.php | 6 +- phpBB/phpbb/db/extractor/mssql_extractor.php | 4 +- phpBB/phpbb/db/extractor/oracle_extractor.php | 4 +- .../db/migration/data/v310/style_update_p1.php | 2 +- phpBB/phpbb/db/migration/data/v310/teampage.php | 4 +- phpBB/phpbb/db/migration/tool/config.php | 2 +- phpBB/phpbb/db/migration/tool/config_text.php | 2 +- phpBB/phpbb/db/migration/tool/module.php | 4 +- phpBB/phpbb/db/migration/tool/permission.php | 2 +- phpBB/phpbb/db/migrator.php | 4 +- phpBB/phpbb/db/sql_insert_buffer.php | 4 +- phpBB/phpbb/db/tools/mssql.php | 2 +- phpBB/phpbb/event/md_exporter.php | 6 +- phpBB/phpbb/event/php_exporter.php | 12 ++-- phpBB/phpbb/files/filespec.php | 6 +- phpBB/phpbb/files/types/form.php | 2 +- phpBB/phpbb/files/types/local.php | 2 +- phpBB/phpbb/filesystem/filesystem.php | 8 +-- phpBB/phpbb/install/helper/database.php | 2 +- .../install/helper/iohandler/ajax_iohandler.php | 6 +- .../install/module/install_data/task/add_bots.php | 2 +- .../module/install_data/task/add_modules.php | 2 +- .../install_database/task/add_config_settings.php | 2 +- .../install_database/task/add_default_data.php | 2 +- .../module/install_database/task/add_tables.php | 2 +- .../install_finish/task/install_extensions.php | 2 +- .../update_database/task/update_extensions.php | 2 +- .../module/update_filesystem/task/diff_files.php | 2 +- phpBB/phpbb/language/language.php | 4 +- phpBB/phpbb/language/language_file_loader.php | 2 +- phpBB/phpbb/log/log.php | 12 ++-- phpBB/phpbb/message/form.php | 4 +- phpBB/phpbb/message/message.php | 6 +- phpBB/phpbb/module/module_manager.php | 10 +-- phpBB/phpbb/notification/manager.php | 2 +- phpBB/phpbb/notification/type/pm.php | 2 +- phpBB/phpbb/notification/type/post.php | 10 +-- phpBB/phpbb/notification/type/topic.php | 2 +- phpBB/phpbb/profilefields/manager.php | 10 +-- phpBB/phpbb/profilefields/type/type_bool.php | 2 +- phpBB/phpbb/profilefields/type/type_dropdown.php | 6 +- phpBB/phpbb/report/controller/report.php | 6 +- phpBB/phpbb/search/base.php | 10 +-- phpBB/phpbb/search/fulltext_mysql.php | 22 +++--- phpBB/phpbb/search/fulltext_native.php | 48 ++++++------- phpBB/phpbb/search/fulltext_postgres.php | 14 ++-- phpBB/phpbb/search/fulltext_sphinx.php | 10 +-- phpBB/phpbb/search/sphinx/config.php | 4 +- phpBB/phpbb/search/sphinx/config_section.php | 6 +- phpBB/phpbb/template/twig/extension.php | 2 +- phpBB/phpbb/tree/nestedset.php | 4 +- phpBB/phpbb/user_loader.php | 2 +- phpBB/posting.php | 30 ++++---- phpBB/search.php | 40 +++++------ phpBB/viewforum.php | 24 +++---- phpBB/viewtopic.php | 48 ++++++------- tests/cache/cache_memory_test.php | 2 +- tests/cron/manager_test.php | 2 +- tests/dbal/write_test.php | 2 +- tests/event/md_exporter_test.php | 4 +- tests/functional/fileupload_remote_test.php | 4 +- tests/functions/get_remote_file_test.php | 2 +- tests/mock/sql_insert_buffer.php | 2 +- tests/notification/base.php | 2 +- tests/test_framework/phpbb_database_test_case.php | 2 +- .../phpbb_database_test_connection_manager.php | 2 +- .../test_framework/phpbb_functional_test_case.php | 4 +- tests/test_framework/phpbb_ui_test_case.php | 2 +- tests/upload/fileupload_test.php | 12 ++-- tests/wrapper/version_compare_test.php | 2 +- 165 files changed, 983 insertions(+), 983 deletions(-) diff --git a/build/build_helper.php b/build/build_helper.php index 3ff1b89eab..ff93c22a12 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -39,8 +39,8 @@ class build_package $this->verbose = $verbose; // Get last two entries - $_latest = $this->versions[sizeof($this->versions) - 1]; - $_before = $this->versions[sizeof($this->versions) - 2]; + $_latest = $this->versions[count($this->versions) - 1]; + $_before = $this->versions[count($this->versions) - 2]; $this->locations = array( 'new_version' => dirname(dirname(__FILE__)) . '/phpBB/', diff --git a/build/package.php b/build/package.php index 178a27faad..18798d0602 100755 --- a/build/package.php +++ b/build/package.php @@ -33,7 +33,7 @@ echo "Now all three package types (patch, files, release) are built as well as t // Go trough all versions making a diff if we even have old versions // For phpBB 3.0.x we might choose a different update method, rendering the things below useless... -if (sizeof($package->old_packages)) +if (count($package->old_packages)) { chdir($package->locations['old_versions']); @@ -76,7 +76,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir); foreach ($file as $entry) @@ -169,7 +169,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir . '/install/update/old'); foreach ($file as $entry) @@ -214,7 +214,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir . '/install/update/new'); foreach ($file as $entry) @@ -321,7 +321,7 @@ $update_info = array( \'version\' => array(\'from\' => \'' . str_replace('_to_', '', $package->old_packages[$_package_name]) . '\', \'to\' => \'' . $package->get('new_version_number') . '\'), '; - if (sizeof($file_contents['all'])) + if (count($file_contents['all'])) { $index_contents .= "\t'files' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['all']) . "',\n\t),\n"; } @@ -330,7 +330,7 @@ $update_info = array( $index_contents .= "\t'files' => array(),\n"; } - if (sizeof($file_contents['binary'])) + if (count($file_contents['binary'])) { $index_contents .= "\t'binary' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['binary']) . "',\n\t),\n"; } @@ -339,7 +339,7 @@ $update_info = array( $index_contents .= "\t'binary' => array(),\n"; } - if (sizeof($file_contents['deleted'])) + if (count($file_contents['deleted'])) { $index_contents .= "\t'deleted' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['deleted']) . "',\n\t),\n"; } @@ -380,7 +380,7 @@ $compress_programs = array( 'zip' => 'zip -r' ); -if (sizeof($package->old_packages)) +if (count($package->old_packages)) { // Build Patch Files chdir($package->get('patch_directory')); diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index c575729d91..d7308a1acc 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -185,7 +185,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -if (sizeof($remove_auth_options)) +if (count($remove_auth_options)) { $db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')'); $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')'); @@ -199,7 +199,7 @@ $prefixes = array('f_', 'a_', 'm_', 'u_'); foreach ($prefixes as $prefix) { $var = $prefix . 'permissions'; - if (sizeof(${$var})) + if (count(${$var})) { foreach (${$var} as $auth_option => $l_ary) { diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php index 5dc112bfc0..282adad229 100644 --- a/phpBB/develop/check_flash_bbcodes.php +++ b/phpBB/develop/check_flash_bbcodes.php @@ -51,7 +51,7 @@ function check_table_flash_bbcodes($table_name, $id_field, $content_field, $uid_ $ids = get_table_flash_bbcode_pkids($table_name, $id_field, $content_field, $uid_field, $bitfield_field); - $size = sizeof($ids); + $size = count($ids); if ($size) { echo "Found $size potentially dangerous flash bbcodes.\n"; diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index ace2e4d953..da9a4fe683 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -489,12 +489,12 @@ foreach ($lang_references as $lang_var => $filenames) $html_data .= '' . $lang_var . '
            '; - if (sizeof($filenames) != 1) + if (count($filenames) != 1) { fwrite($common_fp, (($entry['common']) ? ",\n" : '') . "\t'$var' => '" . $lang[$var] . "'"); $entry['common'] = true; } - else if (sizeof($filenames) == 1) + else if (count($filenames) == 1) { // Merge logical - hardcoded $fname = (preg_match('#^(' . implode('|', $merge) . ')#', $filenames[0], $match)) ? $match[0] . '.php' : str_replace($ext, 'php', $filenames[0]); diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 07c4024b2f..4f684b5b27 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -89,7 +89,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize) $rowset = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - $post_rows = sizeof($rowset); + $post_rows = count($rowset); if( $post_rows ) { diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index d90f4d4d32..569ffe680c 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -627,7 +627,7 @@ $min = ($i < $j) ? $i : $j;
            if (isset($forum) && $forum == 5)
            -

            The empty() function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && sizeof($array) > 0 - this can be written in a shorter way as !empty($array).

            +

            The empty() function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && count($array) > 0 - this can be written in a shorter way as !empty($array).

            Switch statements:

            Switch/case code blocks can get a bit long sometimes. To have some level of notice and being in-line with the opening/closing brace requirement (where they are on the same line for better readability), this also applies to switch/case code blocks and the breaks. An example:

            @@ -994,9 +994,9 @@ $sql = $db->sql_build_query('SELECT', $sql_array);

            Operations in loop definition:

            Always try to optimize your loops if operations are going on at the comparing part, since this part is executed every time the loop is parsed through. For assignments a descriptive name should be chosen. Example:

            -

            // On every iteration the sizeof function is called

            +

            // On every iteration the count function is called

            -for ($i = 0; $i < sizeof($post_data); $i++)
            +for ($i = 0; $i < count($post_data); $i++)
             {
             	do_something();
             }
            @@ -1004,7 +1004,7 @@ for ($i = 0; $i < sizeof($post_data); $i++)

            // You are able to assign the (not changing) result within the loop itself

            -for ($i = 0, $size = sizeof($post_data); $i < $size; $i++)
            +for ($i = 0, $size = count($post_data); $i < $size; $i++)
             {
             	do_something();
             }
            diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 2480f1f025..dc4eb66cf8 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -190,7 +190,7 @@ class acp_attachments validate_config_vars($display_vars['vars'], $cfg_array, $error); // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -226,7 +226,7 @@ class acp_attachments // Check Settings $this->test_upload($error, $this->new_config['upload_path'], false); - if (!sizeof($error)) + if (!count($error)) { trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } @@ -256,14 +256,14 @@ class acp_attachments $supported_types = get_supported_image_types(); // Check Thumbnail Support - if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) + if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !count($supported_types['format']))) { $this->new_config['img_create_thumbnail'] = 0; } $template->assign_vars(array( 'U_SEARCH_IMAGICK' => $this->u_action . '&action=imgmagick', - 'S_THUMBNAIL_SUPPORT' => (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) ? false : true) + 'S_THUMBNAIL_SUPPORT' => (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !count($supported_types['format']))) ? false : true) ); // Secure Download Options - Same procedure as with banning @@ -290,7 +290,7 @@ class acp_attachments $template->assign_vars(array( 'S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], 'S_DEFINED_IPS' => ($defined_ips != '') ? true : false, - 'S_WARNING' => (sizeof($error)) ? true : false, + 'S_WARNING' => (count($error)) ? true : false, 'WARNING_MSG' => implode('
            ', $error), 'DEFINED_IPS' => $defined_ips, @@ -363,7 +363,7 @@ class acp_attachments // Generate correct Change List $extensions = array(); - for ($i = 0, $size = sizeof($extension_change_list); $i < $size; $i++) + for ($i = 0, $size = count($extension_change_list); $i < $size; $i++) { $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i]; } @@ -390,7 +390,7 @@ class acp_attachments // Delete Extension? $extension_id_list = $request->variable('extension_id_list', array(0)); - if (sizeof($extension_id_list)) + if (count($extension_id_list)) { $sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' @@ -420,7 +420,7 @@ class acp_attachments if ($add_extension && $add) { - if (!sizeof($error)) + if (!count($error)) { $sql = 'SELECT extension_id FROM ' . EXTENSIONS_TABLE . " @@ -433,7 +433,7 @@ class acp_attachments } $db->sql_freeresult($result); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'group_id' => $add_extension_group, @@ -447,7 +447,7 @@ class acp_attachments } } - if (!sizeof($error)) + if (!count($error)) { $notify[] = $user->lang['EXTENSIONS_UPDATED']; } @@ -558,7 +558,7 @@ class acp_attachments $db->sql_freeresult($result); } - if (!sizeof($error)) + if (!count($error)) { // Ok, build the update/insert array $upload_icon = $request->variable('upload_icon', 'no_image'); @@ -575,7 +575,7 @@ class acp_attachments $max_filesize = 0; } - if (!sizeof($allowed_forums)) + if (!count($allowed_forums)) { $forum_select = false; } @@ -612,7 +612,7 @@ class acp_attachments $extension_list = $request->variable('extensions', array(0)); - if ($action == 'edit' && sizeof($extension_list)) + if ($action == 'edit' && count($extension_list)) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = 0 @@ -620,7 +620,7 @@ class acp_attachments $db->sql_query($sql); } - if (sizeof($extension_list)) + if (count($extension_list)) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = $group_id @@ -630,7 +630,7 @@ class acp_attachments $cache->destroy('_extensions'); - if (!sizeof($error)) + if (!count($error)) { $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; } @@ -806,7 +806,7 @@ class acp_attachments 'S_FILENAME_LIST' => $filename_list, 'S_EDIT_GROUP' => true, 'S_NO_IMAGE' => $no_image_select, - 'S_FORUM_IDS' => (sizeof($forum_ids)) ? true : false, + 'S_FORUM_IDS' => (count($forum_ids)) ? true : false, 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=extensions"), 'U_BACK' => $this->u_action, @@ -931,7 +931,7 @@ class acp_attachments $add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); $post_ids = $request->variable('post_id', array('' => 0)); - if (sizeof($delete_files)) + if (count($delete_files)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' @@ -954,7 +954,7 @@ class acp_attachments $db->sql_freeresult($result); } - if (sizeof($delete_files)) + if (count($delete_files)) { $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); @@ -974,7 +974,7 @@ class acp_attachments } unset($add_files); - if (sizeof($upload_list)) + if (count($upload_list)) { $template->assign_var('S_UPLOADING_FILES', true); @@ -1127,7 +1127,7 @@ class acp_attachments { $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); - if (sizeof($delete_files)) + if (count($delete_files)) { // Select those attachments we want to delete... $sql = 'SELECT real_filename @@ -1143,7 +1143,7 @@ class acp_attachments if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) { - if (sizeof($delete_files) != $num_deleted) + if (count($delete_files) != $num_deleted) { $error[] = $user->lang['FILES_GONE']; } @@ -1264,7 +1264,7 @@ class acp_attachments // Grab extensions $extensions = $cache->obtain_attach_extensions(true); - for ($i = 0, $end = sizeof($attachments_list); $i < $end; ++$i) + for ($i = 0, $end = count($attachments_list); $i < $end; ++$i) { $row = $attachments_list[$i]; @@ -1299,7 +1299,7 @@ class acp_attachments break; } - if (sizeof($error)) + if (count($error)) { $template->assign_vars(array( 'S_WARNING' => true, @@ -1307,7 +1307,7 @@ class acp_attachments ); } - if (sizeof($notify)) + if (count($notify)) { $template->assign_vars(array( 'S_NOTIFY' => true, @@ -1476,7 +1476,7 @@ class acp_attachments $row['group_name'] = $user->lang['NOT_ASSIGNED']; $group_name[] = $row; - for ($i = 0, $groups_size = sizeof($group_name); $i < $groups_size; $i++) + for ($i = 0, $groups_size = count($group_name); $i < $groups_size; $i++) { if ($default_group === false) { @@ -1709,7 +1709,7 @@ class acp_attachments } $db->sql_freeresult($result); - if (sizeof($iplist)) + if (count($iplist)) { foreach ($iplist as $ip_entry) { @@ -1719,7 +1719,7 @@ class acp_attachments } } - if (sizeof($hostlist)) + if (count($hostlist)) { foreach ($hostlist as $host_entry) { @@ -1742,7 +1742,7 @@ class acp_attachments { $unip_sql = $request->variable('unip', array(0)); - if (sizeof($unip_sql)) + if (count($unip_sql)) { $l_unip_list = ''; diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 18d574081a..7153a8ec70 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -494,7 +494,7 @@ class acp_bbcodes // Pad backreference numbers from tokens if (preg_match_all('/(?lang['FORM_INVALID']; } // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -683,7 +683,7 @@ class acp_board 'L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'ERROR_MSG' => implode('
            ', $error), 'U_ACTION' => $this->u_action) @@ -1103,7 +1103,7 @@ class acp_board $db->sql_query($sql); // Already emptied for all... - if (sizeof($values)) + if (count($values)) { // Set for selected forums $sql = 'UPDATE ' . FORUMS_TABLE . ' diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index e89b16663c..8bd357bc91 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -55,7 +55,7 @@ class acp_bots switch ($action) { case 'activate': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; @@ -69,7 +69,7 @@ class acp_bots break; case 'deactivate': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; @@ -83,7 +83,7 @@ class acp_bots break; case 'delete': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { if (confirm_box(true)) { @@ -109,7 +109,7 @@ class acp_bots WHERE bot_id $sql_id"; $db->sql_query($sql); - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { $_tables = array(USERS_TABLE, USER_GROUP_TABLE); foreach ($_tables as $table) @@ -207,7 +207,7 @@ class acp_bots $error[] = $user->lang['BOT_NAME_TAKEN']; } - if (!sizeof($error)) + if (!count($error)) { // New bot? Create a new user and group entry if ($action == 'add') @@ -338,7 +338,7 @@ class acp_bots 'L_TITLE' => $user->lang['BOT_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$bot_id&action=$action", 'U_BACK' => $this->u_action, - 'ERROR_MSG' => (sizeof($error)) ? implode('
            ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
            ', $error) : '', 'BOT_NAME' => $bot_row['bot_name'], 'BOT_IP' => $bot_row['bot_ip'], @@ -348,7 +348,7 @@ class acp_bots 'S_ACTIVE_OPTIONS' => $s_active_options, 'S_STYLE_OPTIONS' => $style_select, 'S_LANG_OPTIONS' => $lang_select, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, ) ); diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 00c7ef40c0..b98756a34b 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -59,7 +59,7 @@ class acp_database $format = $request->variable('method', ''); $where = $request->variable('where', ''); - if (!sizeof($table)) + if (!count($table)) { trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -495,7 +495,7 @@ function sanitize_data_mssql($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = 'char(' . ord(array_shift($matches[0])) . ')'; } @@ -519,7 +519,7 @@ function sanitize_data_oracle($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = 'chr(' . ord(array_shift($matches[0])) . ')'; } @@ -541,7 +541,7 @@ function sanitize_data_generic($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = "'" . array_shift($matches[0]) . "'"; } @@ -583,7 +583,7 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) static $array = array(); static $record = ''; - if (!sizeof($array)) + if (!count($array)) { while (!$eof($fp)) { @@ -605,7 +605,7 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) } } - if (sizeof($array)) + if (count($array)) { return array_shift($array); } diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 57eefad02d..5a1fbac9f6 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -68,7 +68,7 @@ class acp_email $error[] = $user->lang['NO_EMAIL_MESSAGE']; } - if (!sizeof($error)) + if (!count($error)) { if (!empty($usernames)) { @@ -168,7 +168,7 @@ class acp_email { $i = 0; - if (sizeof($email_list)) + if (count($email_list)) { $j++; } @@ -235,16 +235,16 @@ class acp_email ); extract($phpbb_dispatcher->trigger_event('core.acp_email_send_before', compact($vars))); - for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) + for ($i = 0, $size = count($email_list); $i < $size; $i++) { $used_lang = $email_list[$i][0]['lang']; $used_method = $email_list[$i][0]['method']; - for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) + for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++) { $email_row = $email_list[$i][$j]; - $messenger->{((sizeof($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']); + $messenger->{((count($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']); $messenger->im($email_row['jabber'], $email_row['name']); } @@ -322,8 +322,8 @@ class acp_email $s_priority_options .= ''; $template_data = array( - 'S_WARNING' => (sizeof($error)) ? true : false, - 'WARNING_MSG' => (sizeof($error)) ? implode('
            ', $error) : '', + 'S_WARNING' => (count($error)) ? true : false, + 'WARNING_MSG' => (count($error)) ? implode('
            ', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => implode("\n", $usernames), diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 66bb630241..cf01ff2489 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -90,7 +90,7 @@ class acp_forums $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); - if (sizeof($errors)) + if (count($errors)) { break; } @@ -198,7 +198,7 @@ class acp_forums $errors = $this->update_forum_data($forum_data); - if (!sizeof($errors)) + if (!count($errors)) { $forum_perm_from = $request->variable('forum_perm_from', 0); $cache->destroy('sql', FORUMS_TABLE); @@ -622,7 +622,7 @@ class acp_forums $template_data = array( 'S_EDIT_FORUM' => true, - 'S_ERROR' => (sizeof($errors)) ? true : false, + 'S_ERROR' => (count($errors)) ? true : false, 'S_PARENT_ID' => $this->parent_id, 'S_FORUM_PARENT_ID' => $forum_data['parent_id'], 'S_ADD_ACTION' => ($action == 'add') ? true : false, @@ -632,7 +632,7 @@ class acp_forums 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], 'L_TITLE' => $user->lang[$this->page_title], - 'ERROR_MSG' => (sizeof($errors)) ? implode('
            ', $errors) : '', + 'ERROR_MSG' => (count($errors)) ? implode('
            ', $errors) : '', 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DATA_LINK' => $forum_data['forum_link'], @@ -772,8 +772,8 @@ class acp_forums 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, 'S_FORUMS_LIST' => $forums_list, - 'S_ERROR' => (sizeof($errors)) ? true : false, - 'ERROR_MSG' => (sizeof($errors)) ? implode('
            ', $errors) : '') + 'S_ERROR' => (count($errors)) ? true : false, + 'ERROR_MSG' => (count($errors)) ? implode('
            ', $errors) : '') ); return; @@ -924,7 +924,7 @@ class acp_forums unset($rowset); $template->assign_vars(array( - 'ERROR_MSG' => (sizeof($errors)) ? implode('
            ', $errors) : '', + 'ERROR_MSG' => (count($errors)) ? implode('
            ', $errors) : '', 'NAVIGATION' => $navigation, 'FORUM_BOX' => $forum_box, 'U_SEL_ACTION' => $this->u_action, @@ -1053,7 +1053,7 @@ class acp_forums // What are we going to do tonight Brain? The same thing we do everynight, // try to take over the world ... or decide whether to continue update // and if so, whether it's a new forum/cat/link or an existing one - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1217,12 +1217,12 @@ class acp_forums $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id'])); } - if (sizeof($errors)) + if (count($errors)) { return $errors; } - if (sizeof($forum_ids)) + if (count($forum_ids)) { $sql = 'DELETE FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); @@ -1252,7 +1252,7 @@ class acp_forums $allowed_forums = array_diff($allowed_forums, $forum_ids); $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " - SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$_row['group_id']}"; $db->sql_query($sql); } @@ -1321,7 +1321,7 @@ class acp_forums $forum_data_sql['forum_last_poster_colour'] = ''; } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1338,7 +1338,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1433,10 +1433,10 @@ class acp_forums $moved_forums = get_forum_branch($from_id, 'children', 'descending'); $from_data = $moved_forums[0]; - $diff = sizeof($moved_forums) * 2; + $diff = count($moved_forums) * 2; $moved_ids = array(); - for ($i = 0, $size = sizeof($moved_forums); $i < $size; ++$i) + for ($i = 0, $size = count($moved_forums); $i < $size; ++$i) { $moved_ids[] = $moved_forums[$i]['forum_id']; } @@ -1612,7 +1612,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1628,12 +1628,12 @@ class acp_forums $errors = array_merge($errors, $this->delete_forum_content($row['forum_id'])); } - if (sizeof($errors)) + if (count($errors)) { return $errors; } - $diff = sizeof($forum_ids) * 2; + $diff = count($forum_ids) * 2; $sql = 'DELETE FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); @@ -1706,7 +1706,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1754,7 +1754,7 @@ class acp_forums $allowed_forums = array_diff($allowed_forums, $forum_ids); $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " - SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$row['group_id']}"; $db->sql_query($sql); } @@ -1927,9 +1927,9 @@ class acp_forums } $db->sql_freeresult($result); - if (sizeof($ids)) + if (count($ids)) { - $start += sizeof($ids); + $start += count($ids); foreach ($tables as $table) { @@ -1937,7 +1937,7 @@ class acp_forums } } } - while (sizeof($ids) == $batch_size); + while (count($ids) == $batch_size); } unset($ids); @@ -1978,7 +1978,7 @@ class acp_forums } // Adjust users post counts - if (sizeof($post_counts)) + if (count($post_counts)) { foreach ($post_counts as $poster_id => $substract) { @@ -2062,7 +2062,7 @@ class acp_forums } $db->sql_freeresult($result); - if (!sizeof($target)) + if (!count($target)) { // The forum is already on top or bottom return false; diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 305296d013..70ae9876f4 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -187,7 +187,7 @@ class acp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); - $start = (sizeof($mark_ary) < 200) ? 0 : $start + 200; + $start = (count($mark_ary) < 200) ? 0 : $start + 200; } else { @@ -486,7 +486,7 @@ class acp_groups $error = array_merge($error, $validation_error); } - if (!sizeof($error)) + if (!count($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes @@ -614,7 +614,7 @@ class acp_groups } } - if (sizeof($error)) + if (count($error)) { $error = array_map(array(&$user, 'lang'), $error); $group_rank = $submit_ary['rank']; @@ -732,12 +732,12 @@ class acp_groups 'S_ADD_GROUP' => ($action == 'add') ? true : false, 'S_GROUP_PERM' => ($action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth')) ? true : false, 'S_INCLUDE_SWATCH' => true, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_USER_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), - 'ERROR_MSG' => (sizeof($error)) ? implode('
            ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
            ', $error) : '', 'GROUP_NAME' => $group_helper->get_name($group_name), 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php index 7991a0dad6..a36b36eddc 100644 --- a/phpBB/includes/acp/acp_help_phpbb.php +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -48,7 +48,7 @@ class acp_help_phpbb $error[] = $user->lang['FORM_INVALID']; } // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 6cd5386857..2c3948f644 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -166,7 +166,7 @@ class acp_icons } $db->sql_freeresult($result); - if (sizeof($smilies)) + if (count($smilies)) { foreach ($smilies as $row) { @@ -301,7 +301,7 @@ class acp_icons } // Ok, another row for adding an addition code for a pre-existing image... - if ($action == 'add' && $mode == 'smilies' && sizeof($smilies)) + if ($action == 'add' && $mode == 'smilies' && count($smilies)) { $template->assign_vars(array( 'S_ADD_CODE' => true, @@ -378,7 +378,7 @@ class acp_icons { $smiley_count = $this->item_count($table); - $addable_smileys_count = sizeof($images); + $addable_smileys_count = count($images); foreach ($images as $image) { if (!isset($image_add[$image])) @@ -546,8 +546,8 @@ class acp_icons { if (preg_match_all("#'(.*?)', ?#", $pak_entry, $data)) { - if ((sizeof($data[1]) != 4 && $mode == 'icons') || - ((sizeof($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' )) + if ((count($data[1]) != 4 && $mode == 'icons') || + ((count($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' )) { trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -605,7 +605,7 @@ class acp_icons if ($mode == 'smilies') { $smiley_count = $this->item_count($table); - if ($smiley_count + sizeof($pak_ary) > SMILEY_LIMIT) + if ($smiley_count + count($pak_ary) > SMILEY_LIMIT) { trigger_error($user->lang('TOO_MANY_SMILIES', SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); } @@ -616,8 +616,8 @@ class acp_icons $data = array(); if (preg_match_all("#'(.*?)', ?#", $pak_entry, $data)) { - if ((sizeof($data[1]) != 4 && $mode == 'icons') || - (sizeof($data[1]) != 6 && $mode == 'smilies')) + if ((count($data[1]) != 4 && $mode == 'icons') || + (count($data[1]) != 6 && $mode == 'smilies')) { trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index ec256e93ef..6026f44ede 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -70,7 +70,7 @@ class acp_inactive $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); - if ($submit && sizeof($mark)) + if ($submit && count($mark)) { if ($action !== 'delete' && !check_form_key($form_key)) { diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index d81154b4ff..8881f624e3 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -415,7 +415,7 @@ class acp_language unset($installed); - if (sizeof($new_ary)) + if (count($new_ary)) { foreach ($new_ary as $iso => $lang_ary) { diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index c33ca8c4fc..8c3fb66a70 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -57,7 +57,7 @@ class acp_logs { $conditions = array(); - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $conditions['log_id'] = array('IN' => $marked); } @@ -167,7 +167,7 @@ class acp_logs 'IP' => $row['ip'], 'DATE' => $user->format_date($row['time']), 'ACTION' => $row['action'], - 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', + 'DATA' => (count($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], ) ); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 9b1a248923..4efa8c70b3 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -337,7 +337,7 @@ class acp_main } unset($posted); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); } diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 4d90b2da8b..fb0c09055e 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -249,7 +249,7 @@ class acp_modules trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - if (!sizeof($errors)) + if (!count($errors)) { $module_manager->remove_cache_file($this->module_class); @@ -364,7 +364,7 @@ class acp_modules trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - if (!sizeof($errors)) + if (!count($errors)) { $module_manager->remove_cache_file($this->module_class); @@ -430,7 +430,7 @@ class acp_modules array_change_key_case($module_data, CASE_UPPER)) ); - if (sizeof($errors)) + if (count($errors)) { $template->assign_vars(array( 'S_ERROR' => true, @@ -444,7 +444,7 @@ class acp_modules } // Default management page - if (sizeof($errors)) + if (count($errors)) { if ($request->is_ajax()) { diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 0bfe67830f..80cad9915d 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -348,7 +348,7 @@ class acp_permission_roles { $hold_ary = $this->auth_admin->get_role_mask($role_id); - if (sizeof($hold_ary)) + if (count($hold_ary)) { $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; @@ -496,7 +496,7 @@ class acp_permission_roles $content_array = $content_array[0]; - $template->assign_var('S_NUM_PERM_COLS', sizeof($categories)); + $template->assign_var('S_NUM_PERM_COLS', count($categories)); // Assign to template foreach ($content_array as $cat => $cat_array) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 12c43bf94c..8e05b95849 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -131,11 +131,11 @@ class acp_permissions } unset($usernames); - if (sizeof($username) && !sizeof($user_id)) + if (count($username) && !count($user_id)) { user_get_id_name($user_id, $username); - if (!sizeof($user_id)) + if (!count($user_id)) { trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -260,17 +260,17 @@ class acp_permissions { $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - if ($all_users && sizeof($items['user_ids'])) + if ($all_users && count($items['user_ids'])) { $user_id = $items['user_ids']; } - else if ($all_groups && sizeof($items['group_ids'])) + else if ($all_groups && count($items['group_ids'])) { $group_id = $items['group_ids']; } } - if (sizeof($user_id) || sizeof($group_id)) + if (count($user_id) || count($group_id)) { $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); } @@ -349,7 +349,7 @@ class acp_permissions { case 'forum_dropdown': - if (sizeof($forum_id)) + if (count($forum_id)) { $this->check_existence('forum', $forum_id); continue 2; @@ -364,7 +364,7 @@ class acp_permissions case 'forums': - if (sizeof($forum_id)) + if (count($forum_id)) { $this->check_existence('forum', $forum_id); continue 2; @@ -394,7 +394,7 @@ class acp_permissions case 'user': - if (sizeof($user_id)) + if (count($user_id)) { $this->check_existence('user', $user_id); continue 2; @@ -409,7 +409,7 @@ class acp_permissions case 'group': - if (sizeof($group_id)) + if (count($group_id)) { $this->check_existence('group', $group_id); continue 2; @@ -428,14 +428,14 @@ class acp_permissions $all_users = (isset($_POST['all_users'])) ? true : false; $all_groups = (isset($_POST['all_groups'])) ? true : false; - if ((sizeof($user_id) && !$all_users) || (sizeof($group_id) && !$all_groups)) + if ((count($user_id) && !$all_users) || (count($group_id) && !$all_groups)) { - if (sizeof($user_id)) + if (count($user_id)) { $this->check_existence('user', $user_id); } - if (sizeof($group_id)) + if (count($group_id)) { $this->check_existence('group', $group_id); } @@ -446,13 +446,13 @@ class acp_permissions // Now we check the users... because the "all"-selection is different here (all defined users/groups) $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - if ($all_users && sizeof($items['user_ids'])) + if ($all_users && count($items['user_ids'])) { $user_id = $items['user_ids']; continue 2; } - if ($all_groups && sizeof($items['group_ids'])) + if ($all_groups && count($items['group_ids'])) { $group_id = $items['group_ids']; continue 2; @@ -487,14 +487,14 @@ class acp_permissions 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_VICTIM' => true, - 'S_ALLOW_ALL_SELECT' => (sizeof($forum_id) > 5) ? false : true, + 'S_ALLOW_ALL_SELECT' => (count($forum_id) > 5) ? false : true, 'S_CAN_SELECT_USER' => ($auth->acl_get('a_authusers')) ? true : false, 'S_CAN_SELECT_GROUP' => ($auth->acl_get('a_authgroups')) ? true : false, 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); // Let the forum names being displayed - if (sizeof($forum_id)) + if (count($forum_id)) { $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' @@ -510,7 +510,7 @@ class acp_permissions $db->sql_freeresult($result); $template->assign_vars(array( - 'S_FORUM_NAMES' => (sizeof($forum_names)) ? true : false, + 'S_FORUM_NAMES' => (count($forum_names)) ? true : false, 'FORUM_NAMES' => implode($user->lang['COMMA_SEPARATOR'], $forum_names)) ); } @@ -527,13 +527,13 @@ class acp_permissions )); // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) - if (sizeof($forum_id) && !sizeof($user_id) && !sizeof($group_id)) + if (count($forum_id) && !count($user_id) && !count($group_id)) { trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( - 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, + 'S_PERMISSION_DROPDOWN' => (count($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), 'U_ACTION' => $this->u_action, @@ -546,8 +546,8 @@ class acp_permissions 'S_SETTING_PERMISSIONS' => true) ); - $hold_ary = $auth_admin->get_mask('set', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); - $auth_admin->display_mask('set', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + $hold_ary = $auth_admin->get_mask('set', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); + $auth_admin->display_mask('set', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); } else { @@ -555,8 +555,8 @@ class acp_permissions 'S_VIEWING_PERMISSIONS' => true) ); - $hold_ary = $auth_admin->get_mask('view', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); - $auth_admin->display_mask('view', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + $hold_ary = $auth_admin->get_mask('view', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); + $auth_admin->display_mask('view', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); } } @@ -652,7 +652,7 @@ class acp_permissions break; } - if (sizeof($ids)) + if (count($ids)) { $sql = "SELECT $sql_id FROM $table @@ -667,7 +667,7 @@ class acp_permissions $db->sql_freeresult($result); } - if (!sizeof($ids)) + if (!count($ids)) { trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -684,7 +684,7 @@ class acp_permissions $psubmit = $request->variable('psubmit', array(0 => array(0 => 0))); // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -715,7 +715,7 @@ class acp_permissions $ug_id = array($ug_id); $forum_id = array($forum_id); - if (sizeof($inherit)) + if (count($inherit)) { foreach ($inherit as $_ug_id => $forum_id_ary) { @@ -771,7 +771,7 @@ class acp_permissions global $request; // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -870,7 +870,7 @@ class acp_permissions } } - if (sizeof(array_diff_assoc($auth_settings, $test_auth_settings))) + if (count(array_diff_assoc($auth_settings, $test_auth_settings))) { return false; } @@ -886,7 +886,7 @@ class acp_permissions global $user, $db, $cache, $auth; // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -895,7 +895,7 @@ class acp_permissions trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : false), $permission_type); + $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : false), $permission_type); // Do we need to recache the moderator lists? if ($permission_type == 'm_') @@ -903,7 +903,7 @@ class acp_permissions phpbb_cache_moderators($db, $cache, $auth); } - $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0))); + $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : array(0 => 0))); if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { @@ -1053,7 +1053,7 @@ class acp_permissions $total = ACL_NO; $add_key = (($forum_id) ? '_LOCAL' : ''); - if (sizeof($groups)) + if (count($groups)) { // Get group auth settings $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id); @@ -1099,7 +1099,7 @@ class acp_permissions // Get user specific permission... globally or for this forum $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); - $auth_setting = (!sizeof($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; + $auth_setting = (!count($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; switch ($auth_setting) { @@ -1258,7 +1258,7 @@ class acp_permissions /** @var \phpbb\group\helper $group_helper */ $group_helper = $phpbb_container->get('group_helper'); - $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); + $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((count($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles $option_ids = $role_ids = array(); @@ -1274,7 +1274,7 @@ class acp_permissions } $db->sql_freeresult($result); - if (sizeof($option_ids)) + if (count($option_ids)) { $sql = 'SELECT DISTINCT role_id FROM ' . ACL_ROLES_DATA_TABLE . ' @@ -1288,15 +1288,15 @@ class acp_permissions $db->sql_freeresult($result); } - if (sizeof($option_ids) && sizeof($role_ids)) + if (count($option_ids) && count($role_ids)) { $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; } - else if (sizeof($role_ids)) + else if (count($role_ids)) { $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); } - else if (sizeof($option_ids)) + else if (count($option_ids)) { $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index f5c1b8e218..d89c200a1b 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -446,7 +446,7 @@ class acp_profile { $exploded_options = (is_array($options)) ? $options : explode("\n", $options); - if (sizeof($exploded_options) == sizeof($lang_options) || $action == 'create') + if (count($exploded_options) == count($lang_options) || $action == 'create') { // The number of options in the field is equal to the number of options already in the database // Or we are creating a new dropdown list. @@ -567,7 +567,7 @@ class acp_profile } } - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -600,9 +600,9 @@ class acp_profile $s_hidden_fields .= build_hidden_fields($_new_key_ary); } - if (!sizeof($error)) + if (!count($error)) { - if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) + if (($step == 3 && (count($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) { if (!check_form_key($form_key)) { @@ -616,7 +616,7 @@ class acp_profile $template->assign_vars(array( 'S_EDIT' => true, 'S_EDIT_MODE' => ($action == 'edit') ? true : false, - 'ERROR_MSG' => (sizeof($error)) ? implode('
            ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
            ', $error) : '', 'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], 'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], @@ -664,7 +664,7 @@ class acp_profile $template->assign_vars(array( 'S_STEP_TWO' => true, - 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) + 'L_NEXT_STEP' => (count($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) ); // Build options based on profile type @@ -776,7 +776,7 @@ class acp_profile $active_value = (!$row['field_active']) ? 'activate' : 'deactivate'; $id = $row['field_id']; - $s_need_edit = (sizeof($this->lang_defs['diff'][$row['field_id']])) ? true : false; + $s_need_edit = (count($this->lang_defs['diff'][$row['field_id']])) ? true : false; if ($s_need_edit) { @@ -1056,7 +1056,7 @@ class acp_profile $this->update_insert(PROFILE_LANG_TABLE, $sql_ary, array('field_id' => $field_id, 'lang_id' => $default_lang_id)); } - if (is_array($cp->vars['l_lang_name']) && sizeof($cp->vars['l_lang_name'])) + if (is_array($cp->vars['l_lang_name']) && count($cp->vars['l_lang_name'])) { foreach ($cp->vars['l_lang_name'] as $lang_id => $data) { @@ -1132,7 +1132,7 @@ class acp_profile } } - if (is_array($cp->vars['l_lang_options']) && sizeof($cp->vars['l_lang_options'])) + if (is_array($cp->vars['l_lang_options']) && count($cp->vars['l_lang_options'])) { $empty_lang = array(); @@ -1143,7 +1143,7 @@ class acp_profile $lang_ary = explode("\n", $lang_ary); } - if (sizeof($lang_ary) != sizeof($cp->vars['lang_options'])) + if (count($lang_ary) != count($cp->vars['lang_options'])) { $empty_lang[$lang_id] = true; } @@ -1195,7 +1195,7 @@ class acp_profile } } - if (sizeof($profile_lang_fields)) + if (count($profile_lang_fields)) { foreach ($profile_lang_fields as $sql) { @@ -1258,7 +1258,7 @@ class acp_profile $where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . $db->sql_escape($value) . "'" : (int) $value); } - if (!sizeof($where_sql)) + if (!count($where_sql)) { return; } @@ -1274,14 +1274,14 @@ class acp_profile { $sql_ary = array_merge($where_fields, $sql_ary); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary)); } } else { - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE ' . implode(' AND ', $where_sql); diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index a8c0dd060d..3eee4f7922 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -97,7 +97,7 @@ class acp_prune 'S_PRUNED' => true) ); - $sql_forum = (sizeof($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; + $sql_forum = (count($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; // Get a list of forum's or the data for the forum that we are pruning. $sql = 'SELECT forum_id, forum_name @@ -195,7 +195,7 @@ class acp_prune // If they haven't selected a forum for pruning yet then // display a select box to use for pruning. - if (!sizeof($forum_id)) + if (!count($forum_id)) { $template->assign_vars(array( 'U_ACTION' => $this->u_action, @@ -227,7 +227,7 @@ class acp_prune $db->sql_freeresult($result); - $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; + $l_selected_forums = (count($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; $template_data = array( 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], @@ -276,7 +276,7 @@ class acp_prune $user_ids = $usernames = array(); $this->get_prune_users($user_ids, $usernames); - if (sizeof($user_ids)) + if (count($user_ids)) { if ($action == 'deactivate') { @@ -315,7 +315,7 @@ class acp_prune $user_ids = $usernames = array(); $this->get_prune_users($user_ids, $usernames); - if (!sizeof($user_ids)) + if (!count($user_ids)) { trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -458,7 +458,7 @@ class acp_prune } // implicit else when both arrays are empty do nothing - if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined_before) && sizeof($joined_before) != 3) || (sizeof($joined_after) && sizeof($joined_after) != 3)) + if ((count($active) && count($active) != 3) || (count($joined_before) && count($joined_before) != 3) || (count($joined_after) && count($joined_after) != 3)) { trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -472,15 +472,15 @@ class acp_prune $where_sql .= ($count !== false) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; // First handle pruning of users who never logged in, last active date is 0000-00-00 - if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + if (count($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) { $where_sql .= ' AND user_lastvisit = 0'; } - else if (sizeof($active) && $active_select != 'lt') + else if (count($active) && $active_select != 'lt') { $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); } - else if (sizeof($active)) + else if (count($active)) { $where_sql .= ' AND (user_lastvisit > 0 AND user_lastvisit < ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]) . ')'; } diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 51c398681d..dfb2ccbfd3 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -103,7 +103,7 @@ class acp_reasons } } - if (!sizeof($error)) + if (!count($error)) { // New reason? if ($action == 'add') @@ -171,7 +171,7 @@ class acp_reasons 'L_TITLE' => $user->lang['REASON_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action", 'U_BACK' => $this->u_action, - 'ERROR_MSG' => (sizeof($error)) ? implode('
            ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
            ', $error) : '', 'REASON_TITLE' => $reason_row['reason_title'], 'REASON_DESCRIPTION' => $reason_row['reason_description'], @@ -182,7 +182,7 @@ class acp_reasons 'S_AVAILABLE_TITLES' => implode($user->lang['COMMA_SEPARATOR'], array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))), 'S_EDIT_REASON' => true, 'S_TRANSLATED' => $translated, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, ) ); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a792ee6b79..8cad7c927c 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -332,9 +332,9 @@ class acp_search $forum_ids[] = $row['forum_id']; } $db->sql_freeresult($result); - $row_count += sizeof($ids); + $row_count += count($ids); - if (sizeof($ids)) + if (count($ids)) { $this->search->index_remove($ids, $posters, $forum_ids); } @@ -474,8 +474,8 @@ class acp_search $statistics = array(); foreach ($data as $statistic => $value) { - $n = sizeof($statistics); - if ($n && sizeof($statistics[$n - 1]) < 3) + $n = count($statistics); + if ($n && count($statistics[$n - 1]) < 3) { $statistics[$n - 1] += array('statistic_2' => $statistic, 'value_2' => $value); } @@ -492,7 +492,7 @@ class acp_search 'S_ACTIVE' => ($type == $config['search_type']) ? true : false, 'S_HIDDEN_FIELDS' => build_hidden_fields(array('search_type' => $type)), 'S_INDEXED' => (bool) $search->index_created(), - 'S_STATS' => (bool) sizeof($statistics)) + 'S_STATS' => (bool) count($statistics)) ); foreach ($statistics as $statistic) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index beaa1d11f1..7ef5cb9981 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -690,7 +690,7 @@ class acp_users } $db->sql_freeresult($result); - if (sizeof($topic_id_ary)) + if (count($topic_id_ary)) { $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment FROM ' . TOPICS_TABLE . ' @@ -718,12 +718,12 @@ class acp_users } // Entire topic comprises posts by this user, move these topics - if (sizeof($move_topic_ary)) + if (count($move_topic_ary)) { move_topics($move_topic_ary, $new_forum_id, false); } - if (sizeof($move_post_ary)) + if (count($move_post_ary)) { // Create new topic // Update post_ids, report_ids, attachment_ids @@ -769,13 +769,13 @@ class acp_users $forum_id_ary = array_unique($forum_id_ary); $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); - if (sizeof($topic_id_ary)) + if (count($topic_id_ary)) { sync('topic_reported', 'topic_id', $topic_id_ary); sync('topic', 'topic_id', $topic_id_ary); } - if (sizeof($forum_id_ary)) + if (count($forum_id_ary)) { sync('forum', 'forum_id', $forum_id_ary, false, true); } @@ -892,7 +892,7 @@ class acp_users $update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']); $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array(); @@ -994,7 +994,7 @@ class acp_users )); } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -1347,7 +1347,7 @@ class acp_users { $s_hidden_fields['delall'] = 1; } - if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked))) + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && count($marked))) { confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } @@ -1383,9 +1383,9 @@ class acp_users { // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array // It doesn't matter if we add more arguments than placeholders - if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0) + if ((substr_count($row['action'], '%') - count($log_data_ary)) > 0) { - $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), '')); + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - count($log_data_ary), '')); } $row['action'] = vsprintf($row['action'], $log_data_ary); $row['action'] = bbcode_nl2br(censor_text($row['action'])); @@ -1478,7 +1478,7 @@ class acp_users // validate custom profile fields $cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error); - if (sizeof($cp_error)) + if (count($cp_error)) { $error = array_merge($error, $cp_error); } @@ -1501,7 +1501,7 @@ class acp_users $vars = array('data', 'user_id', 'user_row', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'user_jabber' => $data['jabber'], @@ -1645,7 +1645,7 @@ class acp_users $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $this->optionset($user_row, 'viewimg', $data['view_images']); $this->optionset($user_row, 'viewflash', $data['view_flash']); @@ -1696,7 +1696,7 @@ class acp_users $vars = array('data', 'user_row', 'sql_ary', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " @@ -2060,7 +2060,7 @@ class acp_users 'sig' ); - if (sizeof($warn_msg)) + if (count($warn_msg)) { $error += $warn_msg; } @@ -2072,7 +2072,7 @@ class acp_users } else { - if (!sizeof($error)) + if (!count($error)) { $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); $this->optionset($user_row, 'sig_smilies', $enable_smilies); @@ -2147,7 +2147,7 @@ class acp_users $sort_key = $request->variable('sk', 'a'); $sort_dir = $request->variable('sd', 'd'); - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $sql = 'SELECT attach_id FROM ' . ATTACHMENTS_TABLE . ' @@ -2164,7 +2164,7 @@ class acp_users $db->sql_freeresult($result); } - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { if (confirm_box(true)) { @@ -2185,7 +2185,7 @@ class acp_users $attachment_manager->delete('attach', $marked); unset($attachment_manager); - $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + $message = (count($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments))); trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -2455,7 +2455,7 @@ class acp_users // Select box for other groups $sql = 'SELECT group_id, group_name, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - ' . ((sizeof($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ' . ((count($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' ORDER BY group_type DESC, group_name ASC'; $result = $db->sql_query($sql); @@ -2604,8 +2604,8 @@ class acp_users // Assign general variables $template->assign_vars(array( - 'S_ERROR' => (sizeof($error)) ? true : false, - 'ERROR_MSG' => (sizeof($error)) ? implode('
            ', $error) : '') + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => (count($error)) ? implode('
            ', $error) : '') ); } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index b36b900396..58da3b922f 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -107,7 +107,7 @@ class auth_admin extends \phpbb\auth\auth $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array('')); // If forum_ids is false and the scope is local we actually want to have all forums within the array - if ($scope == 'local' && !sizeof($forum_ids)) + if ($scope == 'local' && !count($forum_ids)) { $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE; @@ -177,9 +177,9 @@ class auth_admin extends \phpbb\auth\auth // Now, we need to fill the gaps with $acl_fill. ;) // Now switch back to keys - if (sizeof($compare_options)) + if (count($compare_options)) { - $compare_options = array_combine($compare_options, array_fill(1, sizeof($compare_options), $acl_fill)); + $compare_options = array_combine($compare_options, array_fill(1, count($compare_options), $acl_fill)); } // Defining the user-function here to save some memory @@ -189,7 +189,7 @@ class auth_admin extends \phpbb\auth\auth }; // Actually fill the gaps - if (sizeof($hold_ary)) + if (count($hold_ary)) { foreach ($hold_ary as $ug_id => $row) { @@ -356,7 +356,7 @@ class auth_admin extends \phpbb\auth\auth // Build js roles array (role data assignments) $s_role_js_array = ''; - if (sizeof($roles)) + if (count($roles)) { $s_role_js_array = array(); @@ -422,7 +422,7 @@ class auth_admin extends \phpbb\auth\auth // If we only have one forum id to display or being in local mode and more than one user/group to display, // we switch the complete interface to group by user/usergroup instead of grouping by forum // To achieve this, we need to switch the array a bit - if (sizeof($forum_ids) == 1 || ($local && sizeof($ug_names_ary) > 1)) + if (count($forum_ids) == 1 || ($local && count($ug_names_ary) > 1)) { $hold_ary_temp = $hold_ary; $hold_ary = array(); @@ -453,9 +453,9 @@ class auth_admin extends \phpbb\auth\auth 'S_LOCAL' => ($local) ? true : false, 'S_GLOBAL' => (!$local) ? true : false, - 'S_NUM_CATS' => sizeof($categories), + 'S_NUM_CATS' => count($categories), 'S_VIEW' => ($mode == 'view') ? true : false, - 'S_NUM_OBJECTS' => sizeof($content_array), + 'S_NUM_OBJECTS' => count($content_array), 'S_USER_MODE' => ($user_mode == 'user') ? true : false, 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); @@ -546,15 +546,15 @@ class auth_admin extends \phpbb\auth\auth 'NAME' => $ug_name, 'CATEGORIES' => implode('
          '; } @@ -672,8 +672,8 @@ class diff_renderer_side_by_side extends diff_renderer case 'change': // Pop the old/new stacks one by one, until both are empty. - $oldsize = sizeof($change['old']); - $newsize = sizeof($change['new']); + $oldsize = count($change['old']); + $newsize = count($change['new']); $left = $right = ''; for ($row = 0, $row_max = max($oldsize, $newsize); $row < $row_max; ++$row) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index e2cab6d4a9..2fb83770fe 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -931,7 +931,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $where_ids = array_map('intval', $where_ids); /* Possible code for splitting post deletion - if (sizeof($where_ids) >= 1001) + if (count($where_ids) >= 1001) { // Split into chunks of 1000 $chunks = array_chunk($where_ids, 1000); diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 910708f502..77e03ee449 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -409,7 +409,7 @@ class compress_zip extends compress function close() { // Write out central file directory and footer ... if it exists - if (sizeof($this->ctrl_dir)) + if (count($this->ctrl_dir)) { fwrite($this->fp, $this->file()); } @@ -511,8 +511,8 @@ class compress_zip extends compress $ctrldir = implode('', $this->ctrl_dir); return $ctrldir . $this->eof_cdh . - pack('v', sizeof($this->ctrl_dir)) . // total # of entries "on this disk" - pack('v', sizeof($this->ctrl_dir)) . // total # of entries overall + pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk" + pack('v', count($this->ctrl_dir)) . // total # of entries overall pack('V', strlen($ctrldir)) . // size of central dir pack('V', $this->datasec_len) . // offset to start of central dir "\x00\x00"; // .zip file comment length diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 06223027d8..40d44cfe7b 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -336,7 +336,7 @@ function get_context($text, $words, $length = 400) $text = str_replace($entities, $characters, $text); $word_indizes = array(); - if (sizeof($words)) + if (count($words)) { $match = ''; // find the starting indizes of all words @@ -361,12 +361,12 @@ function get_context($text, $words, $length = 400) } unset($match); - if (sizeof($word_indizes)) + if (count($word_indizes)) { $word_indizes = array_unique($word_indizes); sort($word_indizes); - $wordnum = sizeof($word_indizes); + $wordnum = count($word_indizes); // number of characters on the right and left side of each word $sequence_length = (int) ($length / (2 * $wordnum)) - 2; $final_text = ''; @@ -434,7 +434,7 @@ function get_context($text, $words, $length = 400) } } - if (!sizeof($words) || !sizeof($word_indizes)) + if (!count($words) || !count($word_indizes)) { return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); } @@ -1021,7 +1021,7 @@ function censor_text($text) } } - if (sizeof($censors)) + if (count($censors)) { return preg_replace($censors['match'], $censors['replace'], $text); } @@ -1079,7 +1079,7 @@ function smiley_text($text, $force_option = false) */ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false) { - if (!sizeof($attachments)) + if (!count($attachments)) { return; } @@ -1114,7 +1114,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a } // Grab attachments (security precaution) - if (sizeof($attach_ids)) + if (count($attach_ids)) { global $db; @@ -1151,7 +1151,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a foreach ($attachments as $attachment) { - if (!sizeof($attachment)) + if (!count($attachment)) { continue; } @@ -1443,7 +1443,7 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al $chars = array_map('utf8_htmlspecialchars', $_chars); // Now check the length ;) - if (sizeof($chars) > $max_length) + if (count($chars) > $max_length) { // Cut off the last elements from the array $string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append))); @@ -1651,7 +1651,7 @@ function phpbb_generate_string_list($items, $user) return ''; } - $count = sizeof($items); + $count = count($items); $last_item = array_pop($items); $lang_key = 'STRING_LIST_MULTI'; diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 176e3dd6de..4a8f664fe9 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -192,7 +192,7 @@ function get_group_id($group_name) $db->sql_freeresult($result); } - if (!sizeof($group_mapping)) + if (!count($group_mapping)) { add_default_groups(); return get_group_id($group_name); @@ -307,7 +307,7 @@ function decode_ip($int_ip) $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); // Any mod changing the way ips are stored? Then we are not able to convert and enter the ip "as is" to not "destroy" anything... - if (sizeof($hexipbang) < 4) + if (count($hexipbang) < 4) { return $int_ip; } @@ -479,7 +479,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $dir->close(); } - for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i) + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) { $dir = $dirlist[$i]; @@ -1261,7 +1261,7 @@ function get_config() } } - if (!sizeof($convert_config)) + if (!count($convert_config)) { $convert->p_master->error($user->lang['CONV_ERROR_CONFIG_EMPTY'], __LINE__, __FILE__); } @@ -1406,9 +1406,9 @@ function get_path($src_path, $src_url, $test_file) $url_parts = explode('/', $m[2]); if (substr($src_url, -1) != '/') { - if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[sizeof($url_parts) - 1])) + if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[count($url_parts) - 1])) { - $url_parts[sizeof($url_parts) - 1] = ''; + $url_parts[count($url_parts) - 1] = ''; } else { @@ -1425,9 +1425,9 @@ function get_path($src_path, $src_url, $test_file) $path_array = array(); $phpbb_parts = explode('/', $script_path); - for ($i = 0, $end = sizeof($url_parts); $i < $end; ++$i) + for ($i = 0, $end = count($url_parts); $i < $end; ++$i) { - if ($i < sizeof($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) + if ($i < count($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) { $path_array[] = $url_parts[$i]; unset($url_parts[$i]); @@ -1435,7 +1435,7 @@ function get_path($src_path, $src_url, $test_file) else { $path = ''; - for ($j = $i, $end2 = sizeof($phpbb_parts); $j < $end2; ++$j) + for ($j = $i, $end2 = count($phpbb_parts); $j < $end2; ++$j) { $path .= '../'; } @@ -1458,7 +1458,7 @@ function get_path($src_path, $src_url, $test_file) function compare_table($tables, $tablename, &$prefixes) { - for ($i = 0, $table_size = sizeof($tables); $i < $table_size; ++$i) + for ($i = 0, $table_size = count($tables); $i < $table_size; ++$i) { if (preg_match('/(.*)' . $tables[$i] . '$/', $tablename, $m)) { @@ -1754,7 +1754,7 @@ function add_default_groups() ); } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(GROUPS_TABLE, $sql_ary); } @@ -1786,7 +1786,7 @@ function add_groups_to_teampage() } $db->sql_freeresult($result); - if (sizeof($teampage_ary)) + if (count($teampage_ary)) { $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); } @@ -2101,7 +2101,7 @@ function update_topics_posted() } unset($posted); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); } @@ -2136,7 +2136,7 @@ function fix_empty_primary_groups() } $db->sql_freeresult($result); - if (sizeof($user_ids)) + if (count($user_ids)) { $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . ' WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); @@ -2152,7 +2152,7 @@ function fix_empty_primary_groups() } $db->sql_freeresult($result); - if (sizeof($user_ids)) + if (count($user_ids)) { $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . ' WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); @@ -2264,7 +2264,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals "\n\n" ); - for ($i = 0, $end = sizeof($str_from); $i < $end; ++$i) + for ($i = 0, $end = count($str_from); $i < $end; ++$i) { $origx[] = '#\\' . str_replace(']', '\\]', $str_from[$i]) . '#is'; $replx[] = $str_to[$i]; @@ -2273,7 +2273,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals if (preg_match_all('#\[email=([^\]]+)\](.*?)\[/email\]#i', $message, $m)) { - for ($i = 0, $end = sizeof($m[1]); $i < $end; ++$i) + for ($i = 0, $end = count($m[1]); $i < $end; ++$i) { if ($m[1][$i] == $m[2][$i]) { @@ -2292,7 +2292,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals $message = preg_replace('#\[size=([0-9]+)\](.*?)\[/size\]#i', '[size=\1]\2[/size]', $message); $message = preg_replace('#\[size=[0-9]{2,}\](.*?)\[/size\]#i', '[size=29]\1[/size]', $message); - for ($i = sizeof($size); $i;) + for ($i = count($size); $i;) { $i--; $message = str_replace('[size=' . $i . ']', '[size=' . $size[$i] . ']', $message); @@ -2335,9 +2335,9 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour $path = $phpbb_root_path; $parts = explode('/', $trg); - unset($parts[sizeof($parts) - 1]); + unset($parts[count($parts) - 1]); - for ($i = 0, $end = sizeof($parts); $i < $end; ++$i) + for ($i = 0, $end = count($parts); $i < $end; ++$i) { $path .= $parts[$i] . '/'; @@ -2437,7 +2437,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ if ($copy_subdirs) { - for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i) + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) { $dir = $dirlist[$i]; @@ -2458,21 +2458,21 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ $bad_dirs[] = $trg_path . $dir; } - if (!sizeof($bad_dirs)) + if (!count($bad_dirs)) { copy_dir($src . $dir, $trg . $dir, true, $overwrite, $die_on_failure, $source_relative_path); } } } - if (sizeof($bad_dirs)) + if (count($bad_dirs)) { - $str = (sizeof($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + $str = (count($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; sort($bad_dirs); $convert->p_master->error(sprintf($str, implode('
          ', $bad_dirs)), __LINE__, __FILE__); } - for ($i = 0, $end = sizeof($filelist); $i < $end; ++$i) + for ($i = 0, $end = count($filelist); $i < $end; ++$i) { copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path); } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 171a73a8de..4c1a90d5b5 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -506,7 +506,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } } - $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; + $l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; } else @@ -558,7 +558,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $l_moderator = $moderators_list = ''; if ($display_moderators && !empty($forum_moderators[$forum_id])) { - $l_moderator = (sizeof($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; + $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; $moderators_list = implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]); } @@ -605,7 +605,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']), 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, - 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, + 'S_SUBFORUMS' => (count($subforums_list)) ? true : false, 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, @@ -1646,10 +1646,10 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && // They must be able to read PMs - sizeof($auth->acl_get_list($user_id, 'u_readpm')) && + count($auth->acl_get_list($user_id, 'u_readpm')) && // They must not be permanently banned - !sizeof(phpbb_get_banned_user_ids($user_id, false)) && + !count(phpbb_get_banned_user_ids($user_id, false)) && // They must allow users to contact via PM (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index e3af294b75..7be12baa13 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -568,7 +568,7 @@ function phpbb_parse_range_request($request_array, $filesize) $range = explode('-', trim($range_string)); // "-" is invalid, "0-0" however is valid and means the very first byte. - if (sizeof($range) != 2 || $range[0] === '' && $range[1] === '') + if (count($range) != 2 || $range[0] === '' && $range[1] === '') { continue; } diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index cfe8c2a90e..cf0865e608 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -207,7 +207,7 @@ class jabber */ function login() { - if (!sizeof($this->features)) + if (!count($this->features)) { $this->add_to_log('Error: No feature information from server available.'); return false; @@ -293,7 +293,7 @@ class jabber */ function get_log() { - if ($this->enable_logging && sizeof($this->log_array)) + if ($this->enable_logging && count($this->log_array)) { return implode("

          ", $this->log_array); } @@ -400,14 +400,14 @@ class jabber */ function response($xml) { - if (!is_array($xml) || !sizeof($xml)) + if (!is_array($xml) || !count($xml)) { return false; } // did we get multiple elements? do one after another // array('message' => ..., 'presence' => ...) - if (sizeof($xml) > 1) + if (count($xml) > 1) { foreach ($xml as $key => $value) { @@ -419,7 +419,7 @@ class jabber { // or even multiple elements of the same type? // array('message' => array(0 => ..., 1 => ...)) - if (sizeof(reset($xml)) > 1) + if (count(reset($xml)) > 1) { foreach (reset($xml) as $value) { @@ -858,14 +858,14 @@ class jabber array_push($children, $vals[$i]['value']); } - while (++$i < sizeof($vals)) + while (++$i < count($vals)) { switch ($vals[$i]['type']) { case 'open': $tagname = (isset($vals[$i]['tag'])) ? $vals[$i]['tag'] : ''; - $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0; + $size = (isset($children[$tagname])) ? count($children[$tagname]) : 0; if (isset($vals[$i]['attributes'])) { @@ -883,7 +883,7 @@ class jabber case 'complete': $tagname = $vals[$i]['tag']; - $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0; + $size = (isset($children[$tagname])) ? count($children[$tagname]) : 0; $children[$tagname][$size]['#'] = (isset($vals[$i]['value'])) ? $vals[$i]['value'] : array(); if (isset($vals[$i]['attributes'])) diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php index 7ab2da8e5c..d91993b23f 100644 --- a/phpBB/includes/functions_mcp.php +++ b/phpBB/includes/functions_mcp.php @@ -113,7 +113,7 @@ function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = fa $topics = array(); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { return array(); } @@ -130,7 +130,7 @@ function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = fa $cache_topic_ids = array(); } - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql_array = array( 'SELECT' => 't.*, f.*', @@ -201,7 +201,7 @@ function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = fals $rowset = array(); - if (!sizeof($post_ids)) + if (!count($post_ids)) { return array(); } @@ -282,7 +282,7 @@ function phpbb_get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = $forum_id = array($forum_id); } - if (!sizeof($forum_id)) + if (!count($forum_id)) { return array(); } @@ -331,7 +331,7 @@ function phpbb_get_pm_data($pm_ids) $rowset = array(); - if (!sizeof($pm_ids)) + if (!count($pm_ids)) { return array(); } @@ -732,7 +732,7 @@ function phpbb_check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_foru } $db->sql_freeresult($result); - if (!sizeof($ids)) + if (!count($ids)) { return false; } diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4eda5ac6cb..b866e108c0 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -84,7 +84,7 @@ class messenger return; } - $pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0; + $pos = isset($this->addresses['to']) ? count($this->addresses['to']) : 0; $this->addresses['to'][$pos]['email'] = trim($address); @@ -109,7 +109,7 @@ class messenger return; } - $pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0; + $pos = isset($this->addresses['cc']) ? count($this->addresses['cc']) : 0; $this->addresses['cc'][$pos]['email'] = trim($address); $this->addresses['cc'][$pos]['name'] = trim($realname); } @@ -124,7 +124,7 @@ class messenger return; } - $pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0; + $pos = isset($this->addresses['bcc']) ? count($this->addresses['bcc']) : 0; $this->addresses['bcc'][$pos]['email'] = trim($address); $this->addresses['bcc'][$pos]['name'] = trim($realname); } @@ -140,7 +140,7 @@ class messenger return; } - $pos = isset($this->addresses['im']) ? sizeof($this->addresses['im']) : 0; + $pos = isset($this->addresses['im']) ? count($this->addresses['im']) : 0; $this->addresses['im'][$pos]['uid'] = trim($address); $this->addresses['im'][$pos]['name'] = trim($realname); } @@ -503,7 +503,7 @@ class messenger $vars = array('headers'); extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); - if (sizeof($this->extra_headers)) + if (count($this->extra_headers)) { $headers = array_merge($headers, $this->extra_headers); } @@ -814,7 +814,7 @@ class queue } $package_size = $data_ary['package_size']; - $num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size; + $num_items = (!$package_size || count($data_ary['data']) < $package_size) ? count($data_ary['data']) : $package_size; /* * This code is commented out because it causes problems on some web hosts. @@ -823,9 +823,9 @@ class queue * web host and the package size setting is wrong. // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... - if (sizeof($data_ary['data']) > $package_size * 2.5) + if (count($data_ary['data']) > $package_size * 2.5) { - $num_items = sizeof($data_ary['data']); + $num_items = count($data_ary['data']); } */ @@ -914,7 +914,7 @@ class queue } // No more data for this object? Unset it - if (!sizeof($this->queue_data[$object]['data'])) + if (!count($this->queue_data[$object]['data'])) { unset($this->queue_data[$object]); } @@ -930,7 +930,7 @@ class queue } } - if (!sizeof($this->queue_data)) + if (!count($this->queue_data)) { @unlink($this->cache_file); } @@ -965,7 +965,7 @@ class queue */ function save() { - if (!sizeof($this->data)) + if (!count($this->data)) { return; } @@ -979,7 +979,7 @@ class queue foreach ($this->queue_data as $object => $data_ary) { - if (isset($this->data[$object]) && sizeof($this->data[$object])) + if (isset($this->data[$object]) && count($this->data[$object])) { $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']); } @@ -1067,7 +1067,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) $mail_rcpt = $mail_to = $mail_cc = array(); // Build correct addresses for RCPT TO command and the client side display (TO, CC) - if (isset($addresses['to']) && sizeof($addresses['to'])) + if (isset($addresses['to']) && count($addresses['to'])) { foreach ($addresses['to'] as $which_ary) { @@ -1076,7 +1076,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } } - if (isset($addresses['bcc']) && sizeof($addresses['bcc'])) + if (isset($addresses['bcc']) && count($addresses['bcc'])) { foreach ($addresses['bcc'] as $which_ary) { @@ -1084,7 +1084,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } } - if (isset($addresses['cc']) && sizeof($addresses['cc'])) + if (isset($addresses['cc']) && count($addresses['cc'])) { foreach ($addresses['cc'] as $which_ary) { @@ -1802,11 +1802,11 @@ function mail_encode($str, $eol = "\r\n") $array = utf8_str_split($str); $str = ''; - while (sizeof($array)) + while (count($array)) { $text = ''; - while (sizeof($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) + while (count($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) { $text .= array_shift($array); } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 7a1991d69a..3563a646e8 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -243,7 +243,7 @@ class p_master } } - $depth = sizeof($this->module_cache['parents'][$row['module_id']]); + $depth = count($this->module_cache['parents'][$row['module_id']]); // We need to prefix the functions to not create a naming conflict @@ -279,7 +279,7 @@ class p_master 'parent' => (int) $row['parent_id'], 'cat' => ($row['right_id'] > $row['left_id'] + 1) ? true : false, - 'is_duplicate' => ($row['module_basename'] && sizeof($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, + 'is_duplicate' => ($row['module_basename'] && count($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, 'name' => (string) $row['module_basename'], 'mode' => (string) $row['module_mode'], @@ -431,7 +431,7 @@ class p_master extract($phpbb_dispatcher->trigger_event('core.module_auth', compact($vars))); $tokens = $match[0]; - for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) + for ($i = 0, $size = count($tokens); $i < $size; $i++) { $token = &$tokens[$i]; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index d9f395efb3..21f31c9fa2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -114,7 +114,7 @@ function generate_smilies($mode, $forum_id) } $db->sql_freeresult($result); - if (sizeof($smilies)) + if (count($smilies)) { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); @@ -200,7 +200,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $topic_condition = ''; } - if (sizeof($ids) == 1) + if (count($ids) == 1) { $sql = 'SELECT MAX(p.post_id) as last_post_id FROM ' . POSTS_TABLE . " p $topic_join @@ -222,7 +222,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $last_post_ids = array(); while ($row = $db->sql_fetchrow($result)) { - if (sizeof($ids) == 1) + if (count($ids) == 1) { $row[$type . '_id'] = $ids[0]; } @@ -256,7 +256,7 @@ function update_post_information($type, $ids, $return_update_sql = false) } } - if (sizeof($last_post_ids)) + if (count($last_post_ids)) { $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -277,7 +277,7 @@ function update_post_information($type, $ids, $return_update_sql = false) } unset($empty_forums, $ids, $last_post_ids); - if ($return_update_sql || !sizeof($update_sql)) + if ($return_update_sql || !count($update_sql)) { return $update_sql; } @@ -310,7 +310,7 @@ function posting_gen_topic_icons($mode, $icon_id) $template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"'); } - if (sizeof($icons)) + if (count($icons)) { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; @@ -690,7 +690,7 @@ function posting_gen_inline_attachments(&$attachment_data) { global $template; - if (sizeof($attachment_data)) + if (count($attachment_data)) { $s_inline_attachment_options = ''; @@ -717,12 +717,12 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a // Some default template variables $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => $show_attach_box, - 'S_HAS_ATTACHMENTS' => sizeof($attachment_data), + 'S_HAS_ATTACHMENTS' => count($attachment_data), 'FILESIZE' => $config['max_filesize'], 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', )); - if (sizeof($attachment_data)) + if (count($attachment_data)) { // We display the posted attachments within the desired order. ($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); @@ -768,7 +768,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a $template->assign_block_vars_array('attach_row', $attachrow_template_vars); } - return sizeof($attachment_data); + return count($attachment_data); } // @@ -816,13 +816,13 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms } $db->sql_freeresult($result); - if (!sizeof($draft_rows)) + if (!count($draft_rows)) { return; } $topic_rows = array(); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster FROM ' . TOPICS_TABLE . ' @@ -935,7 +935,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $db->sql_freeresult($result); - if (!sizeof($post_list)) + if (!count($post_list)) { return false; } @@ -1030,7 +1030,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id ); extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_post_list', compact($vars))); - for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) + for ($i = 0, $end = count($post_list); $i < $end; ++$i) { // A non-existing rowset only happens if there was no user present for the entered poster_id // This could be a broken posts table. @@ -1257,7 +1257,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ foreach ($shadow_forum_ids as $updated_forum => $topic_count) { - // counting is fun! we only have to do sizeof($forum_ids) number of queries, + // counting is fun! we only have to do count($forum_ids) number of queries, // even if the topic is moved back to where its shadow lives (we count how many times it is in a forum) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET forum_topics_approved = forum_topics_approved - ' . $topic_count . ' @@ -1277,7 +1277,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data); $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if (count($update_sql)) { $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); @@ -1326,7 +1326,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ { // Update last post information when hard deleting. Soft delete already did that by itself. $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if (count($update_sql)) { $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]); } @@ -1968,7 +1968,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $sql_insert_ary = array(); - for ($i = 0, $size = sizeof($poll_ary['poll_options']); $i < $size; $i++) + for ($i = 0, $size = count($poll_ary['poll_options']); $i < $size; $i++) { if (strlen(trim($poll_ary['poll_options'][$i]))) { @@ -1976,7 +1976,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data { // If we add options we need to put them to the end to be able to preserve votes... $sql_insert_ary[] = array( - 'poll_option_id' => (int) sizeof($cur_poll_options) + 1 + sizeof($sql_insert_ary), + 'poll_option_id' => (int) count($cur_poll_options) + 1 + count($sql_insert_ary), 'topic_id' => (int) $data_ary['topic_id'], 'poll_option_text' => (string) $poll_ary['poll_options'][$i] ); @@ -1994,16 +1994,16 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary); - if (sizeof($poll_ary['poll_options']) < sizeof($cur_poll_options)) + if (count($poll_ary['poll_options']) < count($cur_poll_options)) { $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ' - WHERE poll_option_id > ' . sizeof($poll_ary['poll_options']) . ' + WHERE poll_option_id > ' . count($poll_ary['poll_options']) . ' AND topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } // If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option - if ($mode == 'edit' && sizeof($poll_ary['poll_options']) != sizeof($cur_poll_options)) + if ($mode == 'edit' && count($poll_ary['poll_options']) != count($cur_poll_options)) { $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']); $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']); @@ -2021,7 +2021,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $orphan_rows[(int) $attach_row['attach_id']] = array(); } - if (sizeof($orphan_rows)) + if (count($orphan_rows)) { $sql = 'SELECT attach_id, filesize, physical_filename FROM ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ff962075a8..444bf2c7e0 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -466,7 +466,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $user_rules = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - if (sizeof($user_rules)) + if (count($user_rules)) { $sql = 'SELECT zebra_id, friend, foe FROM ' . ZEBRA_TABLE . " @@ -499,7 +499,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $db->sql_freeresult($result); // Retrieve user memberships - if (sizeof($user_ids)) + if (count($user_ids)) { $sql = 'SELECT * FROM ' . USER_GROUP_TABLE . ' @@ -600,14 +600,14 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // only gone through if new messages arrive. // Delete messages - if (sizeof($delete_ids)) + if (count($delete_ids)) { - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); } // Set messages to Unread - if (sizeof($unread_ids)) + if (count($unread_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_unread = 0 @@ -618,7 +618,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } // mark messages as important - if (sizeof($important_ids)) + if (count($important_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_marked = 1 - pm_marked @@ -631,7 +631,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Move into folder $folder = array(); - if (sizeof($move_into_folder)) + if (count($move_into_folder)) { // Determine Full Folder Action - we need the move to folder id later eventually $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; @@ -676,12 +676,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Check Message Limit - we calculate with the complete array, most of the time it is one message // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) - if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; // If destination folder itself is full... - if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } @@ -699,7 +699,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) WHERE user_id = $user_id AND folder_id = $dest_folder ORDER BY msg_id ASC"; - $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $user->data['message_limit'])); + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + count($msg_ary)) - $user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -708,7 +708,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } $db->sql_freeresult($result); - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, $dest_folder); } } @@ -744,7 +744,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } - if (sizeof($action_ary)) + if (count($action_ary)) { // Move from OUTBOX to SENTBOX // We are not checking any full folder status here... SENTBOX is a special treatment (old messages get deleted) @@ -785,7 +785,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $move_msg_ids = array($move_msg_ids); } - if (sizeof($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && + if (count($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && !in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)) && $cur_folder_id != $dest_folder) { // We have to check the destination folder ;) @@ -805,7 +805,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol trigger_error('NOT_AUTHORISED'); } - if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $row['pm_count'] + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '

          '; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $row['folder_name']); @@ -822,7 +822,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); - if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $num_messages + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '

          '; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); @@ -949,7 +949,7 @@ function handle_mark_actions($user_id, $mark_action) $msg_ids = $request->variable('marked_msg_id', array(0)); $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -981,7 +981,7 @@ function handle_mark_actions($user_id, $mark_action) { delete_pm($user_id, $msg_ids, $cur_folder_id); - $success_msg = (sizeof($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $success_msg = (count($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); meta_refresh(3, $redirect); @@ -1032,7 +1032,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $msg_ids = array($msg_ids); } - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -1069,7 +1069,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $db->sql_freeresult($result); unset($msg_ids); - if (!sizeof($delete_rows)) + if (!count($delete_rows)) { return false; } @@ -1156,7 +1156,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $delete_ids = array_keys($delete_rows); - if (sizeof($delete_ids)) + if (count($delete_ids)) { // Check if there are any attachments we need to remove /** @var \phpbb\attachment\manager $attachment_manager */ @@ -1289,7 +1289,7 @@ function phpbb_delete_users_pms($user_ids) $num_pms = (int) $row['num_undelivered_privmsgs']; $undelivered_user[$num_pms][] = (int) $row['user_id']; - if (sizeof($undelivered_user[$num_pms]) > 50) + if (count($undelivered_user[$num_pms]) > 50) { // If there are too many users affected the query might get // too long, so we update the value for the first bunch here. @@ -1416,7 +1416,7 @@ function rebuild_header($check_ary) $_types = array('u', 'g'); foreach ($_types as $type) { - if (sizeof(${$type})) + if (count(${$type})) { foreach (${$type} as $id) { @@ -1461,7 +1461,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } $address = array(); - if (sizeof($u)) + if (count($u)) { $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' @@ -1485,7 +1485,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) $db->sql_freeresult($result); } - if (sizeof($g)) + if (count($g)) { if ($plaintext) { @@ -1532,7 +1532,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } } - if (sizeof($address) && !$plaintext) + if (count($address) && !$plaintext) { $template->assign_var('S_' . strtoupper($check_type) . '_RECIPIENT', true); @@ -1651,7 +1651,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($data_ary['address_list'][$ug_type]) && sizeof($data_ary['address_list'][$ug_type])) + if (isset($data_ary['address_list'][$ug_type]) && count($data_ary['address_list'][$ug_type])) { foreach ($data_ary['address_list'][$ug_type] as $id => $field) { @@ -1673,7 +1673,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) } } - if (isset($data_ary['address_list']['g']) && sizeof($data_ary['address_list']['g'])) + if (isset($data_ary['address_list']['g']) && count($data_ary['address_list']['g'])) { // We need to check the PM status of group members (do they want to receive PM's?) // Only check if not a moderator or admin, since they are allowed to override this user setting @@ -1696,7 +1696,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $db->sql_freeresult($result); } - if (!sizeof($recipients)) + if (!count($recipients)) { trigger_error('NO_RECIPIENT'); } @@ -1764,7 +1764,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) break; } - if (sizeof($sql_data)) + if (count($sql_data)) { if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') { @@ -1844,7 +1844,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $orphan_rows[(int) $attach_row['attach_id']] = array(); } - if (sizeof($orphan_rows)) + if (count($orphan_rows)) { $sql = 'SELECT attach_id, filesize, physical_filename FROM ' . ATTACHMENTS_TABLE . ' @@ -2038,7 +2038,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - if (sizeof($rowset) == 1 && !$in_post_mode) + if (count($rowset) == 1 && !$in_post_mode) { return false; } @@ -2051,7 +2051,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode // Re-order rowset to be able to get the next/prev message rows... $rowset = array_values($rowset); - for ($i = 0, $size = sizeof($rowset); $i < $size; $i++) + for ($i = 0, $size = count($rowset); $i < $size; $i++) { $row = &$rowset[$i]; $id = (int) $row['msg_id']; @@ -2197,7 +2197,7 @@ function get_recipient_strings($pm_by_id) foreach ($_types as $ug_type) { - if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + if (isset($address[$message_id][$ug_type]) && count($address[$message_id][$ug_type])) { foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) { diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 0fc8a7eea5..67ce2211e7 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -112,7 +112,7 @@ class transfer $dir = explode('/', $dir); $dirs = ''; - for ($i = 0, $total = sizeof($dir); $i < $total; $i++) + for ($i = 0, $total = count($dir); $i < $total; $i++) { $result = true; diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index 2f3405f915..b878b1af0a 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -268,7 +268,7 @@ class mcp_ban { $post_info = phpbb_get_post_data($post_id, 'm_ban'); - if (sizeof($post_info) && !empty($post_info[$post_id])) + if (count($post_info) && !empty($post_info[$post_id])) { switch ($mode) { diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 3e214797c8..19f71e092a 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -96,14 +96,14 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $pagination = $phpbb_container->get('pagination'); $selected_ids = ''; - if (sizeof($post_id_list) && $action != 'merge_topics') + if (count($post_id_list) && $action != 'merge_topics') { foreach ($post_id_list as $num => $post_id) { $selected_ids .= '&post_id_list[' . $num . ']=' . $post_id; } } - else if (sizeof($topic_id_list) && $action == 'merge_topics') + else if (count($topic_id_list) && $action == 'merge_topics') { foreach ($topic_id_list as $num => $topic_id) { @@ -221,13 +221,13 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $db->sql_freeresult($result); // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync - if (!sizeof($topic_list) && $forum_topics && $start > 0) + if (!count($topic_list) && $forum_topics && $start > 0) { redirect($url . "&i=$id&action=$action&mode=$mode"); } // Get topic tracking info - if (sizeof($topic_list)) + if (count($topic_list)) { if ($config['load_db_lastread']) { @@ -358,7 +358,7 @@ function mcp_resync_topics($topic_ids) { global $db, $user, $phpbb_log, $request; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -389,7 +389,7 @@ function mcp_resync_topics($topic_ids) } $db->sql_freeresult($result); - $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; + $msg = (count($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; $redirect = $request->variable('redirect', $user->data['session_page']); @@ -406,7 +406,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) { global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']); return; @@ -421,7 +421,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id])) + if (!count($all_topic_data) || empty($all_topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; @@ -440,7 +440,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $post_id_list = $request->variable('post_id_list', array(0)); $start = $request->variable('start', 0); - if (!sizeof($post_id_list) && sizeof($topic_ids)) + if (!count($post_id_list) && count($topic_ids)) { $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' @@ -455,7 +455,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $db->sql_freeresult($result); } - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index c34c915a40..cbc84e8c64 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -115,7 +115,7 @@ class mcp_logs { if (confirm_box(true)) { - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $conditions = array( 'forum_id' => array('IN' => $forum_list), @@ -221,7 +221,7 @@ class mcp_logs 'IP' => $row['ip'], 'DATE' => $user->format_date($row['time']), 'ACTION' => $row['action'], - 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', + 'DATA' => (count($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], ) ); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 3d56bba21c..2133bd9a19 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -47,7 +47,7 @@ class mcp_main case 'unlock': $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -60,7 +60,7 @@ class mcp_main $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); - if (!sizeof($post_ids)) + if (!count($post_ids)) { trigger_error('NO_POST_SELECTED'); } @@ -75,7 +75,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -88,7 +88,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -101,7 +101,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -118,7 +118,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -135,7 +135,7 @@ class mcp_main $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; - if (!sizeof($post_ids)) + if (!count($post_ids)) { trigger_error('NO_POST_SELECTED'); } @@ -148,7 +148,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -193,7 +193,7 @@ class mcp_main $forum_info = phpbb_get_forum_data($forum_id, 'm_', true); - if (!sizeof($forum_info)) + if (!count($forum_info)) { $this->main('main', 'front'); return; @@ -342,7 +342,7 @@ function lock_unlock($action, $ids) ); extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars))); - $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + $success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; meta_refresh(2, $redirect); $message = $user->lang[$success_msg]; @@ -355,7 +355,7 @@ function lock_unlock($action, $ids) } else { - confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields); } redirect($redirect); @@ -373,25 +373,25 @@ function change_topic_type($action, $topic_ids) case 'make_announce': $new_topic_type = POST_ANNOUNCE; $check_acl = 'f_announce'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; break; case 'make_global': $new_topic_type = POST_GLOBAL; $check_acl = 'f_announce_global'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; break; case 'make_sticky': $new_topic_type = POST_STICKY; $check_acl = 'f_sticky'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; break; default: $new_topic_type = POST_NORMAL; $check_acl = false; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; break; } @@ -419,7 +419,7 @@ function change_topic_type($action, $topic_ids) WHERE " . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); - if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids)) + if (($new_topic_type == POST_GLOBAL) && count($topic_ids)) { // Delete topic shadows for global announcements $sql = 'DELETE FROM ' . TOPICS_TABLE . ' @@ -432,9 +432,9 @@ function change_topic_type($action, $topic_ids) $db->sql_query($sql); } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; - if (sizeof($topic_ids)) + if (count($topic_ids)) { $data = phpbb_get_topic_data($topic_ids); @@ -496,7 +496,7 @@ function mcp_move_topic($topic_ids) { $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); - if (!sizeof($forum_data)) + if (!count($forum_data)) { $additional_msg = $user->lang['FORUM_NOT_EXIST']; } @@ -691,7 +691,7 @@ function mcp_move_topic($topic_ids) $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted; } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; foreach ($sync_sql as $forum_id_key => $array) { @@ -714,7 +714,7 @@ function mcp_move_topic($topic_ids) 'ADDITIONAL_MSG' => $additional_msg) ); - confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } $redirect = $request->variable('redirect', "index.$phpEx"); @@ -762,7 +762,7 @@ function mcp_restore_topic($topic_ids) if (confirm_box(true)) { - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; $data = phpbb_get_topic_data($topic_ids); @@ -784,7 +784,7 @@ function mcp_restore_topic($topic_ids) } else { - confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); + confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); } $topic_id = $request->variable('t', 0); @@ -842,7 +842,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' if (confirm_box(true)) { - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; $data = phpbb_get_topic_data($topic_ids); @@ -927,10 +927,10 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' 'S_TOPIC_MODE' => true, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', sizeof($topic_ids)), + 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)), )); - $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; + $l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; if ($only_softdeleted) { $l_confirm .= '_PERMANENTLY'; @@ -1042,11 +1042,11 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post'])); } - $affected_topics = sizeof($topic_info); + $affected_topics = count($topic_info); // None of the topics is really deleted, so a redirect won't hurt much. $deleted_topics = 0; - $success_msg = (sizeof($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; + $success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; foreach ($approve_log as $row) { @@ -1093,7 +1093,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { $topic_id_list[] = $row['topic_id']; } - $affected_topics = sizeof($topic_id_list); + $affected_topics = count($topic_id_list); $db->sql_freeresult($result); $post_data = phpbb_get_post_data($post_ids); @@ -1132,7 +1132,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', } $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); - if (sizeof($post_ids) == 1) + if (count($post_ids) == 1) { if ($deleted_topics) { @@ -1181,10 +1181,10 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', 'S_SOFTDELETED' => $only_softdeleted, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', sizeof($post_ids)), + 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)), )); - $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; + $l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; if ($only_softdeleted) { $l_confirm .= '_PERMANENTLY'; @@ -1247,11 +1247,11 @@ function mcp_fork_topic($topic_ids) { $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { $additional_msg = $user->lang['NO_TOPIC_SELECTED']; } - else if (!sizeof($forum_data)) + else if (!count($forum_data)) { $additional_msg = $user->lang['FORUM_NOT_EXIST']; } @@ -1409,7 +1409,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (!sizeof($post_rows)) + if (!count($post_rows)) { continue; } @@ -1512,7 +1512,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); } @@ -1536,7 +1536,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } @@ -1557,7 +1557,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); } @@ -1589,7 +1589,7 @@ function mcp_fork_topic($topic_ids) sync('topic', 'topic_id', $new_topic_id_list); sync('forum', 'forum_id', $to_forum_id); - $config->increment('num_topics', sizeof($new_topic_id_list), false); + $config->increment('num_topics', count($new_topic_id_list), false); $config->increment('num_posts', $total_posts, false); foreach ($new_topic_id_list as $topic_id => $new_topic_id) @@ -1601,7 +1601,7 @@ function mcp_fork_topic($topic_ids) )); } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; } else { @@ -1611,7 +1611,7 @@ function mcp_fork_topic($topic_ids) 'ADDITIONAL_MSG' => $additional_msg) ); - confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } $redirect = $request->variable('redirect', "index.$phpEx"); diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 67a1a959e4..c17b9985af 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -55,7 +55,7 @@ class mcp_pm_reports $report_id_list = $request->variable('report_id_list', array(0)); - if (!sizeof($report_id_list)) + if (!count($report_id_list)) { trigger_error('NO_REPORT_SELECTED'); } @@ -104,7 +104,7 @@ class mcp_pm_reports $pm_info = phpbb_get_pm_data(array($pm_id)); - if (!sizeof($pm_info)) + if (!count($pm_info)) { trigger_error('NO_REPORT_SELECTED'); } @@ -141,7 +141,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments(0, $message, $attachments, $update_count); @@ -251,7 +251,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($report_ids)) + if (count($report_ids)) { $sql = 'SELECT p.*, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru @@ -270,7 +270,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($pm_list)) + if (count($pm_list)) { $address_list = get_recipient_strings($pm_by_id); diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 60ec3b8f5a..d6d0369e48 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -38,7 +38,7 @@ function mcp_post_details($id, $mode, $action) add_form_key('mcp_post_details'); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('POST_NOT_EXIST'); } @@ -165,7 +165,7 @@ function mcp_post_details($id, $mode, $action) } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $user->add_lang('viewtopic'); $update_count = array(); @@ -409,7 +409,7 @@ function mcp_post_details($id, $mode, $action) ); } - if (sizeof($users_ary)) + if (count($users_ary)) { // Get the usernames $sql = 'SELECT user_id, username @@ -495,7 +495,7 @@ function mcp_post_details($id, $mode, $action) $user_select = ''; - if (sizeof($usernames_ary)) + if (count($usernames_ary)) { ksort($usernames_ary); @@ -656,7 +656,7 @@ function change_poster(&$post_info, $userdata) // Renew post info $post_info = phpbb_get_post_data(array($post_id), false, true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('POST_NOT_EXIST'); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index d489649649..2e0a1cf9e6 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -179,7 +179,7 @@ class mcp_queue $post_info = phpbb_get_post_data(array($post_id), 'm_approve', true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('NO_POST_SELECTED'); } @@ -230,7 +230,7 @@ class mcp_queue } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); @@ -377,7 +377,7 @@ class mcp_queue { $topic_info = phpbb_get_topic_data(array($topic_id)); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -407,7 +407,7 @@ class mcp_queue $forum_list[] = $row['forum_id']; } - if (!sizeof($forum_list)) + if (!count($forum_list)) { trigger_error('NOT_MODERATOR'); } @@ -423,7 +423,7 @@ class mcp_queue { $forum_info = phpbb_get_forum_data(array($forum_id), $m_perm); - if (!sizeof($forum_info)) + if (!count($forum_info)) { trigger_error('NOT_MODERATOR'); } @@ -493,7 +493,7 @@ class mcp_queue } $db->sql_freeresult($result); - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u @@ -565,7 +565,7 @@ class mcp_queue $db->sql_freeresult($result); } - if (sizeof($forum_names)) + if (count($forum_names)) { // Select the names for the forum_ids $sql = 'SELECT forum_id, forum_name @@ -799,7 +799,7 @@ class mcp_queue } else { - $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; } /** @@ -842,7 +842,7 @@ class mcp_queue $message .= '

          ' . $user->lang('RETURN_PAGE', '', ''); // If approving one post, also give links back to post... - if (sizeof($post_info) == 1 && $post_url) + if (count($post_info) == 1 && $post_url) { $message .= '

          ' . $user->lang('RETURN_POST', '', ''); } @@ -875,14 +875,14 @@ class mcp_queue // Create the confirm box message $action_msg = strtoupper($action); - $num_posts = sizeof($post_id_list) - $num_topics; + $num_posts = count($post_id_list) - $num_topics; if ($num_topics > 0 && $num_posts <= 0) { $action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S'); } else { - $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'); + $action_msg .= '_POST' . ((count($post_id_list) == 1) ? '' : 'S'); } confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html'); } @@ -947,9 +947,9 @@ class mcp_queue ); } - if (sizeof($topic_info) >= 1) + if (count($topic_info) >= 1) { - $success_msg = (sizeof($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; } foreach ($approve_log as $log_data) @@ -1052,7 +1052,7 @@ class mcp_queue $message .= '

          ' . $user->lang('RETURN_PAGE', '', ''); // If approving one topic, also give links back to topic... - if (sizeof($topic_info) == 1 && $topic_url) + if (count($topic_info) == 1 && $topic_url) { $message .= '

          ' . $user->lang('RETURN_TOPIC', '', ''); } @@ -1083,7 +1083,7 @@ class mcp_queue 'S_' . strtoupper($action) => true, )); - confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); + confirm_box(false, strtoupper($action) . '_TOPIC' . ((count($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } redirect($redirect); @@ -1234,8 +1234,8 @@ class mcp_queue } // Get disapproved posts/topics counts separately - $num_disapproved_topics = sizeof($disapprove_log_topics); - $num_disapproved_posts = sizeof($disapprove_log_posts); + $num_disapproved_topics = count($disapprove_log_topics); + $num_disapproved_posts = count($disapprove_log_posts); // Build the whole log $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts); @@ -1244,7 +1244,7 @@ class mcp_queue unset($post_data, $disapprove_log_topics, $disapprove_log_posts); // Let's do the job - delete disapproved posts - if (sizeof($post_disapprove_list)) + if (count($post_disapprove_list)) { if (!function_exists('delete_posts')) { @@ -1472,7 +1472,7 @@ class mcp_queue $l_confirm_msg = 'DELETE_POST_PERMANENTLY'; $confirm_template = 'confirm_delete_body.html'; } - $l_confirm_msg .= ((sizeof($post_id_list) == 1) ? '' : 'S'); + $l_confirm_msg .= ((count($post_id_list) == 1) ? '' : 'S'); $template->assign_vars(array( 'S_NOTIFY_POSTER' => $show_notify, diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 1462acf110..f5147deb49 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -53,7 +53,7 @@ class mcp_reports $report_id_list = $request->variable('report_id_list', array(0)); - if (!sizeof($report_id_list)) + if (!count($report_id_list)) { trigger_error('NO_REPORT_SELECTED'); } @@ -158,7 +158,7 @@ class mcp_reports $post_info = phpbb_get_post_data(array($post_id), 'm_report', true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('NO_REPORT_SELECTED'); } @@ -222,7 +222,7 @@ class mcp_reports } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); @@ -321,7 +321,7 @@ class mcp_reports { $topic_info = phpbb_get_topic_data(array($topic_id)); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -346,7 +346,7 @@ class mcp_reports $forum_list[] = $row['forum_id']; } - if (!sizeof($forum_list)) + if (!count($forum_list)) { trigger_error('NOT_MODERATOR'); } @@ -362,7 +362,7 @@ class mcp_reports { $forum_info = phpbb_get_forum_data(array($forum_id), 'm_report'); - if (!sizeof($forum_info)) + if (!count($forum_info)) { trigger_error('NOT_MODERATOR'); } @@ -443,7 +443,7 @@ class mcp_reports } $db->sql_freeresult($result); - if (sizeof($report_ids)) + if (count($report_ids)) { $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru @@ -617,12 +617,12 @@ function close_report($report_id_list, $mode, $action, $pm = false) } $db->sql_freeresult($result); - if (sizeof($reports)) + if (count($reports)) { $close_report_posts = array_unique($close_report_posts); $close_report_topics = array_unique($close_report_topics); - if (!$pm && sizeof($close_report_posts)) + if (!$pm && count($close_report_posts)) { // Get a list of topics that still contain reported posts $sql = 'SELECT DISTINCT topic_id @@ -658,7 +658,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } $db->sql_query($sql); - if (sizeof($close_report_posts)) + if (count($close_report_posts)) { if ($pm) { @@ -679,7 +679,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) WHERE ' . $db->sql_in_set('post_id', $close_report_posts); $db->sql_query($sql); - if (sizeof($close_report_topics)) + if (count($close_report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 @@ -721,7 +721,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } // Notify reporters - if (sizeof($notify_reporters)) + if (count($notify_reporters)) { foreach ($notify_reporters as $report_id => $reporter) { @@ -761,11 +761,11 @@ function close_report($report_id_list, $mode, $action, $pm = false) unset($notify_reporters, $post_info, $reports); - $success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS'; } else { - confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); + confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((count($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } $redirect = $request->variable('redirect', "index.$phpEx"); @@ -784,12 +784,12 @@ function close_report($report_id_list, $mode, $action, $pm = false) if (!$pm) { - if (sizeof($forum_ids) === 1) + if (count($forum_ids) === 1) { $return_forum = sprintf($user->lang['RETURN_FORUM'], '', '') . '

          '; } - if (sizeof($topic_ids) === 1) + if (count($topic_ids) === 1) { $return_topic = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

          '; } diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 76df5b3a5e..9c63245982 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -36,7 +36,7 @@ function mcp_topic_view($id, $mode, $action) $topic_id = $request->variable('t', 0); $topic_info = phpbb_get_topic_data(array($topic_id), false, true); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -97,7 +97,7 @@ function mcp_topic_view($id, $mode, $action) include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { trigger_error('NO_POST_SELECTED'); } @@ -172,7 +172,7 @@ function mcp_topic_view($id, $mode, $action) // Grab extensions $attachments = array(); - if ($topic_info['topic_attachment'] && sizeof($post_id_list)) + if ($topic_info['topic_attachment'] && count($post_id_list)) { // Get attachments... if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) @@ -326,7 +326,7 @@ function mcp_topic_view($id, $mode, $action) { $to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge'); - if (!sizeof($to_topic_info)) + if (!count($to_topic_info)) { $to_topic_id = 0; } @@ -408,7 +408,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $forum_id = $request->variable('forum_id', 0); $start = $request->variable('start', 0); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; @@ -422,7 +422,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $post_id = $post_id_list[0]; $post_info = phpbb_get_post_data(array($post_id)); - if (!sizeof($post_info)) + if (!count($post_info)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; @@ -446,7 +446,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post'); - if (!sizeof($forum_info)) + if (!count($forum_info)) { $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']); return; @@ -530,7 +530,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $db->sql_freeresult($result); } - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { trigger_error('NO_POST_SELECTED'); } @@ -628,7 +628,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } @@ -649,7 +649,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); } @@ -690,7 +690,7 @@ function merge_posts($topic_id, $to_topic_id) $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) + if (!count($topic_data) || empty($topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; @@ -707,7 +707,7 @@ function merge_posts($topic_id, $to_topic_id) $post_id_list = $request->variable('post_id_list', array(0)); $start = $request->variable('start', 0); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 45f00c9ee1..d67bc69591 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -705,10 +705,10 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { // if $tok is ']' the buffer holds a tag - if (strtolower($buffer) == '/list' && sizeof($list_end_tags)) + if (strtolower($buffer) == '/list' && count($list_end_tags)) { // valid [/list] tag, check nesting so that we don't hit false positives - if (sizeof($item_end_tags) && sizeof($item_end_tags) >= sizeof($list_end_tags)) + if (count($item_end_tags) && count($item_end_tags) >= count($list_end_tags)) { // current li tag has not been closed $out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . ']['; @@ -733,10 +733,10 @@ class bbcode_firstpass extends bbcode } else { - if (($buffer == '*' || substr($buffer, -2) == '[*') && sizeof($list_end_tags)) + if (($buffer == '*' || substr($buffer, -2) == '[*') && count($list_end_tags)) { // the buffer holds a bullet tag and we have a [list] tag open - if (sizeof($item_end_tags) >= sizeof($list_end_tags)) + if (count($item_end_tags) >= count($list_end_tags)) { if (substr($buffer, -2) == '[*') { @@ -780,11 +780,11 @@ class bbcode_firstpass extends bbcode while ($in); // do we have some tags open? close them now - if (sizeof($item_end_tags)) + if (count($item_end_tags)) { $out .= '[' . implode('][', $item_end_tags) . ']'; } - if (sizeof($list_end_tags)) + if (count($list_end_tags)) { $out .= '[' . implode('][', $list_end_tags) . ']'; } @@ -835,7 +835,7 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { - if (strtolower($buffer) == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') + if (strtolower($buffer) == '/quote' && count($close_tags) && substr($out, -1, 1) == '[') { // we have found a closing tag $out .= array_pop($close_tags) . ']'; @@ -949,7 +949,7 @@ class bbcode_firstpass extends bbcode $out .= $buffer; - if (sizeof($close_tags)) + if (count($close_tags)) { $out .= '[' . implode('][', $close_tags) . ']'; } @@ -1500,7 +1500,7 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($match)) + if (count($match)) { if ($max_smilies) { @@ -1534,7 +1534,7 @@ class parse_message extends bbcode_firstpass $error = array(); - $num_attachments = sizeof($this->attachment_data); + $num_attachments = count($this->attachment_data); $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); $upload = $request->file($form_name); $upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name'])); @@ -1571,7 +1571,7 @@ class parse_message extends bbcode_firstpass $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = $filedata['error']; - if ($filedata['post_attach'] && !sizeof($error)) + if ($filedata['post_attach'] && !count($error)) { $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], @@ -1635,7 +1635,7 @@ class parse_message extends bbcode_firstpass } } - if ($preview || $refresh || sizeof($error)) + if ($preview || $refresh || count($error)) { if (isset($this->plupload) && $this->plupload->is_active()) { @@ -1706,7 +1706,7 @@ class parse_message extends bbcode_firstpass $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = array_merge($error, $filedata['error']); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], @@ -1802,7 +1802,7 @@ class parse_message extends bbcode_firstpass $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; - if (!sizeof($attachment_data)) + if (!count($attachment_data)) { return; } @@ -1822,7 +1822,7 @@ class parse_message extends bbcode_firstpass } // Regenerate already posted attachments - if (sizeof($not_orphan)) + if (count($not_orphan)) { // Get the attachment data, based on the poster id... $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize @@ -1842,13 +1842,13 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($not_orphan)) + if (count($not_orphan)) { trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); } // Regenerate newly uploaded attachments - if (sizeof($orphan)) + if (count($orphan)) { $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize FROM ' . ATTACHMENTS_TABLE . ' @@ -1868,7 +1868,7 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($orphan)) + if (count($orphan)) { trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); } @@ -1889,7 +1889,7 @@ class parse_message extends bbcode_firstpass $tmp_message = $this->message; $poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text'])); - $poll['poll_options_size'] = sizeof($poll['poll_options']); + $poll['poll_options_size'] = count($poll['poll_options']); foreach ($poll['poll_options'] as &$poll_option) { @@ -1918,7 +1918,7 @@ class parse_message extends bbcode_firstpass } } - if (sizeof($poll['poll_options']) == 1) + if (count($poll['poll_options']) == 1) { $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 66c3109b3d..c1b623cd71 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -38,7 +38,7 @@ class ucp_attachments $delete = (isset($_POST['delete'])) ? true : false; $delete_ids = array_keys($request->variable('attachment', array(0))); - if ($delete && sizeof($delete_ids)) + if ($delete && count($delete_ids)) { // Validate $delete_ids... $sql = 'SELECT attach_id @@ -56,7 +56,7 @@ class ucp_attachments $db->sql_freeresult($result); } - if ($delete && sizeof($delete_ids)) + if ($delete && count($delete_ids)) { $s_hidden_fields = array( 'delete' => 1 @@ -75,12 +75,12 @@ class ucp_attachments unset($attachment_manager); meta_refresh(3, $this->u_action); - $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

          ' . sprintf($user->lang['RETURN_UCP'], '', ''); + $message = ((count($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

          ' . sprintf($user->lang['RETURN_UCP'], '', ''); trigger_error($message); } else { - confirm_box(false, (sizeof($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); + confirm_box(false, (count($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); } } diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index 08aacdef3a..e069f15eb2 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -55,14 +55,14 @@ class ucp_auth_link $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); // This path is only for primary actions - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { if (!check_form_key('ucp_auth_link')) { $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { // Any post data could be necessary for auth (un)linking $link_data = $request->get_super_global(\phpbb\request\request_interface::POST); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 352b7d1ec3..1fb026167a 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -71,7 +71,7 @@ class ucp_groups } $db->sql_freeresult($result); - if (!sizeof($group_row)) + if (!count($group_row)) { trigger_error('GROUP_NOT_EXIST'); } @@ -330,7 +330,7 @@ class ucp_groups $sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " + WHERE ' . ((count($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " group_type $sql_and ORDER BY group_type DESC, group_name"; $result = $db->sql_query($sql); @@ -562,7 +562,7 @@ class ucp_groups $error = array_merge($error, $colour_error); } - if (!sizeof($error)) + if (!count($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes @@ -605,7 +605,7 @@ class ucp_groups } } - if (sizeof($error)) + if (count($error)) { $error = array_map(array(&$user, 'lang'), $error); $group_rank = $submit_ary['rank']; @@ -703,12 +703,12 @@ class ucp_groups 'S_EDIT' => true, 'S_INCLUDE_SWATCH' => true, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), 'S_GROUP_MANAGE' => true, - 'ERROR_MSG' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
          ', $error) : '', 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, @@ -911,7 +911,7 @@ class ucp_groups if (confirm_box(true)) { - if (!sizeof($mark_ary)) + if (!count($mark_ary)) { $start = 0; @@ -934,7 +934,7 @@ class ucp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); - $start = (sizeof($mark_ary) < 200) ? 0 : $start + 200; + $start = (count($mark_ary) < 200) ? 0 : $start + 200; } else { @@ -1073,7 +1073,7 @@ class ucp_groups 'action' => $action ); - confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', sizeof($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); + confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', count($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); } trigger_error($user->lang['NO_USERS_ADDED'] . '

          ' . sprintf($user->lang['RETURN_PAGE'], '', '')); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 77ac1dfb54..71a615e75c 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -230,10 +230,10 @@ class ucp_main $forums = array_keys($request->variable('f', array(0 => 0))); $topics = array_keys($request->variable('t', array(0 => 0))); - if (sizeof($forums) || sizeof($topics)) + if (count($forums) || count($topics)) { $l_unwatch = ''; - if (sizeof($forums)) + if (count($forums)) { $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forums) . ' @@ -243,7 +243,7 @@ class ucp_main $l_unwatch .= '_FORUMS'; } - if (sizeof($topics)) + if (count($topics)) { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topics) . ' @@ -453,7 +453,7 @@ class ucp_main $topics = (isset($_POST['t'])) ? array_keys($request->variable('t', array(0 => 0))) : array(); $url = $this->u_action; - if (!sizeof($topics)) + if (!count($topics)) { trigger_error('NO_BOOKMARKS_SELECTED'); } @@ -508,7 +508,7 @@ class ucp_main { $drafts = array_keys($request->variable('d', array(0 => 0))); - if (sizeof($drafts)) + if (count($drafts)) { $sql = 'DELETE FROM ' . DRAFTS_TABLE . ' WHERE ' . $db->sql_in_set('draft_id', $drafts) . ' @@ -594,7 +594,7 @@ class ucp_main } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id, forum_id, topic_title FROM ' . TOPICS_TABLE . ' diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 029588bb23..a6d925f95e 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -205,7 +205,7 @@ class ucp_notifications } $template->assign_vars(array( - strtoupper($block) . '_COLS' => sizeof($notification_methods) + 1, + strtoupper($block) . '_COLS' => count($notification_methods) + 1, )); } diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 86cdb090c8..bf18e76568 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -406,7 +406,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : ''; $icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0; - if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !count($address_list) && !$refresh && !$submit && !$preview) { // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all" if ($action == 'quotepost' || !$reply_to_all) @@ -428,7 +428,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } } } - else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview) + else if ($action == 'edit' && !count($address_list) && !$refresh && !$submit && !$preview) { // Rebuild TO and BCC Header $address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address'])); @@ -561,7 +561,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) unset($list[$user->data['user_id']]); } - $max_recipients = ($max_recipients < sizeof($list)) ? sizeof($list) : $max_recipients; + $max_recipients = ($max_recipients < count($list)) ? count($list) : $max_recipients; unset($list); } @@ -584,7 +584,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Check for too many recipients - if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) + if (!empty($address_list['u']) && $max_recipients && count($address_list['u']) > $max_recipients) { $address_list = get_recipients($address_list, $max_recipients); $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); @@ -788,7 +788,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Parse Attachments - before checksum is calculated $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); - if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) + if (count($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) { $error[] = implode('
          ', $message_parser->warn_msg); $message_parser->warn_msg = array(); @@ -798,7 +798,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']); // On a refresh we do not care about message parsing errors - if (sizeof($message_parser->warn_msg) && !$refresh) + if (count($message_parser->warn_msg) && !$refresh) { $error[] = implode('
          ', $message_parser->warn_msg); } @@ -825,14 +825,14 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; } - if (!sizeof($address_list)) + if (!count($address_list)) { $error[] = $user->lang['NO_RECIPIENT']; } } // Store message, sync counters - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { $pm_data = array( 'msg_id' => (int) $msg_id, @@ -889,7 +889,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Preview - if (!sizeof($error) && $preview) + if (!count($error) && $preview) { $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); @@ -909,7 +909,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Attachment Preview - if (sizeof($message_parser->attachment_data)) + if (count($message_parser->attachment_data)) { $template->assign_var('S_HAS_ATTACHMENTS', true); @@ -929,7 +929,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $preview_subject = censor_text($subject); - if (!sizeof($error)) + if (!count($error)) { $template->assign_vars(array( 'PREVIEW_SUBJECT' => $preview_subject, @@ -943,7 +943,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Decode text for message display - $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!sizeof($error) || (sizeof($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; + $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!count($error) || (count($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; $message_parser->decode_message($bbcode_uid); @@ -1035,7 +1035,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Build address list for display // array('u' => array($author_id => 'to')); - if (sizeof($address_list)) + if (count($address_list)) { // Get Usernames and Group Names $result = array(); @@ -1198,7 +1198,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, 'S_COMPOSE_PM' => true, @@ -1300,7 +1300,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove } // If add to or add bcc not pressed, users could still have usernames listed they want to add... - if (!$add_to && !$add_bcc && (sizeof($group_list) || sizeof($usernames))) + if (!$add_to && !$add_bcc && (count($group_list) || count($usernames))) { $add_to = true; @@ -1321,7 +1321,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove { $type = ($add_to) ? 'to' : 'bcc'; - if (sizeof($group_list)) + if (count($group_list)) { foreach ($group_list as $group_id) { @@ -1333,13 +1333,13 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove $user_id_ary = array(); // Reveal the correct user_ids - if (sizeof($usernames)) + if (count($usernames)) { $user_id_ary = array(); user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE)); // If there are users not existing, we will at least print a notice... - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { $error[] = $user->lang['PM_NO_USERS']; } @@ -1408,7 +1408,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; } - if (!sizeof(array_keys($address_list['u']))) + if (!count(array_keys($address_list['u']))) { return; } @@ -1466,7 +1466,7 @@ function num_recipients($address_list) foreach ($address_list as $field => $adr_ary) { - $num_recipients += sizeof($adr_ary); + $num_recipients += count($adr_ary); } return $num_recipients; diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 2458c4118d..3861962516 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -521,7 +521,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $action_option = $request->variable('action_option', ''); $back = (isset($_REQUEST['back'])) ? $request->variable('back', array('' => 0)) : array(); - if (sizeof($back)) + if (count($back)) { if ($action_option) { diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index b5bb406d7d..2acc528b9f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -114,7 +114,7 @@ function view_folder($id, $mode, $folder_id, $folder) ); // Okay, lets dump out the page ... - if (sizeof($folder_info['pm_list'])) + if (count($folder_info['pm_list'])) { $address_list = array(); @@ -236,7 +236,7 @@ function view_folder($id, $mode, $folder_id, $folder) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($address_temp[$message_id][$ug_type]) && sizeof($address_temp[$message_id][$ug_type])) + if (isset($address_temp[$message_id][$ug_type]) && count($address_temp[$message_id][$ug_type])) { if (!isset($address[$message_id][$ug_type])) { @@ -269,8 +269,8 @@ function view_folder($id, $mode, $folder_id, $folder) // There is the chance that all recipients of the message got deleted. To avoid creating // exports without recipients, we add a bogus "undisclosed recipient". - if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) && - !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u']))) + if (!(isset($address[$message_id]['g']) && count($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && count($address[$message_id]['u']))) { $address[$message_id]['u'] = array(); $address[$message_id]['u']['to'] = array(); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index cf767a7cce..5d7e32c8f3 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -113,7 +113,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $db->sql_freeresult($result); // No attachments exist, but message table thinks they do so go ahead and reset attach flags - if (!sizeof($attachments)) + if (!count($attachments)) { $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_attachment = 0 @@ -134,7 +134,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) parse_attachments(false, $message, $attachments, $update_count); // Update the attachment download counts - if (sizeof($update_count)) + if (count($update_count)) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 @@ -240,7 +240,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_PM_ACTION' => $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'], - 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, + 'S_HAS_ATTACHMENTS' => (count($attachments)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), @@ -360,7 +360,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } // Display not already displayed Attachments for this post, we already parsed them. ;) - if (isset($attachments) && sizeof($attachments)) + if (isset($attachments) && count($attachments)) { foreach ($attachments as $attachment) { diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index c2aa910ed0..7785aeb07b 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -96,7 +96,7 @@ class ucp_prefs $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'user_allow_pm' => $data['allowpm'], @@ -188,7 +188,7 @@ class ucp_prefs $db->sql_freeresult($result); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, 'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, @@ -277,7 +277,7 @@ class ucp_prefs $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $user->optionset('viewimg', $data['images']); $user->optionset('viewflash', $data['flash']); @@ -412,7 +412,7 @@ class ucp_prefs extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_after', compact($vars))); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'S_IMAGES' => $data['images'], 'S_FLASH' => $data['flash'], diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index b7f8501fe4..beb440ce76 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -98,7 +98,7 @@ class ucp_profile $passwords_manager = $phpbb_container->get('passwords.manager'); // Only check the new password against the previous password if there have been no errors - if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) + if (!count($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) { $error[] = 'SAME_PASSWORD_ERROR'; } @@ -125,7 +125,7 @@ class ucp_profile $vars = array('data', 'submit', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], @@ -220,7 +220,7 @@ class ucp_profile $vars = array('data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars))); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -257,7 +257,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'USERNAME' => $data['username'], 'EMAIL' => $data['email'], @@ -343,7 +343,7 @@ class ucp_profile // validate custom profile fields $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error); - if (sizeof($cp_error)) + if (count($cp_error)) { $error = array_merge($error, $cp_error); } @@ -365,7 +365,7 @@ class ucp_profile $vars = array('data', 'submit', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $data['notify'] = $user->data['user_notify_type']; @@ -449,7 +449,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'S_JABBER_ENABLED' => $config['jab_enable'], 'JABBER' => $data['jabber'], )); @@ -537,7 +537,7 @@ class ucp_profile 'sig' ); - if (sizeof($warn_msg)) + if (count($warn_msg)) { $error += $warn_msg; } @@ -549,7 +549,7 @@ class ucp_profile } else { - if (!sizeof($error)) + if (!count($error)) { $user->optionset('sig_bbcode', $enable_bbcode); $user->optionset('sig_smilies', $enable_smilies); @@ -594,7 +594,7 @@ class ucp_profile $controller_helper = $phpbb_container->get('controller.helper'); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'SIGNATURE' => $decoded_message['text'], 'SIGNATURE_PREVIEW' => $signature_preview, @@ -753,7 +753,7 @@ class ucp_profile $avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'AVATAR' => $avatar, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', @@ -778,7 +778,7 @@ class ucp_profile $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { if (!empty($keys)) { @@ -825,7 +825,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index a7a93d6115..3c5f4e2826 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -167,7 +167,7 @@ class ucp_register unset($now); $template_vars = array( - 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), @@ -185,7 +185,7 @@ class ucp_register else { $template_vars = array( - 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, @@ -319,7 +319,7 @@ class ucp_register // validate custom profile fields $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); - if (!sizeof($error)) + if (!count($error)) { if ($data['new_password'] != $data['password_confirm']) { @@ -340,7 +340,7 @@ class ucp_register $vars = array('submit', 'data', 'cp_data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $server_url = generate_board_url(); @@ -596,7 +596,7 @@ class ucp_register extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); $template_vars = array_merge($template_vars, array( - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), )); diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index fa6a03f87c..b4c561fc76 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -47,7 +47,7 @@ class ucp_zebra $data[$var] = $request->variable($var, $default, true); } - if (!empty($data['add']) || sizeof($data['usernames'])) + if (!empty($data['add']) || count($data['usernames'])) { if (confirm_box(true)) { @@ -105,35 +105,35 @@ class ucp_zebra $db->sql_freeresult($result); // remove friends from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], $friends); - if (sizeof($data['add']) < $n && $mode == 'foes') + if (count($data['add']) < $n && $mode == 'foes') { $error[] = $user->lang['NOT_ADDED_FOES_FRIENDS']; } // remove foes from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], $foes); - if (sizeof($data['add']) < $n && $mode == 'friends') + if (count($data['add']) < $n && $mode == 'friends') { $error[] = $user->lang['NOT_ADDED_FRIENDS_FOES']; } // remove the user himself from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], array(utf8_clean_string($user->data['username']))); - if (sizeof($data['add']) < $n) + if (count($data['add']) < $n) { $error[] = $user->lang['NOT_ADDED_' . $l_mode . '_SELF']; } unset($friends, $foes, $n); - if (sizeof($data['add'])) + if (count($data['add'])) { $sql = 'SELECT user_id, user_type FROM ' . USERS_TABLE . ' @@ -159,7 +159,7 @@ class ucp_zebra } $db->sql_freeresult($result); - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { // Remove users from foe list if they are admins or moderators if ($mode == 'foes') @@ -175,7 +175,7 @@ class ucp_zebra $perms = array_unique($perms); - if (sizeof($perms)) + if (count($perms)) { $error[] = $user->lang['NOT_ADDED_FOES_MOD_ADMIN']; } @@ -185,7 +185,7 @@ class ucp_zebra unset($perms); } - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { $sql_mode = ($mode == 'friends') ? 'friend' : 'foe'; @@ -218,7 +218,7 @@ class ucp_zebra } unset($user_id_ary); } - else if (!sizeof($error)) + else if (!count($error)) { $error[] = $user->lang['USER_NOT_FOUND_OR_INACTIVE']; } @@ -244,7 +244,7 @@ class ucp_zebra else if ($updated) { meta_refresh(3, $this->u_action); - $message = $user->lang[$l_mode . '_UPDATED'] . '
          ' . implode('
          ', $error) . ((sizeof($error)) ? '
          ' : '') . '
          ' . sprintf($user->lang['RETURN_UCP'], '', ''); + $message = $user->lang[$l_mode . '_UPDATED'] . '
          ' . implode('
          ', $error) . ((count($error)) ? '
          ' : '') . '
          ' . sprintf($user->lang['RETURN_UCP'], '', ''); trigger_error($message); } else diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 01caf47349..89de454427 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1390,7 +1390,7 @@ function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false) { $words = explode(' ', $line); - for ($i = 0, $size = sizeof($words); $i < $size; $i++) + for ($i = 0, $size = count($words); $i < $size; $i++) { $word = $words[$i]; diff --git a/phpBB/install/convert/controller/convertor.php b/phpBB/install/convert/controller/convertor.php index 7b2a00d7b9..3639b10dc5 100644 --- a/phpBB/install/convert/controller/convertor.php +++ b/phpBB/install/convert/controller/convertor.php @@ -537,7 +537,7 @@ class convertor foreach ($prefixes as $prefix => $count) { - if ($count >= sizeof($tables)) + if ($count >= count($tables)) { $possible_prefix = $prefix; break; @@ -730,7 +730,7 @@ class convertor include_once($this->phpbb_root_path . 'install/convertors/' . $entry); if (isset($convertor_data)) { - $sort[strtolower($convertor_data['forum_name'])] = sizeof($convertors); + $sort[strtolower($convertor_data['forum_name'])] = count($convertors); $convertors[] = array( 'tag' => $m[1], diff --git a/phpBB/install/convert/convertor.php b/phpBB/install/convert/convertor.php index f7f05ebdae..5118651b71 100644 --- a/phpBB/install/convert/convertor.php +++ b/phpBB/install/convert/convertor.php @@ -312,9 +312,9 @@ class convertor } } - if (sizeof($bad_folders)) + if (count($bad_folders)) { - $msg = (sizeof($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + $msg = (count($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; sort($bad_folders); $this->error(sprintf($msg, implode('
          ', $bad_folders)), __LINE__, __FILE__, true); @@ -371,7 +371,7 @@ class convertor $val = array($val); } - for ($j = 0, $size = sizeof($val); $j < $size; ++$j) + for ($j = 0, $size = count($val); $j < $size; ++$j) { if (preg_match('/LEFT JOIN ([a-z0-9_]+) AS ([a-z0-9_]+)/i', $val[$j], $m)) { @@ -412,11 +412,11 @@ class convertor // Throw an error if some tables are missing // We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again - if (sizeof($missing_tables) == sizeof($tables_list)) + if (count($missing_tables) == count($tables_list)) { $this->error($user->lang['NO_TABLES_FOUND'] . ' ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); } - else if (sizeof($missing_tables)) + else if (count($missing_tables)) { $this->error(sprintf($user->lang['TABLES_MISSING'], implode($user->lang['COMMA_SEPARATOR'], $missing_tables)) . '

          ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); } @@ -514,7 +514,7 @@ class convertor )); // This loop takes one target table and processes it - while ($current_table < sizeof($convert->convertor['schema'])) + while ($current_table < count($convert->convertor['schema'])) { $schema = $convert->convertor['schema'][$current_table]; @@ -753,7 +753,7 @@ class convertor case 'mysqli': $waiting_rows[] = '(' . implode(', ', $insert_values) . ')'; - if (sizeof($waiting_rows) >= $convert->num_wait_rows) + if (count($waiting_rows) >= $convert->num_wait_rows) { $errored = false; @@ -809,7 +809,7 @@ class convertor $src_db->sql_freeresult($___result); // We might still have some rows waiting - if (sizeof($waiting_rows)) + if (count($waiting_rows)) { $errored = false; $db->sql_return_on_error(true); @@ -888,7 +888,7 @@ class convertor $current_table++; // $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows)); - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, sizeof($convert->convertor['schema'])); + $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, count($convert->convertor['schema'])); $this->template->assign_vars(array( 'BODY' => $msg, @@ -1126,7 +1126,7 @@ class convertor } else { - while ($last_statement < sizeof($convert->convertor['execute_last'])) + while ($last_statement < count($convert->convertor['execute_last'])) { // @codingStandardsIgnoreStart eval($convert->convertor['execute_last'][$last_statement]); @@ -1140,8 +1140,8 @@ class convertor $last_statement++; $url = $this->save_convert_progress($converter, 'jump=1&last=' . $last_statement); - $percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement)); - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage); + $percentage = ($last_statement == 0) ? 0 : floor(100 / (count($convert->convertor['execute_last']) / $last_statement)); + $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, count($convert->convertor['execute_last']), $percentage); $this->template->assign_vars(array( 'L_SUBMIT' => $user->lang['CONTINUE_LAST'], diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 6f43e1915e..8b80eec4c8 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1071,7 +1071,7 @@ function phpbb_convert_authentication($mode) } } - if (sizeof($forum_ids)) + if (count($forum_ids)) { // Now make sure the user is able to read these forums $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids); @@ -1267,7 +1267,7 @@ function phpbb_prepare_message($message) // parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') $message_parser->parse($enable_bbcode, $enable_magic_url, $enable_smilies); - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $msg_id = isset($convert->row['post_id']) ? $convert->row['post_id'] : $convert->row['privmsgs_id']; $convert->p_master->error('' . $user->lang['POST_ID'] . ': ' . $msg_id . ' ' . $user->lang['CONV_ERROR_MESSAGE_PARSER'] . ':

          ' . implode('
          ', $message_parser->warn_msg), __LINE__, __FILE__, true); @@ -1495,7 +1495,7 @@ function phpbb_attachment_forum_perms($forum_permissions) $forum_ids[] = (int) $forum_id; } - if (sizeof($forum_ids)) + if (count($forum_ids)) { return attachment_forum_perms($forum_ids); } @@ -1860,7 +1860,7 @@ function phpbb_check_username_collisions() $db->sql_freeresult($result); // there was at least one collision, the admin will have to solve it before conversion can continue - if (sizeof($colliding_names)) + if (count($colliding_names)) { $sql = 'SELECT user_id, username_clean FROM ' . USERCONV_TABLE . ' diff --git a/phpBB/mcp.php b/phpBB/mcp.php index a5464f4a73..c4a8a66c18 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -36,7 +36,7 @@ $template->assign_var('S_IN_MCP', true); $id = $request->variable('i', ''); $mode = $request->variable('mode', array('')); -$mode = sizeof($mode) ? array_shift($mode) : $request->variable('mode', ''); +$mode = count($mode) ? array_shift($mode) : $request->variable('mode', ''); // Only Moderators can go beyond this point if (!$user->data['is_registered']) @@ -59,7 +59,7 @@ if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\requ $action = $forum_action; } -if (sizeof($action_ary)) +if (count($action_ary)) { list($action, ) = each($action_ary); } diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 985b45acf7..977857da59 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -719,7 +719,7 @@ switch ($mode) 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'), 'S_GROUP_OPTIONS' => $group_options, - 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false, + 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false, 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', @@ -933,7 +933,7 @@ switch ($mode) // We validate form and field here, only id/class allowed $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; - if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + if ((($mode == '' || $mode == 'searchuser') || count(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) { $username = $request->variable('username', '', true); $email = strtolower($request->variable('email', '')); @@ -980,7 +980,7 @@ switch ($mode) $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : ''; $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : ''; - if (isset($find_key_match[$joined_select]) && sizeof($joined) == 3) + if (isset($find_key_match[$joined_select]) && count($joined) == 3) { $joined_time = gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]); @@ -990,7 +990,7 @@ switch ($mode) } } - if (isset($find_key_match[$active_select]) && sizeof($active) == 3 && $auth->acl_get('u_viewonline')) + if (isset($find_key_match[$active_select]) && count($active) == 3 && $auth->acl_get('u_viewonline')) { $active_time = gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); @@ -1449,7 +1449,7 @@ switch ($mode) $leaders_set = false; // So, did we get any users? - if (sizeof($user_list)) + if (count($user_list)) { // Session time?! Session time... $sql = 'SELECT session_user_id, MAX(session_time) AS session_time @@ -1534,7 +1534,7 @@ switch ($mode) $vars = array('user_list', 'use_contact_fields'); extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars))); - for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) + for ($i = 0, $end = count($user_list); $i < $end; ++$i) { $user_id = $user_list[$i]; $row = $id_cache[$user_id]; @@ -1550,21 +1550,21 @@ switch ($mode) $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( 'ROW_NUMBER' => $i + ($start + 1), - 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_GROUP_LEADER' => $is_leader, 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']), )); - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $memberrow = array_merge($memberrow, $cp_row['row']); } $template->assign_block_vars('memberrow', $memberrow); - if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow'])) + if (isset($cp_row['blockrow']) && count($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { diff --git a/phpBB/phpbb/attachment/resync.php b/phpBB/phpbb/attachment/resync.php index 6c2e0a8b0d..aeacf82511 100644 --- a/phpBB/phpbb/attachment/resync.php +++ b/phpBB/phpbb/attachment/resync.php @@ -87,7 +87,7 @@ class resync */ public function resync($type, $ids) { - if (empty($type) || !is_array($ids) || !sizeof($ids) || !in_array($type, array('post', 'topic', 'message'))) + if (empty($type) || !is_array($ids) || !count($ids) || !in_array($type, array('post', 'topic', 'message'))) { return; } @@ -112,7 +112,7 @@ class resync // Now only unset those ids remaining $ids = array_diff($ids, $remaining_ids); - if (sizeof($ids)) + if (count($ids)) { $sql = 'UPDATE ' . $this->resync_table . ' SET ' . $type . '_attachment = 0 diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index f9863b372c..b9d32058db 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -162,7 +162,7 @@ class upload // Make sure the image category only holds valid images... $this->check_image($is_image); - if (sizeof($this->file->error)) + if (count($this->file->error)) { $this->file->remove(); $this->file_data['error'] = array_merge($this->file_data['error'], $this->file->error); diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index dbd83f1eb0..f46a21a8ae 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -72,8 +72,8 @@ class auth // Verify bitstring length with options provided... $renew = false; - $global_length = sizeof($this->acl_options['global']); - $local_length = sizeof($this->acl_options['local']); + $global_length = count($this->acl_options['global']); + $local_length = count($this->acl_options['local']); // Specify comparing length (bitstring is padded to 31 bits) $global_length = ($global_length % 31) ? ($global_length - ($global_length % 31) + 31) : $global_length; @@ -236,7 +236,7 @@ class auth $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE; - if (sizeof($this->acl)) + if (count($this->acl)) { $sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($this->acl), true); } @@ -278,7 +278,7 @@ class auth } // If we get forum_ids not having this permission, we need to fill the remaining parts - if ($negate && sizeof($this->acl_forum_ids)) + if ($negate && count($this->acl_forum_ids)) { foreach ($this->acl_forum_ids as $f) { @@ -455,7 +455,7 @@ class auth { $hold_str = ''; - if (sizeof($hold_ary)) + if (count($hold_ary)) { ksort($hold_ary); diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index c48b771ab0..0789a6234d 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -99,7 +99,7 @@ class ldap extends \phpbb\auth\provider\base @ldap_close($ldap); - if (!is_array($result) || sizeof($result) < 2) + if (!is_array($result) || count($result) < 2) { return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']); } @@ -192,7 +192,7 @@ class ldap extends \phpbb\auth\provider\base $ldap_result = @ldap_get_entries($ldap, $search); - if (is_array($ldap_result) && sizeof($ldap_result) > 1) + if (is_array($ldap_result) && count($ldap_result) > 1) { if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password))) { diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index fdc5f57df0..5587e69d3c 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -635,7 +635,7 @@ class oauth extends \phpbb\auth\provider\base $oauth_user_ids = array(); - if ($rows !== false && sizeof($rows)) + if ($rows !== false && count($rows)) { foreach ($rows as $row) { diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f5547c4bc6..8b773017c5 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -64,7 +64,7 @@ class local extends \phpbb\avatar\driver\driver $table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4; $row_count = $col_count = $avatar_pos = 0; - $avatar_count = sizeof($avatar_list[$category]); + $avatar_count = count($avatar_list[$category]); reset($avatar_list[$category]); diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 887a0ff258..d765a27871 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -167,7 +167,7 @@ class upload extends \phpbb\avatar\driver\driver $file->clean_filename('avatar', $prefix, $row['id']); // If there was an error during upload, then abort operation - if (sizeof($file->error)) + if (count($file->error)) { $file->remove(); $error = $file->error; @@ -221,7 +221,7 @@ class upload extends \phpbb\avatar\driver\driver unset($filedata); - if (!sizeof($error)) + if (!count($error)) { // Move file and overwrite any existing image $file->move_file($destination, true); @@ -229,7 +229,7 @@ class upload extends \phpbb\avatar\driver\driver // If there was an error during move, then clean up leftovers $error = array_merge($error, $file->error); - if (sizeof($error)) + if (count($error)) { $file->remove(); return false; @@ -291,7 +291,7 @@ class upload extends \phpbb\avatar\driver\driver ); extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars))); - if (!sizeof($error) && $this->filesystem->exists($filename)) + if (!count($error) && $this->filesystem->exists($filename)) { try { diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index f4b3dc278d..3eca521148 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -123,7 +123,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_fetchrow($query_id) { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id])) { return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; } @@ -136,7 +136,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_fetchfield($query_id, $field) { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id])) { return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false; } @@ -149,7 +149,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_rowseek($rownum, $query_id) { - if ($rownum >= sizeof($this->sql_rowset[$query_id])) + if ($rownum >= count($this->sql_rowset[$query_id])) { return false; } diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index e9d2ba8e04..de6f444251 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -135,7 +135,7 @@ class file extends \phpbb\cache\driver\base if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } @@ -290,7 +290,7 @@ class file extends \phpbb\cache\driver\base } else { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index cc03804705..052f40c243 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -188,7 +188,7 @@ abstract class memory extends \phpbb\cache\driver\base } else { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index 8a4366fed1..502ae27625 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -227,7 +227,7 @@ class service // Store allowed extensions forum wise if ($row['allow_group']) { - $extensions['_allowed_post'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums; + $extensions['_allowed_post'][$extension] = (!count($allowed_forums)) ? 0 : $allowed_forums; } if ($row['allow_in_pm']) diff --git a/phpBB/phpbb/captcha/char_cube3d.php b/phpBB/phpbb/captcha/char_cube3d.php index a712b16dce..0255259ac4 100644 --- a/phpBB/phpbb/captcha/char_cube3d.php +++ b/phpBB/phpbb/captcha/char_cube3d.php @@ -220,7 +220,7 @@ class char_cube3d */ function scale($vector, $length) { - if (sizeof($vector) == 2) + if (count($vector) == 2) { return array($vector[0] * $length, $vector[1] * $length); } diff --git a/phpBB/phpbb/captcha/colour_manager.php b/phpBB/phpbb/captcha/colour_manager.php index 6ca3c3fd2c..82332da810 100644 --- a/phpBB/phpbb/captcha/colour_manager.php +++ b/phpBB/phpbb/captcha/colour_manager.php @@ -256,7 +256,7 @@ class colour_manager if (is_array($resource)) { $results = array(); - for ($i = 0, $size = sizeof($resource); $i < $size; ++$i) + for ($i = 0, $size = count($resource); $i < $size; ++$i) { $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original)); } diff --git a/phpBB/phpbb/captcha/gd.php b/phpBB/phpbb/captcha/gd.php index e9538439c6..91b2f89d81 100644 --- a/phpBB/phpbb/captcha/gd.php +++ b/phpBB/phpbb/captcha/gd.php @@ -100,7 +100,7 @@ class gd $noise_bitmaps = $this->captcha_noise_bg_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { - $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data']))); + $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data']))); $noise[$i]->range(); //$box = $noise[$i]->dimensions($sizes[$i]); @@ -1658,32 +1658,32 @@ class gd 'height' => 15, 'data' => array( - 'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)], - 'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)], - 'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)], - 'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)], - 'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)], - 'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)], - 'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)], - 'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)], - 'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)], - 'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)], - 'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)], - 'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)], - 'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)], - 'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)], - 'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)], - 'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)], - 'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)], - 'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)], - 'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)], - 'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)], - 'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)], - 'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)], - 'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)], - 'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)], - 'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)], - 'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)], + 'A' => $chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)], + 'B' => $chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)], + 'C' => $chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)], + 'D' => $chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)], + 'E' => $chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)], + 'F' => $chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)], + 'G' => $chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)], + 'H' => $chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)], + 'I' => $chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)], + 'J' => $chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)], + 'K' => $chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)], + 'L' => $chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)], + 'M' => $chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)], + 'N' => $chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)], + 'O' => $chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)], + 'P' => $chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)], + 'Q' => $chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)], + 'R' => $chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)], + 'S' => $chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)], + 'T' => $chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)], + 'U' => $chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)], + 'V' => $chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)], + 'W' => $chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)], + 'X' => $chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)], + 'Y' => $chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)], + 'Z' => $chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)], '1' => array( array(0,0,0,1,1,0,0,0,0), diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php index 82b08704ff..b508767d17 100644 --- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php +++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php @@ -169,7 +169,7 @@ abstract class captcha_abstract } while ($row = $db->sql_fetchrow($result)); - if (sizeof($sql_in)) + if (count($sql_in)) { $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' WHERE ' . $db->sql_in_set('session_id', $sql_in); diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 9d481acc5d..7797212ac9 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -84,7 +84,7 @@ class qa $db->sql_freeresult($result); // fallback to the board default lang - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { $this->question_lang = $config['default_lang']; @@ -101,7 +101,7 @@ class qa } // final fallback to any language - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { $this->question_lang = ''; @@ -311,7 +311,7 @@ class qa } while ($row = $db->sql_fetchrow($result)); - if (sizeof($sql_in)) + if (count($sql_in)) { $sql = 'DELETE FROM ' . $this->table_qa_confirm . ' WHERE ' . $db->sql_in_set('confirm_id', $sql_in); @@ -395,7 +395,7 @@ class qa $error = ''; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { /** @var \phpbb\log\log_interface $phpbb_log */ $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); @@ -439,7 +439,7 @@ class qa { global $db, $user; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { return; } @@ -465,7 +465,7 @@ class qa { global $db, $user; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { return; } @@ -536,7 +536,7 @@ class qa { global $db, $user; - if (!strlen($this->confirm_id) || !sizeof($this->question_ids)) + if (!strlen($this->confirm_id) || !count($this->question_ids)) { return false; } @@ -979,7 +979,7 @@ class qa if (!isset($langs[$question_data['lang_iso']]) || !strlen($question_data['question_text']) || - !sizeof($question_data['answers']) || + !count($question_data['answers']) || !is_array($question_data['answers'])) { return false; diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php index cfa9891fbc..9f2ee822be 100644 --- a/phpBB/phpbb/console/command/thumbnail/delete.php +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -107,7 +107,7 @@ class delete extends \phpbb\console\command\command { $thumbnail_deleted[] = $row['attach_id']; - if (sizeof($thumbnail_deleted) === 250) + if (count($thumbnail_deleted) === 250) { $this->commit_changes($thumbnail_deleted); $thumbnail_deleted = array(); diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 237300894b..f023e0742c 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -334,7 +334,7 @@ class content_visibility AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; // If user has moderator permissions, add everything in the moderated forums - if (sizeof($approve_forums)) + if (count($approve_forums)) { $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); } @@ -584,7 +584,7 @@ class content_visibility $sql_ary[$recipient_field] = " + $count_increase"; } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $forum_sql = array(); diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 50dce35baa..2859945915 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -267,7 +267,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base unset($row['line2'], $row['line3']); } } - return (sizeof($row)) ? $row : false; + return (count($row)) ? $row : false; } /** diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index 54238a15ef..5fd14709f8 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -136,7 +136,7 @@ class oracle extends \phpbb\db\driver\driver */ function _rewrite_col_compare($args) { - if (sizeof($args) == 4) + if (count($args) == 4) { if ($args[2] == '=') { @@ -290,7 +290,7 @@ class oracle extends \phpbb\db\driver\driver and/or need the db restore script, uncomment this. - if (sizeof($cols) !== sizeof($vals)) + if (count($cols) !== count($vals)) { // Try to replace some common data we know is from our restore script or from other sources $regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]); @@ -332,7 +332,7 @@ class oracle extends \phpbb\db\driver\driver if ($string) { // New value if cols != value - $vals[(sizeof($cols) !== sizeof($vals)) ? $i : $i - 1] .= $string; + $vals[(count($cols) !== count($vals)) ? $i : $i - 1] .= $string; } $vals = array(0 => $vals); diff --git a/phpBB/phpbb/db/extractor/mssql_extractor.php b/phpBB/phpbb/db/extractor/mssql_extractor.php index 2817d3ebcc..4eeab4780e 100644 --- a/phpBB/phpbb/db/extractor/mssql_extractor.php +++ b/phpBB/phpbb/db/extractor/mssql_extractor.php @@ -132,14 +132,14 @@ class mssql_extractor extends base_extractor $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - if (!sizeof($rows)) + if (!count($rows)) { $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n"; $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n"; } $rows[] = "\t\t[{$row['COLUMN_NAME']}]"; } - if (sizeof($rows)) + if (count($rows)) { $sql_data .= implode(",\n", $rows); $sql_data .= "\n\t) ON [PRIMARY] \nGO\n"; diff --git a/phpBB/phpbb/db/extractor/oracle_extractor.php b/phpBB/phpbb/db/extractor/oracle_extractor.php index 79a991889b..bc43a37b10 100644 --- a/phpBB/phpbb/db/extractor/oracle_extractor.php +++ b/phpBB/phpbb/db/extractor/oracle_extractor.php @@ -82,7 +82,7 @@ class oracle_extractor extends base_extractor } $this->db->sql_freeresult($result); - if (sizeof($primary_key)) + if (count($primary_key)) { $rows[] = " CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')'; } @@ -103,7 +103,7 @@ class oracle_extractor extends base_extractor } $this->db->sql_freeresult($result); - if (sizeof($unique)) + if (count($unique)) { $rows[] = " CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')'; } diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index f50ab33830..a7e30a9cb7 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -133,7 +133,7 @@ class style_update_p1 extends \phpbb\db\migration\migration } // Remove old entries from styles table - if (!sizeof($valid_styles)) + if (!count($valid_styles)) { // No valid styles: remove everything and add prosilver $this->sql_query('DELETE FROM ' . STYLES_TABLE); diff --git a/phpBB/phpbb/db/migration/data/v310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php index f8edbc3492..3a37b17e97 100644 --- a/phpBB/phpbb/db/migration/data/v310/teampage.php +++ b/phpBB/phpbb/db/migration/data/v310/teampage.php @@ -93,13 +93,13 @@ class teampage extends \phpbb\db\migration\migration $teampage_entries[] = array( 'group_id' => (int) $row['group_id'], 'teampage_name' => '', - 'teampage_position' => sizeof($teampage_entries) + 1, + 'teampage_position' => count($teampage_entries) + 1, 'teampage_parent' => 0, ); } $this->db->sql_freeresult($result); - if (sizeof($teampage_entries)) + if (count($teampage_entries)) { $this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries); } diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 33aa8ff026..a351c4858e 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -134,7 +134,7 @@ class config implements \phpbb\db\migration\tool\tool_interface case 'remove': $call = 'add'; - if (sizeof($arguments) == 1) + if (count($arguments) == 1) { $arguments[] = ''; } diff --git a/phpBB/phpbb/db/migration/tool/config_text.php b/phpBB/phpbb/db/migration/tool/config_text.php index 54b45f6f6d..5fe9a25b70 100644 --- a/phpBB/phpbb/db/migration/tool/config_text.php +++ b/phpBB/phpbb/db/migration/tool/config_text.php @@ -110,7 +110,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface case 'remove': $call = 'add'; - if (sizeof($arguments) == 1) + if (count($arguments) == 1) { $arguments[] = ''; } diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 238e063a87..7d2720c861 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -515,7 +515,7 @@ class module implements \phpbb\db\migration\tool\tool_interface $parent_id = $parent_id ?: 0; // If automatic adding is in action, convert array back to string to simplify things - if (is_array($data) && sizeof($data) == 1) + if (is_array($data) && count($data) == 1) { $data = $data['module_langname']; } @@ -528,7 +528,7 @@ class module implements \phpbb\db\migration\tool\tool_interface // Search for the parent module_langname $ids = array_keys($this->module_categories, $parent_id); - switch (sizeof($ids)) + switch (count($ids)) { // No parent with the given module_langname exist case 0: diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 9688420025..4b53aa32a7 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -442,7 +442,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface } ); - if (sizeof($auth_option)) + if (count($auth_option)) { return $this->permission_set($role_name, $auth_option, 'role', $has_permission); } diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 6c026c3ae1..a425df56e8 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -632,7 +632,7 @@ class migrator */ protected function process_data_step($steps, $state, $revert = false) { - if (sizeof($steps) === 0) + if (count($steps) === 0) { return true; } @@ -659,7 +659,7 @@ class migrator // Result will be null or true if everything completed correctly // Stop after each update step, to let the updater control the script runtime $result = $this->run_step($steps[$step], $last_result, $revert); - if (($result !== null && $result !== true) || $step + 1 < sizeof($steps)) + if (($result !== null && $result !== true) || $step + 1 < count($steps)) { return array( 'result' => $result, diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index 18e4814a77..30e807b154 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -92,7 +92,7 @@ class sql_insert_buffer // Flush buffer if it is full or when DB does not support multi inserts. // In the later case, the buffer will always only contain one row. - if (!$this->db->get_multi_insert() || sizeof($this->buffer) >= $this->max_buffered_rows) + if (!$this->db->get_multi_insert() || count($this->buffer) >= $this->max_buffered_rows) { return $this->flush(); } @@ -104,7 +104,7 @@ class sql_insert_buffer * Inserts a row set, i.e. an array of rows, by calling insert(). * * Please note that it is in most cases better to use insert() instead of - * first building a huge rowset. Or at least sizeof($rows) should be kept + * first building a huge rowset. Or at least count($rows) should be kept * small. * * @param array $rows diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index 23b49aab44..8b95b7070e 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -440,7 +440,7 @@ class mssql extends tools { $result = $this->sql_index_drop($table_name, $index_name); $statements = array_merge($statements, $result); - if (sizeof($index_data) > 1) + if (count($index_data) > 1) { // Remove this column from the index and recreate it $recreate_indexes[$index_name] = array_diff($index_data, array($column_name)); diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index e042d0a5d1..bec91d04f4 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -87,7 +87,7 @@ class md_exporter $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); } - return sizeof($this->events); + return count($this->events); } /** @@ -113,7 +113,7 @@ class md_exporter } } - return sizeof($this->events); + return count($this->events); } /** @@ -219,7 +219,7 @@ class md_exporter ); } - return sizeof($this->events); + return count($this->events); } /** diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 7b80863305..64d1e429b7 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -117,7 +117,7 @@ class php_exporter } ksort($this->events); - return sizeof($this->events); + return count($this->events); } /** @@ -199,7 +199,7 @@ class php_exporter if (strpos($content, 'dispatcher->trigger_event(') || strpos($content, 'dispatcher->dispatch(')) { $this->set_content(explode("\n", $content)); - for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++) + for ($i = 0, $num_lines = count($this->file_lines); $i < $num_lines; $i++) { $event_line = false; $found_trigger_event = strpos($this->file_lines[$i], 'dispatcher->trigger_event('); @@ -397,7 +397,7 @@ class php_exporter if (isset($match[2])) { $vars_array = explode("', '", $match[2]); - if ($throw_multiline && sizeof($vars_array) > 6) + if ($throw_multiline && count($vars_array) > 6) { throw new \LogicException('Should use multiple lines for $vars definition ' . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); @@ -460,7 +460,7 @@ class php_exporter if (strpos($var_line, '* @var ') === 0) { $doc_line = explode(' ', $var_line, 5); - if (sizeof($doc_line) !== 5) + if (count($doc_line) !== 5) { throw new \LogicException("Found invalid line '{$this->file_lines[$this->current_event_line - $current_doc_line]}' " . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); @@ -707,9 +707,9 @@ class php_exporter { $vars_array = array_unique($vars_array); $vars_docblock = array_unique($vars_docblock); - $sizeof_vars_array = sizeof($vars_array); + $sizeof_vars_array = count($vars_array); - if ($sizeof_vars_array !== sizeof($vars_docblock) || $sizeof_vars_array !== sizeof(array_intersect($vars_array, $vars_docblock))) + if ($sizeof_vars_array !== count($vars_docblock) || $sizeof_vars_array !== count(array_intersect($vars_array, $vars_docblock))) { throw new \LogicException("\$vars array does not match the list of '@var' tags for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php index f1a32ef4a8..6847bca4cb 100644 --- a/phpBB/phpbb/files/filespec.php +++ b/phpBB/phpbb/files/filespec.php @@ -121,7 +121,7 @@ class filespec */ public function set_upload_ary($upload_ary) { - if (!isset($upload_ary) || !sizeof($upload_ary)) + if (!isset($upload_ary) || !count($upload_ary)) { return $this; } @@ -403,7 +403,7 @@ class filespec */ public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) { - if (sizeof($this->error)) + if (count($this->error)) { return false; } @@ -478,7 +478,7 @@ class filespec // Remove temporary filename @unlink($this->filename); - if (sizeof($this->error)) + if (count($this->error)) { return false; } diff --git a/phpBB/phpbb/files/types/form.php b/phpBB/phpbb/files/types/form.php index 832f090c47..2c3beb6e02 100644 --- a/phpBB/phpbb/files/types/form.php +++ b/phpBB/phpbb/files/types/form.php @@ -119,7 +119,7 @@ class form extends base // PHP Upload file size check $file = $this->check_upload_size($file); - if (sizeof($file->error)) + if (count($file->error)) { return $file; } diff --git a/phpBB/phpbb/files/types/local.php b/phpBB/phpbb/files/types/local.php index 7e9210b196..4dfe4f7506 100644 --- a/phpBB/phpbb/files/types/local.php +++ b/phpBB/phpbb/files/types/local.php @@ -86,7 +86,7 @@ class local extends base // PHP Upload file size check $file = $this->check_upload_size($file); - if (sizeof($file->error)) + if (count($file->error)) { return $file; } diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 2112882d1d..3f39448f05 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -171,7 +171,7 @@ class filesystem implements filesystem_interface continue; } - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') + if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..') { array_pop($filtered); } @@ -671,7 +671,7 @@ class filesystem implements filesystem_interface else if (function_exists('debug_backtrace')) { $call_stack = debug_backtrace(0); - $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[sizeof($call_stack) - 1]['file'])); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file'])); } else { @@ -683,7 +683,7 @@ class filesystem implements filesystem_interface //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); - //$namespace_part_count = sizeof($namespace_parts); + //$namespace_part_count = count($namespace_parts); // Check if we still loading from root //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) @@ -807,7 +807,7 @@ class filesystem implements filesystem_interface array_pop($resolved); $resolved_path = false; } - else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[sizeof($resolved) - 1], array('.', '..'))) + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..'))) { array_pop($resolved); $resolved_path = false; diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 59b86a8ca7..ad0f3dd3cd 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -372,7 +372,7 @@ class database $tables = array_map('strtolower', $tables); $table_intersect = array_intersect($tables, $table_ary); - if (sizeof($table_intersect)) + if (count($table_intersect)) { $errors[] = array( 'title' => 'INST_ERR_PREFIX', diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index dd584eff30..2a608f504e 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -204,7 +204,7 @@ class ajax_iohandler extends iohandler_base if (in_array($input_options['type'], array('select', 'radio'), true)) { - for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) + for ($i = 0, $total = count($input_options['options']); $i < $total; $i++) { if (isset($input_options['options'][$i]['label'])) { @@ -381,7 +381,7 @@ class ajax_iohandler extends iohandler_base */ public function set_active_stage_menu($menu_path) { - $this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1]; + $this->nav_data['active'] = $menu_path[count($menu_path) - 1]; $this->send_response(); } @@ -390,7 +390,7 @@ class ajax_iohandler extends iohandler_base */ public function set_finished_stage_menu($menu_path) { - $this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1]; + $this->nav_data['finished'][] = $menu_path[count($menu_path) - 1]; $this->send_response(); } diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php index 1f1cecceb2..07f8e025cf 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_bots.php +++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php @@ -239,7 +239,7 @@ class add_bots extends \phpbb\install\task_base $this->install_config->set('add_bot_index', $i); - if ($i < sizeof($this->bot_list)) + if ($i < count($this->bot_list)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php index d21a5be823..b64f4c31db 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_modules.php +++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php @@ -169,7 +169,7 @@ class add_modules extends \phpbb\install\task_base $this->db->sql_return_on_error(true); $module_classes = array('acp', 'mcp', 'ucp'); - $total = sizeof($module_classes); + $total = count($module_classes); $i = $this->config->get('module_class_index', 0); $module_classes = array_slice($module_classes, $i); diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php index 8002e3ed97..54114e3f9c 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -327,7 +327,7 @@ class add_config_settings extends \phpbb\install\task_base } $i = $this->install_config->get('add_config_settings_index', 0); - $total = sizeof($sql_ary); + $total = count($sql_ary); $sql_ary = array_slice($sql_ary, $i); foreach ($sql_ary as $sql) diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php index e32101a3f7..c05e5321fb 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php +++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php @@ -99,7 +99,7 @@ class add_default_data extends \phpbb\install\task_base $sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']); $i = $this->config->get('add_default_data_index', 0); - $total = sizeof($sql_query); + $total = count($sql_query); $sql_query = array_slice($sql_query, $i); foreach ($sql_query as $sql) diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php index f344f91582..dc814f36ef 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_tables.php +++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php @@ -101,7 +101,7 @@ class add_tables extends \phpbb\install\task_base $db_table_schema = @file_get_contents($this->schema_file_path); $db_table_schema = json_decode($db_table_schema, true); - $total = sizeof($db_table_schema); + $total = count($db_table_schema); $i = $this->config->get('add_table_index', 0); $db_table_schema = array_slice($db_table_schema, $i); diff --git a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php index eee13a6581..47ea156c66 100644 --- a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php +++ b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php @@ -157,7 +157,7 @@ class install_extensions extends \phpbb\install\task_base $this->install_config->set('install_extensions_index', $i); - if ($i < sizeof($all_available_extensions)) + if ($i < count($all_available_extensions)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/update_database/task/update_extensions.php b/phpBB/phpbb/install/module/update_database/task/update_extensions.php index b66847b243..0195b9c661 100644 --- a/phpBB/phpbb/install/module/update_database/task/update_extensions.php +++ b/phpBB/phpbb/install/module/update_database/task/update_extensions.php @@ -206,7 +206,7 @@ class update_extensions extends task_base $this->install_config->set('update_extensions_index', $i); - if ($i < sizeof($all_available_extensions)) + if ($i < count($all_available_extensions)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 8151a24f2d..2f6048b4fd 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -145,7 +145,7 @@ class diff_files extends task_base { $file_contents[] = file_get_contents($file_to_diff); - if ($file_contents[sizeof($file_contents) - 1] === false) + if ($file_contents[count($file_contents) - 1] === false) { $this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff)); unset($file_contents); diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php index 42429c2c07..51e6d0b185 100644 --- a/phpBB/phpbb/language/language.php +++ b/phpBB/phpbb/language/language.php @@ -312,7 +312,7 @@ class language // Replace key with language entry and simply pass along... return vsprintf($lang, $args); } - else if (sizeof($lang) == 0) + else if (count($lang) == 0) { // If the language entry is an empty array, we just return the language key return $key; @@ -322,7 +322,7 @@ class language $key_found = false; // We now get the first number passed and will select the key based upon this number - for ($i = 0, $num_args = sizeof($args); $i < $num_args; $i++) + for ($i = 0, $num_args = count($args); $i < $num_args; $i++) { if (is_int($args[$i]) || is_float($args[$i])) { diff --git a/phpBB/phpbb/language/language_file_loader.php b/phpBB/phpbb/language/language_file_loader.php index 359202fd63..b6816afd16 100644 --- a/phpBB/phpbb/language/language_file_loader.php +++ b/phpBB/phpbb/language/language_file_loader.php @@ -127,7 +127,7 @@ class language_file_loader // the first directory from the path (that should be the language directory) $path_diff_parts = explode('/', $path_diff); - if (sizeof($path_diff_parts) > 1) + if (count($path_diff_parts) > 1) { array_shift($path_diff_parts); $component = implode('/', $path_diff_parts) . '/'; diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index dcc4cdde51..5333fe2bdf 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -391,7 +391,7 @@ class log implements \phpbb\log\log_interface { $sql_where .= ' AND '; - if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + if (is_array($field_value) && count($field_value) == 2 && !is_array($field_value[1])) { $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; } @@ -689,9 +689,9 @@ class log implements \phpbb\log\log_interface } } - if (($num_args - sizeof($log_data_ary)) > 0) + if (($num_args - count($log_data_ary)) > 0) { - $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), '')); + $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - count($log_data_ary), '')); } $lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary); @@ -740,7 +740,7 @@ class log implements \phpbb\log\log_interface $vars = array('log', 'topic_id_list', 'reportee_id_list'); extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars))); - if (sizeof($topic_id_list)) + if (count($topic_id_list)) { $topic_auth = $this->get_topic_auth($topic_id_list); @@ -752,7 +752,7 @@ class log implements \phpbb\log\log_interface } } - if (sizeof($reportee_id_list)) + if (count($reportee_id_list)) { $reportee_data_list = $this->get_reportee_data($reportee_id_list); @@ -838,7 +838,7 @@ class log implements \phpbb\log\log_interface $keywords_pattern = array(); // Build pattern and keywords... - for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) + for ($i = 0, $num_keywords = count($keywords); $i < $num_keywords; $i++) { $keywords_pattern[] = preg_quote($keywords[$i], '#'); $keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char()); diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php index 21d4de0b4d..63bada91ff 100644 --- a/phpBB/phpbb/message/form.php +++ b/phpBB/phpbb/message/form.php @@ -139,7 +139,7 @@ abstract class form $this->errors[] = 'FORM_INVALID'; } - if (!sizeof($this->errors)) + if (!count($this->errors)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_emailtime = ' . time() . ' @@ -169,7 +169,7 @@ abstract class form add_form_key('memberlist_email'); $template->assign_vars(array( - 'ERROR_MESSAGE' => (sizeof($this->errors)) ? implode('
          ', $this->errors) : '', + 'ERROR_MESSAGE' => (count($this->errors)) ? implode('
          ', $this->errors) : '', )); } } diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php index 5fd24b542e..fa701d1c77 100644 --- a/phpBB/phpbb/message/message.php +++ b/phpBB/phpbb/message/message.php @@ -209,7 +209,7 @@ class message */ public function cc_sender() { - if (!sizeof($this->recipients)) + if (!count($this->recipients)) { trigger_error('No email recipients specified'); } @@ -238,7 +238,7 @@ class message */ public function send(\messenger $messenger, $contact) { - if (!sizeof($this->recipients)) + if (!count($this->recipients)) { return; } @@ -271,7 +271,7 @@ class message 'MESSAGE' => htmlspecialchars_decode($this->body)) ); - if (sizeof($this->template_vars)) + if (count($this->template_vars)) { $messenger->assign_vars($this->template_vars); } diff --git a/phpBB/phpbb/module/module_manager.php b/phpBB/phpbb/module/module_manager.php index 67bac5b33e..00df33f62f 100644 --- a/phpBB/phpbb/module/module_manager.php +++ b/phpBB/phpbb/module/module_manager.php @@ -311,7 +311,7 @@ class module_manager // we're turning a category into a module $branch = $this->get_module_branch($module_data['module_id'], $module_data['module_class'], 'children', false); - if (sizeof($branch)) + if (count($branch)) { throw new module_not_found_exception('NO_CATEGORY_TO_MODULE'); } @@ -353,10 +353,10 @@ class module_manager } $from_data = $moved_modules[0]; - $diff = sizeof($moved_modules) * 2; + $diff = count($moved_modules) * 2; $moved_ids = array(); - for ($i = 0, $size = sizeof($moved_modules); $i < $size; ++$i) + for ($i = 0, $size = count($moved_modules); $i < $size; ++$i) { $moved_ids[] = $moved_modules[$i]['module_id']; } @@ -443,7 +443,7 @@ class module_manager $branch = $this->get_module_branch($module_id, $module_class, 'children', false); - if (sizeof($branch)) + if (count($branch)) { throw new module_exception('CANNOT_REMOVE_MODULE'); } @@ -506,7 +506,7 @@ class module_manager } $this->db->sql_freeresult($result); - if (!sizeof($target)) + if (!count($target)) { // The module is already on top or bottom throw new module_not_found_exception(); diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 1cd7e5bc9a..ac6bb3c6da 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -339,7 +339,7 @@ class manager } } - if (!sizeof($notify_users)) + if (!count($notify_users)) { return; } diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 8fb9172911..c51586afb9 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -99,7 +99,7 @@ class pm extends \phpbb\notification\type\base 'ignore_users' => array(), ), $options); - if (!sizeof($pm['recipients'])) + if (!count($pm['recipients'])) { return array(); } diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 03221e7c7a..254f4c07b3 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -202,9 +202,9 @@ class post extends \phpbb\notification\type\base 'username' => $this->get_data('post_username'), )), $responders); - $responders_cnt = sizeof($responders); + $responders_cnt = count($responders); $responders = $this->trim_user_ary($responders); - $trimmed_responders_cnt = $responders_cnt - sizeof($responders); + $trimmed_responders_cnt = $responders_cnt - count($responders); foreach ($responders as $responder) { @@ -337,7 +337,7 @@ class post extends \phpbb\notification\type\base */ public function trim_user_ary($users) { - if (sizeof($users) > 4) + if (count($users) > 4) { array_splice($users, 3); } @@ -357,7 +357,7 @@ class post extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users) || !$this->inherit_read_status) + if (!count($notify_users) || !$this->inherit_read_status) { return array(); } @@ -426,7 +426,7 @@ class post extends \phpbb\notification\type\base // Do not add more than 25 responders, // we trim the username list to "a, b, c and x others" anyway // so there is no use to add all of them anyway. - if (sizeof($responders) > 25) + if (count($responders) > 25) { return array(); } diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 671c34fe96..5c42afa8c8 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -261,7 +261,7 @@ class topic extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users) || !$this->inherit_read_status) + if (!count($notify_users) || !$this->inherit_read_status) { return array(); } diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index ea4b24af56..35b18ddf07 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -230,7 +230,7 @@ class manager */ public function update_profile_field_data($user_id, $cp_data) { - if (!sizeof($cp_data)) + if (!count($cp_data)) { return; } @@ -258,7 +258,7 @@ class manager */ public function generate_profile_fields_template_headlines($restrict_option = '') { - if (!sizeof($this->profile_cache)) + if (!count($this->profile_cache)) { $this->build_cache(); } @@ -318,12 +318,12 @@ class manager $user_ids = array($user_ids); } - if (!sizeof($this->profile_cache)) + if (!count($this->profile_cache)) { $this->build_cache(); } - if (!sizeof($user_ids)) + if (!count($user_ids)) { return array(); } @@ -486,7 +486,7 @@ class manager $sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . ' - ' . ((sizeof($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' + ' . ((count($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' AND l.field_id = f.field_id'; $result = $this->db->sql_query($sql); diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index f6f3f17a6c..9c09e27bc4 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -398,7 +398,7 @@ class type_bool extends type_base public function display_options(&$template_vars, &$field_data) { // Initialize these array elements if we are creating a new field - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { // No options have been defined for a boolean field. $field_data['lang_options'][0] = ''; diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index 17ae89e1b2..d54404bbb4 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -282,7 +282,7 @@ class type_dropdown extends type_base */ public function validate_options_on_submit($error, $field_data) { - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { $error[] = $this->user->lang['NO_FIELD_ENTRIES']; } @@ -298,7 +298,7 @@ class type_dropdown extends type_base if ($step == 2 && $key == 'field_maxlen') { // Get the number of options if this key is 'field_maxlen' - return sizeof(explode("\n", $this->request->variable('lang_options', '', true))); + return count(explode("\n", $this->request->variable('lang_options', '', true))); } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); @@ -310,7 +310,7 @@ class type_dropdown extends type_base public function display_options(&$template_vars, &$field_data) { // Initialize these array elements if we are creating a new field - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { // No options have been defined for the dropdown menu $field_data['lang_options'] = array(); diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php index e1c14afde0..0aa6833dfa 100644 --- a/phpBB/phpbb/report/controller/report.php +++ b/phpBB/phpbb/report/controller/report.php @@ -141,7 +141,7 @@ class report // Handle request try { - if (!empty($submit) && sizeof($error) === 0) + if (!empty($submit) && count($error) === 0) { $this->report_handler->add_report( (int) $id, @@ -273,7 +273,7 @@ class report } $this->template->assign_vars(array( - 'ERROR' => (sizeof($error) > 0) ? implode('
          ', $error) : '', + 'ERROR' => (count($error) > 0) ? implode('
          ', $error) : '', 'S_REPORT_POST' => ($mode === 'pm') ? false : true, 'REPORT_TEXT' => $report_text, 'S_HIDDEN_FIELDS' => (!empty($s_hidden_fields)) ? $s_hidden_fields : null, @@ -302,7 +302,7 @@ class report $error[] = $visual_confirmation_response; } - if (sizeof($error) === 0) + if (count($error) === 0) { $captcha->reset(); } diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index 56de973b65..e7d0774b6c 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -133,7 +133,7 @@ class base { global $cache, $config, $db, $user; - $length = min(sizeof($id_ary), $config['search_block_size']); + $length = min(count($id_ary), $config['search_block_size']); // nothing to cache so exit if (!$length) @@ -148,7 +148,7 @@ class base if (!($store = $cache->get('_search_results_' . $search_key))) { // add the current keywords to the recent searches in the cache which are listed on the search page - if (!empty($keywords) || sizeof($author_ary)) + if (!empty($keywords) || count($author_ary)) { $sql = 'SELECT search_time FROM ' . SEARCH_RESULTS_TABLE . ' @@ -201,7 +201,7 @@ class base $store += $store_ids; // if the cache is too big - if (sizeof($store) - 2 > 20 * $config['search_block_size']) + if (count($store) - 2 > 20 * $config['search_block_size']) { // remove everything in front of two blocks in front of the current start index for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++) @@ -243,7 +243,7 @@ class base global $db, $cache, $config; // clear all searches that searched for the specified words - if (sizeof($words)) + if (count($words)) { $sql_where = ''; foreach ($words as $word) @@ -264,7 +264,7 @@ class base } // clear all searches that searched for the specified authors - if (is_array($authors) && sizeof($authors)) + if (is_array($authors) && count($authors)) { $sql_where = ''; foreach ($authors as $author) diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index c8df1951e3..51c5fe8b76 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -232,9 +232,9 @@ class fulltext_mysql extends \phpbb\search\base $this->split_words = $matches[1]; // We limit the number of allowed keywords to minimize load on the database - if ($this->config['max_num_search_keywords'] && sizeof($this->split_words) > $this->config['max_num_search_keywords']) + if ($this->config['max_num_search_keywords'] && count($this->split_words) > $this->config['max_num_search_keywords']) { - trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], sizeof($this->split_words))); + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], count($this->split_words))); } // to allow phrase search, we need to concatenate quoted words @@ -361,7 +361,7 @@ class fulltext_mysql extends \phpbb\search\base // remove too short or too long words $text = array_values($text); - for ($i = 0, $n = sizeof($text); $i < $n; $i++) + for ($i = 0, $n = count($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); if (utf8_strlen($text[$i]) < $this->config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len']) @@ -563,12 +563,12 @@ class fulltext_mysql extends \phpbb\search\base $sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id'; $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; - if (sizeof($author_ary) && $author_name) + if (count($author_ary) && $author_name) { // first one matches post of registered users, second one guests and deleted users $sql_author = ' AND (' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } - else if (sizeof($author_ary)) + else if (count($author_ary)) { $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); } @@ -580,7 +580,7 @@ class fulltext_mysql extends \phpbb\search\base $sql_where_options = $sql_sort_join; $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; - $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_where_options .= ' AND ' . $post_visibility; $sql_where_options .= $sql_author; $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -660,7 +660,7 @@ class fulltext_mysql extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -737,7 +737,7 @@ class fulltext_mysql extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -890,7 +890,7 @@ class fulltext_mysql extends \phpbb\search\base $id_ary = array_unique($id_ary); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); @@ -997,7 +997,7 @@ class fulltext_mysql extends \phpbb\search\base $alter_list[] = $alter_entry; } - if (sizeof($alter_list)) + if (count($alter_list)) { foreach ($alter_list as $alter) { @@ -1050,7 +1050,7 @@ class fulltext_mysql extends \phpbb\search\base $alter[] = 'DROP INDEX post_text'; } - if (sizeof($alter)) + if (count($alter)) { $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); } diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 73dcfce9a5..bd222488a0 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -285,7 +285,7 @@ class fulltext_native extends \phpbb\search\base ); $keywords = preg_replace($match, $replace, $keywords); - $num_keywords = sizeof(explode(' ', $keywords)); + $num_keywords = count(explode(' ', $keywords)); // We limit the number of allowed keywords to minimize load on the database if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords']) @@ -301,7 +301,7 @@ class fulltext_native extends \phpbb\search\base $words = array(); preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words); - if (sizeof($words[1])) + if (count($words[1])) { $keywords = '(' . implode('|', $words[1]) . ')'; } @@ -316,7 +316,7 @@ class fulltext_native extends \phpbb\search\base $common_ids = $words = array(); - if (sizeof($exact_words)) + if (count($exact_words)) { $sql = 'SELECT word_id, word_text, word_common FROM ' . SEARCH_WORDLIST_TABLE . ' @@ -426,10 +426,10 @@ class fulltext_native extends \phpbb\search\base } } } - if (sizeof($id_words)) + if (count($id_words)) { sort($id_words); - if (sizeof($id_words) > 1) + if (count($id_words) > 1) { $this->{$mode . '_ids'}[] = $id_words; } @@ -440,7 +440,7 @@ class fulltext_native extends \phpbb\search\base } } // throw an error if we shall not ignore unexistant words - else if (!$ignore_no_id && sizeof($non_common_words)) + else if (!$ignore_no_id && count($non_common_words)) { trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words))); } @@ -480,7 +480,7 @@ class fulltext_native extends \phpbb\search\base } // Return true if all words are not common words - if (sizeof($exact_words) - sizeof($this->common_words) > 0) + if (count($exact_words) - count($this->common_words) > 0) { return true; } @@ -716,7 +716,7 @@ class fulltext_native extends \phpbb\search\base } } - if (sizeof($this->must_not_contain_ids)) + if (count($this->must_not_contain_ids)) { $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), @@ -826,7 +826,7 @@ class fulltext_native extends \phpbb\search\base $sql_where[] = 'p.topic_id = ' . $topic_id; } - if (sizeof($author_ary)) + if (count($author_ary)) { if ($author_name) { @@ -840,7 +840,7 @@ class fulltext_native extends \phpbb\search\base $sql_where[] = $sql_author; } - if (sizeof($ex_fid_ary)) + if (count($ex_fid_ary)) { $sql_where[] = $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true); } @@ -1010,7 +1010,7 @@ class fulltext_native extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -1082,7 +1082,7 @@ class fulltext_native extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -1289,7 +1289,7 @@ class fulltext_native extends \phpbb\search\base $this->db->sql_freeresult($result); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); @@ -1443,7 +1443,7 @@ class fulltext_native extends \phpbb\search\base // individual arrays of added and removed words for text and title. What // we need to do now is add the new words (if they don't already exist) // and then add (or remove) matches between the words and this post - if (sizeof($unique_add_words)) + if (count($unique_add_words)) { $sql = 'SELECT word_id, word_text FROM ' . SEARCH_WORDLIST_TABLE . ' @@ -1459,7 +1459,7 @@ class fulltext_native extends \phpbb\search\base $new_words = array_diff($unique_add_words, array_keys($word_ids)); $this->db->sql_transaction('begin'); - if (sizeof($new_words)) + if (count($new_words)) { $sql_ary = array(); @@ -1483,7 +1483,7 @@ class fulltext_native extends \phpbb\search\base { $title_match = ($word_in == 'title') ? 1 : 0; - if (sizeof($word_ary)) + if (count($word_ary)) { $sql_in = array(); foreach ($word_ary as $word) @@ -1512,7 +1512,7 @@ class fulltext_native extends \phpbb\search\base { $title_match = ($word_in == 'title') ? 1 : 0; - if (sizeof($word_ary)) + if (count($word_ary)) { $sql = 'INSERT INTO ' . SEARCH_WORDMATCH_TABLE . ' (post_id, word_id, title_match) SELECT ' . (int) $post_id . ', word_id, ' . (int) $title_match . ' @@ -1543,7 +1543,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_remove($post_ids, $author_ids, $forum_ids) { - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT w.word_id, w.word_text, m.title_match FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w @@ -1566,7 +1566,7 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - if (sizeof($title_word_ids)) + if (count($title_word_ids)) { $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' SET word_count = word_count - 1 @@ -1575,7 +1575,7 @@ class fulltext_native extends \phpbb\search\base $this->db->sql_query($sql); } - if (sizeof($message_word_ids)) + if (count($message_word_ids)) { $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' SET word_count = word_count - 1 @@ -1630,7 +1630,7 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - if (sizeof($sql_in)) + if (count($sql_in)) { // Flag the words $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' @@ -1650,7 +1650,7 @@ class fulltext_native extends \phpbb\search\base unset($sql_in); } - if (sizeof($destroy_cache_words)) + if (count($destroy_cache_words)) { // destroy cached search results containing any of the words that are now common or were removed $this->destroy_cache(array_unique($destroy_cache_words)); @@ -1685,7 +1685,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_created() { - if (!sizeof($this->stats)) + if (!count($this->stats)) { $this->get_stats(); } @@ -1698,7 +1698,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_stats() { - if (!sizeof($this->stats)) + if (!count($this->stats)) { $this->get_stats(); } diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 8dbc7212a1..4fe7e3b88d 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -294,7 +294,7 @@ class fulltext_postgres extends \phpbb\search\base // remove too short or too long words $text = array_values($text); - for ($i = 0, $n = sizeof($text); $i < $n; $i++) + for ($i = 0, $n = count($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len']) @@ -502,12 +502,12 @@ class fulltext_postgres extends \phpbb\search\base $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; - if (sizeof($author_ary) && $author_name) + if (count($author_ary) && $author_name) { // first one matches post of registered users, second one guests and deleted users $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } - else if (sizeof($author_ary)) + else if (count($author_ary)) { $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); } @@ -519,7 +519,7 @@ class fulltext_postgres extends \phpbb\search\base $sql_where_options = $sql_sort_join; $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; - $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_where_options .= ' AND ' . $post_visibility; $sql_where_options .= $sql_author; $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -609,7 +609,7 @@ class fulltext_postgres extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -686,7 +686,7 @@ class fulltext_postgres extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -861,7 +861,7 @@ class fulltext_postgres extends \phpbb\search\base $id_ary = array_unique($id_ary); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index a20e3ad4b5..54d32ca371 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -483,7 +483,7 @@ class fulltext_sphinx global $user, $phpbb_log; // No keywords? No posts. - if (!strlen($this->search_query) && !sizeof($author_ary)) + if (!strlen($this->search_query) && !count($author_ary)) { return false; } @@ -623,7 +623,7 @@ class fulltext_sphinx break; } - if (sizeof($author_ary)) + if (count($author_ary)) { $this->sphinx->SetFilter('poster_id', $author_ary); } @@ -633,14 +633,14 @@ class fulltext_sphinx // but at least it will also cause the same for normal users. $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED)); - if (sizeof($ex_fid_ary)) + if (count($ex_fid_ary)) { // All forums that a user is allowed to access $fid_ary = array_unique(array_intersect(array_keys($this->auth->acl_getf('f_read', true)), array_keys($this->auth->acl_getf('f_search', true)))); // All forums that the user wants to and can search in $search_forums = array_diff($fid_ary, $ex_fid_ary); - if (sizeof($search_forums)) + if (count($search_forums)) { $this->sphinx->SetFilter('forum_id', $search_forums); } @@ -790,7 +790,7 @@ class fulltext_sphinx } $this->db->sql_freeresult($result); - if (sizeof($post_updates)) + if (count($post_updates)) { $this->sphinx->UpdateAttributes($this->indexes, array('topic_last_post_time'), $post_updates); } diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index 675649b460..3205574b45 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -46,7 +46,7 @@ class config */ function get_section_by_name($name) { - for ($i = 0, $size = sizeof($this->sections); $i < $size; $i++) + for ($i = 0, $size = count($this->sections); $i < $size; $i++) { // Make sure this is really a section object and not a comment if (($this->sections[$i] instanceof \phpbb\search\sphinx\config_section) && $this->sections[$i]->get_name() == $name) @@ -67,7 +67,7 @@ class config function add_section($name) { $this->sections[] = new \phpbb\search\sphinx\config_section($name, ''); - return $this->sections[sizeof($this->sections) - 1]; + return $this->sections[count($this->sections) - 1]; } /** diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 14ab3a752c..2fc8b2da17 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -87,7 +87,7 @@ class config_section */ function get_variable_by_name($name) { - for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) + for ($i = 0, $size = count($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) @@ -106,7 +106,7 @@ class config_section */ function delete_variables_by_name($name) { - for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) + for ($i = 0, $size = count($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) @@ -129,7 +129,7 @@ class config_section function create_variable($name, $value) { $this->variables[] = new \phpbb\search\sphinx\config_variable($name, $value, ''); - return $this->variables[sizeof($this->variables) - 1]; + return $this->variables[count($this->variables) - 1]; } /** diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index f0e716d697..1aa7717470 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -146,7 +146,7 @@ class extension extends \Twig_Extension // of items to grab (length) // Start must always be the actual starting number for this calculation (not negative) - $start = ($start < 0) ? sizeof($item) + $start : $start; + $start = ($start < 0) ? count($item) + $start : $start; $end = $end - $start; } diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 7149513fd9..c02deaebf4 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -706,7 +706,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface { $acquired_new_lock = $this->acquire_lock(); - $diff = sizeof($subset_items) * 2; + $diff = count($subset_items) * 2; $sql_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items); $sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true); @@ -746,7 +746,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface */ protected function prepare_adding_subset(array $subset_items, array $new_parent) { - $diff = sizeof($subset_items) * 2; + $diff = count($subset_items) * 2; $sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true); $set_left_id = $this->db->sql_case($this->column_left_id . ' > ' . (int) $new_parent[$this->column_right_id], $this->column_left_id . ' + ' . $diff, $this->column_left_id); diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index cdd28329db..294f5208d5 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -75,7 +75,7 @@ class user_loader // Do not load users we already have in $this->users $user_ids = array_diff($user_ids, array_keys($this->users)); - if (sizeof($user_ids)) + if (count($user_ids)) { $sql = 'SELECT * FROM ' . $this->users_table . ' diff --git a/phpBB/posting.php b/phpBB/posting.php index 02bf1c1d07..3530bb5048 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -581,7 +581,7 @@ if ($mode == 'edit') ); } -$orig_poll_options_size = sizeof($post_data['poll_options']); +$orig_poll_options_size = count($post_data['poll_options']); $message_parser = new parse_message(); /* @var $plupload \phpbb\plupload\plupload */ @@ -884,7 +884,7 @@ if ($submit || $preview || $refresh) } // Delete Poll - if ($poll_delete && $mode == 'edit' && sizeof($post_data['poll_options']) && + if ($poll_delete && $mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))) { if ($submit && check_form_key('posting')) @@ -1034,7 +1034,7 @@ if ($submit || $preview || $refresh) // Parse message if ($update_message) { - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $error[] = implode('
          ', $message_parser->warn_msg); $message_parser->warn_msg = array(); @@ -1046,7 +1046,7 @@ if ($submit || $preview || $refresh) } // On a refresh we do not care about message parsing errors - if (sizeof($message_parser->warn_msg) && $refresh && !$preview) + if (count($message_parser->warn_msg) && $refresh && !$preview) { $message_parser->warn_msg = array(); } @@ -1268,7 +1268,7 @@ if ($submit || $preview || $refresh) } } - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $error[] = implode('
          ', $message_parser->warn_msg); } @@ -1313,7 +1313,7 @@ if ($submit || $preview || $refresh) extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); // Store message, sync counters - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { if ($submit) { @@ -1510,7 +1510,7 @@ if ($submit || $preview || $refresh) } // Preview -if (!sizeof($error) && $preview) +if (!count($error) && $preview) { $post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time; @@ -1552,7 +1552,7 @@ if (!sizeof($error) && $preview) } $template->assign_vars(array( - 'S_HAS_POLL_OPTIONS' => (sizeof($post_data['poll_options'])), + 'S_HAS_POLL_OPTIONS' => (count($post_data['poll_options'])), 'S_IS_MULTI_CHOICE' => ($post_data['poll_max_options'] > 1) ? true : false, 'POLL_QUESTION' => $parse_poll->message, @@ -1581,7 +1581,7 @@ if (!sizeof($error) && $preview) } // Attachment Preview - if (sizeof($message_parser->attachment_data)) + if (count($message_parser->attachment_data)) { $template->assign_var('S_HAS_ATTACHMENTS', true); @@ -1599,7 +1599,7 @@ if (!sizeof($error) && $preview) unset($attachment_data); } - if (!sizeof($error)) + if (!count($error)) { $template->assign_vars(array( 'PREVIEW_SUBJECT' => $preview_subject, @@ -1622,7 +1622,7 @@ if ($generate_quote && $config['max_quote_depth'] > 0) } // Decode text for message display -$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; +$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !count($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); if ($generate_quote) @@ -1670,7 +1670,7 @@ $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; $post_data['post_text'] = $message_parser->message; -if (sizeof($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) +if (count($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) { $message_parser->message = $post_data['poll_title']; $message_parser->bbcode_uid = $post_data['bbcode_uid']; @@ -1795,7 +1795,7 @@ $page_data = array( 'FORUM_NAME' => $post_data['forum_name'], 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', 'TOPIC_TITLE' => censor_text($post_data['topic_title']), - 'MODERATORS' => (sizeof($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + 'MODERATORS' => (count($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], @@ -1807,7 +1807,7 @@ $page_data = array( 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', - 'ERROR' => (sizeof($error)) ? implode('
          ', $error) : '', + 'ERROR' => (count($error)) ? implode('
          ', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $request->variable('edit_reason', '', true), 'SHOW_PANEL' => $request->variable('show_panel', ''), @@ -1867,7 +1867,7 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ $page_data = array_merge($page_data, array( 'S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)), - 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), + 'S_POLL_DELETE' => ($mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false, 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']), diff --git a/phpBB/search.php b/phpBB/search.php index eabb1fc96e..97a8f320d4 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -198,7 +198,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; } - if (!sizeof($author_id_ary)) + if (!count($author_id_ary)) { trigger_error('NO_SEARCH_RESULTS'); } @@ -220,7 +220,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Which forums should not be searched? Author searches are also carried out in unindexed forums - if (empty($keywords) && sizeof($author_id_ary)) + if (empty($keywords) && count($author_id_ary)) { $ex_fid_ary = array_keys($auth->acl_getf('!f_read', true)); } @@ -229,7 +229,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); } - $not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; + $not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id FROM ' . FORUMS_TABLE . ' f @@ -256,7 +256,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) continue; } - if (sizeof($search_forum)) + if (count($search_forum)) { if ($search_child) { @@ -309,9 +309,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $correct_query = $search->split_keywords($keywords, $search_terms); $common_words = $search->get_common_words(); - if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) + if (!$correct_query || (!$search->get_search_query() && !count($author_id_ary) && !$search_id)) { - $ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
          ' : ''; + $ignored = (count($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
          ' : ''; $word_length = $search->get_word_length(); if ($word_length) { @@ -324,7 +324,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } - if (!$keywords && sizeof($author_id_ary)) + if (!$keywords && count($author_id_ary)) { // if it is an author search we want to show topics by default $show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); @@ -384,7 +384,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) WHERE t.topic_moved_id = 0 $last_post_time_sql AND " . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' ORDER BY t.topic_last_post_time DESC'; $field = 'topic_id'; break; @@ -422,7 +422,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) AND p.topic_id = t.topic_id $last_post_time AND $m_approve_posts_fid_sql - " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'post_id'; } @@ -435,7 +435,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) AND p.topic_id = t.topic_id $last_post_time AND $m_approve_topics_fid_sql - " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'topic_id'; } @@ -451,7 +451,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_where = 'AND t.topic_moved_id = 0 AND ' . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; @@ -477,7 +477,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) FROM ' . POSTS_TABLE . ' p WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' AND ' . $m_approve_posts_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'post_id'; } @@ -488,7 +488,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' AND t.topic_moved_id = 0 AND ' . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; /* [Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul) @@ -562,7 +562,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $search_id = ''; } - $total_match_count = sizeof($id_ary); + $total_match_count = count($id_ary); if ($total_match_count) { // Limit the number to $total_matches_limit for pre-made searches @@ -592,7 +592,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } - else if (sizeof($author_id_ary)) + else if (count($author_id_ary)) { $firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false; $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); @@ -642,10 +642,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_where = ''; - if (sizeof($id_ary)) + if (count($id_ary)) { $sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary); - $sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; + $sql_where .= (count($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; $sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql); } @@ -883,7 +883,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $db->sql_freeresult($result); // If we have some shadow topics, update the rowset to reflect their topic information - if (sizeof($shadow_topic_list)) + if (count($shadow_topic_list)) { $sql = 'SELECT * FROM ' . TOPICS_TABLE . ' @@ -987,7 +987,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) unset($text_only_message); // Pull attachment data - if (sizeof($attach_list)) + if (count($attach_list)) { $use_attach_list = $attach_list; $attach_list = array(); @@ -1001,7 +1001,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } - if (sizeof($attach_list)) + if (count($attach_list)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e4cf08d548..04a39e83d5 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -400,7 +400,7 @@ $template->assign_vars(array( 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), + 'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), 'U_WATCH_FORUM_LINK' => $s_watching_forum['link'], 'U_WATCH_FORUM_TOGGLE' => $s_watching_forum['link_toggle'], 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], @@ -410,7 +410,7 @@ $template->assign_vars(array( 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), - 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, + 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && count($moderators[$forum_id]) > 1) ? false : true, 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, 'S_VIEWFORUM' => true, @@ -480,7 +480,7 @@ if ($user->data['is_registered']) $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time'; - if ($s_display_active && sizeof($active_forum_ary)) + if ($s_display_active && count($active_forum_ary)) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time'; @@ -588,8 +588,8 @@ if ($start > $topics_count / 2) // Select the sort order $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); - $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - sizeof($announcement_list)); - $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - sizeof($announcement_list)); + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - count($announcement_list)); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - count($announcement_list)); } else { @@ -607,7 +607,7 @@ else $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } -if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary)) +if ($forum_data['forum_type'] == FORUM_POST || !count($active_forum_ary)) { $sql_where = 't.forum_id = ' . $forum_id; } @@ -618,7 +618,7 @@ else if (empty($active_forum_ary['exclude_forum_id'])) else { $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']); - $sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; + $sql_where = (count($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; } // Grab just the sorted topic ids @@ -677,7 +677,7 @@ $db->sql_freeresult($result); // For storing shadow topics $shadow_topic_list = array(); -if (sizeof($topic_list)) +if (count($topic_list)) { // SQL array for obtaining topics/stickies $sql_array = array( @@ -707,7 +707,7 @@ if (sizeof($topic_list)) } // If we have some shadow topics, update the rowset to reflect their topic information -if (sizeof($shadow_topic_list)) +if (count($shadow_topic_list)) { // SQL array for obtaining shadow topics $sql_array = array( @@ -782,7 +782,7 @@ if ($s_display_active) // We need to remove the global announcements from the forums total topic count, // otherwise the number is different from the one on the forum list -$total_topic_count = $topics_count - sizeof($announcement_list); +$total_topic_count = $topics_count - count($announcement_list); $base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start); @@ -809,7 +809,7 @@ $vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); // Okay, lets dump out the page ... -if (sizeof($topic_list)) +if (count($topic_list)) { $mark_forum_read = true; $mark_time_forum = 0; @@ -1022,7 +1022,7 @@ extract($phpbb_dispatcher->trigger_event('core.viewforum_generate_page_after', c // on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find // any it updates the forum last read cookie. This requires that the user visit the forum // after reading a topic -if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read) +if ($forum_data['forum_type'] == FORUM_POST && count($topic_list) && $mark_forum_read) { update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9037918a20..38eba32374 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -32,7 +32,7 @@ $topic_id = $request->variable('t', 0); $post_id = $request->variable('p', 0); $voted_id = $request->variable('vote_id', array('' => 0)); -$voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; +$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id; $start = $request->variable('start', 0); @@ -740,7 +740,7 @@ $template->assign_vars(array( 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', - 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), @@ -763,7 +763,7 @@ $template->assign_vars(array( 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, + 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), 'S_MOD_ACTION' => $s_quickmod_action, @@ -856,9 +856,9 @@ if (!empty($topic_data['poll_start'])) (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && $topic_data['topic_status'] != ITEM_LOCKED && $topic_data['forum_status'] != ITEM_LOCKED && - (!sizeof($cur_voted_id) || + (!count($cur_voted_id) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; - $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false; + $s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false; /** * Event to manipulate the poll data @@ -893,16 +893,16 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) + if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); - if (!sizeof($voted_id)) + if (!count($voted_id)) { $message = 'NO_VOTE_OPTION'; } - else if (sizeof($voted_id) > $topic_data['poll_max_options']) + else if (count($voted_id) > $topic_data['poll_max_options']) { $message = 'TOO_MANY_VOTE_OPTIONS'; } @@ -996,7 +996,7 @@ if (!empty($topic_data['poll_start'])) 'user_votes' => array_flip($valid_user_votes), 'vote_counts' => $vote_counts, 'total_votes' => array_sum($vote_counts), - 'can_vote' => !sizeof($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), + 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), ); $json_response = new \phpbb\json_response(); $json_response->send($data); @@ -1016,7 +1016,7 @@ if (!empty($topic_data['poll_start'])) $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; - for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) + for ($i = 0, $size = count($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true); } @@ -1158,7 +1158,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -if (!sizeof($post_list)) +if (!count($post_list)) { if ($sort_days) { @@ -1482,7 +1482,7 @@ if ($config['load_cpf_viewtopic']) } // Generate online information for user -if ($config['load_onlinetrack'] && sizeof($id_cache)) +if ($config['load_onlinetrack'] && count($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' @@ -1500,7 +1500,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache)) unset($id_cache); // Pull attachment data -if (sizeof($attach_list)) +if (count($attach_list)) { if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { @@ -1518,7 +1518,7 @@ if (sizeof($attach_list)) $db->sql_freeresult($result); // No attachments exist, but post table thinks they do so go ahead and reset post_attach flags - if (!sizeof($attachments)) + if (!count($attachments)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 0 @@ -1526,7 +1526,7 @@ if (sizeof($attach_list)) $db->sql_query($sql); // We need to update the topic indicator too if the complete topic is now without an attachment - if (sizeof($rowset) != $total_posts) + if (count($rowset) != $total_posts) { // Not all posts are displayed so we query the db to find if there's any attachment for this topic $sql = 'SELECT a.post_msg_id as post_id @@ -1583,12 +1583,12 @@ $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_li // Get the list of permanently banned users $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); -$i_total = sizeof($rowset) - 1; +$i_total = count($rowset) - 1; $prev_post_id = ''; $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], - 'S_NUM_POSTS' => sizeof($post_list)) + 'S_NUM_POSTS' => count($post_list)) ); /** @@ -1633,7 +1633,7 @@ extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', comp // Output the posts $first_unread = $post_unread = false; -for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) +for ($i = 0, $end = count($post_list); $i < $end; ++$i) { // A non-existing rowset only happens if there was no user present for the entered poster_id // This could be a broken posts table. @@ -1676,7 +1676,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) + if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1740,7 +1740,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) + if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1983,7 +1983,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, 'L_POST_DELETED_MESSAGE' => $l_deleted_message, @@ -1992,7 +1992,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_FRIEND' => ($row['friend']) ? true : false, 'S_UNREAD_POST' => $post_unread, 'S_FIRST_UNREAD' => $s_first_unread, - 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, 'S_IGNORE_POST' => ($row['foe']) ? true : false, @@ -2048,7 +2048,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $i = $current_row_number; - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $post_row = array_merge($post_row, $cp_row['row']); } @@ -2161,7 +2161,7 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use $db->sql_query($sql); // Update the attachment download counts - if (sizeof($update_count)) + if (count($update_count)) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 diff --git a/tests/cache/cache_memory_test.php b/tests/cache/cache_memory_test.php index 9f92e8d8dc..ba1010bcf3 100644 --- a/tests/cache/cache_memory_test.php +++ b/tests/cache/cache_memory_test.php @@ -116,7 +116,7 @@ class phpbb_cache_memory_test extends phpbb_database_test_case $results[] = $row; } $this->cache->sql_freeresult($query_id); - $this->assertEquals($query[1], sizeof($results)); + $this->assertEquals($query[1], count($results)); } $this->cache->destroy('sql', $table); diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index f4dd69b19b..76f8c753bf 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -40,7 +40,7 @@ class phpbb_cron_manager_test extends \phpbb_test_case public function test_manager_finds_all_ready_tasks() { $tasks = $this->manager->find_all_ready_tasks(); - $this->assertEquals(3, sizeof($tasks)); + $this->assertEquals(3, count($tasks)); } public function test_manager_finds_one_ready_task() diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index 98709fb043..4fa5cc37a2 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -67,7 +67,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case $result = $db->sql_query($sql); $rows = $db->sql_fetchrowset($result); - $this->assertEquals(1, sizeof($rows)); + $this->assertEquals(1, count($rows)); $this->assertEquals('config2', $rows[0]['config_name']); $db->sql_freeresult($result); diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php index 607f442fdf..2eeb48ea05 100644 --- a/tests/event/md_exporter_test.php +++ b/tests/event/md_exporter_test.php @@ -92,7 +92,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case public function test_crawl_eventsmd($file, $min_version, $max_version, $events) { $exporter = new \phpbb\event\md_exporter(dirname(__FILE__) . '/fixtures/', null, $min_version, $max_version); - $this->assertSame(sizeof($events), $exporter->crawl_eventsmd($file, 'adm')); + $this->assertSame(count($events), $exporter->crawl_eventsmd($file, 'adm')); $this->assertEquals($events, $exporter->get_events()); } @@ -146,7 +146,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case $exporter->crawl_eventsmd('docs/events.md', $filter); $events = $exporter->crawl_file_for_events($file); - $this->assertGreaterThanOrEqual(0, sizeof($events)); + $this->assertGreaterThanOrEqual(0, count($events)); $this->assertTrue($exporter->validate_events_from_file($file, $events)); } } diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 88f8999005..426ebcee53 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -102,7 +102,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case ->set_allowed_extensions(array('gif')) ->set_max_filesize(2000); $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/test.gif'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertTrue(file_exists($file->get('filename'))); $this->assertTrue($file->is_uploaded()); } @@ -115,7 +115,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case ->set_allowed_extensions(array('gif')) ->set_max_filesize(100); $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/test.gif'); - $this->assertEquals(1, sizeof($file->error)); + $this->assertEquals(1, count($file->error)); $this->assertEquals('WRONG_FILESIZE', $file->error[0]); } } diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php index 1550aa37e6..75e5a6dc61 100644 --- a/tests/functions/get_remote_file_test.php +++ b/tests/functions/get_remote_file_test.php @@ -58,7 +58,7 @@ class phpbb_functions_get_remote_file extends phpbb_test_case $this->assertGreaterThanOrEqual( 2, - sizeof($lines), + count($lines), 'Failed asserting that the version file has at least two lines.' ); diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php index c751764d45..e57983684d 100644 --- a/tests/mock/sql_insert_buffer.php +++ b/tests/mock/sql_insert_buffer.php @@ -15,7 +15,7 @@ class phpbb_mock_sql_insert_buffer extends \phpbb\db\sql_insert_buffer { public function flush() { - return (sizeof($this->buffer)) ? true : false; + return (count($this->buffer)) ? true : false; } public function get_buffer() diff --git a/tests/notification/base.php b/tests/notification/base.php index b64e25cf8c..80b9a0d777 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -163,7 +163,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case 'order_dir' => 'ASC', ), $options)); - $this->assertEquals(sizeof($expected), $notifications['unread_count']); + $this->assertEquals(count($expected), $notifications['unread_count']); $i = 0; foreach ($notifications['notifications'] as $notification) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index b7386e9a3e..df7c669865 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -229,7 +229,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { // http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important // but one array_diff is not enough! - if (sizeof(array_diff($one, $two)) || sizeof(array_diff($two, $one))) + if (count(array_diff($one, $two)) || count(array_diff($two, $one))) { // get a nice error message $this->assertEquals($one, $two); diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 147029d699..b58e9c752b 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -621,7 +621,7 @@ class phpbb_database_test_connection_manager } // Combine all of the SETVALs into one query - if (sizeof($setval_queries)) + if (count($setval_queries)) { $queries[] = 'SELECT ' . implode(', ', $setval_queries); } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index c9943c4302..2d8224f7dc 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -425,7 +425,7 @@ class phpbb_functional_test_case extends phpbb_test_case $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]'); // Wait for extension to be fully enabled - while (sizeof($meta_refresh)) + while (count($meta_refresh)) { preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match); $url = $match[1]; @@ -990,7 +990,7 @@ class phpbb_functional_test_case extends phpbb_test_case $this->assertEquals( 1, - sizeof($result), + count($result), $message ?: 'Failed asserting that exactly one checkbox with name' . " $name exists in crawler scope." ); diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index b875d3212b..d38d14f45c 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -317,7 +317,7 @@ class phpbb_ui_test_case extends phpbb_test_case $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]'); // Wait for extension to be fully enabled - while (sizeof($meta_refresh)) + while (count($meta_refresh)) { preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match); $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1])); diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index fb72823f08..5b3357237d 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -173,7 +173,7 @@ class phpbb_fileupload_test extends phpbb_test_case ->set_max_filesize(1000); $file = $this->gen_valid_filespec(); $upload->common_checks($file); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); } public function test_local_upload() @@ -184,7 +184,7 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertFalse($file->additional_checks()); $this->assertTrue($file->move_file('../tests/upload/fixture/copies', true)); $file->remove(); @@ -198,10 +198,10 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertFalse($file->move_file('../tests/upload/fixture')); $this->assertFalse($file->get('file_moved')); - $this->assertEquals(1, sizeof($file->error)); + $this->assertEquals(1, count($file->error)); } public function test_move_existent_file_overwrite() @@ -213,9 +213,9 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $file->move_file('../tests/upload/fixture/copies', true); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); unlink($this->path . 'copies/jpg.jpg'); } diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index 8260d99504..ee23fe779c 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -66,7 +66,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case '3.2-A1', ); - for ($i = 0, $size = sizeof($releases); $i < $size - 1; ++$i) + for ($i = 0, $size = count($releases); $i < $size - 1; ++$i) { $version1 = $releases[$i]; $version2 = $releases[$i + 1]; -- cgit v1.2.1 From c1ec6517bfe0f080ad052e727073794583464bfb Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 1 Jan 2018 14:40:59 +0100 Subject: [ticket/14972] Add PHP 7.2 to build matrix PHPBB3-14972 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4cef1af10e..db3e4311c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ matrix: env: DB=mysqli - php: 7.1 env: DB=mysqli + - php: 7.2 + env: DB=mysqli - php: nightly env: DB=mysqli - php: hhvm -- cgit v1.2.1 From cbee288eeb74efa92b39abe7a2db71dc00ef5b66 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 27 Jan 2017 23:06:59 +0100 Subject: [ticket/15055] Add .appveyor.yml file PHPBB3-15055 --- .appveyor.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000000..1246c7735f --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,39 @@ +build: false +clone_folder: c:\projects\phpbb + +services: + - mssql2014 + +init: + - SET PATH=c:\php;%PATH% + - SET COMPOSER_NO_INTERACTION=1 + - SET SYMFONY_DEPRECATIONS_HELPER=strict + - SET ANSICON=121x90 (121x90) + - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped + - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f + +before_test: + - sqlcmd -S "(local)\SQL2014" -Q "Use [master]; CREATE DATABASE [phpbb_test]" + - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% + - cinst -y php -version 5.6.17 --allow-empty-checksums + - cd c:\tools\php + - ps: cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini + - echo date.timezone="UTC" >> php.ini + - echo extension_dir=ext >> php.ini + - echo extension=php_openssl.dll >> php.ini + - echo extension=php_mbstring.dll >> php.ini + - echo extension=php_curl.dll >> php.ini + - echo extension=php_gd2.dll >> php.ini + - echo extension=php_tidy.dll >> php.ini + - echo extension=php_fileinfo.dll >> php.ini + - php -r "readfile('https://dl.dropboxusercontent.com/u/7129062/sqlsrv_unofficial_3.0.2.2.zip');" > sqlsrv.zip + - unzip sqlsrv.zip + - copy sqlsrv_unofficial_3.0.2.2\x64\*.dll ext + - echo extension=php_sqlsrv_56_nts.dll >> php.ini + - echo extension=php_pdo_sqlsrv_56_nts.dll >> php.ini + - cd c:\projects\phpbb\phpBB + - php ..\composer.phar install + +test_script: + - cd c:\projects\phpbb + - php -e phpBB\vendor\phpunit\phpunit\phpunit -- cgit v1.2.1 From d65d776d9263954a5bea849ab4d061b383aa564a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 27 Jan 2017 23:47:24 +0100 Subject: [ticket/15055] Output test config to test_config.php PHPBB3-15055 --- .appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 1246c7735f..077742e799 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -33,7 +33,10 @@ before_test: - echo extension=php_pdo_sqlsrv_56_nts.dll >> php.ini - cd c:\projects\phpbb\phpBB - php ..\composer.phar install + - cd c:\projects\phpbb\tests + - touch test_config.php + - ps: $data = " Date: Sat, 28 Jan 2017 11:30:34 +0100 Subject: [ticket/15055] Debug issues PHPBB3-15055 --- .appveyor.yml | 2 +- tests/attachment/fixtures/resync.xml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 077742e799..5a4b2b4951 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -39,4 +39,4 @@ before_test: test_script: - cd c:\projects\phpbb - - php -e phpBB\vendor\phpunit\phpunit\phpunit --verbose + - php -e phpBB\vendor\phpunit\phpunit\phpunit --verbose --stop-on-error diff --git a/tests/attachment/fixtures/resync.xml b/tests/attachment/fixtures/resync.xml index 6e2cc62f68..af04701b4a 100644 --- a/tests/attachment/fixtures/resync.xml +++ b/tests/attachment/fixtures/resync.xml @@ -1,6 +1,7 @@
          ', $categories), - 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && sizeof($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', - 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && sizeof($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', + 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && count($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', + 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && count($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', 'L_ACL_TYPE' => $l_acl_type, 'S_LOCAL' => ($local) ? true : false, 'S_GLOBAL' => (!$local) ? true : false, - 'S_NUM_CATS' => sizeof($categories), + 'S_NUM_CATS' => count($categories), 'S_VIEW' => ($mode == 'view') ? true : false, - 'S_NUM_OBJECTS' => sizeof($content_array), + 'S_NUM_OBJECTS' => count($content_array), 'S_USER_MODE' => ($user_mode == 'user') ? true : false, 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); @@ -637,7 +637,7 @@ class auth_admin extends \phpbb\auth\auth global $db, $template, $user, $phpbb_root_path, $phpEx; global $phpbb_container; - if (!sizeof($hold_ary)) + if (!count($hold_ary)) { return; } @@ -669,7 +669,7 @@ class auth_admin extends \phpbb\auth\auth 'FORUM_ID' => $forum_id) ); - if (isset($auth_ary['users']) && sizeof($auth_ary['users'])) + if (isset($auth_ary['users']) && count($auth_ary['users'])) { $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' @@ -688,7 +688,7 @@ class auth_admin extends \phpbb\auth\auth $db->sql_freeresult($result); } - if (isset($auth_ary['groups']) && sizeof($auth_ary['groups'])) + if (isset($auth_ary['groups']) && count($auth_ary['groups'])) { $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE . ' @@ -890,7 +890,7 @@ class auth_admin extends \phpbb\auth\auth } $db->sql_freeresult($result); - if (sizeof($role_ids)) + if (count($role_ids)) { $sql = "DELETE FROM $table WHERE $forum_sql @@ -1000,7 +1000,7 @@ class auth_admin extends \phpbb\auth\auth } // If no data is there, we set the any-flag to ACL_NEVER... - if (!sizeof($sql_ary)) + if (!count($sql_ary)) { $sql_ary[] = array( 'role_id' => (int) $role_id, @@ -1083,7 +1083,7 @@ class auth_admin extends \phpbb\auth\auth $db->sql_freeresult($result); // Get role data for resetting data - if (sizeof($cur_role_auth)) + if (count($cur_role_auth)) { $sql = 'SELECT ao.auth_option, rd.role_id, rd.auth_setting FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_ROLES_DATA_TABLE . ' rd diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 6572c0ad2c..239e5c8ad6 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -94,13 +94,13 @@ class bbcode ${$type}['replace'][] = $replace; } - if (sizeof($str['search'])) + if (count($str['search'])) { $message = str_replace($str['search'], $str['replace'], $message); $str = array('search' => array(), 'replace' => array()); } - if (sizeof($preg['search'])) + if (count($preg['search'])) { // we need to turn the entities back into their original form to allow the // search patterns to work properly @@ -191,7 +191,7 @@ class bbcode } } - if (sizeof($sql)) + if (count($sql)) { global $db; diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index d307880c4b..68c6c6e6a8 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -75,7 +75,7 @@ class diff { $count = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -98,7 +98,7 @@ class diff { $count = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -136,7 +136,7 @@ class diff $rev->_edits = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; $rev->_edits[] = $edit->reverse(); @@ -152,7 +152,7 @@ class diff */ function is_empty() { - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -168,8 +168,8 @@ class diff $final = $edit->final; // We can simplify one case where the array is usually supposed to be empty... - if (sizeof($orig) == 1 && trim($orig[0]) === '') $orig = array(); - if (sizeof($final) == 1 && trim($final[0]) === '') $final = array(); + if (count($orig) == 1 && trim($orig[0]) === '') $orig = array(); + if (count($final) == 1 && trim($final[0]) === '') $final = array(); if (!$orig && !$final) { @@ -196,13 +196,13 @@ class diff { $lcs = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if (is_a($edit, 'diff_op_copy')) { - $lcs += sizeof($edit->orig); + $lcs += count($edit->orig); } } return $lcs; @@ -219,13 +219,13 @@ class diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if ($edit->orig) { - array_splice($lines, sizeof($lines), 0, $edit->orig); + array_splice($lines, count($lines), 0, $edit->orig); } } return $lines; @@ -242,13 +242,13 @@ class diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if ($edit->final) { - array_splice($lines, sizeof($lines), 0, $edit->final); + array_splice($lines, count($lines), 0, $edit->final); } } return $lines; @@ -296,7 +296,7 @@ class diff $prevtype = null; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -332,7 +332,7 @@ class mapped_diff extends diff */ function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines) { - if (sizeof($from_lines) != sizeof($mapped_from_lines) || sizeof($to_lines) != sizeof($mapped_to_lines)) + if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines)) { return false; } @@ -340,20 +340,20 @@ class mapped_diff extends diff parent::diff($mapped_from_lines, $mapped_to_lines); $xi = $yi = 0; - for ($i = 0; $i < sizeof($this->_edits); $i++) + for ($i = 0; $i < count($this->_edits); $i++) { $orig = &$this->_edits[$i]->orig; if (is_array($orig)) { - $orig = array_slice($from_lines, $xi, sizeof($orig)); - $xi += sizeof($orig); + $orig = array_slice($from_lines, $xi, count($orig)); + $xi += count($orig); } $final = &$this->_edits[$i]->final; if (is_array($final)) { - $final = array_slice($to_lines, $yi, sizeof($final)); - $yi += sizeof($final); + $final = array_slice($to_lines, $yi, count($final)); + $yi += count($final); } } } @@ -377,12 +377,12 @@ class diff_op function norig() { - return ($this->orig) ? sizeof($this->orig) : 0; + return ($this->orig) ? count($this->orig) : 0; } function nfinal() { - return ($this->final) ? sizeof($this->final) : 0; + return ($this->final) ? count($this->final) : 0; } } @@ -517,7 +517,7 @@ class diff3 extends diff { $conflicts = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -550,7 +550,7 @@ class diff3 extends diff $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -590,7 +590,7 @@ class diff3 extends diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -614,7 +614,7 @@ class diff3 extends diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -638,7 +638,7 @@ class diff3 extends diff { $conflicts = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -803,9 +803,9 @@ class diff3_op function solve_prepare() { // We can simplify one case where the array is usually supposed to be empty... - if (sizeof($this->orig) == 1 && trim($this->orig[0]) === '') $this->orig = array(); - if (sizeof($this->final1) == 1 && trim($this->final1[0]) === '') $this->final1 = array(); - if (sizeof($this->final2) == 1 && trim($this->final2[0]) === '') $this->final2 = array(); + if (count($this->orig) == 1 && trim($this->orig[0]) === '') $this->orig = array(); + if (count($this->final1) == 1 && trim($this->final1[0]) === '') $this->final1 = array(); + if (count($this->final2) == 1 && trim($this->final2[0]) === '') $this->final2 = array(); // Now we only can have the case where the only difference between arrays are newlines, so compare all cases @@ -848,10 +848,10 @@ class diff3_op $_final1 = &$this->$final1; // Ok, we basically search for $orig in $final1 - $compare_seq = sizeof($_orig); + $compare_seq = count($_orig); // Go through the conflict code - for ($i = 0, $j = 0, $size = sizeof($_final1); $i < $size; $i++, $j = $i) + for ($i = 0, $j = 0, $size = count($_final1); $i < $size; $i++, $j = $i) { $line = $_final1[$i]; $skip = 0; @@ -895,7 +895,7 @@ class diff3_op // CASE ONE: orig changed into final2, but modified/unknown code in final1. // IF orig is found "as is" in final1 we replace the code directly in final1 and populate this as final2/merge - if (sizeof($this->orig) && sizeof($this->final2)) + if (count($this->orig) && count($this->final2)) { $result = $this->_compare_conflict_seq('orig', 'final1', 'final2'); @@ -915,7 +915,7 @@ class diff3_op } // Try to solve $Id$ issues. ;) - if (sizeof($this->orig) == 1 && sizeof($this->final1) == 1 && sizeof($this->final2) == 1) + if (count($this->orig) == 1 && count($this->final1) == 1 && count($this->final2) == 1) { $match = '#^' . preg_quote('* @version $Id: ', '#') . '[a-z\._\- ]+[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9\:Z]+ [a-z0-9_\- ]+\$$#'; @@ -939,9 +939,9 @@ class diff3_op } // The same is true for a line at the end. ;) - if (sizeof($this->orig) && sizeof($this->final2) && sizeof($this->orig) === sizeof($this->final2) && trim($this->orig[sizeof($this->orig)-1]) === '' && trim($this->final2[sizeof($this->final2)-1]) === '') + if (count($this->orig) && count($this->final2) && count($this->orig) === count($this->final2) && trim($this->orig[count($this->orig)-1]) === '' && trim($this->final2[count($this->final2)-1]) === '') { - unset($this->orig[sizeof($this->orig)-1], $this->final2[sizeof($this->final2)-1]); + unset($this->orig[count($this->orig)-1], $this->final2[count($this->final2)-1]); $this->orig = array_values($this->orig); $this->final2 = array_values($this->final2); @@ -972,7 +972,7 @@ class diff3_op } // CASE TWO: Added lines from orig to final2 but final1 had added lines too. Just merge them. - if (!sizeof($this->orig) && $this->final1 !== $this->final2 && sizeof($this->final1) && sizeof($this->final2)) + if (!count($this->orig) && $this->final1 !== $this->final2 && count($this->final1) && count($this->final2)) { $result = $this->_compare_conflict_seq('final2', 'final1'); @@ -1001,7 +1001,7 @@ class diff3_op } // CASE THREE: Removed lines (orig has the to-remove line(s), but final1 has additional lines which does not need to be removed). Just remove orig from final1 and then use final1 as final2/merge - if (!sizeof($this->final2) && sizeof($this->orig) && sizeof($this->final1) && $this->orig !== $this->final1) + if (!count($this->final2) && count($this->orig) && count($this->final1) && $this->orig !== $this->final1) { $result = $this->_compare_conflict_seq('orig', 'final1'); @@ -1011,11 +1011,11 @@ class diff3_op } // First of all, try to find the code in orig in final1. ;) - $compare_seq = sizeof($this->orig); + $compare_seq = count($this->orig); $begin = $end = -1; $j = 0; - for ($i = 0, $size = sizeof($this->final1); $i < $size; $i++) + for ($i = 0, $size = count($this->final1); $i < $size; $i++) { $line = $this->final1[$i]; @@ -1147,6 +1147,6 @@ class diff3_block_builder function _append(&$array, $lines) { - array_splice($array, sizeof($array), 0, $lines); + array_splice($array, count($array), 0, $lines); } } diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index bc21b3b9ba..757fdadde9 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -84,8 +84,8 @@ class diff_engine $to_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $to_lines)); } - $n_from = sizeof($from_lines); - $n_to = sizeof($to_lines); + $n_from = count($from_lines); + $n_to = count($to_lines); $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array(); unset($this->seq, $this->in_seq, $this->lcs); @@ -145,7 +145,7 @@ class diff_engine } // Find the LCS. - $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv)); + $this->_compareseq(0, count($this->xv), 0, count($this->yv)); // Merge edits when possible. if ($this->skip_whitespace_changes) @@ -444,8 +444,8 @@ class diff_engine $i = 0; $j = 0; - $len = sizeof($lines); - $other_len = sizeof($other_changed); + $len = count($lines); + $other_len = count($other_changed); while (1) { diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 6b7f07cf9c..c12ff3b7d5 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -128,8 +128,8 @@ class diff_renderer if (is_array($block)) { // How many lines to keep as context from the copy block. - $keep = ($i == sizeof($diffs) - 1) ? $ntrail : $nlead + $ntrail; - if (sizeof($edit->orig) <= $keep) + $keep = ($i == count($diffs) - 1) ? $ntrail : $nlead + $ntrail; + if (count($edit->orig) <= $keep) { // We have less lines in the block than we want for context => keep the whole block. $block[] = $edit; @@ -156,9 +156,9 @@ class diff_renderer if (!is_array($block)) { // Extract context lines from the preceding copy block. - $context = array_slice($context, sizeof($context) - $nlead); - $x0 = $xi - sizeof($context); - $y0 = $yi - sizeof($context); + $context = array_slice($context, count($context) - $nlead); + $x0 = $xi - count($context); + $y0 = $yi - count($context); $block = array(); if ($context) @@ -169,8 +169,8 @@ class diff_renderer $block[] = $edit; } - $xi += ($edit->orig) ? sizeof($edit->orig) : 0; - $yi += ($edit->final) ? sizeof($edit->final) : 0; + $xi += ($edit->orig) ? count($edit->orig) : 0; + $yi += ($edit->final) ? count($edit->final) : 0; } if (is_array($block)) @@ -433,7 +433,7 @@ class diff_renderer_inline extends diff_renderer { array_walk($lines, array(&$this, '_encode')); $lines[0] = $this->_ins_prefix . $lines[0]; - $lines[sizeof($lines) - 1] .= $this->_ins_suffix; + $lines[count($lines) - 1] .= $this->_ins_suffix; return $this->_lines($lines, ' ', false); } @@ -441,7 +441,7 @@ class diff_renderer_inline extends diff_renderer { array_walk($lines, array(&$this, '_encode')); $lines[0] = $this->_del_prefix . $lines[0]; - $lines[sizeof($lines) - 1] .= $this->_del_suffix; + $lines[count($lines) - 1] .= $this->_del_suffix; return $this->_lines($lines, ' ', false); } @@ -617,7 +617,7 @@ class diff_renderer_side_by_side extends diff_renderer $this->render($diff); // Is the diff empty? - if (!sizeof($this->lines)) + if (!count($this->lines)) { $output .= '
          ' . $user->lang['NO_VISIBLE_CHANGES'] . '
          + attach_idpost_msg_idtopic_idin_message @@ -9,6 +10,7 @@ physical_filenamethumbnail + 1 1 1 0 @@ -18,6 +20,7 @@ 0 + 2 1 1 1 @@ -27,6 +30,7 @@ 0 + 3 1 1 1 @@ -37,13 +41,16 @@
          + extension_idextensiongroup_id + 1 jpg 1 + 2 png 1 -- cgit v1.2.1 From 66143e99bee0931b77c50d9e3b1fbd0b9629e48d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Jan 2017 11:05:45 +0100 Subject: [ticket/15055] Further fixes to ensure PHP 7.1 & mssql compatibility PHPBB3-15055 --- .appveyor.yml | 6 ++---- phpBB/includes/acp/acp_bbcodes.php | 2 +- tests/console/user/base.php | 5 +++++ tests/test_framework/phpbb_functional_test_case.php | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5a4b2b4951..9ca7aee8a0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,10 +6,7 @@ services: init: - SET PATH=c:\php;%PATH% - - SET COMPOSER_NO_INTERACTION=1 - - SET SYMFONY_DEPRECATIONS_HELPER=strict - SET ANSICON=121x90 (121x90) - - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f before_test: @@ -19,6 +16,7 @@ before_test: - cd c:\tools\php - ps: cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini - echo date.timezone="UTC" >> php.ini + - echo display_errors=On >> php.ini - echo extension_dir=ext >> php.ini - echo extension=php_openssl.dll >> php.ini - echo extension=php_mbstring.dll >> php.ini @@ -39,4 +37,4 @@ before_test: test_script: - cd c:\projects\phpbb - - php -e phpBB\vendor\phpunit\phpunit\phpunit --verbose --stop-on-error + - php -e phpBB\vendor\phpunit\phpunit\phpunit --verbose diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 18d574081a..e9d96bdecc 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -253,7 +253,7 @@ class acp_bbcodes if ($row) { - $bbcode_id = $row['max_bbcode_id'] + 1; + $bbcode_id = (int) $row['max_bbcode_id'] + 1; // Make sure it is greater than the core bbcode ids... if ($bbcode_id <= NUM_CORE_BBCODES) diff --git a/tests/console/user/base.php b/tests/console/user/base.php index b84c0bb267..6e5436fb9d 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -34,6 +34,11 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case { global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx; + if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux') + { + $this->markTestSkipped('Unable to test console feature on OS other than Linux.'); + } + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('cache.driver', new phpbb_mock_cache()); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index c9943c4302..4e22e7b039 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -509,7 +509,6 @@ class phpbb_functional_test_case extends phpbb_test_case else { $db->sql_multi_insert(STYLES_TABLE, array(array( - 'style_id' => $style_id, 'style_name' => $style_path, 'style_copyright' => '', 'style_active' => 1, -- cgit v1.2.1 From 44ba0f5054151e3207ff49610728bf8cfe1ab78f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Jan 2017 11:50:22 +0100 Subject: [ticket/15055] Start setting up IIS PHPBB3-15055 --- .appveyor.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 9ca7aee8a0..363d528523 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,8 +1,13 @@ build: false clone_folder: c:\projects\phpbb +version: '{build}' services: - mssql2014 + - iis + +hosts: + phpbb.test: 127.0.0.1 init: - SET PATH=c:\php;%PATH% @@ -33,7 +38,23 @@ before_test: - php ..\composer.phar install - cd c:\projects\phpbb\tests - touch test_config.php - - ps: $data = " Date: Sun, 29 Jan 2017 14:05:27 +0100 Subject: [ticket/15055] Start fixing missing keys in fixtures PHPBB3-15055 --- .appveyor.yml | 2 ++ tests/dbal/fixtures/boolean_processor.xml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index 363d528523..472ac433bb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -51,6 +51,8 @@ before_test: - appcmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\tools\php\php-cgi.exe',resourceType='Either'] - iisreset - NET START W3SVC + - mkdir "C:\projects\phpbb\phpBB\cache\test" + - mkdir "C:\projects\phpbb\phpBB\cache\installer" - icacls "C:\projects\phpbb\phpBB\cache" /grant Users:F /T - icacls "C:\projects\phpbb\phpBB\files" /grant Users:F /T - icacls "C:\projects\phpbb\phpBB\store" /grant Users:F /T diff --git a/tests/dbal/fixtures/boolean_processor.xml b/tests/dbal/fixtures/boolean_processor.xml index c5da677116..d31d679f45 100644 --- a/tests/dbal/fixtures/boolean_processor.xml +++ b/tests/dbal/fixtures/boolean_processor.xml @@ -60,25 +60,31 @@
          user_idgroup_id + group_leader 1 1 + 2 2 1 + 2 3 1 + 2 4 2 + 2 5 2 + 2
          -- cgit v1.2.1 From 5bb62f5560ee913efe56c1fcb8c1a855204cc658 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Jan 2017 15:56:21 +0100 Subject: [ticket/15055] Use unicode column types where necessary PHPBB3-15055 --- phpBB/phpbb/db/tools/mssql.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index 23b49aab44..6f800f730d 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -49,18 +49,18 @@ class mssql extends tools 'STEXT' => '[varchar] (3000)', 'TEXT' => '[varchar] (8000)', 'MTEXT' => '[text]', - 'XSTEXT_UNI'=> '[varchar] (100)', - 'STEXT_UNI' => '[varchar] (255)', - 'TEXT_UNI' => '[varchar] (4000)', - 'MTEXT_UNI' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', 'TIMESTAMP' => '[int]', 'DECIMAL' => '[float]', 'DECIMAL:' => '[float]', 'PDECIMAL' => '[float]', 'PDECIMAL:' => '[float]', - 'VCHAR_UNI' => '[varchar] (255)', - 'VCHAR_UNI:'=> '[varchar] (%d)', - 'VCHAR_CI' => '[varchar] (255)', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', 'VARBINARY' => '[varchar] (255)', ), @@ -80,18 +80,18 @@ class mssql extends tools 'STEXT' => '[varchar] (3000)', 'TEXT' => '[varchar] (8000)', 'MTEXT' => '[text]', - 'XSTEXT_UNI'=> '[varchar] (100)', - 'STEXT_UNI' => '[varchar] (255)', - 'TEXT_UNI' => '[varchar] (4000)', - 'MTEXT_UNI' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', 'TIMESTAMP' => '[int]', 'DECIMAL' => '[float]', 'DECIMAL:' => '[float]', 'PDECIMAL' => '[float]', 'PDECIMAL:' => '[float]', - 'VCHAR_UNI' => '[varchar] (255)', - 'VCHAR_UNI:'=> '[varchar] (%d)', - 'VCHAR_CI' => '[varchar] (255)', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', 'VARBINARY' => '[varchar] (255)', ), ); -- cgit v1.2.1 From 635befa00e0d9791137a2a500260b578021f60b8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Jan 2017 15:56:45 +0100 Subject: [ticket/15055] Drop primary keys when necessary and fix test comparisons PHPBB3-15055 --- phpBB/phpbb/db/tools/mssql.php | 35 +++++++++++++++++++++++++++++++++++ tests/dbal/db_tools_test.php | 9 ++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index 6f800f730d..0dfb09b1ba 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -448,6 +448,10 @@ class mssql extends tools } } + // Drop primary keys depending on this column + $result = $this->mssql_get_drop_default_primary_key_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + // Drop default value constraint $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); $statements = array_merge($statements, $result); @@ -684,6 +688,37 @@ class mssql extends tools return $statements; } + /** + * Get queries to drop the primary keys depending on the specified column + * + * We need to drop primary keys depending on this column before being able + * to delete them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_primary_key_queries($table_name, $column_name) + { + $statements = array(); + + $sql = "SELECT ccu.CONSTRAINT_NAME, ccu.COLUMN_NAME + FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc + JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name + WHERE tc.TABLE_NAME = '{$table_name}' + AND tc.CONSTRAINT_TYPE = 'Primary Key'"; + + $result = $this->db->sql_query($sql); + + while ($primary_key = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $primary_key['CONSTRAINT_NAME'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + /** * Checks to see if column is an identity column * diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index f9243e7266..f78cebdec7 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -203,8 +203,15 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_list_columns() { + $config = $this->get_database_config(); + $table_columns = $this->table_data['COLUMNS']; + + if (strpos($config['dbms'], 'mssql') !== false) + { + ksort($table_columns); + } $this->assertEquals( - array_keys($this->table_data['COLUMNS']), + array_keys($table_columns), array_values($this->tools->sql_list_columns('prefix_table_name')) ); } -- cgit v1.2.1 From f903e5b3c025560d44622bcd4d15c7e0fa3b1633 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 24 Dec 2017 11:06:31 +0100 Subject: [ticket/15055] Try moving to PHP 7.1 PHPBB3-15055 --- .appveyor.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 472ac433bb..ef301584b7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,9 +15,13 @@ init: - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f before_test: + - ps: Set-Service wuauserv -StartupType Manual - sqlcmd -S "(local)\SQL2014" -Q "Use [master]; CREATE DATABASE [phpbb_test]" - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - - cinst -y php -version 5.6.17 --allow-empty-checksums + - ps: Set-Service wuauserv -StartupType Manual + - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern 7.1 | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + - ps: Get-ChildItem -Path "c:\tools\php71" -Recurse | + Move-Item -destination "c:\tools\php" - cd c:\tools\php - ps: cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini - echo date.timezone="UTC" >> php.ini @@ -29,11 +33,18 @@ before_test: - echo extension=php_gd2.dll >> php.ini - echo extension=php_tidy.dll >> php.ini - echo extension=php_fileinfo.dll >> php.ini - - php -r "readfile('https://dl.dropboxusercontent.com/u/7129062/sqlsrv_unofficial_3.0.2.2.zip');" > sqlsrv.zip - - unzip sqlsrv.zip - - copy sqlsrv_unofficial_3.0.2.2\x64\*.dll ext - - echo extension=php_sqlsrv_56_nts.dll >> php.ini - - echo extension=php_pdo_sqlsrv_56_nts.dll >> php.ini + - ps: | + cd c:\tools\php\ext + $DLLVersion = "4.1.6.1" + appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip + 7z x -y php_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip > $null + appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip + 7z x -y php_pdo_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip > $null + Remove-Item c:\tools\php\* -include .zip + cd c:\tools\php + Add-Content php.ini "`nextension=php_sqlsrv.dll" + Add-Content php.ini "`nextension=php_pdo_sqlsrv.dll" + Add-Content php.ini "`n" - cd c:\projects\phpbb\phpBB - php ..\composer.phar install - cd c:\projects\phpbb\tests -- cgit v1.2.1 From f4381a20d4ec6201a00cd618c24fd29b67f77965 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 24 Dec 2017 16:48:28 +0100 Subject: [ticket/15055] Handle default identity column on mssql in database tests PHPBB3-15055 --- tests/test_framework/phpbb_database_test_case.php | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index b7386e9a3e..670d39ed69 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -145,6 +145,53 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function createXMLDataSet($path) { $this->fixture_xml_data = parent::createXMLDataSet($path); + if (strpos($this->get_database_config()['dbms'], 'mssql') !== false) + { + $newXmlData = new PHPUnit_Extensions_Database_DataSet_DefaultDataSet(); + $db = $this->new_dbal(); + foreach ($this->fixture_xml_data as $key => $value) + { + $sql = "SELECT COLUMN_NAME AS identity_column + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 + AND TABLE_NAME = '$key' + ORDER BY TABLE_NAME"; + $result = $db->sql_query($sql); + $identity_columns = $db->sql_fetchrowset($result); + $has_default_identity = false; + foreach ($identity_columns as $column) + { + if ($column['identity_column'] === 'mssqlindex') + { + $has_default_identity = true; + break; + } + } + + if ($has_default_identity) + { + /** @var \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData $tableMetaData */ + $tableMetaData = $value->getTableMetaData(); + $columns = $tableMetaData->getColumns(); + $columns[] = 'mssqlindex'; + $newMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($key, $columns, $tableMetaData->getPrimaryKeys()); + $newTable = new PHPUnit_Extensions_Database_DataSet_DefaultTable($newMetaData); + for ($i = 0; $i < $value->getRowCount(); $i++) + { + $dataRow = $value->getRow($i); + $dataRow['mssqlindex'] = $i + 1; + $newTable->addRow($dataRow); + } + $newXmlData->addTable($newTable); + } + else + { + $newXmlData->addTable($value); + } + } + + $this->fixture_xml_data = $newXmlData; + } return $this->fixture_xml_data; } -- cgit v1.2.1 From 400fc0f73d03010d3bf28d2b1db5d789dc085334 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 25 Dec 2017 18:49:31 +0100 Subject: [ticket/15055] Only drop dependent PK indexes and fix more tests for mssql PHPBB3-15055 --- phpBB/phpbb/db/tools/mssql.php | 3 ++- tests/dbal/db_tools_test.php | 5 +++- tests/functions/fixtures/validate_username.xml | 2 ++ tests/functions_user/fixtures/delete_user.xml | 9 +++++++ .../submit_post_notification.type.bookmark.xml | 2 ++ .../submit_post_notification.type.post.xml | 3 +++ ...submit_post_notification.type.post_in_queue.xml | 2 ++ .../submit_post_notification.type.quote.xml | 2 ++ .../submit_post_notification.type.topic.xml | 2 ++ tests/notification/notification_test.php | 2 +- tests/search/fixtures/posts.xml | 5 ++++ tests/test_framework/phpbb_database_test_case.php | 30 +++++++++++++++++----- 12 files changed, 57 insertions(+), 10 deletions(-) diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index 0dfb09b1ba..1e4d3aee2f 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -706,7 +706,8 @@ class mssql extends tools FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name WHERE tc.TABLE_NAME = '{$table_name}' - AND tc.CONSTRAINT_TYPE = 'Primary Key'"; + AND tc.CONSTRAINT_TYPE = 'Primary Key' + AND ccu.COLUMN_NAME = '{$column_name}'"; $result = $this->db->sql_query($sql); diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index f78cebdec7..dbe2c2909a 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -462,7 +462,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case // Index name has > 30 chars - that should not be possible. $too_long_index_name = str_repeat('i', 31); $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', $too_long_index_name)); - $this->setExpectedTriggerError(E_USER_ERROR); + if (strpos($this->tools->sql_layer, 'mssql') === false) + { + $this->setExpectedTriggerError(E_USER_ERROR); + } $this->tools->sql_create_index('prefix_table_name', $too_long_index_name, array('c_timestamp')); } } diff --git a/tests/functions/fixtures/validate_username.xml b/tests/functions/fixtures/validate_username.xml index 1b85a2f06d..add8f76553 100644 --- a/tests/functions/fixtures/validate_username.xml +++ b/tests/functions/fixtures/validate_username.xml @@ -1,9 +1,11 @@ + group_idgroup_namegroup_desc + 10 foobar_group test123 diff --git a/tests/functions_user/fixtures/delete_user.xml b/tests/functions_user/fixtures/delete_user.xml index 56014b35d1..8de2659722 100644 --- a/tests/functions_user/fixtures/delete_user.xml +++ b/tests/functions_user/fixtures/delete_user.xml @@ -515,35 +515,44 @@
          user_id + folder_id 2 + 1 3 + 2
          user_idrule_string + rule_id 2 + 1 3 + 2
          user_iddraft_message + draft_id 2 + 1 3 + 2
          diff --git a/tests/notification/fixtures/submit_post_notification.type.bookmark.xml b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml index 7f069abc59..db1cef2ef6 100644 --- a/tests/notification/fixtures/submit_post_notification.type.bookmark.xml +++ b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml @@ -29,6 +29,7 @@ + notification_idnotification_type_iduser_iditem_id @@ -36,6 +37,7 @@ notification_readnotification_data + 1 1 5 1 diff --git a/tests/notification/fixtures/submit_post_notification.type.post.xml b/tests/notification/fixtures/submit_post_notification.type.post.xml index a4bf9d3ee4..920b271525 100644 --- a/tests/notification/fixtures/submit_post_notification.type.post.xml +++ b/tests/notification/fixtures/submit_post_notification.type.post.xml @@ -21,6 +21,7 @@
          + notification_idnotification_type_iduser_iditem_id @@ -28,6 +29,7 @@ notification_readnotification_data + 1 1 5 1 @@ -36,6 +38,7 @@ + 2 1 8 1 diff --git a/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml index 0a955c48d2..12e73b0ff2 100644 --- a/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml +++ b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml @@ -1,6 +1,7 @@
          + notification_idnotification_type_iduser_iditem_id @@ -8,6 +9,7 @@ notification_readnotification_data + 1 1 6 1 diff --git a/tests/notification/fixtures/submit_post_notification.type.quote.xml b/tests/notification/fixtures/submit_post_notification.type.quote.xml index c66830fbf5..9f4ba91475 100644 --- a/tests/notification/fixtures/submit_post_notification.type.quote.xml +++ b/tests/notification/fixtures/submit_post_notification.type.quote.xml @@ -1,6 +1,7 @@
          + notification_idnotification_type_iduser_iditem_id @@ -8,6 +9,7 @@ notification_readnotification_data + 1 1 5 1 diff --git a/tests/notification/fixtures/submit_post_notification.type.topic.xml b/tests/notification/fixtures/submit_post_notification.type.topic.xml index e0f6583f48..1f96ed2ee7 100644 --- a/tests/notification/fixtures/submit_post_notification.type.topic.xml +++ b/tests/notification/fixtures/submit_post_notification.type.topic.xml @@ -21,6 +21,7 @@
          + notification_idnotification_type_iduser_iditem_id @@ -28,6 +29,7 @@ notification_readnotification_data + 1 1 8 1 diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php index ec42aa193c..6bbabfc602 100644 --- a/tests/notification/notification_test.php +++ b/tests/notification/notification_test.php @@ -108,7 +108,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base $types = array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'); foreach ($types as $id => $type) { - $this->db->sql_query('INSERT INTO phpbb_notification_types ' . + $this->getConnection()->createQueryTable('insertNotification', 'INSERT INTO phpbb_notification_types ' . $this->db->sql_build_array('INSERT', array( 'notification_type_id' => ($id + 1), 'notification_type_name' => $type, diff --git a/tests/search/fixtures/posts.xml b/tests/search/fixtures/posts.xml index 16232b8f39..4916cd188b 100644 --- a/tests/search/fixtures/posts.xml +++ b/tests/search/fixtures/posts.xml @@ -1,25 +1,30 @@
          + post_idpost_usernamepost_subjectpost_text + 1 foo foo foo + 2 bar bar bar + 3 commonword commonword commonword + 4 baaz baaz baaz diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 670d39ed69..bbcb8d9a48 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -151,6 +151,11 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $db = $this->new_dbal(); foreach ($this->fixture_xml_data as $key => $value) { + /** @var \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData $tableMetaData */ + $tableMetaData = $value->getTableMetaData(); + $columns = $tableMetaData->getColumns(); + $primaryKeys = $tableMetaData->getPrimaryKeys(); + $sql = "SELECT COLUMN_NAME AS identity_column FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMNPROPERTY(object_id(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 @@ -159,8 +164,15 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $result = $db->sql_query($sql); $identity_columns = $db->sql_fetchrowset($result); $has_default_identity = false; + $add_primary_keys = false; foreach ($identity_columns as $column) { + if (in_array($column['identity_column'], $columns) && !in_array($column['identity_column'], $primaryKeys)) + { + $primaryKeys[] = $column['identity_column']; + $add_primary_keys = true; + } + if ($column['identity_column'] === 'mssqlindex') { $has_default_identity = true; @@ -168,18 +180,22 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } - if ($has_default_identity) + if ($has_default_identity || $add_primary_keys) { - /** @var \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData $tableMetaData */ - $tableMetaData = $value->getTableMetaData(); - $columns = $tableMetaData->getColumns(); - $columns[] = 'mssqlindex'; - $newMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($key, $columns, $tableMetaData->getPrimaryKeys()); + if ($has_default_identity) + { + $columns[] = 'mssqlindex'; + } + + $newMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($key, $columns, $primaryKeys); $newTable = new PHPUnit_Extensions_Database_DataSet_DefaultTable($newMetaData); for ($i = 0; $i < $value->getRowCount(); $i++) { $dataRow = $value->getRow($i); - $dataRow['mssqlindex'] = $i + 1; + if ($has_default_identity) + { + $dataRow['mssqlindex'] = $i + 1; + } $newTable->addRow($dataRow); } $newXmlData->addTable($newTable); -- cgit v1.2.1 From 27a24d0a677a3f1fb0dcf2393859eb37fe3bc0c3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 25 Dec 2017 19:20:02 +0100 Subject: [ticket/15055] Try using build matrix PHPBB3-15055 --- .appveyor.yml | 26 +++++++++++++++++++--- phpBB/phpbb/tree/nestedset.php | 2 +- .../phpbb_database_test_connection_manager.php | 8 +++++++ tests/tree/nestedset_forum_base.php | 10 +++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ef301584b7..9e5d687372 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,9 +3,23 @@ clone_folder: c:\projects\phpbb version: '{build}' services: - - mssql2014 - iis +environment: + matrix: + - db: mssql + db_version: sql2012sp1 + php: 7.1 + - db: mssql + db_version: sql2014 + php: 7.1 + - db: mssql + db_version: sql2016 + php: 7.1 + - db: mssql + db_version: sql2017 + php: 7.1 + hosts: phpbb.test: 127.0.0.1 @@ -16,7 +30,13 @@ init: before_test: - ps: Set-Service wuauserv -StartupType Manual - - sqlcmd -S "(local)\SQL2014" -Q "Use [master]; CREATE DATABASE [phpbb_test]" + - ps: | + $instanceName = $env:db_version.ToUpper() + Start-Service "MSSQL`$$instanceName" + Set-Variable -Name "sqlServerPath" -Value "(local)\$($env:db_version.ToUpper())" + Write-Host "$sqlServerPath" + Write-Host "$env:db_version --> $($env:db_version.ToUpper())" + sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS" - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - ps: Set-Service wuauserv -StartupType Manual - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern 7.1 | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') @@ -49,7 +69,7 @@ before_test: - php ..\composer.phar install - cd c:\projects\phpbb\tests - touch test_config.php - - ps: $data = "db->sql_fetchrow($result); $this->db->sql_freeresult($result); - $diff = ' + ' . ($row[$this->column_right_id] - (int) $item[$this->column_left_id] + 1); + $diff = ' + ' . ((int) $row[$this->column_right_id] - (int) $item[$this->column_left_id] + 1); } $sql = 'UPDATE ' . $this->table_name . ' diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 147029d699..74170f2f35 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -222,6 +222,14 @@ class phpbb_database_test_connection_manager $this->purge_extras(); break; + case 'phpbb\db\driver\mssql': + case 'phpbb\db\driver\mssqlnative': + $this->connect(); + // Drop all tables + $this->pdo->exec("EXEC sp_MSforeachtable 'DROP TABLE ?'"); + $this->purge_extras(); + break; + default: $this->connect(false); diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php index 3daa75b2e4..62f3e0bcab 100644 --- a/tests/tree/nestedset_forum_base.php +++ b/tests/tree/nestedset_forum_base.php @@ -100,6 +100,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case } else { + if (strpos($this->db->sql_layer, 'mssql') !== false) + { + $sql = 'SET IDENTITY_INSERT phpbb_forums ON'; + $this->db->sql_query($sql); + } $buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_forums'); $buffer->insert_all($forums); $buffer->flush(); @@ -107,6 +112,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case $this->database_synchronisation(array( 'phpbb_forums' => array('forum_id'), )); + if (strpos($this->db->sql_layer, 'mssql') !== false) + { + $sql = 'SET IDENTITY_INSERT phpbb_forums OFF'; + $this->db->sql_query($sql); + } } } -- cgit v1.2.1 From 6f6750b6294232e6cd11eb38d0cb8492d1e1245a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 27 Dec 2017 09:04:15 +0100 Subject: [ticket/15055] Specify utf8 as character set in sqlsrv_connect This is needed to be able to correctly retrieve unicode data from the db. PHPBB3-15055 --- phpBB/phpbb/db/driver/mssqlnative.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 50dce35baa..28bd3ceb42 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -50,7 +50,8 @@ class mssqlnative extends \phpbb\db\driver\mssql_base $this->db_connect_id = sqlsrv_connect($this->server, array( 'Database' => $this->dbname, 'UID' => $this->user, - 'PWD' => $sqlpassword + 'PWD' => $sqlpassword, + 'CharacterSet' => 'UTF-8' )); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); -- cgit v1.2.1 From 9883aa4930a5af4df1cfefeb1d82891d81460c9a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 30 Dec 2017 12:05:05 +0100 Subject: [ticket/15055] Run also on PHP 7.0 PHPBB3-15055 --- .appveyor.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 9e5d687372..d5c5203fbe 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,6 +7,9 @@ services: environment: matrix: + - db: mssql + db_version: sql2017 + php: 7.0 - db: mssql db_version: sql2012sp1 php: 7.1 @@ -39,8 +42,8 @@ before_test: sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS" - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - ps: Set-Service wuauserv -StartupType Manual - - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern 7.1 | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - - ps: Get-ChildItem -Path "c:\tools\php71" -Recurse | + - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + - ps: Get-ChildItem -Path "c:\tools\php$($env:php -replace '[.]','')" -Recurse | Move-Item -destination "c:\tools\php" - cd c:\tools\php - ps: cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini @@ -56,10 +59,10 @@ before_test: - ps: | cd c:\tools\php\ext $DLLVersion = "4.1.6.1" - appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip - 7z x -y php_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip > $null - appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip - 7z x -y php_pdo_sqlsrv-$($DLLVersion)-7.1-nts-vc14-x64.zip > $null + appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip + 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null + appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip + 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null Remove-Item c:\tools\php\* -include .zip cd c:\tools\php Add-Content php.ini "`nextension=php_sqlsrv.dll" -- cgit v1.2.1 From ede339c1c8b19fa01a61594d231902013ef473b0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 30 Dec 2017 12:25:05 +0100 Subject: [ticket/15055] Extend build matrix and trim text in extension_acp_test PHPBB3-15055 --- .appveyor.yml | 126 +++++++++++++++++++++----------- tests/functional/extension_acp_test.php | 2 +- 2 files changed, 83 insertions(+), 45 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d5c5203fbe..fa2fd9fc20 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,76 +7,114 @@ services: environment: matrix: - - db: mssql - db_version: sql2017 - php: 7.0 - db: mssql db_version: sql2012sp1 - php: 7.1 + php: 7.0 - db: mssql db_version: sql2014 - php: 7.1 + php: 7.0 - db: mssql db_version: sql2016 - php: 7.1 + php: 7.0 - db: mssql db_version: sql2017 php: 7.1 +# - db: mariadb +# php: 7.1 +# - db: mysqli +# php: 7.1 +# - db: sqlite +# php: 7.1 +# - db: postgresql +# php: 7.1 hosts: phpbb.test: 127.0.0.1 init: - - SET PATH=c:\php;%PATH% + - SET PATH=%systemroot%\system32\inetsrv\;C:\Program Files\OpenSSL;C:\tools\php;c:\php;%PATH% - SET ANSICON=121x90 (121x90) - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f before_test: - - ps: Set-Service wuauserv -StartupType Manual - ps: | - $instanceName = $env:db_version.ToUpper() - Start-Service "MSSQL`$$instanceName" - Set-Variable -Name "sqlServerPath" -Value "(local)\$($env:db_version.ToUpper())" - Write-Host "$sqlServerPath" - Write-Host "$env:db_version --> $($env:db_version.ToUpper())" - sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS" - - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - - ps: Set-Service wuauserv -StartupType Manual - - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - - ps: Get-ChildItem -Path "c:\tools\php$($env:php -replace '[.]','')" -Recurse | + Set-Service wuauserv -StartupType Manual + cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + Get-ChildItem -Path "c:\tools\php$($env:php -replace '[.]','')" -Recurse | Move-Item -destination "c:\tools\php" - - cd c:\tools\php - - ps: cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini - - echo date.timezone="UTC" >> php.ini - - echo display_errors=On >> php.ini - - echo extension_dir=ext >> php.ini - - echo extension=php_openssl.dll >> php.ini - - echo extension=php_mbstring.dll >> php.ini - - echo extension=php_curl.dll >> php.ini - - echo extension=php_gd2.dll >> php.ini - - echo extension=php_tidy.dll >> php.ini - - echo extension=php_fileinfo.dll >> php.ini - - ps: | - cd c:\tools\php\ext - $DLLVersion = "4.1.6.1" - appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip - 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null - appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip - 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null - Remove-Item c:\tools\php\* -include .zip cd c:\tools\php - Add-Content php.ini "`nextension=php_sqlsrv.dll" - Add-Content php.ini "`nextension=php_pdo_sqlsrv.dll" - Add-Content php.ini "`n" + cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini + Add-Content php.ini "`n date.timezone=UTC" + Add-Content php.ini "`n display_errors=On" + Add-Content php.ini "`n extension_dir=ext" + Add-Content php.ini "`n extension=php_openssl.dll" + Add-Content php.ini "`n extension=php_mbstring.dll" + Add-Content php.ini "`n extension=php_curl.dll" + Add-Content php.ini "`n extension=php_gd2.dll" + Add-Content php.ini "`n extension=php_tidy.dll" + Add-Content php.ini "`n extension=php_fileinfo.dll" + Add-Content php.ini "`n extension=php_pdo_sqlite.dll" + Add-Content php.ini "`n extension=php_sqlite3.dll" + Add-Content php.ini "`n extension=php_pdo_mysql.dll" + Add-Content php.ini "`n extension=php_mysqli.dll" + Add-Content php.ini "`n extension=php_pdo_pgsql.dll" + Add-Content php.ini "`n extension=php_pgsql.dll" + + # Get MSSQL driver + if ($env:db -eq "mssql") { + cd c:\tools\php\ext + $DLLVersion = "4.1.6.1" + appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip + 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null + appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip + 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null + Remove-Item c:\tools\php\* -include .zip + cd c:\tools\php + Add-Content php.ini "`nextension=php_sqlsrv.dll" + Add-Content php.ini "`nextension=php_pdo_sqlsrv.dll" + Add-Content php.ini "`n" + + $instanceName = $env:db_version.ToUpper() + Start-Service "MSSQL`$$instanceName" + Set-Variable -Name "sqlServerPath" -Value "(local)\$($env:db_version.ToUpper())" + + # Create database write test config + sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS" + $data = "filter('dl')->count(); $i++) { - $text = $crawler->filter('dl')->eq($i)->text(); + $text = trim($crawler->filter('dl')->eq($i)->text()); $match = false; -- cgit v1.2.1 From a999718b42742c9911a24a74cf60f80e196d5cf8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 11:53:15 +0100 Subject: [ticket/15055] Support console questions on windows PHPBB3-15055 --- tests/console/user/add_test.php | 48 ++++++++++++++++++++++++++++++++++--- tests/console/user/base.php | 5 ---- tests/dbal/db_tools_test.php | 4 ---- tests/tree/nestedset_forum_base.php | 10 +++++--- 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php index 8641bf87b6..d1a1f8542e 100644 --- a/tests/console/user/add_test.php +++ b/tests/console/user/add_test.php @@ -14,12 +14,15 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; use phpbb\console\command\user\add; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; require_once dirname(__FILE__) . '/base.php'; class phpbb_console_user_add_test extends phpbb_console_user_base { - public function get_command_tester() + public function get_command_tester($question_answers = []) { $application = new Application(); $application->add(new add( @@ -34,7 +37,42 @@ class phpbb_console_user_add_test extends phpbb_console_user_base $command = $application->find('user:add'); $this->command_name = $command->getName(); - $this->question = $command->getHelper('question'); + + if (!empty($question_answers)) + { + $ask = function(InputInterface $input, OutputInterface $output, Question $question) use ($question_answers) + { + $text = $question->getQuestion(); + + // handle a question + foreach ($question_answers as $expected_question => $answer) + { + if (strpos($text, $expected_question) !== false) + { + $response = $answer; + } + } + + if (!isset($response)) + { + throw new \RuntimeException('Was asked for input on an unhandled question: ' . $text); + } + + $output->writeln(print_r($response, true)); + return $response; + }; + $helper = $this->createMock('\Symfony\Component\Console\Helper\QuestionHelper'); + $helper->expects($this->any()) + ->method('ask') + ->will($this->returnCallback($ask)); + $this->question = $helper; + $command->getHelperSet()->set($helper, 'question'); + } + else + { + $this->question = $command->getHelper('question'); + } + return new CommandTester($command); } @@ -57,7 +95,11 @@ class phpbb_console_user_add_test extends phpbb_console_user_base public function test_add_dialog() { - $command_tester = $this->get_command_tester(); + $command_tester = $this->get_command_tester([ + 'USERNAME' => 'bar', + 'PASSWORD' => 'password', + 'EMAIL_ADDRESS' => 'bar@test.com', + ]); $this->assertEquals(2, $this->get_user_id('Admin')); diff --git a/tests/console/user/base.php b/tests/console/user/base.php index 6e5436fb9d..b84c0bb267 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -34,11 +34,6 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case { global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx; - if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux') - { - $this->markTestSkipped('Unable to test console feature on OS other than Linux.'); - } - $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('cache.driver', new phpbb_mock_cache()); diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index dbe2c2909a..72a3718662 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -462,10 +462,6 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case // Index name has > 30 chars - that should not be possible. $too_long_index_name = str_repeat('i', 31); $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', $too_long_index_name)); - if (strpos($this->tools->sql_layer, 'mssql') === false) - { - $this->setExpectedTriggerError(E_USER_ERROR); - } $this->tools->sql_create_index('prefix_table_name', $too_long_index_name, array('c_timestamp')); } } diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php index 62f3e0bcab..498c6a69a2 100644 --- a/tests/tree/nestedset_forum_base.php +++ b/tests/tree/nestedset_forum_base.php @@ -69,7 +69,7 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case static $forums; if (empty($forums)) - { + { $this->create_forum('Parent with two flat children'); $this->create_forum('Flat child #1', 1); $this->create_forum('Flat child #2', 1); @@ -86,7 +86,7 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case // Updating forum_parents column here so it's not empty // This is required, so we can see whether the methods - // correctly clear the values. + // correctly clear the values. $sql = "UPDATE phpbb_forums SET forum_parents = 'a:0:{}'"; $this->db->sql_query($sql); @@ -100,6 +100,8 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case } else { + // Turn on identity insert on mssql to be able to insert into + // identity columns (e.g. forum_id) if (strpos($this->db->sql_layer, 'mssql') !== false) { $sql = 'SET IDENTITY_INSERT phpbb_forums ON'; @@ -112,12 +114,14 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case $this->database_synchronisation(array( 'phpbb_forums' => array('forum_id'), )); + + // Disable identity insert on mssql again if (strpos($this->db->sql_layer, 'mssql') !== false) { $sql = 'SET IDENTITY_INSERT phpbb_forums OFF'; $this->db->sql_query($sql); } - } + } } protected function create_forum($name, $parent_id = 0) -- cgit v1.2.1 From d99ef034463ec94739026ca5154e597db77df8a9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 31 Dec 2017 11:57:02 +0100 Subject: [ticket/15055] Run phantomjs for UI tests PHPBB3-15055 --- .appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index fa2fd9fc20..e536a561ff 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -110,6 +110,10 @@ before_test: sqlite3 c:\projects\test.db "create table aTable(field1 int); drop table aTable;" $data = " Date: Sun, 31 Dec 2017 14:00:36 +0100 Subject: [ticket/15055] Properly support index length check on mssql PHPBB3-15055 --- phpBB/phpbb/db/tools/mssql.php | 20 ++++++++++++++++---- phpBB/phpbb/db/tools/tools.php | 15 +++++++++++++-- tests/dbal/db_tools_test.php | 24 +++++++++++++++++------- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index 1e4d3aee2f..b84c0db403 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -545,10 +545,7 @@ class mssql extends tools { $statements = array(); - if ($this->mssql_is_sql_server_2000()) - { - $this->check_index_name_length($table_name, $index_name); - } + $this->check_index_name_length($table_name, $index_name); // remove index length $column = preg_replace('#:.*$#', '', $column); @@ -558,6 +555,21 @@ class mssql extends tools return $this->_sql_run_sql($statements); } + /** + * {@inheritdoc} + */ + protected function get_max_index_name_length() + { + if ($this->mssql_is_sql_server_2000()) + { + return parent::get_max_index_name_length(); + } + else + { + return 128; + } + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php index 2f891e43d5..d21d34b8a9 100644 --- a/phpBB/phpbb/db/tools/tools.php +++ b/phpBB/phpbb/db/tools/tools.php @@ -1561,7 +1561,8 @@ class tools implements tools_interface */ protected function check_index_name_length($table_name, $index_name, $throw_error = true) { - if (strlen($index_name) > 30) + $max_index_name_length = $this->get_max_index_name_length(); + if (strlen($index_name) > $max_index_name_length) { // Try removing the table prefix if it's at the beginning $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) @@ -1582,13 +1583,23 @@ class tools implements tools_interface if ($throw_error) { - trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is $max_index_name_length characters.", E_USER_ERROR); } } return $index_name; } + /** + * Get maximum index name length. Might vary depending on db type + * + * @return int Maximum index name length + */ + protected function get_max_index_name_length() + { + return 30; + } + /** * {@inheritDoc} */ diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index 72a3718662..0365463a48 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -439,29 +439,39 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->markTestIncomplete('The table prefix length is too long for proper testing of index shortening function.'); } + $max_index_length = 30; + + if ($this->tools instanceof \phpbb\db\tools\mssql) + { + $max_length_method = new ReflectionMethod('\phpbb\db\tools\mssql', 'get_max_index_name_length'); + $max_length_method->setAccessible(true); + $max_index_length = $max_length_method->invoke($this->tools); + } + $table_suffix = str_repeat('a', 25 - strlen($table_prefix)); $table_name = $table_prefix . $table_suffix; $this->tools->sql_create_table($table_name, $this->table_data); - // Index name and table suffix and table prefix have > 30 chars in total. - // Index name and table suffix have <= 30 chars in total. - $long_index_name = str_repeat('i', 30 - strlen($table_suffix)); + // Index name and table suffix and table prefix have > maximum index length chars in total. + // Index name and table suffix have <= maximum index length chars in total. + $long_index_name = str_repeat('i', $max_index_length - strlen($table_suffix)); $this->assertFalse($this->tools->sql_index_exists($table_name, $long_index_name)); $this->assertTrue($this->tools->sql_create_index($table_name, $long_index_name, array('c_timestamp'))); $this->assertTrue($this->tools->sql_index_exists($table_name, $long_index_name)); - // Index name and table suffix have > 30 chars in total. - $very_long_index_name = str_repeat('i', 30); + // Index name and table suffix have > maximum index length chars in total. + $very_long_index_name = str_repeat('i', $max_index_length); $this->assertFalse($this->tools->sql_index_exists($table_name, $very_long_index_name)); $this->assertTrue($this->tools->sql_create_index($table_name, $very_long_index_name, array('c_timestamp'))); $this->assertTrue($this->tools->sql_index_exists($table_name, $very_long_index_name)); $this->tools->sql_table_drop($table_name); - // Index name has > 30 chars - that should not be possible. - $too_long_index_name = str_repeat('i', 31); + // Index name has > maximum index length chars - that should not be possible. + $too_long_index_name = str_repeat('i', $max_index_length + 1); $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', $too_long_index_name)); + $this->setExpectedTriggerError(E_USER_ERROR); $this->tools->sql_create_index('prefix_table_name', $too_long_index_name, array('c_timestamp')); } } -- cgit v1.2.1 From 4afb53dd8d4fb53ce49e0164130cf34712e19324 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 1 Jan 2018 18:00:51 +0100 Subject: [ticket/15055] Add comments explaining overriden createXMLDataSet() PHPBB3-15055 --- tests/test_framework/phpbb_database_test_case.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index bbcb8d9a48..c2d658cfff 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -142,9 +142,17 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $manager->database_synchronisation($table_column_map); } + /** + * Create xml data set for insertion into database + * + * @param string $path Path to fixture XML + * @return PHPUnit_Extensions_Database_DataSet_DefaultDataSet|PHPUnit_Extensions_Database_DataSet_XmlDataSet + */ public function createXMLDataSet($path) { $this->fixture_xml_data = parent::createXMLDataSet($path); + + // Extend XML data set on MSSQL if (strpos($this->get_database_config()['dbms'], 'mssql') !== false) { $newXmlData = new PHPUnit_Extensions_Database_DataSet_DefaultDataSet(); @@ -165,6 +173,11 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $identity_columns = $db->sql_fetchrowset($result); $has_default_identity = false; $add_primary_keys = false; + + // Iterate over identity columns to check for missing primary + // keys in data set and special identity column 'mssqlindex' + // that might have been added when no default identity column + // exists in the current table. foreach ($identity_columns as $column) { if (in_array($column['identity_column'], $columns) && !in_array($column['identity_column'], $primaryKeys)) @@ -182,6 +195,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if ($has_default_identity || $add_primary_keys) { + // Add default identity column to columns list if ($has_default_identity) { $columns[] = 'mssqlindex'; -- cgit v1.2.1 From 7b6be23117aae157d2bff7ca9cc3610320f368a1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 1 Jan 2018 19:25:11 +0100 Subject: [ticket/15055] Use getMock() for phpBB 3.2 compatibility PHPBB3-15055 --- tests/console/user/add_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php index d1a1f8542e..bdfb8a8d2a 100644 --- a/tests/console/user/add_test.php +++ b/tests/console/user/add_test.php @@ -61,7 +61,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base $output->writeln(print_r($response, true)); return $response; }; - $helper = $this->createMock('\Symfony\Component\Console\Helper\QuestionHelper'); + $helper = $this->getMock('\Symfony\Component\Console\Helper\QuestionHelper', array('ask')); $helper->expects($this->any()) ->method('ask') ->will($this->returnCallback($ask)); -- cgit v1.2.1 From 84ccb3aded7fe303fb176b87f7b976288dcedf35 Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Wed, 3 Jan 2018 16:18:14 -0500 Subject: [ticket/15495] Use transaction in ACP move_forum Should prevent the forums table from getting messed up if an error or concurrent execution happens. PHPBB3-15495 --- phpBB/includes/acp/acp_forums.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 66bb630241..6c749bb7bd 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1431,6 +1431,8 @@ class acp_forums return $errors; } + $db->sql_transaction('begin'); + $moved_forums = get_forum_branch($from_id, 'children', 'descending'); $from_data = $moved_forums[0]; $diff = sizeof($moved_forums) * 2; @@ -1502,6 +1504,8 @@ class acp_forums WHERE " . $db->sql_in_set('forum_id', $moved_ids); $db->sql_query($sql); + $db->sql_transaction('commit'); + return $errors; } -- cgit v1.2.1 From 2119dee53d6409cbe77ec944fd322e3f8df0dcae Mon Sep 17 00:00:00 2001 From: Derky Date: Thu, 4 Jan 2018 21:09:39 +0100 Subject: [ticket/15489] Add NO_FORUMS_IN_CATEGORY message PHPBB3-15489 --- phpBB/language/en/viewforum.php | 1 + phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/language/en/viewforum.php b/phpBB/language/en/viewforum.php index cab205ddf9..e2a6e2a718 100644 --- a/phpBB/language/en/viewforum.php +++ b/phpBB/language/en/viewforum.php @@ -54,6 +54,7 @@ $lang = array_merge($lang, array( 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', // Not used anymore 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', // Not used anymore 'NO_READ_ACCESS' => 'You do not have the required permissions to view or read topics within this forum.', + 'NO_FORUMS_IN_CATEGORY' => 'This category has no forums.', 'NO_UNREAD_POSTS_HOT' => 'No unread posts [ Popular ]', 'NO_UNREAD_POSTS_LOCKED' => 'No unread posts [ Locked ]', diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index c3547b3e16..b5e12cdde4 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -253,7 +253,7 @@
          - {L_NO_FORUMS} + {L_NO_FORUMS_IN_CATEGORY}
          -- cgit v1.2.1 From 98c50695003652fba171e25dd2e171ddffbd72e1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 5 Jan 2018 21:22:24 +0100 Subject: [ticket/15055] Display appveyor badges in readme PHPBB3-15055 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b6c886d687..d1854dc74d 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ Read our [Vagrant documentation](phpBB/docs/vagrant.md) to find out how to use V ## AUTOMATED TESTING -We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis builds below: +We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](https://bamboo.phpbb.com) or check our travis builds below: -* [![Build Status](https://secure.travis-ci.org/phpbb/phpbb.png?branch=master)](http://travis-ci.org/phpbb/phpbb) **master** - Latest development version -* [![Build Status](https://secure.travis-ci.org/phpbb/phpbb.png?branch=3.2.x)](http://travis-ci.org/phpbb/phpbb) **3.2.x** - Development of version 3.2.x -* [![Build Status](https://secure.travis-ci.org/phpbb/phpbb.png?branch=3.1.x)](http://travis-ci.org/phpbb/phpbb) **3.1.x** - Development of version 3.1.x +* [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=master)](http://travis-ci.org/phpbb/phpbb)[![Build status](https://ci.appveyor.com/api/projects/status/8g98ybngd2f3axy1/branch/master?svg=true)](https://ci.appveyor.com/project/phpBB/phpbb/branch/master) **master** - Latest development version +* [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=3.2.x)](http://travis-ci.org/phpbb/phpbb)[![Build status](https://ci.appveyor.com/api/projects/status/8g98ybngd2f3axy1/branch/3.2.x?svg=true)](https://ci.appveyor.com/project/phpBB/phpbb/branch/3.2.x) **3.2.x** - Development of version 3.2.x +* [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=3.1.x)](http://travis-ci.org/phpbb/phpbb) **3.1.x** - Development of version 3.1.x ## LICENSE -- cgit v1.2.1 From 90e440855ec5094f5f3f3d196d44c1a059cd2606 Mon Sep 17 00:00:00 2001 From: Derky Date: Sat, 6 Jan 2018 00:09:02 +0100 Subject: [ticket/15499] Remove HHVM from Travis build matrix PHPBB3-15499 --- .travis.yml | 3 --- travis/setup-phpbb.sh | 2 +- travis/setup-webserver.sh | 53 ++++++++++++++++++----------------------------- 3 files changed, 21 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index db3e4311c5..91b8b4932c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,10 +30,7 @@ matrix: env: DB=mysqli - php: nightly env: DB=mysqli - - php: hhvm - env: DB=mysqli allow_failures: - - php: hhvm - php: nightly fast_finish: true diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index f9fd9522ca..be9eb703d5 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -26,7 +26,7 @@ then travis/setup-mariadb.sh fi -if [ "$NOTESTS" != '1' -a "$TRAVIS_PHP_VERSION" != "hhvm" ] +if [ "$NOTESTS" != '1' ] then travis/setup-php-extensions.sh fi diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 3369d740fe..7fb67e0454 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -22,39 +22,26 @@ PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB") NGINX_CONF="/etc/nginx/sites-enabled/default" APP_SOCK=$(realpath "$DIR")/php-app.sock -if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] -then - HHVM_LOG=$(realpath "$DIR")/hhvm.log - - sudo service hhvm stop - sudo hhvm \ - --mode daemon \ - --user "$USER" \ - -vServer.Type=fastcgi \ - -vServer.FileSocket="$APP_SOCK" \ - -vLog.File="$HHVM_LOG" -else - # php-fpm - PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" - PHP_FPM_CONF="$DIR/php-fpm.conf" - - echo " - [global] - - [travis] - user = $USER - group = $USER - listen = $APP_SOCK - listen.mode = 0666 - pm = static - pm.max_children = 2 - - php_admin_value[memory_limit] = 128M - " > $PHP_FPM_CONF - - sudo $PHP_FPM_BIN \ - --fpm-config "$DIR/php-fpm.conf" -fi +# php-fpm +PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" +PHP_FPM_CONF="$DIR/php-fpm.conf" + +echo " + [global] + + [travis] + user = $USER + group = $USER + listen = $APP_SOCK + listen.mode = 0666 + pm = static + pm.max_children = 2 + + php_admin_value[memory_limit] = 128M +" > $PHP_FPM_CONF + +sudo $PHP_FPM_BIN \ + --fpm-config "$DIR/php-fpm.conf" # nginx cat $DIR/../phpBB/docs/nginx.sample.conf \ -- cgit v1.2.1 From e31474542dac500c76ed67d2b80f90a38da149d1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 6 Jan 2018 10:53:12 +0100 Subject: [ticket/15498] Do not pass whether URL uses router to is_route is_route expects a flag of whether this is a route that was generated with the router as opposed to is_router_used() which returns whether the router will be used via app.php. PHPBB3-15498 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2cd62d7bac..97e1e8e340 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2185,7 +2185,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo // re-add sid / transform & to & for user->page (user->page is always using &) $use_page = ($u_action) ? $u_action : str_replace('&', '&', $user->page['page']); - $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite']), $phpbb_path_helper->is_router_used()); + $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite'])); $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; $template->assign_vars(array( -- cgit v1.2.1 From 101e6c8f96e29d96c4b66c6257f809366dbfe351 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 21 Mar 2017 22:31:18 +0700 Subject: [ticket/14972] Fix create_insert_array() declaration in admin_activate_user PHPBB3-14972 --- phpBB/phpbb/notification/type/admin_activate_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 9f2ae857ef..78c10ac36a 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -175,7 +175,7 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public function create_insert_array($user, $pre_create_data) + public function create_insert_array($user, $pre_create_data = array()) { $this->set_data('user_actkey', $user['user_actkey']); $this->notification_time = $user['user_regdate']; -- cgit v1.2.1 From d05c7fd34288375683c5b0467930748b1457ac75 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 6 Jan 2018 16:06:59 +0100 Subject: [ticket/15496] Add sort key to SELECT in fulltext_postgres Postgres requires that the column being ordered also appears in the SELECT part of the query. PHPBB3-15496 --- phpBB/phpbb/search/fulltext_postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 8dbc7212a1..30aeb35ee0 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -498,7 +498,7 @@ class fulltext_postgres extends \phpbb\search\base ); extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_keywords_main_query_before', compact($vars))); - $sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id'; + $sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id, ' . $sort_by_sql[$sort_key]; $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; -- cgit v1.2.1 From 57179fbb7944e75a92e15cdbd5a9955bcc1677c7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 6 Jan 2018 19:23:20 +0100 Subject: [ticket/15353] Do not use empty to not offer empty archive for download PHPBB3-15353 --- phpBB/phpbb/install/module/update_filesystem/task/diff_files.php | 4 ++-- .../install/module/update_filesystem/task/download_updated_files.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 8151a24f2d..b15e32cc82 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -208,7 +208,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (empty($files)) + if (count($files) < 1) { unset($update_files[$type]); } @@ -226,7 +226,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (empty($files)) + if (count($files) < 1) { unset($update_files[$type]); } diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php index 0b83e9a79d..2fc756c20a 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -101,12 +101,12 @@ class download_updated_files extends task_base 'update_recheck_files_submit' => array( 'label' => 'UPDATE_RECHECK_UPDATE_FILES', 'type' => 'submit', - 'is_secondary' => empty($file_update_info), + 'is_secondary' => count($file_update_info) < 1, ), 'database_update_submit' => array( 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', 'type' => 'submit', - 'disabled' => !empty($file_update_info), + 'disabled' => count($file_update_info) > 0, ), )); -- cgit v1.2.1 From e7c5fc32d2aedbc89a5e54362af83d538600ba87 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 7 Jan 2018 11:43:54 +0100 Subject: [prep-release-3.2.2] Update changelog for 3.2.2 release --- phpBB/docs/CHANGELOG.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cacd1835a0..667e9b9ca3 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -129,6 +129,10 @@

          Changes since 3.2.1

          +

          Security Issue

          +
            +
          • [SECURITY-211] - URLs with javascript scheme should not be made clickable
          • +

          Bug

          • [PHPBB3-7845] - Error on posting local image when script path is empty
          • @@ -191,6 +195,10 @@
          • [PHPBB3-15464] - Can't reparse [IMG] - in uppercase
          • [PHPBB3-15475] - Restore Travis PR commit message validation
          • [PHPBB3-15478] - core.js $loadingIndicator JavaScript errors
          • +
          • [PHPBB3-15489] - Wrong footer text on forum of type "category"
          • +
          • [PHPBB3-15496] - SQL Error in PostgreSQL Fulltext search when results displayed as topics
          • +
          • [PHPBB3-15497] - Declaration of admin_activate_user::create_insert_array not compatible with base
          • +
          • [PHPBB3-15498] - confirm_box() adds duplicate strings to URLs in extensions

          Improvement

            -- cgit v1.2.1 From f8180ca97bf6d9e92a0a080e2af8af2f0654bfbe Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 7 Jan 2018 11:45:49 +0100 Subject: [prep-release-3.2.2] Add migration for 3.2.2 --- phpBB/phpbb/db/migration/data/v32x/v322.php | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/v322.php diff --git a/phpBB/phpbb/db/migration/data/v32x/v322.php b/phpBB/phpbb/db/migration/data/v32x/v322.php new file mode 100644 index 0000000000..7ecbbb3e79 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v322.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v322 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.2', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3112', + '\phpbb\db\migration\data\v32x\v322rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.2')), + ); + } +} -- cgit v1.2.1 From f38fce5ce570318ac64c95601e891cfe2e8f4d1a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 7 Jan 2018 11:47:59 +0100 Subject: [prep-release-3.1.12] Update changelog --- phpBB/docs/CHANGELOG.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6914aa5060..6c6e539405 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -123,6 +123,10 @@

            Changes since 3.1.11

            +

            Security Issue

            +
              +
            • [SECURITY-211] - URLs with javascript scheme should not be made clickable
            • +

            Bug

            • [PHPBB3-9533] - phpbb_own_realpath() doesn't always replicate realpath() behaviour
            • -- cgit v1.2.1 From 77b275181aeddf43e1077d06abce11a9722bb85a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 7 Jan 2018 16:59:14 +0100 Subject: [prep-release-3.2.2] Add 3.1.12 to build and fix display of download box --- build/build.xml | 2 +- phpBB/phpbb/install/module/update_filesystem/task/diff_files.php | 4 ++-- .../module/update_filesystem/task/download_updated_files.php | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/build.xml b/build/build.xml index 92c3860192..2ef9016a17 100644 --- a/build/build.xml +++ b/build/build.xml @@ -4,7 +4,7 @@ - + diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 7114e60ba1..2f6048b4fd 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -208,7 +208,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (count($files) < 1) + if (empty($files)) { unset($update_files[$type]); } @@ -226,7 +226,7 @@ class diff_files extends task_base foreach ($update_files as $type => $files) { - if (count($files) < 1) + if (empty($files)) { unset($update_files[$type]); } diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php index 2fc756c20a..4d7f0e0cdf 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -86,7 +86,8 @@ class download_updated_files extends task_base { $file_update_info = $this->installer_config->get('update_files', array()); - if (count($file_update_info) > 0) + // Display download box only if the archive won't be empty + if (!empty($file_update_info) && !(isset($file_update_info['delete']) && count($file_update_info) == 1)) { // Render download box $this->iohandler->add_download_link( @@ -101,12 +102,12 @@ class download_updated_files extends task_base 'update_recheck_files_submit' => array( 'label' => 'UPDATE_RECHECK_UPDATE_FILES', 'type' => 'submit', - 'is_secondary' => count($file_update_info) < 1, + 'is_secondary' => empty($file_update_info), ), 'database_update_submit' => array( 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', 'type' => 'submit', - 'disabled' => count($file_update_info) > 0, + 'disabled' => !empty($file_update_info), ), )); -- cgit v1.2.1 From f26cf2dc1f2c58ac6cf97974aafa749688cacbaa Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 7 Jan 2018 18:51:18 +0100 Subject: [3.2.x] Update versions to 3.2.3-dev --- build/build.xml | 6 +++--- phpBB/includes/constants.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/build.xml b/build/build.xml index 2ef9016a17..1491b95b48 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - - - + + + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 8a5d49358c..7eeb36595d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.2.2'); +@define('PHPBB_VERSION', '3.2.3-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 6075b8d589..1f92439c70 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -279,7 +279,7 @@ 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 ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.2'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.3-dev'); 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'); -- cgit v1.2.1 From 81a8a76c594fd90de316775f494170dddf2d6b51 Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Sun, 7 Jan 2018 22:22:41 +0100 Subject: [ticket/15500] Updates PHP requirements to 5.4.7+ in docs/ PHPBB3-15500 --- phpBB/docs/INSTALL.html | 2 +- phpBB/docs/README.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 956a384263..2d97373721 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -147,7 +147,7 @@
            • Oracle
            -
          • PHP 5.4.0+ with support for the database you intend to use.
          • +
          • PHP 5.4.7+ with support for the database you intend to use.
          • The following PHP modules are required:
            • json
            • diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 7fd80b3c2d..fd4bfdada0 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -323,7 +323,7 @@
              -

              phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.0 and the maximum supported version is the latest stable version of PHP.

              +

              phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.7 and the maximum supported version is the latest stable version of PHP 7.2.

              Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.

              -- cgit v1.2.1 From 0391b48d7e95aca38be7c7ce7f1cbbba6c9fc5ab Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 8 Jan 2018 23:21:17 +0700 Subject: [ticket/15502] Fix migrations PHPBB3-15502 --- phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php | 6 +++++- phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php index 282c6bef2f..16fbdbc77b 100644 --- a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php +++ b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php @@ -33,13 +33,17 @@ class fix_user_styles extends \phpbb\db\migration\migration public function styles_fix() { $default_style = (int) $this->config['default_style']; + $enabled_styles = array(); // Get enabled styles $sql = 'SELECT style_id FROM ' . STYLES_TABLE . ' WHERE style_active = 1'; $result = $this->db->sql_query($sql); - $enabled_styles = $result->fetch_array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $enabled_styles[] = (int) $row['style_id']; + } $this->db->sql_freeresult($result); // Set the default style to users who have an invalid style diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php index 3bf442bab5..08609b571b 100644 --- a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php +++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php @@ -13,7 +13,7 @@ namespace phpbb\db\migration\data\v32x; -class merge_duplicate_bbcodes extends \phpbb\db\migration\migration +class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migration { public function update_data() { @@ -30,7 +30,7 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\migration while ($row = $this->db->sql_fetchrow($result)) { $variant = (substr($row['bbcode_tag'], -1) === '=') ? 'with': 'without'; - $bbcode_name = rtrim($row['bbcode_tag'], '='); + $bbcode_name = strtolower(rtrim($row['bbcode_tag'], '=')); $bbcodes[$bbcode_name][$variant] = $row; } $this->db->sql_freeresult($result); -- cgit v1.2.1 From daf668a9693a65d66d57ccbe1bb365b163610c40 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 8 Jan 2018 21:15:24 +0100 Subject: [ticket/15055] Display content on unexpted server error PHPBB3-15055 --- .appveyor.yml | 18 +++++++++--------- tests/test_framework/phpbb_functional_test_case.php | 7 ++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e536a561ff..a729b034d9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,15 +7,15 @@ services: environment: matrix: - - db: mssql - db_version: sql2012sp1 - php: 7.0 - - db: mssql - db_version: sql2014 - php: 7.0 - - db: mssql - db_version: sql2016 - php: 7.0 +# - db: mssql +# db_version: sql2012sp1 +# php: 7.0 +# - db: mssql +# db_version: sql2014 +# php: 7.0 +# - db: mssql +# db_version: sql2016 +# php: 7.0 - db: mssql db_version: sql2017 php: 7.1 diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 2be16c7198..a63d5dc5ec 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -911,10 +911,15 @@ class phpbb_functional_test_case extends phpbb_test_case * status code. This assertion tries to catch that. * * @param int $status_code Expected status code - * @return null + * @return void */ static public function assert_response_status_code($status_code = 200) { + if ($status_code != self::$client->getResponse()->getStatus() && + preg_match('/^5[0-9]{2}/', self::$client->getResponse()->getStatus())) + { + self::fail('Encountered unexpected server error:\n' . self::$client->getResponse()->getContent()); + } self::assertEquals($status_code, self::$client->getResponse()->getStatus(), 'HTTP status code does not match'); } -- cgit v1.2.1 From 3c7f45c1665d51b0aba1ab44d378f8a0ad861e09 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 8 Jan 2018 22:19:58 +0100 Subject: [ticket/15055] Fix line break and disable sql server 2017 for now SQL Server 2017 currently fails for unknown reasons and just results in an overall longer build time. Therefore disabling it for now. PHPBB3-15055 --- .appveyor.yml | 26 +++++++++++++--------- .../test_framework/phpbb_functional_test_case.php | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a729b034d9..1e2bc1c184 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,18 +7,18 @@ services: environment: matrix: -# - db: mssql -# db_version: sql2012sp1 -# php: 7.0 -# - db: mssql -# db_version: sql2014 -# php: 7.0 -# - db: mssql -# db_version: sql2016 -# php: 7.0 - db: mssql - db_version: sql2017 - php: 7.1 + db_version: sql2012sp1 + php: 7.0 + - db: mssql + db_version: sql2014 + php: 7.0 + - db: mssql + db_version: sql2016 + php: 7.0 +# - db: mssql +# db_version: sql2017 +# php: 7.1 # - db: mariadb # php: 7.1 # - db: mysqli @@ -114,6 +114,10 @@ before_test: # Install PhantomJS cinst -y phantomjs Start-Process "phantomjs" "--webdriver=8910" | Out-Null + - ps: | + cd c:\projects\phpbb\phpBB + (Get-Content c:\projects\phpbb\phpBB\web.config).replace("", "`n`t`n`t`t`n`t") | Set-Content c:\projects\phpbb\phpBB\web.config + (Get-Content c:\projects\phpbb\phpBB\web.config).replace("`t", "`t`t`n`t") | Set-Content c:\projects\phpbb\phpBB\web.config - cd c:\projects\phpbb\phpBB - php ..\composer.phar install - choco install -y urlrewrite diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index a63d5dc5ec..e1daa4558a 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -918,7 +918,7 @@ class phpbb_functional_test_case extends phpbb_test_case if ($status_code != self::$client->getResponse()->getStatus() && preg_match('/^5[0-9]{2}/', self::$client->getResponse()->getStatus())) { - self::fail('Encountered unexpected server error:\n' . self::$client->getResponse()->getContent()); + self::fail("Encountered unexpected server error:\n" . self::$client->getResponse()->getContent()); } self::assertEquals($status_code, self::$client->getResponse()->getStatus(), 'HTTP status code does not match'); } -- cgit v1.2.1 From 62f8fed7977ea451cfc7dbc6ea93297d29edd24c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 9 Jan 2018 21:29:40 +0100 Subject: [ticket/15055] Run sql2016 builds with PHP 7.1 PHPBB3-15055 --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 1e2bc1c184..7ec7a47daa 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,7 +15,7 @@ environment: php: 7.0 - db: mssql db_version: sql2016 - php: 7.0 + php: 7.1 # - db: mssql # db_version: sql2017 # php: 7.1 -- cgit v1.2.1 From 8d551e2dedbde8c6126c2cbbb58768c1e2ad275d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 10 Jan 2018 20:47:24 +0100 Subject: [ticket/15055] Specifiy PHP 7.1.12 and use development ini PHP 7.1.13 seems to randomly fail. Use 7.1.12 for now. PHPBB3-15055 --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 7ec7a47daa..0c5874f386 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,7 +15,7 @@ environment: php: 7.0 - db: mssql db_version: sql2016 - php: 7.1 + php: 7.1.12 # - db: mssql # db_version: sql2017 # php: 7.1 @@ -43,7 +43,7 @@ before_test: Get-ChildItem -Path "c:\tools\php$($env:php -replace '[.]','')" -Recurse | Move-Item -destination "c:\tools\php" cd c:\tools\php - cat php.ini-production | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini + cat php.ini-development | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini Add-Content php.ini "`n date.timezone=UTC" Add-Content php.ini "`n display_errors=On" Add-Content php.ini "`n extension_dir=ext" -- cgit v1.2.1 From 6a75fe26fc80e1ffab0242ea6c2e9d1c1ef7d7c7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 10 Jan 2018 21:24:30 +0100 Subject: [ticket/15055] Use regex to copy php to tools php PHPBB3-15055 --- .appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0c5874f386..a4fac799b2 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -40,7 +40,7 @@ before_test: - ps: | Set-Service wuauserv -StartupType Manual cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - Get-ChildItem -Path "c:\tools\php$($env:php -replace '[.]','')" -Recurse | + Get-ChildItem -Path "c:\tools\php$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1$2')" -Recurse | Move-Item -destination "c:\tools\php" cd c:\tools\php cat php.ini-development | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini @@ -64,10 +64,10 @@ before_test: if ($env:db -eq "mssql") { cd c:\tools\php\ext $DLLVersion = "4.1.6.1" - appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip - 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null - appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip - 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc14-x64.zip > $null + appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip + 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip > $null + appveyor-retry appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip + 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip > $null Remove-Item c:\tools\php\* -include .zip cd c:\tools\php Add-Content php.ini "`nextension=php_sqlsrv.dll" -- cgit v1.2.1 From 8c89194cc6f197c302eae00b6bed565b3e5653d4 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Thu, 11 Jan 2018 19:05:19 +0300 Subject: [ticket/15492] Fix permission role combobox in RTL Varius fixes to css and js for correct displaying permission role combbox in RTL mode PHPBB3-15492 --- phpBB/adm/style/admin.css | 11 +++++++++++ phpBB/adm/style/permission_mask.html | 2 +- phpBB/adm/style/tooltip.js | 15 +++++++++++---- phpBB/assets/javascript/core.js | 2 ++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index eafe11ee89..efdd6f1e22 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -2459,6 +2459,9 @@ fieldset.permissions .padding { text-align: left; } +.rtl .dropdown li { + text-align: right; +} .wrap .dropdown li, .dropdown.wrap li { white-space: normal; } @@ -2473,6 +2476,10 @@ fieldset.permissions .padding { width: 250px; } +.rtl .roles-options > .dropdown { + right: auto; +} + .roles-options { -webkit-user-select: none; -moz-user-select: none; @@ -2491,6 +2498,10 @@ fieldset.permissions .padding { background: url('../images/arrow_down.gif') no-repeat 245px .7em; } +.rtl .roles-options > span { + background: url('../images/arrow_down.gif') no-repeat 7px .7em; +} + .roles-options li { list-style: none; } diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html index 8b3121bfa0..c556664b8c 100644 --- a/phpBB/adm/style/permission_mask.html +++ b/phpBB/adm/style/permission_mask.html @@ -41,7 +41,7 @@
              {% if p_mask.f_mask.role_options %}
              -
          - - + + diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 4efa8c70b3..8f169d15a7 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -585,6 +585,7 @@ class acp_main 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'), + 'U_ATTACH_ORPHAN' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_attachments&mode=orphan'), 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false, 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, -- cgit v1.2.1 From 5878d66ebfe6a25c6d5e495c4fd07e7d3ad634ab Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Fri, 12 Jan 2018 16:28:37 +0100 Subject: [ticket/15512] Avoid reparsing non-existent polls PHPBB3-15512 --- phpBB/phpbb/textreparser/plugins/poll_title.php | 2 +- tests/text_reparser/plugins/fixtures/polls.xml | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/textreparser/plugins/poll_title.php b/phpBB/phpbb/textreparser/plugins/poll_title.php index 76d30655c9..5ca8bb063b 100644 --- a/phpBB/phpbb/textreparser/plugins/poll_title.php +++ b/phpBB/phpbb/textreparser/plugins/poll_title.php @@ -34,7 +34,7 @@ class poll_title extends \phpbb\textreparser\row_based_plugin $sql = 'SELECT t.topic_id AS id, t.poll_title AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE t.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id .' - AND t.poll_max_options > 0 + AND t.poll_start > 0 AND p.post_id = t.topic_first_post_id'; return $sql; diff --git a/tests/text_reparser/plugins/fixtures/polls.xml b/tests/text_reparser/plugins/fixtures/polls.xml index 2960d640a9..5247fb906d 100644 --- a/tests/text_reparser/plugins/fixtures/polls.xml +++ b/tests/text_reparser/plugins/fixtures/polls.xml @@ -44,55 +44,66 @@ topic_id topic_first_post_id poll_title + poll_start 1 1 This row should be [b]ignored[/b] + 1 2 1 [b]Not bold[/b] :) http://example.org + 1 3 2 [b:abcd1234]Bold[/b:abcd1234] :) http://example.org + 1 4 3 :) http://example.org]]> + 1 5 4 http://example.org]]> + 1 6 2 + 1 7 1 + 1 8 2 + 1 9 1 + 1 1000 1 This row should be [b]ignored[/b] + 1
          {PHP_VERSION_INFO} {L_NUMBER_ORPHAN}{L_COLON} {TOTAL_ORPHAN} + + {TOTAL_ORPHAN} + + {TOTAL_ORPHAN} + +    
          -- cgit v1.2.1 From 3469545e3ad934bcb1fc9ac0c527b59aa97c072b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 14 Jan 2018 12:59:01 +0100 Subject: [ticket/15516] Add instructions for running UI tests PHPBB3-15516 --- tests/RUNNING_TESTS.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index c9941d61e5..3bff4f5d26 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -143,14 +143,14 @@ If you want all tests, run: Functional tests ------------------ +================ Functional tests test software the way a user would. They simulate a user browsing the website, but they do these steps in an automated way. phpBB allows you to write such tests. Running -======= +------- Running the tests requires your phpBB3 repository to be accessible through a local web server. You will need to supply the URL to the webserver in @@ -170,6 +170,27 @@ If you only want the functional tests, run: This will change your board's config.php file, but it makes a backup at config_dev.php, so you can restore it after the test run is complete. +UI tests +======== + +UI tests are functional tests that also support running JavaScript in a +headless browser. These should be used when functionality that is only +executed using JS needs to be tested. The require a running +[PhantomJS WebDriver instance](http://phantomjs.org/). The executable can +either be downloaded from [PhantomJS](http://phantomjs.org/download.html) +or alternatively be installed with npm: + + $ npm install -g phantomjs-prebuilt + +You might have to run the command as superuser / administrator on some +systems. Afterwards, a new WebDriver instance can be started via command +line: + + $ phantomjs --webdriver=127.0.0.1:8910 + +Port 8910 is the default port that will be used by UI tests to connect +to the WebDriver instance. + More Information ================ -- cgit v1.2.1 From 1f80b668f1c44f5ca5710b426bcde200525e24f7 Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Tue, 16 Jan 2018 21:42:26 +0100 Subject: [ticket/15500] Remove number from upper PHP limit PHPBB3-15500 --- phpBB/docs/README.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index fd4bfdada0..567ecd5ee0 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -323,7 +323,7 @@
          -

          phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.7 and the maximum supported version is the latest stable version of PHP 7.2.

          +

          phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.7 and the maximum supported version is the latest stable version of PHP.

          Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.

          -- cgit v1.2.1 From f01e29effe5bf053ac5205e47f8e0e90a262315a Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Wed, 17 Jan 2018 00:16:26 +0100 Subject: [ticket/15518] Add a setting to toggle permission checks for pms in viewtopic PHPBB3-15518 --- phpBB/includes/acp/acp_board.php | 1 + phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ .../data/v32x/enable_accurate_pm_button.php | 36 ++++++++++++++++++++++ phpBB/viewtopic.php | 18 ++++++++--- 5 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 phpBB/phpbb/db/migration/data/v32x/enable_accurate_pm_button.php diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index c2a004c395..f89f5535eb 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -356,6 +356,7 @@ class acp_board 'load_user_activity_limit' => array('lang' => 'LOAD_USER_ACTIVITY_LIMIT', 'validate' => 'int:0:99999999', 'type' => 'number:0:99999999', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_accurate_pm_button' => array('lang' => 'YES_ACCURATE_PM_BUTTON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'CUSTOM_PROFILE_FIELDS', diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 1f92439c70..4dfe5e94aa 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -106,6 +106,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_force_sender', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_accurate_pm_button', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_mod_rewrite', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_board_notifications', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 25d70813f6..0b2e6372a6 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -406,6 +406,8 @@ $lang = array_merge($lang, array( 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', + 'YES_ACCURATE_PM_BUTTON' => 'Enable accurate PM indicator in topic pages', + 'YES_ACCURATE_PM_BUTTON_EXPLAIN' => 'If this setting is enabled, only users who are permitted to read private messages will have a private message button.', 'YES_BIRTHDAYS' => 'Enable birthday listing', 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', 'YES_JUMPBOX' => 'Enable display of jumpbox', diff --git a/phpBB/phpbb/db/migration/data/v32x/enable_accurate_pm_button.php b/phpBB/phpbb/db/migration/data/v32x/enable_accurate_pm_button.php new file mode 100644 index 0000000000..a7b99606f7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/enable_accurate_pm_button.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class enable_accurate_pm_button extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v322', + ); + } + + public function effectively_installed() + { + return isset($this->config['enable_accurate_pm_button']); + } + + public function update_data() + { + return array( + array('config.add', array('enable_accurate_pm_button', '1')), + ); + } +} diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 38eba32374..9e6e4538d6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1576,12 +1576,20 @@ if (count($attach_list)) } } -// Get the list of users who can receive private messages -$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); -$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; +if ($config['enable_accurate_pm_button']) +{ + // Get the list of users who can receive private messages + $can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); + $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; -// Get the list of permanently banned users -$permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); + // Get the list of permanently banned users + $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); +} +else +{ + $can_receive_pm_list = array_keys($user_cache); + $permanently_banned_users = []; +} $i_total = count($rowset) - 1; $prev_post_id = ''; -- cgit v1.2.1 From 84ff21a586da459a061bf72e2a18dc6432d66d61 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Jan 2018 18:30:21 +0100 Subject: [ticket/15099] Remove type attr from INCLUDECSS and INCLUDEJS PHPBB3-15099 --- phpBB/phpbb/template/assets_bag.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/assets_bag.php b/phpBB/phpbb/template/assets_bag.php index 9013061b96..067b0eb8f1 100644 --- a/phpBB/phpbb/template/assets_bag.php +++ b/phpBB/phpbb/template/assets_bag.php @@ -71,7 +71,7 @@ class assets_bag $output = ''; foreach ($this->stylesheets as $stylesheet) { - $output .= "get_url()}\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n"; + $output .= "get_url()}\" rel=\"stylesheet\" media=\"screen\" />\n"; } return $output; @@ -87,7 +87,7 @@ class assets_bag $output = ''; foreach ($this->scripts as $script) { - $output .= "\n"; + $output .= "\n"; } return $output; -- cgit v1.2.1 From ad748ec0a7e6ed32064dea885cc3115f1ce4b23d Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Jan 2018 22:10:53 +0100 Subject: [ticket/15099] Fix tests PHPBB3-15099 --- tests/template/template_includecss_test.php | 8 ++++---- tests/template/template_includejs_test.php | 32 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index bc871aa612..4eb30eda1e 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -95,19 +95,19 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te */ array( array('TEST' => 1), - '', + '', ), array( array('TEST' => 2), - '', + '', ), array( array('TEST' => 3), - '', + '', ), array( array('TEST' => 4), - '', + '', ), ); } diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 232f551b4a..19c016ae5e 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -28,67 +28,67 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes */ array( array('TEST' => 1), - '', + '', ), array( array('TEST' => 2), - '', + '', ), array( array('TEST' => 3), - '', + '', ), array( array('TEST' => 4), - '', + '', ), array( array('TEST' => 6), - '', + '', ), array( array('TEST' => 7), - '', + '', ), array( array('TEST' => 8), - '', + '', ), array( array('TEST' => 9), - '', + '', ), array( array('TEST' => 10), - '', + '', ), array( array('TEST' => 11), - '', + '', ), array( array('TEST' => 12), - '', + '', ), array( array('TEST' => 14), - '', + '', ), array( array('TEST' => 15), - '', + '', ), array( array('TEST' => 16), - '', + '', ), array( array('TEST' => 17), - '', + '', ), array( array('TEST' => 18), - '', + '', ), ); } -- cgit v1.2.1 From ede0a36076cdc1bf315f0d13dfc6606b3e95e499 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Fri, 19 Jan 2018 16:28:54 +0300 Subject: [ticket/15510] Link Orphan attachments in ACP General to its page change `IF TOTAL_ORPHAN` to `IF TOTAL_ORPHAN > 0` PHPBB3-15510 --- phpBB/adm/style/acp_main.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index a414ae2c3b..12477a4b77 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -154,7 +154,7 @@ {L_NUMBER_ORPHAN}{L_COLON} - + {TOTAL_ORPHAN} {TOTAL_ORPHAN} -- cgit v1.2.1 From ccc260b179c743aedb6bf777532f54870d357bd1 Mon Sep 17 00:00:00 2001 From: hubaishan Date: Fri, 19 Jan 2018 19:07:16 +0300 Subject: [ticket/15491] Add twitter and facebook Add twitter and facebook PHPBB3-15491 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index dd28c1b706..aa980a136b 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -49,7 +49,7 @@ $lang = array_merge($lang, array( // Support page 'SUPPORT_TITLE' => 'Support', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

          • installation
          • configuration
          • technical questions
          • problems relating to potential bugs in the software
          • updating from Release Candidate (RC) versions to the latest stable version
          • converting from phpBB 2.0.x to phpBB3
          • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

          We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

          Extensions / Styles

          For issues relating to Extensions, please post in the appropriate Extensions Forum.
          For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

          If your question relates to a specific package, please post directly in the topic dedicated to the package.

          Obtaining Support

          Support Section
          Quick Start Guide

          To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

          ', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

          • installation
          • configuration
          • technical questions
          • problems relating to potential bugs in the software
          • updating from Release Candidate (RC) versions to the latest stable version
          • converting from phpBB 2.0.x to phpBB3
          • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

          We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

          Extensions / Styles

          For issues relating to Extensions, please post in the appropriate Extensions Forum.
          For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

          If your question relates to a specific package, please post directly in the topic dedicated to the package.

          Obtaining Support

          Support Section
          Quick Start Guide

          To ensure you stay up to date with the latest news and releases, follow us on Twitter and Facebook

          ', // License 'LICENSE_TITLE' => 'General Public License', -- cgit v1.2.1 From bb442c498b866aff35b974731a6bc2a6281e3675 Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Fri, 19 Jan 2018 18:16:17 +0100 Subject: [ticket/15500] Adds 7.1 and 7.2 to tested versions PHPBB3-15500 --- phpBB/docs/README.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 567ecd5ee0..8fb9036ad8 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -327,7 +327,7 @@

          Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.

          -

          This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, PostgreSQL 8.x, Oracle 8 and SQLite 3. Versions of PHP used range from 5.4.x above 5.6.x to 7.0.x without problem.

          +

          This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, PostgreSQL 8.x, Oracle 8 and SQLite 3. Versions of PHP used range from 5.4.7 above 5.6.x to 7.1.x and 7.2.x without problem.

          7.i. Notice on PHP security issues

          -- cgit v1.2.1 From ce6adeea02067220720ac516fcbfb9510a5ef0ab Mon Sep 17 00:00:00 2001 From: kasimi Date: Fri, 19 Jan 2018 18:41:58 +0100 Subject: [ticket/15523] Fix AdBlocker causing JS error when using CookieConsent PHPBB3-15523 --- .../styles/prosilver/template/overall_footer.html | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 97a21f9a6e..b01b0bb213 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -62,24 +62,27 @@ -- cgit v1.2.1 From 122f61e1ca3c29743072ae584cf81f79fdcdf7a7 Mon Sep 17 00:00:00 2001 From: canonknipser Date: Sat, 20 Jan 2018 17:01:19 +0100 Subject: [ticket/15513] Signature edit in acp gives error When editing a users signature in acp, a error is thrown. PHPBB3-15513 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7ef5cb9981..60afccdc22 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2099,7 +2099,7 @@ class acp_users if ($request->is_set_post('preview')) { - $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); } /** @var \phpbb\controller\helper $controller_helper */ -- cgit v1.2.1 From 2d8b856a6329d695f86765660459fa6785d59953 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 20 Jan 2018 09:52:14 -0800 Subject: [ticket/15525] Update to valid SPDX license name GPL-2.0-only PHPBB3-15525 --- phpBB/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/composer.json b/phpBB/composer.json index 926fad5188..4f796a9dcb 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -4,7 +4,7 @@ "type": "project", "keywords": ["phpbb", "forum"], "homepage": "https://www.phpbb.com", - "license": "GPL-2.0", + "license": "GPL-2.0-only", "authors": [ { "name": "phpBB Limited", -- cgit v1.2.1 From f08887e2774c480daf6b0d29dc949d2590472ee3 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 20 Jan 2018 09:48:00 -0800 Subject: [ticket/15526] Cast bbcode id to INT in merge bbcodes migration PHPBB3-15526 --- phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php index 08609b571b..b1ee241f44 100644 --- a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php +++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php @@ -65,11 +65,11 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migrat $sql = 'UPDATE ' . BBCODES_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $bbcode_data) . ' - WHERE bbcode_id = ' . $without['bbcode_id']; + WHERE bbcode_id = ' . (int) $without['bbcode_id']; $this->sql_query($sql); $sql = 'DELETE FROM ' . BBCODES_TABLE . ' - WHERE bbcode_id = ' . $with['bbcode_id']; + WHERE bbcode_id = ' . (int) $with['bbcode_id']; $this->sql_query($sql); } } -- cgit v1.2.1 From abe218c34a36ac3e32cbc508ca2419f761f6a71e Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 21 Jan 2018 10:54:07 +0100 Subject: [ticket/15528] Display style phpBB version PHPBB3-15528 --- phpBB/adm/style/acp_styles.html | 2 ++ phpBB/includes/acp/acp_styles.php | 1 + phpBB/language/en/acp/styles.php | 1 + 3 files changed, 4 insertions(+) diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 43c2f96a65..37a36b019b 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -96,6 +96,7 @@ {L_STYLE_NAME} + {L_STYLE_PHPBB_VERSION} {L_STYLE_USED_BY} {L_ACTIONS} {STYLES_LIST_EXTRA} @@ -129,6 +130,7 @@
          {L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}
          + {styles_list.STYLE_PHPBB_VERSION} {styles_list.USERS} diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 4c390c5f0e..1bf5a3c6a8 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -952,6 +952,7 @@ class acp_styles // Style data 'STYLE_ID' => $style['style_id'], 'STYLE_NAME' => htmlspecialchars($style['style_name']), + 'STYLE_PHPBB_VERSION' => $this->read_style_cfg($style['style_path'])['phpbb_version'], 'STYLE_PATH' => htmlspecialchars($style['style_path']), 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_ACTIVE' => $style['style_active'], diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 9293d67ecc..511a6f9f8e 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -80,6 +80,7 @@ $lang = array_merge($lang, array( 'STYLE_UNINSTALL' => 'Uninstall', 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', + 'STYLE_PHPBB_VERSION' => 'Style phpBB version', 'STYLE_USED_BY' => 'Used by (including robots)', 'STYLE_VERSION' => 'Style version', -- cgit v1.2.1 From 875dc63c6f2e98ccedad153ad3761f11bf24ff5d Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 21 Jan 2018 11:04:07 +0100 Subject: [ticket/15529] Color groups in ACP PHPBB3-15529 --- phpBB/adm/style/acp_groups.html | 2 +- phpBB/includes/acp/acp_groups.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 26d7030531..d0096370d9 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -316,7 +316,7 @@ - {groups.GROUP_NAME} + style="color: #{groups.GROUP_COLOR}">{groups.GROUP_NAME} {groups.TOTAL_MEMBERS} {groups.PENDING_MEMBERS} {L_SETTINGS} diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 70ae9876f4..0e058213e0 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -926,7 +926,7 @@ class acp_groups ); // Get us all the groups - $sql = 'SELECT g.group_id, g.group_name, g.group_type + $sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour FROM ' . GROUPS_TABLE . ' g ORDER BY g.group_type ASC, g.group_name'; $result = $db->sql_query($sql); @@ -985,6 +985,7 @@ class acp_groups 'S_GROUP_SPECIAL' => ($row['group_type'] == GROUP_SPECIAL) ? true : false, 'GROUP_NAME' => $group_name, + 'GROUP_COLOR' => $row['group_colour'], 'TOTAL_MEMBERS' => $row['total_members'], 'PENDING_MEMBERS' => $row['pending_members'] )); -- cgit v1.2.1 From 5c8a667db2e47313e687fd8afe3c4fa7c73abeb9 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 22 Jan 2018 02:37:47 +0100 Subject: [ticket/15527] Skip malformed BBCodes during merge_duplicate_bbcodes migration PHPBB3-15527 --- .../data/v32x/merge_duplicate_bbcodes.php | 31 +++++++++++++++------- phpBB/phpbb/textformatter/s9e/bbcode_merger.php | 3 +++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php index 08609b571b..6457a84adb 100644 --- a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php +++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php @@ -13,6 +13,8 @@ namespace phpbb\db\migration\data\v32x; +use Exception; + class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migration { public function update_data() @@ -46,16 +48,25 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migrat protected function merge_bbcodes(array $without, array $with) { - $merged = $this->container->get('text_formatter.s9e.bbcode_merger')->merge_bbcodes( - [ - 'usage' => $without['bbcode_match'], - 'template' => $without['bbcode_tpl'] - ], - [ - 'usage' => $with['bbcode_match'], - 'template' => $with['bbcode_tpl'] - ] - ); + try + { + $merged = $this->container->get('text_formatter.s9e.bbcode_merger')->merge_bbcodes( + [ + 'usage' => $without['bbcode_match'], + 'template' => $without['bbcode_tpl'] + ], + [ + 'usage' => $with['bbcode_match'], + 'template' => $with['bbcode_tpl'] + ] + ); + } + catch (Exception $e) + { + // Ignore the pair and move on. The BBCodes would have to be fixed manually + return; + } + $bbcode_data = [ 'bbcode_tag' => $without['bbcode_tag'], 'bbcode_helpline' => $without['bbcode_helpline'] . ' | ' . $with['bbcode_helpline'], diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php index 72b1473751..a05ca3c2b8 100644 --- a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php +++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php @@ -37,6 +37,9 @@ class bbcode_merger * * All of the arrays contain a "usage" element and a "template" element * + * @throws InvalidArgumentException if a definition cannot be interpreted + * @throws RuntimeException if something unexpected occurs + * * @param array $without BBCode definition without an attribute * @param array $with BBCode definition with an attribute * @return array Merged definition -- cgit v1.2.1 From 531d9dfa1f0dddfe765a92ca40c77015091ecc5e Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 22 Jan 2018 03:34:47 +0100 Subject: [ticket/15531] Log malformed BBCodes PHPBB3-15531 --- .../default/container/services_text_formatter.yml | 1 + phpBB/language/en/acp/common.php | 1 + phpBB/phpbb/textformatter/s9e/factory.php | 44 +++++++++++++++------- tests/test_framework/phpbb_test_case_helpers.php | 7 +++- tests/text_formatter/s9e/factory_test.php | 18 +++++++++ .../s9e/fixtures/malformed_bbcode.xml | 28 ++++++++++++++ 6 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 tests/text_formatter/s9e/fixtures/malformed_bbcode.xml diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 74624ea4e4..07087cd4a9 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -39,6 +39,7 @@ services: - '@dispatcher' - '@config' - '@text_formatter.s9e.link_helper' + - '@log' - '%text_formatter.cache.dir%' - '%text_formatter.cache.parser.key%' - '%text_formatter.cache.renderer.key%' diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index de5039f047..0d5f6fee25 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -552,6 +552,7 @@ $lang = array_merge($lang, array( 'LOG_BBCODE_ADD' => 'Added new BBCode
          » %s', 'LOG_BBCODE_EDIT' => 'Edited BBCode
          » %s', 'LOG_BBCODE_DELETE' => 'Deleted BBCode
          » %s', + 'LOG_BBCODE_CONFIGURATION_ERROR' => 'Error while configuring BBCode: %1$s
          » %2$s', 'LOG_BOT_ADDED' => 'New bot added
          » %s', 'LOG_BOT_DELETE' => 'Deleted bot
          » %s', diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 1e85856898..2b11a79192 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -13,6 +13,7 @@ namespace phpbb\textformatter\s9e; +use Exception; use s9e\TextFormatter\Configurator; use s9e\TextFormatter\Configurator\Items\AttributeFilters\RegexpFilter; use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; @@ -131,6 +132,11 @@ class factory implements \phpbb\textformatter\cache_interface */ protected $dispatcher; + /** + * @var \phpbb\log\log_interface + */ + protected $log; + /** * Constructor * @@ -139,11 +145,12 @@ class factory implements \phpbb\textformatter\cache_interface * @param \phpbb\event\dispatcher_interface $dispatcher * @param \phpbb\config\config $config * @param \phpbb\textformatter\s9e\link_helper $link_helper + * @param \phpbb\log\log_interface $log * @param string $cache_dir Path to the cache dir * @param string $cache_key_parser Cache key used for the parser * @param string $cache_key_renderer Cache key used for the renderer */ - public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer) + public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, \phpbb\log\log_interface $log, $cache_dir, $cache_key_parser, $cache_key_renderer) { $this->link_helper = $link_helper; $this->cache = $cache; @@ -153,6 +160,7 @@ class factory implements \phpbb\textformatter\cache_interface $this->config = $config; $this->data_access = $data_access; $this->dispatcher = $dispatcher; + $this->log = $log; } /** @@ -272,7 +280,7 @@ class factory implements \phpbb\textformatter\cache_interface // Add default BBCodes foreach ($this->get_default_bbcodes($configurator) as $bbcode) { - $configurator->BBCodes->addCustom($bbcode['usage'], new UnsafeTemplate($bbcode['template'])); + $this->add_bbcode($configurator, $bbcode['usage'], $bbcode['template']); } if (isset($configurator->tags['QUOTE'])) { @@ -299,17 +307,7 @@ class factory implements \phpbb\textformatter\cache_interface }, $row['bbcode_tpl'] ); - - try - { - $configurator->BBCodes->addCustom($row['bbcode_match'], new UnsafeTemplate($tpl)); - } - catch (\Exception $e) - { - /** - * @todo log an error? - */ - } + $this->add_bbcode($configurator, $row['bbcode_match'], $tpl); } // Load smilies @@ -418,6 +416,26 @@ class factory implements \phpbb\textformatter\cache_interface return array('parser' => $parser, 'renderer' => $renderer); } + /** + * Add a BBCode to given configurator + * + * @param Configurator $configurator + * @param string $usage + * @param string $template + * @return void + */ + protected function add_bbcode(Configurator $configurator, $usage, $template) + { + try + { + $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template)); + } + catch (Exception $e) + { + $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]); + } + } + /** * Configure the Autolink / Autoemail plugins used to linkify text * diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 7fb9a740b8..c792976b1e 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -385,7 +385,7 @@ class phpbb_test_case_helpers $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access'); $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); $mb->setConstructorArgs(array( - $this->test_case->getMock('phpbb\\db\\driver\\driver'), + $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')->getMock(), 'phpbb_bbcodes', 'phpbb_smilies', 'phpbb_styles', @@ -489,8 +489,11 @@ class phpbb_test_case_helpers $request = new phpbb_mock_request; } + // Get a log interface + $log = ($container->has('log')) ? $container->get('log') : $this->test_case->getMockBuilder('phpbb\\log\\log_interface')->getMock(); + // Create and register the text_formatter.s9e.factory service - $factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer); + $factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $log, $cache_dir, $cache_key_parser, $cache_key_renderer); $container->set('text_formatter.s9e.factory', $factory); // Create a user if none was provided, and add the common lang strings diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index d35330a975..0d780a19a9 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -56,6 +56,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case $this->dispatcher, new \phpbb\config\config(array('allowed_schemes_links' => 'http,https,ftp')), new \phpbb\textformatter\s9e\link_helper, + $this->getMockBuilder('phpbb\\log\\log_interface')->getMock(), $this->get_cache_dir(), '_foo_parser', '_foo_renderer' @@ -263,6 +264,23 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case $this->assertSame($expected, $renderer->render($parser->parse($original))); } + /** + * @testdox Logs malformed BBCodes + */ + public function test_malformed_bbcodes() + { + $log = $this->getMockBuilder('phpbb\\log\\log_interface')->getMock(); + $log->expects($this->once()) + ->method('add') + ->with('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, ['[x !x]{TEXT}[/x]', 'Cannot interpret the BBCode definition']); + + $container = new phpbb_mock_container_builder; + $container->set('log', $log); + + $fixture = __DIR__ . '/fixtures/malformed_bbcode.xml'; + $this->get_test_case_helpers()->set_s9e_services($container, $fixture); + } + /** * @testdox get_configurator() triggers events before and after configuration */ diff --git a/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml b/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml new file mode 100644 index 0000000000..7e7aa1a39c --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml @@ -0,0 +1,28 @@ + + + + bbcode_id + bbcode_tag + bbcode_helpline + display_on_posting + bbcode_match + bbcode_tpl + first_pass_match + first_pass_replace + second_pass_match + second_pass_replace + + + 13 + x + + 1 + [x !x]{TEXT}[/x] + ... + + + + + +
          +
          -- cgit v1.2.1 From 3c5b3254d151c052070aa1e5ef2efef7d850f95b Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 22 Jan 2018 16:36:12 +0100 Subject: [ticket/15531] Workaround for false-positive sniff PHPBB3-15531 --- phpBB/phpbb/textformatter/s9e/factory.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 2b11a79192..c0bbc7b0e8 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -13,7 +13,6 @@ namespace phpbb\textformatter\s9e; -use Exception; use s9e\TextFormatter\Configurator; use s9e\TextFormatter\Configurator\Items\AttributeFilters\RegexpFilter; use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; @@ -430,7 +429,7 @@ class factory implements \phpbb\textformatter\cache_interface { $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template)); } - catch (Exception $e) + catch (\Exception $e) { $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]); } -- cgit v1.2.1 From 233a07ceda0a5523ec6fd4c8de1ea8e6aec681a8 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 22 Jan 2018 17:39:24 +0100 Subject: [ticket/15528] Rename column label PHPBB3-15528 --- phpBB/language/en/acp/styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 511a6f9f8e..ab85d9d2f5 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -80,7 +80,7 @@ $lang = array_merge($lang, array( 'STYLE_UNINSTALL' => 'Uninstall', 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', - 'STYLE_PHPBB_VERSION' => 'Style phpBB version', + 'STYLE_PHPBB_VERSION' => 'phpBB Version', 'STYLE_USED_BY' => 'Used by (including robots)', 'STYLE_VERSION' => 'Style version', -- cgit v1.2.1 From 329eb201d96b13745e8f6dcd845304a14e826b34 Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Mon, 22 Jan 2018 22:17:25 +0100 Subject: [ticket/15532] Updates the links for guidelines and message format PHPBB3-15532 --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 39eb83e454..cacfcf1118 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,9 @@ Checklist: -- [ ] Correct branch: master for new features; 3.2.x, 3.1.x for fixes +- [ ] Correct branch: master for new features; 3.2.x for fixes - [ ] Tests pass -- [ ] Code follows coding guidelines: [master / 3.2.x](https://area51.phpbb.com/docs/master/coding-guidelines.html), [3.1.x](https://area51.phpbb.com/docs/31x/coding-guidelines.html) -- [ ] Commit follows commit message [format](https://wiki.phpbb.com/Git#Commit_Messages) +- [ ] Code follows coding guidelines: [master](https://area51.phpbb.com/docs/dev/master/development/coding_guidelines.html) and [3.2.x](https://area51.phpbb.com/docs/dev/3.2.x/development/coding_guidelines.html) +- [ ] Commit follows commit message [format](https://area51.phpbb.com/docs/dev/3.2.x/development/git.html) Tracker ticket (set the ticket ID to **your ticket ID**): -- cgit v1.2.1 From 277f4efcc7e091da57bfd49143e3b0618a984c10 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 24 Jan 2018 13:34:23 +0100 Subject: [ticket/15514] Improve SMTP_SERVER lang key PHPBB3-15514 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 25d70813f6..b050af070a 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -585,7 +585,7 @@ $lang = array_merge($lang, array( 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', 'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.', - 'SMTP_SERVER' => 'SMTP server address', + 'SMTP_SERVER' => 'SMTP server address and protocol', 'SMTP_SERVER_EXPLAIN' => 'Note that you have to provide the protocol that your server uses. If you are using SSL, this has to be "ssl://your.mailserver.com"', 'SMTP_SETTINGS' => 'SMTP settings', 'SMTP_USERNAME' => 'SMTP username', -- cgit v1.2.1 From 532afbf83a509b25c5042f5bb374657417ca3e5d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 24 Jan 2018 18:47:40 +0100 Subject: [ticket/15527] Remove "use" and specify full class name for exception PHPBB3-15527 --- phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php index 6457a84adb..ad50089d4e 100644 --- a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php +++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php @@ -13,8 +13,6 @@ namespace phpbb\db\migration\data\v32x; -use Exception; - class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migration { public function update_data() @@ -61,7 +59,7 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migrat ] ); } - catch (Exception $e) + catch (\Exception $e) { // Ignore the pair and move on. The BBCodes would have to be fixed manually return; -- cgit v1.2.1 From ca2e2e6107da66fea970a23875c09aaa87c176f7 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 25 Jan 2018 20:49:10 +0700 Subject: [ticket/15533] Fix typo in viewtopic_topic_tools.html PHPBB3-15533 --- phpBB/styles/prosilver/template/viewtopic_topic_tools.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html index 397c807bb3..272a434f6a 100644 --- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html +++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html @@ -11,7 +11,7 @@
        • - {S_WATCH_TOPIC_TITLE} + {S_WATCH_TOPIC_TITLE}
        • -- cgit v1.2.1 From f1afccb6625b3b5774c39749f39cfb760ab4d5f7 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 25 Jan 2018 20:59:10 +0700 Subject: [ticket/15534] Update extensions database link in ACP for phpBB 3.2 PHPBB3-15534 --- phpBB/adm/style/acp_ext_list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 7ab2608e13..6a6341e1a6 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -7,7 +7,7 @@

          {L_EXTENSIONS_EXPLAIN}

          - {L_BROWSE_EXTENSIONS_DATABASE}{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS} + {L_BROWSE_EXTENSIONS_DATABASE}{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}