From 36d5fff1c6cbacbda4b4c623d8b9d909f214167a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 23:47:05 +0200 Subject: [PATCH 01/16] [ticket/12536] Get Versions Should Not Require Both Stable and Unstable https://tracker.phpbb.com/browse/PHPBB3-12536 PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index e2fdf6ce63..7d59b5cd3a 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -216,10 +216,19 @@ class version_helper if ($this->force_stability !== null) { - return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; + $stability = ($this->force_stability === 'unstable') ? 'unstable' : 'stable'; + } + else + { + $stability = $this->is_stable($this->current_version) ? 'stable' : 'unstable'; } - return ($this->is_stable($this->current_version)) ? $info['stable'] : $info['unstable']; + if (!isset($info[$stability])) + { + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + + return $info[$stability]; } /** @@ -247,7 +256,7 @@ class version_helper $info = json_decode($info, true); - if (empty($info['stable']) || empty($info['unstable'])) + if (empty($info['stable']) && empty($info['unstable'])) { $this->user->add_lang('acp/common'); From 3dddf1f4bf84d7a97ee47623a868483079ed643e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 12:48:08 +0200 Subject: [PATCH 02/16] [ticket/12536] Return empty array if stability unavailable PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 7d59b5cd3a..4c779c1a5a 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -225,7 +225,7 @@ class version_helper if (!isset($info[$stability])) { - throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + return array(); } return $info[$stability]; From 8b6df0e2f8a0601b43a1c1186f09bf058dadb47b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 12:59:10 +0200 Subject: [PATCH 03/16] [ticket/12536] Update doc block PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 4c779c1a5a..8e1c593094 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -208,7 +208,6 @@ class version_helper * * @param bool $force_update Ignores cached data. Defaults to false. * @return string Version info - * @throws \RuntimeException */ public function get_versions_matching_stability($force_update = false) { From 300d5c32db82a72309d389860864e5513ca45ce4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:22:54 +0200 Subject: [PATCH 04/16] [ticket/12509] Add an option to set the path of custom file for extensions https://tracker.phpbb.com/browse/PHPBB3-12509 PHPBB3-12509 --- phpBB/includes/functions_messenger.php | 5 ++++- phpBB/phpbb/template/twig/twig.php | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 79a5aeda1a..bc5937fdc4 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -252,7 +252,10 @@ class messenger } } - $this->set_template_paths($template_lang . '_email', $template_paths); + $this->set_template_paths(array( + 'name' => $template_lang . '_email', + 'ext_path' => 'language/' . $template_lang . '/email' + ), $template_paths); $this->template->set_filenames(array( 'body' => $template_file . '.txt', diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 83630f5992..9e5a572cb5 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -211,8 +211,8 @@ class twig extends \phpbb\template\base * * Note: Templates are still compiled to phpBB's cache directory. * - * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. - * @param string|array or string $paths Array of style paths, relative to current root directory + * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. + * @param string|array of string $paths Array of style paths, relative to current root directory * @return phpbb_template $this */ public function set_custom_style($names, $paths) @@ -234,10 +234,18 @@ class twig extends \phpbb\template\base $namespace = str_replace('/', '_', $ext_namespace); $paths = array(); - foreach ($names as $style_name) + foreach ($names as $template_dir) { - $ext_style_path = $ext_path . 'styles/' . $style_name . '/'; - $ext_style_template_path = $ext_style_path . 'template/'; + if (is_array($template_dir) && isset($template_dir['ext_path'])) + { + $ext_style_template_path = $ext_path . $template_dir['ext_path']; + $ext_style_path = dirname($ext_style_template_path); + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + } if (is_dir($ext_style_template_path)) { From 910b9b59b39ffab0614a310cfa9ddcf42723fe89 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:25:44 +0200 Subject: [PATCH 05/16] [ticket/12509] Update acp custom_style setter PHPBB3-12509 --- phpBB/adm/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c1e8edbd03..973ce8fe5d 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,7 +50,11 @@ $module_id = request_var('i', ''); $mode = request_var('mode', ''); // Set custom style for admin area -$template->set_custom_style('adm', $phpbb_admin_path . 'style'); +$template->set_custom_style(array( + 'name' => 'adm', + 'ex_path' => 'adm/', +), $phpbb_admin_path . 'style'); + $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); From 1e427fa031eea8dd6a1e04f1407f996d1d948203 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:39:42 +0200 Subject: [PATCH 06/16] [ticket/12509] Fix the call to set_custom_file in adm/index and messenger PHPBB3-12509 --- phpBB/adm/index.php | 6 ++++-- phpBB/includes/functions_messenger.php | 6 ++++-- phpBB/phpbb/template/twig/twig.php | 14 +++++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 973ce8fe5d..31965cec28 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -51,8 +51,10 @@ $mode = request_var('mode', ''); // Set custom style for admin area $template->set_custom_style(array( - 'name' => 'adm', - 'ex_path' => 'adm/', + array( + 'name' => 'adm', + 'ex_path' => 'adm/', + ) ), $phpbb_admin_path . 'style'); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index bc5937fdc4..482f95dd99 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -253,8 +253,10 @@ class messenger } $this->set_template_paths(array( - 'name' => $template_lang . '_email', - 'ext_path' => 'language/' . $template_lang . '/email' + array( + 'name' => $template_lang . '_email', + 'ext_path' => 'language/' . $template_lang . '/email' + ) ), $template_paths); $this->template->set_filenames(array( diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 9e5a572cb5..a084245918 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -236,10 +236,18 @@ class twig extends \phpbb\template\base foreach ($names as $template_dir) { - if (is_array($template_dir) && isset($template_dir['ext_path'])) + if (is_array($template_dir)) { - $ext_style_template_path = $ext_path . $template_dir['ext_path']; - $ext_style_path = dirname($ext_style_template_path); + if (isset($template_dir['ext_path'])) + { + $ext_style_template_path = $ext_path . $template_dir['ext_path']; + $ext_style_path = dirname($ext_style_template_path); + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir['name'] . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + } } else { From 9fc2063d8623149ec6f8e359c87d626fcc5eeb88 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:49:21 +0200 Subject: [PATCH 07/16] [ticket/12509] Fix doc block PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index a084245918..fc6e9eacd8 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -213,7 +213,7 @@ class twig extends \phpbb\template\base * * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. * @param string|array of string $paths Array of style paths, relative to current root directory - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_custom_style($names, $paths) { From 57d08dc77b61157ee53272ec0ba0154d7a416f0c Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 00:27:04 +0200 Subject: [PATCH 08/16] [ticket/12509] Fix typo in adm/index.php PHPBB3-12509 --- phpBB/adm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 31965cec28..f83a491e97 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -53,7 +53,7 @@ $mode = request_var('mode', ''); $template->set_custom_style(array( array( 'name' => 'adm', - 'ex_path' => 'adm/', + 'ext_path' => 'adm/', ) ), $phpbb_admin_path . 'style'); From c8080d6464a406deaa4b5b2d375eea119f049dff Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 01:11:43 +0200 Subject: [PATCH 09/16] [ticket/12509] Fix path in adm/index.php PHPBB3-12509 --- phpBB/adm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index f83a491e97..19482b6d6a 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -53,7 +53,7 @@ $mode = request_var('mode', ''); $template->set_custom_style(array( array( 'name' => 'adm', - 'ext_path' => 'adm/', + 'ext_path' => 'adm/style/', ) ), $phpbb_admin_path . 'style'); From 9d7c36041e0dac509476069ee5bbce92e841f33e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 02:16:32 +0200 Subject: [PATCH 10/16] [ticket/12509] Update calls to set_custom_style in forgotten places PHPBB3-12509 --- phpBB/includes/functions_module.php | 7 ++++++- phpBB/install/index.php | 7 ++++++- phpBB/install/install_update.php | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 04efcb7b2e..9ef0754120 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -581,7 +581,12 @@ class p_master if (is_dir($module_style_dir)) { - $template->set_custom_style('adm', array($module_style_dir, $phpbb_admin_path . 'style')); + $template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ) + ), array($module_style_dir, $phpbb_admin_path . 'style')); } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 66c8559e98..8d13c182d8 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -250,7 +250,12 @@ $phpbb_path_helper = $phpbb_container->get('path_helper'); $template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context()); $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); -$template->set_custom_style('adm', $paths); +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ) +), $paths); $path = array_shift($paths); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 87b7d8d703..ab276624ee 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -141,7 +141,12 @@ class install_update extends module // Set custom template again. ;) $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); - $template->set_custom_style('adm', $paths); + $template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ) + ), $paths); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], From e1d9f1c67c9be90ac2f7f6a86ed02f0c22622afa Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 15 May 2014 01:14:44 +0200 Subject: [PATCH 11/16] [ticket/12536] Use stable values when unstable are unavailable PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 8e1c593094..4718088ab6 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -215,19 +215,10 @@ class version_helper if ($this->force_stability !== null) { - $stability = ($this->force_stability === 'unstable') ? 'unstable' : 'stable'; - } - else - { - $stability = $this->is_stable($this->current_version) ? 'stable' : 'unstable'; + return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; } - if (!isset($info[$stability])) - { - return array(); - } - - return $info[$stability]; + return ($this->is_stable($this->current_version)) ? $info['stable'] : $info['unstable']; } /** @@ -271,6 +262,9 @@ class version_helper } } + $info['stable'] = (empty($info['stable'])) ? array() : $info['stable']; + $info['unstable'] = (empty($info['unstable'])) ? $info['stable'] : $info['unstable']; + $this->cache->put($cache_file, $info, 86400); // 24 hours } From a1e21f0a5cfafb9f195002031618656d0e1abfc8 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 15 May 2014 02:10:51 +0200 Subject: [PATCH 12/16] [ticket/12536] Add test cases with empty versions list PHPBB3-12536 --- tests/version/version_test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/version/version_test.php b/tests/version/version_test.php index 2e2398bd45..5caad46e10 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -181,6 +181,11 @@ class phpbb_version_helper_test extends phpbb_test_case ), ), ), + array( + '1.1.0', + array(), + array(), + ), ); } @@ -286,6 +291,11 @@ class phpbb_version_helper_test extends phpbb_test_case ), '1.1.0-a2', ), + array( + '1.1.0', + array(), + null, + ), ); } From 9a846e447ba98b175c510d9fbe7741648296a1ba Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 26 May 2014 23:44:30 +0200 Subject: [PATCH 13/16] [ticket/12509] Add missing ',' in arrays PHPBB3-12509 --- phpBB/adm/index.php | 2 +- phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/functions_module.php | 2 +- phpBB/install/index.php | 2 +- phpBB/install/install_update.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 19482b6d6a..b87b43945c 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -54,7 +54,7 @@ $template->set_custom_style(array( array( 'name' => 'adm', 'ext_path' => 'adm/style/', - ) + ), ), $phpbb_admin_path . 'style'); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 482f95dd99..4a3f2ec73a 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -256,7 +256,7 @@ class messenger array( 'name' => $template_lang . '_email', 'ext_path' => 'language/' . $template_lang . '/email' - ) + ), ), $template_paths); $this->template->set_filenames(array( diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 9ef0754120..86d3a3a077 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -585,7 +585,7 @@ class p_master array( 'name' => 'adm', 'ext_path' => 'adm/style/', - ) + ), ), array($module_style_dir, $phpbb_admin_path . 'style')); } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 8d13c182d8..d38c5fa676 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -254,7 +254,7 @@ $template->set_custom_style(array( array( 'name' => 'adm', 'ext_path' => 'adm/style/', - ) + ), ), $paths); $path = array_shift($paths); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ab276624ee..c2f7b191a7 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -145,7 +145,7 @@ class install_update extends module array( 'name' => 'adm', 'ext_path' => 'adm/style/', - ) + ), ), $paths); $template->assign_vars(array( From 8a227b981adae1ec49ad0996f32fe3e5fff33e8a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 26 May 2014 23:46:59 +0200 Subject: [PATCH 14/16] [ticket/12536] Restore missing @throws PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 4718088ab6..76bd477e18 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -208,6 +208,7 @@ class version_helper * * @param bool $force_update Ignores cached data. Defaults to false. * @return string Version info + * @throws \RuntimeException */ public function get_versions_matching_stability($force_update = false) { From 05cd25a88b551d7338596cc6634e95cb371f565d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 27 May 2014 00:05:12 +0200 Subject: [PATCH 15/16] [ticket/12509] Add example in doc block PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index fc6e9eacd8..9ea5121553 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -212,6 +212,10 @@ class twig extends \phpbb\template\base * Note: Templates are still compiled to phpBB's cache directory. * * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. + * E.g. array( + * 'name' => 'adm', + * 'ext_path' => 'adm/style/', + * ) * @param string|array of string $paths Array of style paths, relative to current root directory * @return \phpbb\template\template $this */ From 6230ae66a3d864f4ef4cd0e79e8bf41f44b9f69e Mon Sep 17 00:00:00 2001 From: Tabitha Backoff Date: Tue, 27 May 2014 10:31:03 -0400 Subject: [PATCH 16/16] [ticket/12596] Add template event acp_group_options_before/after Add template events to the group settings page to allow extensions to add additional options for groups. PHPBB3-12596 --- phpBB/adm/style/acp_groups.html | 2 ++ phpBB/docs/events.md | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index cf189f979f..f9846ea7cd 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -56,6 +56,7 @@
{L_GROUP_OPTIONS_SAVE} +

{L_GROUP_FOUNDER_MANAGE_EXPLAIN}
@@ -78,6 +79,7 @@

{L_GROUP_RECEIVE_PM_EXPLAIN}
+
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 4a6a1895dd..4dc55540f3 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -22,6 +22,18 @@ acp_forums_normal_settings_append * Since: 3.1.0-a1 * Purpose: Add settings to forums +acp_group_options_before +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.0-b4 +* Purpose: Add addtional options to group settings (before GROUP_FOUNDER_MANAGE) + +acp_group_options_after +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.0-b4 +* Purpose: Add addtional options to group settings (after GROUP_RECEIVE_PM) + acp_main_actions_append === * Location: adm/style/acp_main.html