diff --git a/inc/load.php b/inc/load.php index ddd12b546beeec61e4e65b462bcabb23b609d455..b8a279523c53986b1236e8ae9041dfb730d93106 100644 --- a/inc/load.php +++ b/inc/load.php @@ -95,7 +95,7 @@ function load_autoload($name){ } // Plugin loading - if(preg_match('/^(helper|syntax|action|admin|renderer|remote)_plugin_([a-zA-Z0-9\x7f-\xff]+)(?:_([^_]+))?$/', + if(preg_match('/^(helper|syntax|action|admin|renderer|remote)_plugin_('.DOKU_PLUGIN_NAME_REGEX.')(?:_([^_]+))?$/', $name, $m)) { // try to load the wanted plugin file $c = ((count($m) === 4) ? "/{$m[3]}" : ''); diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 9d7b51e146f4a2ccb8d0334694c8b9f5bb863f3f..968d47a5c1c7db5cd6970ad72451c571325306df 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -156,7 +156,7 @@ class Doku_Plugin_Controller { } else { $all_plugins[$plugin] = 1; } - if ($all_plugins[$plugin] == 1 && preg_match('/^[a-zA-Z0-9\x7f-\xff]+$/', $plugin) !== 1) { + if ($all_plugins[$plugin] == 1 && preg_match('/^'.DOKU_PLUGIN_NAME_REGEX.'$/', $plugin) !== 1) { msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ". 'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1); } diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 53cfedf82b6edeb7df2c2efdcfb28205df9f3507..7c37d4f7ffefbff48d2aae99ed87cef67e22b961 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -8,6 +8,8 @@ // plugin related constants if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +// note that only [a-z0-9]+ is officially supported, this is only to support plugins that don't follow these conventions, too +if(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z0-9\x7f-\xff]+'); /** * Original plugin functions, remain for backwards compatibility