diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-10 14:08:19 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-09-12 13:29:34 +0200 |
commit | 4ff703e3691e6cb398e8d208c1f54ed61315e0e8 (patch) | |
tree | dc70aab63e4b5c0ff88736cec065eed60c94d7d2 /application/plugin | |
parent | e2dff28b44fafcf11a1db7985c50cd40e6945821 (diff) | |
download | Shaarli-4ff703e3691e6cb398e8d208c1f54ed61315e0e8.tar.gz Shaarli-4ff703e3691e6cb398e8d208c1f54ed61315e0e8.tar.zst Shaarli-4ff703e3691e6cb398e8d208c1f54ed61315e0e8.zip |
Plugins: do not save metadata along plugin parameters
Also prevent the token to be saved.
Fixes #1550
Diffstat (limited to 'application/plugin')
-rw-r--r-- | application/plugin/PluginManager.php | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/application/plugin/PluginManager.php b/application/plugin/PluginManager.php index 7881e3be..1b2197c9 100644 --- a/application/plugin/PluginManager.php +++ b/application/plugin/PluginManager.php | |||
@@ -100,20 +100,17 @@ class PluginManager | |||
100 | */ | 100 | */ |
101 | public function executeHooks($hook, &$data, $params = array()) | 101 | public function executeHooks($hook, &$data, $params = array()) |
102 | { | 102 | { |
103 | if (!empty($params['target'])) { | 103 | $metadataParameters = [ |
104 | $data['_PAGE_'] = $params['target']; | 104 | 'target' => '_PAGE_', |
105 | } | 105 | 'loggedin' => '_LOGGEDIN_', |
106 | 106 | 'basePath' => '_BASE_PATH_', | |
107 | if (isset($params['loggedin'])) { | 107 | 'bookmarkService' => '_BOOKMARK_SERVICE_', |
108 | $data['_LOGGEDIN_'] = $params['loggedin']; | 108 | ]; |
109 | } | 109 | |
110 | 110 | foreach ($metadataParameters as $parameter => $metaKey) { | |
111 | if (isset($params['basePath'])) { | 111 | if (array_key_exists($parameter, $params)) { |
112 | $data['_BASE_PATH_'] = $params['basePath']; | 112 | $data[$metaKey] = $params[$parameter]; |
113 | } | 113 | } |
114 | |||
115 | if (isset($params['bookmarkService'])) { | ||
116 | $data['_BOOKMARK_SERVICE_'] = $params['bookmarkService']; | ||
117 | } | 114 | } |
118 | 115 | ||
119 | foreach ($this->loadedPlugins as $plugin) { | 116 | foreach ($this->loadedPlugins as $plugin) { |
@@ -128,6 +125,10 @@ class PluginManager | |||
128 | } | 125 | } |
129 | } | 126 | } |
130 | } | 127 | } |
128 | |||
129 | foreach ($metadataParameters as $metaKey) { | ||
130 | unset($data[$metaKey]); | ||
131 | } | ||
131 | } | 132 | } |
132 | 133 | ||
133 | /** | 134 | /** |