From fdd5a1876388e20b8b79f39bdc6e63c1ce964a91 Mon Sep 17 00:00:00 2001 From: Martin Beckmann Date: Mon, 1 Feb 2016 23:11:39 +0100 Subject: [PATCH 1/3] [ticket/14443] Introduce additional parameter to messenger PHPBB3-14443 --- phpBB/includes/functions_messenger.php | 10 +++++----- phpBB/phpbb/notification/method/messenger_base.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ae393739b9..1f70b64ea8 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -210,7 +210,7 @@ class messenger /** * Set email template to use */ - function template($template_file, $template_lang = '', $template_path = '') + function template($template_file, $template_lang = '', $template_path = '', $template_dir_prefix = '') { global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; @@ -232,7 +232,7 @@ class messenger if ($template_path) { $template_paths = array( - $template_path, + $template_path . '/' . $template_dir_prefix, ); } else @@ -241,7 +241,7 @@ class messenger $template_path .= $template_lang . '/email'; $template_paths = array( - $template_path, + $template_path . '/' . $template_dir_prefix, ); // we can only specify default language fallback when the path is not a custom one for which we @@ -251,14 +251,14 @@ class messenger $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; $fallback_template_path .= basename($config['default_lang']) . '/email'; - $template_paths[] = $fallback_template_path; + $template_paths[] = $fallback_template_path . '/' . $template_dir_prefix; } } $this->set_template_paths(array( array( 'name' => $template_lang . '_email', - 'ext_path' => 'language/' . $template_lang . '/email' + 'ext_path' => 'language/' . $template_lang . '/email' . '/' . $template_dir_prefix, ), ), $template_paths); diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index c3aee088f9..5ae96282c4 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -74,7 +74,7 @@ abstract class messenger_base extends \phpbb\notification\method\base continue; } - $messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']); + $messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix); $messenger->set_addresses($user); From a35314c6ea38cfe3878fe68ac3d0453caafe30e1 Mon Sep 17 00:00:00 2001 From: Martin Beckmann Date: Tue, 2 Feb 2016 15:49:36 +0100 Subject: [PATCH 2/3] [ticket/14443] Avoid duplicate slashes PHPBB3-14443 --- phpBB/includes/functions_messenger.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 1f70b64ea8..6cef791814 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -214,6 +214,8 @@ class messenger { global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; + $template_dir_prefix = (!$template_dir_prefix || substr($template_dir_prefix, 0, 1) === '/') ? $template_dir_prefix : '/' . $template_dir_prefix; + $this->setup_template(); if (!trim($template_file)) @@ -232,7 +234,7 @@ class messenger if ($template_path) { $template_paths = array( - $template_path . '/' . $template_dir_prefix, + $template_path . $template_dir_prefix, ); } else @@ -241,7 +243,7 @@ class messenger $template_path .= $template_lang . '/email'; $template_paths = array( - $template_path . '/' . $template_dir_prefix, + $template_path . $template_dir_prefix, ); // we can only specify default language fallback when the path is not a custom one for which we @@ -251,14 +253,14 @@ class messenger $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; $fallback_template_path .= basename($config['default_lang']) . '/email'; - $template_paths[] = $fallback_template_path . '/' . $template_dir_prefix; + $template_paths[] = $fallback_template_path . $template_dir_prefix; } } $this->set_template_paths(array( array( 'name' => $template_lang . '_email', - 'ext_path' => 'language/' . $template_lang . '/email' . '/' . $template_dir_prefix, + 'ext_path' => 'language/' . $template_lang . '/email' . $template_dir_prefix, ), ), $template_paths); From 5d579631d73339dbc5c1265a969db30f220d3630 Mon Sep 17 00:00:00 2001 From: Martin Beckmann Date: Sat, 27 Feb 2016 15:14:31 +0100 Subject: [PATCH 3/3] [ticket/14443] substr($var, 0, 1) -> $var[0] PHPBB3-14443 --- 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 6cef791814..89f8e76dd3 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -214,7 +214,7 @@ class messenger { global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; - $template_dir_prefix = (!$template_dir_prefix || substr($template_dir_prefix, 0, 1) === '/') ? $template_dir_prefix : '/' . $template_dir_prefix; + $template_dir_prefix = (!$template_dir_prefix || $template_dir_prefix[0] === '/') ? $template_dir_prefix : '/' . $template_dir_prefix; $this->setup_template();