]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2781 path checking in ElggPluginPackage constructor should work for both *nix...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 7 Jan 2011 14:34:57 +0000 (14:34 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 7 Jan 2011 14:34:57 +0000 (14:34 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7854 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggPluginPackage.php

index 422f777b930edd0a36d38fc932d2a312c9bd5160..c13345e67862f7a063a5a1ac4ab019e182634014 100644 (file)
@@ -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();