aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/CONTRIBUTING.md (renamed from CONTRIBUTING.md)0
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md10
-rw-r--r--phpBB/adm/style/acp_database.html2
-rw-r--r--phpBB/cron.php12
-rw-r--r--phpBB/includes/functions_content.php29
-rw-r--r--phpBB/includes/functions_download.php2
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php28
-rw-r--r--phpBB/phpbb/cron/manager.php2
-rw-r--r--phpBB/phpbb/notification/manager.php31
-rw-r--r--phpBB/phpbb/template/twig/twig.php2
-rw-r--r--phpBB/search.php5
11 files changed, 100 insertions, 23 deletions
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 3fceabda10..3fceabda10 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000..39eb83e454
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,10 @@
+Checklist:
+
+- [ ] Correct branch: master for new features; 3.2.x, 3.1.x for fixes
+- [ ] Tests pass
+- [ ] Code follows coding guidelines: [master / 3.2.x](https://area51.phpbb.com/docs/master/coding-guidelines.html), [3.1.x](https://area51.phpbb.com/docs/31x/coding-guidelines.html)
+- [ ] Commit follows commit message [format](https://wiki.phpbb.com/Git#Commit_Messages)
+
+Tracker ticket (set the ticket ID to **your ticket ID**):
+
+https://tracker.phpbb.com/browse/PHPBB3-12345
diff --git a/phpBB/adm/style/acp_database.html b/phpBB/adm/style/acp_database.html
index bf0c80bcd9..39f06319f9 100644
--- a/phpBB/adm/style/acp_database.html
+++ b/phpBB/adm/style/acp_database.html
@@ -14,7 +14,7 @@
<legend>{L_RESTORE_OPTIONS}</legend>
<dl>
<dt><label for="file">{L_SELECT_FILE}{L_COLON}</label></dt>
- <dd><select id="file" name="file" size="10"><!-- BEGIN files --><option value="{files.FILE}"<!-- IF files.S_LAST_ROW --> selected="selected"<!-- ENDIF -->>{files.NAME}</option><!-- END files --></select></dd>
+ <dd><select id="file" name="file" size="10"><!-- BEGIN files --><option value="{files.FILE}"<!-- IF files.S_FIRST_ROW --> selected="selected"<!-- ENDIF -->>{files.NAME}</option><!-- END files --></select></dd>
</dl>
<p class="submit-buttons">
diff --git a/phpBB/cron.php b/phpBB/cron.php
index 3f022b1db8..aed68f6aeb 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -55,6 +55,18 @@ if ($cron_lock->acquire())
$task = $cron->find_task($cron_type);
if ($task)
{
+ /**
+ * This event enables you to catch the task before it runs
+ *
+ * @event core.cron_run_before
+ * @var \phpbb\cron\task\wrapper task Current Cron task
+ * @since 3.1.8-RC1
+ */
+ $vars = array(
+ 'task',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.cron_run_before', compact($vars)));
+
if ($task->is_parametrized())
{
$task->parse_parameters($request);
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index e05fcb0586..87dd306e8a 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -150,7 +150,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,
*/
function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false)
{
- global $config, $auth, $template, $user, $db, $phpbb_path_helper;
+ global $config, $auth, $template, $user, $db, $phpbb_path_helper, $phpbb_dispatcher;
// We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality)
if (!$config['load_jumpbox'] && $force_display === false)
@@ -205,20 +205,21 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
continue;
}
+ $tpl_ary = array();
if (!$display_jumpbox)
{
- $template->assign_block_vars('jumpbox_forums', array(
+ $tpl_ary[] = array(
'FORUM_ID' => ($select_all) ? 0 : -1,
'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'],
'S_FORUM_COUNT' => $iteration,
'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $forum_id)),
- ));
+ );
$iteration++;
$display_jumpbox = true;
}
- $template->assign_block_vars('jumpbox_forums', array(
+ $tpl_ary[] = array(
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '',
@@ -227,7 +228,25 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false,
'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])),
- ));
+ );
+
+ /**
+ * Modify the jumpbox before it is assigned to the template
+ *
+ * @event core.make_jumpbox_modify_tpl_ary
+ * @var array row The data of the forum
+ * @var array tpl_ary Template data of the forum
+ * @since 3.1.10-RC1
+ */
+ $vars = array(
+ 'row',
+ 'tpl_ary',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_tpl_ary', compact($vars)));
+
+ $template->assign_block_vars_array('jumpbox_forums', $tpl_ary);
+
+ unset($tpl_ary);
for ($i = 0; $i < $padding; $i++)
{
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 2c5cba2c0d..2c6f62227c 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -166,7 +166,7 @@ function send_file_to_browser($attachment, $upload_dir, $category)
}
// Make sure the database record for the filesize is correct
- if ($size > 0 && $size != $attachment['filesize'])
+ if ($size > 0 && $size != $attachment['filesize'] && strpos($attachment['physical_filename'], 'thumb_') === false)
{
// Update database record
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index aae80b0c06..d365e8b489 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -751,6 +751,34 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
$enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false);
+ /**
+ * Modify private message
+ *
+ * @event core.ucp_pm_compose_modify_parse_before
+ * @var bool enable_bbcode Whether or not bbcode is enabled
+ * @var bool enable_smilies Whether or not smilies are enabled
+ * @var bool enable_urls Whether or not urls are enabled
+ * @var bool enable_sig Whether or not signature is enabled
+ * @var string subject PM subject text
+ * @var object message_parser The message parser object
+ * @var bool submit Whether or not the form has been sumitted
+ * @var bool preview Whether or not the signature is being previewed
+ * @var array error Any error strings
+ * @since 3.1.10-RC1
+ */
+ $vars = array(
+ 'enable_bbcode',
+ 'enable_smilies',
+ 'enable_urls',
+ 'enable_sig',
+ 'subject',
+ 'message_parser',
+ 'submit',
+ 'preview',
+ 'error',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_parse_before', compact($vars)));
+
if ($submit)
{
$status_switch = (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php
index 079ce8107e..9bd30a0a5b 100644
--- a/phpBB/phpbb/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
@@ -110,7 +110,7 @@ class manager
* Web runner uses this method to resolve names to tasks.
*
* @param string $name Name of the task to look up.
- * @return \phpbb\cron\task\task A task corresponding to the given name, or null.
+ * @return \phpbb\cron\task\wrapper A wrapped task corresponding to the given name, or null.
*/
public function find_task($name)
{
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 222d9fe9e6..ecba8938f2 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -192,7 +192,7 @@ class manager
$sql = 'SELECT n.*, nt.notification_type_name
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
WHERE n.user_id = ' . (int) $options['user_id'] .
- (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . '
+ (($options['notification_id']) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : '') . '
AND nt.notification_type_id = n.notification_type_id
AND nt.notification_type_enabled = 1
ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
@@ -275,10 +275,9 @@ class manager
$sql = 'UPDATE ' . $this->notifications_table . "
SET notification_read = 1
WHERE notification_time <= " . (int) $time .
- (($notification_type_name !== false) ? ' AND ' .
- (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') .
- (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') .
- (($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '');
+ (($notification_type_name !== false) ? ' AND ' . $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : '') .
+ (($user_id !== false) ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') .
+ (($item_id !== false) ? ' AND ' . $this->db->sql_in_set('item_id', $item_id) : '');
$this->db->sql_query($sql);
}
@@ -297,10 +296,9 @@ class manager
$sql = 'UPDATE ' . $this->notifications_table . "
SET notification_read = 1
WHERE notification_time <= " . (int) $time .
- (($notification_type_name !== false) ? ' AND ' .
- (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') .
- (($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
- (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
+ (($notification_type_name !== false) ? ' AND ' . $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : '') .
+ (($item_parent_id !== false) ? ' AND ' . $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : '') .
+ (($user_id !== false) ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '');
$this->db->sql_query($sql);
}
@@ -317,7 +315,7 @@ class manager
$sql = 'UPDATE ' . $this->notifications_table . "
SET notification_read = 1
WHERE notification_time <= " . (int) $time . '
- AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id);
+ AND ' . $this->db->sql_in_set('notification_id', $notification_id);
$this->db->sql_query($sql);
}
@@ -542,8 +540,8 @@ class manager
$sql = 'DELETE FROM ' . $this->notifications_table . '
WHERE notification_type_id = ' . (int) $notification_type_id . '
- AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) .
- (($parent_id !== false) ? ' AND ' . ((is_array($parent_id) ? $this->db->sql_in_set('item_parent_id', $parent_id) : 'item_parent_id = ' . (int) $parent_id)) : '');
+ AND ' . $this->db->sql_in_set('item_id', $item_id) .
+ (($parent_id !== false) ? ' AND ' . $this->db->sql_in_set('item_parent_id', $parent_id) : '');
$this->db->sql_query($sql);
}
@@ -969,11 +967,16 @@ class manager
/**
* Get notification type ids (as an array)
*
- * @param array $notification_type_names Array of strings
+ * @param string|array $notification_type_names Notification type names
* @return array Array of integers
*/
- public function get_notification_type_ids(array $notification_type_names)
+ public function get_notification_type_ids($notification_type_names)
{
+ if (!is_array($notification_type_names))
+ {
+ $notification_type_names = array($notification_type_names);
+ }
+
$notification_type_ids = array();
foreach ($notification_type_names as $name)
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
index bd754d9bbd..d1bbb2b55a 100644
--- a/phpBB/phpbb/template/twig/twig.php
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -350,7 +350,7 @@ class twig extends \phpbb\template\base
return $this->twig->render($this->get_filename_from_handle($handle), $this->get_template_vars());
}
- $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars())));
+ $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle), $this->get_template_vars()));
return $this;
}
diff --git a/phpBB/search.php b/phpBB/search.php
index 7469daa49c..3fa3b61c3c 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -320,7 +320,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
* @var array ex_fid_ary Array of excluded forum ids
* @var array author_id_ary Array of exclusive author ids
* @var string search_id The id of the search request
+ * @var array id_ary Array of post or topic ids for search result
+ * @var string show_results 'posts' or 'topics' type of ids
* @since 3.1.3-RC1
+ * @changed 3.1.10-RC1 Added id_ary, show_results
*/
$vars = array(
'keywords',
@@ -328,6 +331,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'ex_fid_ary',
'author_id_ary',
'search_id',
+ 'id_ary',
+ 'show_results',
);
extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars)));