aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_extensions.php
diff options
context:
space:
mode:
authorjaviexin <javiexin@gmail.com>2016-12-11 21:15:30 +0100
committerjaviexin <javiexin@gmail.com>2016-12-11 21:15:30 +0100
commitaae6341989f479d13f3ead0bf5126335444bcf35 (patch)
treeaa8de4b6c525d4e656e46d6261f166b7225fcf10 /phpBB/includes/acp/acp_extensions.php
parent3322117c3863c443ca1b79d25541bde4c662c0ed (diff)
downloadforums-aae6341989f479d13f3ead0bf5126335444bcf35.tar
forums-aae6341989f479d13f3ead0bf5126335444bcf35.tar.gz
forums-aae6341989f479d13f3ead0bf5126335444bcf35.tar.bz2
forums-aae6341989f479d13f3ead0bf5126335444bcf35.tar.xz
forums-aae6341989f479d13f3ead0bf5126335444bcf35.zip
[ticket/14849] Add core.acp_extensions_run_action
Moved the event to a slightly modified position to perform common checks before calling the event, added an extra variable to allow execution control, honor the extension modified value of u_action (if any) PHPBB-14849
Diffstat (limited to 'phpBB/includes/acp/acp_extensions.php')
-rw-r--r--phpBB/includes/acp/acp_extensions.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 5a2ded91e2..4d00279474 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -56,6 +56,18 @@ class acp_extensions
$safe_time_limit = (ini_get('max_execution_time') / 2);
$start_time = time();
+ // Cancel action
+ if ($request->is_set_post('cancel'))
+ {
+ $action = 'list';
+ $ext_name = '';
+ }
+
+ if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($request->variable('hash', ''), $action . '.' . $ext_name))
+ {
+ trigger_error('FORM_INVALID', E_USER_WARNING);
+ }
+
/**
* Event to run a specific action on extension
*
@@ -65,22 +77,22 @@ class acp_extensions
* @var string ext_name Extension name from request
* @var int safe_time_limit Safe limit of execution time
* @var int start_time Start time
+ * @var string tpl_name Template file to load; leave empty to continue execution, filled in if ready to finish
* @since 3.1.11-RC1
*/
$u_action = $this->u_action;
- $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time');
+ $tpl_name = '';
+ $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name');
extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
- // Cancel action
- if ($request->is_set_post('cancel'))
- {
- $action = 'list';
- $ext_name = '';
- }
+ // In case they have been updated by the event
+ $this->u_action = $u_action;
+ $this->tpl_name = $tpl_name;
- if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($request->variable('hash', ''), $action . '.' . $ext_name))
+ // If tpl_name was set by the prior event, we are done
+ if ($tpl_name)
{
- trigger_error('FORM_INVALID', E_USER_WARNING);
+ return;
}
// If they've specified an extension, let's load the metadata manager and validate it.