aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_forums.html2
-rw-r--r--phpBB/config/avatar.yml1
-rw-r--r--phpBB/docs/events.md30
-rw-r--r--phpBB/includes/functions.php16
-rw-r--r--phpBB/includes/mcp/mcp_forum.php24
-rw-r--r--phpBB/includes/ucp/ucp_register.php10
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php74
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php4
-rw-r--r--phpBB/phpbb/search/fulltext_native.php12
-rw-r--r--phpBB/styles/prosilver/template/posting_layout.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html5
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html3
-rw-r--r--phpBB/styles/subsilver2/template/posting_body.html2
13 files changed, 168 insertions, 17 deletions
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 756092a1f0..0d8b8ad583 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -343,6 +343,8 @@
<!-- EVENT acp_forums_rules_settings_append -->
</fieldset>
</div>
+
+ <!-- EVENT acp_forums_custom_settings -->
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
diff --git a/phpBB/config/avatar.yml b/phpBB/config/avatar.yml
index 5292489715..b0dca137b0 100644
--- a/phpBB/config/avatar.yml
+++ b/phpBB/config/avatar.yml
@@ -60,6 +60,7 @@ services:
- %core.php_ext%
- @path_helper
- @mimetype.guesser
+ - @dispatcher
- @cache.driver
calls:
- [set_name, [avatar.driver.upload]]
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index 19e7d1121c..b768daf3df 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -22,6 +22,12 @@ acp_email_options_after
* Since: 3.1.2-RC1
* Purpose: Add settings to mass email form
+acp_forums_custom_settings
+===
+* Location: adm/style/acp_forums.html
+* Since: 3.1.6-RC1
+* Purpose: Add its own box (fieldset) for extension settings
+
acp_forums_main_settings_append
===
* Location: adm/style/acp_forums.html
@@ -1133,6 +1139,14 @@ posting_poll_body_options_after
* Since: 3.1.4-RC1
* Purpose: Add content after the poll options on creating a poll
+posting_topic_title_before
+===
+* Locations:
+ + styles/prosilver/template/posting_layout.html
+ + styles/subsilver2/template/posting_body.html
+* Since: 3.1.6-RC1
+* Purpose: Allows to add some information on the left of the topic title in the posting form
+
quickreply_editor_panel_after
===
* Locations:
@@ -1392,6 +1406,22 @@ ucp_pm_viewmessage_post_buttons_before
* Purpose: Add post button to private messages (next to edit, quote etc), at
the start of the list.
+ucp_pm_viewmessage_post_buttons_list_after
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+* Since: 3.1.6-RC1
+* Purpose: Add post button custom list to private messages (next to edit, quote etc),
+after the original list.
+
+ucp_pm_viewmessage_post_buttons_list_before
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+* Since: 3.1.6-RC1
+* Purpose: Add post button custom list to private messages (next to edit, quote etc),
+before the original list.
+
ucp_pm_viewmessage_print_head_append
===
* Locations:
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 82aa91429c..fff55d993e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4823,7 +4823,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false)
{
global $user, $config, $cache, $phpbb_root_path, $phpEx;
global $request;
- global $phpbb_container;
+ global $phpbb_container, $phpbb_dispatcher;
if (!$config['allow_avatar'] && !$ignore_config)
{
@@ -4884,6 +4884,20 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false)
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}
+ /**
+ * Event to modify HTML <img> tag of avatar
+ *
+ * @event core.get_avatar_after
+ * @var array row Row cleaned by \phpbb\avatar\manager::clean_row
+ * @var string alt Optional language string for alt tag within image, can be a language key or text
+ * @var bool ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
+ * @var array avatar_data The HTML attributes for avatar <img> tag
+ * @var string html The HTML <img> tag of generated avatar
+ * @since 3.1.6-RC1
+ */
+ $vars = array('row', 'alt', 'ignore_config', 'avatar_data', 'html');
+ extract($phpbb_dispatcher->trigger_event('core.get_avatar_after', compact($vars)));
+
return $html;
}
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index c18ca1aa1d..157134b09e 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -77,6 +77,30 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
break;
}
+ /**
+ * Get some data in order to execute other actions.
+ *
+ * @event core.mcp_forum_view_before
+ * @var string action The action
+ * @var array forum_info Array with forum infos
+ * @var int start Start value
+ * @var array topic_id_list Array of topics ids
+ * @var array post_id_list Array of posts ids
+ * @var array source_topic_ids Array of source topics ids
+ * @var int to_topic_id Array of destination topics ids
+ * @since 3.1.6-RC1
+ */
+ $vars = array(
+ 'action',
+ 'forum_info',
+ 'start',
+ 'topic_id_list',
+ 'post_id_list',
+ 'source_topic_ids',
+ 'to_topic_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_forum_view_before', compact($vars)));
+
$pagination = $phpbb_container->get('pagination');
$selected_ids = '';
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 0ee45b0706..3426af95d0 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -176,6 +176,16 @@ class ucp_register
}
unset($lang_row);
+ /**
+ * Allows to modify the agreements.
+ *
+ * To assign data to the template, use $template->assign_vars()
+ *
+ * @event core.ucp_register_agreement
+ * @since 3.1.6-RC1
+ */
+ $phpbb_dispatcher->dispatch('core.ucp_register_agreement');
+
$this->tpl_name = 'ucp_agreement';
return;
}
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index 73147a85a0..a1d84345e1 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -24,6 +24,11 @@ class upload extends \phpbb\avatar\driver\driver
protected $mimetype_guesser;
/**
+ * @var \phpbb\event\dispatcher_interface
+ */
+ protected $dispatcher;
+
+ /**
* Construct a driver object
*
* @param \phpbb\config\config $config phpBB configuration
@@ -31,15 +36,17 @@ class upload extends \phpbb\avatar\driver\driver
* @param string $php_ext PHP file extension
* @param \phpbb_path_helper $path_helper phpBB path helper
* @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
+ * @param \phpbb\event\dispatcher_interface $dispatcher phpBB Event dispatcher object
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
*/
- public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null)
+ public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\cache\driver\driver_interface $cache = null)
{
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->path_helper = $path_helper;
$this->mimetype_guesser = $mimetype_guesser;
+ $this->dispatcher = $dispatcher;
$this->cache = $cache;
}
@@ -137,6 +144,15 @@ class upload extends \phpbb\avatar\driver\driver
$prefix = $this->config['avatar_salt'] . '_';
$file->clean_filename('avatar', $prefix, $row['id']);
+ // If there was an error during upload, then abort operation
+ if (sizeof($file->error))
+ {
+ $file->remove();
+ $error = $file->error;
+ return false;
+ }
+
+ // Calculate new destination
$destination = $this->config['avatar_path'];
// Adjust destination path (no trailing slash)
@@ -151,13 +167,35 @@ class upload extends \phpbb\avatar\driver\driver
$destination = '';
}
- // Move file and overwrite any existing image
- $file->move_file($destination, true);
+ /**
+ * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar)
+ *
+ * @event core.avatar_driver_upload_move_file_before
+ * @var string destination Destination directory where the file is going to be moved
+ * @var string prefix Prefix for the avatar filename
+ * @var array row Array with avatar row data
+ * @var array error Array of errors, if filled in by this event file will not be moved
+ * @since 3.1.6-RC1
+ */
+ $vars = array(
+ 'destination',
+ 'prefix',
+ 'row',
+ 'error',
+ );
+ extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars)));
- if (sizeof($file->error))
+ if (!sizeof($error))
+ {
+ // Move file and overwrite any existing image
+ $file->move_file($destination, true);
+ }
+
+ // If there was an error during move, then clean up leftovers
+ $error = array_merge($error, $file->error);
+ if (sizeof($error))
{
$file->remove();
- $error = array_merge($error, $file->error);
return false;
}
@@ -192,10 +230,32 @@ class upload extends \phpbb\avatar\driver\driver
*/
public function delete($row)
{
+
+ $error = array();
+ $destination = $this->config['avatar_path'];
+ $prefix = $this->config['avatar_salt'] . '_';
$ext = substr(strrchr($row['avatar'], '.'), 1);
- $filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext;
+ $filename = $this->phpbb_root_path . $destination . '/' . $prefix . $row['id'] . '.' . $ext;
+
+ /**
+ * Before deleting an existing avatar
+ *
+ * @event core.avatar_driver_upload_delete_before
+ * @var string destination Destination directory where the file is going to be deleted
+ * @var string prefix Prefix for the avatar filename
+ * @var array row Array with avatar row data
+ * @var array error Array of errors, if filled in by this event file will not be deleted
+ * @since 3.1.6-RC1
+ */
+ $vars = array(
+ 'destination',
+ 'prefix',
+ 'row',
+ 'error',
+ );
+ extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars)));
- if (file_exists($filename))
+ if (!sizeof($error) && file_exists($filename))
{
@unlink($filename);
}
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index e7ef64826c..bad2003000 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -685,6 +685,7 @@ class fulltext_mysql extends \phpbb\search\base
* Set to 0 to force a re-count
* @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen
* @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table
+ * @var string type Either "posts" or "topics" specifying the type of search being made
* @var array author_ary Array of user_id containing the users to filter the results to
* @var string author_name An extra username to search on
* @var string sql_author SQL WHERE condition for the post author ids
@@ -697,6 +698,7 @@ class fulltext_mysql extends \phpbb\search\base
* @var string sort_days Time, in days, that the oldest post showing can have
* @var string sql_time The SQL to search on the time specifyed by sort_days
* @var bool firstpost_only Wether or not to search only on the first post of the topics
+ * @var string sql_firstpost The SQL with the conditions to join the tables when using firstpost_only
* @var array ex_fid_ary Forum ids that must not be searched on
* @var array sql_fora SQL query for ex_fid_ary
* @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions
@@ -707,6 +709,7 @@ class fulltext_mysql extends \phpbb\search\base
'result_count',
'sql_sort_table',
'sql_sort_join',
+ 'type',
'author_ary',
'author_name',
'sql_author',
@@ -719,6 +722,7 @@ class fulltext_mysql extends \phpbb\search\base
'sort_days',
'sql_time',
'firstpost_only',
+ 'sql_firstpost',
'ex_fid_ary',
'sql_fora',
'm_approve_fid_sql',
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index c2cae3b37e..7c825029fb 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -733,9 +733,10 @@ class fulltext_native extends \phpbb\search\base
* @var array must_not_contain_ids Ids that cannot be taken into account for the results
* @var array must_exclude_one_ids Ids that cannot be on the results
* @var array must_contain_ids Ids that must be on the results
- * @var int result_count The previous result count for the format of the query
+ * @var int total_results The previous result count for the format of the query
* Set to 0 to force a re-count
- * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED
+ * @var array sql_array The data on how to search in the DB at this point
+ * @var bool left_join_topics Whether or not TOPICS_TABLE should be CROSS JOIN'ED
* @var array author_ary Array of user_id containing the users to filter the results to
* @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant)
* @var array ex_fid_ary Which forums not to search on
@@ -748,7 +749,7 @@ class fulltext_native extends \phpbb\search\base
* @var string sql_where An array of the current WHERE clause conditions
* @var string sql_match Which columns to do the search on
* @var string sql_match_where Extra conditions to use to properly filter the matching process
- * @var string group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause
+ * @var bool group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause
* @var string sort_by_sql The possible predefined sort types
* @var string sort_key The sort type used from the possible sort types
* @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used
@@ -761,8 +762,9 @@ class fulltext_native extends \phpbb\search\base
'must_not_contain_ids',
'must_exclude_one_ids',
'must_contain_ids',
- 'result_count',
- 'join_topic',
+ 'total_results',
+ 'sql_array',
+ 'left_join_topics',
'author_ary',
'author_name',
'ex_fid_ary',
diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html
index 34f0c63d5c..19a7351d78 100644
--- a/phpBB/styles/prosilver/template/posting_layout.html
+++ b/phpBB/styles/prosilver/template/posting_layout.html
@@ -1,7 +1,7 @@
<!-- INCLUDE overall_header.html -->
<!-- IF TOPIC_TITLE -->
- <h2 class="posting-title"><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
+ <h2 class="posting-title"><!-- EVENT posting_topic_title_before --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
<!-- ELSE -->
<h2 class="posting-title"><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 7704209fc8..d92b90a045 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -75,7 +75,9 @@
<div class="postbody">
<h3 class="first">{SUBJECT}</h3>
- <!-- IF U_DELETE or U_EDIT or U_QUOTE or U_REPORT -->
+ <!-- DEFINE $SHOW_PM_POST_BUTTONS = (U_EDIT or U_DELETE or U_REPORT or U_QUOTE) -->
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_list_before -->
+ <!-- IF $SHOW_PM_POST_BUTTONS -->
<ul class="post-buttons">
<!-- EVENT ucp_pm_viewmessage_post_buttons_before -->
<!-- IF U_EDIT -->
@@ -101,6 +103,7 @@
<!-- EVENT ucp_pm_viewmessage_post_buttons_after -->
</ul>
<!-- ENDIF -->
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_list_after -->
<p class="author">
<strong>{L_SENT_AT}{L_COLON}</strong> {SENT_DATE}
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index e2f04db3e1..449fd3401f 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -212,9 +212,10 @@
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
+ <!-- DEFINE $SHOW_POST_BUTTONS = (postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE) -->
<!-- EVENT viewtopic_body_post_buttons_list_before -->
<!-- IF not S_IS_BOT -->
- <!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE -->
+ <!-- IF $SHOW_POST_BUTTONS -->
<ul class="post-buttons">
<!-- EVENT viewtopic_body_post_buttons_before -->
<!-- IF postrow.U_EDIT -->
diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html
index cde6873a90..03311a3d60 100644
--- a/phpBB/styles/subsilver2/template/posting_body.html
+++ b/phpBB/styles/subsilver2/template/posting_body.html
@@ -20,7 +20,7 @@
<!-- IF not S_PRIVMSGS -->
<div id="pageheader">
- <h2><!-- IF TOPIC_TITLE --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- ELSE --><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- ENDIF --></h2>
+ <h2><!-- IF TOPIC_TITLE --><!-- EVENT posting_topic_title_before --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- ELSE --><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- ENDIF --></h2>
<!-- IF MODERATORS -->
<p class="moderators">{L_MODERATORS}{L_COLON} {MODERATORS}</p>