diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 2e0a1cf9e6..4f1f9bb990 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -501,6 +501,29 @@ class mcp_queue AND t.topic_id = p.topic_id AND u.user_id = p.poster_id ORDER BY ' . $sort_order_sql; + + /** + * Alter sql query to get information on all posts in queue + * + * @event core.mcp_queue_get_posts_for_posts_query_before + * @var string sql String with the query to be executed + * @var array forum_list List of forums that contain the posts + * @var int visibility_const Integer with one of the possible ITEM_* constant values + * @var int topic_id topic_id in the page request + * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string) + * @var string sort_order_sql String with the ORDER BY SQL code used in this query + * @since 3.2.3-RC2 + */ + $vars = array( + 'sql', + 'forum_list', + 'visibility_const', + 'topic_id', + 'limit_time_sql', + 'sort_order_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_for_posts_query_before', compact($vars))); + $result = $db->sql_query($sql); $post_data = $rowset = array(); @@ -588,7 +611,7 @@ class mcp_queue $row['post_username'] = $row['username'] ?: $user->lang['GUEST']; } - $template->assign_block_vars('postrow', array( + $post_row = array( 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), @@ -606,7 +629,25 @@ class mcp_queue 'TOPIC_TITLE' => $row['topic_title'], 'POST_TIME' => $user->format_date($row['post_time']), 'S_HAS_ATTACHMENTS' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'], - )); + ); + + /** + * Alter sql query to get information on all topics in the list of forums provided. + * + * @event core.mcp_queue_get_posts_modify_post_row + * @var array post_row Template variables for current post + * @var array row Post data + * @var array forum_names Forum names + * @since 3.2.3-RC2 + */ + $vars = array( + 'post_row', + 'row', + 'forum_names', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_modify_post_row', compact($vars))); + + $template->assign_block_vars('postrow', $post_row); } unset($rowset, $forum_names); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 4a99798627..76982be098 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -404,10 +404,10 @@ $lang = array_merge($lang, array( 'READ_NOTIFICATION_EXPIRE_DAYS_EXPLAIN' => 'Number of days that will elapse before a read notification will automatically be deleted. Set this value to 0 to make notifications permanent.', 'RECOMPILE_STYLES' => 'Recompile stale style components', 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', + 'YES_ACCURATE_PM_BUTTON' => 'Enable permission specific PM button in topic pages', + 'YES_ACCURATE_PM_BUTTON_EXPLAIN' => 'If this setting is enabled, only post profiles of users who are permitted to read private messages will have a private message button.', 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', - 'YES_ACCURATE_PM_BUTTON' => 'Enable accurate PM indicator in topic pages', - 'YES_ACCURATE_PM_BUTTON_EXPLAIN' => 'If this setting is enabled, only users who are permitted to read private messages will have a private message button.', 'YES_BIRTHDAYS' => 'Enable birthday listing', 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', 'YES_JUMPBOX' => 'Enable display of jumpbox', diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index 9d0bb5f8b9..c3a5ae9e44 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -92,7 +92,7 @@ $lang = array_merge($lang, array( 'GROUP_OPEN' => 'Open', 'GROUP_PENDING' => 'Pending members', 'GROUP_MAX_RECIPIENTS' => 'Maximum number of allowed recipients per private message', - 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. The maximum for all groups of the user is used to determine the actual value.
Set this value to 0 to overwrite the setting for all users of this group with the board-wide setting.', + 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. The maximum for all groups of the user is used to determine the actual value.
Set this value to 0 to overwrite the setting for all users of this group with the board-wide setting.', 'GROUP_OPTIONS_SAVE' => 'Group wide options', 'GROUP_PROMOTE' => 'Promote to group leader', 'GROUP_RANK' => 'Group rank', diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index b5823e19ec..d87b71d4d3 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -519,12 +519,6 @@ class module implements \phpbb\db\migration\tool\tool_interface // Allow '' to be sent as 0 $parent_id = $parent_id ?: 0; - // If automatic adding is in action, convert array back to string to simplify things - if (is_array($data) && count($data) == 1) - { - $data = $data['module_langname']; - } - if (!is_numeric($parent_id)) { // Refresh the $module_categories array diff --git a/tests/dbal/ext/foo/bar/acp/acp_test_info.php b/tests/dbal/ext/foo/bar/acp/acp_test_info.php new file mode 100644 index 0000000000..ac92623c3a --- /dev/null +++ b/tests/dbal/ext/foo/bar/acp/acp_test_info.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace foo\bar\acp; + +class acp_test_info +{ + public function module() + { + return array( + 'filename' => '\foo\bar\acp\acp_test_module', + 'title' => 'ACP_NEW_MODULE', + 'modes' => array( + 'mode_1' => array( + 'title' => 'ACP_NEW_MODULE_MODE_1', + 'auth' => '', + 'cat' => array('ACP_NEW_MODULE'), + ), + 'mode_2' => array( + 'title' => 'ACP_NEW_MODULE_MODE_2', + 'auth' => '', + 'cat' => array('ACP_NEW_MODULE'), + ), + ), + ); + } +} diff --git a/tests/dbal/ext/foo/bar/acp/acp_test_module.php b/tests/dbal/ext/foo/bar/acp/acp_test_module.php new file mode 100644 index 0000000000..01ce5c17dc --- /dev/null +++ b/tests/dbal/ext/foo/bar/acp/acp_test_module.php @@ -0,0 +1,25 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace foo\bar\acp; + +class acp_test_module +{ + var $u_action; + + function main($id, $mode) + { + $this->tpl_name = 'foobar'; + $this->page_title = 'Bertie'; + } +} diff --git a/tests/dbal/ext/foo/bar/composer.json b/tests/dbal/ext/foo/bar/composer.json new file mode 100644 index 0000000000..2edfd43d84 --- /dev/null +++ b/tests/dbal/ext/foo/bar/composer.json @@ -0,0 +1,24 @@ +{ + "name": "foo/bar", + "type": "phpbb-extension", + "description": "An example/sample extension to be used for testing purposes in phpBB Development.", + "version": "1.0.0", + "time": "2012-02-15 01:01:01", + "license": "GNU GPL v2", + "authors": [{ + "name": "John Smith", + "username": "JohnSmith27", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.4.7" + }, + "extra": { + "display-name": "phpBB BarFoo Extension", + "soft-require": { + "phpbb/phpbb": "3.2.*@dev" + } + } +} diff --git a/tests/dbal/ext/foo/bar/ucp/ucp_test_info.php b/tests/dbal/ext/foo/bar/ucp/ucp_test_info.php new file mode 100644 index 0000000000..d3489af832 --- /dev/null +++ b/tests/dbal/ext/foo/bar/ucp/ucp_test_info.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace foo\bar\ucp; + +class ucp_test_info +{ + public function module() + { + return array( + 'filename' => '\foo\bar\ucp\ucp_test_module', + 'title' => 'UCP_NEW_MODULE', + 'modes' => array( + 'mode_1' => array( + 'title' => 'UCP_NEW_MODULE_MODE_1', + 'auth' => '', + 'cat' => array('UCP_NEW_MODULE'), + ), + 'mode_2' => array( + 'title' => 'UCP_NEW_MODULE_MODE_2', + 'auth' => '', + 'cat' => array('UCP_NEW_MODULE'), + ), + ), + ); + } +} diff --git a/tests/dbal/ext/foo/bar/ucp/ucp_test_module.php b/tests/dbal/ext/foo/bar/ucp/ucp_test_module.php new file mode 100644 index 0000000000..b06b3238b6 --- /dev/null +++ b/tests/dbal/ext/foo/bar/ucp/ucp_test_module.php @@ -0,0 +1,25 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace foo\bar\ucp; + +class ucp_test_module +{ + var $u_action; + + function main($id, $mode) + { + $this->tpl_name = 'foobar'; + $this->page_title = 'Bertie'; + } +} diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 43c93630a6..46045d2371 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -11,6 +11,9 @@ * */ +require_once dirname(__FILE__) . '/ext/foo/bar/acp/acp_test_info.php'; +require_once dirname(__FILE__) . '/ext/foo/bar/ucp/ucp_test_info.php'; + class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { public function getDataSet() @@ -39,6 +42,9 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + // Correctly set the root path for this test to this directory, so the classes can be found + $phpbb_root_path = dirname(__FILE__) . '/'; + $phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path); $module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx); @@ -403,6 +409,35 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->fail($e); } $this->assertEquals(true, $this->tool->exists('ucp', 'UCP_NEW_SUBCAT', 'UCP_NEW_MODULE')); + + // Test adding new UCP module the automatic way, single mode + try + { + $this->tool->add('ucp', 'UCP_NEW_CAT', array( + 'module_basename' => '\foo\bar\ucp\ucp_test_module', + 'modes' => array('mode_1'), + )); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals(true, $this->tool->exists('ucp', 'UCP_NEW_CAT', 'UCP_NEW_MODULE_MODE_1')); + $this->assertEquals(false, $this->tool->exists('ucp', 'UCP_NEW_CAT', 'UCP_NEW_MODULE_MODE_2')); + + // Test adding new ACP module the automatic way, all modes + try + { + $this->tool->add('acp', 'ACP_NEW_CAT', array( + 'module_basename' => '\foo\bar\acp\acp_test_module', + )); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals(true, $this->tool->exists('acp', 'ACP_NEW_CAT', 'ACP_NEW_MODULE_MODE_1')); + $this->assertEquals(true, $this->tool->exists('acp', 'ACP_NEW_CAT', 'ACP_NEW_MODULE_MODE_2')); } public function test_remove()