diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/composer.json | 2 | ||||
-rw-r--r-- | phpBB/composer.lock | 109 | ||||
-rw-r--r-- | phpBB/config/default/container/services.yml | 6 | ||||
-rw-r--r-- | phpBB/docs/events.md | 32 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 9 | ||||
-rw-r--r-- | phpBB/includes/functions_acp.php | 3 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 3 | ||||
-rw-r--r-- | phpBB/memberlist.php | 14 | ||||
-rw-r--r-- | phpBB/phpbb/group/helper.php | 260 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_forum.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_move.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_poll_body.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/search_results.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/viewforum_body.html | 4 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 32 |
15 files changed, 411 insertions, 73 deletions
diff --git a/phpBB/composer.json b/phpBB/composer.json index d192fd57c8..33655b865f 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -31,7 +31,7 @@ "guzzlehttp/guzzle": "~5.3", "lusitanian/oauth": "^0.8.1", "marc1706/fast-image-size": "^1.1", - "paragonie/random_compat": "^1.4", + "paragonie/random_compat": "^2.0", "patchwork/utf8": "^1.1", "s9e/text-formatter": "^1.3", "symfony/config": "^2.8", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 7d4f355e64..d2a95fd8a3 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6daa2f5f7a161377dee1835bd4d5b463", + "content-hash": "cd42964227d699a6923798e33eab3dd5", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -342,7 +342,7 @@ "oauth", "security" ], - "time": "2018-02-14T22:37:14+00:00" + "time": "2016-07-12T22:15:00+00:00" }, { "name": "marc1706/fast-image-size", @@ -461,16 +461,16 @@ }, { "name": "paragonie/random_compat", - "version": "v1.4.3", + "version": "v2.0.18", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd" + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/9b3899e3c3ddde89016f576edb8c489708ad64cd", - "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", "shasum": "" }, "require": { @@ -502,10 +502,11 @@ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", + "polyfill", "pseudorandom", "random" ], - "time": "2018-04-04T21:48:54+00:00" + "time": "2019-01-03T20:59:08+00:00" }, { "name": "patchwork/utf8", @@ -727,7 +728,7 @@ }, { "name": "symfony/config", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -784,7 +785,7 @@ }, { "name": "symfony/console", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -845,7 +846,7 @@ }, { "name": "symfony/debug", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -902,16 +903,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f" + "reference": "c306198fee8f872a8f5f031e6e4f6f83086992d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a2f40df187f0053bc361bcea3b27ff2b85744d9f", - "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c306198fee8f872a8f5f031e6e4f6f83086992d8", + "reference": "c306198fee8f872a8f5f031e6e4f6f83086992d8", "shasum": "" }, "require": { @@ -961,11 +962,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-11-11T11:18:13+00:00" + "time": "2019-04-16T11:33:46+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1025,7 +1026,7 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1075,7 +1076,7 @@ }, { "name": "symfony/finder", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1124,16 +1125,16 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92" + "reference": "746f8d3638bf46ee8b202e62f2b214c3d61fb06a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0ab719bedc9fc6748a95b2dcb04137292a27b92", - "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/746f8d3638bf46ee8b202e62f2b214c3d61fb06a", + "reference": "746f8d3638bf46ee8b202e62f2b214c3d61fb06a", "shasum": "" }, "require": { @@ -1175,20 +1176,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-11-25T11:27:05+00:00" + "time": "2019-04-16T10:00:53+00:00" }, { "name": "symfony/http-kernel", - "version": "v2.8.49", + "version": "v2.8.51", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa" + "reference": "a01e2b4b267fda24dba9b06cd1c575ca87a51ad2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3df0207d4c973eb9c91b38a608aef4654dc256fa", - "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a01e2b4b267fda24dba9b06cd1c575ca87a51ad2", + "reference": "a01e2b4b267fda24dba9b06cd1c575ca87a51ad2", "shasum": "" }, "require": { @@ -1259,7 +1260,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-12-06T14:45:07+00:00" + "time": "2019-04-17T16:42:28+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1494,16 +1495,16 @@ }, { "name": "symfony/proxy-manager-bridge", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8" + "reference": "40802595fea26ada845ed58124d8000a13dd4c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", - "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/40802595fea26ada845ed58124d8000a13dd4c6f", + "reference": "40802595fea26ada845ed58124d8000a13dd4c6f", "shasum": "" }, "require": { @@ -1544,11 +1545,11 @@ ], "description": "Symfony ProxyManager Bridge", "homepage": "https://symfony.com", - "time": "2018-11-11T11:18:13+00:00" + "time": "2019-04-16T11:33:46+00:00" }, { "name": "symfony/routing", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -1622,7 +1623,7 @@ }, { "name": "symfony/twig-bridge", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", @@ -1707,7 +1708,7 @@ }, { "name": "symfony/yaml", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -1757,16 +1758,16 @@ }, { "name": "twig/twig", - "version": "v1.39.1", + "version": "v1.42.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec" + "reference": "21707d6ebd05476854805e4f91b836531941bcd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/21707d6ebd05476854805e4f91b836531941bcd4", + "reference": "21707d6ebd05476854805e4f91b836531941bcd4", "shasum": "" }, "require": { @@ -1776,12 +1777,12 @@ "require-dev": { "psr/container": "^1.0", "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.39-dev" + "dev-master": "1.42-dev" } }, "autoload": { @@ -1819,7 +1820,7 @@ "keywords": [ "templating" ], - "time": "2019-04-16T17:12:57+00:00" + "time": "2019-06-18T15:35:16+00:00" }, { "name": "zendframework/zend-code", @@ -2362,16 +2363,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", "shasum": "" }, "require": { @@ -2392,8 +2393,8 @@ } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -2421,7 +2422,7 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2019-06-13T12:50:23+00:00" }, { "name": "phpunit/dbunit", @@ -3416,7 +3417,7 @@ }, { "name": "symfony/browser-kit", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", @@ -3473,7 +3474,7 @@ }, { "name": "symfony/css-selector", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -3526,7 +3527,7 @@ }, { "name": "symfony/dom-crawler", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3583,7 +3584,7 @@ }, { "name": "symfony/process", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/process.git", diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index 9bb1d673f4..3ead1e6181 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -122,7 +122,13 @@ services: group_helper: class: phpbb\group\helper arguments: + - '@auth' + - '@cache' + - '@config' - '@language' + - '@dispatcher' + - '@path_helper' + - '@user' log: class: phpbb\log\log diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 39888bf671..afe4bd7781 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -988,6 +988,20 @@ mcp_move_before * Since: 3.1.10-RC1 * Purpose: Add content before move topic/post form +mcp_move_destination_forum_after +=== +* Locations: + + styles/prosilver/template/mcp_move.html +* Since: 3.2.8-RC1 +* Purpose: Add content after the destination select element in the move topic/post form + +mcp_move_destination_forum_before +=== +* Locations: + + styles/prosilver/template/mcp_move.html +* Since: 3.2.8-RC1 +* Purpose: Add content before the destination select element in the move topic/post form + mcp_post_additional_options === * Locations: @@ -2281,6 +2295,24 @@ topiclist_row_prepend * Changed: 3.1.6-RC1 Added event to mcp_forum.html * Purpose: Add content into topic rows (inside the elements containing topic titles) +topiclist_row_topic_by_author_after +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html +* Since: 3.2.8-RC1 +* Purpose: Add content into topic rows (after the "by topic author" row) + +topiclist_row_topic_by_author_before +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html +* Since: 3.2.8-RC1 +* Purpose: Add content into topic rows (before the "by topic author" row) + topiclist_row_topic_title_after === * Locations: diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5cc6826cb9..605afda0bd 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2364,7 +2364,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa } // Check form key - if ($password && !check_form_key($form_name)) + if ($password && !defined('IN_CHECK_BAN') && !check_form_key($form_name)) { $result = array( 'status' => false, @@ -4131,9 +4131,9 @@ function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = * * @return string Avatar html */ -function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) +function phpbb_get_group_avatar($group_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) { - $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); + $row = \phpbb\avatar\manager::clean_row($group_row, 'group'); return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); } @@ -4591,12 +4591,13 @@ function page_header($page_title = '', $display_online_list = false, $item_id = if ($send_headers) { - // An array of http headers that phpbb will set. The following event may override these. + // An array of http headers that phpBB will set. The following event may override these. $http_headers += array( // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + 'Referrer-Policy' => 'strict-origin-when-cross-origin', ); if (!empty($user->data['is_bot'])) { diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index dd326c3db6..a2014a7d5b 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -112,12 +112,13 @@ function adm_page_header($page_title) 'CONTAINER_EXCEPTION' => $phpbb_container->hasParameter('container_exception') ? $phpbb_container->getParameter('container_exception') : false, )); - // An array of http headers that phpbb will set. The following event may override these. + // An array of http headers that phpBB will set. The following event may override these. $http_headers = array( // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + 'Referrer-Policy' => 'strict-origin-when-cross-origin', ); /** diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index a15a03f966..2542be5e02 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1482,6 +1482,8 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al * Get username details for placing into templates. * This function caches all modes on first call, except for no_profile and anonymous user - determined by $user_id. * +* @html Username spans and links +* * @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link) * @param int $user_id The users id * @param string $username The users name @@ -1501,6 +1503,7 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', { global $phpbb_root_path, $phpEx; + /** @html Username spans and links for usage in the template */ $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); $_profile_cache['tpl_noprofile'] = '<span class="username">{USERNAME}</span>'; $_profile_cache['tpl_noprofile_colour'] = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>'; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b26d7c8f94..8f4d54b2c7 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1223,18 +1223,18 @@ switch ($mode) $avatar_img = phpbb_get_group_avatar($group_row); // ... same for group rank - $user_rank_data = array( + $group_rank_data = array( 'title' => null, 'img' => null, 'img_src' => null, ); if ($group_row['group_rank']) { - $user_rank_data = phpbb_get_user_rank($group_row, false); + $group_rank_data = $group_helper->get_rank($group_row); - if ($user_rank_data['img']) + if ($group_rank_data['img']) { - $user_rank_data['img'] .= '<br />'; + $group_rank_data['img'] .= '<br />'; } } // include modules for manage groups link display or not @@ -1261,11 +1261,11 @@ switch ($mode) 'GROUP_NAME' => $group_helper->get_name($group_row['group_name']), 'GROUP_COLOR' => $group_row['group_colour'], 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], - 'GROUP_RANK' => $user_rank_data['title'], + 'GROUP_RANK' => $group_rank_data['title'], 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $user_rank_data['img'], - 'RANK_IMG_SRC' => $user_rank_data['img_src'], + 'RANK_IMG' => $group_rank_data['img'], + 'RANK_IMG_SRC' => $group_rank_data['img_src'], 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '', 'U_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&mode=manage') : false,) diff --git a/phpBB/phpbb/group/helper.php b/phpBB/phpbb/group/helper.php index 5befddfc53..aa3876b325 100644 --- a/phpBB/phpbb/group/helper.php +++ b/phpBB/phpbb/group/helper.php @@ -13,19 +13,74 @@ namespace phpbb\group; +use phpbb\auth\auth; +use phpbb\cache\service as cache; +use phpbb\config\config; +use phpbb\language\language; +use phpbb\event\dispatcher_interface; +use phpbb\path_helper; +use phpbb\user; + class helper { - /** @var \phpbb\language\language */ + /** @var auth */ + protected $auth; + + /** @var cache */ + protected $cache; + + /** @var config */ + protected $config; + + /** @var language */ protected $language; + /** @var dispatcher_interface */ + protected $dispatcher; + + /** @var path_helper */ + protected $path_helper; + + /** @var user */ + protected $user; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var array Return templates for a group name string */ + protected $name_strings; + /** * Constructor * - * @param \phpbb\language\language $language Language object + * @param auth $auth Authentication object + * @param cache $cache Cache service object + * @param config $config Configuration object + * @param language $language Language object + * @param dispatcher_interface $dispatcher Event dispatcher object + * @param path_helper $path_helper Path helper object + * @param user $user User object */ - public function __construct(\phpbb\language\language $language) + public function __construct(auth $auth, cache $cache, config $config, language $language, dispatcher_interface $dispatcher, path_helper $path_helper, user $user) { + $this->auth = $auth; + $this->cache = $cache; + $this->config = $config; $this->language = $language; + $this->dispatcher = $dispatcher; + $this->path_helper = $path_helper; + $this->user = $user; + + $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); + + /** @html Group name spans and links for usage in the template */ + $this->name_strings = array( + 'base_url' => "{$path_helper->get_phpbb_root_path()}memberlist.{$path_helper->get_php_ext()}?mode=group&g={GROUP_ID}", + 'tpl_noprofile' => '<span class="username">{GROUP_NAME}</span>', + 'tpl_noprofile_colour' => '<span class="username-coloured" style="color: {GROUP_COLOUR};">{GROUP_NAME}</span>', + 'tpl_profile' => '<a class="username" href="{PROFILE_URL}">{GROUP_NAME}</a>', + 'tpl_profile_colour' => '<a class="username-coloured" href="{PROFILE_URL}" style="color: {GROUP_COLOUR};">{GROUP_NAME}</a>', + ); } /** @@ -37,4 +92,203 @@ class helper { return $this->language->is_set('G_' . utf8_strtoupper($group_name)) ? $this->language->lang('G_' . utf8_strtoupper($group_name)) : $group_name; } + + /** + * Get group name details for placing into templates. + * + * @html Group name spans and links + * + * @param string $mode Profile (for getting an url to the profile), + * group_name (for obtaining the group name), + * colour (for obtaining the group colour), + * full (for obtaining a coloured group name link to the group's profile), + * no_profile (the same as full but forcing no profile link) + * @param int $group_id The group id + * @param string $group_name The group name + * @param string $group_colour The group colour + * @param mixed $custom_profile_url optional parameter to specify a profile url. The group id gets appended to this url as &g={group_id} + * + * @return string A string consisting of what is wanted based on $mode. + */ + public function get_name_string($mode, $group_id, $group_name, $group_colour = '', $custom_profile_url = false) + { + $s_is_bots = ($group_name === 'BOTS'); + + // This switch makes sure we only run code required for the mode + switch ($mode) + { + case 'full': + case 'no_profile': + case 'colour': + + // Build correct group colour + $group_colour = $group_colour ? '#' . $group_colour : ''; + + // Return colour + if ($mode === 'colour') + { + $group_name_string = $group_colour; + break; + } + + // no break; + + case 'group_name': + + // Build correct group name + $group_name = $this->get_name($group_name); + + // Return group name + if ($mode === 'group_name') + { + $group_name_string = $group_name; + break; + } + + // no break; + + case 'profile': + + // Build correct profile url - only show if not anonymous and permission to view profile if registered user + // For anonymous the link leads to a login page. + if ($group_id && !$s_is_bots && ($this->user->data['user_id'] == ANONYMOUS || $this->auth->acl_get('u_viewprofile'))) + { + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&g=' . (int) $group_id : str_replace(array('={GROUP_ID}', '=%7BGROUP_ID%7D'), '=' . (int) $group_id, append_sid($this->name_strings['base_url'])); + } + else + { + $profile_url = ''; + } + + // Return profile + if ($mode === 'profile') + { + $group_name_string = $profile_url; + break; + } + + // no break; + } + + if (!isset($group_name_string)) + { + if (($mode === 'full' && empty($profile_url)) || $mode === 'no_profile' || $s_is_bots) + { + $group_name_string = str_replace(array('{GROUP_COLOUR}', '{GROUP_NAME}'), array($group_colour, $group_name), (!$group_colour) ? $this->name_strings['tpl_noprofile'] : $this->name_strings['tpl_noprofile_colour']); + } + else + { + $group_name_string = str_replace(array('{PROFILE_URL}', '{GROUP_COLOUR}', '{GROUP_NAME}'), array($profile_url, $group_colour, $group_name), (!$group_colour) ? $this->name_strings['tpl_profile'] : $this->name_strings['tpl_profile_colour']); + } + } + + $name_strings = $this->name_strings; + + /** + * Use this event to change the output of the group name + * + * @event core.modify_group_name_string + * @var string mode profile|group_name|colour|full|no_profile + * @var int group_id The group identifier + * @var string group_name The group name + * @var string group_colour The group colour + * @var string custom_profile_url Optional parameter to specify a profile url. + * @var string group_name_string The string that has been generated + * @var array name_strings Array of original return templates + * @since 3.2.8-RC1 + */ + $vars = array( + 'mode', + 'group_id', + 'group_name', + 'group_colour', + 'custom_profile_url', + 'group_name_string', + 'name_strings', + ); + extract($this->dispatcher->trigger_event('core.modify_group_name_string', compact($vars))); + + return $group_name_string; + } + + /** + * Get group rank title and image + * + * @html Group rank image element + * + * @param array $group_data The current stored group data + * + * @return array An associative array containing the rank title (title), + * the rank image as full img tag (img) and the rank image source (img_src) + */ + public function get_rank($group_data) + { + $group_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a group's rank before displaying + * + * @event core.get_group_rank_before + * @var array group_data Array with group's data + * @since 3.2.8-RC1 + */ + + $vars = array('group_data'); + extract($this->dispatcher->trigger_event('core.get_group_rank_before', compact($vars))); + + if (!empty($group_data['group_rank'])) + { + // Only obtain ranks if group rank is set + $ranks = $this->cache->obtain_ranks(); + + if (isset($ranks['special'][$group_data['group_rank']])) + { + $rank = $ranks['special'][$group_data['group_rank']]; + + $group_rank_data['title'] = $rank['rank_title']; + + $group_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $this->path_helper->update_web_root_path($this->phpbb_root_path . $this->config['ranks_path'] . '/' . $rank['rank_image']) : ''; + + /** @html Group rank image element for usage in the template */ + $group_rank_data['img'] = (!empty($rank['rank_image'])) ? '<img src="' . $group_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; + } + } + + /** + * Modify a group's rank before displaying + * + * @event core.get_group_rank_after + * @var array group_data Array with group's data + * @var array group_rank_data Group rank data + * @since 3.2.8-RC1 + */ + + $vars = array( + 'group_data', + 'group_rank_data', + ); + extract($this->dispatcher->trigger_event('core.get_group_rank_after', compact($vars))); + + return $group_rank_data; + } + + /** + * Get group avatar. + * Wrapper function for phpbb_get_group_avatar() + * + * @param array $group_row Row from the groups table + * @param string $alt Optional language string for alt tag within image, can be a language key or text + * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP + * @param bool $lazy If true, will be lazy loaded (requires JS) + * + * @return string Avatar html + */ + function get_avatar($group_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) + { + return phpbb_get_group_avatar($group_row, $alt, $ignore_config, $lazy); + } } diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index f6c518e1df..82df5d5dbe 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -86,7 +86,9 @@ <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + {% EVENT topiclist_row_topic_by_author_before %} {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {% EVENT topiclist_row_topic_by_author_after %} </div> <!-- EVENT topiclist_row_append --> </div> diff --git a/phpBB/styles/prosilver/template/mcp_move.html b/phpBB/styles/prosilver/template/mcp_move.html index 45a9ae83bc..63197ef274 100644 --- a/phpBB/styles/prosilver/template/mcp_move.html +++ b/phpBB/styles/prosilver/template/mcp_move.html @@ -43,12 +43,14 @@ <!-- IF ADDITIONAL_MSG --><p>{ADDITIONAL_MSG}</p><!-- ENDIF --> <fieldset> + {% EVENT mcp_move_destination_forum_before %} <dl class="fields2"> <dt><label>{L_SELECT_DESTINATION_FORUM}{L_COLON}</label></dt> <dd><select name="to_forum_id">{S_FORUM_SELECT}</select></dd> <!-- IF S_CAN_LEAVE_SHADOW --><dd><label for="move_leave_shadow"><input type="checkbox" name="move_leave_shadow" id="move_leave_shadow" />{L_LEAVE_SHADOW}</label></dd><!-- ENDIF --> <!-- IF S_CAN_LOCK_TOPIC --><dd><label for="move_lock_topics"><input type="checkbox" name="move_lock_topics" id="move_lock_topics" />{L_LOCK_TOPIC}</label></dd><!-- ENDIF --> </dl> + {% EVENT mcp_move_destination_forum_after %} <dl class="fields2"> <dt> </dt> <dd><strong>{MESSAGE_TEXT}</strong></dd> diff --git a/phpBB/styles/prosilver/template/posting_poll_body.html b/phpBB/styles/prosilver/template/posting_poll_body.html index ee7100aded..795649650d 100644 --- a/phpBB/styles/prosilver/template/posting_poll_body.html +++ b/phpBB/styles/prosilver/template/posting_poll_body.html @@ -15,8 +15,8 @@ <!-- IF S_SHOW_POLL_BOX --> <dl> - <dt><label for="poll_title">{L_POLL_QUESTION}{L_COLON}</label></dt> - <dd><input type="text" name="poll_title" id="poll_title" maxlength="255" value="{POLL_TITLE}" class="inputbox" /></dd> + <dt><label for="poll_title">{{ lang('POLL_QUESTION') ~ lang('COLON') }}</label></dt> + <dd><input type="text" name="poll_title" id="poll_title" maxlength="100" value="{{ POLL_TITLE }}" class="inputbox" /></dd> </dl> <dl> <dt><label for="poll_option_text">{L_POLL_OPTIONS}{L_COLON}</label><br /><span>{L_POLL_OPTIONS_EXPLAIN}</span></dt> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index d4dc6aa97e..391afa4d7f 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -117,7 +117,9 @@ <div class="responsive-hide left-box"> <!-- IF searchresults.S_HAS_POLL --><i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i><!-- ENDIF --> <!-- IF searchresults.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i><!-- ENDIF --> + {% EVENT topiclist_row_topic_by_author_before %} {L_POST_BY_AUTHOR} <!-- EVENT search_results_topic_author_username_prepend -->{searchresults.TOPIC_AUTHOR_FULL}<!-- EVENT search_results_topic_author_username_append --> » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> + {% EVENT topiclist_row_topic_by_author_after %} </div> <!-- IF .searchresults.pagination --> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index d7099f387f..1827738019 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -157,7 +157,7 @@ <li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->"> <!-- EVENT viewforum_body_topic_row_prepend --> <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> - <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url('{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}'); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> @@ -198,7 +198,9 @@ <div class="topic-poster responsive-hide left-box"> <!-- IF topicrow.S_HAS_POLL --><i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i><!-- ENDIF --> <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i><!-- ENDIF --> + {% EVENT topiclist_row_topic_by_author_before %} {L_POST_BY_AUTHOR} <!-- EVENT viewforum_body_topic_author_username_prepend -->{topicrow.TOPIC_AUTHOR_FULL}<!-- EVENT viewforum_body_topic_author_username_append --> » {topicrow.FIRST_POST_TIME} + {% EVENT topiclist_row_topic_by_author_after %} <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> </div> diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eb2d52cf61..0c2be8c52e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -453,6 +453,38 @@ $join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +/** +* Event to add new sorting options +* +* @event core.viewtopic_gen_sort_selects_before +* @var array limit_days Limit results by time +* @var array sort_by_text Language strings for sorting options +* @var array sort_by_sql SQL conditions for sorting options +* @var array join_user_sql SQL joins required for sorting options +* @var int sort_days User selected sort days +* @var string sort_key User selected sort key +* @var string sort_dir User selected sort direction +* @var string s_limit_days Initial value of limit days selectbox +* @var string s_sort_key Initial value of sort key selectbox +* @var string s_sort_dir Initial value of sort direction selectbox +* @var string u_sort_param Initial value of sorting form action +* @since 3.2.8-RC1 +*/ +$vars = array( + 'limit_days', + 'sort_by_text', + 'sort_by_sql', + 'join_user_sql', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_gen_sort_selects_before', compact($vars))); + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); // Obtain correct post count and ordering SQL if user has |