From cacb9f2ec514f028ef7ccf35a3fa04b38bdac7ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 7 Oct 2011 09:44:31 +0200 Subject: [ticket/10400] Allow forum name to be '0' PHPBB3-10400 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 4d9b9f01e0..27bec3f1ea 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -875,7 +875,7 @@ class acp_forums $errors = array(); - if (!$forum_data['forum_name']) + if ($forum_data['forum_name'] == '') { $errors[] = $user->lang['FORUM_NAME_EMPTY']; } -- cgit v1.2.1 From fa23def7742b66b25a8c71e68d334f999624a84d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 29 Oct 2011 00:16:30 +0200 Subject: [ticket/10190] Do not show hint about permissions when editing forum settings. PHPBB3-10190 --- phpBB/includes/acp/acp_forums.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 27bec3f1ea..50e12a0f15 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -212,15 +212,11 @@ class acp_forums $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; - // Redirect to permissions - if ($auth->acl_get('a_fauth') && !$copied_permissions) - { - $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); - } - // redirect directly to permission settings screen if authed if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) { + $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); } -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/acp/acp_forums.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 7fe8915ad1..fad22fc285 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -2,9 +2,8 @@ /** * * @package acp -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From bb7a03f738c97dc225873691c459f2bf9e612ef6 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Wed, 27 Jul 2011 12:57:58 +0100 Subject: [ticket/10281] AJAXified reordering forums in the ACP. PHPBB3-10281 --- phpBB/includes/acp/acp_forums.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index fad22fc285..d3e2dbd904 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -255,6 +255,12 @@ class acp_forums add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name); $cache->destroy('sql', FORUMS_TABLE); } + + if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') + { + echo json_encode(array('success' => ($move_forum_name !== false))); + exit; + } break; -- cgit v1.2.1 From 94172b54dd09b28e19b4b12933b3f96e498d264a Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Fri, 19 Aug 2011 09:38:57 +0100 Subject: [ticket/10271] Changed AJAX functions to $request->is_ajax(). PHPBB3-10271 --- phpBB/includes/acp/acp_forums.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index d3e2dbd904..cb410e361a 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -25,7 +25,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $request; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; $user->add_lang('acp/forums'); @@ -256,7 +256,7 @@ class acp_forums $cache->destroy('sql', FORUMS_TABLE); } - if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') + if ($request->is_ajax()) { echo json_encode(array('success' => ($move_forum_name !== false))); exit; -- cgit v1.2.1 From dce38f44de04bd7a1f91f8e57f6d266bd5e1af86 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Fri, 19 Aug 2011 10:45:03 +0100 Subject: [ticket/10328] Added a JSON class. The JSON class adds a consistent way to send JSON to the client, making it perfect for AJAX (jQuery automatically parses it). PHPBB3-10328 --- phpBB/includes/acp/acp_forums.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index cb410e361a..6c05b1e108 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -258,8 +258,7 @@ class acp_forums if ($request->is_ajax()) { - echo json_encode(array('success' => ($move_forum_name !== false))); - exit; + JSON::send(array('success' => ($move_forum_name !== false))); } break; -- cgit v1.2.1 From 7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Wed, 24 Aug 2011 12:25:54 +0100 Subject: [ticket/10328] Renamed the JSON class, also now using autoloading. It is no longer static, and uses autoloading. It has also been renamed from JSON to phpbb_json_response. PHPBB3-10328 --- phpBB/includes/acp/acp_forums.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6c05b1e108..3a3b2021eb 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -258,7 +258,8 @@ class acp_forums if ($request->is_ajax()) { - JSON::send(array('success' => ($move_forum_name !== false))); + $json_response = new phpbb_json_response; + $json_response->send(array('success' => ($move_forum_name !== false))); } break; -- cgit v1.2.1 From eb7a04d32427d2070befdd10fcec657222bc8fa8 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 15 Mar 2012 21:06:44 +0000 Subject: [feature/events] Add core.acp_foruns_add_forum_data ledge PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 3a3b2021eb..f4d0a93b8d 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -220,6 +220,11 @@ class acp_forums } trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + + $vars = array('forum_data'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.acp_forums_add_forum_data', $event); + extract($event->get_data_filtered($vars)); } break; -- cgit v1.2.1 From 19a3164e80e9e34cab13d25f205789d7eb27aa66 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 15 Mar 2012 23:59:40 +0000 Subject: [feature/events] Fixing core.acp_forums_add_forum_data PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f4d0a93b8d..11843384ed 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -107,6 +107,11 @@ class acp_forums 'forum_id' => $forum_id ); + $vars = array('forum_data'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.acp_forums_add_forum_data', $event); + extract($event->get_data_filtered($vars)); + // No break here case 'add': @@ -220,11 +225,6 @@ class acp_forums } trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); - - $vars = array('forum_data'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.acp_forums_add_forum_data', $event); - extract($event->get_data_filtered($vars)); } break; -- cgit v1.2.1 From 8af7d225ef481cd26e6fd7862847183d25727117 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Tue, 20 Mar 2012 11:23:03 +0000 Subject: [feature/events] Change to use the new method of adding events PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 11843384ed..d86925dfab 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -108,9 +108,7 @@ class acp_forums ); $vars = array('forum_data'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.acp_forums_add_forum_data', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_add_forum_data', compact($vars), $vars)); // No break here -- cgit v1.2.1 From 3f1b4e83aef7f7344cd551463b59de71bb4bd6fe Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Sat, 31 Mar 2012 13:39:41 +0100 Subject: [feature/events] Removing the third trigger_event parameter PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index d86925dfab..f71e5f85b0 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -108,7 +108,7 @@ class acp_forums ); $vars = array('forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_add_forum_data', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_add_forum_data', compact($vars))); // No break here -- cgit v1.2.1 From 0f78b4699acd823f773214497f68840178a8b82e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 15:41:02 +0200 Subject: [feature/php-events] Replace core.acp_forums_add_forum_data Add missing global $phpbb_dispatcher, add $action and name the event better PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f71e5f85b0..b634a3d9a0 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -25,7 +25,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; $user->add_lang('acp/forums'); @@ -107,9 +107,6 @@ class acp_forums 'forum_id' => $forum_id ); - $vars = array('forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_add_forum_data', compact($vars))); - // No break here case 'add': @@ -153,6 +150,9 @@ class acp_forums 'forum_password_unset' => request_var('forum_password_unset', false), ); + $vars = array('action', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_modify_forum_data', compact($vars))); + // On add, add empty forum_options... else do not consider it (not updating it) if ($action == 'add') { -- cgit v1.2.1 From 2e5a7ae4dda587bc1f47f2f1fddb4e13235217d4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:22:22 +0200 Subject: [feature/php-events] Add additional events to acp_forums.php PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index b634a3d9a0..1c798a12da 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -151,7 +151,7 @@ class acp_forums ); $vars = array('action', 'forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_modify_forum_data', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_get_forum_data', compact($vars))); // On add, add empty forum_options... else do not consider it (not updating it) if ($action == 'add') @@ -416,6 +416,9 @@ class acp_forums $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); $forum_data['forum_password_confirm'] = $forum_data['forum_password']; + + $vars = array('forum_id', 'row', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_modify_forum_data', compact($vars))); } else { @@ -453,6 +456,9 @@ class acp_forums 'forum_password' => '', 'forum_password_confirm'=> '', ); + + $vars = array('forum_id', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_init_forum_data', compact($vars))); } } @@ -585,7 +591,7 @@ class acp_forums $errors[] = $user->lang['FORUM_PASSWORD_OLD']; } - $template->assign_vars(array( + $template_data = array( 'S_EDIT_FORUM' => true, 'S_ERROR' => (sizeof($errors)) ? true : false, 'S_PARENT_ID' => $this->parent_id, @@ -650,7 +656,12 @@ class acp_forums 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, - )); + ); + + $vars = array('forum_id', 'action', 'forum_data', 'template_data', 'old_forum_type', 'forum_desc_data', 'forum_rules_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_assign_template_forum_data', compact($vars))); + + $template->assign_vars($template_data); return; @@ -875,10 +886,13 @@ class acp_forums */ function update_forum_data(&$forum_data) { - global $db, $user, $cache, $phpbb_root_path; + global $db, $user, $cache, $phpbb_root_path, $phpbb_dispatcher; $errors = array(); + $vars = array('forum_data', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_update_forum_data', compact($vars))); + if ($forum_data['forum_name'] == '') { $errors[] = $user->lang['FORUM_NAME_EMPTY']; @@ -1242,6 +1256,9 @@ class acp_forums add_log('admin', 'LOG_FORUM_EDIT', $forum_data['forum_name']); } + $vars = array('forum_data', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_update_forum_data_after', compact($vars))); + return $errors; } @@ -1250,10 +1267,13 @@ class acp_forums */ function move_forum($from_id, $to_id) { - global $db, $user; + global $db, $user, $phpbb_dispatcher; $to_data = $moved_ids = $errors = array(); + $vars = array('from_id', 'to_id'); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_move_forum', compact($vars))); + // Check if we want to move to a parent with link type if ($to_id > 0) { -- cgit v1.2.1 From b1582ece91e7ebd9f635040bbb1a4c6c47786135 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:42:47 +0200 Subject: [feature/php-events] Proper name for request forum data to avoid confusion PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 1c798a12da..6631edf438 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -151,7 +151,7 @@ class acp_forums ); $vars = array('action', 'forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_get_forum_data', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.acp_forums_request_forum_data', compact($vars))); // On add, add empty forum_options... else do not consider it (not updating it) if ($action == 'add') -- cgit v1.2.1 From e3a9bf0376a9e4d6e9f5730e5118d11ce75296bd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 17:43:46 +0200 Subject: [feature/php-events] Fix doc and naming of core.acp_forums_request_forum_data PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6631edf438..564181be9e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -150,8 +150,16 @@ class acp_forums 'forum_password_unset' => request_var('forum_password_unset', false), ); + /** + * Request forum data and operate on it (parse texts, etc.) + * + * @event core.acp_manage_forums_request_data + * @var string action Type of the action: add|edit + * @var array forum_data Array with new forum data + * @since 3.1-A1 + */ $vars = array('action', 'forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_request_forum_data', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_request_data', compact($vars))); // On add, add empty forum_options... else do not consider it (not updating it) if ($action == 'add') -- cgit v1.2.1 From 38ba09e707c1fd97fe79d6b8165e1315346cbfef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 12:01:09 +0200 Subject: [feature/php-events] Fix naming and doc of acp_manage_forums_initialise_data PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 564181be9e..54085d856b 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -397,6 +397,9 @@ class acp_forums $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; } + // Initialise $row, so we always have it in the event + $row = array(); + // Show form to create/modify a forum if ($action == 'edit') { @@ -424,9 +427,6 @@ class acp_forums $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); $forum_data['forum_password_confirm'] = $forum_data['forum_password']; - - $vars = array('forum_id', 'row', 'forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_modify_forum_data', compact($vars))); } else { @@ -464,12 +464,27 @@ class acp_forums 'forum_password' => '', 'forum_password_confirm'=> '', ); - - $vars = array('forum_id', 'forum_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_init_forum_data', compact($vars))); } } + /** + * Initialise data before we display the add/edit form + * + * @event core.acp_manage_forums_initialise_data + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @since 3.1-A1 + */ + $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_initialise_data', compact($vars))); + $forum_rules_data = array( 'text' => $forum_data['forum_rules'], 'allow_bbcode' => true, -- cgit v1.2.1 From 3beda0cbabe704b661e3d810db4c62a8d28a6bd6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 12:44:28 +0200 Subject: [feature/php-events] Fix naming and doc of core.acp_manage_forums_display_form PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 54085d856b..c9225744bf 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -681,8 +681,27 @@ class acp_forums 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, ); - $vars = array('forum_id', 'action', 'forum_data', 'template_data', 'old_forum_type', 'forum_desc_data', 'forum_rules_data'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_assign_template_forum_data', compact($vars))); + /** + * Modify forum template data before we display the form + * + * @event core.acp_manage_forums_display_form + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @var array errors Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @var array template_data Array with new forum data + * @since 3.1-A1 + */ + $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list', 'errors', 'template_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_display_form', compact($vars))); $template->assign_vars($template_data); -- cgit v1.2.1 From caf76b4cebccbfd7e348c89f7bce8d731fa2fd43 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 12:50:47 +0200 Subject: [feature/php-events] Fix naming and doc of core.acp_manage_forums_validate_data PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index c9225744bf..7af2fb822e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -932,8 +932,17 @@ class acp_forums $errors = array(); + /** + * Validate the forum data before we create/update the forum + * + * @event core.acp_manage_forums_validate_data + * @var array forum_data Array with new forum data + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1-A1 + */ $vars = array('forum_data', 'errors'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_update_forum_data', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); if ($forum_data['forum_name'] == '') { -- cgit v1.2.1 From cfd5fcbe2609024f57c900435b02346d5c7e28e0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 12:58:20 +0200 Subject: [feature/php-events] Add new event core.acp_manage_forums_update_data_before Allows you to remove data from forum_data_sql before we update/create the forum PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 7af2fb822e..151e03f18f 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1036,7 +1036,25 @@ class acp_forums } unset($forum_data_sql['forum_password_unset']); - if (!isset($forum_data_sql['forum_id'])) + $is_new_forum = !isset($forum_data_sql['forum_id']); + + /** + * Remove invalid values from forum_data_sql that should not be updated + * + * @event core.acp_manage_forums_update_data_before + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we are going to update + * @var bool is_new_forum Do we create a forum or update one + * If you want to overwrite this value, + * ensure to set forum_data_sql[forum_id] + * @since 3.1-A1 + */ + $vars = array('forum_data', 'forum_data_sql'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); + + $is_new_forum = !isset($forum_data_sql['forum_id']); + + if ($is_new_forum) { // no forum_id means we're creating a new forum unset($forum_data_sql['type_action']); -- cgit v1.2.1 From 70c90bea4f8ba6cc0c4f34f2f55f8171f1b7ba87 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 13:06:20 +0200 Subject: [feature/php-events] Fix doc and naming of acp_manage_forums_update_data_after PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 151e03f18f..542c3ffd77 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1325,8 +1325,21 @@ class acp_forums add_log('admin', 'LOG_FORUM_EDIT', $forum_data['forum_name']); } - $vars = array('forum_data', 'errors'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_update_forum_data_after', compact($vars))); + /** + * Event after a forum was updated or created + * + * @event core.acp_manage_forums_update_data_after + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we updated + * @var bool is_new_forum Did we create a forum or update one + * If you want to overwrite this value, + * ensure to set forum_data_sql[forum_id] + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1-A1 + */ + $vars = array('forum_data', 'forum_data_sql' 'is_new_forum', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); return $errors; } -- cgit v1.2.1 From 43d17b2337eefa0530dea57516138eaf9724862b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 13:16:18 +0200 Subject: [feature/php-events] Fix doc and naming of core.acp_manage_forums_move_children PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 542c3ffd77..d6d8879f7b 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1353,9 +1353,6 @@ class acp_forums $to_data = $moved_ids = $errors = array(); - $vars = array('from_id', 'to_id'); - extract($phpbb_dispatcher->trigger_event('core.acp_forums_move_forum', compact($vars))); - // Check if we want to move to a parent with link type if ($to_id > 0) { @@ -1364,10 +1361,30 @@ class acp_forums if ($to_data['forum_type'] == FORUM_LINK) { $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; - return $errors; } } + /** + * Event when we move all children of one forum to another + * + * This event may be triggered, when a forum is deleted + * + * @event core.acp_manage_forums_move_children + * @var int from_id If of the current parent forum + * @var int to_id If of the new parent forum + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1-A1 + */ + $vars = array('from_id', 'to_id', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_children', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } + $moved_forums = get_forum_branch($from_id, 'children', 'descending'); $from_data = $moved_forums[0]; $diff = sizeof($moved_forums) * 2; -- cgit v1.2.1 From cdcadf72c4d613e262a06589e7dfe4c81803344c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Aug 2012 13:20:34 +0200 Subject: [feature/php-events] Add event core.acp_manage_forums_move_content PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index d6d8879f7b..6fb246458c 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1464,7 +1464,30 @@ class acp_forums */ function move_forum_content($from_id, $to_id, $sync = true) { - global $db; + global $db, $phpbb_dispatcher; + + $errors = array(); + + /** + * Event when we move content from one forum to another + * + * @event core.acp_manage_forums_move_children + * @var int from_id If of the current parent forum + * @var int to_id If of the new parent forum + * @var bool sync Shall we sync the "to"-forum's data + * @var array errors Array of errors, should be strings and not + * language key. If this array is not empty, + * The content will not be moved. + * @since 3.1-A1 + */ + $vars = array('from_id', 'to_id', 'sync', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); -- cgit v1.2.1 From b32d5a3edf418e2c9cdfa8cbe027c9da7e31d2f6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 18 Aug 2012 20:25:11 +0200 Subject: [feature/php-events] Fix core.acp_manage_forums_update_data_after vars PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6fb246458c..39bc7e39ad 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1338,7 +1338,7 @@ class acp_forums * language key. * @since 3.1-A1 */ - $vars = array('forum_data', 'forum_data_sql' 'is_new_forum', 'errors'); + $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); return $errors; -- cgit v1.2.1 From 90ed6e734d7a8587e73fb0e37251982adc8d10ab Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 18 Aug 2012 20:28:14 +0200 Subject: [feature/php-events] Fix acp_manage_forums_update_data_before and is_new_forum PHPBB3-9550 --- phpBB/includes/acp/acp_forums.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_forums.php') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 39bc7e39ad..c6dbf5eb9c 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1036,17 +1036,14 @@ class acp_forums } unset($forum_data_sql['forum_password_unset']); - $is_new_forum = !isset($forum_data_sql['forum_id']); - /** * Remove invalid values from forum_data_sql that should not be updated * * @event core.acp_manage_forums_update_data_before * @var array forum_data Array with forum data * @var array forum_data_sql Array with data we are going to update - * @var bool is_new_forum Do we create a forum or update one - * If you want to overwrite this value, - * ensure to set forum_data_sql[forum_id] + * If forum_data_sql[forum_id] is set, we update + * that forum, otherwise a new one is created. * @since 3.1-A1 */ $vars = array('forum_data', 'forum_data_sql'); -- cgit v1.2.1