]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added in skeleton for image and album classes
authorCash Costello <cash.costello@gmail.com>
Sun, 21 Jun 2009 22:42:39 +0000 (22:42 +0000)
committerCash Costello <cash.costello@gmail.com>
Sun, 21 Jun 2009 22:42:39 +0000 (22:42 +0000)
languages/en.php
lib/album.php [new file with mode: 0644]
lib/image.php [new file with mode: 0644]
start.php
thumbnail.php
upgrade.php [new file with mode: 0644]
views/default/tidypics/settings.php

index fb7fa7182b49efbe4e7c33e11b61bd7049db8b98..355f9660b5ab7adc8d0fd16093308dde2b6fac57 100644 (file)
                        'album:delete:confirm' => "Are you sure you want to delete this album?",\r
                        'album:created' => "Your new album has been created.",\r
                        'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',\r
+                       \r
+                       'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',\r
                                \r
                //Error messages\r
                                 \r
                        'album:none' => "No albums have been created yet.",\r
                        'album:uploadfailed' => "Sorry; we could not save your album.",\r
                        'album:deletefailed' => "Your album could not be deleted at this time.",\r
-                       'album:blank' => "Please give this album a title and description."\r
+                       'album:blank' => "Please give this album a title and description.",\r
+                       \r
+                       'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",\r
        );\r
                                        \r
        add_translation("en",$english);\r
diff --git a/lib/album.php b/lib/album.php
new file mode 100644 (file)
index 0000000..7e03ed6
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+       /**
+        * Tidypics Album class
+        * 
+        */
+
+
+       class TidypicsAlbum extends ElggObject
+       {
+               protected function initialise_attributes()
+               {
+                       parent::initialise_attributes();
+                       
+                       $this->attributes['subtype'] = "album";
+               }
+               
+               public function __construct($guid = null) 
+               {
+                       parent::__construct($guid);
+               }
+       }
+       
+?>
\ No newline at end of file
diff --git a/lib/image.php b/lib/image.php
new file mode 100644 (file)
index 0000000..3a23a19
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+       /**
+        * Tidypics Image class
+        * 
+        */
+
+
+       class TidypicsImage extends ElggFile
+       {
+               protected function initialise_attributes()
+               {
+                       parent::initialise_attributes();
+                       
+                       $this->attributes['subtype'] = "image";
+               }
+               
+               public function __construct($guid = null) 
+               {
+                       parent::__construct($guid);
+               }
+       }
+       
+?>
\ No newline at end of file
index 24423dafddde05e3f6566e4ccb251e8573ec6d20..e2a87a8e8c8757a7607daa420a579febd24e5de6 100644 (file)
--- a/start.php
+++ b/start.php
@@ -10,7 +10,8 @@
 \r
        // include core libraries\r
        include dirname(__FILE__) . "/lib/tidypics.php";\r
-       \r
+       include dirname(__FILE__) . "/lib/image.php";\r
+       include dirname(__FILE__) . "/lib/album.php";\r
        \r
        /**\r
         * tidypics plugin initialisation functions.\r
                register_entity_url_handler('tidypics_image_url', 'object', 'image');\r
                register_entity_url_handler('tidypics_album_url', 'object', 'album');\r
 \r
+               // add the class files for image and album\r
+               add_subtype("object", "image", "TidypicsImage");\r
+               add_subtype("object", "album", "TidypicsAlbum");\r
+\r
                // Register entity type\r
                register_entity_type('object','image');\r
                register_entity_type('object','album');\r
index 688d400af779f2763da6a80430ead925ec592123..eaca0849f078bad0f3f66e41300b4af2efe44229 100644 (file)
@@ -62,7 +62,7 @@
        }\r
 \r
        // Return the thumbnail and exit\r
-       $mime = $file->mimetype;\r
+       $mime = $file->getMimeType();\r
        header("Content-type: $mime");\r
        echo $contents;\r
        exit;\r
diff --git a/upgrade.php b/upgrade.php
new file mode 100644 (file)
index 0000000..7fc3187
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+/********************************************
+ *
+ * Upgrade from Tidypics 1.5 to 1.6
+ *
+ *********************************************/
+
+       include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+       $result = true;
+       
+       // add image class
+       $id = get_subtype_id("object", "image"); 
+       if ($id != 0) {
+               $table = $CONFIG->dbprefix . 'entity_subtypes';
+               $result = update_data("UPDATE {$table} set class='TidypicsImage' where id={$id}");
+               if (!result) {
+                       register_error(elgg_echo('tidypics:upgrade:failed'));
+                       forward($_SERVER['HTTP_REFERER']);
+               }
+       }
+
+       // add album class
+       $id = get_subtype_id("object", "album"); 
+       if ($id != 0) {
+               $table = $CONFIG->dbprefix . 'entity_subtypes';
+               $result = update_data("UPDATE {$table} set class='TidypicsAlbum' where id={$id}");
+               if (!result) {
+                       register_error(elgg_echo('tidypics:upgrade:failed'));
+                       forward($_SERVER['HTTP_REFERER']);
+               }
+       }
+
+       system_message(elgg_echo('tidypics:upgrade:success'));
+       
+       forward($_SERVER['HTTP_REFERER']);
+?>
\ No newline at end of file
index e69d6d3066604e07e3e06fa240317106d9a1098e..c8d12d861f8f5292e59af44bfea5131c60cc97a9 100644 (file)
@@ -4,8 +4,20 @@
        \r
        global $CONFIG;  \r
        $system_url = $CONFIG->wwwroot . 'mod/tidypics/system.php';\r
+       $upgrade_url = $CONFIG->wwwroot . 'mod/tidypics/upgrade.php';\r
+       \r
+       $upgrade = false;\r
+       if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album'))\r
+               $upgrade = true;\r
 ?>\r
 <p>\r
+<?php\r
+       if ($upgrade) {\r
+?>\r
+<a href="<?php echo $upgrade_url; ?>">Upgrade</a><br />\r
+<?php\r
+       }\r
+?>\r
 <a href="<?php echo $system_url; ?>">Run Server Analysis</a>\r
 </p>\r
 <?php\r