[pLog-svn] r5521 - in plugins/branches/lifetype-1.2: . randomimage unported

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sun Jun 10 23:58:28 EDT 2007


Author: jondaley
Date: 2007-06-10 23:58:28 -0400 (Sun, 10 Jun 2007)
New Revision: 5521

Added:
   plugins/branches/lifetype-1.2/randomimage/
Removed:
   plugins/branches/lifetype-1.2/unported/randomimage/
Modified:
   plugins/branches/lifetype-1.2/randomimage/pluginrandomimage.class.php
   plugins/branches/lifetype-1.2/randomimage/readme.txt
Log:
ported to 1.2, and bug #1214 fixed, images now grabbed from correct blog

Copied: plugins/branches/lifetype-1.2/randomimage (from rev 5520, plugins/branches/lifetype-1.2/unported/randomimage)

Modified: plugins/branches/lifetype-1.2/randomimage/pluginrandomimage.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/randomimage/pluginrandomimage.class.php	2007-06-11 03:56:05 UTC (rev 5520)
+++ plugins/branches/lifetype-1.2/randomimage/pluginrandomimage.class.php	2007-06-11 03:58:28 UTC (rev 5521)
@@ -1,23 +1,23 @@
 <?php
 
     lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-    lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
-    lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
 
-define("RANDOMIMAGE_DEBUG", 0);
+define("RANDOMIMAGE_DEBUG", 1);
 
     /**
      * Plugin returns a randomly selected image from a given album
      */
     class PluginRandomImage extends PluginBase
     {
-        function PluginRandomImage(){
-            $this->PluginBase();
+        function PluginRandomImage($source=""){
+            $this->PluginBase($source);
   
             $this->id = "randomimage";
             $this->author = "Jon Daley";
-            $this->desc = "This plugin offers a random image from a specific album.";
-  
+            $this->desc = "This plugin offers a random image ".
+                "from a specific album.";
+            $this->version = "20070710";
+            
             $this->locales = Array( "en_UK" );
         }
 
@@ -26,8 +26,12 @@
          * previewType can be "PREVIEW", "MEDIUM" or "FULL"
          */
         function getImage($albumName, $previewType){
+            lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+
+            $blogId = $this->blogInfo->getId();
+
             $albums = new GalleryAlbums();
-            $album = $albums->getAlbumByName($albumName);
+            $album = $albums->getAlbumByName($albumName, $blogId);
             if(!$album){
                 if(RANDOMIMAGE_DEBUG)
                     return "no album '$albumName'";
@@ -37,13 +41,13 @@
 
             $resources = new GalleryResources();
 
+                // get number of images in this album
             $numResources = $resources->getNumUserResources(
-                $this->blogInfo->getOwner(), $album->getId(), GALLERY_RESOURCE_IMAGE);
+                -1, $album->getId(), GALLERY_RESOURCE_IMAGE);
                 
             if($numResources <= 0){
                 if(RANDOMIMAGE_DEBUG)
-                    return "no resources in album: ".
-                        $this->blogInfo->getOwner()." ". $album->getId()." ".GALLERY_RESOURCE_IMAGE;
+                    return ("no resources in album: ". $album->getId());
                 else
                     return "";
             }

Modified: plugins/branches/lifetype-1.2/randomimage/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/unported/randomimage/readme.txt	2007-06-11 03:56:05 UTC (rev 5520)
+++ plugins/branches/lifetype-1.2/randomimage/readme.txt	2007-06-11 03:58:28 UTC (rev 5521)
@@ -1,9 +1,7 @@
 Random Image plugin for LifeType
 Author: Jon Daley
 Contact URL: http://limedaley.com/
-Version: 1.1
 
-
 Example URL using this plugin: http://groshlink.net/ 
   (click into any of the categories to see the images on the right)
 



More information about the pLog-svn mailing list