aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/overall_header.html2
-rw-r--r--phpBB/adm/style/simple_header.html1
-rw-r--r--phpBB/docs/events.md32
-rw-r--r--phpBB/includes/functions_acp.php1
-rw-r--r--phpBB/includes/functions_display.php15
-rw-r--r--phpBB/includes/functions_install.php2
-rw-r--r--phpBB/includes/functions_posting.php18
-rw-r--r--phpBB/includes/functions_privmsgs.php2
-rw-r--r--phpBB/install/database_update.php20
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/search_type.php34
-rw-r--r--phpBB/phpbb/db/migrator.php24
-rw-r--r--phpBB/phpbb/extension/manager.php5
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/simple_header.html2
-rw-r--r--tests/extension/manager_test.php2
-rw-r--r--tests/functional/private_messages_test.php69
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php92
20 files changed, 281 insertions, 48 deletions
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html
index afd2b94924..f1f7eee282 100644
--- a/phpBB/adm/style/overall_header.html
+++ b/phpBB/adm/style/overall_header.html
@@ -89,6 +89,8 @@ function popup(url, width, height, name)
{$STYLESHEETS}
+<!-- EVENT acp_overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS} nojs">
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index bf8f41cd7a..d0b9bf62ed 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -84,6 +84,7 @@ function find_username(url)
</script>
<!-- EVENT acp_simple_header_head_append -->
{$STYLESHEETS}
+<!-- EVENT acp_simple_header_stylesheets_after -->
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index b80e5fd4cb..c537504d54 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -64,6 +64,13 @@ acp_overall_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the ACP
+acp_overall_header_stylesheets_after
+===
+* Location: adm/style/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the ACP.
+Note that INCLUDECSS will not work with this event.
+
acp_posting_buttons_after
===
* Locations:
@@ -96,6 +103,13 @@ acp_simple_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the simple header of the ACP
+acp_simple_header_stylesheets_after
+===
+* Location: adm/style/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the simple header
+of the ACP. Note that INCLUDECSS will not work with this event.
+
acp_users_overview_options_append
===
* Location: adm/style/acp_users_overview.html
@@ -609,6 +623,15 @@ overall_header_page_body_before
* Since: 3.1.0-b3
* Purpose: Add content after the page-header, but before the page-body
+overall_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/overall_header.html
+ + styles/subsilver2/template/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
posting_editor_buttons_after
===
* Locations:
@@ -767,6 +790,15 @@ simple_header_head_append
* Since: 3.1.0-b4
* Purpose: Add asset calls directly before the `</head>` tag
+simple_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/simple_header.html
+ + styles/subsilver2/template/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
topiclist_row_prepend
===
* Locations:
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 8453da6e6e..ad5a359710 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -240,7 +240,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
case 'range':
case 'search':
case 'tel':
- case 'url':
case 'week':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 68b1356297..bfe9c0b055 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1063,7 +1063,8 @@ function display_reasons($reason_id = 0)
function display_user_activity(&$userdata)
{
global $auth, $template, $db, $user;
- global $phpbb_root_path, $phpEx, $phpbb_container;
+ global $phpbb_root_path, $phpEx;
+ global $phpbb_container, $phpbb_dispatcher;
// Do not display user activity for users having more than 5000 posts...
if ($userdata['user_posts'] > 5000)
@@ -1134,6 +1135,18 @@ function display_user_activity(&$userdata)
}
}
+ /**
+ * Alter list of forums and topics to display as active
+ *
+ * @event core.display_user_activity_modify_actives
+ * @var array userdata User's data
+ * @var array active_f_row List of active forums
+ * @var array active_t_row List of active posts
+ * @since 3.1.0-RC3
+ */
+ $vars = array('userdata', 'active_f_row', 'active_t_row');
+ extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars)));
+
$userdata['active_t_row'] = $active_t_row;
$userdata['active_f_row'] = $active_f_row;
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index ab6ecb5519..28cc603bdb 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -266,7 +266,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();
- $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
+ $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);
}
else
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 04e28fb865..26c4a06977 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -907,7 +907,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a
function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0)
{
global $user, $db, $template, $auth;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpbb_dispatcher, $phpEx;
$topic_ids = $forum_ids = $draft_rows = array();
@@ -950,7 +950,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
$topic_rows = array();
if (sizeof($topic_ids))
{
- $sql = 'SELECT topic_id, forum_id, topic_title
+ $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
$result = $db->sql_query($sql);
@@ -961,6 +961,20 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
}
$db->sql_freeresult($result);
}
+
+ /**
+ * Drafts found and their topics
+ * Edit $draft_rows in order to add or remove drafts loaded
+ *
+ * @event core.load_drafts_draft_list_result
+ * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft
+ * @var array topic_ids The list of topics got from the topics table
+ * @var array topic_rows The topics that draft_rows references
+ * @since 3.1.0-RC3
+ */
+ $vars = array('draft_rows', 'topic_ids', 'topic_rows');
+ extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars)));
+
unset($topic_ids);
$template->assign_var('S_SHOW_DRAFTS', true);
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index e60311f8ab..488f46a398 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -212,7 +212,7 @@ function get_folder($user_id, $folder_id = false)
);
}
- if ($folder_id !== false && !isset($folder[$folder_id]))
+ if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id]))
{
trigger_error('UNKNOWN_FOLDER');
}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index c54c84cdbc..517143792a 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -177,25 +177,9 @@ define('IN_DB_UPDATE', true);
// End startup code
-// Make sure migrations have been installed.
-$db_tools = $phpbb_container->get('dbal.tools');
-if (!$db_tools->sql_table_exists($table_prefix . 'migrations'))
-{
- $db_tools->sql_create_table($table_prefix . 'migrations', array(
- 'COLUMNS' => array(
- 'migration_name' => array('VCHAR', ''),
- 'migration_depends_on' => array('TEXT', ''),
- 'migration_schema_done' => array('BOOL', 0),
- 'migration_data_done' => array('BOOL', 0),
- 'migration_data_state' => array('TEXT', ''),
- 'migration_start_time' => array('TIMESTAMP', 0),
- 'migration_end_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'migration_name',
- ));
-}
-
$migrator = $phpbb_container->get('migrator');
+$migrator->create_migrations_table();
+
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
$finder = $phpbb_extension_manager->get_finder();
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index bb5f83b16f..c3caae5f70 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -53,6 +53,8 @@ class migrate extends \phpbb\console\command\command
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $this->migrator->create_migrations_table();
+
$this->load_migrations();
$orig_version = $this->config['version'];
while (!$this->migrator->finished())
diff --git a/phpBB/phpbb/db/migration/data/v310/search_type.php b/phpBB/phpbb/db/migration/data/v310/search_type.php
new file mode 100644
index 0000000000..f89456ae19
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/search_type.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class search_type extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ (is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)),
+ array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 8b089a060f..8bc63e564a 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -767,4 +767,28 @@ class migrator
return $this->migrations;
}
+
+ /**
+ * Creates the migrations table if it does not exist.
+ * @return null
+ */
+ public function create_migrations_table()
+ {
+ // Make sure migrations have been installed.
+ if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations'))
+ {
+ $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array(
+ 'COLUMNS' => array(
+ 'migration_name' => array('VCHAR', ''),
+ 'migration_depends_on' => array('TEXT', ''),
+ 'migration_schema_done' => array('BOOL', 0),
+ 'migration_data_done' => array('BOOL', 0),
+ 'migration_data_state' => array('TEXT', ''),
+ 'migration_start_time' => array('TIMESTAMP', 0),
+ 'migration_end_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'migration_name',
+ ));
+ }
+ }
}
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index b19eb9f8a3..4a12e9ec8c 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -77,11 +77,12 @@ class manager
{
$this->extensions = array();
- // Do not try to load any extensions when installing or updating
+ // Do not try to load any extensions if the extension table
+ // does not exist or when installing or updating.
// Note: database updater invokes this code, and in 3.0
// there is no extension table therefore the rest of this function
// fails
- if (defined('IN_INSTALL'))
+ if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<'))
{
return;
}
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index df09fc6a30..076a3160f0 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -51,6 +51,8 @@
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index d31dd32cf6..0831d5f9dc 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -28,6 +28,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index cb9a3a2a36..a87c0fcd5d 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -135,6 +135,8 @@ function marklist(id, name, state)
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html
index faeeaea3d5..0c3dff4a05 100644
--- a/phpBB/styles/subsilver2/template/simple_header.html
+++ b/phpBB/styles/subsilver2/template/simple_header.html
@@ -14,6 +14,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 230c90c7c7..067fd62581 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -135,7 +135,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
protected function create_extension_manager($with_cache = true)
{
- $config = new \phpbb\config\config(array());
+ $config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->new_dbal();
$db_tools = new \phpbb\db\tools($db);
$phpbb_root_path = __DIR__ . './../../phpBB/';
diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php
new file mode 100644
index 0000000000..1f6dc3a979
--- /dev/null
+++ b/tests/functional/private_messages_test.php
@@ -0,0 +1,69 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_private_messages_test extends phpbb_functional_test_case
+{
+ public function test_setup_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ // Set the maximum number of private messages per folder to 1
+ $values['config[pm_max_msgs]'] = 1;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+
+ public function test_inbox_full()
+ {
+ $this->login();
+ $message_id = $this->create_private_message('Test private message #1', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('UCP_PM_VIEW'), $crawler->filter('html')->text());
+
+ $message_id = $this->create_private_message('Test private message #2', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('NO_AUTH_READ_HOLD_MESSAGE'), $crawler->filter('html')->text());
+ }
+
+ public function test_restore_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ $values['config[pm_max_msgs]'] = 50;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 07ef826abf..9bb4d69bf4 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -897,6 +897,76 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
{
$this->add_lang('posting');
+ $crawler = $this->submit_message($posting_url, $posting_contains, $form_data);
+
+ if ($expected !== '')
+ {
+ if (isset($this->lang[$expected]))
+ {
+ $this->assertContainsLang($expected, $crawler->filter('html')->text());
+ }
+ else
+ {
+ $this->assertContains($expected, $crawler->filter('html')->text());
+ }
+ return null;
+ }
+
+ $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
+
+ return array(
+ 'topic_id' => $this->get_parameter_from_link($url, 't'),
+ 'post_id' => $this->get_parameter_from_link($url, 'p'),
+ );
+ }
+
+ /**
+ * Creates a private message
+ *
+ * Be sure to login before creating
+ *
+ * @param string $subject
+ * @param string $message
+ * @param array $to
+ * @param array $additional_form_data Any additional form data to be sent in the request
+ * @return int private_message_id
+ */
+ public function create_private_message($subject, $message, $to, $additional_form_data = array())
+ {
+ $this->add_lang(array('ucp', 'posting'));
+
+ $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}";
+
+ $form_data = array_merge(array(
+ 'subject' => $subject,
+ 'message' => $message,
+ 'post' => true,
+ ), $additional_form_data);
+
+ foreach ($to as $user_id)
+ {
+ $form_data['address_list[u][' . $user_id . ']'] = 'to';
+ }
+
+ $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data);
+
+ $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text());
+ $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri();
+
+ return $this->get_parameter_from_link($url, 'p');
+ }
+
+ /**
+ * Helper for submitting a message (post or private message)
+ *
+ * @param string $posting_url
+ * @param string $posting_contains
+ * @param array $form_data
+ * @return \Symfony\Component\DomCrawler\Crawler the crawler object
+ */
+ protected function submit_message($posting_url, $posting_contains, $form_data)
+ {
+
$crawler = self::request('GET', $posting_url);
$this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
@@ -938,27 +1008,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
// I use a request because the form submission method does not allow you to send data that is not
// contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
// Instead, I send it as a request with the submit button "post" set to true.
- $crawler = self::request('POST', $posting_url, $form_data);
-
- if ($expected !== '')
- {
- if (isset($this->lang[$expected]))
- {
- $this->assertContainsLang($expected, $crawler->filter('html')->text());
- }
- else
- {
- $this->assertContains($expected, $crawler->filter('html')->text());
- }
- return null;
- }
-
- $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
-
- return array(
- 'topic_id' => $this->get_parameter_from_link($url, 't'),
- 'post_id' => $this->get_parameter_from_link($url, 'p'),
- );
+ return self::request('POST', $posting_url, $form_data);
}
/**