From 9d4e91ee598fa2b19cfc21acac18cb45d8702e39 Mon Sep 17 00:00:00 2001 From: mattab Date: Mon, 7 Oct 2013 14:08:56 +1300 Subject: Refactoring + improve Trusted Host message --- plugins/CorePluginsAdmin/PluginInstaller.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/CorePluginsAdmin/PluginInstaller.php') diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php index d284ff75c8..849b910e21 100644 --- a/plugins/CorePluginsAdmin/PluginInstaller.php +++ b/plugins/CorePluginsAdmin/PluginInstaller.php @@ -142,6 +142,11 @@ class PluginInstaller throw new PluginInstallerException('Plugin is not valid, the plugin.json file does not specify the plugin name.'); } + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $metadata->name)) { + throw new PluginInstallerException('The plugin name specified in plugin.json contains illegal characters. ' . + 'Plugin name can only contain following characters: [a-zA-Z0-9-_].'); + } + if (empty($metadata->version)) { throw new PluginInstallerException('Plugin is not valid, the plugin.json file does not specify the plugin version.'); } -- cgit v1.2.3