From 11c5a6621389af854170d3190432d3f414c77618 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 18 Feb 2012 23:31:31 +0100 Subject: [PATCH 01/76] [ticket/10658] Use get_user_rank() for group ranks on group view. The old code was buggy because it did not prefix the path with the phpBB root path which causes problems with bridges and other URL rewriting. PHPBB3-10658 --- phpBB/memberlist.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b3c0bae16a..cfa1631dbe 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1221,21 +1221,16 @@ switch ($mode) // Misusing the avatar function for displaying group avatars... $avatar_img = get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR'); + // ... same for group rank $rank_title = $rank_img = $rank_img_src = ''; if ($group_row['group_rank']) { - if (isset($ranks['special'][$group_row['group_rank']])) + get_user_rank($group_row['group_rank'], false, $rank_title, $rank_img, $rank_img_src); + + if ($rank_img) { - $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title']; + $rank_img .= '
'; } - $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '
' : ''; - $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : ''; - } - else - { - $rank_title = ''; - $rank_img = ''; - $rank_img_src = ''; } $template->assign_vars(array( From bb7e86c2b1920c5820d4c9cca7ec76bd25835fa1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 8 Mar 2012 15:19:15 +0100 Subject: [PATCH 02/76] [ticket/10658] Do not fetch ranks into the $ranks array, it is no longer used. PHPBB3-10658 --- phpBB/memberlist.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index cfa1631dbe..3dd5bd24b6 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -62,11 +62,6 @@ $default_key = 'c'; $sort_key = request_var('sk', $default_key); $sort_dir = request_var('sd', 'a'); - -// Grab rank information for later -$ranks = $cache->obtain_ranks(); - - // What do you want to do today? ... oops, I think that line is taken ... switch ($mode) { From 97d4f168f588288df071e4a8b107b9ffb8b0355f Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Mon, 19 Mar 2012 15:08:28 -0400 Subject: [PATCH 03/76] [ticket/10675] Add disk full language string when posting attachments Add language string visible by admins only for when the disk does not have enough free space to upload attachments. PHPBB3-10675 --- phpBB/includes/functions_posting.php | 9 ++++++++- phpBB/language/en/posting.php | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f920be9c4b..b40fd67927 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -497,7 +497,14 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage { if ($free_space <= $file->get('filesize')) { - $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; + if ($auth->acl_get('a_')) + { + $filedata['error'][] = $user->lang['ATTACH_DISK_FULL']; + } + else + { + $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; + } $filedata['post_attach'] = false; $file->remove(); diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index f8d265dddd..dd0ba7fc6d 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -42,6 +42,7 @@ $lang = array_merge($lang, array( 'ADD_POLL' => 'Poll creation', 'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank.', 'ALREADY_DELETED' => 'Sorry but this message is already deleted.', + 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment', 'ATTACH_QUOTA_REACHED' => 'Sorry, the board attachment quota has been reached.', 'ATTACH_SIG' => 'Attach a signature (signatures can be altered via the UCP)', From 28fac327426de08b7a5476b2417fef4f03be6908 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 29 Mar 2012 15:51:06 +0100 Subject: [PATCH 04/76] [ticket/10705] Change WARNINGS_ZERO_TOTAL in en language Located the WARNINGS_ZERO_TOTAL in the language and replaced it with NO_WARNINGS PHPBB3-10705 --- phpBB/language/en/mcp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 664365b1ec..d57036cc0e 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -388,7 +388,7 @@ $lang = array_merge($lang, array( 'WARNING_PM_BODY' => 'The following is a warning which has been issued to you by an administrator or moderator of this site.[quote]%s[/quote]', 'WARNING_PM_SUBJECT' => 'Board warning issued', 'WARNING_POST_DEFAULT' => 'This is a warning regarding the following post made by you: %s .', - 'WARNINGS_ZERO_TOTAL' => 'No warnings exist.', + 'NO_WARNINGS' => 'No warnings exist.', 'YOU_SELECTED_TOPIC' => 'You selected topic number %d: %s.', From d0e7b38aecbd5f357401297c8d57824a0504e9b6 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 29 Mar 2012 15:52:06 +0100 Subject: [PATCH 05/76] [ticket/10705] Change WARNINGS_ZERO_TOTAL in prosilver Located the L_WARNINGS_ZERO_TOTAL in prosilver and replaced it with L_NO_WARNINGS PHPBB3-10705 --- phpBB/styles/prosilver/template/mcp_warn_front.html | 4 ++-- phpBB/styles/prosilver/template/mcp_warn_list.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_warn_front.html b/phpBB/styles/prosilver/template/mcp_warn_front.html index 8f42e28cc0..2f7d939b16 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_front.html +++ b/phpBB/styles/prosilver/template/mcp_warn_front.html @@ -55,7 +55,7 @@ -

{L_WARNINGS_ZERO_TOTAL}

+

{L_NO_WARNINGS}

@@ -88,7 +88,7 @@ -

{L_WARNINGS_ZERO_TOTAL}

+

{L_NO_WARNINGS}

diff --git a/phpBB/styles/prosilver/template/mcp_warn_list.html b/phpBB/styles/prosilver/template/mcp_warn_list.html index d9c0bce088..5e43903f11 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_list.html +++ b/phpBB/styles/prosilver/template/mcp_warn_list.html @@ -53,7 +53,7 @@ -

{L_WARNINGS_ZERO_TOTAL}

+

{L_NO_WARNINGS}

From 56629d8e3c80cd490b8ec39d4fa102d0303f9a4b Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 29 Mar 2012 15:52:28 +0100 Subject: [PATCH 06/76] [ticket/10705] Change WARNINGS_ZERO_TOTAL in subsilver2 Located the L_WARNINGS_ZERO_TOTAL in subsilver2 and replaced it with L_NO_WARNINGS PHPBB3-10705 --- phpBB/styles/subsilver2/template/mcp_warn_front.html | 4 ++-- phpBB/styles/subsilver2/template/mcp_warn_list.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/subsilver2/template/mcp_warn_front.html b/phpBB/styles/subsilver2/template/mcp_warn_front.html index 417355d537..020a79f419 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_front.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_front.html @@ -38,7 +38,7 @@ - {L_WARNINGS_ZERO_TOTAL} + {L_NO_WARNINGS} @@ -64,7 +64,7 @@ - {L_WARNINGS_ZERO_TOTAL} + {L_NO_WARNINGS} diff --git a/phpBB/styles/subsilver2/template/mcp_warn_list.html b/phpBB/styles/subsilver2/template/mcp_warn_list.html index 6ed0b68bd5..0b0cfa8a45 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_list.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_list.html @@ -21,7 +21,7 @@ - {L_WARNINGS_ZERO_TOTAL} + {L_NO_WARNINGS} From 9391d423c05818e5f18ddbe051e1713c835f4404 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 30 Mar 2012 19:04:20 +0100 Subject: [PATCH 07/76] [feature/event-dispatcher] Adding composer.phar to .gitignore for olympus To keep the .gitignore's the same. PHPBB3-9550 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e6e017f85e..de26e1dd1e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /phpBB/cache/*.html /phpBB/cache/*.php /phpBB/cache/queue.php.lock +/phpBB/composer.phar /phpBB/config.php /phpBB/config_dev.php /phpBB/config_test.php From a7045e65724481002e232a7d143b7cc2ed6acb3a Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 30 Mar 2012 21:43:00 -0400 Subject: [PATCH 08/76] [feature/qrpreview] Preview from Quick Reply PHPBB3-10726 --- phpBB/language/en/viewtopic.php | 2 +- phpBB/posting.php | 2 +- phpBB/styles/prosilver/template/ajax.js | 11 +++++++++++ .../styles/prosilver/template/quickreply_editor.html | 4 ++-- .../styles/subsilver2/template/quickreply_editor.html | 4 ++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 1460490672..184f88ed3c 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -62,7 +62,7 @@ $lang = array_merge($lang, array( 'FILE_NOT_FOUND_404' => 'The file %s does not exist.', 'FORK_TOPIC' => 'Copy topic', - 'FULL_EDITOR' => 'Full Editor', + 'FULL_EDITOR' => 'Full Editor & Preview', 'LINKAGE_FORBIDDEN' => 'You are not authorised to view, download or link from/to this site.', 'LOGIN_NOTIFY_TOPIC' => 'You have been notified about this topic, please login to view it.', diff --git a/phpBB/posting.php b/phpBB/posting.php index 56fb7832f2..71ba353e89 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -38,7 +38,7 @@ $load = (isset($_POST['load'])) ? true : false; $delete = (isset($_POST['delete'])) ? true : false; $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; -$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['full_editor']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false; +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false; $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', ''); $error = $post_data = array(); diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index cc886c42b1..54f34e4204 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -66,6 +66,17 @@ $('[data-ajax]').each(function() { }); +/** + * This simply appends #preview to the action of the + * QR action when you click the Full Editor & Preview button + */ +$('#qr_full_editor').click(function() { + $('#qr_postform').attr('action', function(i, val) { + return val + '#preview'; + }); +}); + + /** * This AJAXifies the quick-mod tools. The reason it cannot be a standard diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 4cd5eedd3e..c7d998eca5 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -14,8 +14,8 @@
{S_FORM_TOKEN} {QR_HIDDEN_FIELDS} -   -   +   +  
diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index de5017280c..4c3f7a3d0b 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -14,8 +14,8 @@ -   - +   + {S_FORM_TOKEN} {QR_HIDDEN_FIELDS} From 0c8d0a82de69277d090907618eee71f815f12436 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 30 Mar 2012 21:46:20 -0400 Subject: [PATCH 09/76] [feature/qrpreview] Add id qr_postform to prosilver QR PHPBB3-10726 --- phpBB/styles/prosilver/template/quickreply_editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index c7d998eca5..a08b5dc3cc 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -1,4 +1,4 @@ -
+

{L_QUICKREPLY}

From b8b342be2d238616b96ace9acbe8af2e18ba1e7a Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Sat, 31 Mar 2012 12:46:44 -0400 Subject: [PATCH 10/76] [Ticket/10675] Correct language string ATTACH_DISK_FULL Add period to ATTACH_DISK_FULL language string PHPBB3-10675 --- phpBB/language/en/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index dd0ba7fc6d..24f3204c57 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -42,7 +42,7 @@ $lang = array_merge($lang, array( 'ADD_POLL' => 'Poll creation', 'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank.', 'ALREADY_DELETED' => 'Sorry but this message is already deleted.', - 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment', + 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment.', 'ATTACH_QUOTA_REACHED' => 'Sorry, the board attachment quota has been reached.', 'ATTACH_SIG' => 'Attach a signature (signatures can be altered via the UCP)', From b3f46b9565117940b79c7530a1c21336cd072073 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 31 Mar 2012 21:20:18 +0300 Subject: [PATCH 11/76] [ticket/10735] Changing locator paths structure Changing locator paths to 2 dimensional array PHPBB3-10735 --- phpBB/includes/extension/finder.php | 18 +++-- .../style/extension_path_provider.php | 36 +++++----- phpBB/includes/style/path_provider.php | 16 +---- .../style/path_provider_interface.php | 7 -- phpBB/includes/style/resource_locator.php | 66 ++++++++----------- phpBB/includes/style/style.php | 4 +- 6 files changed, 62 insertions(+), 85 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 23b9f1c658..87ca40917d 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -270,11 +270,12 @@ class phpbb_extension_finder * Finds all directories matching the configured options * * @param bool $cache Whether the result should be cached + * @param bool $extension_keys Whether the result should have extension name as array key * @return array An array of paths to found directories */ - public function get_directories($cache = true) + public function get_directories($cache = true, $extension_keys = false) { - return $this->find_with_root_path($cache, true); + return $this->find_with_root_path($cache, true, $extension_keys); } /** @@ -294,16 +295,25 @@ class phpbb_extension_finder * @param bool $cache Whether the result should be cached * @param bool $is_dir Directories will be returned when true, only files * otherwise + * @param bool $extension_keys If true, result will be associative array + * with extension name as key * @return array An array of paths to found items */ - protected function find_with_root_path($cache = true, $is_dir = false) + protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false) { $items = $this->find($cache, $is_dir); $result = array(); foreach ($items as $item => $ext_name) { - $result[] = $this->phpbb_root_path . $item; + if ($extension_keys) + { + $result[$ext_name] = $this->phpbb_root_path . $item; + } + else + { + $result[] = $this->phpbb_root_path . $item; + } } return $result; diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/includes/style/extension_path_provider.php index 1fb6580ce1..4eac300424 100644 --- a/phpBB/includes/style/extension_path_provider.php +++ b/phpBB/includes/style/extension_path_provider.php @@ -82,22 +82,26 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple $directories = array(); $finder = $this->extension_manager->get_finder(); - foreach ($this->base_path_provider as $path) + foreach ($this->base_path_provider as $key => $paths) { - if ($path && !phpbb_is_absolute($path)) + if ($key == 'style') { - $directories = array_merge($directories, $finder - ->directory('/' . $this->ext_dir_prefix . $path) - ->get_directories() - ); + foreach ($paths as $path) + { + $directories['style'][] = $path; + if ($path && !phpbb_is_absolute($path)) + { + $result = $finder->directory('/' . $this->ext_dir_prefix . $path) + ->get_directories(true, true); + foreach ($result as $ext => $ext_path) + { + $directories[$ext][] = $ext_path; + } + } + } } } - foreach ($this->base_path_provider as $path) - { - $directories[] = $path; - } - return $directories; } @@ -112,14 +116,4 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple $this->base_path_provider->set_styles($styles); $this->items = null; } - - /** - * Retrieves the path to the main style passed into set_styles() - * - * @return string Main style path - */ - public function get_main_style_path() - { - return $this->base_path_provider->get_main_style_path(); - } } diff --git a/phpBB/includes/style/path_provider.php b/phpBB/includes/style/path_provider.php index c229af92ba..731d682e88 100644 --- a/phpBB/includes/style/path_provider.php +++ b/phpBB/includes/style/path_provider.php @@ -24,7 +24,6 @@ if (!defined('IN_PHPBB')) */ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface { - protected $main_style_name = ''; protected $paths = array(); /** @@ -41,25 +40,14 @@ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_p * Overwrites the current style paths * * The first element of the passed styles map, is considered the main - * style and can be retrieved through get_main_style_path(). + * style. * * @param array $styles An array of style paths. The first element is the main style. * @return null */ public function set_styles(array $styles) { - $this->paths = $styles; - $this->main_style_path = $this->paths[0]; - } - - /** - * Retrieves the path to the main style passed into set_styles() - * - * @return string Main style path - */ - public function get_main_style_path() - { - return $this->main_style_path; + $this->paths = array('style' => $styles); } /** diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/includes/style/path_provider_interface.php index 7ae94e17f4..1a6153a4d3 100644 --- a/phpBB/includes/style/path_provider_interface.php +++ b/phpBB/includes/style/path_provider_interface.php @@ -39,11 +39,4 @@ interface phpbb_style_path_provider_interface extends Traversable * @return null */ public function set_styles(array $styles); - - /** - * Retrieves the path to the main style passed into set_styles() - * - * @return string Main style path - */ - public function get_main_style_path(); } diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php index af261534c3..39505cedb5 100644 --- a/phpBB/includes/style/resource_locator.php +++ b/phpBB/includes/style/resource_locator.php @@ -38,12 +38,6 @@ class phpbb_style_resource_locator */ private $roots = array(); - /** - * Index of the main style in the roots array. - * @var int - */ - private $main_root_id = 0; - /** * Location of templates directory within style directories. * Must have trailing slash. Empty if templates are stored in root @@ -69,17 +63,6 @@ class phpbb_style_resource_locator */ private $filenames = array(); - /** - * Set main style location (must have been added through set_paths first). - * - * @param string $style_path Path to style directory - * @return null - */ - public function set_main_style($style_path) - { - $this->main_root_id = array_search($style_path, $this->roots, true); - } - /** * Sets the list of style paths * @@ -95,16 +78,18 @@ class phpbb_style_resource_locator $this->roots = array(); $this->files = array(); $this->filenames = array(); - $this->main_root_id = 0; - foreach ($style_paths as $path) + foreach ($style_paths as $key => $paths) { - // Make sure $path has no ending slash - if (substr($path, -1) === '/') + foreach ($paths as $path) { - $path = substr($path, 0, -1); + // Make sure $path has no ending slash + if (substr($path, -1) === '/') + { + $path = substr($path, 0, -1); + } + $this->roots[$key][] = $path; } - $this->roots[] = $path; } } @@ -125,9 +110,12 @@ class phpbb_style_resource_locator $this->filename[$handle] = $filename; - foreach ($this->roots as $root_index => $root) + foreach ($this->roots as $root_key => $root_paths) { - $this->files[$root_index][$handle] = $root . '/' . $this->template_path . $filename; + foreach ($root_paths as $root_index => $root) + { + $this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename; + } } } } @@ -174,12 +162,12 @@ class phpbb_style_resource_locator public function get_virtual_source_file_for_handle($handle) { // If we don't have a file assigned to this handle, die. - if (!isset($this->files[$this->main_root_id][$handle])) + if (!isset($this->files['style'][0][$handle])) { trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); } - $source_file = $this->files[$this->main_root_id][$handle]; + $source_file = $this->files['style'][0][$handle]; return $source_file; } @@ -202,26 +190,28 @@ class phpbb_style_resource_locator public function get_source_file_for_handle($handle) { // If we don't have a file assigned to this handle, die. - if (!isset($this->files[$this->main_root_id][$handle])) + if (!isset($this->files['style'][0][$handle])) { trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); } // locate a source file that exists - $source_file = $this->files[0][$handle]; + $source_file = $this->files['style'][0][$handle]; $tried = $source_file; - for ($i = 1, $n = count($this->roots); $i < $n && !file_exists($source_file); $i++) + foreach ($this->roots as $root_key => $root_paths) { - $source_file = $this->files[$i][$handle]; - $tried .= ', ' . $source_file; + foreach ($root_paths as $root_index => $root) + { + $source_file = $this->files[$root_key][$root_index][$handle]; + if (file_exists($source_file)) + { + return $source_file; + } + $tried .= ', ' . $source_file; + } } // search failed - if (!file_exists($source_file)) - { - trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); - } - - return $source_file; + trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); } } diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index 539a2642ee..dc1e71dff6 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -92,6 +92,9 @@ class phpbb_style $paths[] = $this->get_style_path($dir); } + // Add 'all' path, used as last fallback path by hooks and extensions + $paths[] = $this->get_style_path('all'); + return $this->set_custom_style($style_name, $paths); } @@ -113,7 +116,6 @@ class phpbb_style $this->provider->set_styles($paths); $this->locator->set_paths($this->provider); - $this->locator->set_main_style($this->provider->get_main_style_path()); $this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_'; From 2ce73baeab35adc3515a04c1db38af62c98d5c93 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 31 Mar 2012 22:07:04 +0300 Subject: [PATCH 12/76] [ticket/10733] Extending get_source_file_for_handle Extending resource locator's function get_source_file_for_handle to find all files. This modified function should be used by template events to locate all templates before compiling them. PHPBB3-10733 --- phpBB/includes/style/resource_locator.php | 31 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php index 39505cedb5..1b35752111 100644 --- a/phpBB/includes/style/resource_locator.php +++ b/phpBB/includes/style/resource_locator.php @@ -185,9 +185,12 @@ class phpbb_style_resource_locator * handle to a path without any filesystem or styles tree checks. * * @param string $handle Template handle (i.e. "friendly" template name) + * @param bool $find_all If true, each root path will be checked and function + * will return array of files instead of string and will not + * trigger a error if template does not exist * @return string Source file path */ - public function get_source_file_for_handle($handle) + public function get_source_file_for_handle($handle, $find_all = false) { // If we don't have a file assigned to this handle, die. if (!isset($this->files['style'][0][$handle])) @@ -198,20 +201,40 @@ class phpbb_style_resource_locator // locate a source file that exists $source_file = $this->files['style'][0][$handle]; $tried = $source_file; + $found = false; + $found_all = array(); foreach ($this->roots as $root_key => $root_paths) { foreach ($root_paths as $root_index => $root) { $source_file = $this->files[$root_key][$root_index][$handle]; + $tried .= ', ' . $source_file; if (file_exists($source_file)) { - return $source_file; + $found = true; + break; + } + } + if ($found) + { + if ($find_all) + { + $found_all[] = $source_file; + $found = false; + } + else + { + break; } - $tried .= ', ' . $source_file; } } // search failed - trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); + if (!$found && !$find_all) + { + trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); + } + + return ($find_all) ? $found_all : $source_file; } } From 5ccd6915e3e8af30856319d84a48dde074fdbaee Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 31 Mar 2012 15:52:16 -0400 Subject: [PATCH 13/76] [feature/qrpreview] Do not error or show preview if no text is entered PHPBB3-10726 --- phpBB/posting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 71ba353e89..7f57f693af 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -38,7 +38,7 @@ $load = (isset($_POST['load'])) ? true : false; $delete = (isset($_POST['delete'])) ? true : false; $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; -$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false; +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview) ? true : false; $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', ''); $error = $post_data = array(); @@ -1198,8 +1198,8 @@ if (!sizeof($error) && $preview) 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, - 'S_DISPLAY_PREVIEW' => true) - ); + 'S_DISPLAY_PREVIEW' => !empty($preview_message), + )); } } From f80512f1066ebfc09d2a4ffac412c56a3fb247de Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 09:52:55 +0300 Subject: [PATCH 14/76] [ticket/10733] Adding functions to locate resources Adding $style->locate() and $template->locate() functions PHPBB3-10733 --- phpBB/includes/style/resource_locator.php | 51 +++++++++++++++++++++++ phpBB/includes/style/style.php | 28 +++++++++++++ phpBB/includes/style/template.php | 36 ++++++++++++++++ 3 files changed, 115 insertions(+) diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php index 1b35752111..3e6dd5d6aa 100644 --- a/phpBB/includes/style/resource_locator.php +++ b/phpBB/includes/style/resource_locator.php @@ -237,4 +237,55 @@ class phpbb_style_resource_locator return ($find_all) ? $found_all : $source_file; } + + /** + * Locates source file path, accounting for styles tree and verifying that + * the path exists. + * + * Unlike previous functions, this function works without template handle + * and it can search for more than one file. If more than one file name is + * specified, it will return location of file that it finds first. + * + * @param array $files List of files to locate. + * @param bool $return_default Determines what to return if file does not + * exist. If true, function will return location where file is + * supposed to be. If false, function will return false. + * @param bool $return_full_path If true, function will return full path + * to file. If false, function will return file name. This + * parameter can be used to check which one of set of files + * is available. + * @return string or boolean Source file path if file exists or $return_default is + * true. False if file does not exist and $return_default is false + */ + public function get_first_file_location($files, $return_default = false, $return_full_path = true) + { + // set default value + $default_result = false; + + // check all available paths + foreach ($this->roots as $root_paths) + { + foreach ($root_paths as $path) + { + // check all files + foreach ($files as $filename) + { + $source_file = $path . '/' . $filename; + if (file_exists($source_file)) + { + return ($return_full_path) ? $source_file : $filename; + } + + // assign first file as result if $return_default is true + if ($return_default && $default_result === false) + { + $default_result = $source_file; + } + } + } + } + + // search failed + return $default_result; + } } diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index dc1e71dff6..5ac61c9f10 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -150,4 +150,32 @@ class phpbb_style { $this->provider->set_ext_dir_prefix($ext_dir_prefix); } + + /** + * Locates source file path, accounting for styles tree and verifying that + * the path exists. + * + * @param string or array $files List of files to locate. If there is only + * one file, $files can be a string to make code easier to read. + * @param bool $return_default Determines what to return if file does not + * exist. If true, function will return location where file is + * supposed to be. If false, function will return false. + * @param bool $return_full_path If true, function will return full path + * to file. If false, function will return file name. This + * parameter can be used to check which one of set of files + * is available. + * @return string or boolean Source file path if file exists or $return_default is + * true. False if file does not exist and $return_default is false + */ + public function locate($files, $return_default = false, $return_full_path = true) + { + // convert string to array + if (is_string($files)) + { + $files = array($files); + } + + // use resource locator to find files + return $this->locator->get_first_file_location($files, $return_default, $return_full_path); + } } diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php index 21a2e821dd..aebf1da603 100644 --- a/phpBB/includes/style/template.php +++ b/phpBB/includes/style/template.php @@ -456,4 +456,40 @@ class phpbb_style_template } include($file); } + + /** + * Locates source template path, accounting for styles tree and verifying that + * the path exists. + * + * @param string or array $files List of templates to locate. If there is only + * one template, $files can be a string to make code easier to read. + * @param bool $return_default Determines what to return if template does not + * exist. If true, function will return location where template is + * supposed to be. If false, function will return false. + * @param bool $return_full_path If true, function will return full path + * to template. If false, function will return template file name. + * This parameter can be used to check which one of set of template + * files is available. + * @return string or boolean Source template path if template exists or $return_default is + * true. False if template does not exist and $return_default is false + */ + public function locate($files, $return_default = false, $return_full_path = true) + { + // add tempalte path prefix + $templates = array(); + if (is_string($files)) + { + $templates[] = $this->template_path . $files; + } + else + { + foreach ($files as $file) + { + $templates[] = $this->template_path . $file; + } + } + + // use resource locator to find files + return $this->locator->get_first_file_location($templates, $return_default, $return_full_path); + } } From 2509853ca530b3b5e0d5b2e10080eeba5a29d937 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 09:53:23 +0300 Subject: [PATCH 15/76] [ticket/10733] Adding test for locator Adding test for $template->locate PHPBB3-10733 --- tests/template/template_locate_test.php | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tests/template/template_locate_test.php diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php new file mode 100644 index 0000000000..591a6afe0c --- /dev/null +++ b/tests/template/template_locate_test.php @@ -0,0 +1,84 @@ +setup_engine(); + + // Locate template + $result = $this->template->locate($files, $return_default, $return_full_path); + $this->assertEquals($result, $expected); + } + + protected function setup_engine(array $new_config = array()) + { + global $phpbb_root_path, $phpEx, $user; + + $defaults = $this->config_defaults(); + $config = new phpbb_config(array_merge($defaults, $new_config)); + + $this->template_path = dirname(__FILE__) . '/templates'; + $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; + $this->style_resource_locator = new phpbb_style_resource_locator(); + $this->style_provider = new phpbb_style_path_provider(); + $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); + } +} From a7d0ef90ea921b2ed876bb933bfa022863771a6e Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 10:58:24 +0300 Subject: [PATCH 16/76] [ticket/10665] INCLUDEJS template tag Implementing INLCUDEJS template tag in style classes PHPBB3-10665 --- phpBB/includes/style/template.php | 21 +++++++- phpBB/includes/style/template_compile.php | 32 +++++++++++- phpBB/includes/style/template_filter.php | 61 ++++++++++++++++++++++- 3 files changed, 109 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php index aebf1da603..4586e8dbf9 100644 --- a/phpBB/includes/style/template.php +++ b/phpBB/includes/style/template.php @@ -288,7 +288,7 @@ class phpbb_style_template return new phpbb_style_template_renderer_include($output_file, $this); } - $compile = new phpbb_style_template_compile($this->config['tpl_allow_php']); + $compile = new phpbb_style_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path); if ($compile->compile_file_to_file($source_file, $output_file) !== false) { @@ -492,4 +492,23 @@ class phpbb_style_template // use resource locator to find files return $this->locator->get_first_file_location($templates, $return_default, $return_full_path); } + + /** + * Include JS file + * + * @param string $file file name + * @param bool $locate True if file needs to be located + */ + function _js_include($file, $locate = false) + { + // Locate file + if ($locate) + { + $file = $this->locator->get_first_file_location(array($file), true, true); + } + + // Add HTML code + $code = ''; + $this->context->append_var('SCRIPTS', $code); + } } diff --git a/phpBB/includes/style/template_compile.php b/phpBB/includes/style/template_compile.php index 3ef3fffc00..bd9e18e102 100644 --- a/phpBB/includes/style/template_compile.php +++ b/phpBB/includes/style/template_compile.php @@ -25,6 +25,13 @@ stream_filter_register('phpbb_template', 'phpbb_style_template_filter'); */ class phpbb_style_template_compile { + /** + * Array of parameters to forward to template filter + * + * @var array + */ + private $filter_params; + /** * Whether tags are allowed * @@ -32,14 +39,31 @@ class phpbb_style_template_compile */ private $allow_php; + /** + * Style resource locator + * + * @var phpbb_style_resource_locator + */ + private $locator; + + /** + * @var string phpBB root path + */ + private $phpbb_root_path; + /** * Constructor. * * @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag) + * @param phpbb_style_resource_locator $locator Resource locator + * @param string $phpbb_root_path Path to phpBB root directory */ - public function __construct($allow_php) + public function __construct($allow_php, $locator, $phpbb_root_path) { + $this->filter_params = array(); $this->allow_php = $allow_php; + $this->locator = $locator; + $this->phpbb_root_path = $phpbb_root_path; } /** @@ -116,7 +140,11 @@ class phpbb_style_template_compile */ private function compile_stream_to_stream($source_stream, $dest_stream) { - stream_filter_append($source_stream, 'phpbb_template', null, array('allow_php' => $this->allow_php)); + $params = $this->filter_params; + $params['allow_php'] = $this->allow_php; + $params['locator'] = $this->locator; + $params['phpbb_root_path'] = $this->phpbb_root_path; + stream_filter_append($source_stream, 'phpbb_template', null, $params); stream_copy_to_stream($source_stream, $dest_stream); } } diff --git a/phpBB/includes/style/template_filter.php b/phpBB/includes/style/template_filter.php index 04fe85e07f..d62ad0ba1e 100644 --- a/phpBB/includes/style/template_filter.php +++ b/phpBB/includes/style/template_filter.php @@ -75,6 +75,18 @@ class phpbb_style_template_filter extends php_user_filter */ private $allow_php; + /** + * Resource locator. + * + * @var phpbb_template_locator + */ + private $locator; + + /** + * @var string phpBB root path + */ + private $phpbb_root_path; + /** * Stream filter * @@ -126,14 +138,16 @@ class phpbb_style_template_filter extends php_user_filter /** * Initializer, called on creation. * - * Get the allow_php option from params, which is passed - * to stream_filter_append. + * Get the allow_php option, root directory and locator from params, + * which are passed to stream_filter_append. */ public function onCreate() { $this->chunk = ''; $this->in_php = false; $this->allow_php = $this->params['allow_php']; + $this->locator = $this->params['locator']; + $this->phpbb_root_path = $this->params['phpbb_root_path']; return true; } @@ -281,6 +295,10 @@ class phpbb_style_template_filter extends php_user_filter return ($this->allow_php) ? 'compile_tag_include_php($matches[2]) . ' ?>' : ''; break; + case 'INCLUDEJS': + return 'compile_tag_include_js($matches[2]) . ' ?>'; + break; + case 'PHP': if ($this->allow_php) { @@ -856,6 +874,45 @@ class phpbb_style_template_filter extends php_user_filter return $tokens; } + /** + * Compile INCLUDEJS tag + * + * @param string $tag_args Expression given with INCLUDEJS in source template + * @return string compiled template code + */ + private function compile_tag_include_js($tag_args) + { + // Process dynamic includes + if ($tag_args[0] == '{') + { + $var = $this->get_varref($tag_args, $is_expr); + if (!$is_expr) + { + return " \$_template->_js_include($var, true);"; + } + return ''; + } + + // Locate file + $filename = $this->locator->get_first_file_location(array($tag_args), false, true); + + if ($filename === false) + { + // File does not exist, find it during run time + return ' $_template->_js_include(\'' . addslashes($tag_args) . '\', true); '; + } + + if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path) + { + // Absolute path, include as is + return ' $_template->_js_include(\'' . addslashes($filename) . '\', false); '; + } + + // Relative path, remove root path from it + $filename = substr($filename, strlen($this->phpbb_root_path)); + return ' global $phpbb_root_path; $_template->_js_include($phpbb_root_path . \'' . addslashes($filename) . '\', false); '; + } + /** * Generates a reference to the given variable inside the given (possibly nested) * block namespace. This is a string of the form: From 2225efc5609add8baf0dc0e7867d9f9f0fae4245 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 10:58:59 +0300 Subject: [PATCH 17/76] [ticket/10665] INCLUDEJS template changes Implementing INLCUDEJS template tag in styles PHPBB3-10665 --- phpBB/styles/prosilver/template/overall_footer.html | 3 ++- phpBB/styles/prosilver/template/simple_footer.html | 1 + phpBB/styles/subsilver2/template/overall_footer.html | 1 + phpBB/styles/subsilver2/template/simple_footer.html | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 1561bae26a..47071ba4df 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -52,7 +52,8 @@ - + +{SCRIPTS} diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 3458d02495..549c31cfb6 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -8,6 +8,7 @@ +{SCRIPTS} diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 9b0b95372e..77b11034b9 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -10,6 +10,7 @@ +{SCRIPTS} diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html index b51be3ac4c..4a65bafd1c 100644 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ b/phpBB/styles/subsilver2/template/simple_footer.html @@ -7,6 +7,7 @@ +{SCRIPTS} From 38c988fb5997f947976ca4c12e3e0d57d1e82b60 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 11:16:57 +0300 Subject: [PATCH 18/76] [ticket/10665] Changing template compiler test Adding new constructor parameters to template compiler test PHPBB3-10665 --- tests/template/template_compile_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/template/template_compile_test.php b/tests/template/template_compile_test.php index fb158cabd5..e2264fb1b7 100644 --- a/tests/template/template_compile_test.php +++ b/tests/template/template_compile_test.php @@ -16,7 +16,7 @@ class phpbb_template_template_compile_test extends phpbb_test_case protected function setUp() { - $this->template_compile = new phpbb_style_template_compile(false); + $this->template_compile = new phpbb_style_template_compile(false, null, ''); $this->template_path = dirname(__FILE__) . '/templates'; } From 4b2ede433e9336cf115fdd41e5c88738b03aa448 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 11:17:13 +0300 Subject: [PATCH 19/76] [ticket/10665] INCLUDEJS unit test Adding INLCUDEJS test PHPBB3-10665 --- tests/template/template_includejs_test.php | 48 ++++++++++++++++++++++ tests/template/templates/includejs.html | 5 +++ 2 files changed, 53 insertions(+) create mode 100644 tests/template/template_includejs_test.php create mode 100644 tests/template/templates/includejs.html diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php new file mode 100644 index 0000000000..e0229e978b --- /dev/null +++ b/tests/template/template_includejs_test.php @@ -0,0 +1,48 @@ +setup_engine(); + + // Prepare correct result + $dir = dirname(__FILE__); + $scripts = array( + '', + '', + '' + ); + + // Run test + $cache_file = $this->template->cachepath . 'includejs.html.php'; + $this->run_template('includejs.html', array('PARENT' => 'parent_only.html'), array(), array(), implode('', $scripts), $cache_file); + } + + protected function setup_engine(array $new_config = array()) + { + global $phpbb_root_path, $phpEx, $user; + + $defaults = $this->config_defaults(); + $config = new phpbb_config(array_merge($defaults, $new_config)); + + $this->template_path = dirname(__FILE__) . '/templates'; + $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; + $this->style_resource_locator = new phpbb_style_resource_locator(); + $this->style_provider = new phpbb_style_path_provider(); + $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); + $this->template->set_filenames(array('body' => 'includejs.html')); + } +} diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html new file mode 100644 index 0000000000..186fc30b43 --- /dev/null +++ b/tests/template/templates/includejs.html @@ -0,0 +1,5 @@ + + + + +{SCRIPTS} \ No newline at end of file From e7cf4bfb2ed2b549e567c7237df799b6af0977ae Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Sun, 1 Apr 2012 18:25:50 +0530 Subject: [PATCH 20/76] [ticket/10731] Fixed addquote() to work on opera browser. In opera, window.getSelection() returned incorrect values, should be using document.getSelection() instead. Fixed in prosilver and subsilver2 templates. PHPBB3-10731 --- phpBB/styles/prosilver/template/editor.js | 2 +- phpBB/styles/subsilver2/template/editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 2c41b543b5..c16b0ef703 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -219,7 +219,7 @@ function addquote(post_id, username, l_wrote) // Get text selection - not only the post content :( // IE9 must use the document.selection method but has the *.getSelection so we just force no IE - if (window.getSelection && !is_ie) + if (window.getSelection && !is_ie && !window.opera) { theSelection = window.getSelection().toString(); } diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index b47583ec75..151cf53ff1 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -221,7 +221,7 @@ function addquote(post_id, username, l_wrote) // Get text selection - not only the post content :( // IE9 must use the document.selection method but has the *.getSelection so we just force no IE - if (window.getSelection && !is_ie) + if (window.getSelection && !is_ie && !window.opera) { theSelection = window.getSelection().toString(); } From 48616c7cf25555f2a5ae681a245ac0da9e812d89 Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Sun, 1 Apr 2012 18:33:18 +0530 Subject: [PATCH 21/76] [ticket/10740] Changed styling of phpbb_alert box, to be centered. Changed the styling of the phpbb.alert() and phpbb.confirm() dialogue boxes to me more centered on a page. PHPBB3-10740 --- phpBB/styles/prosilver/theme/common.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 31015b28f9..e154db236f 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -594,9 +594,10 @@ li.pagination { border: 1px solid transparent; position: fixed; display: none; - top: 100px; - left: 35%; + top: 40%; + left: 50%; width: 30%; + margin-left: -15%; z-index: 50; padding: 25px; padding: 0 25px 20px 25px; From b1b530f92cca7eb115e096ea8901133d421771d2 Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Sun, 1 Apr 2012 18:25:50 +0530 Subject: [PATCH 22/76] [ticket/10731] Fixed addquote() to work on opera browser. In opera, window.getSelection() returned incorrect values, should be using document.getSelection() instead. Fixed in prosilver and subsilver2 templates. PHPBB3-10731 --- phpBB/styles/prosilver/template/editor.js | 4 ++-- phpBB/styles/subsilver2/template/editor.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index cfdb54f54b..c16b0ef703 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -219,7 +219,7 @@ function addquote(post_id, username, l_wrote) // Get text selection - not only the post content :( // IE9 must use the document.selection method but has the *.getSelection so we just force no IE - if (window.getSelection && !is_ie) + if (window.getSelection && !is_ie && !window.opera) { theSelection = window.getSelection().toString(); } @@ -456,4 +456,4 @@ function getCaretPosition(txtarea) } return caretPos; -} \ No newline at end of file +} diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 7cc5de9034..151cf53ff1 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -221,7 +221,7 @@ function addquote(post_id, username, l_wrote) // Get text selection - not only the post content :( // IE9 must use the document.selection method but has the *.getSelection so we just force no IE - if (window.getSelection && !is_ie) + if (window.getSelection && !is_ie && !window.opera) { theSelection = window.getSelection().toString(); } @@ -459,4 +459,4 @@ function getCaretPosition(txtarea) } return caretPos; -} \ No newline at end of file +} From f5bac7686b1678dbd33eddd368d845237bb18943 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 19:14:53 +0300 Subject: [PATCH 23/76] [ticket/10733] Removing static from data providers Removing static from data provider functions PHPBB3-10733 --- tests/dbal/select_test.php | 14 +++++++------- tests/dbal/write_test.php | 4 ++-- tests/group_positions/group_positions_test.php | 14 +++++++------- tests/request/request_var_test.php | 4 ++-- tests/security/extract_current_page_test.php | 2 +- tests/security/redirect_test.php | 2 +- tests/template/template_inheritance_test.php | 2 +- tests/template/template_locate_test.php | 2 +- tests/template/template_test.php | 4 ++-- tests/text_processing/make_clickable_test.php | 2 +- tests/utf/utf8_clean_string_test.php | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 21b12777dc..cc213f09bc 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -17,7 +17,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml'); } - public static function return_on_error_select_data() + public function return_on_error_select_data() { return array( array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), @@ -44,7 +44,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public static function fetchrow_data() + public function fetchrow_data() { return array( array('', array(array('username_clean' => 'barfoo'), @@ -95,7 +95,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public static function fetchfield_data() + public function fetchfield_data() { return array( array('', array('barfoo', 'foobar', 'bertie')), @@ -125,7 +125,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - public static function query_limit_data() + public function query_limit_data() { return array( array(0, 0, array(array('username_clean' => 'barfoo'), @@ -166,7 +166,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - public static function like_expression_data() + public function like_expression_data() { // * = any_char; # = one_char return array( @@ -203,7 +203,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public static function in_set_data() + public function in_set_data() { return array( array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))), @@ -277,7 +277,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public static function build_array_data() + public function build_array_data() { return array( array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))), diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index 596c50a220..987161a831 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -16,7 +16,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml'); } - public static function build_array_insert_data() + public function build_array_insert_data() { return array( array(array( @@ -104,7 +104,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public static function update_data() + public function update_data() { return array( array( diff --git a/tests/group_positions/group_positions_test.php b/tests/group_positions/group_positions_test.php index fd9f57e78f..c17e25511b 100644 --- a/tests/group_positions/group_positions_test.php +++ b/tests/group_positions/group_positions_test.php @@ -15,7 +15,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/group_positions.xml'); } - public static function get_group_value_data() + public function get_group_value_data() { return array( array('teampage', 1, 0), @@ -38,7 +38,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $test_class->get_group_value($group_id)); } - public static function get_group_count_data() + public function get_group_count_data() { return array( array('teampage', 2), @@ -59,7 +59,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $test_class->get_group_count()); } - public static function add_group_data() + public function add_group_data() { return array( array('teampage', 1, array( @@ -93,7 +93,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public static function delete_group_data() + public function delete_group_data() { return array( array('teampage', 1, false, array( @@ -147,7 +147,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public static function move_up_data() + public function move_up_data() { return array( array('teampage', 1, array( @@ -186,7 +186,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public static function move_down_data() + public function move_down_data() { return array( array('teampage', 1, array( @@ -225,7 +225,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public static function move_data() + public function move_data() { return array( array('teampage', 1, 1, array( diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index 1fa0afae13..0e85d4694b 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -112,7 +112,7 @@ class phpbb_request_var_test extends phpbb_test_case $this->assertEquals($expected, $result, 'Testing deep access to multidimensional input arrays: ' . $path); } - public static function deep_access() + public function deep_access() { return array( // array(path, default, expected result) @@ -123,7 +123,7 @@ class phpbb_request_var_test extends phpbb_test_case ); } - public static function request_variables() + public function request_variables() { return array( // strings diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index b4a475ffb3..d77cbbcaf3 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_security_extract_current_page_test extends phpbb_security_test_base { - public static function security_variables() + public function security_variables() { return array( array('http://localhost/phpBB/index.php', 'mark=forums&x=">', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'), diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index da318209e2..1325466137 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_security_redirect_test extends phpbb_security_test_base { - public static function provider() + public function provider() { // array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false)) return array( diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index 7348da9a4a..a76658701a 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -14,7 +14,7 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t /** * @todo put test data into templates/xyz.test */ - public static function template_data() + public function template_data() { return array( // First element of the array is test name - keep them distinct diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php index 591a6afe0c..8edbd6a008 100644 --- a/tests/template/template_locate_test.php +++ b/tests/template/template_locate_test.php @@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/template_test_case.php'; class phpbb_template_template_locate_test extends phpbb_template_template_test_case { - public static function template_data() + public function template_data() { return array( // First element of the array is test name - keep them distinct diff --git a/tests/template/template_test.php b/tests/template/template_test.php index edf621e16c..739bbe9387 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -15,7 +15,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @todo put test data into templates/xyz.test */ - public static function template_data() + public function template_data() { return array( /* @@ -394,7 +394,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->run_template('php.html', array(), array(), array(), 'test', $cache_file); } - public static function alter_block_array_data() + public function alter_block_array_data() { return array( array( diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index 8697907311..d94fac2ae4 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; class phpbb_text_processing_make_clickable_test extends phpbb_test_case { - public static function make_clickable_data() + public function make_clickable_data() { // value => whether it should work $prefix_texts = array( diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index 70bd549d5b..ae11e00fbd 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_utf_utf8_clean_string_test extends phpbb_test_case { - public static function cleanable_strings() + public function cleanable_strings() { return array( array('MiXed CaSe', 'mixed case', 'Checking case folding'), From eaba2ed9ca6025358de0432bb569cfb2e3ca6985 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 19:20:42 +0300 Subject: [PATCH 24/76] [ticket/10733] Fixing test Changing expected and result in locator test PHPBB3-10733 --- tests/template/template_locate_test.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php index 8edbd6a008..89a4ae6fb1 100644 --- a/tests/template/template_locate_test.php +++ b/tests/template/template_locate_test.php @@ -17,38 +17,38 @@ class phpbb_template_template_locate_test extends phpbb_template_template_test_c // First element of the array is test name - keep them distinct array( 'simple inheritance - only parent template exists', + dirname(__FILE__) . '/parent_templates/parent_only.html', 'parent_only.html', false, true, - dirname(__FILE__) . '/parent_templates/parent_only.html', ), array( 'simple inheritance - only child template exists', + dirname(__FILE__) . '/templates/child_only.html', 'child_only.html', false, true, - dirname(__FILE__) . '/templates/child_only.html', ), array( 'simple inheritance - both parent and child templates exist', + dirname(__FILE__) . '/templates/parent_and_child.html', 'parent_and_child.html', false, true, - dirname(__FILE__) . '/templates/parent_and_child.html', ), array( 'find first template - only child template exists in main style', + 'child_only.html', array('parent_only.html', 'child_only.html'), false, false, - 'child_only.html', ), array( 'find first template - both templates exist in main style', + 'parent_and_child.html', array('parent_and_child.html', 'child_only.html'), false, false, - 'parent_and_child.html', ), ); } @@ -56,14 +56,14 @@ class phpbb_template_template_locate_test extends phpbb_template_template_test_c /** * @dataProvider template_data */ - public function test_template($name, $files, $return_default, $return_full_path, $expected) + public function test_template($name, $expected, $files, $return_default, $return_full_path) { // Reset the engine state $this->setup_engine(); // Locate template $result = $this->template->locate($files, $return_default, $return_full_path); - $this->assertEquals($result, $expected); + $this->assertSame($expected, $result); } protected function setup_engine(array $new_config = array()) From f36a6f0ae35107ac75be3cffff2f0f341baee7a8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 1 Apr 2012 18:44:05 +0200 Subject: [PATCH 25/76] [ticket/10740] Revert margin-left changes of previous commit PHPBB3-10740 --- phpBB/styles/prosilver/theme/common.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e154db236f..77e2b8c0c6 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -595,9 +595,8 @@ li.pagination { position: fixed; display: none; top: 40%; - left: 50%; + left: 35%; width: 30%; - margin-left: -15%; z-index: 50; padding: 25px; padding: 0 25px 20px 25px; From fb0df8d2e398a634457b317a721734e53596f002 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 20:19:07 +0300 Subject: [PATCH 26/76] [ticket/10665] Moving filter parameters to one array Moving filter parameters to one array in template compiler class PHPBB3-10665 --- phpBB/includes/style/template_compile.php | 34 ++++------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/phpBB/includes/style/template_compile.php b/phpBB/includes/style/template_compile.php index bd9e18e102..fa0928f424 100644 --- a/phpBB/includes/style/template_compile.php +++ b/phpBB/includes/style/template_compile.php @@ -32,25 +32,6 @@ class phpbb_style_template_compile */ private $filter_params; - /** - * Whether tags are allowed - * - * @var bool - */ - private $allow_php; - - /** - * Style resource locator - * - * @var phpbb_style_resource_locator - */ - private $locator; - - /** - * @var string phpBB root path - */ - private $phpbb_root_path; - /** * Constructor. * @@ -60,10 +41,11 @@ class phpbb_style_template_compile */ public function __construct($allow_php, $locator, $phpbb_root_path) { - $this->filter_params = array(); - $this->allow_php = $allow_php; - $this->locator = $locator; - $this->phpbb_root_path = $phpbb_root_path; + $this->filter_params = array( + 'allow_php' => $allow_php, + 'locator' => $locator, + 'phpbb_root_path' => $phpbb_root_path + ); } /** @@ -140,11 +122,7 @@ class phpbb_style_template_compile */ private function compile_stream_to_stream($source_stream, $dest_stream) { - $params = $this->filter_params; - $params['allow_php'] = $this->allow_php; - $params['locator'] = $this->locator; - $params['phpbb_root_path'] = $this->phpbb_root_path; - stream_filter_append($source_stream, 'phpbb_template', null, $params); + stream_filter_append($source_stream, 'phpbb_template', null, $this->filter_params); stream_copy_to_stream($source_stream, $dest_stream); } } From 1ffc7c1fab85b1eb732b31bfd8a0f48c7351e68a Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 20:29:03 +0300 Subject: [PATCH 27/76] [ticket/10665] Changing template->_js_include to public Changing template->_js_include to public function PHPBB3-10665 --- phpBB/includes/style/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php index 4586e8dbf9..3f15355f7a 100644 --- a/phpBB/includes/style/template.php +++ b/phpBB/includes/style/template.php @@ -499,7 +499,7 @@ class phpbb_style_template * @param string $file file name * @param bool $locate True if file needs to be located */ - function _js_include($file, $locate = false) + public function _js_include($file, $locate = false) { // Locate file if ($locate) From 2d9d8d367389c6bc0cef7852849e3d43ac682789 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 20:37:45 +0300 Subject: [PATCH 28/76] [ticket/10665] New test class for templates with tree New parent template test class for tests that use styles tree PHPBB3-10665 --- tests/template/template_includejs_test.php | 21 ++------------ tests/template/template_inheritance_test.php | 20 ++----------- tests/template/template_locate_test.php | 20 ++----------- .../template/template_test_case_with_tree.php | 29 +++++++++++++++++++ 4 files changed, 35 insertions(+), 55 deletions(-) create mode 100644 tests/template/template_test_case_with_tree.php diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index e0229e978b..fa23837553 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -7,9 +7,9 @@ * */ -require_once dirname(__FILE__) . '/template_test_case.php'; +require_once dirname(__FILE__) . '/template_test_case_with_tree.php'; -class phpbb_template_template_includejs_test extends phpbb_template_template_test_case +class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree { public function test_includejs_compilation() { @@ -28,21 +28,4 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes $cache_file = $this->template->cachepath . 'includejs.html.php'; $this->run_template('includejs.html', array('PARENT' => 'parent_only.html'), array(), array(), implode('', $scripts), $cache_file); } - - protected function setup_engine(array $new_config = array()) - { - global $phpbb_root_path, $phpEx, $user; - - $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); - - $this->template_path = dirname(__FILE__) . '/templates'; - $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); - $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); - $this->template->set_filenames(array('body' => 'includejs.html')); - } } diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index a76658701a..febfed9ef0 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -7,9 +7,9 @@ * */ -require_once dirname(__FILE__) . '/template_test_case.php'; +require_once dirname(__FILE__) . '/template_test_case_with_tree.php'; -class phpbb_template_template_inheritance_test extends phpbb_template_template_test_case +class phpbb_template_template_inheritance_test extends phpbb_template_template_test_case_with_tree { /** * @todo put test data into templates/xyz.test @@ -61,20 +61,4 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); } - - protected function setup_engine(array $new_config = array()) - { - global $phpbb_root_path, $phpEx, $user; - - $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); - - $this->template_path = dirname(__FILE__) . '/templates'; - $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); - $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); - } } diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php index 89a4ae6fb1..d6e2e82a47 100644 --- a/tests/template/template_locate_test.php +++ b/tests/template/template_locate_test.php @@ -7,9 +7,9 @@ * */ -require_once dirname(__FILE__) . '/template_test_case.php'; +require_once dirname(__FILE__) . '/template_test_case_with_tree.php'; -class phpbb_template_template_locate_test extends phpbb_template_template_test_case +class phpbb_template_template_locate_test extends phpbb_template_template_test_case_with_tree { public function template_data() { @@ -65,20 +65,4 @@ class phpbb_template_template_locate_test extends phpbb_template_template_test_c $result = $this->template->locate($files, $return_default, $return_full_path); $this->assertSame($expected, $result); } - - protected function setup_engine(array $new_config = array()) - { - global $phpbb_root_path, $phpEx, $user; - - $defaults = $this->config_defaults(); - $config = new phpbb_config(array_merge($defaults, $new_config)); - - $this->template_path = dirname(__FILE__) . '/templates'; - $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); - $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); - } } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php new file mode 100644 index 0000000000..e76d9436cf --- /dev/null +++ b/tests/template/template_test_case_with_tree.php @@ -0,0 +1,29 @@ +config_defaults(); + $config = new phpbb_config(array_merge($defaults, $new_config)); + + $this->template_path = dirname(__FILE__) . '/templates'; + $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; + $this->style_resource_locator = new phpbb_style_resource_locator(); + $this->style_provider = new phpbb_style_path_provider(); + $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); + } +} From c89ea703bda1006b382f8cc0da292f6e2a3701f5 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 20:46:10 +0300 Subject: [PATCH 29/76] [ticket/10665] Solution for T_SUPER_TEMPLATE_PATH Temporary solution for T_SUPER_TEMPLATE_PATH pointing to wrong directory, variable will be completely removed later because it will be obsolete PHPBB3-10665 --- 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 74db8cb8fd..a44ebb04e8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4770,7 +4770,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_ASSETS_PATH' => "{$web_path}assets", 'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme', 'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template', - 'T_SUPER_TEMPLATE_PATH' => ($user->theme['style_parent_id']) ? "{$web_path}styles/" . rawurlencode($user->theme['style_parent_tree']) . '/template' : "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template', + 'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template', 'T_IMAGES_PATH' => "{$web_path}images/", 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", From 37480e5594145bbead07c8f70644d52983f92913 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 1 Apr 2012 20:50:59 +0300 Subject: [PATCH 30/76] [ticket/10665] Adding includejs to acp templates Adding includejs to acp overall_footer.html PHPBB3-10665 --- phpBB/adm/style/overall_footer.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 0337080f3d..a486a69514 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -39,7 +39,8 @@ - + +{SCRIPTS} From 06d26ef46e914c823889dab37627e7fa39d883ce Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Mon, 2 Apr 2012 00:35:39 +0530 Subject: [PATCH 31/76] [ticket/10438] Alligning the Smileys on the same line as the text. Changed the styling of smilies to appear at the same level as text, by adding vertical-align: text-bottom css property to all smilies. Edited functions_content.php to add class="smilies" to all parsed smilies. PHPBB3-10438 --- phpBB/includes/functions_content.php | 2 +- phpBB/styles/prosilver/theme/common.css | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index f2faf20f43..6b2ee98d7a 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -739,7 +739,7 @@ function smiley_text($text, $force_option = false) else { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; - return preg_replace('#', $text); + return preg_replace('#

{L_TOPIC}: {TOPIC_TITLE}