From b0383a90e1416d14fd5461b4d148386f3cdb4ac4 Mon Sep 17 00:00:00 2001 From: paulsohier <paul999@phpbb.com> Date: Sat, 24 Jan 2015 18:53:33 +0100 Subject: [PATCH 1/3] [ticket/13542] Update core.ucp_prefs_personal_data to include $error Update the event so extensions will be able to validate (and deny) changes. PHPBB3-13542 --- phpBB/includes/ucp/ucp_prefs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 2195500b57..111e16685a 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 */ - $vars = array('submit', 'data'); + $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars))); if ($submit) From c86e5e8514055ade4cdf17d63feaf450d1e8bd69 Mon Sep 17 00:00:00 2001 From: paulsohier <paul999@phpbb.com> Date: Sat, 24 Jan 2015 19:04:26 +0100 Subject: [PATCH 2/3] [ticket/13542] Merge result of validation into existing $error Because extensions can set a entry in $error, the result of the validate needs to be merged into it. PHPBB3-13542 --- phpBB/includes/ucp/ucp_prefs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 111e16685a..6a990e2e0f 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -85,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')) { From 0cfa9779532e820ee9d0e40376f7587634dc2417 Mon Sep 17 00:00:00 2001 From: paulsohier <paul999@phpbb.com> Date: Sat, 24 Jan 2015 20:26:51 +0100 Subject: [PATCH 3/3] [ticket/13542] Added sentenence of what is changed in the event PHPBB3-13542 --- phpBB/includes/ucp/ucp_prefs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 6a990e2e0f..1d3fb19f67 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -69,7 +69,7 @@ class ucp_prefs * @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 + * @changed 3.1.4-rc1 Added error variable to the event */ $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));