aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_email.php18
-rw-r--r--phpBB/includes/acp/acp_users.php26
-rw-r--r--phpBB/includes/functions.php54
-rw-r--r--phpBB/includes/functions_posting.php34
-rw-r--r--phpBB/includes/functions_user.php32
-rw-r--r--phpBB/includes/mcp/mcp_queue.php92
-rw-r--r--phpBB/includes/mcp/mcp_topic.php36
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php8
-rw-r--r--phpBB/includes/ucp/ucp_profile.php46
9 files changed, 327 insertions, 19 deletions
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index fcc2bd7641..fda9d50779 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -314,7 +314,7 @@ class acp_email
$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
- $template->assign_vars(array(
+ $template_data = array(
'S_WARNING' => (sizeof($error)) ? true : false,
'WARNING_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'U_ACTION' => $this->u_action,
@@ -323,8 +323,22 @@ class acp_email
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=acp_email&amp;field=usernames'),
'SUBJECT' => $subject,
'MESSAGE' => $message,
- 'S_PRIORITY_OPTIONS' => $s_priority_options)
+ 'S_PRIORITY_OPTIONS' => $s_priority_options,
);
+ /**
+ * Modify custom email template data before we display the form
+ *
+ * @event core.acp_email_display
+ * @var array template_data Array with template data assigned to email template
+ * @var array exclude Array with groups which are excluded from group selection
+ * @var array usernames Usernames which will be displayed in form
+ *
+ * @since 3.1.4-RC1
+ */
+ $vars = array('template_data', 'exclude', 'usernames');
+ extract($phpbb_dispatcher->trigger_event('core.acp_email_display', compact($vars)));
+
+ $template->assign_vars($template_data);
}
}
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 881e50dd5a..3c957a7093 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1377,6 +1377,19 @@ class acp_users
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
+ /**
+ * Modify user data on editing profile in ACP
+ *
+ * @event core.acp_users_modify_profile
+ * @var array data Array with user profile data
+ * @var bool submit Flag indicating if submit button has been pressed
+ * @var int user_id The user id
+ * @var array user_row Array with the full user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array('data', 'submit', 'user_id', 'user_row');
+ extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars)));
+
if ($submit)
{
$error = validate_data($data, array(
@@ -1408,6 +1421,19 @@ class acp_users
'user_birthday' => $data['user_birthday'],
);
+ /**
+ * Modify profile data in ACP before submitting to the database
+ *
+ * @event core.acp_users_profile_modify_sql_ary
+ * @var array cp_data Array with the user custom profile fields data
+ * @var array data Array with user profile data
+ * @var int user_id The user id
+ * @var array user_row Array with the full user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array('cp_data', 'data', 'user_id', 'user_row');
+ extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
WHERE user_id = $user_id";
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 97429a0be4..940484a0ea 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1150,10 +1150,43 @@ function phpbb_timezone_select($template, $user, $default = '', $truncate = fals
function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0)
{
global $db, $user, $config;
- global $request, $phpbb_container;
+ global $request, $phpbb_container, $phpbb_dispatcher;
$post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time;
+ $should_markread = true;
+
+ /**
+ * This event is used for performing actions directly before marking forums,
+ * topics or posts as read.
+ *
+ * It is also possible to prevent the marking. For that, the $should_markread parameter
+ * should be set to FALSE.
+ *
+ * @event core.markread_before
+ * @var string mode Variable containing marking mode value
+ * @var mixed forum_id Variable containing forum id, or false
+ * @var mixed topic_id Variable containing topic id, or false
+ * @var int post_time Variable containing post time
+ * @var int user_id Variable containing the user id
+ * @var bool should_markread Flag indicating if the markread should be done or not.
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'mode',
+ 'forum_id',
+ 'topic_id',
+ 'post_time',
+ 'user_id',
+ 'should_markread',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.markread_before', compact($vars)));
+
+ if (!$should_markread)
+ {
+ return;
+ }
+
if ($mode == 'all')
{
if ($forum_id === false || !sizeof($forum_id))
@@ -1648,6 +1681,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0)
{
global $config, $db, $user;
+ global $phpbb_dispatcher;
$user_id = ($user_id === false) ? (int) $user->data['user_id'] : (int) $user_id;
@@ -1691,6 +1725,24 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
$sql_sort",
);
+ /**
+ * Change SQL query for fetching unread topics data
+ *
+ * @event core.get_unread_topics_modify_sql
+ * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, LEFT_JOIN, WHERE
+ * @var int last_mark User's last_mark time
+ * @var string sql_extra Extra WHERE SQL statement
+ * @var string sql_sort ORDER BY SQL sorting statement
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'sql_array',
+ 'last_mark',
+ 'sql_extra',
+ 'sql_sort',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.get_unread_topics_modify_sql', compact($vars)));
+
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 22ade15b48..f3c49badfe 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1037,7 +1037,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
global $user, $auth, $db, $template, $bbcode, $cache;
- global $config, $phpbb_root_path, $phpEx, $phpbb_container;
+ global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC';
@@ -1176,7 +1176,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
$u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&amp;t=$topic_id&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
- $template->assign_block_vars($mode . '_row', array(
+ $post_row = array(
'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
@@ -1195,9 +1195,37 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'POST_ID' => $row['post_id'],
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=post_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
- 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '')
+ 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '',
);
+ $current_row_number = $i;
+
+ /**
+ * Event to modify the template data block for topic reviews
+ *
+ * @event core.topic_review_modify_row
+ * @var string mode The review mode
+ * @var int topic_id The topic that is being reviewed
+ * @var int forum_id The topic's forum
+ * @var int cur_post_id Post offset id
+ * @var int current_row_number Number of the current row being iterated
+ * @var array post_row Template block array of the current post
+ * @var array row Array with original post and user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'mode',
+ 'topic_id',
+ 'forum_id',
+ 'cur_post_id',
+ 'current_row_number',
+ 'post_row',
+ 'row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars)));
+
+ $template->assign_block_vars($mode . '_row', $post_row);
+
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))
{
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index f79a8998c4..83f6e44453 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -703,7 +703,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
*/
function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
{
- global $config, $db, $user, $auth;
+ global $config, $db, $user, $auth, $phpbb_dispatcher;
$deactivated = $activated = 0;
$sql_statements = array();
@@ -756,6 +756,21 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
}
$db->sql_freeresult($result);
+ /**
+ * Check or modify activated/deactivated users data before submitting it to the database
+ *
+ * @event core.user_active_flip_before
+ * @var string mode User type changing mode, can be: flip|activate|deactivate
+ * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND
+ * @var int activated The number of users to be activated
+ * @var int deactivated The number of users to be deactivated
+ * @var array user_id_ary Array with user ids to change user type
+ * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements');
+ extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars)));
+
if (sizeof($sql_statements))
{
foreach ($sql_statements as $user_id => $sql_ary)
@@ -769,6 +784,21 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
$auth->acl_clear_prefetch(array_keys($sql_statements));
}
+ /**
+ * Perform additional actions after the users have been activated/deactivated
+ *
+ * @event core.user_active_flip_after
+ * @var string mode User type changing mode, can be: flip|activate|deactivate
+ * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND
+ * @var int activated The number of users to be activated
+ * @var int deactivated The number of users to be deactivated
+ * @var array user_id_ary Array with user ids to change user type
+ * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements');
+ extract($phpbb_dispatcher->trigger_event('core.user_active_flip_after', compact($vars)));
+
if ($deactivated)
{
set_config_count('num_users', $deactivated * (-1), true);
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index f9c00da3ec..82c3bc9ab0 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -616,7 +616,7 @@ class mcp_queue
*/
static public function approve_posts($action, $post_id_list, $id, $mode)
{
- global $db, $template, $user, $config, $request, $phpbb_container;
+ global $db, $template, $user, $config, $request, $phpbb_container, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
@@ -764,6 +764,30 @@ class mcp_queue
$success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
}
+ /**
+ * Perform additional actions during post(s) approval
+ *
+ * @event core.approve_posts_after
+ * @var string action Variable containing the action we perform on the posts ('approve' or 'restore')
+ * @var array post_info Array containing info for all posts being approved
+ * @var array topic_info Array containing info for all parent topics of the posts
+ * @var int num_topics Variable containing number of topics
+ * @var bool notify_poster Variable telling if the post should be notified or not
+ * @var string success_msg Variable containing the language key for the success message
+ * @var string redirect Variable containing the redirect url
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'action',
+ 'post_info',
+ 'topic_info',
+ 'num_topics',
+ 'notify_poster',
+ 'success_msg',
+ 'redirect',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.approve_posts_after', compact($vars)));
+
meta_refresh(3, $redirect);
$message = $user->lang[$success_msg];
@@ -840,7 +864,7 @@ class mcp_queue
static public function approve_topics($action, $topic_id_list, $id, $mode)
{
global $db, $template, $user, $config;
- global $phpEx, $phpbb_root_path, $request, $phpbb_container;
+ global $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_dispatcher;
if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
{
@@ -945,6 +969,28 @@ class mcp_queue
}
}
+ /**
+ * Perform additional actions during topics(s) approval
+ *
+ * @event core.approve_topics_after
+ * @var string action Variable containing the action we perform on the posts ('approve' or 'restore')
+ * @var mixed topic_info Array containing info for all topics being approved
+ * @var array first_post_ids Array containing ids of all first posts
+ * @var bool notify_poster Variable telling if the poster should be notified or not
+ * @var string success_msg Variable containing the language key for the success message
+ * @var string redirect Variable containing the redirect url
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'action',
+ 'topic_info',
+ 'first_post_ids',
+ 'notify_poster',
+ 'success_msg',
+ 'redirect',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.approve_topics_after', compact($vars)));
+
meta_refresh(3, $redirect);
$message = $user->lang[$success_msg];
@@ -1008,7 +1054,7 @@ class mcp_queue
*/
static public function disapprove_posts($post_id_list, $id, $mode)
{
- global $db, $template, $user, $config, $phpbb_container;
+ global $db, $template, $user, $config, $phpbb_container, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path, $request;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
@@ -1239,8 +1285,6 @@ class mcp_queue
}
}
- unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang);
-
if ($num_disapproved_topics)
{
$success_msg = ($num_disapproved_topics == 1) ? 'TOPIC' : 'TOPICS';
@@ -1275,6 +1319,44 @@ class mcp_queue
}
}
+ /**
+ * Perform additional actions during post(s) disapproval
+ *
+ * @event core.disapprove_posts_after
+ * @var array post_info Array containing info for all posts being disapproved
+ * @var array topic_information Array containing information for the topics
+ * @var array topic_posts_unapproved Array containing list of topic ids and the count of disapproved posts in them
+ * @var array post_disapprove_list Array containing list of posts and their topic id
+ * @var int num_disapproved_topics Variable containing the number of disapproved topics
+ * @var int num_disapproved_posts Variable containing the number of disapproved posts
+ * @var array lang_reasons Array containing the language keys for reasons
+ * @var string disapprove_reason Variable containing the language key for the success message
+ * @var string disapprove_reason_lang Variable containing the language key for the success message
+ * @var bool is_disapproving Variable telling if anything is going to be disapproved
+ * @var bool notify_poster Variable telling if the post should be notified or not
+ * @var string success_msg Variable containing the language key for the success message
+ * @var string redirect Variable containing the redirect url
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'post_info',
+ 'topic_information',
+ 'topic_posts_unapproved',
+ 'post_disapprove_list',
+ 'num_disapproved_topics',
+ 'num_disapproved_posts',
+ 'lang_reasons',
+ 'disapprove_reason',
+ 'disapprove_reason_lang',
+ 'is_disapproving',
+ 'notify_poster',
+ 'success_msg',
+ 'redirect',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.disapprove_posts_after', compact($vars)));
+
+ unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang);
+
meta_refresh(3, $redirect);
$message = $user->lang[$success_msg];
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 1698b080c9..3a456169d5 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
function mcp_topic_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth, $cache, $phpbb_container;
+ global $template, $db, $user, $auth, $cache, $phpbb_container, $phpbb_dispatcher;
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());
@@ -228,7 +228,7 @@ function mcp_topic_view($id, $mode, $action)
$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
- $template->assign_block_vars('postrow', array(
+ $post_row = array(
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
@@ -250,9 +250,39 @@ function mcp_topic_view($id, $mode, $action)
'U_POST_DETAILS' => "$url&amp;i=$id&amp;p={$row['post_id']}&amp;mode=post_details" . (($forum_id) ? "&amp;f=$forum_id" : ''),
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
- 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '')
+ 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
);
+ $current_row_number = $i;
+
+ /**
+ * Event to modify the template data block for topic reviews in the MCP
+ *
+ * @event core.mcp_topic_review_modify_row
+ * @var int id ID of the tab we are displaying
+ * @var string mode Mode of the MCP page we are displaying
+ * @var int topic_id The topic ID we are currently reviewing
+ * @var int forum_id The forum ID we are currently in
+ * @var int start Start item of this page
+ * @var int current_row_number Number of the post on this page
+ * @var array post_row Template block array of the current post
+ * @var array row Array with original post and user data
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'id',
+ 'mode',
+ 'topic_id',
+ 'forum_id',
+ 'start',
+ 'current_row_number',
+ 'post_row',
+ 'row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars)));
+
+ $template->assign_block_vars('postrow', $post_row);
+
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))
{
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 2195500b57..1d3fb19f67 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -67,9 +67,11 @@ class ucp_prefs
* @var bool submit Do we display the form only
* or did the user press submit
* @var array data Array with current ucp options data
+ * @var array error Array with list of errors
* @since 3.1.0-a1
+ * @changed 3.1.4-rc1 Added error variable to the event
*/
- $vars = array('submit', 'data');
+ $vars = array('submit', 'data', 'error');
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
if ($submit)
@@ -83,11 +85,11 @@ class ucp_prefs
$data['user_style'] = (int) $user->data['user_style'];
}
- $error = validate_data($data, array(
+ $error = array_merge(validate_data($data, array(
'dateformat' => array('string', false, 1, 30),
'lang' => array('language_iso_name'),
'tz' => array('timezone'),
- ));
+ )), $error);
if (!check_form_key('ucp_prefs_personal'))
{
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index a876d0133a..c1cdcf88ca 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -32,7 +32,7 @@ class ucp_profile
function main($id, $mode)
{
global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
- global $request, $phpbb_container;
+ global $request, $phpbb_container, $phpbb_dispatcher;
$user->add_lang('posting');
@@ -54,6 +54,17 @@ class ucp_profile
'password_confirm' => $request->variable('password_confirm', '', true),
);
+ /**
+ * Modify user registration data on editing account settings in UCP
+ *
+ * @event core.ucp_profile_reg_details_data
+ * @var array data Array with current or updated user registration data
+ * @var bool submit Flag indicating if submit button has been pressed
+ * @since 3.1.4-RC1
+ */
+ $vars = array('data', 'submit');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_data', compact($vars)));
+
add_form_key('ucp_reg_details');
if ($submit)
@@ -200,6 +211,17 @@ class ucp_profile
$sql_ary['user_newpasswd'] = '';
}
+ /**
+ * Modify user registration data before submitting it to the database
+ *
+ * @event core.ucp_profile_reg_details_sql_ary
+ * @var array data Array with current or updated user registration data
+ * @var array sql_ary Array with user registration data to submit to the database
+ * @since 3.1.4-RC1
+ */
+ $vars = array('data', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars)));
+
if (sizeof($sql_ary))
{
$sql = 'UPDATE ' . USERS_TABLE . '
@@ -285,6 +307,17 @@ class ucp_profile
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
}
+ /**
+ * Modify user data on editing profile in UCP
+ *
+ * @event core.ucp_profile_modify_profile_info
+ * @var array data Array with user profile data
+ * @var bool submit Flag indicating if submit button has been pressed
+ * @since 3.1.4-RC1
+ */
+ $vars = array('data', 'submit');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_profile_info', compact($vars)));
+
add_form_key('ucp_profile_info');
if ($submit)
@@ -341,6 +374,17 @@ class ucp_profile
$sql_ary['user_birthday'] = $data['user_birthday'];
}
+ /**
+ * Modify profile data in UCP before submitting to the database
+ *
+ * @event core.ucp_profile_info_modify_sql_ary
+ * @var array cp_data Array with the user custom profile fields data
+ * @var array data Array with user profile data
+ * @since 3.1.4-RC1
+ */
+ $vars = array('cp_data', 'data');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];