'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
--- /dev/null
+<?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
--- /dev/null
+<?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
\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
}\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
--- /dev/null
+<?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
\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