Fix spartacus problems with dependant plugins in the same path
authorgarvinhicking <garvinhicking>
Mon, 30 May 2005 08:51:51 +0000 (08:51 +0000)
committergarvinhicking <garvinhicking>
Mon, 30 May 2005 08:51:51 +0000 (08:51 +0000)
docs/NEWS
plugins/serendipity_event_spartacus/serendipity_event_spartacus.php

index 68acb1862d2c6e9d31179192145efad133d5c2e8..2de06b0529c899e5a8e5571dcc258259dcb58d92 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Spartacus plugin can now properly handle plugins which contain both
+      sidebar and event plugins in one directory (garvinhicking)
+
     * TEMPLATES: Added div.serendipity_section_(comments|trackbacks|commentform)
       containers inside the Default Template's entries.tpl file to be
       able to customize certain containers via CSS.
index ca58fefbb15036b609ba216162c8dc2c72d221ad..b9bd09ebd834a8ec42c3f6fa2f1c51c96e95663f 100644 (file)
@@ -23,7 +23,7 @@ switch ($serendipity['lang']) {
         @define('PLUGIN_EVENT_SPARTACUS_FETCHING', 'Versuche URL %s zu öffnen...');
         @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_URL', '%s bytes von obiger URL geladen. Speichere Inhalt als %s...');
         @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE', '%s bytes von bereits bestehender Datei geladen. Speichere Inhalt als %s...');
-        @define('PLUGIN_EVENT_SPARTACUS_FETCHED_DONE', 'Data successfully fetched.');
+        @define('PLUGIN_EVENT_SPARTACUS_FETCHED_DONE', 'Daten erfolgreich geladen.');
         break;
 
     case 'en':
@@ -51,7 +51,7 @@ class serendipity_event_spartacus extends serendipity_event
         $propbag->add('description',   PLUGIN_EVENT_SPARTACUS_DESC);
         $propbag->add('stackable',     false);
         $propbag->add('author',        'Garvin Hicking');
-        $propbag->add('version',       '1.1');
+        $propbag->add('version',       '1.2');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -335,6 +335,14 @@ class serendipity_event_spartacus extends serendipity_event
             $target = $pdir . $file;
             @mkdir($pdir . $plugin_to_install);
             $this->fetchfile($url, $target);
+            if (!isset($baseDir)) {
+                $baseDirs = explode('/', $file);
+                $baseDir  = $baseDirs[0];
+            }
+        }
+        
+        if (isset($baseDir)) {
+            return $baseDir;
         }
     }
 
@@ -376,8 +384,12 @@ class serendipity_event_spartacus extends serendipity_event
 
                 case 'backend_plugins_fetchplugin':
                     if (!empty($eventData['GET']['spartacus_fetch'])) {
-                        $this->download($this->fetchOnline($eventData['GET']['spartacus_fetch']), $eventData['GET']['install_plugin']);
-                        $eventData['GET']['pluginPath'] = $eventData['GET']['install_plugin'];
+                        $baseDir = $this->download($this->fetchOnline($eventData['GET']['spartacus_fetch']), $eventData['GET']['install_plugin']);
+                        if (!empty($baseDir)) {
+                            $eventData['GET']['pluginPath'] = $baseDir;
+                        } else {
+                            $eventData['GET']['pluginPath'] = $eventData['GET']['install_plugin'];
+                        }
                         
                         if ($eventData['GET']['spartacus_upgrade']) {
                             $eventData['install'] = false;