From eac45f9416be1b6caabb7ef00f78cb93234021a0 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 7 Jan 2011 14:34:57 +0000 Subject: Refs #2781 path checking in ElggPluginPackage constructor should work for both *nix and Windows now git-svn-id: http://code.elgg.org/elgg/trunk@7854 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginPackage.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index 422f777b9..c13345e67 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -93,7 +93,8 @@ class ElggPluginPackage { * @throws PluginException */ public function __construct($plugin, $validate = true) { - if (substr($plugin, 0, 1) == '/') { + $plugin_path = elgg_get_plugin_path(); + if (strpos($plugin, $plugin_path) === 0) { // this is a path $path = sanitise_filepath($plugin); @@ -107,7 +108,7 @@ class ElggPluginPackage { throw new PluginException(elgg_echo('PluginException:InvalidID', array($plugin))); } - $path = get_config('pluginspath') . "$plugin/"; + $path = "{$plugin_path}$plugin/"; $id = $plugin; } @@ -198,6 +199,11 @@ class ElggPluginPackage { * @return bool */ private function isSaneDeps() { + // protection against plugins with no manifest file + if (!$this->getManifest()) { + return false; + } + $conflicts = $this->getManifest()->getConflicts(); $requires = $this->getManifest()->getRequires(); $provides = $this->getManifest()->getProvides(); -- cgit v1.2.3