aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
committerCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
commit4e0c1576475390faa2f1fb4c4dc2902a953f440e (patch)
treecd3a47df019344d7f6c938ebe31c60cfa9b03677
downloadelgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.gz
elgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.bz2
First commit
-rw-r--r--actions/addalbum.php72
-rw-r--r--actions/delete.php105
-rw-r--r--actions/download.php43
-rw-r--r--actions/edit_multi.php62
-rw-r--r--actions/editalbum.php91
-rw-r--r--actions/icon.php41
-rw-r--r--actions/upload.php133
-rw-r--r--contributions.txt170
-rw-r--r--edit.php46
-rw-r--r--edit_multi.php33
-rw-r--r--friends.php43
-rw-r--r--graphics/Thumbs.dbbin0 -> 18944 bytes
-rw-r--r--graphics/arrow_next.gifbin0 -> 304 bytes
-rw-r--r--graphics/arrow_previous.gifbin0 -> 306 bytes
-rw-r--r--graphics/bl.gifbin0 -> 215 bytes
-rw-r--r--graphics/br.gifbin0 -> 217 bytes
-rw-r--r--graphics/btnClose.gifbin0 -> 361 bytes
-rw-r--r--graphics/btnContract.gifbin0 -> 188 bytes
-rw-r--r--graphics/btnExpand.gifbin0 -> 192 bytes
-rw-r--r--graphics/btnNext.gifbin0 -> 308 bytes
-rw-r--r--graphics/btnPrevious.gifbin0 -> 317 bytes
-rw-r--r--graphics/icons/Thumbs.dbbin0 -> 24064 bytes
-rw-r--r--graphics/icons/album.gifbin0 -> 1411 bytes
-rw-r--r--graphics/icons/general.jpgbin0 -> 7036 bytes
-rw-r--r--graphics/icons/general.pngbin0 -> 7177 bytes
-rw-r--r--graphics/icons/river_icon_album.gifbin0 -> 398 bytes
-rw-r--r--graphics/icons/river_icon_image.gifbin0 -> 284 bytes
-rw-r--r--graphics/img_error.jpgbin0 -> 5864 bytes
-rw-r--r--graphics/loader.gifbin0 -> 2545 bytes
-rw-r--r--graphics/tl.gifbin0 -> 214 bytes
-rw-r--r--graphics/tr.gifbin0 -> 217 bytes
-rw-r--r--graphics/ttl.gifbin0 -> 288 bytes
-rw-r--r--graphics/ttp.gifbin0 -> 192 bytes
-rw-r--r--graphics/ttr.gifbin0 -> 288 bytes
-rw-r--r--index.php45
-rw-r--r--languages/de.php114
-rw-r--r--languages/en.php115
-rw-r--r--languages/es.php115
-rw-r--r--languages/pl.php115
-rw-r--r--manifest.xml9
-rw-r--r--newalbum.php31
-rw-r--r--start.php174
-rw-r--r--tasks.txt66
-rw-r--r--thumbnail.php55
-rw-r--r--tidypics_user_instructions_.txt71
-rw-r--r--upload.php49
-rw-r--r--view.php62
-rw-r--r--views/default/input/accessRead.php61
-rw-r--r--views/default/input/cover_checkbox.php45
-rw-r--r--views/default/input/multi_radio.php42
-rw-r--r--views/default/object/album.php137
-rw-r--r--views/default/object/image.php130
-rw-r--r--views/default/river/object/album/annotate.php13
-rw-r--r--views/default/river/object/album/create.php13
-rw-r--r--views/default/river/object/image/annotate.php13
-rw-r--r--views/default/river/object/image/create.php13
-rw-r--r--views/default/settings/tidypics/edit.php10
-rw-r--r--views/default/tidypics/css.php128
-rw-r--r--views/default/tidypics/forms/edit.php115
-rw-r--r--views/default/tidypics/forms/edit_multi.php44
-rw-r--r--views/default/tidypics/forms/upload.php79
-rw-r--r--views/default/tidypics/groupprofile_albums.php60
-rw-r--r--views/default/tidypics/icon.php41
-rw-r--r--views/default/tidypics/menu.php16
-rw-r--r--views/default/widgets/album_view/edit.php21
-rw-r--r--views/default/widgets/album_view/view.php53
-rw-r--r--views/rss/object/file.php30
-rw-r--r--world.php37
68 files changed, 2961 insertions, 0 deletions
diff --git a/actions/addalbum.php b/actions/addalbum.php
new file mode 100644
index 000000000..127885270
--- /dev/null
+++ b/actions/addalbum.php
@@ -0,0 +1,72 @@
+<?php
+ /**
+ * Elgg blog: add post action
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ if (!isloggedin()) forward();
+
+ // Get input data
+ $title = get_input('albumtitle');
+ $body = get_input('albumbody');
+ $tags = get_input('albumtags');
+ $access = get_input('access_id');
+ $container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
+ $back_url = 'pg/photos/new/' . get_entity($container_guid)->username;
+
+ // Cache to the session
+ $_SESSION['albumtitle'] = $title;
+ $_SESSION['albumbody'] = $body;
+ $_SESSION['albumtags'] = $tags;
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags);
+ // Make sure the title / description aren't blank
+ if (empty($title) || empty($body)) {
+ register_error(elgg_echo("album:blank"));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page
+
+ // Otherwise, save the blog post
+ } else {
+
+ // Initialise a new ElggObject
+ $album = new ElggObject();
+ // Tell the system it's an album
+ $album->subtype = "album";
+
+ // Set its owner to the current user
+ $album->container_guid = $container_guid;
+ $album->owner_guid = $_SESSION['user']->getGUID();
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $album->access_id = $access;
+ // Set its title and description appropriately
+ $album->title = $title;
+ $album->description = $body;
+ // Before we can set metadata, we need to save the blog post
+ if (!$album->save()) {
+ register_error(elgg_echo("album:error"));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page
+ }
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ if (is_array($tagarray)) {
+ $album->tags = $tagarray;
+ }
+ // Success message
+ system_message(elgg_echo("album:created"));
+ // Remove the blog post cache
+ unset($_SESSION['albumtitle']);
+ unset($_SESSION['albumbody']);
+ unset($_SESSION['albumtags']);
+ // Forward to the main blog page
+
+ forward("pg/photos/upload/" . $album->guid);
+
+ }
+
+?> \ No newline at end of file
diff --git a/actions/delete.php b/actions/delete.php
new file mode 100644
index 000000000..6b8789fb4
--- /dev/null
+++ b/actions/delete.php
@@ -0,0 +1,105 @@
+<?php
+
+ /**
+ * Elgg file delete
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ //if not logged in, see world pictures instead
+ if (!isloggedin()) forward('pg/photos/world');
+
+ $guid = (int) get_input('file');
+ $forward_url = 'pg/photos/world'; //forward to world pictures if there is an unknown error
+
+ if ($photoObject = get_entity($guid)) {
+ if ($photoObject->canEdit()) {
+ $subtype = $photoObject->getSubtype();
+ $container = get_entity($photoObject->container_guid);
+
+ if ($subtype!='image' && $subtype!='album') forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //back off if not an album or image
+
+ if ($subtype == 'image') { //deleting an image
+ $forward_url = $container->getURL(); //forward back to album after deleting pictures
+ $images = array($photoObject);
+ } else { //deleting an album
+ $forward_url = 'pg/photos/owned/' . $container->username;
+ $images = get_entities("object","image", $guid, '', 999); //get all the images from this album, or the image requested
+ } //end of subtype comparison
+
+ //loop through all images and delete them
+ foreach($images as $im) {
+ $thumbnail = $im->thumbnail;
+ $smallthumb = $im->smallthumb;
+ $largethumb = $im->largethumb;
+
+ if ($thumbnail) { //delete standard thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($thumbnail);
+ $delfile->delete();
+ }
+ if ($smallthumb) { //delete small thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($smallthumb);
+ $delfile->delete();
+ }
+ if ($largethumb) { //delete large thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($largethumb);
+ $delfile->delete();
+ }
+ if ($im) { //delete actual image file
+ $delfile = new ElggFile($im->getGUID());
+ $delfile->owner_guid = $im->getOwner();
+ //$delfile->setFilename($im->originalfilename);
+ if (!$delfile->delete()) {
+ if ($subtype=='image') register_error(elgg_echo("file:deletefailed")); //unable to delete object
+ } else {
+ if ($subtype=='image') system_message(elgg_echo("file:deleted")); //successfully deleted object
+ }
+ } //end delete actual image file
+ } //end looping through each image to delete it
+
+ //now that all images have been deleted, delete the album
+ if ($subtype=='album') {
+ //delete the album's directory manually; first create a temp file to get the directory path
+ $tmpfile = new ElggFile();
+ $tmpfile->setFilename('image/' . $guid . '/._tmp_del_tidypics_album_');
+ $tmpfile->subtype = 'image';
+ $tmpfile->container_guid = $guid;
+ $tmpfile->open("write");
+ $tmpfile->write('');
+ $tmpfile->close();
+ $tmpfile->save();
+ $albumdir = eregi_replace('/._tmp_del_tidypics_album_', '', $tmpfile->getFilenameOnFilestore());
+ $tmpfile->delete();
+ if (is_dir($albumdir))
+ rmdir($albumdir);
+
+ //delete object from database
+ if (!$photoObject->delete()) {
+ register_error(elgg_echo("file:deletefailed")); //unable to delete object
+ } else {
+ system_message(elgg_echo("file:deleted")); //successfully deleted object
+ }
+ } //end of delete album
+
+
+ } else { //user does not have permissions to delete this image or album
+ $container = $_SESSION['user'];
+ register_error(elgg_echo("file:deletefailed"));
+ } //end of canEdit() comparison
+
+ } else { // unable to get Elgg entity
+ register_error(elgg_echo("file:deletefailed"));
+ } //end of get_entitty()
+
+ forward($forward_url);
+
+?> \ No newline at end of file
diff --git a/actions/download.php b/actions/download.php
new file mode 100644
index 000000000..31f21f0f5
--- /dev/null
+++ b/actions/download.php
@@ -0,0 +1,43 @@
+<?php
+ /**
+ * Elgg file browser download action.
+ *
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+
+ $file_guid = (int) get_input("file_guid");
+ $file = get_entity($file_guid);
+
+ if ($file)
+ {
+ $filename = $file->originalfilename;
+ $mime = $file->mimetype;
+
+ header("Content-type: $mime");
+ if (strpos($mime, "image/")!==false)
+ header("Content-Disposition: inline; filename=\"$filename\"");
+ else
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+
+
+ $readfile = new ElggFile($file_guid);
+ $readfile->owner_guid = $file->owner_guid;
+ //$readfile->setFilename($filename);
+
+ $contents = $readfile->grabFile();
+
+ if (empty($contents))
+ echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/icons/general.jpg" );
+ else
+ echo $contents;
+
+ exit;
+ }
+ else
+ register_error(elgg_echo("image:downloadfailed"));
+
+?> \ No newline at end of file
diff --git a/actions/edit_multi.php b/actions/edit_multi.php
new file mode 100644
index 000000000..9bb9c4eed
--- /dev/null
+++ b/actions/edit_multi.php
@@ -0,0 +1,62 @@
+<?php
+ /**
+ * Elgg album: multi image edit action
+ *
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ if (!isloggedin()) forward();
+
+ // Get input data
+ $cover = get_input('cover');
+ $title_array = get_input('title');
+ $caption_array = get_input('caption');
+ $tags_array = get_input('tags');
+ $image_guid_array = get_input('image_guid');
+ $container_guid = get_input('container_guid');
+ $album_entity = get_entity($container_guid);
+ $not_updated = array();
+
+ foreach($image_guid_array as $key => $im){
+ $image = get_entity($im);
+
+ if ($image->canEdit()){
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags_array[$key]);
+
+ //set description appropriately
+ $image->title = $title_array[$key];
+
+ //set description appropriately
+ $image->description = $caption_array[$key];
+
+ // Before we can set metadata, we need to save the image
+ if (!$image->save()) {
+ array_push($not_updated, $image->guid);
+ }
+
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ $image->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $image->tags = $tagarray;
+ }
+
+ //if cover meta is sent from image save as metadata
+ if($cover == $im){
+ $album_entity->cover = $im;
+ }
+ }
+ }
+ // Success message
+ if (count($not_updated) > 0) {
+ register_error(elgg_echo("images:notedited"));
+ } else {
+ system_message(elgg_echo("images:edited"));
+ }
+
+ // Forward to the main album page
+ forward($album_entity->getURL());
+
+
+?> \ No newline at end of file
diff --git a/actions/editalbum.php b/actions/editalbum.php
new file mode 100644
index 000000000..36b0f7379
--- /dev/null
+++ b/actions/editalbum.php
@@ -0,0 +1,91 @@
+<?php
+
+ /**
+ * Elgg album: edit album action
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ if (!isloggedin()) forward();
+
+ // Get input data
+ $guid = (int) get_input('albumpost');
+ $title = get_input('albumtitle');
+ $body = get_input('albumbody');
+ $access = get_input('access_id');
+ $tags = get_input('albumtags');
+ $back_url = 'mod/tidypics/edit.php?file_guid=' . $guid;
+
+ // Make sure we actually have permission to edit
+ $album = get_entity($guid);
+ if ($album->canEdit())
+ {
+
+ // Cache to the session
+ $_SESSION['albumtitle'] = $title;
+ $_SESSION['albumbody'] = $body;
+ $_SESSION['albumtags'] = $tags;
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags);
+
+ // Get owning user
+ $owner = get_entity($album->getOwner());
+
+ // edit access only if access is different from current
+
+ if($album->access_id != $access)
+ {
+ $album->access_id = $access;
+
+ //get images from album and update access on image entities
+ $images = get_entities("object","image", $guid, '', 999, '', false);
+ foreach($images as $im){
+ $im->access_id = $access;
+ $im->save();
+ //new core updates all metadata access as well!
+ }
+ }
+
+
+ // Set its title and description appropriately
+ $album->title = $title;
+ $album->description = $body;
+
+ // Before we can set metadata, we need to save the image
+ if (!$album->save()) {
+ register_error(elgg_echo("album:error"));
+ $album->delete();
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page
+ }
+
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ $album->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $album->tags = $tagarray;
+ }
+
+ //if cover meta is sent from image save as metadata
+ if(get_input('cover') == elgg_echo('album:cover:yes')){
+ $container = get_entity($album->container_guid);
+ $container->cover = $album->guid;
+ }
+
+ // Success message
+ system_message(elgg_echo("album:edited"));
+
+ // Remove the image cache
+ unset($_SESSION['albumtitle']);
+ unset($_SESSION['albumbody']);
+ unset($_SESSION['albumtags']);
+
+ // Forward to the main blog page
+ forward($album->getURL());
+
+ }
+?> \ No newline at end of file
diff --git a/actions/icon.php b/actions/icon.php
new file mode 100644
index 000000000..718425819
--- /dev/null
+++ b/actions/icon.php
@@ -0,0 +1,41 @@
+<?php
+ /**
+ * Elgg tidypics icon action
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $file_guid = get_input("file_guid");
+ $file = get_entity($file_guid);
+
+ if ($file)
+ {
+ $filename = $file->thumbnail;
+ $mime = $file->mimetype;
+
+ header("Content-type: $mime");
+ if (strpos($mime, "image/")!==false)
+ header("Content-Disposition: inline; filename=\"$filename\"");
+ else
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+
+
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($filename);
+
+ $contents = $readfile->grabFile();
+
+ if (empty($contents))
+ echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/icons/general.jpg" );
+ else
+ echo $contents;
+
+ exit;
+ }
+ else
+ register_error(elgg_echo("file:downloadfailed"));
+?> \ No newline at end of file
diff --git a/actions/upload.php b/actions/upload.php
new file mode 100644
index 000000000..f969f6f40
--- /dev/null
+++ b/actions/upload.php
@@ -0,0 +1,133 @@
+<?php
+ /**
+ * Elgg multi-image uploader action
+ *
+ * This will upload up to 10 images at at time to an album
+ */
+
+ global $CONFIG;
+
+ // Get common variables
+ $access_id = (int) get_input("access_id");
+ $container_guid = (int) get_input('container_guid', 0);
+ if (!$container_guid)
+ $container_guid == $_SESSION['user']->getGUID();
+
+ $not_uploaded = array();
+ $uploaded_images = array();
+
+ foreach($_FILES as $key => $sent_file) {
+ if(!empty($sent_file['name'])) {
+ $name = $_FILES[$key]['name'];
+ $mime = $_FILES[$key]['type'];
+
+ //make sure file is an image
+ if($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png' || $mime == 'image/pjpeg') {
+ //this will save to users folder in /image/ and organize by photo album
+ $prefix = "image/" . $container_guid . "/";
+ $file = new ElggFile();
+ $filestorename = strtolower(time().$name);
+ $file->setFilename($prefix.$filestorename);
+ $file->setMimeType($mime);
+ $file->originalfilename = $name;
+ $file->subtype="image";
+ $file->access_id = $access_id;
+ if ($container_guid) {
+ $file->container_guid = $container_guid;
+ }
+ $file->open("write");
+ $file->write(get_uploaded_file($key));
+ $file->close();
+ $result = $file->save();
+
+ if ($result) { //file was saved; now create some thumbnails
+ //get maximum file size from plugin settings
+ if (get_plugin_setting('maxfilesize','tidypics')) {
+ if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) {
+ $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB
+ } else {
+ $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics');
+ }
+ } else {
+ $maxfilesize = 10240; //if the file size limit is not set, default to 10MB
+ }
+ $maxfilesize = 1024 * $maxfilesize; //convert to bytes
+
+ //check file size and remove picture if it exceeds the maximum
+ if (filesize($file->getFilenameOnFilestore())<= $maxfilesize) {
+ array_push($uploaded_images, $file->guid);
+
+ // Generate thumbnail
+ //TODO: REMOVE THE BELOW IF STATEMENT ONCE get_resized_image_from_existing_file() ACCEPTS IMAGES OVER 0.9MB IN SIZE
+ if (filesize($file->getFilenameOnFilestore())<= 943718) { //create thumbnails if file size < 0.9MB
+ try {$thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); } catch (Exception $e) { $thumblarge = false; }
+ try {$thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); } catch (Exception $e) { $thumbsmall = false; }
+ try {$thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); } catch (Exception $e) { $thumbnail = false; }
+ }
+ if ($thumbnail) {
+ $thumb = new ElggFile();
+ $thumb->setMimeType($mime);
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumb->open("write");
+ if ($thumb->write($thumbnail)) {
+ $file->thumbnail = $prefix."thumb".$filestorename;
+ } else {
+ $thumb->delete();
+ }
+ $thumb->close();
+ }
+ if ($thumbsmall) {
+ $thumb = new ElggFile();
+ $thumb->setMimeType($mime);
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumb->open("write");
+ if ($thumb->write($thumbsmall)) {
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+ } else {
+ $thumb->delete();
+ }
+ $thumb->close();
+ }
+ if ($thumblarge) {
+ $thumb = new ElggFile();
+ $thumb->setMimeType($mime);
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumb->open("write");
+ if ($thumb->write($thumblarge)) {
+ $file->largethumb = $prefix."largethumb".$filestorename;
+ } else {
+ $thumb->delete();
+ }
+ $thumb->close();
+ }
+ } else { //file exceeds file size limit, so delete it
+ $file->delete();
+ array_push($not_uploaded, $name);
+ } //end of file size check
+ } else { //file was not saved for some unknown reason
+ array_push($not_uploaded, $name);
+ } //end of file saved check and thumbnail creation
+ } else { // file is not a supported image type
+ array_push($not_uploaded, $name);
+ } //end of mimetype block
+ } //end of file name empty check
+ } //end of loop
+
+ if (count($not_uploaded) == 0) {
+ system_message(elgg_echo("images:saved"));
+ } else {
+ $error = elgg_echo("image:uploadfailed") . '<br />';
+ foreach($not_uploaded as $im_name){
+ $error .= ' [' . $im_name . '] ';
+ }
+ $error .= ' ' . elgg_echo("image:notimage");
+ register_error($error);
+ } //end of upload check
+
+ if (count($uploaded_images)>0) {
+ forward($CONFIG->wwwroot . 'mod/tidypics/edit_multi.php?files=' . implode('-', $uploaded_images)); //forward to multi-image edit page
+ } else {
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
+ }
+
+?> \ No newline at end of file
diff --git a/contributions.txt b/contributions.txt
new file mode 100644
index 000000000..ff014654c
--- /dev/null
+++ b/contributions.txt
@@ -0,0 +1,170 @@
+Elgg community and users:
+
+ The original author of Tidypics has not been active in the Elgg community lately. Therefore, I took on the task of improving his plug-in and maintaining a log of all changes in this file. If you contribute to this plug-in, please record your changes here and release them under a GPL license.
+
+Best regards,
+
+Gabriel Monge-Franco (gabrielinux)
+http://gabriel.mongefranco.com
+
+
+------------------------------------------------------------------------
+Version 1.08.2 Change List
+Release Date: 02/13/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08.2 CHANGES
+------------------------------------------------------------------------
+* Fixed bug introduced in v1.08.1 that broke the picture upload (thanks to Karsten Schulze).
+* Fixed empty variables in several files that were supposed to send the user back to the previous page, but didn't.
+* Cleaned up change log (contributions.txt).
+* Finally fixed the Polish language file!!! Yay!! :)
+
+* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+* TODO: create a new widget to show pictures (in slideshow) in a user's profile.
+* TODO: add settings for group albums so that the group owner can select the number of albums to show.
+* TODO: implement a way to move pictures from one album to another (should be pretty easy).
+* TODO: add an "Add Photos" option to the user widget similar to the one in the group widget.
+* TODO: implement automagic file resizing to meet the admin's maximum resolution and file size.
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08.2 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.08.1 Change List
+Release Date: 02/13/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+ * LKLaRose (http://community.elgg.org/pg/profile/lauren)
+ * Webgalli (http://community.elgg.org/pg/profile/webgalli)
+ * Karsten Schulze (http://ks.frinx.eu)
+ * Cash (http://community.elgg.org/pg/profile/costelloc)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08.1 CHANGES
+------------------------------------------------------------------------
+* Fixed bug introduced in v1.08 that caused fake files to be created during thumbnail creation (thanks to Karsten Schulze).
+* Reverted to old directory structure that saves pictures to /image/ALBUMGUID/picGUID (v1.08 saved to /image/ALBUMGUID__picGUID, thus keeping everything in one folder).
+* Album directory is now deleted when the album is deleted (along with every picture inside of the album).
+* Reverted thumbnail and small thumbnail to use picture cropping instead of scaling, so that sites that already use Tidypics can keep a consisting look and feel.
+* Completed River integration by moving album and image directories to an "object" sub-directory (thanks to LKLaRose).
+* Added status messages/graphics to give the user some feedback.
+* Fixed bug in profile widget whereby the selected number of albums had no effect (thanks to @Webgalli and @cheltenham).
+* Fixed bug introduced in v1.06 that prevented anonymous users from viewing a user's album (thanks to Karsten Schulze).
+* Fixed more language file bugs (thanks to Karsten Schulze).
+* Administrators can now set a file size limit from the plugin configuration (it has to be in Kilobytes).
+
+* JUST PLAIN WEIRD: Fixed Polish language file (thanks to @Vazco, Ian Medlock and Brett Profitt) and saved as UTF8 without BOM. However, it still doesn't work. Can somebody try saving it on a Polish box for me? :)
+
+* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters?
+* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+* TODO: create a new widget to show pictures (in slideshow) in a user's profile.
+* TODO: add settings for group albums so that the group owner can select the number of albums to show.
+* TODO: implement a way to move pictures from one album to another (should be pretty easy).
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08.1 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.08 Change List
+Release Date: 02/08/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08 CHANGES
+------------------------------------------------------------------------
+* Merged most (safe) changes made by other contributors in v1.07.
+ - Did not include SWFuploader or JQuery due to the number of bugs reported.
+* Changed ugly "new album" picture into something better looking.
+* Fixed bug whereby image objects were deleted from the database, but they physical files remained on the server.
+ - Since deleting directories was not possible without the use of unsafe file operations, albums no longer create new directories. Instead, all pictures are saved as /image/ALBUMGUID__picturename.
+* Fixed some bugs in the English, Spanish and German language files and added missing error messages.
+* Thumbnails now display the default error image (same as new album) when the requested image cannot be found.
+* Fixed a bug in the multi-edit form that did not allow image titles to be saved.
+* Removed some customizations made to edit.php action in v1.07 since they removed the ability to add titles to images.
+* Fixed bug introduced in v1.07 that prevented images from being set as album covers.
+* Fixed miscellaneous bugs in group albums widget.
+* Removed jQuery for now since it was making the albums too slow. In the future, we should look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+
+
+* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters?
+* TODO: Work around 0.9MB source file size limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.07 Change List
+Release Date: 02/03/2008
+Contributors:
+ * vazco (http://community.elgg.org/pg/profile/vazco)
+ * simophin (http://community.elgg.org/pg/profile/simophin)
+------------------------------------------------------------------------
+BEGIN VERSION 1.07 CHANGES
+------------------------------------------------------------------------
+* About 10 missing translations added
+* Translated to polish
+* When no album is present, user can add a new album straight from the widget if he has the required rights
+* Added some missing <p></p>
+* Changed some <? to <?php
+* Unauthorized album edit taken care of
+* Added jQuery Lightbox support, but commented out just in case someone won't want to use it (there may be some problems with the lightbox, since I'm not using it myself and I didn't test it)
+------------------------------------------------------------------------
+END VERSION 1.07 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.06 Change List
+Release Date: 02/03/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+------------------------------------------------------------------------
+BEGIN VERSION 1.06 CHANGES
+------------------------------------------------------------------------
+* Forward all non-logged in users to World (public) pictures. This fixes a bug in which anonymous users would see a list of pictures titled, "'s pictures" (without a name).
+* Forward requests to "owned" without an user ID to "owned/userid" when a user is logged in. This fixes a bug in which all users would see a list of pictures titled, "'s pictures" (without a name).
+* Replaced several hard-coded strings to elgg_echo() functions so they can be translated.
+* Re-enabled title entry in picture editing. Titles are only optional, so there is no reason to hide them, especially if some users may find them useful. Moreover, lack of image titles makes list views awkward.
+* Fixed multi-picture editing bug in which editing was disabled after uploading multiple pictures.
+* Fixed several tags not conforming to standard PHP opening tags.
+* Fixed some bugs in the English language file.
+* Added Spanish and German translations (if you speak German, please double-check the language file!!!).
+* Added a download link at the bottom of each picture to download the original file.
+* Updated some icons and created missing ones.
+
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: change ugly "new album" picture into something better looking.
+* TODO: re-organize files to clean up the plug-in directory (e.g., move world.php to views/default)
+* TODO: Fix bug whereby image objects are deleted from the database, but the physical files remain on the server. The path can be found with $file->getFilename(), but would it be safe to execute shell commands directly???
+------------------------------------------------------------------------
+END VERSION 1.06 CHANGES
+------------------------------------------------------------------------
+
diff --git a/edit.php b/edit.php
new file mode 100644
index 000000000..2c202e402
--- /dev/null
+++ b/edit.php
@@ -0,0 +1,46 @@
+<?php
+ /**
+ * Elgg file saver
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ gatekeeper();
+ set_context('photos');
+ $file = (int) get_input('file_guid');
+
+ if (!$file = get_entity($file))
+ forward();
+
+ if(!$file->canEdit())
+ forward();
+
+ $subtype = $file->getSubtype();
+
+ if($subtype == 'album'){
+ if($container = $file->container_guid)
+ set_page_owner($container);
+
+ $area2 .= elgg_view_title($title = elgg_echo('album:edit'));
+ }
+ elseif($subtype == 'image'){
+ if($container = get_entity($file->container_guid)->container_guid)
+ set_page_owner($container);
+
+ $area2 .= elgg_view_title($title = elgg_echo('image:edit'));
+ }
+ else{
+ forward();
+ }
+
+ $area2 .= elgg_view("tidypics/forms/edit",array('entity' => $file, 'subtype' => $subtype));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+ page_draw(elgg_echo("edit"), $body);
+
+
+?> \ No newline at end of file
diff --git a/edit_multi.php b/edit_multi.php
new file mode 100644
index 000000000..2fdc85e42
--- /dev/null
+++ b/edit_multi.php
@@ -0,0 +1,33 @@
+<?php
+ /**
+ * Elgg image multi edit
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ gatekeeper();
+ set_context('photos');
+ $file_string = get_input('files');
+ $file_array_sent = explode('-', $file_string);
+ $new_file_array = array();
+
+ foreach($file_array_sent as $file_guid){
+ if ($entity = get_entity($file_guid)){
+ if($entity->canEdit()){
+ array_push($new_file_array, $file_guid);
+ }
+ if(!$album_guid) $album_guid = $entity->container_guid;
+
+ }
+ }
+
+ $area2 .= elgg_view_title($title = elgg_echo('image:edit'));
+ $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+ page_draw(elgg_echo("edit"), $body);
+?> \ No newline at end of file
diff --git a/friends.php b/friends.php
new file mode 100644
index 000000000..61ed52380
--- /dev/null
+++ b/friends.php
@@ -0,0 +1,43 @@
+<?php
+ /**
+ * Elgg file browser
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ //if no friends were requested, see world pictures instead, or redirect to user's friends
+ if (is_null(get_input('username')) || get_input('username')=='') {
+ if (!isloggedin()) {
+ forward('pg/photos/world');
+ } else {
+ forward('pg/photos/friends/' . $_SESSION['user']->username);
+ }
+ }
+
+ if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') {
+ $friendname = get_input('username');
+ } else {
+ $friendname = page_owner_entity()->name;
+ };
+
+ if(isloggedin() && (page_owner() == $_SESSION['guid'])) {
+ $area2 = elgg_view_title($title = elgg_echo('album:yours:friends'));
+ } else {
+ $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), "$friendname"));
+ }
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_user_friends_objects(page_owner(), 'album');
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:friends"),$_SESSION['user']->name), $body);
+?> \ No newline at end of file
diff --git a/graphics/Thumbs.db b/graphics/Thumbs.db
new file mode 100644
index 000000000..46eac31d3
--- /dev/null
+++ b/graphics/Thumbs.db
Binary files differ
diff --git a/graphics/arrow_next.gif b/graphics/arrow_next.gif
new file mode 100644
index 000000000..6b3d8f829
--- /dev/null
+++ b/graphics/arrow_next.gif
Binary files differ
diff --git a/graphics/arrow_previous.gif b/graphics/arrow_previous.gif
new file mode 100644
index 000000000..e7ded54eb
--- /dev/null
+++ b/graphics/arrow_previous.gif
Binary files differ
diff --git a/graphics/bl.gif b/graphics/bl.gif
new file mode 100644
index 000000000..735fcb582
--- /dev/null
+++ b/graphics/bl.gif
Binary files differ
diff --git a/graphics/br.gif b/graphics/br.gif
new file mode 100644
index 000000000..90cdccdcb
--- /dev/null
+++ b/graphics/br.gif
Binary files differ
diff --git a/graphics/btnClose.gif b/graphics/btnClose.gif
new file mode 100644
index 000000000..b8ab4638d
--- /dev/null
+++ b/graphics/btnClose.gif
Binary files differ
diff --git a/graphics/btnContract.gif b/graphics/btnContract.gif
new file mode 100644
index 000000000..9be301039
--- /dev/null
+++ b/graphics/btnContract.gif
Binary files differ
diff --git a/graphics/btnExpand.gif b/graphics/btnExpand.gif
new file mode 100644
index 000000000..72a8471b3
--- /dev/null
+++ b/graphics/btnExpand.gif
Binary files differ
diff --git a/graphics/btnNext.gif b/graphics/btnNext.gif
new file mode 100644
index 000000000..467f23246
--- /dev/null
+++ b/graphics/btnNext.gif
Binary files differ
diff --git a/graphics/btnPrevious.gif b/graphics/btnPrevious.gif
new file mode 100644
index 000000000..298c1e99c
--- /dev/null
+++ b/graphics/btnPrevious.gif
Binary files differ
diff --git a/graphics/icons/Thumbs.db b/graphics/icons/Thumbs.db
new file mode 100644
index 000000000..fb5d56ed3
--- /dev/null
+++ b/graphics/icons/Thumbs.db
Binary files differ
diff --git a/graphics/icons/album.gif b/graphics/icons/album.gif
new file mode 100644
index 000000000..73ce91356
--- /dev/null
+++ b/graphics/icons/album.gif
Binary files differ
diff --git a/graphics/icons/general.jpg b/graphics/icons/general.jpg
new file mode 100644
index 000000000..23494eff2
--- /dev/null
+++ b/graphics/icons/general.jpg
Binary files differ
diff --git a/graphics/icons/general.png b/graphics/icons/general.png
new file mode 100644
index 000000000..267ae010c
--- /dev/null
+++ b/graphics/icons/general.png
Binary files differ
diff --git a/graphics/icons/river_icon_album.gif b/graphics/icons/river_icon_album.gif
new file mode 100644
index 000000000..e1bbfedaa
--- /dev/null
+++ b/graphics/icons/river_icon_album.gif
Binary files differ
diff --git a/graphics/icons/river_icon_image.gif b/graphics/icons/river_icon_image.gif
new file mode 100644
index 000000000..6f8bfd6af
--- /dev/null
+++ b/graphics/icons/river_icon_image.gif
Binary files differ
diff --git a/graphics/img_error.jpg b/graphics/img_error.jpg
new file mode 100644
index 000000000..e3aad2aed
--- /dev/null
+++ b/graphics/img_error.jpg
Binary files differ
diff --git a/graphics/loader.gif b/graphics/loader.gif
new file mode 100644
index 000000000..7ac990cf0
--- /dev/null
+++ b/graphics/loader.gif
Binary files differ
diff --git a/graphics/tl.gif b/graphics/tl.gif
new file mode 100644
index 000000000..ff93dadcc
--- /dev/null
+++ b/graphics/tl.gif
Binary files differ
diff --git a/graphics/tr.gif b/graphics/tr.gif
new file mode 100644
index 000000000..8dc197272
--- /dev/null
+++ b/graphics/tr.gif
Binary files differ
diff --git a/graphics/ttl.gif b/graphics/ttl.gif
new file mode 100644
index 000000000..8e44c0374
--- /dev/null
+++ b/graphics/ttl.gif
Binary files differ
diff --git a/graphics/ttp.gif b/graphics/ttp.gif
new file mode 100644
index 000000000..36f7211c4
--- /dev/null
+++ b/graphics/ttp.gif
Binary files differ
diff --git a/graphics/ttr.gif b/graphics/ttr.gif
new file mode 100644
index 000000000..66d06941e
--- /dev/null
+++ b/graphics/ttr.gif
Binary files differ
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..00b09d14b
--- /dev/null
+++ b/index.php
@@ -0,0 +1,45 @@
+<?php
+ /**
+ * Elgg tidypics photo gallery main page
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ *
+ *
+ */
+
+ //require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ //get the owner of the current page
+ $owner = page_owner_entity();
+
+ //if page owner cannot be found, forward to user's pictures instead (or world if not logged in)
+ if (is_null($owner->username) || empty($owner->username)) {
+ //if not logged in, see world pictures instead
+ if (!isloggedin()) forward('pg/photos/world');
+ forward('pg/photos/owned/' . $_SESSION['user']->username);
+ }
+
+ //set the title
+ $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name"));
+
+ //allow new album creation
+ if(can_write_to_container($_SESSION['guid'], page_owner())){
+ $area2 .= '<a href="'.$CONFIG->wwwroot . "pg/photos/new/". $owner->username.'">'.elgg_echo('album:create').'</a><br><br>';
+ }
+
+ // Get objects
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities("object","album",page_owner(),10);
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body);
+?> \ No newline at end of file
diff --git a/languages/de.php b/languages/de.php
new file mode 100644
index 000000000..2d668f72f
--- /dev/null
+++ b/languages/de.php
@@ -0,0 +1,114 @@
+<?php
+ /**
+ * Elgg tidypics plugin language pack
+ *
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $german = array(
+
+ // Menu items and titles
+
+ 'image' => "Bild",
+ 'images' => "Bilder",
+ 'caption' => "Untertitel",
+ 'photos' => "Photos",
+ 'images:upload' => "Bilder hochladen",
+ 'album' => "Fotoalbum",
+ 'albums' => "Fotoalben",
+ 'album:yours' => "Deine Fotoalben",
+ 'album:yours:friends' => "Fotoalben von Freunden",
+ 'album:user' => "Fotoalben von %s",
+ 'album:friends' => "Fotoalben von Freunden von %s",
+ 'album:all' => "Alle Fotoalben",
+ 'album:group' => "Alben der Gruppe",
+ 'item:object:image' => "Photos",
+ 'item:object:album' => "Alben",
+ 'tidypics:settings:maxfilesize' => "Maximale Dateigröße in den Kilobytes (KB):",
+
+ //actions
+
+ 'album:create' => "Neues Album",
+ 'album:add' => "Fotoalbum hinzuf&uuml;gen",
+ 'album:addpix' => "Fotos hinzuf&uuml;gen",
+ 'album:edit' => "Album bearbeiten",
+ 'album:delete' => "Album l&ouml;schen",
+
+ 'image:edit' => "Bild bearbeiten",
+ 'image:delete' => "Bild l&ouml;schen",
+ 'image:download' => "Download Bild",
+
+ //forms
+
+ 'album:title' => "Titel",
+ 'album:desc' => "Beschreibung",
+ 'album:tags' => "Stichw&ouml;rter",
+ 'album:cover' => "Albumcover erstellen?",
+ 'album:cover:yes' => "Ja",
+ 'image:access:note' => "(Zugriffsberechtigung wird vom Album &uuml;bernommen)",
+
+ //views
+
+ 'image:total' => "Bilder im Album:",
+ 'image:by' => "Bild hinzugef&uuml;gt von",
+ 'album:by' => "Album erstellt von:",
+ 'album:created:on' => "Verursacht",
+ 'image:none' => "Noch keine Bilder hinzugef&uuml;gt.",
+ 'image:back' => "Zur&uuml;ck",
+ 'image:next' => "Weiter",
+
+ //widgets
+
+ 'album:widget' => "Fotoalben",
+ 'album:more' => "Alle Alben ansehen",
+ 'album:widget:description' => "Zeige Deine neuesten Fotoalben",
+ 'album:display:number' => "Anzahl der Alben, die angezeigt werden sollen",
+ 'album:num_albums' => "Anzahl der anzuzeigenden Alben",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s hat hochgeladen:",
+ 'image:river:item' => "ein Bild",
+ 'image:river:annotate' => "%s kommentierte",
+
+ //albums
+ 'album:river:created' => "%s erstellte",
+ 'album:river:item' => "ein Album",
+ 'album:river:annotate' => "%s kommentierte",
+
+ // Status messages
+
+ 'image:saved' => "Dein Bild wurde gespeichert.",
+ 'images:saved' => "Alle Bilder wurden gespeichert.",
+ 'image:deleted' => "Dein Bild wurde gel&ouml;scht.",
+ 'image:delete:confirm' => "Willst Du das Bild wirklich l&ouml;schen?",
+
+ 'images:edited' => "Dein Bild wurde aktualisiert.",
+ 'album:edited' => "Dein Album wurde aktualisiert.",
+ 'album:saved' => "Dein Album wurde gespeichert.",
+ 'album:deleted' => "Dein Album wurde gel&ouml;scht.",
+ 'album:delete:confirm' => "Willst Du das Album wirklich l&ouml;schen?",
+ 'album:created' => "Ihr neues Album ist hergestellt worden.",
+ 'tidypics:status:processing' => "Warten Sie bitte, während wir verarbeiten Ihre Abbildung....",
+
+ //Error messages
+
+ 'image:none' => "Kein Bilder gefunden.",
+ 'image:uploadfailed' => "Dateien konnten nicht hochgeladen werden:",
+ 'image:deletefailed' => "Bild konnte nicht gel&ouml;scht werden.",
+ 'image:downloadfailed' => "Dieses Bild ist nicht diesmal vorhanden.",
+
+ 'image:notimage' => 'Wir akzeptieren nur jpeg, gif, und png Dateien der erlaubten Dateigröße an.',
+ 'images:notedited' => 'Nicht alle Bilder konnten hochgeladen werden',
+
+ 'album:none' => "Keine Alben gefunden.",
+ 'album:uploadfailed' => "Sorry; Dein Album konnte nicht gespeichert werden.",
+ 'album:deletefailed' => "Dein Album konnte nicht gel&ouml;scht werden.",
+ 'album:blank' => "Geben Sie diesem Album einen Titel und eine Beschreibung bitte."
+ );
+
+ add_translation("de",$german);
+?>
diff --git a/languages/en.php b/languages/en.php
new file mode 100644
index 000000000..2316a9e2f
--- /dev/null
+++ b/languages/en.php
@@ -0,0 +1,115 @@
+<?php
+ /**
+ * Elgg tidypics plugin language pack
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $english = array(
+
+ // Menu items and titles
+
+ 'image' => "Image",
+ 'images' => "Images",
+ 'caption' => "Caption",
+ 'photos' => "Photos",
+ 'images:upload' => "Upload Images",
+ 'album' => "Photo Album",
+ 'albums' => "Photo Albums",
+ 'album:yours' => "Your photo albums",
+ 'album:yours:friends' => "Your friends' photo albums",
+ 'album:user' => "%s's photo albums",
+ 'album:friends' => "%s's friends' photo albums",
+ 'album:all' => "All site photo albums",
+ 'album:group' => "Group albums",
+ 'item:object:image' => "Photos",
+ 'item:object:album' => "Albums",
+ 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "New Album",
+ 'album:add' => "Add Photo Album",
+ 'album:addpix' => "Add photos",
+ 'album:edit' => "Edit album",
+ 'album:delete' => "Delete album",
+
+ 'image:edit' => "Edit image",
+ 'image:delete' => "Delete image",
+ 'image:download' => "Download image",
+
+ //forms
+
+ 'album:title' => "Title",
+ 'album:desc' => "Description",
+ 'album:tags' => "Tags",
+ 'album:cover' => "Make image album cover?",
+ 'album:cover:yes' => "Yes",
+ 'image:access:note' => "(view access is inherited from the album)",
+
+ //views
+
+ 'image:total' => "Images in album:",
+ 'image:by' => "Image added by",
+ 'album:by' => "Album created by",
+ 'album:created:on' => "Created",
+ 'image:none' => "No images have been added yet.",
+ 'image:back' => "Back",
+ 'image:next' => "Next",
+
+ //widgets
+
+ 'album:widget' => "Photo Albums",
+ 'album:more' => "View all albums",
+ 'album:widget:description' => "Showcase your latest photo albums",
+ 'album:display:number' => "Number of albums to display",
+ 'album:num_albums' => "Number of albums to display",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s uploaded",
+ 'image:river:item' => "an image",
+ 'image:river:annotate' => "%s commented on",
+
+ //albums
+ 'album:river:created' => "%s created",
+ 'album:river:item' => "an album",
+ 'album:river:annotate' => "%s commented on",
+
+ // Status messages
+
+ 'image:saved' => "Your image was successfully saved.",
+ 'images:saved' => "All images were successfully saved.",
+ 'image:deleted' => "Your image was successfully deleted.",
+ 'image:delete:confirm' => "Are you sure you want to delete this image?",
+
+ 'images:edited' => "Your images were successfully updated.",
+ 'album:edited' => "Your album was successfully updated.",
+ 'album:saved' => "Your album was successfully saved.",
+ 'album:deleted' => "Your album was successfully deleted.",
+ 'album:delete:confirm' => "Are you sure you want to delete this album?",
+ 'album:created' => "Your new album has been created.",
+ 'tidypics:status:processing' => "Please wait while we process your picture....",
+
+ //Error messages
+
+ 'image:none' => "We could not find any images at the moment.",
+ 'image:uploadfailed' => "Files not uploaded:",
+ 'image:deletefailed' => "Your image could not be deleted at this time.",
+ 'image:downloadfailed' => "Sorry; this image is not available at this time.",
+
+ 'image:notimage' => "We only accept jpeg, gif, or png images of the allowed file size.",
+ 'images:notedited' => "Not all images were successfully updated",
+
+ 'album:none' => "We could not find any albums at the moment.",
+ 'album:uploadfailed' => "Sorry; we could not save your album.",
+ 'album:deletefailed' => "Your album could not be deleted at this time.",
+ 'album:blank' => "Please give this album a title and description."
+ );
+
+ add_translation("en",$english);
+?> \ No newline at end of file
diff --git a/languages/es.php b/languages/es.php
new file mode 100644
index 000000000..babb87068
--- /dev/null
+++ b/languages/es.php
@@ -0,0 +1,115 @@
+<?php
+ /**
+ * Elgg tidypics plugin language pack
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $spanish = array(
+
+ // Menu items and titles
+
+ 'image' => "Imagen",
+ 'images' => "Im&#225;genes",
+ 'caption' => "Leyenda",
+ 'photos' => "Fotos",
+ 'images:upload' => "Subir Im&#225;genes",
+ 'album' => "&#193;llbum de Fotos",
+ 'albums' => "&#193;lbums de Fotos",
+ 'album:yours' => "Tus &#225;lbums de fotos",
+ 'album:yours:friends' => "&#193;lbums de tus amigos",
+ 'album:user' => "&#193;llbums de %s",
+ 'album:friends' => "Albums de los amigos de %s",
+ 'album:all' => "Todos los &#225;lbums",
+ 'album:group' => "&#193;llbums del grupo",
+ 'item:object:image' => "Fotos",
+ 'item:object:album' => "&#193;llbums",
+ 'tidypics:settings:maxfilesize' => "Tama&#241;o m&#225;ximo en kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "Nuevo &#225;lbum",
+ 'album:add' => "A&#241;adir &#225;lbum de fotos",
+ 'album:addpix' => "A&#241;adir fotos",
+ 'album:edit' => "Modificar &#225;lbum",
+ 'album:delete' => "Eliminar &#225;lbum",
+
+ 'image:edit' => "Modificar imagen",
+ 'image:delete' => "Eliminar imagen",
+ 'image:download' => "Descargar imagen",
+
+ //forms
+
+ 'album:title' => "T&#237;tulo",
+ 'album:desc' => "Descripci&#243;n",
+ 'album:tags' => "Etiquetas",
+ 'album:cover' => "&#191;Hacer portada del &#225;lbum?",
+ 'album:cover:yes' => "Si",
+ 'image:access:note' => "(los permisos de acceso se heredan del &#225;lbum)",
+
+ //views
+
+ 'image:total' => "Im&#225;genes en el &#225;lbum:",
+ 'image:by' => "Imagen a&#241;adida por",
+ 'album:by' => "Album creado por",
+ 'album:created:on' => "Creado",
+ 'image:none' => "Todav&#237;a no se han a&#241;adido im&#225;genes.",
+ 'image:back' => "Anterior",
+ 'image:next' => "Siguiente",
+
+ //widgets
+
+ 'album:widget' => "Albums de Fotos",
+ 'album:more' => "Ver todos los albums",
+ 'album:widget:description' => "Muestra tus &#225;lbums de fotos m&#225;s recientes",
+ 'album:display:number' => "N&#250;mero de albums a mostrar",
+ 'album:num_albums' => "N&#250;mero de albums a mostrar",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s subi&#243;",
+ 'image:river:item' => "una imagen",
+ 'image:river:annotate' => "%s coment&#243; en",
+
+ //albums
+ 'album:river:created' => "%s cre&#243;",
+ 'album:river:item' => "un album",
+ 'album:river:annotate' => "%s coment&#243; en",
+
+ // Status messages
+
+ 'image:saved' => "Tu imagen ha sido guardada.",
+ 'images:saved' => "Todas tus im&#225;genes han sido guardadas.",
+ 'image:deleted' => "Tu imagen ha sido borrada.",
+ 'image:delete:confirm' => "&#191;Deseas borrar esta imagen?",
+
+ 'images:edited' => "Tus im&#225;genes han sido actualizadas.",
+ 'album:edited' => "Tu &#225;lbum ha sido actualizado.",
+ 'album:saved' => "Tu &#225;lbum ha sido guardado.",
+ 'album:deleted' => "Tu &#225;lbum ha sido borrado con &#233;xito.",
+ 'album:delete:confirm' => "&#191;Deseas borrar este &#225;lbum?",
+ 'album:created' => "Tu nuevo &#225;lbum ha sido creado.",
+ 'tidypics:status:processing' => "Por favor espera mientras procesamos tu imagen....",
+
+ //Error messages
+
+ 'image:none' => "No ha sido psible encontrar ninguna imagen en este momento.",
+ 'image:uploadfailed' => "Algunos ficheros no se pudieron subir:",
+ 'image:deletefailed' => "Tu imagen no ha podido ser borrada en este momento.",
+ 'image:downloadfailed' => "Esta imagen no se encuentra disponible en este momento.",
+
+ 'image:notimage' => "S&#243;lo se aceptan im&#225;genes jpeg, gif, o png del tama&#241;o permitido.",
+ 'images:notedited' => "No se pudieron actualizar todas las im&#225;genes.",
+
+ 'album:none' => "Actualmente no hay ning&#250;n &#225;lbum de fotos.",
+ 'album:uploadfailed' => "No se ha podido guardar el &#225;lbum.",
+ 'album:deletefailed' => "En este momento no se ha podido borrar el &#225;lbum.",
+ 'album:blank' => "Por favor entra un t&#237;tulo y descripci&#243;n para tu nuevo &#225;lbum."
+ );
+
+ add_translation("es",$spanish);
+?> \ No newline at end of file
diff --git a/languages/pl.php b/languages/pl.php
new file mode 100644
index 000000000..047b17220
--- /dev/null
+++ b/languages/pl.php
@@ -0,0 +1,115 @@
+<?php
+ /**
+ * Elgg tidypics plugin language pack
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $polish = array(
+
+ // Menu items and titles
+
+ 'image' => "Obrazek",
+ 'images' => "Obrazki",
+ 'caption' => "Opis",
+ 'photos' => "Zdjęcia",
+ 'images:upload' => "Dodaj obrazki",
+ 'album' => "Album zdjęciowy",
+ 'albums' => "Albumy zdjęciowe",
+ 'album:yours' => "Twoje albumy",
+ 'album:yours:friends' => "Albumy twoich znajomych",
+ 'album:user' => "Albumy użytkownika %s",
+ 'album:friends' => "Albumy przyjaciół użytkownika %s",
+ 'album:all' => "Wszystkie publiczne albumy",
+ 'album:group' => "Albumy rejsu",
+ 'item:object:image' => "Zdjęcia",
+ 'item:object:album' => "Albumy",
+ 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "Nowy album",
+ 'album:add' => "Dodaj album zdjęciowy",
+ 'album:addpix' => "Dodaj zdjęcia",
+ 'album:edit' => "Edytuj album",
+ 'album:delete' => "Skasuj album",
+
+ 'image:edit' => "Edytuj obrazek",
+ 'image:delete' => "Skasuj obrazek",
+ 'image:download' => "Pobierz obrazek",
+
+ //forms
+
+ 'album:title' => "Tytuł albumu",
+ 'album:desc' => "Opis (widoczny tylko dla twórcy)",
+ 'album:tags' => "Tagi",
+ 'album:cover' => "Ustaw jako okładkę albumu?",
+ 'album:cover:yes' => "Tak",
+ 'image:access:note' => "(prawa dostępu pobierane są z ustawień albumu)",
+
+ //views
+
+ 'image:total' => "Obrazki w albumie:",
+ 'image:by' => "Obrazek dodany przez",
+ 'album:by' => "Album stworzony przez",
+ 'album:created:on' => "Stworzono",
+ 'image:none' => "Nie dodano jeszcze żadnych obrazków.",
+ 'image:back' => "Poprzednia",
+ 'image:next' => "Kolejna",
+
+ //widgets
+
+ 'album:widget' => "Albumy zdjęciowe",
+ 'album:more' => "Pokaż wszystkie albumy",
+ 'album:widget:description' => "Pokazuje twoje ostatnie albumy zdjęciowe",
+ 'album:display:number' => "Liczba wyświetlanych albumów",
+ 'album:num_albums' => "Liczba wyświetlanych albumów",
+
+ // river
+
+ //images
+ 'image:river:created' => "wgrano %s",
+ 'image:river:item' => "obrazek",
+ 'image:river:annotate' => "%s skomentował",
+
+ //albums
+ 'album:river:created' => "Stworzono %s",
+ 'album:river:item' => "album",
+ 'album:river:annotate' => "%s skomentował",
+
+ // Status messages
+
+ 'image:saved' => "Twój obrazek został pomyślnie zapisany.",
+ 'images:saved' => "Wszystkie obrazki zostały pomyślnie zapisane.",
+ 'image:deleted' => "Twój obrazek został pomyślnie skasowany.",
+ 'image:delete:confirm' => "Czy jesteś pewien że chcesz skasować ten obrazek?",
+
+ 'images:edited' => "Twoje obrazki zostały pomyślnie zapisane.",
+ 'album:edited' => "Twój album został pomyślnie zapisany.",
+ 'album:saved' => "Twój album został pomyślnie zapisany.",
+ 'album:deleted' => "Twój album został skasowany.",
+ 'album:delete:confirm' => "Na pewno chcesz skasować ten album?",
+ 'album:created' => "Stworzono nowy album.",
+ 'tidypics:status:processing' => "Please wait while we process your picture....",
+
+ //Error messages
+
+ 'image:none' => "Jeszcze nie dodano żadnych obrazków.",
+ 'image:uploadfailed' => "Pliki nie zapisane:",
+ 'image:deletefailed' => "Nie udało się skasować obrazka.",
+ 'image:downloadfailed' => "Nie udało się ściągnąć albumu.",
+
+ 'image:notimage' => "Akceptowane formaty to tylko: jpeg, gif i png, and the allowed file size.",
+ 'images:notedited' => "Nie wszystkie obrazki zostały zapisane",
+
+ 'album:none' => "Jeszcze nie dodano żadnych albumów.",
+ 'album:uploadfailed' => "Nie udało się zapisać twojego albumu.",
+ 'album:deletefailed' => "Nie udało się usunąć twojego albumu.",
+ 'album:blank' => "Please give this albumu a tytuł and opis."
+ );
+
+ add_translation("pl",$polish);
+?> \ No newline at end of file
diff --git a/manifest.xml b/manifest.xml
new file mode 100644
index 000000000..1dfd9b7a7
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Curverider, Jade, apsurd, Gabriel Monge-Franco and other contributors." />
+ <field key="version" value="1.x" />
+ <field key="description" value="Tidypics Photo Gallery Plugin" />
+ <field key="website" value="http://www.tastyseed.com/" />
+ <field key="copyright" value="(C) apsurd 2008" />
+ <field key="licence" value="GNU General Public License version 3" />
+</plugin_manifest>
diff --git a/newalbum.php b/newalbum.php
new file mode 100644
index 000000000..8df0ec019
--- /dev/null
+++ b/newalbum.php
@@ -0,0 +1,31 @@
+<?php
+
+ /**
+ * Elgg blog add entry page
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ $area2 = elgg_view_title(elgg_echo('album:add'));
+ $area2 .= elgg_view("tidypics/forms/edit");
+
+ // Display page
+ page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 ));
+
+
+?> \ No newline at end of file
diff --git a/start.php b/start.php
new file mode 100644
index 000000000..f3c675d52
--- /dev/null
+++ b/start.php
@@ -0,0 +1,174 @@
+<?php
+ /**
+ * Elgg tidypics
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ /**
+ * tidypics plugin initialisation functions.
+ */
+ function tidypics_init()
+ {
+ // Get config
+ global $CONFIG;
+
+ // Set up menu for logged in users
+ if (isloggedin())
+ {
+ add_menu(elgg_echo('photos'), $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username);
+ }
+
+ // Extend CSS
+ extend_view('css', 'tidypics/css');
+
+ // Extend hover-over and profile menu
+ extend_view('profile/menu/links','tidypics/menu');
+
+ //group view ** psuedo widget view for group pages**
+ extend_view('groups/right_column','tidypics/groupprofile_albums');
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('photos','tidypics_page_handler');
+
+ // Add a new tidypics widget
+ add_widget_type('album_view',elgg_echo("album:widget"),elgg_echo("album:widget:description"), 'profile');
+
+ // Register a URL handler for files
+ register_entity_url_handler('image_url','object','image');
+ register_entity_url_handler('album_url','object','album');
+
+ // Register entity type
+ register_entity_type('object','image');
+ register_entity_type('object','album');
+
+ }
+
+ /**
+ * Sets up submenus for tidypics. Triggered on pagesetup.
+ */
+ function tidypics_submenus() {
+
+ global $CONFIG;
+
+ $page_owner = page_owner_entity();
+
+ // General submenu options
+ if (get_context() == "photos") {
+ if (isloggedin() && (page_owner() == $_SESSION['guid'] || !page_owner())) {
+ add_submenu_item(sprintf(elgg_echo("album:yours"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, '1view');
+ add_submenu_item(sprintf(elgg_echo('album:yours:friends'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/friends/". page_owner_entity()->username, '1view');
+ add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view');
+ } else if (page_owner() && $page_owner instanceof ElggUser) {
+ add_submenu_item(sprintf(elgg_echo('album:friends'),$page_owner->name), $CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,'1view');
+ add_submenu_item(sprintf(elgg_echo('album:all'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/world/", '1view');
+ }
+ }
+ if (isloggedin() && ($page_owner instanceof ElggGroup)) {
+ add_submenu_item(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/photos/owned/" . page_owner_entity()->username, 'photo_albums');
+ }
+ }
+
+ /**
+ * tidypics page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function tidypics_page_handler($page) {
+
+ global $CONFIG;
+
+ if (isset($page[0]))
+ {
+ switch($page[0])
+ {
+ case "owned": //view list of albums owned by container
+ if (isset($page[1])) set_input('username',$page[1]);
+
+ /* if you want to put new album action in the submenu, just do it like this --------->
+ if(can_write_to_container($_SESSION['guid'], page_owner())){
+ add_submenu_item(elgg_echo('album:create'), $CONFIG->wwwroot . "pg/photos/new/". page_owner_entity()->username, 'pagesactions');
+ }
+ */
+ include($CONFIG->pluginspath . "tidypics/index.php");
+ break;
+
+ case "view": //view an image individually
+ set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/view.php");
+ break;
+
+ case "album": //view an album individually
+ set_input('guid',$page[1]);
+ @include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php");
+ break;
+
+ case "new": //create new album
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/newalbum.php");
+ break;
+
+ case "upload": //upload images to album
+ if (isset($page[1])) set_input('container_guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/upload.php");
+ break;
+
+ case "friends":
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/friends.php");
+ break;
+
+ case "world":
+ include($CONFIG->pluginspath . "tidypics/world.php");
+ break;
+
+ }
+ }
+ else
+ {
+ // Include the standard profile index
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/index.php");
+ }
+
+ }
+
+ /**
+ * Populates the ->getUrl() method for file objects
+ *
+ * @param ElggEntity $entity album/image entity
+ * @return string File URL
+ */
+ function image_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
+
+ }
+
+ function album_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
+
+ }
+
+ // Make sure tidypics_init is called on initialisation
+ register_elgg_event_handler('init','system','tidypics_init');
+ register_elgg_event_handler('pagesetup','system','tidypics_submenus');
+
+ // Register actions
+ register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php");
+ register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php");
+ register_action("tidypics/editalbum", false, $CONFIG->pluginspath. "tidypics/actions/editalbum.php");
+ register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
+ register_action("tidypics/icon", true, $CONFIG->pluginspath. "tidypics/actions/icon.php");
+ register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
+ register_action("tidypics/download", true, $CONFIG->pluginspath . "tidypics/actions/download.php");
+
+?> \ No newline at end of file
diff --git a/tasks.txt b/tasks.txt
new file mode 100644
index 000000000..879d8cb42
--- /dev/null
+++ b/tasks.txt
@@ -0,0 +1,66 @@
+
+Tasks:
+
+ -> DONE --clean up css
+ -> DONE -- test river views
+ -> DONE -- enable widget views
+ -> DONE -- multi image uploader form.
+
+ -> DONE -- Album covers: implement cover option for NEW uploaded images @ upload.php action
+ i want to enable multi uploader so better to put it in there.
+ (radio box so only one image can be the cover)
+
+ -> DONE -- /pg/photos/owned
+ Edit the way album list is presented (make it nicer)
+ -> DONE -- when adding or editing album ->
+ saving the album's view access should also edit
+ all containing image view access
+ if add new album
+ -> all image uploads default to albums current access
+ -> all image edits can not change access
+ if edit album
+ -> change access of album and cycle through all current images.
+
+ -> DONE -- Album covers: implemented edit image screen to specify album cover
+ -> DONE -- allow photo albums for users
+ -> DONE -- internationalize all text
+ -> DONE -- clean up unecessary functions from file plugin
+ -> DONE -- limit uploader to image only mimetype
+ -> DONE -- (for now) see if i can get rid of any unecessary meta
+ -> DONE -- create friends views and world views
+ -> DONE -- add breadcrumb
+ -> DONE -- (but optimize) add thumbnail icons for listings
+
+
+
+ --------- CAVEATS -----------
+
+
+ -> SOLVED -- (just clear the pagination css class) problem:
+ when viewing an indie album, the images are floated.
+ if the pagination is enabled the bottom bar does not clear the
+ floated images
+
+Problem:
+the delete action does not delete any actual images
+the current method should work, but it doesnt
+look for clues in engine/lib/filestore.php
+when deleting an album, easy way to delete all images
+is just to find the albums folder and delete it.
+
+Problem:
+when defining covers for album , i need to edit the input/checkboxes view
+in order submit correctly. Remove the [] as part of the name
+
+--------------------
+my differences due to theme
+------------------------
+My customizations:
+
+in the controls i am added to submenu
+edit this out when packaging
+
+ -> if i add album actions to submenu i lose "js confirm" on delete
+ -> change the album access permissions for groups to have
+ only 3 choices (logged in , everyone, or group only)
+ \ No newline at end of file
diff --git a/thumbnail.php b/thumbnail.php
new file mode 100644
index 000000000..0e6142cbb
--- /dev/null
+++ b/thumbnail.php
@@ -0,0 +1,55 @@
+<?php
+
+ /**
+ * Elgg file thumbnail
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Get engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // Get file GUID
+ $file_guid = (int) get_input('file_guid',0);
+
+ // Get file thumbnail size
+ $size = get_input('size','small');
+ if ($size != 'small') {
+ $size = 'large';
+ }
+
+ // Get file entity
+ if ($file = get_entity($file_guid)) {
+ if ($file->getSubtype() == "image") {
+ // Get file thumbnail
+ if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+ } else {
+ $thumbfile = $file->largethumb;
+ }
+
+ // Grab the file
+ if ($thumbfile && !empty($thumbfile)) {
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($thumbfile);
+ //$mime = $file->getMimeType();
+ $contents = $readfile->grabFile();
+ }
+ } //end subtype comparison
+ } //end get_entity
+
+ // Open error image if file was not found
+ if (!isset($contents) || is_null($contents) || $file->getSubtype()!='image') {
+ //$vars['url'].'mod/tidypics/graphics/img_error.jpg
+ forward('mod/tidypics/graphics/img_error.jpg');
+ } //end of default error image
+
+ // Return the thumbnail and exit
+ header("Content-type: image");
+ echo $contents;
+ exit;
+?> \ No newline at end of file
diff --git a/tidypics_user_instructions_.txt b/tidypics_user_instructions_.txt
new file mode 100644
index 000000000..eb2c2a809
--- /dev/null
+++ b/tidypics_user_instructions_.txt
@@ -0,0 +1,71 @@
+--------------------------------------------
+Tidypics Photo Gallery plugin version 1.05
+Release #5.
+Release Date: October 27, 2008
+--------------------------------------------
+
+Installation
+------------------
+1. Drop into root/mod/
+2. Enable plugin via admin panel.
+3. Done
+
+
+
+Requirements
+------------------------
+Will function with all versions of elgg, but current SVN build is needed
+for consistency.
+Reason:
+Updating the album access persmissions will auto-update the access for all
+images contained in the album, but when updating each image entity,
+the metadata for that entity also needs to be updated. The function that accomplishes
+this is only in the current SVN build.
+If you do not use the current SVN build of elgg, you will likely get incorrectly
+synced access permissions. Just wait for elg 1.1 and all will be dandy.
+No changes need to be made to tidypics since the function is called via hook.
+
+
+
+Recorded problems:
+----------------------------
+1. when viewing an individual album, the image gallery displayed is a collection
+ of floated divs. If pagination is enabled the bottom pagination bar does not
+ clear the floated images and you will get a messy display. I did not yet
+ research a better way to create a gallery view while being inline with elggs listing functions.
+
+2. The delete action does not delete any actual .
+ The current method should work, but it does not.
+ I am quite sure this is unintended, but we will have to wait till the core
+ gets updated.
+ Currently NO IMAGES will ever be deleted from your serverspace.
+
+3. The groups view is a little odd because all other content like blogs, pages, are in list view.
+ I refuse to put albums in list view, so if you want that, sorry! (just steal the list view from object/albums.php)
+
+
+Cost to use this plugin:
+----------------------------------
+
+ Participation in the tidypics group on community.elgg.org
+
+ We need:
+ ------------------------
+ 1. User testing
+ 2. Bug reports
+ 3. Functionality, usability, feature requests/discussions
+ 4. Developers: Feature enhancements.
+
+ If you do not pay the advertised cost of tidypics, you are stealing this plugin!
+ Don't be a taker!!
+
+ Bye!
+
+ - Jade
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/upload.php b/upload.php
new file mode 100644
index 000000000..320c5ce6d
--- /dev/null
+++ b/upload.php
@@ -0,0 +1,49 @@
+<?php
+ /**
+ * Elgg Photos
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+ global $CONFIG;
+
+
+ // Get the current page's owner
+ if ($album = (int) get_input('container_guid'))
+ {
+ $album_entity = get_entity($album);
+
+ //if album does not exist or user does not have access
+ if(!$album_entity || !$album_entity->canEdit())
+ forward('pg/photos/owned/');
+
+ //set group to "real" container
+ $container = $album_entity->container_guid;
+ set_page_owner($container);
+ }
+ else
+ forward('pg/photos/owned/');
+
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($page_owner->getGUID());
+ }
+
+ set_context('photos');
+ $title = elgg_echo('album:addpix');
+ $area2 .= elgg_view_title($title);
+
+ $area2 .= '<h2><a href="' . $album_entity->getURL() . '">'. $album_entity->title. '</a></h2>';
+
+ $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album ) );
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3);
+
+ page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/view.php b/view.php
new file mode 100644
index 000000000..e0121baae
--- /dev/null
+++ b/view.php
@@ -0,0 +1,62 @@
+<?php
+
+ /**
+ * full view of an image
+ * Given a GUID, this page will try and display any entity
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // Get the GUID of the entity we want to view
+ $guid = (int) get_input('guid');
+ $shell = get_input('shell');
+ if ($shell == "no") {
+ $shell = false;
+ } else {
+ $shell = true;
+ }
+
+ $context = get_input('context');
+ if ($context) set_context($context);
+
+ // Get the entity, if possible
+ if ($entity = get_entity($guid)) {
+
+ //set "real" container - image container is the album , group/user is the album container
+ $top_container = get_entity($entity->container_guid)->container_guid;
+
+ if ($top_container) {
+ set_page_owner($top_container);
+ } else {
+ set_page_owner($entity->owner_guid);
+ }
+
+ // Set the body to be the full view of the entity, and the title to be its title
+ $area2 = elgg_view_entity($entity,true);
+ if ($shell) {
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2);
+ } else {
+ $body = $area2;
+ }
+
+ } else {
+ $body = elgg_echo('notfound');
+ }
+
+ // Display the page
+ if ($shell) {
+ page_draw("", $body);
+ } else {
+ header("Content-type: text/html; charset=UTF-8");
+ echo $body;
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/input/accessRead.php b/views/default/input/accessRead.php
new file mode 100644
index 000000000..81392b19f
--- /dev/null
+++ b/views/default/input/accessRead.php
@@ -0,0 +1,61 @@
+<?php
+
+ /**
+ * Elgg access level input
+ * this is a custom input that disables the given value, but passes the value discreetly
+ * we need this because using "disabled" inputs do not pass values and will store as default 0
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['js'] Any Javascript to enter into the input tag
+ * @uses $vars['internalname'] The name of the input field
+ *
+ */
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-access";
+
+ //default no array sent get all normal select values
+ if (!is_array($vars['options']))
+ {
+ $vars['options'] = array();
+ $vars['options'] = get_write_access_array();
+ }
+
+ //if sending custom select values via array
+ if (is_array($vars['options']) && sizeof($vars['options']) > 0)
+ {
+
+ /* my hacks (pay no attention please =D )
+ //allow showing of group for write access
+ if($vars['group_write']) $vars['options'] = trigger_plugin_hook('access:collections:write','user',array('user_id' => $_SESSION['guid'], 'site_id' => 0),$vars['options']);
+ */
+
+ //developer check - to check the value being sent initially
+ //echo 'given value: '.$vars['value'].'<br>';
+
+ //if no value currently set - specify default
+ if (empty($vars['value']) && $vars['value'] != '0')
+ $vars['value'] = 2;
+
+
+ foreach($vars['options'] as $key => $option) {
+ if ($key == $vars['value']) {
+?>
+ <input type="text" value="<?php echo htmlentities($option, null, 'UTF-8'); ?>" class="<?php echo $class ?>" DISABLED>
+ <input type="hidden" name="<?php echo $vars['internalname']; ?>" value="<?php echo $key ;?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> class="<?php echo $class; ?>">
+
+<?php
+ }
+ }
+
+
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/input/cover_checkbox.php b/views/default/input/cover_checkbox.php
new file mode 100644
index 000000000..48c7d51cc
--- /dev/null
+++ b/views/default/input/cover_checkbox.php
@@ -0,0 +1,45 @@
+<?php
+
+ /**
+ * Elgg custom checkbox input used to define an album cover
+ * @ forms/edit.php
+ * i made custom check box because the default checkboxes allows for more than one box.
+ * it handles the checkboxes via arrays, but i only need one and i did not want to use time figuring it all out
+ * simple and sweet , one checkbox.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['js'] Any Javascript to enter into the input tag
+ * @uses $vars['internalname'] The name of the input field
+ * @uses $vars['options'] An array of strings representing the options for the checkbox field
+ *
+ */
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-checkboxes";
+
+ foreach($vars['options'] as $label => $option) {
+
+ if ($option != $vars['value']) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
+
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ }
+
+ $disabled = "";
+ if ($vars['disabled']) $disabled = ' disabled="yes" ';
+ echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" {$selected} value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/input/multi_radio.php b/views/default/input/multi_radio.php
new file mode 100644
index 000000000..11f4c13b8
--- /dev/null
+++ b/views/default/input/multi_radio.php
@@ -0,0 +1,42 @@
+<?php
+
+ /**
+ * Elgg radio input
+ * Displays a radio input field
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['js'] Any Javascript to enter into the input tag
+ * @uses $vars['internalname'] The name of the input field
+ * @uses $vars['options'] An array of strings representing the options for the radio field
+ *
+ */
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-checkboxes";
+
+ foreach($vars['options'] as $label => $option) {
+
+ if ($vars['set'] != $vars['value']) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
+
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ }
+
+ $disabled = "";
+ if ($vars['disabled']) $disabled = ' disabled="yes" ';
+ echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" {$selected} value=\"".htmlentities($vars['value'], null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/object/album.php b/views/default/object/album.php
new file mode 100644
index 000000000..b95d55eed
--- /dev/null
+++ b/views/default/object/album.php
@@ -0,0 +1,137 @@
+<?php
+ /**
+ * Elgg file browser.
+ * File renderer.
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+
+ $file = $vars['entity'];
+ $file_guid = $file->getGUID();
+ $tags = $file->tags;
+ $title = $file->title;
+ $desc = $file->description;
+ $owner = $vars['entity']->getOwnerEntity();
+ $friendlytime = friendly_time($vars['entity']->time_created);
+ $mime = $file->mimetype;
+
+ if (get_context() == "search") {
+
+ if (get_input('search_viewtype') == "gallery") {
+ //default gallery view for album listing @ /photos/owned/
+
+ //get album cover if one was set
+ if($file->cover)
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$file->cover.'&size=small" border="0" class="album_cover" alt="thumbnail"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/img_error.jpg" class="album_cover" alt="new album">';
+
+ ?>
+ <div class="album_gallery_item">
+ <a href="<?php echo $file->getURL();?>"><?php echo $title;?></a><br>
+ <a href="<?php echo $file->getURL();?>"><?php echo $album_cover;?></a><br>
+ <small><a href="<?php echo $vars['url'];?>pg/profile/<?php echo $owner->username;?>"><?php echo $owner->name;?></a> <?php echo $friendlytime;?><br>
+ <?php
+ //get the number of comments
+ $numcomments = elgg_count_comments($file);
+ if ($numcomments)
+ echo "<a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
+ ?>
+ </small>
+ </div>
+
+ <?php
+ } else {
+ //album list-entity view
+
+ $info = '<p><a href="' .$file->getURL(). '">'.$title.'</a></p>';
+ $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
+ $numcomments = elgg_count_comments($file);
+ if ($numcomments)
+ $info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
+ $info .= "</p>";
+
+ $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . "</a>";
+
+ echo elgg_view_listing($icon, $info);
+
+ }
+
+ } else {
+ // individual album view
+?>
+ <div id="pages_breadcrumbs">
+<?php
+ if (is_null(page_owner_entity()->username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos
+?>
+ <a href="<?php echo $vars['url'] . 'pg/photos/world'; ?>"><?php echo elgg_echo("albums"); ?></a>&nbsp;&#62;&nbsp;
+<?php
+ } else {
+?>
+ <a href="<?php echo $vars['url'] . 'pg/photos/owned/' . page_owner_entity()->username; ?>"><?php echo sprintf(elgg_echo("album:user"), page_owner_entity()->name); ?></a>&nbsp;&#62;&nbsp;
+<?php
+ }
+?>
+ <?php echo $title; ?>
+ </div>
+
+<?php
+ echo '<div id="tidypics_title">'.$title.'</div>';
+ echo '<div id="tidypics_desc">'.autop($desc).'</div>';
+
+ if ($file->canEdit()) { // add edits
+ // specific to my theme only
+ //add_submenu_item(elgg_echo('album:addpix'), $vars['url'] . "pg/photos/upload/". $file_guid , '', 'jade');
+ //add_submenu_item(elgg_echo('album:edit'), $vars['url'] . "mod/tidypics/edit.php?file_guid=". $file_guid , '', 'jade');
+ //add_submenu_item(elgg_echo('album:delete'), $vars['url'] . "action/tidypics/delete?file=". $file_guid , '', 'jade');
+
+?>
+ <div id="tidypics_controls">
+ <a href="<?php echo $vars['url'] . "pg/photos/upload/" . $file_guid ;?>"><?php echo elgg_echo('album:addpix');?></a>
+ <a href="<?php echo $vars['url']; ?>mod/tidypics/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('album:edit'); ?></a>&nbsp;
+
+ <?php echo elgg_view('output/confirmlink',array(
+ 'href' => $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(),
+ 'text' => elgg_echo("album:delete"),
+ 'confirm' => elgg_echo("album:delete:confirm"),
+ ));
+ ?>
+ </div>
+<?php
+ }
+
+ // display the simple image views. Uses: via 'object/image.php'
+ $count = get_entities("object","image", $file_guid, '', 999);
+
+ //build array for back | next links
+ $_SESSION['image_sort'] = array();
+
+ foreach($count as $image){
+ array_push($_SESSION['image_sort'], $image->guid);
+ }
+
+ if(count($count) > 0)
+ echo list_entities("object","image", $file_guid, 24, false);
+ else
+ echo elgg_echo('image:none');
+
+?>
+ <div class="clearfloat"></div>
+ <div id="tidypics_info">
+ <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
+ <?php echo elgg_echo('album:by');?> <b><a href="<?php echo $vars['url'] ;?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?><br>
+ <?php echo elgg_echo('image:total');?> <b><?php echo count($count);?></b><br>
+ </div>
+
+<?php
+ if ($vars['full']) {
+ echo elgg_view_comments($file);
+ }
+
+}
+?>
diff --git a/views/default/object/image.php b/views/default/object/image.php
new file mode 100644
index 000000000..063ad09cb
--- /dev/null
+++ b/views/default/object/image.php
@@ -0,0 +1,130 @@
+<?php
+ /**
+
+ * image object views
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+ $file = $vars['entity'];
+ $file_guid = $file->getGUID();
+ $tags = $file->tags;
+ $title = $file->title;
+ $desc = $file->description;
+ $owner = $vars['entity']->getOwnerEntity();
+ $friendlytime = friendly_time($vars['entity']->time_created);
+
+ $mime = $file->mimetype;
+
+if (get_context() == "search") { //if this is the search view
+
+
+ if (get_input('search_viewtype') == "gallery") {
+ ?>
+ <div class="album_images">
+ <a href="<?php echo $file->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $file_guid;?>&size=small" border="0" alt="thumbnail"/></a>
+ </div>
+ <?php
+ }
+ else{
+ //image list-entity view
+ $info = '<p><a href="' .$file->getURL(). '">'.$title.'</a></p>';
+ $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/photos/owned/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
+ $numcomments = elgg_count_comments($file);
+ if ($numcomments)
+ $info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
+ $info .= "</p>";
+ $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("tidypics/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . "</a>";
+
+ echo elgg_view_listing($icon, $info);
+ }
+}
+else { //tidypics image display
+
+ if (!$vars['full']) { //simple gallery view
+
+?>
+ <div class="album_images">
+ <a href="<?php echo $file->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $file_guid;?>&size=small" border="0" alt="thumbnail"/></a>
+ </div>
+<?php
+ }
+ else{ // individual full image view
+
+ $album = get_entity($file->container_guid);
+
+ //compile back | next links
+ $current = array_search($file_guid, $_SESSION['image_sort']);
+
+ if(!$current){ // means we are no longer using the correct album array
+
+ //rebuild the array ->
+ $count = get_entities("object","image", $album->guid, '', 999);
+ $_SESSION['image_sort'] = array();
+
+ foreach($count as $image){
+ array_push($_SESSION['image_sort'], $image->guid);
+ }
+
+ $current = array_search($file_guid, $_SESSION['image_sort']);
+ }
+
+ if(!$current == 0)
+ $back = '<a href="' .$vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current-1] . '">&#60;&#60;' . elgg_echo('image:back') . '</a>&nbsp;&nbsp;';
+
+ if(array_key_exists(($current+1), $_SESSION['image_sort']))
+ $next = '&nbsp;&nbsp;<a href="' . $vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current+1] . '">' . elgg_echo('image:next') . '&#62;&#62;</a>';
+
+?>
+ <div id="pages_breadcrumbs">
+<?php
+ if (is_null(page_owner_entity()->username) || empty(page_owner_entity()->username)) { //when no owner available, link to world photos
+?>
+ <a href="<?php echo $vars['url'] . 'pg/photos/world'; ?>"><?php echo elgg_echo("albums"); ?></a>&nbsp;&#62;&nbsp;
+<?php
+ } else {
+?>
+ <a href="<?php echo $vars['url'] . 'pg/photos/owned/' . page_owner_entity()->username; ?>"><?php echo sprintf(elgg_echo("album:user"), page_owner_entity()->name); ?></a>&nbsp;&#62;&nbsp;
+<?php
+ }
+?>
+ <a href="<?php echo $album->getURL(); ?>"><?php echo $album->title; ?></a>&nbsp;&#62;&nbsp;
+ <?php echo $current+1 . ' / ' . sizeof($_SESSION['image_sort']); ?>
+ </div>
+<?php
+ echo '<div id="tidypics_title">' . $title . '</div>';
+ echo '<div id="tidypics_desc">' . autop($desc) . '</div>';
+ echo '<div id="image_full">';
+ echo '<div id="image_nav">' . $back . $next . '</div>';
+ if($next) echo '<a href="' . $vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current+1] . '">';
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $file_guid . '&size=large" border="0" alt="' . $title . '"/>';
+ if($next) echo '</a>';
+ echo '</div>';
+?>
+ <div id="tidypics_controls">
+ <a target="_new" href="<?php echo $vars['url']; ?>action/tidypics/download?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo("image:download"); ?></a>&nbsp;
+<?php
+ if ($file->canEdit()) { // add edit controls
+?>
+ <a href="<?php echo $vars['url']; ?>mod/tidypics/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('image:edit'); ?></a>&nbsp;
+ <?php echo elgg_view('output/confirmlink',array(
+ 'href' => $vars['url'] . "action/tidypics/delete?file=" . $file->getGUID(),
+ 'text' => elgg_echo("image:delete"),
+ 'confirm' => elgg_echo("image:delete:confirm"),
+ ));
+ }
+ ?>
+ </div>
+
+ <div id="tidypics_info">
+ <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
+ <?php echo elgg_echo('image:by');?> <b><a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?><br>
+ </div>
+<?php
+ echo elgg_view_comments($file);
+ }
+
+}
+?> \ No newline at end of file
diff --git a/views/default/river/object/album/annotate.php b/views/default/river/object/album/annotate.php
new file mode 100644
index 000000000..691b0c7ec
--- /dev/null
+++ b/views/default/river/object/album/annotate.php
@@ -0,0 +1,13 @@
+<?php
+
+ $statement = $vars['statement'];
+ $performed_by = $statement->getSubject();
+ $object = $statement->getObject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("album:river:annotate"),$url) . " ";
+ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("album:river:item") . "</a>";
+
+ echo $string;
+
+?> \ No newline at end of file
diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php
new file mode 100644
index 000000000..68553309c
--- /dev/null
+++ b/views/default/river/object/album/create.php
@@ -0,0 +1,13 @@
+<?php
+
+ $statement = $vars['statement'];
+ $performed_by = $statement->getSubject();
+ $object = $statement->getObject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("album:river:created"),$url) . " ";
+ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("album:river:item") . "</a>";
+
+ echo $string;
+
+?> \ No newline at end of file
diff --git a/views/default/river/object/image/annotate.php b/views/default/river/object/image/annotate.php
new file mode 100644
index 000000000..b0b1b8719
--- /dev/null
+++ b/views/default/river/object/image/annotate.php
@@ -0,0 +1,13 @@
+<?php
+
+ $statement = $vars['statement'];
+ $performed_by = $statement->getSubject();
+ $object = $statement->getObject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("image:river:annotate"),$url) . " ";
+ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("image:river:item") . "</a>";
+
+ echo $string;
+
+?> \ No newline at end of file
diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php
new file mode 100644
index 000000000..3f5bbb5e8
--- /dev/null
+++ b/views/default/river/object/image/create.php
@@ -0,0 +1,13 @@
+<?php
+
+ $statement = $vars['statement'];
+ $performed_by = $statement->getSubject();
+ $object = $statement->getObject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("image:river:created"),$url) . " ";
+ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("image:river:item") . "</a>";
+
+ echo $string;
+
+?> \ No newline at end of file
diff --git a/views/default/settings/tidypics/edit.php b/views/default/settings/tidypics/edit.php
new file mode 100644
index 000000000..2c63edff8
--- /dev/null
+++ b/views/default/settings/tidypics/edit.php
@@ -0,0 +1,10 @@
+<?php
+ $maxfilesize = $vars['entity']->maxfilesize;
+ if (!$maxfilesize) $maxfilesize = (int) 10240; //set the default maximum file size to 10MB (1024KB * 10 = 10240KB = 10MB)
+
+?>
+<p>
+ <?php echo elgg_echo('tidypics:settings:maxfilesize'); ?>
+
+ <?php echo elgg_view('input/text', array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)); ?>
+</p> \ No newline at end of file
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
new file mode 100644
index 000000000..f9f5b09e6
--- /dev/null
+++ b/views/default/tidypics/css.php
@@ -0,0 +1,128 @@
+<?php
+ /**
+ * tidypics CSS extender
+ */
+?>
+ /* --- independent view for image/album SHARED --- */
+
+#tidypics_title{
+ font-size:1.2em;
+ font-weight:bold;
+}
+#tidypics_desc{
+ padding:0 20px;
+ font-style:italic;
+}
+#tidypics_info{
+ padding:20px;
+ line-height:1.5em;
+}
+
+#tidypics_controls{
+ text-align:center;
+ margin-bottom:10px;
+}
+
+#tidypics_controls a{
+ margin:10px;
+}
+
+ /* independent album view only */
+
+.album_images{
+ float:left;
+ width:160px;
+ height:160px;
+ margin:4px;
+ padding:5px;
+ border:1px solid #ccc;
+ text-align:center;
+}
+
+ /* independent image view only */
+
+#image_full{
+ text-align:center;
+ margin:10px;
+}
+#image_full img{
+ padding:5px;
+ border:1px solid #ccc;
+ margin:7px 0;
+}
+
+/* --- albums gallery view --- */
+
+.album_cover{
+ padding:2px;
+ border:1px solid #ccc;
+ margin:8px 0;
+}
+
+
+/* ------ album WIDGET VIEW ------ */
+
+#album_widget_container{
+ text-align:center;
+}
+
+.album_widget_single_item{
+
+}
+.album_widget_title{
+
+}
+.album_widget_timestamp {
+ color:#666666;
+ margin:0;
+}
+.collapsable_box #album_widget_layout {
+ margin:0;
+}
+
+/* --------- image upload/edit forms ------------ */
+
+#image_upload_list li{
+ margin:3px 0;
+}
+.edit_image_container{
+ padding:5px;
+ margin:5px 0;
+ overflow:auto;
+}
+.edit_images{
+ float:right;
+ width:160px;
+ height:160px;
+ margin:4px;
+ padding:5px;
+ border:1px solid #ccc;
+ text-align:center;
+}
+.image_info{
+ float:left;
+ width:60%;
+}
+.image_info label{
+ font-size:1em;
+}
+.edit_image{
+ float:right;
+ border:1px solid #ccc;
+ width:153px;
+ height:153px;
+}
+
+/* --------- tidypics river items ------------ */
+
+.river_image_create {
+ background: url(<?php echo $vars['url']; ?>mod/tidypics/graphics/icons/river_icon_image.gif) no-repeat left -1px;
+}
+.river_album_create {
+ background: url(<?php echo $vars['url']; ?>mod/tidypics/graphics/icons/river_icon_album.gif) no-repeat left -1px;
+}
+
+.pagination {
+ clear:both !important;
+}
+ \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php
new file mode 100644
index 000000000..efe4aa508
--- /dev/null
+++ b/views/default/tidypics/forms/edit.php
@@ -0,0 +1,115 @@
+<?php
+ /**
+ * Elgg images edit/add page
+ * This form is used to:
+ * - create albums
+ * - edit albums
+ * - edit images
+ */
+
+ //set stuff if we are editing existing album or image
+ if (isset($vars['entity'])) {
+ $title = sprintf(elgg_echo("album:edit"),$object->title);
+ $action = "tidypics/editalbum";
+ $title = $vars['entity']->title;
+ $body = $vars['entity']->description;
+ $tags = $vars['entity']->tags;
+ $access_id = $vars['entity']->access_id;
+ $subtype = $vars['subtype'];
+
+ // if nothing is sent, create new, but only new albums are sent here
+ // new images are sent to upload.php
+ } else {
+ $title = elgg_echo("album:add");
+ $action = "tidypics/addalbum";
+ $tags = "";
+ $title = "";
+ $description = "";
+ }
+
+ // in case we have some cached details
+ if (isset($vars['albumtitle'])) {
+ $title = $vars['albumtitle'];
+ $body = $vars['albumbody'];
+ $tags = $vars['albumtags'];
+ }
+
+ $container_guid = get_input('container_guid');
+ if (!$container_guid) $container_guid = page_owner();
+
+?>
+ <form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post">
+ <p>
+ <label><?php echo elgg_echo('album:title'); ?></label>
+ <?php echo elgg_view("input/text", array("internalname" => "albumtitle", "value" => $title,)); ?>
+ </p>
+<?php
+ if($vars['subtype'] == 'album' || $action == "tidypics/addalbum")
+ {
+?>
+ <p>
+ <label><?php echo elgg_echo('album:desc'); ?></label>
+ <?php echo elgg_view("input/text",array("internalname" => "albumbody","value" => $body,)); ?>
+ </p>
+<?php
+ } else {
+?>
+ <p>
+ <label><?php echo elgg_echo('caption'); ?></label>
+ <?php echo elgg_view("input/text",array("internalname" => "albumbody","value" => $body,)); ?>
+ </p>
+<?php
+ } //End album/image selection
+?>
+ <p>
+ <label><?php echo elgg_echo("tags"); ?></label>
+ <?php echo elgg_view("input/tags", array( "internalname" => "albumtags","value" => $tags,)); ?>
+ </p>
+
+ <?php
+
+ if($vars['subtype'] == 'image')
+ {
+ //if this is an image --
+ //ALBUM COVER: ask to set image to album cover ::
+ //ACCESS: only existing images come here :: so acess should already be initially set by album
+
+ $guid = $vars['entity']->guid;
+ $container_guid = $vars['entity']->container_guid;
+ $cover_guid = get_entity($container_guid)->cover;
+
+ if($cover_guid == $vars['entity']->guid)
+ $cover = 'yes';
+
+ ?>
+ <p>
+ <label><?php echo elgg_echo("album:cover"); ?></label>
+ <?php echo elgg_view("input/cover_checkbox", array( "internalname" => "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?>
+ </p>
+ <p>
+ <label><?php echo sprintf(elgg_echo('access'), "$subtype"); ?></label>
+ <?php echo elgg_view('input/accessRead', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </p>
+ <?php echo elgg_echo('image:access:note');?>
+ <?php
+ }
+ else{
+ //this is a new or existing album, both of which access is editable
+ ?>
+ <p>
+ <label><?php echo sprintf(elgg_echo('access'), "$subtype"); ?></label>
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </p>
+
+ <?php
+ }
+
+ if (isset($vars['entity'])) {
+ ?>
+ <input type="hidden" name="albumpost" value="<?php echo $vars['entity']->getGUID(); ?>" />
+ <?php
+ }
+ ?>
+ <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+ <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
+ </form> \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
new file mode 100644
index 000000000..252a660bd
--- /dev/null
+++ b/views/default/tidypics/forms/edit_multi.php
@@ -0,0 +1,44 @@
+<?php
+ /**
+ * form for mass editing all uploaded images
+ */
+?>
+<form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post">
+<?php
+
+ $file_array = $vars['file_array'];
+ $album_entity = get_entity($vars['album_guid']);
+ if(!$album_entity->cover) $no_cover = true;
+
+ foreach($file_array as $key => $file_guid){
+ $entity = get_entity($file_guid);
+ $guid = $entity->guid;
+ $body = $entity->description;
+ $tags = $entity->tags;
+ $container_guid = $entity->container_guid;
+ if($no_cover && !$cover) $cover = $guid;
+
+ echo '<div class="edit_image_container">';
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="edit_images" alt="' . $title . '"/>';
+ echo '<div class="image_info">';
+ echo '<p><label>' . elgg_echo('album:title') . '</label>';
+ echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";
+ echo '</p>';
+ echo '<p><label>' . elgg_echo('caption') . "</label>";
+ echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n";
+ echo "</p>";
+ echo '<p><label>' . elgg_echo("tags") . "</label>\n";
+ echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";
+ echo '</p>';
+ echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";
+ echo '<label>' . elgg_echo("album:cover") . '</label>';
+ echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array('yes'), 'set' => $cover));
+ echo '</div>';
+ echo '</div>';
+
+ }
+ echo elgg_echo('image:access:note');
+?>
+ <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+ <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
+ </form> \ No newline at end of file
diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php
new file mode 100644
index 000000000..35768f64c
--- /dev/null
+++ b/views/default/tidypics/forms/upload.php
@@ -0,0 +1,79 @@
+<?php
+ /**
+ * Elgg file browser uploader
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+ global $CONFIG;
+
+ //this is for image uploads only. Image edits are handled by edit.php form
+
+ $container_guid = get_input('container_guid');
+ $access_id = get_entity($vars['album'])->access_id;
+ if (get_plugin_setting('maxfilesize','tidypics')) {
+ if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) {
+ $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB
+ } else {
+ $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics');
+ }
+ } else {
+ $maxfilesize = 10240; //if the file size limit is not set, default to 10MB
+ }
+
+?>
+<script language="javascript">
+<!--
+
+var state = 'none';
+
+function showhide(layer_ref) {
+ if (state == 'block') {
+ state = 'none';
+ }
+ else {
+ state = 'block';
+ }
+ if (document.all) { //IS IE 4 or 5 (or 6 beta)
+ eval( "document.all." + layer_ref + ".style.display = state");
+ }
+ if (document.layers) { //IS NETSCAPE 4 or below
+ document.layers[layer_ref].display = state;
+ }
+ if (document.getElementById &&!document.all) {
+ hza = document.getElementById(layer_ref);
+ hza.style.display = state;
+ }
+ return false;
+}
+//-->
+</script>
+<form action="<?php echo $vars['url']; ?>action/tidypics/upload" enctype="multipart/form-data" method="post">
+ <p style="line-height:1.6em;">
+ <label><?php echo elgg_echo("images:upload"); ?></label><br />
+ <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br />
+ <div align="center" class="tidypics_loader" id="tidypics_loader" name="tidypics_loader" style="display:none;"><center><img alt="..." border="0" src="<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>" /></center></div>
+ <ol id="image_upload_list">
+<?php
+ for($x = 0; $x < 10; $x++){
+ echo '<li>' . elgg_view("input/file",array('internalname' => "upload_$x")) . "</li>\n";
+ }
+?>
+ </ol>
+ </p>
+
+ <label><?php echo sprintf(elgg_echo('access'), 'image'); ?></label>
+ <?php echo elgg_view('input/accessRead', array('internalname' => 'access_id','value' => $access_id)); ?>
+
+ <p>
+ <?php
+ if ($container_guid)
+ echo '<input type="hidden" name="container_guid" value="'.$container_guid.'" />';
+
+ ?>
+ <input type="submit" value="<?php echo elgg_echo("save"); ?>" onclick="showhide('tidypics_loader');" />
+ </p>
+
+</form> \ No newline at end of file
diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php
new file mode 100644
index 000000000..ea11006fa
--- /dev/null
+++ b/views/default/tidypics/groupprofile_albums.php
@@ -0,0 +1,60 @@
+<?php
+ //the number of files to display
+ $number = (int) $vars['entity']->num_display;
+ //if no number has been set, default to 5
+ if (!$number)
+ $number = 5;
+
+ $owner = page_owner_entity();
+ $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
+
+ echo '<div id="group_albums_widget">';
+ echo '<h2>' . elgg_echo('albums') . '</h2>';
+
+ if ($owner_albums) {
+ echo '<div id="album_widget_container">';
+ foreach($owner_albums as $album){
+
+ //get album cover if one was set
+ if($album->cover)
+ $album_cover = '<img src="'.$vars['url'].'/mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" border="0" class="album_cover" alt="album cover"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'/mod/tidypics/graphics/img_error.jpg" class="album_cover" alt="new album">';
+
+ ?>
+ <div class="album_widget_single_item">
+ <div class="album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
+ <div class="album_widget_timestamp"> <?php echo elgg_echo("album:created:on") . ' ' . friendly_time($album->time_created);?></div>
+ <?php
+ //get the number of comments
+ $numcomments = elgg_count_comments($album);
+ if ($numcomments)
+ echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a><br>";
+ ?>
+ <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a>
+ </div>
+ <?php
+ } //end of loop
+
+ //get a link to the group's album, or world if unavailable
+ if (is_null($owner->username) || empty($owner->username)) {
+ echo '<a href="' . $vars['url'] . 'pg/photos/world">' . elgg_echo('album:all') . '</a>';
+ } else {
+ echo '<a href="' . $vars['url'] . 'pg/photos/owned/' . $owner->username . '">' . elgg_echo('album:more') . '</a>';
+ }
+
+ //close album_widget_container div
+ echo "</div>";
+ } else {
+
+ echo '<div id="no_album_found">';
+ echo '<p class="pages_add_title">'.elgg_echo("album:none").'</p>';
+ if ($owner && ($owner->canWriteToContainer($_SESSION['user']))){
+ echo '<a class="add_topic_button" href='.$CONFIG->url .'pg/photos/new/'.$owner->username.'>'.elgg_echo("album:add").'</a>';
+ echo '</div>';
+ }
+
+ }
+ //close group_albums_widget div
+ echo "</div>";
+?> \ No newline at end of file
diff --git a/views/default/tidypics/icon.php b/views/default/tidypics/icon.php
new file mode 100644
index 000000000..614fa3ad0
--- /dev/null
+++ b/views/default/tidypics/icon.php
@@ -0,0 +1,41 @@
+<?php
+ /**
+ * Elgg tidypic icon
+ * Optionally you can specify a size.
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+
+if($vars['album']){
+ echo "<img src=\"{$CONFIG->wwwroot}mod/tidypics/graphics/icons/album.gif\" border=\"0\" />";
+}
+else{
+
+ $mime = $vars['mimetype'];
+ if (isset($vars['thumbnail'])) {
+ $thumbnail = $vars['thumbnail'];
+ } else {
+ $thumbnail = false;
+ }
+
+ $size = $vars['size'];
+ if ($size != 'large') {
+ $size = 'small';
+ }
+
+ if ($thumbnail && strpos($mime, "image/")!==false)
+ echo "<img src=\"{$vars['url']}action/tidypics/icon?file_guid={$vars['file_guid']}\" border=\"0\" />";
+ else
+ {
+ if ($size == 'large')
+ echo "<img src=\"{$CONFIG->wwwroot}mod/tidypics/graphics/icons/general_lrg.gif\" border=\"0\" />";
+ else
+ echo "<img src=\"{$CONFIG->wwwroot}mod/tidypics/graphics/icons/general.gif\" border=\"0\" />";
+ }
+}
+?> \ No newline at end of file
diff --git a/views/default/tidypics/menu.php b/views/default/tidypics/menu.php
new file mode 100644
index 000000000..4368993dd
--- /dev/null
+++ b/views/default/tidypics/menu.php
@@ -0,0 +1,16 @@
+<?php
+
+ /**
+ * Elgg hoverover extender for tidypics
+ *
+ * @package ElggFile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+?>
+
+ <p class="user_menu_file <?php if(get_context() == 'photos') echo 'profile_select';?>">
+ <a href="<?php echo $vars['url']; ?>pg/photos/owned/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("albums"); ?></a>
+ </p> \ No newline at end of file
diff --git a/views/default/widgets/album_view/edit.php b/views/default/widgets/album_view/edit.php
new file mode 100644
index 000000000..2d7c7708f
--- /dev/null
+++ b/views/default/widgets/album_view/edit.php
@@ -0,0 +1,21 @@
+<p>
+ <?php echo elgg_echo("album:num_albums"); ?>:
+
+ <?php
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 5;
+ ?>
+ <select name="params[num_display]">
+ <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
+ <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
+ <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
+ <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
+ <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
+ <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
+ <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
+ <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
+ <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
+ <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
+ <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
+ <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>
+ </select>
+</p> \ No newline at end of file
diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php
new file mode 100644
index 000000000..347332971
--- /dev/null
+++ b/views/default/widgets/album_view/view.php
@@ -0,0 +1,53 @@
+<?php
+ //the number of files to display
+ $number = (int) $vars['entity']->num_display;
+ //if no number has been set, default to 5
+ if (!$number)
+ $number = 5;
+
+ $owner = page_owner_entity();
+ $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
+
+ if ($owner_albums) {
+ echo '<div id="album_widget_container">';
+
+ foreach($owner_albums as $album){
+
+ //get album cover if one was set
+ if($album->cover)
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" border="0" class="album_cover" alt="' . $album->title . '"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/img_error.jpg" border="0" class="album_cover" alt="' . $album->title . '">';
+ ?>
+ <div class="album_widget_single_item">
+ <div class="album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
+ <div class="album_widget_timestamp"> <?php echo elgg_echo("album:created:on") . ' '. friendly_time($album->time_created);?></div>
+ <?php
+ //get the number of comments
+ $numcomments = elgg_count_comments($album);
+ if ($numcomments)
+ echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a><br>";
+ ?>
+ <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a>
+ </div>
+ <?php
+ }
+
+ //get a link to the users album
+ $users_album_url = $vars['url'] . "pg/photos/owned/" . $owner->username;
+ echo "<a href=\"{$users_album_url}\">" . elgg_echo('album:more') . "</a>";
+ echo "</div>";
+
+ } else {
+
+ echo '<p class="pages_add_title">'.elgg_echo("album:none").'</p>';
+
+ //check if owner has write rights. If so, let him edit the album
+ $container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
+
+ if ($owner->username == get_entity($container_guid)->username){
+ echo '<p class="pages_add"><a class="pages add" href='.$CONFIG->url .'pg/photos/new/'.$owner->username.'>'.elgg_echo("album:create").'</a></p>';
+ }
+
+ }
+?> \ No newline at end of file
diff --git a/views/rss/object/file.php b/views/rss/object/file.php
new file mode 100644
index 000000000..3bd84d076
--- /dev/null
+++ b/views/rss/object/file.php
@@ -0,0 +1,30 @@
+<?php
+
+ /**
+ * Elgg RSS file object view
+ *
+ * @package ElggFile
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $title = $vars['entity']->title;
+ if (empty($title)) {
+ $title = substr($vars['entity']->description,0,32);
+ if (strlen($vars['entity']->description) > 32)
+ $title .= " ...";
+ }
+
+?>
+
+ <item>
+ <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
+ <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
+ <link><?php echo $vars['entity']->getURL(); ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
+ <enclosure url="<?php echo $vars['url']; ?>action/file/download?file_guid=<?php echo $vars['entity']->getGUID(); ?>" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
+ </item>
diff --git a/world.php b/world.php
new file mode 100644
index 000000000..2e80f5393
--- /dev/null
+++ b/world.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg file browser
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+ $tag = get_input("tag");
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ // Get objects
+ $area2 = elgg_view_title($title = elgg_echo('album:all'));
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities('object','album', 0, 28);
+
+ set_context('photos');
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:all"),$_SESSION['user']->name), $body);
+?> \ No newline at end of file