aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-12-12 19:51:49 +0000
committerCash Costello <cash.costello@gmail.com>2009-12-12 19:51:49 +0000
commit621177abc2bc60e9edb3ca723a4afaa9d9e713ef (patch)
treed6064f1fe767d042ea41e4adea88e57b8e5138ff
parentb40060fafaba46e2fb8800b2c2e557a8c6bde9db (diff)
downloadelgg-621177abc2bc60e9edb3ca723a4afaa9d9e713ef.tar.gz
elgg-621177abc2bc60e9edb3ca723a4afaa9d9e713ef.tar.bz2
convert line endings to Unix
-rw-r--r--actions/addalbum.php146
-rw-r--r--actions/addtag.php208
-rw-r--r--actions/create_thumbnails.php122
-rw-r--r--actions/delete.php240
-rw-r--r--actions/deletetag.php114
-rw-r--r--actions/edit.php162
-rw-r--r--actions/edit_multi.php130
-rw-r--r--actions/imtest.php38
-rw-r--r--actions/settings.php140
-rw-r--r--actions/upload.php510
-rw-r--r--languages/en.php440
-rw-r--r--lib/resize.php1092
-rw-r--r--lib/tidypics.php596
-rw-r--r--pages/admin.php46
-rw-r--r--pages/download.php102
-rw-r--r--pages/edit.php100
-rw-r--r--pages/edit_multiple.php94
-rw-r--r--pages/friends.php74
-rw-r--r--pages/newalbum.php62
-rw-r--r--pages/ownedalbums.php100
-rw-r--r--pages/tagged.php98
-rw-r--r--pages/upload.php82
-rw-r--r--pages/viewalbum.php134
-rw-r--r--pages/viewimage.php114
-rw-r--r--pages/world.php60
-rw-r--r--start.php872
-rw-r--r--thumbnail.php156
-rw-r--r--views/default/annotation/annotate.php40
-rw-r--r--views/default/js/tagging.php604
-rw-r--r--views/default/river/object/album/create.php84
-rw-r--r--views/default/river/object/image/create.php56
-rw-r--r--views/default/river/object/image/tag.php44
-rw-r--r--views/default/tidypics/admin/help.php48
-rw-r--r--views/default/tidypics/admin/imagelib.php122
-rw-r--r--views/default/tidypics/admin/settings.php48
-rw-r--r--views/default/tidypics/admin/stats.php68
-rw-r--r--views/default/tidypics/admin/thumbnails.php64
-rw-r--r--views/default/tidypics/albums.php100
-rw-r--r--views/default/tidypics/breadcrumbs.php44
-rw-r--r--views/default/tidypics/exif.php26
-rw-r--r--views/default/tidypics/forms/edit.php234
-rw-r--r--views/default/tidypics/forms/edit_multi.php114
-rw-r--r--views/default/tidypics/forms/settings.php288
-rw-r--r--views/default/tidypics/gallery.php126
-rw-r--r--views/default/tidypics/groupprofile_albums.php28
-rw-r--r--views/default/tidypics/hover_menu.php22
-rw-r--r--views/default/tidypics/image_menu.php100
-rw-r--r--views/default/tidypics/tagging.php172
-rw-r--r--views/default/widgets/album_view/edit.php46
-rw-r--r--views/default/widgets/latest_photos/edit.php28
-rw-r--r--views/rss/object/album.php88
-rw-r--r--views/rss/object/file.php46
-rw-r--r--views/rss/object/image.php36
-rw-r--r--views/rss/tidypics/gallery.php34
54 files changed, 4371 insertions, 4371 deletions
diff --git a/actions/addalbum.php b/actions/addalbum.php
index ffc7ec9c7..8df488a92 100644
--- a/actions/addalbum.php
+++ b/actions/addalbum.php
@@ -1,74 +1,74 @@
-<?php
- /**
- * Tidypics Add New Album Action
- *
- */
-
- // Make sure we're logged in
- gatekeeper();
-
- // Get input data
- $title = get_input('tidypicstitle');
- $body = get_input('tidypicsbody');
- $tags = get_input('tidypicstags');
- $access = get_input('access_id');
- $container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
-
- // Cache to the session
- $_SESSION['tidypicstitle'] = $title;
- $_SESSION['tidypicsbody'] = $body;
- $_SESSION['tidypicstags'] = $tags;
-
- // Convert string of tags into a preformatted array
- $tagarray = string_to_tag_array($tags);
- // Make sure the title isn't blank
- if (empty($title)) {
- register_error(elgg_echo("album:blank"));
- forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
- // Otherwise, save the album
- } 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();
- $album->access_id = $access;
- // Set its title and description appropriately
- $album->title = $title;
- $album->description = $body;
-
- // we catch the adding images to new albums in the upload action and throw a river new album event
- $album->new_album = TP_NEW_ALBUM;
-
- // Before we can set metadata, we need to save the album
- 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
- if (is_array($tagarray)) {
- $album->tags = $tagarray;
- }
-
-
-
- // Success message
- system_message(elgg_echo("album:created"));
-
- // Remove the album post cache
- unset($_SESSION['tidypicstitle']);
- unset($_SESSION['tidypicsbody']);
- unset($_SESSION['tidypicstags']);
-
- // plugins can register to be told when a new Tidypics album has been created
- trigger_elgg_event('add', 'tp_album', $album);
-
- forward("pg/photos/upload/" . $album->guid);
- }
-
+<?php
+ /**
+ * Tidypics Add New Album Action
+ *
+ */
+
+ // Make sure we're logged in
+ gatekeeper();
+
+ // Get input data
+ $title = get_input('tidypicstitle');
+ $body = get_input('tidypicsbody');
+ $tags = get_input('tidypicstags');
+ $access = get_input('access_id');
+ $container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
+
+ // Cache to the session
+ $_SESSION['tidypicstitle'] = $title;
+ $_SESSION['tidypicsbody'] = $body;
+ $_SESSION['tidypicstags'] = $tags;
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags);
+ // Make sure the title isn't blank
+ if (empty($title)) {
+ register_error(elgg_echo("album:blank"));
+ forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
+ // Otherwise, save the album
+ } 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();
+ $album->access_id = $access;
+ // Set its title and description appropriately
+ $album->title = $title;
+ $album->description = $body;
+
+ // we catch the adding images to new albums in the upload action and throw a river new album event
+ $album->new_album = TP_NEW_ALBUM;
+
+ // Before we can set metadata, we need to save the album
+ 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
+ if (is_array($tagarray)) {
+ $album->tags = $tagarray;
+ }
+
+
+
+ // Success message
+ system_message(elgg_echo("album:created"));
+
+ // Remove the album post cache
+ unset($_SESSION['tidypicstitle']);
+ unset($_SESSION['tidypicsbody']);
+ unset($_SESSION['tidypicstags']);
+
+ // plugins can register to be told when a new Tidypics album has been created
+ trigger_elgg_event('add', 'tp_album', $album);
+
+ forward("pg/photos/upload/" . $album->guid);
+ }
+
?> \ No newline at end of file
diff --git a/actions/addtag.php b/actions/addtag.php
index 2c258db84..56268783e 100644
--- a/actions/addtag.php
+++ b/actions/addtag.php
@@ -1,104 +1,104 @@
-<?php
- /**
- * Tidypics Add Photo Tag
- *
- */
-
- gatekeeper();
- action_gatekeeper();
-
- $coordinates_str = get_input('coordinates');
-
- $user_id = get_input('user_id');
- $image_guid = get_input('image_guid');
- $word = get_input('word');
-
- if ($image_guid == 0) {
- register_error(elgg_echo("tidypics:phototagging:error"));
- forward($_SERVER['HTTP_REFERER']);
- }
-
- $image = get_entity($image_guid);
- if (!$image)
- {
- register_error(elgg_echo("tidypics:phototagging:error"));
- forward($_SERVER['HTTP_REFERER']);
- }
-
- // test for empty tag
- if ($user_id == 0 && empty($word)) {
- register_error(elgg_echo("tidypics:phototagging:error"));
- forward($_SERVER['HTTP_REFERER']);
- }
-
-
- $new_word_tag = false;
- if ($user_id != 0) {
- $relationships_type = 'user';
- $value = $user_id;
- } else {
- $relationships_type = 'word';
- $value = $word;
-
- // check to see if the photo has this tag and add if not
- if (!is_array($image->tags)) {
- if ($image->tags != $word) {
- $new_word_tag = true;
- $tagarray = $image->tags . ',' . $word;
- $tagarray = string_to_tag_array($tagarray);
- }
- } else {
- if (!in_array($word, $image->tags)) {
- $new_word_tag = true;
- $tagarray = $image->tags;
- $tagarray[] = $word;
- }
- }
- }
-
- // add new tag now so it is available in search
- if ($new_word_tag) {
- $image->clearMetadata('tags');
- $image->tags = $tagarray;
- }
-
- // create string for javascript tag object
- $tag->coords = $coordinates_str;
- $tag->type = $relationships_type;
- $tag->value = $value;
-
- $access_id = $image->getAccessID();
- $owner_id = get_loggedin_userid();
- $tagger = get_loggedin_user();
-
- //Save annotation
- if ($image->annotate('phototag', serialize($tag), $access_id, $owner_id)) {
- // if tag is a user id, add relationship for searching (find all images with user x)
- if ($relationships_type === 'user') {
- if (!check_entity_relationship($user_id, 'phototag', $image_guid)) {
- add_entity_relationship($user_id, 'phototag', $image_guid);
-
- // also add this to the river - subject is image, object is the tagged user
- if (function_exists('add_to_river'))
- add_to_river('river/object/image/tag', 'tag', $image_guid, $user_id, $access_id);
-
- // notify user of tagging as long as not self
- if ($owner_id != $user_id)
- notify_user($user_id, $owner_id, elgg_echo('tidypics:tag:subject'),
- sprintf(
- elgg_echo('tidypics:tag:body'),
- $image->title,
- $tagger->name,
- $image->getURL()
- )
- );
- }
- }
-
- system_message(elgg_echo("tidypics:phototagging:success"));
- }
-
-
- forward($_SERVER['HTTP_REFERER']);
-
-?>
+<?php
+ /**
+ * Tidypics Add Photo Tag
+ *
+ */
+
+ gatekeeper();
+ action_gatekeeper();
+
+ $coordinates_str = get_input('coordinates');
+
+ $user_id = get_input('user_id');
+ $image_guid = get_input('image_guid');
+ $word = get_input('word');
+
+ if ($image_guid == 0) {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ $image = get_entity($image_guid);
+ if (!$image)
+ {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ // test for empty tag
+ if ($user_id == 0 && empty($word)) {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+
+ $new_word_tag = false;
+ if ($user_id != 0) {
+ $relationships_type = 'user';
+ $value = $user_id;
+ } else {
+ $relationships_type = 'word';
+ $value = $word;
+
+ // check to see if the photo has this tag and add if not
+ if (!is_array($image->tags)) {
+ if ($image->tags != $word) {
+ $new_word_tag = true;
+ $tagarray = $image->tags . ',' . $word;
+ $tagarray = string_to_tag_array($tagarray);
+ }
+ } else {
+ if (!in_array($word, $image->tags)) {
+ $new_word_tag = true;
+ $tagarray = $image->tags;
+ $tagarray[] = $word;
+ }
+ }
+ }
+
+ // add new tag now so it is available in search
+ if ($new_word_tag) {
+ $image->clearMetadata('tags');
+ $image->tags = $tagarray;
+ }
+
+ // create string for javascript tag object
+ $tag->coords = $coordinates_str;
+ $tag->type = $relationships_type;
+ $tag->value = $value;
+
+ $access_id = $image->getAccessID();
+ $owner_id = get_loggedin_userid();
+ $tagger = get_loggedin_user();
+
+ //Save annotation
+ if ($image->annotate('phototag', serialize($tag), $access_id, $owner_id)) {
+ // if tag is a user id, add relationship for searching (find all images with user x)
+ if ($relationships_type === 'user') {
+ if (!check_entity_relationship($user_id, 'phototag', $image_guid)) {
+ add_entity_relationship($user_id, 'phototag', $image_guid);
+
+ // also add this to the river - subject is image, object is the tagged user
+ if (function_exists('add_to_river'))
+ add_to_river('river/object/image/tag', 'tag', $image_guid, $user_id, $access_id);
+
+ // notify user of tagging as long as not self
+ if ($owner_id != $user_id)
+ notify_user($user_id, $owner_id, elgg_echo('tidypics:tag:subject'),
+ sprintf(
+ elgg_echo('tidypics:tag:body'),
+ $image->title,
+ $tagger->name,
+ $image->getURL()
+ )
+ );
+ }
+ }
+
+ system_message(elgg_echo("tidypics:phototagging:success"));
+ }
+
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
diff --git a/actions/create_thumbnails.php b/actions/create_thumbnails.php
index 3869e2dcf..09743eef6 100644
--- a/actions/create_thumbnails.php
+++ b/actions/create_thumbnails.php
@@ -1,61 +1,61 @@
-<?php
- /**
- * Tidypics Thumbnail Creation Test
- *
- * Called through ajax
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
- include dirname(dirname(__FILE__)) . "/lib/resize.php";
-
- global $CONFIG;
-
- $guid = $_GET['guid'];
-
- $image = get_entity($guid);
- if (!$image || !($image instanceof TidypicsImage)) {
- echo "Unable to get original image";
- return;
- }
-
- $filename = $image->getFilename();
- $container_guid = $image->container_guid;
- if (!$filename || !$container_guid) {
- echo "Error retrieving information about the image";
- return;
- }
-
- $title = $image->title;
- $prefix = "image/" . $container_guid . "/";
- $filestorename = substr($filename, strlen($prefix));
-
- $image_lib = get_plugin_setting('image_lib', 'tidypics');
- if (!$image_lib)
- $image_lib = "GD";
-
- if ($image_lib == 'ImageMagick') { // ImageMagick command line
-
- if (tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
- echo "Failed to create thumbnails";
- }
-
- } else if ($image_lib == 'ImageMagickPHP') { // imagick PHP extension
-
- if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
- echo "Failed to create thumbnails";
- }
-
- } else {
-
- if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
- echo "Failed to create thumbnails";
- }
-
- } // end of image library selector
-
- echo "<img id=\"tidypics_image\" src=\"{$CONFIG->wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&amp;size=large\" alt=\"{$title}\" />";
-
-?>
+<?php
+ /**
+ * Tidypics Thumbnail Creation Test
+ *
+ * Called through ajax
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+ include dirname(dirname(__FILE__)) . "/lib/resize.php";
+
+ global $CONFIG;
+
+ $guid = $_GET['guid'];
+
+ $image = get_entity($guid);
+ if (!$image || !($image instanceof TidypicsImage)) {
+ echo "Unable to get original image";
+ return;
+ }
+
+ $filename = $image->getFilename();
+ $container_guid = $image->container_guid;
+ if (!$filename || !$container_guid) {
+ echo "Error retrieving information about the image";
+ return;
+ }
+
+ $title = $image->title;
+ $prefix = "image/" . $container_guid . "/";
+ $filestorename = substr($filename, strlen($prefix));
+
+ $image_lib = get_plugin_setting('image_lib', 'tidypics');
+ if (!$image_lib)
+ $image_lib = "GD";
+
+ if ($image_lib == 'ImageMagick') { // ImageMagick command line
+
+ if (tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } else if ($image_lib == 'ImageMagickPHP') { // imagick PHP extension
+
+ if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } else {
+
+ if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } // end of image library selector
+
+ echo "<img id=\"tidypics_image\" src=\"{$CONFIG->wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&amp;size=large\" alt=\"{$title}\" />";
+
+?>
diff --git a/actions/delete.php b/actions/delete.php
index 1a518af9e..5506c2303 100644
--- a/actions/delete.php
+++ b/actions/delete.php
@@ -1,121 +1,121 @@
-<?php
-
- /**
- * Tidypics Delete Action for Images and Albums
- *
- */
-
- // must be logged in
- gatekeeper();
-
- $forward_url = 'pg/photos/world'; // by default forward to world photos
-
- $guid = (int) get_input('guid');
-
- $entity = get_entity($guid);
- if (!$entity) { // unable to get Elgg entity
- register_error(elgg_echo("file:deletefailed"));
- forward($forward_url);
- }
-
- if (!$entity->canEdit()) { // user doesn't have permissions
- register_error(elgg_echo("file:deletefailed"));
- forward($forward_url);
- }
-
- $subtype = $entity->getSubtype();
- $container = get_entity($entity->container_guid);
-
- if ($subtype != 'image' && $subtype != 'album') { // how did we even get here?
- register_error(elgg_echo("file:deletefailed"));
- forward($forward_url);
- }
-
- $owner_guid = 0; // group or user
- if ($subtype == 'image') { //deleting an image
- $album = get_entity($entity->container_guid);
- $owner_guid = $album->container_guid;
- $forward_url = $container->getURL(); //forward back to album after deleting pictures
- $images = array($entity);
- // plugins can register to be told when a Tidypics image has been deleted
- trigger_elgg_event('delete', 'tp_image', $entity);
- } else { //deleting an album
- $owner_guid = $entity->container_guid;
- $forward_url = 'pg/photos/owned/' . $container->username;
- //get all the images from this album as long as less than 999 images
- $images = get_entities("object", "image", $guid, '', 999);
- // plugins can register to be told when a Tidypics album has been deleted
- trigger_elgg_event('delete', 'tp_album', $entity);
- }
-
- // make sure we decrease the repo size for the size quota
- $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
-
- //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);
- $image_repo_size -= $delfile->size();
-
- 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 (!$entity->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
-
- create_metadata($owner_guid, "image_repo_size", $image_repo_size, 'integer', $owner_guid);
-
- forward($forward_url);
-
+<?php
+
+ /**
+ * Tidypics Delete Action for Images and Albums
+ *
+ */
+
+ // must be logged in
+ gatekeeper();
+
+ $forward_url = 'pg/photos/world'; // by default forward to world photos
+
+ $guid = (int) get_input('guid');
+
+ $entity = get_entity($guid);
+ if (!$entity) { // unable to get Elgg entity
+ register_error(elgg_echo("file:deletefailed"));
+ forward($forward_url);
+ }
+
+ if (!$entity->canEdit()) { // user doesn't have permissions
+ register_error(elgg_echo("file:deletefailed"));
+ forward($forward_url);
+ }
+
+ $subtype = $entity->getSubtype();
+ $container = get_entity($entity->container_guid);
+
+ if ($subtype != 'image' && $subtype != 'album') { // how did we even get here?
+ register_error(elgg_echo("file:deletefailed"));
+ forward($forward_url);
+ }
+
+ $owner_guid = 0; // group or user
+ if ($subtype == 'image') { //deleting an image
+ $album = get_entity($entity->container_guid);
+ $owner_guid = $album->container_guid;
+ $forward_url = $container->getURL(); //forward back to album after deleting pictures
+ $images = array($entity);
+ // plugins can register to be told when a Tidypics image has been deleted
+ trigger_elgg_event('delete', 'tp_image', $entity);
+ } else { //deleting an album
+ $owner_guid = $entity->container_guid;
+ $forward_url = 'pg/photos/owned/' . $container->username;
+ //get all the images from this album as long as less than 999 images
+ $images = get_entities("object", "image", $guid, '', 999);
+ // plugins can register to be told when a Tidypics album has been deleted
+ trigger_elgg_event('delete', 'tp_album', $entity);
+ }
+
+ // make sure we decrease the repo size for the size quota
+ $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+
+ //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);
+ $image_repo_size -= $delfile->size();
+
+ 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 (!$entity->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
+
+ create_metadata($owner_guid, "image_repo_size", $image_repo_size, 'integer', $owner_guid);
+
+ forward($forward_url);
+
?> \ No newline at end of file
diff --git a/actions/deletetag.php b/actions/deletetag.php
index 3a76f6e99..becf1fedb 100644
--- a/actions/deletetag.php
+++ b/actions/deletetag.php
@@ -1,57 +1,57 @@
-<?php
- /**
- * Tidypics Delete Photo Tag
- *
- */
-
- gatekeeper();
- action_gatekeeper();
-
- $image_guid = get_input('image_guid');
- $tags = get_input('tags');
-
-
- if ($image_guid == 0) {
- register_error(elgg_echo("tidypics:phototagging:error"));
- forward($_SERVER['HTTP_REFERER']);
- }
-
- $image = get_entity($image_guid);
- if (!$image)
- {
- register_error(elgg_echo("tidypics:phototagging:error"));
- forward($_SERVER['HTTP_REFERER']);
- }
-
- foreach ($tags as $id => $value) {
- // delete normal tag if it exists
- if (is_array($image->tags)) {
- $index = array_search($value, $image->tags);
- if ($index !== false) {
- $tagarray = $image->tags;
- unset($tagarray[$index]);
- $image->clearMetadata('tags');
- $image->tags = $tagarray;
- }
- } else {
- if ($value === $image->tags) {
- $image->clearMetadata('tags');
- }
- }
-
- // delete relationship if this tag is a user
- $annotation = get_annotation($id);
- $photo_tag = unserialize($annotation->value);
- if ($photo_tag->type == 'user') {
- remove_entity_relationship($photo_tag->value, 'phototag', $image_guid);
- }
-
- // delete the photo tag annotation
- delete_annotation($id);
- }
-
- system_message(elgg_echo("tidypics:deletetag:success"));
-
- forward($_SERVER['HTTP_REFERER']);
-
-?>
+<?php
+ /**
+ * Tidypics Delete Photo Tag
+ *
+ */
+
+ gatekeeper();
+ action_gatekeeper();
+
+ $image_guid = get_input('image_guid');
+ $tags = get_input('tags');
+
+
+ if ($image_guid == 0) {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ $image = get_entity($image_guid);
+ if (!$image)
+ {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ foreach ($tags as $id => $value) {
+ // delete normal tag if it exists
+ if (is_array($image->tags)) {
+ $index = array_search($value, $image->tags);
+ if ($index !== false) {
+ $tagarray = $image->tags;
+ unset($tagarray[$index]);
+ $image->clearMetadata('tags');
+ $image->tags = $tagarray;
+ }
+ } else {
+ if ($value === $image->tags) {
+ $image->clearMetadata('tags');
+ }
+ }
+
+ // delete relationship if this tag is a user
+ $annotation = get_annotation($id);
+ $photo_tag = unserialize($annotation->value);
+ if ($photo_tag->type == 'user') {
+ remove_entity_relationship($photo_tag->value, 'phototag', $image_guid);
+ }
+
+ // delete the photo tag annotation
+ delete_annotation($id);
+ }
+
+ system_message(elgg_echo("tidypics:deletetag:success"));
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
diff --git a/actions/edit.php b/actions/edit.php
index 91c465828..cdf9420b2 100644
--- a/actions/edit.php
+++ b/actions/edit.php
@@ -1,81 +1,81 @@
-<?php
-
- /**
- * Tidypics edit album/image action
- *
- */
-
- // Make sure we're logged in
- gatekeeper();
-
- // Get input data
- $guid = (int) get_input('guid'); // guid of image or album
- $title = get_input('tidypicstitle');
- $body = get_input('tidypicsbody');
- $access = get_input('access_id');
- $tags = get_input('tidypicstags');
- $subtype = get_input('subtype');
- $cover = get_input('cover');
- if (is_array($cover)) $cover = $cover[0];
-
- $container_guid = get_input('container_guid');
-
- // Make sure we actually have permission to edit
- $entity = get_entity($guid);
- if (!$entity->canEdit()) {
- forward();
- }
-
- // Get owning user/group
- $owner = get_entity($entity->getOwner());
-
- // change access only if access is different from current
- if ($subtype == 'album' && $entity->access_id != $access) {
- $entity->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();
- }
- }
-
-
- // Set its title and description appropriately
- $entity->title = $title;
- $entity->description = $body;
-
- // Before we can set metadata, we need to save the entity
- if (!$entity->save()) {
- register_error(elgg_echo("album:error"));
- $entity->delete();
- forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
- }
-
- // Now let's add tags
- $tagarray = string_to_tag_array($tags);
- $entity->clearMetadata('tags');
- if (is_array($tagarray)) {
- $entity->tags = $tagarray;
- }
-
- //if cover meta is sent from image save as metadata
- if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {
- $album = get_entity($container_guid);
- $album->cover = $entity->guid;
- }
-
- // Success message
- if ($subtype == 'album') {
- system_message(elgg_echo("album:edited"));
- // plugins can register to be told when a Tidypics album has been updated
- trigger_elgg_event('update', 'tp_album', $entity);
- } else {
- system_message(elgg_echo('images:edited'));
- // plugins can register to be told when a Tidypics image has been updated
- trigger_elgg_event('update', 'tp_image', $entity);
- }
-
- forward($entity->getURL());
-?>
+<?php
+
+ /**
+ * Tidypics edit album/image action
+ *
+ */
+
+ // Make sure we're logged in
+ gatekeeper();
+
+ // Get input data
+ $guid = (int) get_input('guid'); // guid of image or album
+ $title = get_input('tidypicstitle');
+ $body = get_input('tidypicsbody');
+ $access = get_input('access_id');
+ $tags = get_input('tidypicstags');
+ $subtype = get_input('subtype');
+ $cover = get_input('cover');
+ if (is_array($cover)) $cover = $cover[0];
+
+ $container_guid = get_input('container_guid');
+
+ // Make sure we actually have permission to edit
+ $entity = get_entity($guid);
+ if (!$entity->canEdit()) {
+ forward();
+ }
+
+ // Get owning user/group
+ $owner = get_entity($entity->getOwner());
+
+ // change access only if access is different from current
+ if ($subtype == 'album' && $entity->access_id != $access) {
+ $entity->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();
+ }
+ }
+
+
+ // Set its title and description appropriately
+ $entity->title = $title;
+ $entity->description = $body;
+
+ // Before we can set metadata, we need to save the entity
+ if (!$entity->save()) {
+ register_error(elgg_echo("album:error"));
+ $entity->delete();
+ forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
+ }
+
+ // Now let's add tags
+ $tagarray = string_to_tag_array($tags);
+ $entity->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $entity->tags = $tagarray;
+ }
+
+ //if cover meta is sent from image save as metadata
+ if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {
+ $album = get_entity($container_guid);
+ $album->cover = $entity->guid;
+ }
+
+ // Success message
+ if ($subtype == 'album') {
+ system_message(elgg_echo("album:edited"));
+ // plugins can register to be told when a Tidypics album has been updated
+ trigger_elgg_event('update', 'tp_album', $entity);
+ } else {
+ system_message(elgg_echo('images:edited'));
+ // plugins can register to be told when a Tidypics image has been updated
+ trigger_elgg_event('update', 'tp_image', $entity);
+ }
+
+ forward($entity->getURL());
+?>
diff --git a/actions/edit_multi.php b/actions/edit_multi.php
index 92252b6dd..c7099e6db 100644
--- a/actions/edit_multi.php
+++ b/actions/edit_multi.php
@@ -1,66 +1,66 @@
-<?php
- /**
- * Elgg album: multi image edit action
- *
- * This is called when uploading images
- */
-
- // Make sure we're logged in
- gatekeeper();
-
- // Get input data
- $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);
- $cover = get_input('cover');
- $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 title appropriately
- if ($title_array[$key])
- $image->title = $title_array[$key];
- else
- $image->title = substr($image->originalfilename, 0, strrpos($image->originalfilename, '.'));
-
- //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());
-
+<?php
+ /**
+ * Elgg album: multi image edit action
+ *
+ * This is called when uploading images
+ */
+
+ // Make sure we're logged in
+ gatekeeper();
+
+ // Get input data
+ $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);
+ $cover = get_input('cover');
+ $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 title appropriately
+ if ($title_array[$key])
+ $image->title = $title_array[$key];
+ else
+ $image->title = substr($image->originalfilename, 0, strrpos($image->originalfilename, '.'));
+
+ //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/imtest.php b/actions/imtest.php
index 8d5171785..cbe15a1c1 100644
--- a/actions/imtest.php
+++ b/actions/imtest.php
@@ -1,19 +1,19 @@
-<?php
- /**
- * Tidypics ImageMagick Location Test
- *
- * Called through ajax
- */
-
- $location = $_GET['location'];
-
- $command = $location . "convert -version";
-
- $result = system($command, $return_val);
-
- if ($return_val == 0) {
- echo $result;
- } else {
- echo "Unable to run ImageMagick. Please check the path.";
- }
-?>
+<?php
+ /**
+ * Tidypics ImageMagick Location Test
+ *
+ * Called through ajax
+ */
+
+ $location = $_GET['location'];
+
+ $command = $location . "convert -version";
+
+ $result = system($command, $return_val);
+
+ if ($return_val == 0) {
+ echo $result;
+ } else {
+ echo "Unable to run ImageMagick. Please check the path.";
+ }
+?>
diff --git a/actions/settings.php b/actions/settings.php
index 6b115b049..e16e7960e 100644
--- a/actions/settings.php
+++ b/actions/settings.php
@@ -1,70 +1,70 @@
-<?php
- /**
- * Save settings of Tidypics
- *
- */
-
- global $CONFIG;
-
- admin_gatekeeper();
- action_gatekeeper();
-
-
- // Params array (text boxes and drop downs)
- $params = get_input('params');
- $result = false;
- foreach ($params as $k => $v) {
- if (!set_plugin_setting($k, $v, 'tidypics')) {
- register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics'));
- forward($_SERVER['HTTP_REFERER']);
- }
- }
-
- // check boxes
- if (is_array(get_input('download_link'))) // this can be done due to way Elgg uses checkboxes
- set_plugin_setting('download_link', 'enabled', 'tidypics');
- else
- set_plugin_setting('download_link', 'disabled', 'tidypics');
-
- if (is_array(get_input('tagging')))
- set_plugin_setting('tagging', 'enabled', 'tidypics');
- else
- set_plugin_setting('tagging', 'disabled', 'tidypics');
-
- if (is_array(get_input('photo_ratings')))
- set_plugin_setting('photo_ratings', 'enabled', 'tidypics');
- else
- set_plugin_setting('photo_ratings', 'disabled', 'tidypics');
-
- if (is_array(get_input('exif')))
- set_plugin_setting('exif', 'enabled', 'tidypics');
- else
- set_plugin_setting('exif', 'disabled', 'tidypics');
-
- if (is_array(get_input('view_count')))
- set_plugin_setting('view_count', 'enabled', 'tidypics');
- else
- set_plugin_setting('view_count', 'disabled', 'tidypics');
-
- if (is_array(get_input('grp_perm_override')))
- set_plugin_setting('grp_perm_override', 'enabled', 'tidypics');
- else
- set_plugin_setting('grp_perm_override', 'disabled', 'tidypics');
-
-
- // image sizes
- $image_sizes = array();
- $image_sizes['large_image_width'] = get_input('large_thumb_width');
- $image_sizes['large_image_height'] = get_input('large_thumb_height');
- $image_sizes['small_image_width'] = get_input('small_thumb_width');
- $image_sizes['small_image_height'] = get_input('small_thumb_height');
- $image_sizes['thumb_image_width'] = get_input('thumb_width');
- $image_sizes['thumb_image_height'] = get_input('thumb_height');
- set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
-
-
-
- system_message(elgg_echo('tidypics:settings:save:ok'));
-
- forward($_SERVER['HTTP_REFERER']);
-?>
+<?php
+ /**
+ * Save settings of Tidypics
+ *
+ */
+
+ global $CONFIG;
+
+ admin_gatekeeper();
+ action_gatekeeper();
+
+
+ // Params array (text boxes and drop downs)
+ $params = get_input('params');
+ $result = false;
+ foreach ($params as $k => $v) {
+ if (!set_plugin_setting($k, $v, 'tidypics')) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics'));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+ }
+
+ // check boxes
+ if (is_array(get_input('download_link'))) // this can be done due to way Elgg uses checkboxes
+ set_plugin_setting('download_link', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('download_link', 'disabled', 'tidypics');
+
+ if (is_array(get_input('tagging')))
+ set_plugin_setting('tagging', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('tagging', 'disabled', 'tidypics');
+
+ if (is_array(get_input('photo_ratings')))
+ set_plugin_setting('photo_ratings', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('photo_ratings', 'disabled', 'tidypics');
+
+ if (is_array(get_input('exif')))
+ set_plugin_setting('exif', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('exif', 'disabled', 'tidypics');
+
+ if (is_array(get_input('view_count')))
+ set_plugin_setting('view_count', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('view_count', 'disabled', 'tidypics');
+
+ if (is_array(get_input('grp_perm_override')))
+ set_plugin_setting('grp_perm_override', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('grp_perm_override', 'disabled', 'tidypics');
+
+
+ // image sizes
+ $image_sizes = array();
+ $image_sizes['large_image_width'] = get_input('large_thumb_width');
+ $image_sizes['large_image_height'] = get_input('large_thumb_height');
+ $image_sizes['small_image_width'] = get_input('small_thumb_width');
+ $image_sizes['small_image_height'] = get_input('small_thumb_height');
+ $image_sizes['thumb_image_width'] = get_input('thumb_width');
+ $image_sizes['thumb_image_height'] = get_input('thumb_height');
+ set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
+
+
+
+ system_message(elgg_echo('tidypics:settings:save:ok'));
+
+ forward($_SERVER['HTTP_REFERER']);
+?>
diff --git a/actions/upload.php b/actions/upload.php
index 3aa739414..0913ed937 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -1,255 +1,255 @@
-<?php
- /**
- * Elgg multi-image uploader action
- *
- * This will upload up to 10 images at at time to an album
- */
-
- global $CONFIG;
- include dirname(dirname(__FILE__)) . "/lib/resize.php";
- include dirname(dirname(__FILE__)) . "/lib/exif.php";
-
- // Make sure we're logged in
- gatekeeper();
-
- // 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();
-
- $album = get_entity($container_guid);
-
- $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
- if (!$maxfilesize)
- $maxfilesize = 5; // default to 5 MB if not set
- $maxfilesize = 1024 * 1024 * $maxfilesize; // convert to bytes from MBs
-
- $quota = get_plugin_setting('quota','tidypics');
- $quota = 1024 * 1024 * $quota;
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
-
- $image_lib = get_plugin_setting('image_lib', 'tidypics');
- if (!$image_lib)
- $image_lib = "GD";
-
- // post limit exceeded
- if (count($_FILES) == 0) {
- trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
- register_error(elgg_echo('tidypics:exceedpostlimit'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
- }
-
- // test to make sure at least 1 image was selected by user
- $num_images = 0;
- foreach($_FILES as $key => $sent_file) {
- if (!empty($sent_file['name']))
- $num_images++;
- }
- if ($num_images == 0) {
- // have user try again
- register_error(elgg_echo('tidypics:noimages'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
- }
-
- $uploaded_images = array();
- $not_uploaded = array();
- $error_msgs = array();
-
- $img_river_view = get_plugin_setting('img_river_view', 'tidypics');
-
- $accepted_formats = array(
- 'image/jpeg',
- 'image/png',
- 'image/gif',
- 'image/pjpeg',
- 'image/x-png',
- );
-
-
- foreach($_FILES as $key => $sent_file) {
-
- // skip empty entries
- if (empty($sent_file['name']))
- continue;
-
- $name = $sent_file['name'];
- $mime = $sent_file['type'];
-
- if ($sent_file['error']) {
- array_push($not_uploaded, $sent_file['name']);
- if ($sent_file['error'] == 1) {
- trigger_error('Tidypics warning: image exceed server php upload limit', E_USER_WARNING);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- }
- else {
- array_push($error_msgs, elgg_echo('tidypics:unk_error'));
- }
- continue;
- }
-
- //make sure file is an image
- if (!in_array($mime, $accepted_formats)) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:not_image'));
- continue;
- }
-
- // check quota
- if ($quota) {
- if ($image_repo_size + $sent_file['size'] > $quota) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
- continue;
- }
- }
-
- // make sure file does not exceed memory limit
- if ($sent_file['size'] > $maxfilesize) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- continue;
- }
-
- // make sure the in memory image size does not exceed memory available - GD only
- $imginfo = getimagesize($sent_file['tmp_name']);
- $mem_avail = ini_get('memory_limit');
- $mem_avail = rtrim($mem_avail, 'M');
- $mem_avail = $mem_avail * 1024 * 1024;
- if ($image_lib == 'GD') {
- $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]);
-
- $mem_used = memory_get_usage();
-
- $mem_avail = $mem_avail - $mem_used - 2097152; // 2 MB buffer
- if ($mem_required > $mem_avail) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
- trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
- continue;
- }
- } else if ($image_lib == 'ImageMagickPHP') {
- // haven't been able to determine a limit like there is for GD
- }
-
- //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->simpletype="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) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:save_error'));
- continue;
- }
-
- //get and store the exif data
- td_get_exif($file);
-
-
- // resize photos to create thumbnails
- if ($image_lib == 'ImageMagick') { // ImageMagick command line
-
- if (tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
- }
-
- } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
-
- if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
- }
-
- } else {
-
- if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
- }
-
- } // end of image library selector
-
- //keep one file handy so we can add a notice to the river if single image option selected
- if(!$file_for_river) {
- $file_for_river = $file;
- }
-
- array_push($uploaded_images, $file->guid);
-
- // update user/group size for checking quota
- $image_repo_size += $sent_file['size'];
-
- // plugins can register to be told when a new image has been uploaded
- trigger_elgg_event('upload', 'tp_image', $file);
-
- // successful upload so check if this is a new album and throw river event/notification if so
- if ($album->new_album == TP_NEW_ALBUM) {
- $album->new_album = TP_OLD_ALBUM;
-
- // we throw the notification manually here so users are not told about the new album until there
- // is at least a few photos in it
- object_notifications('create', 'object', $album);
-
- if (function_exists('add_to_river'))
- add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
- }
-
- if ($img_river_view == "all") {
- add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
- }
- unset($file); // may not be needed but there seems to be a memory leak
-
- } //end of for loop
-
- if (count($not_uploaded) > 0) {
- if (count($uploaded_images) > 0)
- $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '<br />';
- else
- $error = elgg_echo("tidypics:completeuploadfailure") . '<br />';
-
- $num_failures = count($not_uploaded);
- for ($i = 0; $i < $num_failures; $i++) {
- $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]} <br />";
- }
- register_error($error);
-
- if (count($uploaded_images) == 0)
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
- else {
- // some images did upload so we fall through
- }
- } else {
- system_message(elgg_echo('tidypics:upl_success'));
- }
-
-
- if (count($uploaded_images) && $img_river_view == "1") {
- if (function_exists('add_to_river')) {
- add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
- }
- }
-
- // update image repo size
- create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
-
- // plugins can register to be told when a Tidypics album has had images added
- trigger_elgg_event('upload', 'tp_album', $album);
-
-
- //forward to multi-image edit page
- forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
-
-?>
+<?php
+ /**
+ * Elgg multi-image uploader action
+ *
+ * This will upload up to 10 images at at time to an album
+ */
+
+ global $CONFIG;
+ include dirname(dirname(__FILE__)) . "/lib/resize.php";
+ include dirname(dirname(__FILE__)) . "/lib/exif.php";
+
+ // Make sure we're logged in
+ gatekeeper();
+
+ // 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();
+
+ $album = get_entity($container_guid);
+
+ $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
+ if (!$maxfilesize)
+ $maxfilesize = 5; // default to 5 MB if not set
+ $maxfilesize = 1024 * 1024 * $maxfilesize; // convert to bytes from MBs
+
+ $quota = get_plugin_setting('quota','tidypics');
+ $quota = 1024 * 1024 * $quota;
+ $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+
+ $image_lib = get_plugin_setting('image_lib', 'tidypics');
+ if (!$image_lib)
+ $image_lib = "GD";
+
+ // post limit exceeded
+ if (count($_FILES) == 0) {
+ trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:exceedpostlimit'));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
+ }
+
+ // test to make sure at least 1 image was selected by user
+ $num_images = 0;
+ foreach($_FILES as $key => $sent_file) {
+ if (!empty($sent_file['name']))
+ $num_images++;
+ }
+ if ($num_images == 0) {
+ // have user try again
+ register_error(elgg_echo('tidypics:noimages'));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
+ }
+
+ $uploaded_images = array();
+ $not_uploaded = array();
+ $error_msgs = array();
+
+ $img_river_view = get_plugin_setting('img_river_view', 'tidypics');
+
+ $accepted_formats = array(
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif',
+ 'image/pjpeg',
+ 'image/x-png',
+ );
+
+
+ foreach($_FILES as $key => $sent_file) {
+
+ // skip empty entries
+ if (empty($sent_file['name']))
+ continue;
+
+ $name = $sent_file['name'];
+ $mime = $sent_file['type'];
+
+ if ($sent_file['error']) {
+ array_push($not_uploaded, $sent_file['name']);
+ if ($sent_file['error'] == 1) {
+ trigger_error('Tidypics warning: image exceed server php upload limit', E_USER_WARNING);
+ array_push($error_msgs, elgg_echo('tidypics:image_mem'));
+ }
+ else {
+ array_push($error_msgs, elgg_echo('tidypics:unk_error'));
+ }
+ continue;
+ }
+
+ //make sure file is an image
+ if (!in_array($mime, $accepted_formats)) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:not_image'));
+ continue;
+ }
+
+ // check quota
+ if ($quota) {
+ if ($image_repo_size + $sent_file['size'] > $quota) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
+ continue;
+ }
+ }
+
+ // make sure file does not exceed memory limit
+ if ($sent_file['size'] > $maxfilesize) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:image_mem'));
+ continue;
+ }
+
+ // make sure the in memory image size does not exceed memory available - GD only
+ $imginfo = getimagesize($sent_file['tmp_name']);
+ $mem_avail = ini_get('memory_limit');
+ $mem_avail = rtrim($mem_avail, 'M');
+ $mem_avail = $mem_avail * 1024 * 1024;
+ if ($image_lib == 'GD') {
+ $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]);
+
+ $mem_used = memory_get_usage();
+
+ $mem_avail = $mem_avail - $mem_used - 2097152; // 2 MB buffer
+ if ($mem_required > $mem_avail) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
+ trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
+ continue;
+ }
+ } else if ($image_lib == 'ImageMagickPHP') {
+ // haven't been able to determine a limit like there is for GD
+ }
+
+ //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->simpletype="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) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:save_error'));
+ continue;
+ }
+
+ //get and store the exif data
+ td_get_exif($file);
+
+
+ // resize photos to create thumbnails
+ if ($image_lib == 'ImageMagick') { // ImageMagick command line
+
+ if (tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ }
+
+ } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
+
+ if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ }
+
+ } else {
+
+ if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ }
+
+ } // end of image library selector
+
+ //keep one file handy so we can add a notice to the river if single image option selected
+ if(!$file_for_river) {
+ $file_for_river = $file;
+ }
+
+ array_push($uploaded_images, $file->guid);
+
+ // update user/group size for checking quota
+ $image_repo_size += $sent_file['size'];
+
+ // plugins can register to be told when a new image has been uploaded
+ trigger_elgg_event('upload', 'tp_image', $file);
+
+ // successful upload so check if this is a new album and throw river event/notification if so
+ if ($album->new_album == TP_NEW_ALBUM) {
+ $album->new_album = TP_OLD_ALBUM;
+
+ // we throw the notification manually here so users are not told about the new album until there
+ // is at least a few photos in it
+ object_notifications('create', 'object', $album);
+
+ if (function_exists('add_to_river'))
+ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
+ }
+
+ if ($img_river_view == "all") {
+ add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
+ }
+ unset($file); // may not be needed but there seems to be a memory leak
+
+ } //end of for loop
+
+ if (count($not_uploaded) > 0) {
+ if (count($uploaded_images) > 0)
+ $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '<br />';
+ else
+ $error = elgg_echo("tidypics:completeuploadfailure") . '<br />';
+
+ $num_failures = count($not_uploaded);
+ for ($i = 0; $i < $num_failures; $i++) {
+ $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]} <br />";
+ }
+ register_error($error);
+
+ if (count($uploaded_images) == 0)
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
+ else {
+ // some images did upload so we fall through
+ }
+ } else {
+ system_message(elgg_echo('tidypics:upl_success'));
+ }
+
+
+ if (count($uploaded_images) && $img_river_view == "1") {
+ if (function_exists('add_to_river')) {
+ add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
+ }
+ }
+
+ // update image repo size
+ create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
+
+ // plugins can register to be told when a Tidypics album has had images added
+ trigger_elgg_event('upload', 'tp_album', $album);
+
+
+ //forward to multi-image edit page
+ forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
+
+?>
diff --git a/languages/en.php b/languages/en.php
index 87c431f75..7fa5f2e73 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -1,221 +1,221 @@
-<?php
-
- $english = array(
- // hack for core bug
- 'untitled' => "untitled",
-
- // Menu items and titles
-
- 'image' => "Image",
- 'images' => "Images",
- 'caption' => "Caption",
- 'photos' => "Photos",
- 'images:upload' => "Upload Images",
- 'images:multiupload' => "Flash Multi Upload Tool",
- 'images:multiupload:todo' => "Choose one or more files for upload.",
- 'album' => "Photo Album",
- 'albums' => "Photo Albums",
- 'album:slideshow' => "View slideshow",
- '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:uploading:images' => "Please wait. Uploading images.",
- 'tidypics:enablephotos' => 'Enable group photo albums',
- 'tidypics:editprops' => 'Edit Image Properties',
- 'tidypics:mostcommented' => 'Most commented images',
- 'tidypics:mostcommentedthismonth' => 'Most commented this month',
- 'tidypics:mostcommentedtoday' => 'Most commented today',
- 'tidypics:mostviewed' => 'Most viewed images',
- 'tidypics:mostvieweddashboard' => 'Most viewed dashboard',
- 'tidypics:mostviewedthisyear' => 'Most viewed this year',
- 'tidypics:mostviewedthismonth' => 'Most viewed this month',
- 'tidypics:mostviewedlastmonth' => 'Most viewed last month',
- 'tidypics:mostviewedtoday' => 'Most viewed today',
- 'tidypics:recentlyviewed' => 'Recently viewed images',
- 'tidypics:recentlycommented' => 'Recently commented images',
- 'tidypics:mostrecent' => 'Most recent images',
- 'tidypics:yourmostviewed' => 'Your most viewed images',
- 'tidypics:yourmostrecent' => 'Your most recent images',
- 'tidypics:friendmostviewed' => "%s's most viewed images",
- 'tidypics:friendmostrecent' => "%s's most recent images",
- 'tidypics:highestrated' => "Highest rated images",
- 'tidypics:views' => "Views: %s",
- 'tidypics:viewsbyowner' => "by %s users (not including you)",
- 'tidypics:viewsbyothers' => "(%s by you)",
- 'tidypics:administration' => 'Tidypics Administration',
- 'tidypics:stats' => 'Stats',
- 'flickr:setup' => 'Flickr Setup',
- 'flickr:usernamesetup' => 'Please enter your Flickr username here:',
- 'flickr:selectalbum' => 'Select album to import photos into',
- 'flickr:albumdesc' => 'Album to import photos to:',
- 'flickr:importmanager' => 'Photoset Import Manager',
- 'flickr:desc' => 'Click on the set you wish to import into this site.<br />Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
- 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process. <br />When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.',
- 'flickr:menusetup' => 'Flickr Setup',
- 'flickr:menuimport' => 'Import Flickr Photos',
-
- //settings
- 'tidypics:settings' => 'Settings',
- 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.',
- 'tidypics:settings:image_lib' => "Image Library",
- 'tidypics:settings:thumbnail' => "Thumbnail Creation",
- 'tidypics:settings:help' => "Help",
- 'tidypics:settings:download_link' => "Show download link",
- 'tidypics:settings:tagging' => "Enable photo tagging",
- 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",
- 'tidypics:settings:exif' => "Show EXIF data",
- 'tidypics:settings:view_count' => "View counter",
- 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
- 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
- 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
- 'tidypics:settings:watermark' => "Enter text to appear in the watermark - not for production sites yet",
- 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
- 'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
- 'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
- 'tidypics:settings:largesize' => "Primary image size",
- 'tidypics:settings:smallsize' => "Album view image size",
- 'tidypics:settings:thumbsize' => "Thumbnail image size",
- 'tidypics:settings:im_id' => "Image ID",
-
- //actions
-
- 'album:create' => "Create new album",
- 'album:add' => "Add Photo Album",
- 'album:addpix' => "Add photos to album",
- '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?",
- 'tidypics:quota' => "Quota usage:",
-
- //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' => "Previous",
- 'image:next' => "Next",
-
- // tagging
- 'tidypics:taginstruct' => 'Select area that you want to tag',
- 'tidypics:deltag_title' => 'Select tags to delete',
- 'tidypics:finish_tagging' => 'Stop tagging',
- 'tidypics:tagthisphoto' => 'Tag this photo',
- 'tidypics:deletetag' => 'Delete a photo tag',
- 'tidypics:actiontag' => 'Tag',
- 'tidypics:actiondelete' => 'Delete',
- 'tidypics:actioncancel' => 'Cancel',
- 'tidypics:inthisphoto' => 'In this photo',
- 'tidypics:usertag' => "Photos tagged with user %s",
- 'tidypics:phototagging:success' => 'Photo tag was successfully added',
- 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging',
- 'tidypics:deletetag:success' => 'Selected tags were successfully deleted',
-
- 'tidypics:tag:subject' => "You have been tagged in a photo",
- 'tidypics:tag:body' => "You have been tagged in the photo %s by %s.
-
-The photo can be viewed here: %s",
-
-
- //rss
- 'tidypics:posted' => 'posted a photo:',
-
- //widgets
-
- 'tidypics:widget:albums' => "Photo Albums",
- 'tidypics:widget:album_descr' => "Showcase your photo albums",
- 'tidypics:widget:num_albums' => "Number of albums to display",
- 'tidypics:widget:latest' => "Latest Photos",
- 'tidypics:widget:latest_descr' => "Display your latest photos",
- 'tidypics:widget:num_latest' => "Number of images to display",
- 'album:more' => "View all albums",
-
- // river
-
- //images
- 'image:river:created' => "%s added the photo %s to album %s",
- 'image:river:item' => "an photo",
- 'image:river:annotate' => "a comment on the photo",
- 'image:river:tagged' => "was tagged in the photo",
-
- //albums
- 'album:river:created' => "%s created a new photo album",
- 'album:river:group' => "in the group",
- 'album:river:item' => "an album",
- 'album:river:annotate' => "a comment on the photo album",
-
- // notifications
- 'tidypics:newalbum' => 'New photo album',
-
-
- // Status messages
-
- 'tidypics:upl_success' => "Your images uploaded successfully.",
- '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:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',
-
- 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',
-
- 'flickr:enterusername' => 'You must enter a username',
- 'flickr:savedusername' => 'Successfully saved username of %s',
- 'flickr:saveduserid' => 'Successfully saved userid of %s',
- 'flickr:savedalbum' => 'Album saved - %s',
-
- //Error messages
-
- 'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",
- 'tidypics:completeuploadfailure' => "Upload of images failed.",
- 'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",
- 'tidypics:noimages' => "No images were selected.",
- 'tidypics:image_mem' => "Image is too large - too many bytes",
- 'tidypics:image_pixels' => "Image has too many pixels",
- 'tidypics:unk_error' => "Unknown upload error",
- 'tidypics:save_error' => "Unknown error saving the image on server",
- 'tidypics:not_image' => "This is not a recognized image type",
- 'image:deletefailed' => "Your image could not be deleted at this time.",
- 'image:downloadfailed' => "Sorry; this image is not available at this time.",
- 'tidypics:nosettings' => "Admin of this site has not set photo album settings.",
- 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator",
- 'images:notedited' => "Not all images were successfully updated",
-
- 'album:none' => "No albums have been created yet.",
- '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.",
-
- 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
-
- 'flickr:errorusername' => 'Username %s not found on Flickr',
- 'flickr:errorusername2' => 'You must enter a username',
- 'flickr:errorimageimport' => 'This image has already been imported',
- 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s"
- );
-
- add_translation("en",$english);
+<?php
+
+ $english = array(
+ // hack for core bug
+ 'untitled' => "untitled",
+
+ // Menu items and titles
+
+ 'image' => "Image",
+ 'images' => "Images",
+ 'caption' => "Caption",
+ 'photos' => "Photos",
+ 'images:upload' => "Upload Images",
+ 'images:multiupload' => "Flash Multi Upload Tool",
+ 'images:multiupload:todo' => "Choose one or more files for upload.",
+ 'album' => "Photo Album",
+ 'albums' => "Photo Albums",
+ 'album:slideshow' => "View slideshow",
+ '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:uploading:images' => "Please wait. Uploading images.",
+ 'tidypics:enablephotos' => 'Enable group photo albums',
+ 'tidypics:editprops' => 'Edit Image Properties',
+ 'tidypics:mostcommented' => 'Most commented images',
+ 'tidypics:mostcommentedthismonth' => 'Most commented this month',
+ 'tidypics:mostcommentedtoday' => 'Most commented today',
+ 'tidypics:mostviewed' => 'Most viewed images',
+ 'tidypics:mostvieweddashboard' => 'Most viewed dashboard',
+ 'tidypics:mostviewedthisyear' => 'Most viewed this year',
+ 'tidypics:mostviewedthismonth' => 'Most viewed this month',
+ 'tidypics:mostviewedlastmonth' => 'Most viewed last month',
+ 'tidypics:mostviewedtoday' => 'Most viewed today',
+ 'tidypics:recentlyviewed' => 'Recently viewed images',
+ 'tidypics:recentlycommented' => 'Recently commented images',
+ 'tidypics:mostrecent' => 'Most recent images',
+ 'tidypics:yourmostviewed' => 'Your most viewed images',
+ 'tidypics:yourmostrecent' => 'Your most recent images',
+ 'tidypics:friendmostviewed' => "%s's most viewed images",
+ 'tidypics:friendmostrecent' => "%s's most recent images",
+ 'tidypics:highestrated' => "Highest rated images",
+ 'tidypics:views' => "Views: %s",
+ 'tidypics:viewsbyowner' => "by %s users (not including you)",
+ 'tidypics:viewsbyothers' => "(%s by you)",
+ 'tidypics:administration' => 'Tidypics Administration',
+ 'tidypics:stats' => 'Stats',
+ 'flickr:setup' => 'Flickr Setup',
+ 'flickr:usernamesetup' => 'Please enter your Flickr username here:',
+ 'flickr:selectalbum' => 'Select album to import photos into',
+ 'flickr:albumdesc' => 'Album to import photos to:',
+ 'flickr:importmanager' => 'Photoset Import Manager',
+ 'flickr:desc' => 'Click on the set you wish to import into this site.<br />Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
+ 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process. <br />When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.',
+ 'flickr:menusetup' => 'Flickr Setup',
+ 'flickr:menuimport' => 'Import Flickr Photos',
+
+ //settings
+ 'tidypics:settings' => 'Settings',
+ 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.',
+ 'tidypics:settings:image_lib' => "Image Library",
+ 'tidypics:settings:thumbnail' => "Thumbnail Creation",
+ 'tidypics:settings:help' => "Help",
+ 'tidypics:settings:download_link' => "Show download link",
+ 'tidypics:settings:tagging' => "Enable photo tagging",
+ 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",
+ 'tidypics:settings:exif' => "Show EXIF data",
+ 'tidypics:settings:view_count' => "View counter",
+ 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
+ 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
+ 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
+ 'tidypics:settings:watermark' => "Enter text to appear in the watermark - not for production sites yet",
+ 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
+ 'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
+ 'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
+ 'tidypics:settings:largesize' => "Primary image size",
+ 'tidypics:settings:smallsize' => "Album view image size",
+ 'tidypics:settings:thumbsize' => "Thumbnail image size",
+ 'tidypics:settings:im_id' => "Image ID",
+
+ //actions
+
+ 'album:create' => "Create new album",
+ 'album:add' => "Add Photo Album",
+ 'album:addpix' => "Add photos to album",
+ '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?",
+ 'tidypics:quota' => "Quota usage:",
+
+ //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' => "Previous",
+ 'image:next' => "Next",
+
+ // tagging
+ 'tidypics:taginstruct' => 'Select area that you want to tag',
+ 'tidypics:deltag_title' => 'Select tags to delete',
+ 'tidypics:finish_tagging' => 'Stop tagging',
+ 'tidypics:tagthisphoto' => 'Tag this photo',
+ 'tidypics:deletetag' => 'Delete a photo tag',
+ 'tidypics:actiontag' => 'Tag',
+ 'tidypics:actiondelete' => 'Delete',
+ 'tidypics:actioncancel' => 'Cancel',
+ 'tidypics:inthisphoto' => 'In this photo',
+ 'tidypics:usertag' => "Photos tagged with user %s",
+ 'tidypics:phototagging:success' => 'Photo tag was successfully added',
+ 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging',
+ 'tidypics:deletetag:success' => 'Selected tags were successfully deleted',
+
+ 'tidypics:tag:subject' => "You have been tagged in a photo",
+ 'tidypics:tag:body' => "You have been tagged in the photo %s by %s.
+
+The photo can be viewed here: %s",
+
+
+ //rss
+ 'tidypics:posted' => 'posted a photo:',
+
+ //widgets
+
+ 'tidypics:widget:albums' => "Photo Albums",
+ 'tidypics:widget:album_descr' => "Showcase your photo albums",
+ 'tidypics:widget:num_albums' => "Number of albums to display",
+ 'tidypics:widget:latest' => "Latest Photos",
+ 'tidypics:widget:latest_descr' => "Display your latest photos",
+ 'tidypics:widget:num_latest' => "Number of images to display",
+ 'album:more' => "View all albums",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s added the photo %s to album %s",
+ 'image:river:item' => "an photo",
+ 'image:river:annotate' => "a comment on the photo",
+ 'image:river:tagged' => "was tagged in the photo",
+
+ //albums
+ 'album:river:created' => "%s created a new photo album",
+ 'album:river:group' => "in the group",
+ 'album:river:item' => "an album",
+ 'album:river:annotate' => "a comment on the photo album",
+
+ // notifications
+ 'tidypics:newalbum' => 'New photo album',
+
+
+ // Status messages
+
+ 'tidypics:upl_success' => "Your images uploaded successfully.",
+ '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:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',
+
+ 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',
+
+ 'flickr:enterusername' => 'You must enter a username',
+ 'flickr:savedusername' => 'Successfully saved username of %s',
+ 'flickr:saveduserid' => 'Successfully saved userid of %s',
+ 'flickr:savedalbum' => 'Album saved - %s',
+
+ //Error messages
+
+ 'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",
+ 'tidypics:completeuploadfailure' => "Upload of images failed.",
+ 'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",
+ 'tidypics:noimages' => "No images were selected.",
+ 'tidypics:image_mem' => "Image is too large - too many bytes",
+ 'tidypics:image_pixels' => "Image has too many pixels",
+ 'tidypics:unk_error' => "Unknown upload error",
+ 'tidypics:save_error' => "Unknown error saving the image on server",
+ 'tidypics:not_image' => "This is not a recognized image type",
+ 'image:deletefailed' => "Your image could not be deleted at this time.",
+ 'image:downloadfailed' => "Sorry; this image is not available at this time.",
+ 'tidypics:nosettings' => "Admin of this site has not set photo album settings.",
+ 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator",
+ 'images:notedited' => "Not all images were successfully updated",
+
+ 'album:none' => "No albums have been created yet.",
+ '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.",
+
+ 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
+
+ 'flickr:errorusername' => 'Username %s not found on Flickr',
+ 'flickr:errorusername2' => 'You must enter a username',
+ 'flickr:errorimageimport' => 'This image has already been imported',
+ 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s"
+ );
+
+ add_translation("en",$english);
?> \ No newline at end of file
diff --git a/lib/resize.php b/lib/resize.php
index 7885a52df..c35eb09ea 100644
--- a/lib/resize.php
+++ b/lib/resize.php
@@ -1,547 +1,547 @@
-<?php
- /**
- * Elgg tidypics library of resizing functions
- *
- */
-
- include dirname(__FILE__) . "/watermark.php";
-
-
- /**
- * Create thumbnails using PHP GD Library
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_gd_thumbnails($file, $prefix, $filestorename)
- {
- global $CONFIG;
-
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- forward($_SERVER['HTTP_REFERER']);
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
- $thumb->owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- false,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- false,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- true,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
-
- unset($thumb);
-
- return true;
- }
-
- /**
- * Writes resized version of an already uploaded image - original from Elgg filestore.php
- * Saves it in the same format as uploaded
- *
- * @param string $input_name The name of the file on the disk
- * @param string $output_name The name of the file to be written
- * @param bool - watermark this image?
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success or false on failure
- */
- function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!imgsizearray)
- return false;
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/pjpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/x-png' => 'png',
- 'image/gif' => 'gif'
- );
-
- // make sure the function is available
- $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
- if (!is_callable($function))
- return false;
-
-
- // load old image
- $oldimage = $function($input_name);
- if (!$oldimage)
- return false;
-
- // allocate the new image
- $newimage = imagecreatetruecolor($newwidth, $newheight);
- if (!$newimage)
- return false;
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
-
- $rtn_code = imagecopyresampled($newimage, $oldimage, 0,0,$widthoffset,$heightoffset,$newwidth,$newheight,$width,$height);
- if (!rtn_code)
- return $rtn_code;
-
- if ($watermark)
- tp_gd_watermark($newimage);
-
- switch ($imgsizearray['mime']) {
- case 'image/jpeg':
- case 'image/pjpeg':
- $rtn_code = imagejpeg($newimage, $output_name, 85);
- break;
- case 'image/png':
- case 'image/x-png':
- $rtn_code = imagepng($newimage, $output_name);
- break;
- case 'image/gif':
- $rtn_code = imagegif($newimage, $output_name);
- break;
- }
-
- imagedestroy($newimage);
- imagedestroy($oldimage);
-
- return $rtn_code;
- }
-
-
- /**
- * Create thumbnails using PHP imagick extension
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_imagick_thumbnails($file, $prefix, $filestorename)
- {
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
- $thumb->owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbnail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
- tp_imagick_watermark($thumbname);
-
- unset($thumb);
-
- return true;
- }
-
-
- /**
- * Resize using PHP imagick extension
- *
- * Writes resized version of an already uploaded image
- *
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success
- */
- function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!$imgsizearray)
- return false;
-
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // initial guess at final dimensions for new image (doesn't check for squareness yet
- if ($newwidth > $maxwidth) {
- $newheight = floor($newheight * ($maxwidth / $newwidth));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- // Handle squareness for both original and new image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- if ($maxheight == $maxwidth) {
- // if input arguments = square, no need to use above calculations (which can have round-off errors)
- $newwidth = $maxwidth;
- $newheight = $maxheight;
- } else {
- if ($newwidth < $newheight) {
- $newheight = $newwidth;
- } else {
- $newwidth = $newheight;
- }
- }
- }
-
-
- // Crop the original image - this needs to be checked over
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = floor(($imgsizearray[0] - $width) / 2);
- $yoffset = floor(($imgsizearray[1] - $height) / 2);
- } else { // assume we're being passed good croping coordinates
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = 0;
- $yoffset = 0;
- } else {
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
-
- try {
- $img = new Imagick($input_name);
- } catch (ImagickException $e) {
- return false;
- }
-
- $img->cropImage($width, $height, $xoffset, $yoffset);
-
- // use the default IM filter (windowing filter), I think 1 means default blurring or number of lobes
- $img->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
- $img->setImagePage($newwidth, $newheight, 0, 0);
-
- if ($img->writeImage($output_name) != true) {
- $img->destroy();
- return false;
- }
-
- $img->destroy();
-
- return true;
- }
-
- /**
- * Create thumbnails using ImageMagick executables
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename)
- {
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
- $thumb->owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbnail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
-
- tp_im_cmdline_watermark($thumbname);
-
-
-
- unset($thumb);
-
- return true;
- }
-
- /*
- * Gets the jpeg contents of the resized version of an already uploaded image
- * (Returns false if the uploaded file was not an image)
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool
- */
- function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
-
- // Get the size information from the image
- if ($imgsizearray = getimagesize($input_name)) {
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/pjpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/x-png' => 'png',
- 'image/gif' => 'gif'
- );
- // If it's a file we can manipulate ...
- if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- // Resize and return the image contents!
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
- $im_path = get_plugin_setting('im_path', 'tidypics');
- if(!$im_path) {
- $im_path = "/usr/bin/";
- }
- if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
- $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
- exec($command);
- return true;
-
- }
- }
-
- return false;
- }
-
+<?php
+ /**
+ * Elgg tidypics library of resizing functions
+ *
+ */
+
+ include dirname(__FILE__) . "/watermark.php";
+
+
+ /**
+ * Create thumbnails using PHP GD Library
+ *
+ * @param ElggFile holds the image that was uploaded
+ * @param string folder to store thumbnail in
+ * @param string name of the thumbnail
+ * @return bool true on success
+ */
+ function tp_create_gd_thumbnails($file, $prefix, $filestorename)
+ {
+ global $CONFIG;
+
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ forward($_SERVER['HTTP_REFERER']);
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
+ $thumb = new ElggFile();
+ $thumb->owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ false,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ false,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ true,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+
+ unset($thumb);
+
+ return true;
+ }
+
+ /**
+ * Writes resized version of an already uploaded image - original from Elgg filestore.php
+ * Saves it in the same format as uploaded
+ *
+ * @param string $input_name The name of the file on the disk
+ * @param string $output_name The name of the file to be written
+ * @param bool - watermark this image?
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool true on success or false on failure
+ */
+ function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+ // Get the size information from the image
+ $imgsizearray = getimagesize($input_name);
+ if (!imgsizearray)
+ return false;
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // Square the image dimensions if we're wanting a square image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ $newwidth = $width;
+ $newheight = $height;
+
+ }
+
+ if ($width > $maxwidth) {
+ $newheight = floor($height * ($maxwidth / $width));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ $accepted_formats = array(
+ 'image/jpeg' => 'jpeg',
+ 'image/pjpeg' => 'jpeg',
+ 'image/png' => 'png',
+ 'image/x-png' => 'png',
+ 'image/gif' => 'gif'
+ );
+
+ // make sure the function is available
+ $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
+ if (!is_callable($function))
+ return false;
+
+
+ // load old image
+ $oldimage = $function($input_name);
+ if (!$oldimage)
+ return false;
+
+ // allocate the new image
+ $newimage = imagecreatetruecolor($newwidth, $newheight);
+ if (!$newimage)
+ return false;
+
+ // Crop the image if we need a square
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = floor(($imgsizearray[0] - $width) / 2);
+ $heightoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = 0;
+ $heightoffset = 0;
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+ if ($square) {
+ $newheight = $maxheight;
+ $newwidth = $maxwidth;
+ }
+
+ $rtn_code = imagecopyresampled($newimage, $oldimage, 0,0,$widthoffset,$heightoffset,$newwidth,$newheight,$width,$height);
+ if (!rtn_code)
+ return $rtn_code;
+
+ if ($watermark)
+ tp_gd_watermark($newimage);
+
+ switch ($imgsizearray['mime']) {
+ case 'image/jpeg':
+ case 'image/pjpeg':
+ $rtn_code = imagejpeg($newimage, $output_name, 85);
+ break;
+ case 'image/png':
+ case 'image/x-png':
+ $rtn_code = imagepng($newimage, $output_name);
+ break;
+ case 'image/gif':
+ $rtn_code = imagegif($newimage, $output_name);
+ break;
+ }
+
+ imagedestroy($newimage);
+ imagedestroy($oldimage);
+
+ return $rtn_code;
+ }
+
+
+ /**
+ * Create thumbnails using PHP imagick extension
+ *
+ * @param ElggFile holds the image that was uploaded
+ * @param string folder to store thumbnail in
+ * @param string name of the thumbnail
+ * @return bool true on success
+ */
+ function tp_create_imagick_thumbnails($file, $prefix, $filestorename)
+ {
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
+ $thumb = new ElggFile();
+ $thumb->owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbnail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+ tp_imagick_watermark($thumbname);
+
+ unset($thumb);
+
+ return true;
+ }
+
+
+ /**
+ * Resize using PHP imagick extension
+ *
+ * Writes resized version of an already uploaded image
+ *
+ *
+ * @param string $input_name The name of the file input field on the submission form
+ * @param string $output_name The name of the file to be written
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool true on success
+ */
+ function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+ // Get the size information from the image
+ $imgsizearray = getimagesize($input_name);
+ if (!$imgsizearray)
+ return false;
+
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // initial guess at final dimensions for new image (doesn't check for squareness yet
+ if ($newwidth > $maxwidth) {
+ $newheight = floor($newheight * ($maxwidth / $newwidth));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ // Handle squareness for both original and new image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ if ($maxheight == $maxwidth) {
+ // if input arguments = square, no need to use above calculations (which can have round-off errors)
+ $newwidth = $maxwidth;
+ $newheight = $maxheight;
+ } else {
+ if ($newwidth < $newheight) {
+ $newheight = $newwidth;
+ } else {
+ $newwidth = $newheight;
+ }
+ }
+ }
+
+
+ // Crop the original image - this needs to be checked over
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $xoffset = floor(($imgsizearray[0] - $width) / 2);
+ $yoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else { // assume we're being passed good croping coordinates
+ $xoffset = $x1;
+ $yoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $xoffset = 0;
+ $yoffset = 0;
+ } else {
+ $xoffset = $x1;
+ $yoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+
+ try {
+ $img = new Imagick($input_name);
+ } catch (ImagickException $e) {
+ return false;
+ }
+
+ $img->cropImage($width, $height, $xoffset, $yoffset);
+
+ // use the default IM filter (windowing filter), I think 1 means default blurring or number of lobes
+ $img->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
+ $img->setImagePage($newwidth, $newheight, 0, 0);
+
+ if ($img->writeImage($output_name) != true) {
+ $img->destroy();
+ return false;
+ }
+
+ $img->destroy();
+
+ return true;
+ }
+
+ /**
+ * Create thumbnails using ImageMagick executables
+ *
+ * @param ElggFile holds the image that was uploaded
+ * @param string folder to store thumbnail in
+ * @param string name of the thumbnail
+ * @return bool true on success
+ */
+ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename)
+ {
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
+ $thumb = new ElggFile();
+ $thumb->owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbnail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+
+ tp_im_cmdline_watermark($thumbname);
+
+
+
+ unset($thumb);
+
+ return true;
+ }
+
+ /*
+ * Gets the jpeg contents of the resized version of an already uploaded image
+ * (Returns false if the uploaded file was not an image)
+ *
+ * @param string $input_name The name of the file input field on the submission form
+ * @param string $output_name The name of the file to be written
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool
+ */
+ function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+
+ // Get the size information from the image
+ if ($imgsizearray = getimagesize($input_name)) {
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // Square the image dimensions if we're wanting a square image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ $newwidth = $width;
+ $newheight = $height;
+
+ }
+
+ if ($width > $maxwidth) {
+ $newheight = floor($height * ($maxwidth / $width));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ $accepted_formats = array(
+ 'image/jpeg' => 'jpeg',
+ 'image/pjpeg' => 'jpeg',
+ 'image/png' => 'png',
+ 'image/x-png' => 'png',
+ 'image/gif' => 'gif'
+ );
+ // If it's a file we can manipulate ...
+ if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
+
+ // Crop the image if we need a square
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = floor(($imgsizearray[0] - $width) / 2);
+ $heightoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = 0;
+ $heightoffset = 0;
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+ // Resize and return the image contents!
+ if ($square) {
+ $newheight = $maxheight;
+ $newwidth = $maxwidth;
+ }
+ $im_path = get_plugin_setting('im_path', 'tidypics');
+ if(!$im_path) {
+ $im_path = "/usr/bin/";
+ }
+ if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
+ $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
+ exec($command);
+ return true;
+
+ }
+ }
+
+ return false;
+ }
+
?> \ No newline at end of file
diff --git a/lib/tidypics.php b/lib/tidypics.php
index e24e4d77e..b0a8a70d2 100644
--- a/lib/tidypics.php
+++ b/lib/tidypics.php
@@ -1,299 +1,299 @@
-<?php
- /**
- * Elgg tidypics library of common functions
- *
- */
-
- /**
- * Get images for display on front page
- *
- * @param int number of images
- * @param int (optional) guid of owner
- * @return string of html for display
- *
- * To use with the custom index plugin, use something like this:
-
- if (is_plugin_enabled('tidypics')) {
-?>
- <!-- display latest photos -->
- <div class="index_box">
- <h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("tidypics:mostrecent"); ?></a></h2>
- <div class="contentWrapper">
- <?php
- echo tp_get_latest_photos(5);
- ?>
- </div>
- </div>
-<?php
- }
-?>
-
- * Good luck
- */
- function tp_get_latest_photos($num_images, $owner_guid = 0)
- {
- $prev_context = set_context('front');
- $image_html = tp_list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
- set_context($prev_context);
- return $image_html;
- }
-
-
- /**
- * Get image directory path
- *
- * Each album gets a subdirectory based on its container id
- *
- * @return string path to image directory
- */
- function tp_get_img_dir()
- {
- $file = new ElggFile();
- return $file->getFilenameOnFilestore() . 'image/';
- }
-
-
-
- /*********************************************************************
- * the functions below replace broken core functions or add functions
- * that could/should exist in the core
- */
-
- /**
- *
- */
- function tp_get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0)
- {
- global $CONFIG;
-
- if ($subtype === false || $subtype === null || $subtype === 0)
- return false;
-
- if ($order_by == "") $order_by = "time_created desc";
- $order_by = sanitise_string($order_by);
- $limit = (int)$limit;
- $offset = (int)$offset;
- $site_guid = (int) $site_guid;
- $timelower = (int) $timelower;
- $timeupper = (int) $timeupper;
- if ($site_guid == 0)
- $site_guid = $CONFIG->site_guid;
-
- $where = array();
-
- if (is_array($subtype)) {
- $tempwhere = "";
- if (sizeof($subtype))
- foreach($subtype as $typekey => $subtypearray) {
- foreach($subtypearray as $subtypeval) {
- $typekey = sanitise_string($typekey);
- if (!empty($subtypeval)) {
- if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
- return false;
- } else {
- // @todo: Setting subtype to 0 when $subtype = '' returns entities with
- // no subtype. This is different to the non-array behavior
- // but may be required in some cases.
- $subtypeval = 0;
- }
- if (!empty($tempwhere)) $tempwhere .= " or ";
- $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
- }
- }
- if (!empty($tempwhere)) $where[] = "({$tempwhere})";
-
- } else {
-
- $type = sanitise_string($type);
- if ($subtype !== "" AND !$subtype = get_subtype_id($type, $subtype))
- return false;
-
- if ($type != "")
- $where[] = "type='$type'";
- if ($subtype!=="")
- $where[] = "subtype=$subtype";
- }
-
- if ($owner_guid != "") {
- if (!is_array($owner_guid)) {
- $owner_array = array($owner_guid);
- $owner_guid = (int) $owner_guid;
- $where[] = "owner_guid = '$owner_guid'";
- } else if (sizeof($owner_guid) > 0) {
- $owner_array = array_map('sanitise_int', $owner_guid);
- // Cast every element to the owner_guid array to int
- $owner_guid = array_map("sanitise_int", $owner_guid);
- $owner_guid = implode(",",$owner_guid);
- $where[] = "owner_guid in ({$owner_guid})";
- }
- }
- if ($site_guid > 0)
- $where[] = "site_guid = {$site_guid}";
-
- if (!is_null($container_guid)) {
- if (is_array($container_guid)) {
- foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
- $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
- } else {
- $container_guid = (int) $container_guid;
- $where[] = "container_guid = {$container_guid}";
- }
- }
- if ($timelower)
- $where[] = "time_created >= {$timelower}";
- if ($timeupper)
- $where[] = "time_created <= {$timeupper}";
-
- if (!$count) {
- $query = "SELECT * from {$CONFIG->dbprefix}entities where ";
- } else {
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
- }
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix(); // Add access controls
- if (!$count) {
- $query .= " order by $order_by";
- if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
- $dt = get_data($query, "entity_row_to_elggstar");
- return $dt;
- } else {
- $total = get_data_row($query);
- return $total->total;
- }
- }
-
- function tp_list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
-
- $offset = (int) get_input('offset');
- $count = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
- $entities = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
-
- return tp_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
- }
-
- function tp_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = false, $pagination = true) {
- $context = get_context();
-
- $html = elgg_view('tidypics/gallery',array(
- 'entities' => $entities,
- 'count' => $count,
- 'offset' => $offset,
- 'limit' => $limit,
- 'baseurl' => $_SERVER['REQUEST_URI'],
- 'fullview' => $fullview,
- 'context' => $context,
- 'viewtypetoggle' => $viewtypetoggle,
- 'viewtype' => get_input('search_viewtype','list'),
- 'pagination' => $pagination
- ));
-
- return $html;
- }
-
- function tp_get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false)
- {
- global $CONFIG;
-
- $sum = sanitise_string($sum);
- $entity_type = sanitise_string($entity_type);
- $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
- $name = get_metastring_id($name);
- $limit = (int) $limit;
- $offset = (int) $offset;
- $owner_guid = (int) $owner_guid;
- if (!empty($mdname) && !empty($mdvalue)) {
- $meta_n = get_metastring_id($mdname);
- $meta_v = get_metastring_id($mdvalue);
- }
-
- if (empty($name)) return 0;
-
- $where = array();
-
- if ($entity_type!="")
- $where[] = "e.type='$entity_type'";
- if ($owner_guid > 0)
- $where[] = "e.owner_guid = $owner_guid";
- if ($entity_subtype)
- $where[] = "e.subtype=$entity_subtype";
- if ($name!="")
- $where[] = "a.name_id='$name'";
-
- if (!empty($mdname) && !empty($mdvalue)) {
- if ($mdname!="")
- $where[] = "m.name_id='$meta_n'";
- if ($mdvalue!="")
- $where[] = "m.value_id='$meta_v'";
- }
-
- if ($sum != "count")
- $where[] = "a.value_type='integer'"; // Limit on integer types
-
- if (!$count) {
- $query = "SELECT distinct e.*, $sum(ms.string) as sum ";
- } else {
- $query = "SELECT count(distinct e.guid) as num, $sum(ms.string) as sum ";
- }
- $query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}annotations a on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id ";
-
- if (!empty($mdname) && !empty($mdvalue)) {
- $query .= " JOIN {$CONFIG->dbprefix}metadata m on m.entity_guid = e.guid ";
- }
-
- $query .= " WHERE ";
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix("a"); // now add access
- $query .= ' and ' . get_access_sql_suffix("e"); // now add access
- if (!$count) $query .= ' group by e.guid';
-
- if (!$count) {
- $query .= ' order by sum ' . $orderdir;
- $query .= ' limit ' . $offset . ' , ' . $limit;
- return get_data($query, "entity_row_to_elggstar");
- } else {
- if ($row = get_data_row($query)) {
- return $row->num;
- }
- }
- return false;
- }
-
- /**
- * Is page owner a group - convenience function
- *
- * @return true/false
- */
- function tp_is_group_page() {
-
- if ($group = page_owner_entity()) {
- if ($group instanceof ElggGroup)
- return true;
- }
-
- return false;
- }
-
-
- /**
- * Is the request from a known browser
- *
- * @return true/false
- */
- function tp_is_person()
- {
- $known = array('msie', 'mozilla', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
-
- $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
-
- foreach ($known as $browser)
- {
- if (strpos($agent, $browser) !== false) {
- return true;
- }
- }
-
- return false;
- }
+<?php
+ /**
+ * Elgg tidypics library of common functions
+ *
+ */
+
+ /**
+ * Get images for display on front page
+ *
+ * @param int number of images
+ * @param int (optional) guid of owner
+ * @return string of html for display
+ *
+ * To use with the custom index plugin, use something like this:
+
+ if (is_plugin_enabled('tidypics')) {
+?>
+ <!-- display latest photos -->
+ <div class="index_box">
+ <h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("tidypics:mostrecent"); ?></a></h2>
+ <div class="contentWrapper">
+ <?php
+ echo tp_get_latest_photos(5);
+ ?>
+ </div>
+ </div>
+<?php
+ }
+?>
+
+ * Good luck
+ */
+ function tp_get_latest_photos($num_images, $owner_guid = 0)
+ {
+ $prev_context = set_context('front');
+ $image_html = tp_list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
+ set_context($prev_context);
+ return $image_html;
+ }
+
+
+ /**
+ * Get image directory path
+ *
+ * Each album gets a subdirectory based on its container id
+ *
+ * @return string path to image directory
+ */
+ function tp_get_img_dir()
+ {
+ $file = new ElggFile();
+ return $file->getFilenameOnFilestore() . 'image/';
+ }
+
+
+
+ /*********************************************************************
+ * the functions below replace broken core functions or add functions
+ * that could/should exist in the core
+ */
+
+ /**
+ *
+ */
+ function tp_get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0)
+ {
+ global $CONFIG;
+
+ if ($subtype === false || $subtype === null || $subtype === 0)
+ return false;
+
+ if ($order_by == "") $order_by = "time_created desc";
+ $order_by = sanitise_string($order_by);
+ $limit = (int)$limit;
+ $offset = (int)$offset;
+ $site_guid = (int) $site_guid;
+ $timelower = (int) $timelower;
+ $timeupper = (int) $timeupper;
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid;
+
+ $where = array();
+
+ if (is_array($subtype)) {
+ $tempwhere = "";
+ if (sizeof($subtype))
+ foreach($subtype as $typekey => $subtypearray) {
+ foreach($subtypearray as $subtypeval) {
+ $typekey = sanitise_string($typekey);
+ if (!empty($subtypeval)) {
+ if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
+ return false;
+ } else {
+ // @todo: Setting subtype to 0 when $subtype = '' returns entities with
+ // no subtype. This is different to the non-array behavior
+ // but may be required in some cases.
+ $subtypeval = 0;
+ }
+ if (!empty($tempwhere)) $tempwhere .= " or ";
+ $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
+ }
+ }
+ if (!empty($tempwhere)) $where[] = "({$tempwhere})";
+
+ } else {
+
+ $type = sanitise_string($type);
+ if ($subtype !== "" AND !$subtype = get_subtype_id($type, $subtype))
+ return false;
+
+ if ($type != "")
+ $where[] = "type='$type'";
+ if ($subtype!=="")
+ $where[] = "subtype=$subtype";
+ }
+
+ if ($owner_guid != "") {
+ if (!is_array($owner_guid)) {
+ $owner_array = array($owner_guid);
+ $owner_guid = (int) $owner_guid;
+ $where[] = "owner_guid = '$owner_guid'";
+ } else if (sizeof($owner_guid) > 0) {
+ $owner_array = array_map('sanitise_int', $owner_guid);
+ // Cast every element to the owner_guid array to int
+ $owner_guid = array_map("sanitise_int", $owner_guid);
+ $owner_guid = implode(",",$owner_guid);
+ $where[] = "owner_guid in ({$owner_guid})";
+ }
+ }
+ if ($site_guid > 0)
+ $where[] = "site_guid = {$site_guid}";
+
+ if (!is_null($container_guid)) {
+ if (is_array($container_guid)) {
+ foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
+ $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
+ } else {
+ $container_guid = (int) $container_guid;
+ $where[] = "container_guid = {$container_guid}";
+ }
+ }
+ if ($timelower)
+ $where[] = "time_created >= {$timelower}";
+ if ($timeupper)
+ $where[] = "time_created <= {$timeupper}";
+
+ if (!$count) {
+ $query = "SELECT * from {$CONFIG->dbprefix}entities where ";
+ } else {
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
+ }
+ foreach ($where as $w)
+ $query .= " $w and ";
+ $query .= get_access_sql_suffix(); // Add access controls
+ if (!$count) {
+ $query .= " order by $order_by";
+ if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
+ $dt = get_data($query, "entity_row_to_elggstar");
+ return $dt;
+ } else {
+ $total = get_data_row($query);
+ return $total->total;
+ }
+ }
+
+ function tp_list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
+
+ $offset = (int) get_input('offset');
+ $count = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
+ $entities = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
+
+ return tp_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
+ }
+
+ function tp_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = false, $pagination = true) {
+ $context = get_context();
+
+ $html = elgg_view('tidypics/gallery',array(
+ 'entities' => $entities,
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'fullview' => $fullview,
+ 'context' => $context,
+ 'viewtypetoggle' => $viewtypetoggle,
+ 'viewtype' => get_input('search_viewtype','list'),
+ 'pagination' => $pagination
+ ));
+
+ return $html;
+ }
+
+ function tp_get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false)
+ {
+ global $CONFIG;
+
+ $sum = sanitise_string($sum);
+ $entity_type = sanitise_string($entity_type);
+ $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
+ $name = get_metastring_id($name);
+ $limit = (int) $limit;
+ $offset = (int) $offset;
+ $owner_guid = (int) $owner_guid;
+ if (!empty($mdname) && !empty($mdvalue)) {
+ $meta_n = get_metastring_id($mdname);
+ $meta_v = get_metastring_id($mdvalue);
+ }
+
+ if (empty($name)) return 0;
+
+ $where = array();
+
+ if ($entity_type!="")
+ $where[] = "e.type='$entity_type'";
+ if ($owner_guid > 0)
+ $where[] = "e.owner_guid = $owner_guid";
+ if ($entity_subtype)
+ $where[] = "e.subtype=$entity_subtype";
+ if ($name!="")
+ $where[] = "a.name_id='$name'";
+
+ if (!empty($mdname) && !empty($mdvalue)) {
+ if ($mdname!="")
+ $where[] = "m.name_id='$meta_n'";
+ if ($mdvalue!="")
+ $where[] = "m.value_id='$meta_v'";
+ }
+
+ if ($sum != "count")
+ $where[] = "a.value_type='integer'"; // Limit on integer types
+
+ if (!$count) {
+ $query = "SELECT distinct e.*, $sum(ms.string) as sum ";
+ } else {
+ $query = "SELECT count(distinct e.guid) as num, $sum(ms.string) as sum ";
+ }
+ $query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}annotations a on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id ";
+
+ if (!empty($mdname) && !empty($mdvalue)) {
+ $query .= " JOIN {$CONFIG->dbprefix}metadata m on m.entity_guid = e.guid ";
+ }
+
+ $query .= " WHERE ";
+ foreach ($where as $w)
+ $query .= " $w and ";
+ $query .= get_access_sql_suffix("a"); // now add access
+ $query .= ' and ' . get_access_sql_suffix("e"); // now add access
+ if (!$count) $query .= ' group by e.guid';
+
+ if (!$count) {
+ $query .= ' order by sum ' . $orderdir;
+ $query .= ' limit ' . $offset . ' , ' . $limit;
+ return get_data($query, "entity_row_to_elggstar");
+ } else {
+ if ($row = get_data_row($query)) {
+ return $row->num;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Is page owner a group - convenience function
+ *
+ * @return true/false
+ */
+ function tp_is_group_page() {
+
+ if ($group = page_owner_entity()) {
+ if ($group instanceof ElggGroup)
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Is the request from a known browser
+ *
+ * @return true/false
+ */
+ function tp_is_person()
+ {
+ $known = array('msie', 'mozilla', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
+
+ $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
+
+ foreach ($known as $browser)
+ {
+ if (strpos($agent, $browser) !== false) {
+ return true;
+ }
+ }
+
+ return false;
+ }
?> \ No newline at end of file
diff --git a/pages/admin.php b/pages/admin.php
index 0668ac324..33d44b6c4 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -1,24 +1,24 @@
-<?php
- /******************************************************************
- *
- * Tidypics Admin Settings
- *
- *******************************************************************/
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- global $CONFIG;
-
- admin_gatekeeper();
- set_context('admin');
- set_page_owner($_SESSION['guid']);
-
- $tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
-
- $body = elgg_view_title(elgg_echo('tidypics:administration'));
-
- $body .= elgg_view("tidypics/admin/tidypics", array('tab' => $tab));
-
- page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body));
-
+<?php
+ /******************************************************************
+ *
+ * Tidypics Admin Settings
+ *
+ *******************************************************************/
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ global $CONFIG;
+
+ admin_gatekeeper();
+ set_context('admin');
+ set_page_owner($_SESSION['guid']);
+
+ $tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
+
+ $body = elgg_view_title(elgg_echo('tidypics:administration'));
+
+ $body .= elgg_view("tidypics/admin/tidypics", array('tab' => $tab));
+
+ page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body));
+
?> \ No newline at end of file
diff --git a/pages/download.php b/pages/download.php
index f5530cebc..e4ad2e855 100644
--- a/pages/download.php
+++ b/pages/download.php
@@ -1,52 +1,52 @@
-<?php
- /**
- * Tidypics Download Photos
- *
- * do not call this directly - call through page handler
- */
-
- global $CONFIG;
-
- $file_guid = (int) get_input("file_guid");
- $file = get_entity($file_guid);
-
- $type = get_input("type");
-
- if ($file) {
- $filename = $file->originalfilename;
- $mime = $file->mimetype;
-
- header("Content-Type: $mime");
- if ($type == "inline")
- header("Content-Disposition: inline; filename=\"$filename\"");
- else
- header("Content-Disposition: attachment; filename=\"$filename\"");
-
-
- $readfile = new ElggFile($file_guid);
- $readfile->owner_guid = $file->owner_guid;
-
- $contents = $readfile->grabFile();
-
- if (empty($contents)) {
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- } else {
-
- // expires every 60 days
- $expires = 60 * 60*60*24;
-
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-
- echo $contents;
- }
-
- exit;
- }
- else
- register_error(elgg_echo("image:downloadfailed"));
-
+<?php
+ /**
+ * Tidypics Download Photos
+ *
+ * do not call this directly - call through page handler
+ */
+
+ global $CONFIG;
+
+ $file_guid = (int) get_input("file_guid");
+ $file = get_entity($file_guid);
+
+ $type = get_input("type");
+
+ if ($file) {
+ $filename = $file->originalfilename;
+ $mime = $file->mimetype;
+
+ header("Content-Type: $mime");
+ if ($type == "inline")
+ header("Content-Disposition: inline; filename=\"$filename\"");
+ else
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+
+
+ $readfile = new ElggFile($file_guid);
+ $readfile->owner_guid = $file->owner_guid;
+
+ $contents = $readfile->grabFile();
+
+ if (empty($contents)) {
+ echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
+ } else {
+
+ // expires every 60 days
+ $expires = 60 * 60*60*24;
+
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+
+ echo $contents;
+ }
+
+ exit;
+ }
+ else
+ register_error(elgg_echo("image:downloadfailed"));
+
?> \ No newline at end of file
diff --git a/pages/edit.php b/pages/edit.php
index 3f13abae9..abf1a0fdd 100644
--- a/pages/edit.php
+++ b/pages/edit.php
@@ -1,51 +1,51 @@
-<?php
- /**
- * Tidypics Edit for Albums and Single Photos
- *
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // make sure the user is logged_in
- gatekeeper();
-
- set_context('photos');
- $guid = (int) get_input('guid');
-
- if (!$entity = get_entity($guid))
- forward();
-
- if (!$entity->canEdit())
- forward();
-
- $subtype = $entity->getSubtype();
-
- if ($subtype == 'album') {
- $title = elgg_echo('album:edit');
-
- if ($container = $entity->container_guid)
- set_page_owner($container);
-
- } else if ($subtype == 'image') {
- $title = elgg_echo('image:edit');
-
- if ($container = get_entity($entity->container_guid)->container_guid)
- set_page_owner($container);
-
- } else {
- forward();
- }
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
-
- $area2 .= elgg_view_title($title);
- $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
- $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
-
- page_draw($title, $body);
+<?php
+ /**
+ * Tidypics Edit for Albums and Single Photos
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // make sure the user is logged_in
+ gatekeeper();
+
+ set_context('photos');
+ $guid = (int) get_input('guid');
+
+ if (!$entity = get_entity($guid))
+ forward();
+
+ if (!$entity->canEdit())
+ forward();
+
+ $subtype = $entity->getSubtype();
+
+ if ($subtype == 'album') {
+ $title = elgg_echo('album:edit');
+
+ if ($container = $entity->container_guid)
+ set_page_owner($container);
+
+ } else if ($subtype == 'image') {
+ $title = elgg_echo('image:edit');
+
+ if ($container = get_entity($entity->container_guid)->container_guid)
+ set_page_owner($container);
+
+ } else {
+ forward();
+ }
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+
+ $area2 .= elgg_view_title($title);
+ $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
index 0c9295054..49b7dd6f3 100644
--- a/pages/edit_multiple.php
+++ b/pages/edit_multiple.php
@@ -1,47 +1,47 @@
-<?php
- /**
- * Tidypics: Edit the properties of multiple images
- *
- * Called after upload only
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- gatekeeper();
- set_context('photos');
-
- // parse out photo guids
- $file_string = get_input('files');
- $file_array_sent = explode('-', $file_string);
- $new_file_array = array();
-
- // set owner of page based on first photo guid
- $photo_guid = (int)$file_array_sent[0];
- $photo = get_entity($photo_guid);
-
- // set page owner based on owner of photo album
- set_page_owner($photo->owner_guid);
- $album = get_entity($photo->container_guid);
- if ($album) {
- $owner_guid = $album->container_guid;
- if ($owner_guid)
- set_page_owner($owner_guid);
- }
-
- 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;
-
- }
- }
-
- $title = elgg_echo('tidypics:editprops');
- $area2 .= elgg_view_title($title);
- $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($title, $body);
-?>
+<?php
+ /**
+ * Tidypics: Edit the properties of multiple images
+ *
+ * Called after upload only
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ gatekeeper();
+ set_context('photos');
+
+ // parse out photo guids
+ $file_string = get_input('files');
+ $file_array_sent = explode('-', $file_string);
+ $new_file_array = array();
+
+ // set owner of page based on first photo guid
+ $photo_guid = (int)$file_array_sent[0];
+ $photo = get_entity($photo_guid);
+
+ // set page owner based on owner of photo album
+ set_page_owner($photo->owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
+ 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;
+
+ }
+ }
+
+ $title = elgg_echo('tidypics:editprops');
+ $area2 .= elgg_view_title($title);
+ $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($title, $body);
+?>
diff --git a/pages/friends.php b/pages/friends.php
index 8ac1e21d0..e35adce04 100644
--- a/pages/friends.php
+++ b/pages/friends.php
@@ -1,38 +1,38 @@
-<?php
- /**
- * Tidypics Friends Albums Listing
- *
- * List all the albums of someone's friends
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- $username = get_input('username');
-
- // if no username, redirect to world photo albums
- if (!$username) {
- forward('pg/photos/world');
- }
-
- // setup title
- $user = get_user_by_username($username);
- if (!$user) {
- forward('pg/photos/world');
- }
- if ($user->guid == get_loggedin_userid())
- $title = elgg_echo('album:yours:friends');
- else
- $title = sprintf(elgg_echo('album:friends'), $user->name);
-
- $area2 = elgg_view_title($title);
-
- // get html for viewing list of photo albums
- set_context('search');
- set_input('search_viewtype', 'gallery'); // need to force gallery view
- $area2 .= list_user_friends_objects($user->guid, 'album', 10, true, false);
-
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+<?php
+ /**
+ * Tidypics Friends Albums Listing
+ *
+ * List all the albums of someone's friends
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ $username = get_input('username');
+
+ // if no username, redirect to world photo albums
+ if (!$username) {
+ forward('pg/photos/world');
+ }
+
+ // setup title
+ $user = get_user_by_username($username);
+ if (!$user) {
+ forward('pg/photos/world');
+ }
+ if ($user->guid == get_loggedin_userid())
+ $title = elgg_echo('album:yours:friends');
+ else
+ $title = sprintf(elgg_echo('album:friends'), $user->name);
+
+ $area2 = elgg_view_title($title);
+
+ // get html for viewing list of photo albums
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
+ $area2 .= list_user_friends_objects($user->guid, 'album', 10, true, false);
+
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/pages/newalbum.php b/pages/newalbum.php
index 006c61b54..fda886d52 100644
--- a/pages/newalbum.php
+++ b/pages/newalbum.php
@@ -1,32 +1,32 @@
-<?php
-
- /**
- * Tidypics Create New Album Page
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // must be logged in to create a new album
- 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']);
- }
-
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- $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 ));
-
+<?php
+
+ /**
+ * Tidypics Create New Album Page
+ *
+ */
+
+ // Load Elgg engine
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // must be logged in to create a new album
+ 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']);
+ }
+
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ $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/pages/ownedalbums.php b/pages/ownedalbums.php
index c3dc54d24..f43c2c5eb 100644
--- a/pages/ownedalbums.php
+++ b/pages/ownedalbums.php
@@ -1,51 +1,51 @@
-<?php
- /**
- * tidypics photo gallery album listing page for a person/group
- *
- * Shows all the albums that belong to that person or group
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // if this page belongs to a closed group, prevent anyone outside group from seeing
- if (is_callable('group_gatekeeper')) group_gatekeeper();
-
- //get the owner of the current page
- $owner = page_owner_entity();
-
-
- //if page owner cannot be found, forward to world album list
- if (is_null($owner->username) || empty($owner->username)) {
- forward('pg/photos/world');
- }
-
-
- // setup group menu for album index
- if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- if (can_write_to_container(0, $owner->guid)) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'tidypics');
- }
- }
-
- //set the title
- $title = sprintf(elgg_echo('album:user'), $owner->name);
- $area2 = elgg_view_title($title);
-
- // Get objects
- set_context('search');
- set_input('search_viewtype', 'gallery');
- if ($owner instanceof ElggGroup)
- $area2 .= list_entities("object", "album", $owner->guid, 12, false);
- else
- $area2 .= list_entities("object", "album", $owner->guid, 12, false);
-
- set_context('photos');
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- // Finally draw the page
- page_draw($title, $body);
+<?php
+ /**
+ * tidypics photo gallery album listing page for a person/group
+ *
+ * Shows all the albums that belong to that person or group
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // if this page belongs to a closed group, prevent anyone outside group from seeing
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
+
+ //get the owner of the current page
+ $owner = page_owner_entity();
+
+
+ //if page owner cannot be found, forward to world album list
+ if (is_null($owner->username) || empty($owner->username)) {
+ forward('pg/photos/world');
+ }
+
+
+ // setup group menu for album index
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ if (can_write_to_container(0, $owner->guid)) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'tidypics');
+ }
+ }
+
+ //set the title
+ $title = sprintf(elgg_echo('album:user'), $owner->name);
+ $area2 = elgg_view_title($title);
+
+ // Get objects
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ if ($owner instanceof ElggGroup)
+ $area2 .= list_entities("object", "album", $owner->guid, 12, false);
+ else
+ $area2 .= list_entities("object", "album", $owner->guid, 12, false);
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/pages/tagged.php b/pages/tagged.php
index fb07b392c..b5a879809 100644
--- a/pages/tagged.php
+++ b/pages/tagged.php
@@ -1,50 +1,50 @@
-<?php
- /**
- * Tidypics Tagged Listing
- *
- * List all photos tagged with a user
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-
- // Get user guid
- $guid = get_input('guid');
-
- $user = get_entity($guid);
-
- if ($user)
- $title = sprintf(elgg_echo('tidypics:usertag'), $user->name);
- else
- $title = "User does not exist";
-
-
-
- // create main column
- $body = elgg_view_title($title);
-
- set_context('search');
- set_input('search_viewtype', 'gallery'); // need to force gallery view
- $body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false);
-
- // Set up submenus
- if (isloggedin()) {
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
- 'tidypics-b' );
- }
- add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent',
- 'tidypics-z');
-
-
-
- $body = elgg_view_layout('two_column_left_sidebar','',$body);
-
-
- page_draw($title,$body);
-
+<?php
+ /**
+ * Tidypics Tagged Listing
+ *
+ * List all photos tagged with a user
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+
+ // Get user guid
+ $guid = get_input('guid');
+
+ $user = get_entity($guid);
+
+ if ($user)
+ $title = sprintf(elgg_echo('tidypics:usertag'), $user->name);
+ else
+ $title = "User does not exist";
+
+
+
+ // create main column
+ $body = elgg_view_title($title);
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
+ $body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false);
+
+ // Set up submenus
+ if (isloggedin()) {
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
+ 'tidypics-b' );
+ }
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent',
+ 'tidypics-z');
+
+
+
+ $body = elgg_view_layout('two_column_left_sidebar','',$body);
+
+
+ page_draw($title,$body);
+
?> \ No newline at end of file
diff --git a/pages/upload.php b/pages/upload.php
index 3550d5620..84d237287 100644
--- a/pages/upload.php
+++ b/pages/upload.php
@@ -1,42 +1,42 @@
-<?php
- /**
- * Tidypics Upload Images Page
- *
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // must be logged in to upload images
- gatekeeper();
-
- $album_guid = (int) get_input('container_guid');
- if (!$album_guid)
- forward();
-
- $album = get_entity($album_guid);
-
- //if album does not exist or user does not have access
- if (!$album || !$album->canEdit()) {
- // throw warning and forward to previous page
- forward($_SERVER['HTTP_REFERER']);
- }
-
- // set page owner based on container (user or group)
- $container = $album->container_guid;
- set_page_owner($container);
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- set_context('photos');
- $title = elgg_echo('album:addpix') . ': ' . $album->title;
- $area2 .= elgg_view_title($title);
-
- $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) );
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+<?php
+ /**
+ * Tidypics Upload Images Page
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // must be logged in to upload images
+ gatekeeper();
+
+ $album_guid = (int) get_input('container_guid');
+ if (!$album_guid)
+ forward();
+
+ $album = get_entity($album_guid);
+
+ //if album does not exist or user does not have access
+ if (!$album || !$album->canEdit()) {
+ // throw warning and forward to previous page
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ // set page owner based on container (user or group)
+ $container = $album->container_guid;
+ set_page_owner($container);
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ set_context('photos');
+ $title = elgg_echo('album:addpix') . ': ' . $album->title;
+ $area2 .= elgg_view_title($title);
+
+ $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) );
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
index 402c2d7e6..9ebc31fae 100644
--- a/pages/viewalbum.php
+++ b/pages/viewalbum.php
@@ -1,68 +1,68 @@
-<?php
-
- /**
- * Tidypics Album View Page
- *
- * This displays a listing of all the photos that belong to an album
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // if this page belongs to a closed group, prevent anyone outside group from seeing
- if (is_callable('group_gatekeeper')) group_gatekeeper();
-
- // get the album entity
- $album_guid = (int) get_input('guid');
- $album = get_entity($album_guid);
-
- // panic if we can't get it
- if (!$album) forward();
-
- // container should always be set, but just in case
- if ($album->container_guid)
- set_page_owner($album->container_guid);
- else
- set_page_owner($album->owner_guid);
-
- $owner = page_owner_entity();
-
- // setup group menu
- if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- }
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
- if (can_write_to_container(0, $album->container_guid)) {
- if ($owner instanceof ElggGroup) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'photos');
- }
- add_submenu_item( elgg_echo('album:addpix'),
- $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
- 'photos');
- add_submenu_item( elgg_echo('album:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
- }
-
- // create body
- $area2 = elgg_view_entity($album, true);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($album->title, $body);
+<?php
+
+ /**
+ * Tidypics Album View Page
+ *
+ * This displays a listing of all the photos that belong to an album
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // if this page belongs to a closed group, prevent anyone outside group from seeing
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
+
+ // get the album entity
+ $album_guid = (int) get_input('guid');
+ $album = get_entity($album_guid);
+
+ // panic if we can't get it
+ if (!$album) forward();
+
+ // container should always be set, but just in case
+ if ($album->container_guid)
+ set_page_owner($album->container_guid);
+ else
+ set_page_owner($album->owner_guid);
+
+ $owner = page_owner_entity();
+
+ // setup group menu
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ }
+
+ // allow other plugins to override the slideshow
+ $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null);
+ if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'photos');
+ }
+ add_submenu_item( elgg_echo('album:addpix'),
+ $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
+ 'photos');
+ add_submenu_item( elgg_echo('album:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
+ 'photos');
+ $ts = time();
+ $token = generate_action_token($ts);
+ add_submenu_item( elgg_echo('album:delete'),
+ $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
+ 'photos',
+ true);
+ }
+
+ // create body
+ $area2 = elgg_view_entity($album, true);
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($album->title, $body);
?> \ No newline at end of file
diff --git a/pages/viewimage.php b/pages/viewimage.php
index 5f23fc685..025c1ad3b 100644
--- a/pages/viewimage.php
+++ b/pages/viewimage.php
@@ -1,58 +1,58 @@
-<?php
-
- /**
- * Tidypics image view
- *
- * Display a view of a single image
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // if this page belongs to a closed group, prevent anyone outside group from seeing
- if (is_callable('group_gatekeeper')) group_gatekeeper();
-
- // get the album entity
- $photo_guid = (int) get_input('guid');
- $photo = get_entity($photo_guid);
-
- // panic if we can't get it
- if (!$photo) forward();
-
- // set page owner based on owner of photo album
- set_page_owner($photo->owner_guid);
- $album = get_entity($photo->container_guid);
- if ($album) {
- $owner_guid = $album->container_guid;
- if ($owner_guid)
- set_page_owner($owner_guid);
- }
-
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- if (can_write_to_container(0, $album->container_guid)) {
- add_submenu_item( elgg_echo('image:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('image:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
- }
-
-
- $title = $photo->title;
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity($photo, true);
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+<?php
+
+ /**
+ * Tidypics image view
+ *
+ * Display a view of a single image
+ */
+
+ // Load Elgg engine
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // if this page belongs to a closed group, prevent anyone outside group from seeing
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
+
+ // get the album entity
+ $photo_guid = (int) get_input('guid');
+ $photo = get_entity($photo_guid);
+
+ // panic if we can't get it
+ if (!$photo) forward();
+
+ // set page owner based on owner of photo album
+ set_page_owner($photo->owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ add_submenu_item( elgg_echo('image:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
+ 'photos');
+ $ts = time();
+ $token = generate_action_token($ts);
+ add_submenu_item( elgg_echo('image:delete'),
+ $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
+ 'photos',
+ true);
+ }
+
+
+ $title = $photo->title;
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view_entity($photo, true);
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/pages/world.php b/pages/world.php
index 2683abc1d..9488f2620 100644
--- a/pages/world.php
+++ b/pages/world.php
@@ -1,31 +1,31 @@
-<?php
- /**
- * Tidypics View All Albums on Site
- *
- */
-
- include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
- // set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- $num_albums = 16;
-
- $title = elgg_echo('album:all');
-
- set_context('photos');
- $area2 = elgg_view_title($title);
-
- set_context('search');
- set_input('search_viewtype', 'gallery');
- $albums_html .= list_entities('object','album', 0, $num_albums, false);
-
-
- $area2 .= $albums_html;
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+<?php
+ /**
+ * Tidypics View All Albums on Site
+ *
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+
+ // set page owner to logged in user
+ if (isloggedin()) {
+ set_page_owner(get_loggedin_userid());
+ }
+
+ $num_albums = 16;
+
+ $title = elgg_echo('album:all');
+
+ set_context('photos');
+ $area2 = elgg_view_title($title);
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $albums_html .= list_entities('object','album', 0, $num_albums, false);
+
+
+ $area2 .= $albums_html;
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?> \ No newline at end of file
diff --git a/start.php b/start.php
index f56669c1f..472bf4881 100644
--- a/start.php
+++ b/start.php
@@ -1,437 +1,437 @@
-<?php
- /**
- * Elgg tidypics
- *
- */
-
- // set some simple defines
- define('TP_OLD_ALBUM', 0);
- define('TP_NEW_ALBUM', 1);
-
- // include core libraries
- include dirname(__FILE__) . "/lib/tidypics.php";
- include dirname(__FILE__) . "/lib/image.php";
- include dirname(__FILE__) . "/lib/album.php";
-
- /**
- * tidypics plugin initialisation functions.
- */
- function tidypics_init()
- {
- 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/hover_menu');
-
- //group view ** psuedo widget view for group pages**
- extend_view('groups/right_column','tidypics/groupprofile_albums');
-
- // rss extensions
- extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
- extend_view('extensions/channel', 'extensions/tidypics/channel');
-
- // 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("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
- add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
-
- // Register a URL handler for files
- register_entity_url_handler('tidypics_image_url', 'object', 'image');
- register_entity_url_handler('tidypics_album_url', 'object', 'album');
-
- // add the class files for image and album
- add_subtype("object", "image", "TidypicsImage");
- add_subtype("object", "album", "TidypicsAlbum");
-
- // Register entity type
- register_entity_type('object','image');
- register_entity_type('object','album');
-
- if (function_exists('add_group_tool_option'))
- add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
-
- if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled")
- register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
-
- // Register for notifications
- if (is_callable('register_notification_object')) {
- register_notification_object('object', 'album', elgg_echo('tidypics:newalbum'));
-
- register_plugin_hook('notify:entity:message', 'object', 'tidypics_notify_message');
- }
-
- // slideshow plugin hook
- register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
- }
-
- /**
- * Sets up sidebar menus for tidypics. Triggered on pagesetup.
- */
- function tidypics_submenus() {
-
- global $CONFIG;
-
- $page_owner = page_owner_entity();
-
- if ($page_owner instanceof ElggGroup) {
- if (get_context() == "groups") {
- if ($page_owner->photos_enable != "no") {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
- }
- }
- // context is only set to photos on individual pages, not on group pages
- else if (get_context() == "photos") {
-
- $view_count = get_plugin_setting('view_count', 'tidypics');
-
- // owner gets "your albumn", "your friends albums", "your most viewed", "your most recent"
- if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
-
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo('album:yours:friends'),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
- } else if (isloggedin()) {
-
- $user = get_loggedin_user();
-
- // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
- // and then "your albums", "your most viewed", "your most recent"
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
- 'tidypics-b' );
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
- 'tidypics-b');
- }
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
- 'tidypics-b');
-
- if($page_owner->name) { // check to make sure the owner set their display name
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
- }
- } else if ($page_owner->guid) {
- // non logged in user gets "page owners albums", "page owner's friends albums"
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
- add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent/',
- 'tidypics-z');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:mostviewed'),
- $CONFIG->wwwroot . 'pg/photos/mostviewed/',
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
- $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
- 'tidypics-z');
- }
- add_submenu_item( elgg_echo('tidypics:recentlycommented'),
- $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
- 'tidypics-z');
- add_submenu_item( 'Flickr Integration',
- $CONFIG->wwwroot . 'mod/tidypics/pages/flickr/setup.php',
- 'tidypics-z');
-
- }
-
- }
-
- /**
- * Sets up tidypics admin menu. Triggered on pagesetup.
- */
- function tidypics_adminmenu()
- {
- global $CONFIG;
- if (get_context() == 'admin' && isadminloggedin()) {
- add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "mod/tidypics/pages/admin.php");
- }
- }
-
- /**
- * Sets up submenus for tidypics most viewed pages
- */
- function tidypics_mostviewed_submenus() {
-
- global $CONFIG;
-
- add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
- }
-
- /**
- * 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]);
- include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
- break;
-
- case "view": //view an image individually
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
- break;
-
- case "album": //view an album individually
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
- break;
-
- case "new": //create new album
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
- break;
-
- case "upload": //upload images to album
- if (isset($page[1])) set_input('container_guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/upload.php");
- break;
-
- case "edit": //edit image or album
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/edit.php");
- break;
-
- case "friends": // albums of friends
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/friends.php");
- break;
-
- case "world": // all site albums
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
- break;
-
- case "download": // download an image
- if (isset($page[1])) set_input('file_guid', $page[1]);
- if (isset($page[2])) set_input('type', $page[2]);
- include($CONFIG->pluginspath . "tidypics/pages/download.php");
- break;
-
- case "tagged": // all photos tagged with user
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
- break;
-
- case "mostviewed": // images with the most views
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
- break;
-
- case "mostrecent": // images uploaded most recently
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
- break;
-
- case "recentlyviewed": // images most recently viewed
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
- break;
-
- case "recentlycommented": // images with the most recent comments
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
- break;
-
- case "highestrated": // images with the highest average rating
- include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
- break;
-
- case "flickr":
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/flickr/setup.php");
- break;
- }
- }
- else
- {
- // going to all site albums if something goes wrong with the page handler
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
- }
-
- }
-
- /**
- * Override permissions for group albums and images
- *
- */
- function tidypics_permission_override($hook, $entity_type, $returnvalue, $params)
- {
- $entity = $params['entity'];
- $user = $params['user'];
-
- if ($entity->subtype == get_subtype_id('object', 'album')) {
- // test that the user can edit the container
- return can_write_to_container(0, $entity->container_guid);
- }
-
- if ($entity->subtype == get_subtype_id('object', 'image')) {
- // test that the user can edit the container
- return can_write_to_container(0, $entity->container_guid);
- }
- }
-
-
- /**
- * Notification message handler
- */
- function tidypics_notify_message($hook, $entity_type, $returnvalue, $params)
- {
- $entity = $params['entity'];
- $to_entity = $params['to_entity'];
- $method = $params['method'];
- if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
- {
- // block notification message when the album doesn't have any photos
- if ($entity->new_album == TP_NEW_ALBUM)
- return false;
-
- $descr = $entity->description;
- $title = $entity->title;
- $owner = $entity->getOwnerEntity();
- return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
- return null;
- }
-
- /**
- * Populates the ->getUrl() method for file objects
- * Registered in the init function
- *
- * @param ElggEntity $entity album/image entity
- * @return string File URL
- */
- function tidypics_image_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
- }
-
- function tidypics_album_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
- }
-
-
- /**
- * Catch the plugin hook and add the default album slideshow
- *
- * @param $hook - 'tidypics:slideshow'
- * @param $entity_type - 'album'
- * @param $returnvalue - if set, return because another plugin has used the hook
- * @param $params - album entity
- * @return unknown_type
- */
- function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) {
-
- if ($returnvalue !== null) {
- // someone has already added a slideshow or requested that the slideshow is not used
- return $returnvalue;
- }
-
- $slideshow_link = 'javascript:PicLensLite.start({maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})';
-
- // add the slideshow javascript to the header
- extend_view('metatags', 'js/slideshow');
-
- return $slideshow_link;
- }
-
- function tp_mostrecentimages($max = 8, $pagination = true) {
- return list_entities("object", "image", 0, $max, false, false, $pagination);
- }
-
-
- // 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_elgg_event_handler('pagesetup','system','tidypics_adminmenu');
-
- // Register actions
- register_action("tidypics/settings", false, $CONFIG->pluginspath . "tidypics/actions/settings.php");
- 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/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php");
- register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
- register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
- register_action("tidypics/addtag", true, $CONFIG->pluginspath . "tidypics/actions/addtag.php");
- register_action("tidypics/deletetag", true, $CONFIG->pluginspath . "tidypics/actions/deletetag.php");
- register_action("tidypics/flickrSetup", true, $CONFIG->pluginspath . "tidypics/actions/flickrSetup.php");
-
+<?php
+ /**
+ * Elgg tidypics
+ *
+ */
+
+ // set some simple defines
+ define('TP_OLD_ALBUM', 0);
+ define('TP_NEW_ALBUM', 1);
+
+ // include core libraries
+ include dirname(__FILE__) . "/lib/tidypics.php";
+ include dirname(__FILE__) . "/lib/image.php";
+ include dirname(__FILE__) . "/lib/album.php";
+
+ /**
+ * tidypics plugin initialisation functions.
+ */
+ function tidypics_init()
+ {
+ 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/hover_menu');
+
+ //group view ** psuedo widget view for group pages**
+ extend_view('groups/right_column','tidypics/groupprofile_albums');
+
+ // rss extensions
+ extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
+ extend_view('extensions/channel', 'extensions/tidypics/channel');
+
+ // 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("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
+ add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
+
+ // Register a URL handler for files
+ register_entity_url_handler('tidypics_image_url', 'object', 'image');
+ register_entity_url_handler('tidypics_album_url', 'object', 'album');
+
+ // add the class files for image and album
+ add_subtype("object", "image", "TidypicsImage");
+ add_subtype("object", "album", "TidypicsAlbum");
+
+ // Register entity type
+ register_entity_type('object','image');
+ register_entity_type('object','album');
+
+ if (function_exists('add_group_tool_option'))
+ add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
+
+ if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled")
+ register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
+
+ // Register for notifications
+ if (is_callable('register_notification_object')) {
+ register_notification_object('object', 'album', elgg_echo('tidypics:newalbum'));
+
+ register_plugin_hook('notify:entity:message', 'object', 'tidypics_notify_message');
+ }
+
+ // slideshow plugin hook
+ register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
+ }
+
+ /**
+ * Sets up sidebar menus for tidypics. Triggered on pagesetup.
+ */
+ function tidypics_submenus() {
+
+ global $CONFIG;
+
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup) {
+ if (get_context() == "groups") {
+ if ($page_owner->photos_enable != "no") {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+ }
+ }
+ // context is only set to photos on individual pages, not on group pages
+ else if (get_context() == "photos") {
+
+ $view_count = get_plugin_setting('view_count', 'tidypics');
+
+ // owner gets "your albumn", "your friends albums", "your most viewed", "your most recent"
+ if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
+
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo('album:yours:friends'),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+ } else if (isloggedin()) {
+
+ $user = get_loggedin_user();
+
+ // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
+ // and then "your albums", "your most viewed", "your most recent"
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
+ 'tidypics-b' );
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
+ 'tidypics-b');
+ }
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
+ 'tidypics-b');
+
+ if($page_owner->name) { // check to make sure the owner set their display name
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+ } else if ($page_owner->guid) {
+ // non logged in user gets "page owners albums", "page owner's friends albums"
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent/',
+ 'tidypics-z');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:mostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/mostviewed/',
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
+ $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
+ 'tidypics-z');
+ }
+ add_submenu_item( elgg_echo('tidypics:recentlycommented'),
+ $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
+ 'tidypics-z');
+ add_submenu_item( 'Flickr Integration',
+ $CONFIG->wwwroot . 'mod/tidypics/pages/flickr/setup.php',
+ 'tidypics-z');
+
+ }
+
+ }
+
+ /**
+ * Sets up tidypics admin menu. Triggered on pagesetup.
+ */
+ function tidypics_adminmenu()
+ {
+ global $CONFIG;
+ if (get_context() == 'admin' && isadminloggedin()) {
+ add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "mod/tidypics/pages/admin.php");
+ }
+ }
+
+ /**
+ * Sets up submenus for tidypics most viewed pages
+ */
+ function tidypics_mostviewed_submenus() {
+
+ global $CONFIG;
+
+ add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
+ }
+
+ /**
+ * 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]);
+ include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
+ break;
+
+ case "view": //view an image individually
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
+ break;
+
+ case "album": //view an album individually
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
+ break;
+
+ case "new": //create new album
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
+ break;
+
+ case "upload": //upload images to album
+ if (isset($page[1])) set_input('container_guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/upload.php");
+ break;
+
+ case "edit": //edit image or album
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/edit.php");
+ break;
+
+ case "friends": // albums of friends
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/friends.php");
+ break;
+
+ case "world": // all site albums
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
+ break;
+
+ case "download": // download an image
+ if (isset($page[1])) set_input('file_guid', $page[1]);
+ if (isset($page[2])) set_input('type', $page[2]);
+ include($CONFIG->pluginspath . "tidypics/pages/download.php");
+ break;
+
+ case "tagged": // all photos tagged with user
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
+ break;
+
+ case "mostviewed": // images with the most views
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
+ break;
+
+ case "mostrecent": // images uploaded most recently
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
+ break;
+
+ case "recentlyviewed": // images most recently viewed
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
+ break;
+
+ case "recentlycommented": // images with the most recent comments
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
+ break;
+
+ case "highestrated": // images with the highest average rating
+ include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
+ break;
+
+ case "flickr":
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/flickr/setup.php");
+ break;
+ }
+ }
+ else
+ {
+ // going to all site albums if something goes wrong with the page handler
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
+ }
+
+ }
+
+ /**
+ * Override permissions for group albums and images
+ *
+ */
+ function tidypics_permission_override($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $user = $params['user'];
+
+ if ($entity->subtype == get_subtype_id('object', 'album')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+
+ if ($entity->subtype == get_subtype_id('object', 'image')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+ }
+
+
+ /**
+ * Notification message handler
+ */
+ function tidypics_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
+ {
+ // block notification message when the album doesn't have any photos
+ if ($entity->new_album == TP_NEW_ALBUM)
+ return false;
+
+ $descr = $entity->description;
+ $title = $entity->title;
+ $owner = $entity->getOwnerEntity();
+ return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ return null;
+ }
+
+ /**
+ * Populates the ->getUrl() method for file objects
+ * Registered in the init function
+ *
+ * @param ElggEntity $entity album/image entity
+ * @return string File URL
+ */
+ function tidypics_image_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
+ }
+
+ function tidypics_album_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
+ }
+
+
+ /**
+ * Catch the plugin hook and add the default album slideshow
+ *
+ * @param $hook - 'tidypics:slideshow'
+ * @param $entity_type - 'album'
+ * @param $returnvalue - if set, return because another plugin has used the hook
+ * @param $params - album entity
+ * @return unknown_type
+ */
+ function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) {
+
+ if ($returnvalue !== null) {
+ // someone has already added a slideshow or requested that the slideshow is not used
+ return $returnvalue;
+ }
+
+ $slideshow_link = 'javascript:PicLensLite.start({maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})';
+
+ // add the slideshow javascript to the header
+ extend_view('metatags', 'js/slideshow');
+
+ return $slideshow_link;
+ }
+
+ function tp_mostrecentimages($max = 8, $pagination = true) {
+ return list_entities("object", "image", 0, $max, false, false, $pagination);
+ }
+
+
+ // 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_elgg_event_handler('pagesetup','system','tidypics_adminmenu');
+
+ // Register actions
+ register_action("tidypics/settings", false, $CONFIG->pluginspath . "tidypics/actions/settings.php");
+ 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/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php");
+ register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
+ register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
+ register_action("tidypics/addtag", true, $CONFIG->pluginspath . "tidypics/actions/addtag.php");
+ register_action("tidypics/deletetag", true, $CONFIG->pluginspath . "tidypics/actions/deletetag.php");
+ register_action("tidypics/flickrSetup", true, $CONFIG->pluginspath . "tidypics/actions/flickrSetup.php");
+
?> \ No newline at end of file
diff --git a/thumbnail.php b/thumbnail.php
index f310aee95..79d487210 100644
--- a/thumbnail.php
+++ b/thumbnail.php
@@ -1,78 +1,78 @@
-<?php
-
- /**
- * Tidypics Thumbnail
- *
- */
-
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- // Get file GUID
- $file_guid = (int) get_input('file_guid');
-
- // Get file thumbnail size
- $size = get_input('size');
- // only 3 possibilities
- if ($size != 'small' && $size != 'thumb') {
- $size = 'large';
- }
-
- $error_image = '';
- switch ($size) {
- case 'thumb':
- $error_image = "image_error_thumb.png";
- break;
- case 'small':
- $error_image = "image_error_small.png";
- break;
- case 'large':
- $error_image = "image_error_large.png";
- break;
- }
-
- // Get file entity
- $file = get_entity($file_guid);
- if (!$file)
- forward('mod/tidypics/graphics/' . $error_image);
-
- if ($file->getSubtype() != "image")
- forward('mod/tidypics/graphics/' . $error_image);
-
- // Get filename
- if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
- } else if ($size == "small") {
- $thumbfile = $file->smallthumb;
- } else {
- $thumbfile = $file->largethumb;
- }
-
- if (!$thumbfile)
- forward('mod/tidypics/graphics/' . $error_image);
-
- // create Elgg File object
- $readfile = new ElggFile();
- $readfile->owner_guid = $file->owner_guid;
- $readfile->setFilename($thumbfile);
- $contents = $readfile->grabFile();
-
- // send error image if file could not be read
- if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
- }
-
- // expires every 14 days
- $expires = 14 * 60*60*24;
-
- // overwrite header caused by php session code so images can be cached
- $mime = $file->getMimeType();
- header("Content-Type: $mime");
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
- // Return the thumbnail and exit
- echo $contents;
- exit;
-?>
+<?php
+
+ /**
+ * Tidypics Thumbnail
+ *
+ */
+
+ include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // Get file GUID
+ $file_guid = (int) get_input('file_guid');
+
+ // Get file thumbnail size
+ $size = get_input('size');
+ // only 3 possibilities
+ if ($size != 'small' && $size != 'thumb') {
+ $size = 'large';
+ }
+
+ $error_image = '';
+ switch ($size) {
+ case 'thumb':
+ $error_image = "image_error_thumb.png";
+ break;
+ case 'small':
+ $error_image = "image_error_small.png";
+ break;
+ case 'large':
+ $error_image = "image_error_large.png";
+ break;
+ }
+
+ // Get file entity
+ $file = get_entity($file_guid);
+ if (!$file)
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ if ($file->getSubtype() != "image")
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // Get filename
+ if ($size == "thumb") {
+ $thumbfile = $file->thumbnail;
+ } else if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+ } else {
+ $thumbfile = $file->largethumb;
+ }
+
+ if (!$thumbfile)
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // create Elgg File object
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($thumbfile);
+ $contents = $readfile->grabFile();
+
+ // send error image if file could not be read
+ if (!$contents) {
+ forward('mod/tidypics/graphics/' . $error_image);
+ }
+
+ // expires every 14 days
+ $expires = 14 * 60*60*24;
+
+ // overwrite header caused by php session code so images can be cached
+ $mime = $file->getMimeType();
+ header("Content-Type: $mime");
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+ // Return the thumbnail and exit
+ echo $contents;
+ exit;
+?>
diff --git a/views/default/annotation/annotate.php b/views/default/annotation/annotate.php
index c0fb05d3a..8156a4bb4 100644
--- a/views/default/annotation/annotate.php
+++ b/views/default/annotation/annotate.php
@@ -1,21 +1,21 @@
-<?php
-
- /*
- * Overriding core view to work around bug dealing with empty titles
- */
-
- $performed_by = get_entity($vars['item']->subject_guid);
- $object = get_entity($vars['item']->object_guid);
- $url = $object->getURL();
- $subtype = get_subtype_from_id($object->subtype);
- $title = $object->title;
- if (!$title)
- $title = elgg_echo('untitled');
-
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $string = sprintf(elgg_echo("river:posted:generic"),$url) . " ";
- $string .= elgg_echo("{$subtype}:river:annotate") . " <a href=\"" . $object->getURL() . "\">" . $title . "</a>";
-
-?>
-
+<?php
+
+ /*
+ * Overriding core view to work around bug dealing with empty titles
+ */
+
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $object = get_entity($vars['item']->object_guid);
+ $url = $object->getURL();
+ $subtype = get_subtype_from_id($object->subtype);
+ $title = $object->title;
+ if (!$title)
+ $title = elgg_echo('untitled');
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("river:posted:generic"),$url) . " ";
+ $string .= elgg_echo("{$subtype}:river:annotate") . " <a href=\"" . $object->getURL() . "\">" . $title . "</a>";
+
+?>
+
<?php echo $string; ?> \ No newline at end of file
diff --git a/views/default/js/tagging.php b/views/default/js/tagging.php
index bd6890502..d8abda24c 100644
--- a/views/default/js/tagging.php
+++ b/views/default/js/tagging.php
@@ -1,303 +1,303 @@
-<?php
- $photo_tags_json = $vars['photo_tags_json'];
-?>
-<script type="text/javascript" src="<?php echo $vars['url'] ?>mod/tidypics/vendors/jquery.imgareaselect-0.7.js"></script>
-<script type="text/javascript" src="<?php echo $vars['url'] ?>mod/tidypics/vendors/jquery.quicksearch.js"></script>
-
-<script type="text/javascript">
-
- var coordinates = "";
- var user_id = 0;
- var tagging = 0;
-
- // add to DOM as soon as ready
- $(document).ready(function () {
- $('ul#tidypics_phototag_list li').quicksearch({
- position: 'before',
- attached: 'ul#tidypics_phototag_list',
- loaderText: '',
- inputClass: 'input-filter',
- delay: 100
- });
-
- $('#quicksearch').submit( function () { addTag() } );
- }
- );
-
- // images are loaded so process tags
- $(window).load(function () {
- $('#tidypics_image').setupTags();
- }
- );
-
- // get tags over image ready for mouseover
- // based on code by Tarique Sani tarique at sanisoft.com - MIT and GPL licenses
- $.fn.setupTags = function()
- {
-
- image = this;
-
- imgOffset = $(image).offset();
- imgOffset.left = parseInt(imgOffset.left) + parseInt($(image).css("border-left-width")) + parseInt($(image).css("padding-left"));
- imgOffset.top = parseInt(imgOffset.top) + parseInt($(image).css("border-top-width")) + parseInt($(image).css("padding-top"));
-
- tags = <?php echo $photo_tags_json; ?>;
-
- $(tags).each(function(){
- appendTag(imgOffset, this);
- });
-
- $(image).hover(
- function(){
- $('.tidypics_tag').show();
- },
- function(){
- $('.tidypics_tag').hide();
- }
- );
-
- addTagEvents();
-
- $('.tidypics_phototag_links').hover(
- function(){
- code = this.id.substr(7); // cut off taglink to get unique id
- $('#tag'+code).show();
- },
- function(){
- code = this.id.substr(7);
- $('#tag'+code).hide();
- }
- );
-
- // make sure we catch and handle when the browser is resized
- $(window).resize(function () {
- $('.tidypics_tag').remove();
-
- imgOffset = $(image).offset();
-
- $(tags).each(function(){
- appendTag(imgOffset, this);
- });
-
- addTagEvents();
- });
- }
-
- function appendTag(offset, tag)
- {
- // catch for IE when no tags available
- if (tag.id == undefined)
- return;
-
- tag_top = parseInt(imgOffset.top) + parseInt(tag.y1);
- tag_left = parseInt(imgOffset.left) + parseInt(tag.x1);
-
- tag_div = $('<div class="tidypics_tag" id="tag'+tag.id+'"></div>').css({ left: tag_left + 'px', top: tag_top + 'px', width: tag.width + 'px', height: tag.height + 'px' });
-
- text_top = parseInt(tag_top) + parseInt(tag.height) + 5;
-
- tag_text_div = $('<div class="tidypics_tag_text">'+tag.text+'</div>').css({ left: tag_left + 'px', top: text_top + 'px', width: '120px'});
-
- $('body').append(tag_div);
- $('body').append(tag_text_div);
- }
-
- function addTagEvents()
- {
- $('.tidypics_tag').hover(
- function(){
- $('.tidypics_tag').show();
- $(this).next('.tidypics_tag_text').show();
- $(this).next('.tidypics_tag_text').css("z-index", 10000);
- },
- function(){
- $('.tidypics_tag').show();
- $(this).next('.tidypics_tag_text').hide();
- $(this).next('.tidypics_tag_text').css("z-index", 0);
- }
- );
- }
-
-
- function selectUser(id, name)
- {
- user_id = id;
- $("input.input-filter").val(name);
- }
-
- function startTagging()
- {
- if (tagging != 0)
- {
- stopTagging();
- return;
- }
-
- tagging = 1;
-
- $('#tidypics_tag_control').text("<?php echo elgg_echo('tidypics:finish_tagging'); ?>");
-
- showTagInstruct();
- $('#tidypics_delete_tag_menu').hide();
-
- $('#tidypics_image').hover(
- function(){
- $('.tidypics_tag').hide();
- },
- function(){
- $('.tidypics_tag').hide();
- }
- );
-
- $('img#tidypics_image').imgAreaSelect( {
- borderWidth: 2,
- borderColor1: 'white',
- borderColor2: 'white',
- disable: false,
- hide: false,
- onSelectEnd: showTagMenu,
- onSelectStart: hideTagMenu
- }
- );
-
- $('img#tidypics_image').css({"cursor" : "crosshair"});
- }
-
- function stopTagging()
- {
- tagging = 0;
-
- hideTagInstruct();
- hideTagMenu();
-
- $('img#tidypics_image').imgAreaSelect( {hide: true, disable: true} );
-
- $('#tidypics_tag_control').text("<?php echo elgg_echo('tidypics:tagthisphoto'); ?>");
-
- // restart tag hovering
- $('#tidypics_image').hover(
- function(){
- $('.tidypics_tag').show();
- },
- function(){
- $('.tidypics_tag').hide();
- }
- );
-
- $('img#tidypics_image').css({"cursor" : "pointer"});
- }
-
- function showTagMenu(oObject, oCoordenates)
- {
- offsetX = 6;
- offsetY = 10;
-
- imgOffset = $('#tidypics_image').offset();
-
- // show the list of friends
- if (oCoordenates.width != 0 && oCoordenates.height != 0) {
- coordinates = oCoordenates;
-
- _top = imgOffset.top + oCoordenates.y2 + offsetY;
- _left = imgOffset.left + oCoordenates.x1 + offsetX;
-
- $('#tidypics_tag_menu').show().css({
- "top": _top + "px",
- "left": _left + "px"
- });
-
- $(".input-filter").focus();
- }
- }
-
-
- function hideTagMenu()
- {
- $('#tidypics_tag_menu').hide();
- }
-
- function showTagInstruct()
- {
- offsetY = -60;
-
- divWidth = $('#tidypics_tag_instructions').width();
- imgOffset = $('#tidypics_image').offset();
- imgWidth = $('#tidypics_image').width();
- offsetX = parseInt((imgWidth - divWidth)/2);
-
- _top = imgOffset.top + offsetY;
- _left = imgOffset.left + offsetX;
-
- $('#tidypics_tag_instructions').show().css({
- "top": _top + "px",
- "left": _left + "px"
- });
- }
-
- function hideTagInstruct()
- {
- $('#tidypics_tag_instructions').hide();
- }
-
- function addTag()
- {
- // do I need a catch for no tag?
-
- $("input#user_id").val(user_id);
- $("input#word").val( $("input.input-filter").val() );
-
- coord_string = '"x1":"' + coordinates.x1 + '",';
- coord_string += '"y1":"' + coordinates.y1 + '",';
- coord_string += '"width":"' + coordinates.width + '",';
- coord_string += '"height":"' + coordinates.height + '"';
-
- $("input#coordinates").val(coord_string);
-
- //Show loading
- //$("#tag_menu").replaceWith('<div align="center" class="ajax_loader"></div>');
- }
-
- function deleteTags()
- {
- offsetY = 60;
-
- stopTagging();
-
- divWidth = $('#delete_tag_menu').width();
- imgOffset = $('#tidypics_image').offset();
- imgWidth = $('#tidypics_image').width();
- offsetX = parseInt((imgWidth - divWidth)/2);
-
- _top = imgOffset.top + offsetY;
- _left = imgOffset.left + offsetX;
-
- $('#tidypics_delete_tag_menu').show().css({
- "top": _top + "px",
- "left": _left + "px"
- });
-
- $('#tidypics_image').hover(
- function(){
- $('.tidypics_tag').hide();
- },
- function(){
- $('.tidypics_tag').hide();
- }
- );
- }
-
- function hideDeleteMenu()
- {
- $('#tidypics_delete_tag_menu').hide();
-
- // restart tag hovering
- $('#tidypics_image').hover(
- function(){
- $('.tidypics_tag').show();
- },
- function(){
- $('.tidypics_tag').hide();
- }
- );
- }
+<?php
+ $photo_tags_json = $vars['photo_tags_json'];
+?>
+<script type="text/javascript" src="<?php echo $vars['url'] ?>mod/tidypics/vendors/jquery.imgareaselect-0.7.js"></script>
+<script type="text/javascript" src="<?php echo $vars['url'] ?>mod/tidypics/vendors/jquery.quicksearch.js"></script>
+
+<script type="text/javascript">
+
+ var coordinates = "";
+ var user_id = 0;
+ var tagging = 0;
+
+ // add to DOM as soon as ready
+ $(document).ready(function () {
+ $('ul#tidypics_phototag_list li').quicksearch({
+ position: 'before',
+ attached: 'ul#tidypics_phototag_list',
+ loaderText: '',
+ inputClass: 'input-filter',
+ delay: 100
+ });
+
+ $('#quicksearch').submit( function () { addTag() } );
+ }
+ );
+
+ // images are loaded so process tags
+ $(window).load(function () {
+ $('#tidypics_image').setupTags();
+ }
+ );
+
+ // get tags over image ready for mouseover
+ // based on code by Tarique Sani tarique at sanisoft.com - MIT and GPL licenses
+ $.fn.setupTags = function()
+ {
+
+ image = this;
+
+ imgOffset = $(image).offset();
+ imgOffset.left = parseInt(imgOffset.left) + parseInt($(image).css("border-left-width")) + parseInt($(image).css("padding-left"));
+ imgOffset.top = parseInt(imgOffset.top) + parseInt($(image).css("border-top-width")) + parseInt($(image).css("padding-top"));
+
+ tags = <?php echo $photo_tags_json; ?>;
+
+ $(tags).each(function(){
+ appendTag(imgOffset, this);
+ });
+
+ $(image).hover(
+ function(){
+ $('.tidypics_tag').show();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
+ );
+
+ addTagEvents();
+
+ $('.tidypics_phototag_links').hover(
+ function(){
+ code = this.id.substr(7); // cut off taglink to get unique id
+ $('#tag'+code).show();
+ },
+ function(){
+ code = this.id.substr(7);
+ $('#tag'+code).hide();
+ }
+ );
+
+ // make sure we catch and handle when the browser is resized
+ $(window).resize(function () {
+ $('.tidypics_tag').remove();
+
+ imgOffset = $(image).offset();
+
+ $(tags).each(function(){
+ appendTag(imgOffset, this);
+ });
+
+ addTagEvents();
+ });
+ }
+
+ function appendTag(offset, tag)
+ {
+ // catch for IE when no tags available
+ if (tag.id == undefined)
+ return;
+
+ tag_top = parseInt(imgOffset.top) + parseInt(tag.y1);
+ tag_left = parseInt(imgOffset.left) + parseInt(tag.x1);
+
+ tag_div = $('<div class="tidypics_tag" id="tag'+tag.id+'"></div>').css({ left: tag_left + 'px', top: tag_top + 'px', width: tag.width + 'px', height: tag.height + 'px' });
+
+ text_top = parseInt(tag_top) + parseInt(tag.height) + 5;
+
+ tag_text_div = $('<div class="tidypics_tag_text">'+tag.text+'</div>').css({ left: tag_left + 'px', top: text_top + 'px', width: '120px'});
+
+ $('body').append(tag_div);
+ $('body').append(tag_text_div);
+ }
+
+ function addTagEvents()
+ {
+ $('.tidypics_tag').hover(
+ function(){
+ $('.tidypics_tag').show();
+ $(this).next('.tidypics_tag_text').show();
+ $(this).next('.tidypics_tag_text').css("z-index", 10000);
+ },
+ function(){
+ $('.tidypics_tag').show();
+ $(this).next('.tidypics_tag_text').hide();
+ $(this).next('.tidypics_tag_text').css("z-index", 0);
+ }
+ );
+ }
+
+
+ function selectUser(id, name)
+ {
+ user_id = id;
+ $("input.input-filter").val(name);
+ }
+
+ function startTagging()
+ {
+ if (tagging != 0)
+ {
+ stopTagging();
+ return;
+ }
+
+ tagging = 1;
+
+ $('#tidypics_tag_control').text("<?php echo elgg_echo('tidypics:finish_tagging'); ?>");
+
+ showTagInstruct();
+ $('#tidypics_delete_tag_menu').hide();
+
+ $('#tidypics_image').hover(
+ function(){
+ $('.tidypics_tag').hide();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
+ );
+
+ $('img#tidypics_image').imgAreaSelect( {
+ borderWidth: 2,
+ borderColor1: 'white',
+ borderColor2: 'white',
+ disable: false,
+ hide: false,
+ onSelectEnd: showTagMenu,
+ onSelectStart: hideTagMenu
+ }
+ );
+
+ $('img#tidypics_image').css({"cursor" : "crosshair"});
+ }
+
+ function stopTagging()
+ {
+ tagging = 0;
+
+ hideTagInstruct();
+ hideTagMenu();
+
+ $('img#tidypics_image').imgAreaSelect( {hide: true, disable: true} );
+
+ $('#tidypics_tag_control').text("<?php echo elgg_echo('tidypics:tagthisphoto'); ?>");
+
+ // restart tag hovering
+ $('#tidypics_image').hover(
+ function(){
+ $('.tidypics_tag').show();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
+ );
+
+ $('img#tidypics_image').css({"cursor" : "pointer"});
+ }
+
+ function showTagMenu(oObject, oCoordenates)
+ {
+ offsetX = 6;
+ offsetY = 10;
+
+ imgOffset = $('#tidypics_image').offset();
+
+ // show the list of friends
+ if (oCoordenates.width != 0 && oCoordenates.height != 0) {
+ coordinates = oCoordenates;
+
+ _top = imgOffset.top + oCoordenates.y2 + offsetY;
+ _left = imgOffset.left + oCoordenates.x1 + offsetX;
+
+ $('#tidypics_tag_menu').show().css({
+ "top": _top + "px",
+ "left": _left + "px"
+ });
+
+ $(".input-filter").focus();
+ }
+ }
+
+
+ function hideTagMenu()
+ {
+ $('#tidypics_tag_menu').hide();
+ }
+
+ function showTagInstruct()
+ {
+ offsetY = -60;
+
+ divWidth = $('#tidypics_tag_instructions').width();
+ imgOffset = $('#tidypics_image').offset();
+ imgWidth = $('#tidypics_image').width();
+ offsetX = parseInt((imgWidth - divWidth)/2);
+
+ _top = imgOffset.top + offsetY;
+ _left = imgOffset.left + offsetX;
+
+ $('#tidypics_tag_instructions').show().css({
+ "top": _top + "px",
+ "left": _left + "px"
+ });
+ }
+
+ function hideTagInstruct()
+ {
+ $('#tidypics_tag_instructions').hide();
+ }
+
+ function addTag()
+ {
+ // do I need a catch for no tag?
+
+ $("input#user_id").val(user_id);
+ $("input#word").val( $("input.input-filter").val() );
+
+ coord_string = '"x1":"' + coordinates.x1 + '",';
+ coord_string += '"y1":"' + coordinates.y1 + '",';
+ coord_string += '"width":"' + coordinates.width + '",';
+ coord_string += '"height":"' + coordinates.height + '"';
+
+ $("input#coordinates").val(coord_string);
+
+ //Show loading
+ //$("#tag_menu").replaceWith('<div align="center" class="ajax_loader"></div>');
+ }
+
+ function deleteTags()
+ {
+ offsetY = 60;
+
+ stopTagging();
+
+ divWidth = $('#delete_tag_menu').width();
+ imgOffset = $('#tidypics_image').offset();
+ imgWidth = $('#tidypics_image').width();
+ offsetX = parseInt((imgWidth - divWidth)/2);
+
+ _top = imgOffset.top + offsetY;
+ _left = imgOffset.left + offsetX;
+
+ $('#tidypics_delete_tag_menu').show().css({
+ "top": _top + "px",
+ "left": _left + "px"
+ });
+
+ $('#tidypics_image').hover(
+ function(){
+ $('.tidypics_tag').hide();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
+ );
+ }
+
+ function hideDeleteMenu()
+ {
+ $('#tidypics_delete_tag_menu').hide();
+
+ // restart tag hovering
+ $('#tidypics_image').hover(
+ function(){
+ $('.tidypics_tag').show();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
+ );
+ }
</script> \ No newline at end of file
diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php
index a9b261566..20f9293d7 100644
--- a/views/default/river/object/album/create.php
+++ b/views/default/river/object/album/create.php
@@ -1,42 +1,42 @@
-<?php
-
- $performed_by = get_entity($vars['item']->subject_guid);
- $album = get_entity($vars['item']->object_guid);
-
- $group_album = ($album->owner_guid != $album->container_guid);
- if ($group_album) {
- $group = get_entity($album->container_guid);
- $group_name = $group->name;
- $group_link = $group->getURL();
- }
-
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $string = sprintf(elgg_echo("album:river:created"),$url) . " ";
- $string .= "<a href=\"" . $album->getURL() . "\">" . $album->title . "</a>";
- if ($group_album)
- $string .= ' ' . elgg_echo('album:river:group') . ' ' . "<a href=\"{$group_link}\" >{$group_name}</a>";
-
- $album_river_view = get_plugin_setting('album_river_view', 'tidypics');
-
- if ($album_river_view == "cover") {
- if ($album->cover) {
- $string .= "<div class=\"river_content\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/>' . "</div>";
- }
- } else {
-
- $string .= "<div class=\"river_content\">";
-
- $images = get_entities("object", "image", $album->guid, 'time_created desc', 7);
-
- if (count($images)) {
- foreach($images as $image){
- $string .= "<a href=\"" . $image->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
- }
- }
-
- $string .= "</div>";
- }
-
-echo $string;
-
-?>
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $album = get_entity($vars['item']->object_guid);
+
+ $group_album = ($album->owner_guid != $album->container_guid);
+ if ($group_album) {
+ $group = get_entity($album->container_guid);
+ $group_name = $group->name;
+ $group_link = $group->getURL();
+ }
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("album:river:created"),$url) . " ";
+ $string .= "<a href=\"" . $album->getURL() . "\">" . $album->title . "</a>";
+ if ($group_album)
+ $string .= ' ' . elgg_echo('album:river:group') . ' ' . "<a href=\"{$group_link}\" >{$group_name}</a>";
+
+ $album_river_view = get_plugin_setting('album_river_view', 'tidypics');
+
+ if ($album_river_view == "cover") {
+ if ($album->cover) {
+ $string .= "<div class=\"river_content\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/>' . "</div>";
+ }
+ } else {
+
+ $string .= "<div class=\"river_content\">";
+
+ $images = get_entities("object", "image", $album->guid, 'time_created desc', 7);
+
+ if (count($images)) {
+ foreach($images as $image){
+ $string .= "<a href=\"" . $image->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
+ }
+ }
+
+ $string .= "</div>";
+ }
+
+echo $string;
+
+?>
diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php
index 5229e109a..2f1777f64 100644
--- a/views/default/river/object/image/create.php
+++ b/views/default/river/object/image/create.php
@@ -1,29 +1,29 @@
-<?php
-
- $performed_by = get_entity($vars['item']->subject_guid);
- $image = get_entity($vars['item']->object_guid);
- if($image->title) {
- $title = $image->title;
- } else {
- $title = "untitled";
- }
-
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $album = get_entity($image->container_guid);
-
- $album_link = "<a href='". $album->getURL() . "'>" . $album->title . "</a>";
- $image_link = "<a href=\"" . $image->getURL() . "\">" . $title . "</a>";
-
- $string = sprintf(elgg_echo("image:river:created"),$performed_by->name, $image_link, $album_link);
-
- $string .= "<div class=\"river_content\">";
-
-/* // this adds the album cover to the river display
- $string .= "<a href=\"" . $album->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
-*/
- $string .= "<a href=\"" . $image->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
- $string .= "</div>";
-
- echo $string;
-
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $image = get_entity($vars['item']->object_guid);
+ if($image->title) {
+ $title = $image->title;
+ } else {
+ $title = "untitled";
+ }
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $album = get_entity($image->container_guid);
+
+ $album_link = "<a href='". $album->getURL() . "'>" . $album->title . "</a>";
+ $image_link = "<a href=\"" . $image->getURL() . "\">" . $title . "</a>";
+
+ $string = sprintf(elgg_echo("image:river:created"),$performed_by->name, $image_link, $album_link);
+
+ $string .= "<div class=\"river_content\">";
+
+/* // this adds the album cover to the river display
+ $string .= "<a href=\"" . $album->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
+*/
+ $string .= "<a href=\"" . $image->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> </a>';
+ $string .= "</div>";
+
+ echo $string;
+
?> \ No newline at end of file
diff --git a/views/default/river/object/image/tag.php b/views/default/river/object/image/tag.php
index 6e60d5af3..1b3589afb 100644
--- a/views/default/river/object/image/tag.php
+++ b/views/default/river/object/image/tag.php
@@ -1,23 +1,23 @@
-<?php
-
- $image = get_entity($vars['item']->subject_guid);
- $person_tagged = get_entity($vars['item']->object_guid);
- if($image->title) {
- $title = $image->title;
- } else {
- $title = "untitled";
- }
-
- // viewer may not have permission to view image
- if (!$image)
- return;
-
-
- $image_url = "<a href=\"{$image->getURL()}\">{$title}</a>";
- $person_url = "<a href=\"{$person_tagged->getURL()}\">{$person_tagged->name}</a>";
-
- $string = $person_url . ' ' . elgg_echo('image:river:tagged') . ' ' . $image_url;
-
- echo $string;
-
+<?php
+
+ $image = get_entity($vars['item']->subject_guid);
+ $person_tagged = get_entity($vars['item']->object_guid);
+ if($image->title) {
+ $title = $image->title;
+ } else {
+ $title = "untitled";
+ }
+
+ // viewer may not have permission to view image
+ if (!$image)
+ return;
+
+
+ $image_url = "<a href=\"{$image->getURL()}\">{$title}</a>";
+ $person_url = "<a href=\"{$person_tagged->getURL()}\">{$person_tagged->name}</a>";
+
+ $string = $person_url . ' ' . elgg_echo('image:river:tagged') . ' ' . $image_url;
+
+ echo $string;
+
?> \ No newline at end of file
diff --git a/views/default/tidypics/admin/help.php b/views/default/tidypics/admin/help.php
index 4014be9ce..7f871598c 100644
--- a/views/default/tidypics/admin/help.php
+++ b/views/default/tidypics/admin/help.php
@@ -1,25 +1,25 @@
-<br />
-<h3>White screen when uploading images</h3>
-<p>
-Tidypics tries to calculate the maximum size of an image that your server will support. If it
-guesses incorrectly and someone uploads a photo that is too large, the script may crash when
-resizing the image if you are using GD. The easiest way to test this is to set display_errors
-to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
-should display on the screen. You can increased your php memory limit (see the docs directory).
-A better option is to use ImageMagick if your server supports it (again see the docs directory).
-</p><p>
-If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
-change display_error back to 0.
-</p>
-<h3>Question mark images appear</h3>
-<p>
-If you see question mark images when you look at your albums, this means the resizing of the images
-failed. This could be due to the memory limits as described above. There are other causes. Tidypics
-tries to detect these problems and write the cause to the error log. You should check your server
-error log right after an upload that results in a question mark for these error messages. The messages
-will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
-not see these warnings.
-</p><p>
-Another possible cause is using ImageMagick when your server does not support it or specifying
-the wrong path to the ImageMagick executables.
+<br />
+<h3>White screen when uploading images</h3>
+<p>
+Tidypics tries to calculate the maximum size of an image that your server will support. If it
+guesses incorrectly and someone uploads a photo that is too large, the script may crash when
+resizing the image if you are using GD. The easiest way to test this is to set display_errors
+to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
+should display on the screen. You can increased your php memory limit (see the docs directory).
+A better option is to use ImageMagick if your server supports it (again see the docs directory).
+</p><p>
+If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
+change display_error back to 0.
+</p>
+<h3>Question mark images appear</h3>
+<p>
+If you see question mark images when you look at your albums, this means the resizing of the images
+failed. This could be due to the memory limits as described above. There are other causes. Tidypics
+tries to detect these problems and write the cause to the error log. You should check your server
+error log right after an upload that results in a question mark for these error messages. The messages
+will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
+not see these warnings.
+</p><p>
+Another possible cause is using ImageMagick when your server does not support it or specifying
+the wrong path to the ImageMagick executables.
</p> \ No newline at end of file
diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php
index deb32d0f3..b4656afe1 100644
--- a/views/default/tidypics/admin/imagelib.php
+++ b/views/default/tidypics/admin/imagelib.php
@@ -1,62 +1,62 @@
-<?php
-
- $img_type = get_subtype_id('object', 'image');
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
- $total = get_data_row($query);
- $num_images = $total->total;
-
- $img_type = get_subtype_id('object', 'album');
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
- $total = get_data_row($query);
- $num_albums = $total->total;
-
- $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
- $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
-
- $num_views = count_annotations(0, 'object', 'image', 'tp_view');
-
- if (get_plugin_setting('tagging', 'tidypics') != "disabled")
- $num_tags = count_annotations(0, 'object', 'image', 'phototag');
-?>
-<br />
-<h3>Overview</h3>
-<p>
-An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
-There are three image library options with Tidypics: PHP extension <a href="http://www.php.net/manual/en/book.image.php">GD</a>,
-<a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension
-<a href="http://pecl.php.net/package/imagick/">imagick</a>. GD is the most common of the three on hosted servers but suffers
-from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
-PHP extension), we recommend that you use that.
-</p>
-<h3>Testing ImageMagick Commandline</h3>
-<p>
-To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
-<a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; ?>">server analysis page</a> to find out the
-configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
-be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
-ImageMagick installed on your server.
-</p>
-<br />
-<p>
-<?php echo elgg_echo('tidypics:settings:im_path'); ?><br />
-<input name="im_location" type="text" />
-<input type="submit" value="Submit" onclick="TestImageMagickLocation();" />
-</p>
-<div id="im_results"></div>
-
-<script type="text/javascript">
-function TestImageMagickLocation()
-{
- var loc = $('input[name=im_location]').val();
- $("#im_results").html("");
- $.ajax({
- type: "GET",
- url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/imtest.php'; ?>",
- data: {location: loc},
- cache: false,
- success: function(html){
- $("#im_results").html(html);
- }
- });
-}
+<?php
+
+ $img_type = get_subtype_id('object', 'image');
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_images = $total->total;
+
+ $img_type = get_subtype_id('object', 'album');
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_albums = $total->total;
+
+ $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
+ $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
+
+ $num_views = count_annotations(0, 'object', 'image', 'tp_view');
+
+ if (get_plugin_setting('tagging', 'tidypics') != "disabled")
+ $num_tags = count_annotations(0, 'object', 'image', 'phototag');
+?>
+<br />
+<h3>Overview</h3>
+<p>
+An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
+There are three image library options with Tidypics: PHP extension <a href="http://www.php.net/manual/en/book.image.php">GD</a>,
+<a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension
+<a href="http://pecl.php.net/package/imagick/">imagick</a>. GD is the most common of the three on hosted servers but suffers
+from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
+PHP extension), we recommend that you use that.
+</p>
+<h3>Testing ImageMagick Commandline</h3>
+<p>
+To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
+<a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; ?>">server analysis page</a> to find out the
+configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
+be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
+ImageMagick installed on your server.
+</p>
+<br />
+<p>
+<?php echo elgg_echo('tidypics:settings:im_path'); ?><br />
+<input name="im_location" type="text" />
+<input type="submit" value="Submit" onclick="TestImageMagickLocation();" />
+</p>
+<div id="im_results"></div>
+
+<script type="text/javascript">
+function TestImageMagickLocation()
+{
+ var loc = $('input[name=im_location]').val();
+ $("#im_results").html("");
+ $.ajax({
+ type: "GET",
+ url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/imtest.php'; ?>",
+ data: {location: loc},
+ cache: false,
+ success: function(html){
+ $("#im_results").html(html);
+ }
+ });
+}
</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php
index 1b449cfc7..ff7d330e2 100644
--- a/views/default/tidypics/admin/settings.php
+++ b/views/default/tidypics/admin/settings.php
@@ -1,25 +1,25 @@
-<?php
-
- echo elgg_view('output/longtext', array('value' => elgg_echo("tidypics:admin:instructions")));
-
- global $CONFIG;
- $system_url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php';
- $upgrade_url = $CONFIG->wwwroot . 'mod/tidypics/actions/upgrade.php';
-
- $upgrade = false;
- if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album'))
- $upgrade = true;
-?>
-<p>
-<?php
- if ($upgrade) {
-?>
-<a href="<?php echo $upgrade_url; ?>">Upgrade</a><br />
-<?php
- }
-?>
-<a href="<?php echo $system_url; ?>">Run Server Analysis</a>
-</p>
-<?php
- echo elgg_view("tidypics/forms/settings");
+<?php
+
+ echo elgg_view('output/longtext', array('value' => elgg_echo("tidypics:admin:instructions")));
+
+ global $CONFIG;
+ $system_url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php';
+ $upgrade_url = $CONFIG->wwwroot . 'mod/tidypics/actions/upgrade.php';
+
+ $upgrade = false;
+ if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album'))
+ $upgrade = true;
+?>
+<p>
+<?php
+ if ($upgrade) {
+?>
+<a href="<?php echo $upgrade_url; ?>">Upgrade</a><br />
+<?php
+ }
+?>
+<a href="<?php echo $system_url; ?>">Run Server Analysis</a>
+</p>
+<?php
+ echo elgg_view("tidypics/forms/settings");
?> \ No newline at end of file
diff --git a/views/default/tidypics/admin/stats.php b/views/default/tidypics/admin/stats.php
index 8de3415a1..aea5e75ba 100644
--- a/views/default/tidypics/admin/stats.php
+++ b/views/default/tidypics/admin/stats.php
@@ -1,35 +1,35 @@
-<?php
-
- $img_type = get_subtype_id('object', 'image');
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
- $total = get_data_row($query);
- $num_images = $total->total;
-
- $img_type = get_subtype_id('object', 'album');
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
- $total = get_data_row($query);
- $num_albums = $total->total;
-
- $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
- $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
-
- $num_views = count_annotations(0, 'object', 'image', 'tp_view');
-
- if (get_plugin_setting('tagging', 'tidypics') != "disabled")
- $num_tags = count_annotations(0, 'object', 'image', 'phototag');
-?>
-<p>
-<br />
-Photos: <?php echo $num_images; ?><br />
-Albums: <?php echo $num_albums; ?><br />
-Comments on photos: <?php echo $num_comments_photos; ?><br />
-Comments on albums: <?php echo $num_comments_albums; ?><br />
-Total views: <?php echo $num_views; ?><br />
-<?php
- if ($num_tags) {
-?>
-Photo tags: <?php echo $num_tags; ?><br />
-<?php
- }
-?>
+<?php
+
+ $img_type = get_subtype_id('object', 'image');
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_images = $total->total;
+
+ $img_type = get_subtype_id('object', 'album');
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_albums = $total->total;
+
+ $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
+ $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
+
+ $num_views = count_annotations(0, 'object', 'image', 'tp_view');
+
+ if (get_plugin_setting('tagging', 'tidypics') != "disabled")
+ $num_tags = count_annotations(0, 'object', 'image', 'phototag');
+?>
+<p>
+<br />
+Photos: <?php echo $num_images; ?><br />
+Albums: <?php echo $num_albums; ?><br />
+Comments on photos: <?php echo $num_comments_photos; ?><br />
+Comments on albums: <?php echo $num_comments_albums; ?><br />
+Total views: <?php echo $num_views; ?><br />
+<?php
+ if ($num_tags) {
+?>
+Photo tags: <?php echo $num_tags; ?><br />
+<?php
+ }
+?>
</p> \ No newline at end of file
diff --git a/views/default/tidypics/admin/thumbnails.php b/views/default/tidypics/admin/thumbnails.php
index 0af59090e..ccd884005 100644
--- a/views/default/tidypics/admin/thumbnails.php
+++ b/views/default/tidypics/admin/thumbnails.php
@@ -1,33 +1,33 @@
-<br />
-<h3>Overview</h3>
-<p>
-This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
-You may experience problems with thumbnail creation if your image library in not configured properly or
-if there is not enough memory for the GD library to load and resize an image. If your users have
-experienced problems with thumbnail creation and you have modified your setup, you can try to redo the
-thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
-a photo) and enter it below.
-</p>
-<h3>Thumbnail Creation</h3>
-<p>
-<b><?php echo elgg_echo('tidypics:settings:im_id'); ?></b>:
-<input name="image_id" type="text" />
-<input type="submit" value="Submit" onclick="TestThumbnailCreation();" />
-</p>
-<div id="im_results"></div>
-<script type="text/javascript">
-function TestThumbnailCreation()
-{
- var image_id = $('input[name=image_id]').val();
- $("#im_results").html("");
- $.ajax({
- type: "GET",
- url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/create_thumbnails.php'; ?>",
- data: {guid: image_id},
- cache: false,
- success: function(html){
- $("#im_results").html(html);
- }
- });
-}
+<br />
+<h3>Overview</h3>
+<p>
+This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
+You may experience problems with thumbnail creation if your image library in not configured properly or
+if there is not enough memory for the GD library to load and resize an image. If your users have
+experienced problems with thumbnail creation and you have modified your setup, you can try to redo the
+thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
+a photo) and enter it below.
+</p>
+<h3>Thumbnail Creation</h3>
+<p>
+<b><?php echo elgg_echo('tidypics:settings:im_id'); ?></b>:
+<input name="image_id" type="text" />
+<input type="submit" value="Submit" onclick="TestThumbnailCreation();" />
+</p>
+<div id="im_results"></div>
+<script type="text/javascript">
+function TestThumbnailCreation()
+{
+ var image_id = $('input[name=image_id]').val();
+ $("#im_results").html("");
+ $.ajax({
+ type: "GET",
+ url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/create_thumbnails.php'; ?>",
+ data: {guid: image_id},
+ cache: false,
+ success: function(html){
+ $("#im_results").html(html);
+ }
+ });
+}
</script> \ No newline at end of file
diff --git a/views/default/tidypics/albums.php b/views/default/tidypics/albums.php
index 9c75bf024..42ac15afe 100644
--- a/views/default/tidypics/albums.php
+++ b/views/default/tidypics/albums.php
@@ -1,51 +1,51 @@
-<?php
-
- //the number of albums to display
- $number = (int)$vars['num_albums'];
- if (!$number)
- $number = 5;
-
- $owner = page_owner_entity();
- $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
-
- echo '<div id="tidypics_album_widget_container">';
-
- if ($owner_albums) {
- foreach($owner_albums as $album) {
-
- if($album->cover)
- $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" class="tidypics_album_cover" alt="' . $album->title . '"/>';
- else
- $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="' . $album->title . '">';
-?>
- <div class="tidypics_album_widget_single_item">
- <div class="tidypics_album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
- <div class="tidypics_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 foreach loop
-
- // bottom link to all group/user albums
- if (is_null($owner->username) || empty($owner->username)) {
- echo '<p class="profile_info_edit_buttons"><a href="' . $vars['url'] . 'pg/photos/world">' . elgg_echo('album:all') . '</a></p>';
- } else {
- echo '<p class="tidypics_download"><a href="' . $vars['url'] . 'pg/photos/owned/' . $owner->username . '">' . elgg_echo('album:more') . '</a></p>';
- }
-
- }
-
- if (can_write_to_container(0, $owner->guid)) {
- echo '<p class="tidypics_download"><a href=' . $CONFIG->wwwroot .'pg/photos/new/' . $owner->username . '>' . elgg_echo("album:create") . '</a></p>';
- }
-
-
- //close album_widget_container div
- echo "</div>";
+<?php
+
+ //the number of albums to display
+ $number = (int)$vars['num_albums'];
+ if (!$number)
+ $number = 5;
+
+ $owner = page_owner_entity();
+ $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
+
+ echo '<div id="tidypics_album_widget_container">';
+
+ if ($owner_albums) {
+ foreach($owner_albums as $album) {
+
+ if($album->cover)
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" class="tidypics_album_cover" alt="' . $album->title . '"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="' . $album->title . '">';
+?>
+ <div class="tidypics_album_widget_single_item">
+ <div class="tidypics_album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
+ <div class="tidypics_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 foreach loop
+
+ // bottom link to all group/user albums
+ if (is_null($owner->username) || empty($owner->username)) {
+ echo '<p class="profile_info_edit_buttons"><a href="' . $vars['url'] . 'pg/photos/world">' . elgg_echo('album:all') . '</a></p>';
+ } else {
+ echo '<p class="tidypics_download"><a href="' . $vars['url'] . 'pg/photos/owned/' . $owner->username . '">' . elgg_echo('album:more') . '</a></p>';
+ }
+
+ }
+
+ if (can_write_to_container(0, $owner->guid)) {
+ echo '<p class="tidypics_download"><a href=' . $CONFIG->wwwroot .'pg/photos/new/' . $owner->username . '>' . elgg_echo("album:create") . '</a></p>';
+ }
+
+
+ //close album_widget_container div
+ echo "</div>";
?> \ No newline at end of file
diff --git a/views/default/tidypics/breadcrumbs.php b/views/default/tidypics/breadcrumbs.php
index 1a96e921c..c4d347e6e 100644
--- a/views/default/tidypics/breadcrumbs.php
+++ b/views/default/tidypics/breadcrumbs.php
@@ -1,22 +1,22 @@
-<?php
- $file_guid = $vars['file_guid'];
- $page_owner = page_owner_entity();
-
- $first_level_text = '';
- $first_level_link = $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username;
- if (get_loggedin_userid() == $page_owner->guid)
- $first_level_text = elgg_echo('album:yours');
- else
- $first_level_text = sprintf(elgg_echo('album:user'), $page_owner->name);
-?>
-<a href="<?php echo $first_level_link; ?>"><?php echo $first_level_text; ?></a>
-<?php
- $second_level_text = '';
- if (isset($vars['album'])) {
- $second_level_text = $vars['album']->title;
- $second_level_link = $vars['album']->getURL();
-?>
->> <a href="<?php echo $second_level_link; ?>"><?php echo $second_level_text; ?></a>
-<?php
- }
-?>
+<?php
+ $file_guid = $vars['file_guid'];
+ $page_owner = page_owner_entity();
+
+ $first_level_text = '';
+ $first_level_link = $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username;
+ if (get_loggedin_userid() == $page_owner->guid)
+ $first_level_text = elgg_echo('album:yours');
+ else
+ $first_level_text = sprintf(elgg_echo('album:user'), $page_owner->name);
+?>
+<a href="<?php echo $first_level_link; ?>"><?php echo $first_level_text; ?></a>
+<?php
+ $second_level_text = '';
+ if (isset($vars['album'])) {
+ $second_level_text = $vars['album']->title;
+ $second_level_link = $vars['album']->getURL();
+?>
+>> <a href="<?php echo $second_level_link; ?>"><?php echo $second_level_text; ?></a>
+<?php
+ }
+?>
diff --git a/views/default/tidypics/exif.php b/views/default/tidypics/exif.php
index 525665754..0100ac575 100644
--- a/views/default/tidypics/exif.php
+++ b/views/default/tidypics/exif.php
@@ -1,14 +1,14 @@
-<?php
-
- $guid = $vars['guid'];
-
- $exif = tp_exif_formatted($guid);
- if ($exif) {
- echo '<div id="tidypics_exif">';
- foreach ($exif as $name => $value) {
- echo $name . ': ' . $value . '<br />';
- }
- echo '</div>';
- }
-
+<?php
+
+ $guid = $vars['guid'];
+
+ $exif = tp_exif_formatted($guid);
+ if ($exif) {
+ echo '<div id="tidypics_exif">';
+ foreach ($exif as $name => $value) {
+ echo $name . ': ' . $value . '<br />';
+ }
+ echo '</div>';
+ }
+
?> \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php
index cec1945f0..342ac8822 100644
--- a/views/default/tidypics/forms/edit.php
+++ b/views/default/tidypics/forms/edit.php
@@ -1,118 +1,118 @@
-<?php
- /**
- * Tidypics images edit/add form
- * 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'])) {
- $action = "tidypics/edit";
- $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 {
- $action = "tidypics/addalbum";
- $tags = "";
- $title = "";
- $body = "";
- if (defined('ACCESS_DEFAULT'))
- $access_id = ACCESS_DEFAULT;
- else
- $access_id = 1; // logged_in by default
- $subtype = 'album';
-
- $title = $_SESSION['tidypicstitle'];
- $body = $_SESSION['tidypicsbody'];
- $tags = $_SESSION['tidypicstags'];
-
- unset($_SESSION['tidypicstitle']);
- unset($_SESSION['tidypicsbody']);
- unset($_SESSION['tidypicstags']);
- }
-
- // group or individual
- $container_guid = page_owner();
-
-?>
-<div class="contentWrapper">
- <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" => "tidypicstitle", "value" => $title,)); ?>
- </p>
-<?php
- if ($subtype == 'album') {
-?>
- <p>
- <label><?php echo elgg_echo('album:desc'); ?></label>
- <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,)); ?>
- </p>
-<?php
- } else {
-?>
- <p>
- <label><?php echo elgg_echo('caption'); ?></label>
- <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?>
- </p>
-<?php
- }
-?>
- <p>
- <label><?php echo elgg_echo("tags"); ?></label>
- <?php echo elgg_view("input/tags", array( "internalname" => "tidypicstags","value" => $tags,)); ?>
- </p>
-
-<?php
- if ($subtype == 'image') {
- $container_guid = $vars['entity']->container_guid;
-
- // should this image be the cover for the album - only ask for non-cover photos
- // determine if it is already the cover
- $img_guid = $vars['entity']->guid;
- $album = get_entity($container_guid);
- $cover_guid = $album->cover;
-
- if ($cover_guid != $img_guid) {
-
-?>
- <p>
-<?php echo elgg_view('input/checkboxes', array('internalname' => "cover",
- 'options' => array(elgg_echo("album:cover")),
- ));
-?>
- </p>
-<?php
- }
-
- } else {
- // album so display access control
-?>
- <p>
- <label><?php echo elgg_echo('access'); ?></label>
- <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
- </p>
-
-<?php
- }
-
- if (isset($vars['entity'])) {
-?>
- <input type="hidden" name="guid" value="<?php echo $vars['entity']->getGUID(); ?>" />
-<?php
- }
-
- echo elgg_view('input/securitytoken');
-?>
- <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
- <input type="hidden" name="subtype" value="<?php echo $subtype; ?>" />
- <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
- </form>
+<?php
+ /**
+ * Tidypics images edit/add form
+ * 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'])) {
+ $action = "tidypics/edit";
+ $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 {
+ $action = "tidypics/addalbum";
+ $tags = "";
+ $title = "";
+ $body = "";
+ if (defined('ACCESS_DEFAULT'))
+ $access_id = ACCESS_DEFAULT;
+ else
+ $access_id = 1; // logged_in by default
+ $subtype = 'album';
+
+ $title = $_SESSION['tidypicstitle'];
+ $body = $_SESSION['tidypicsbody'];
+ $tags = $_SESSION['tidypicstags'];
+
+ unset($_SESSION['tidypicstitle']);
+ unset($_SESSION['tidypicsbody']);
+ unset($_SESSION['tidypicstags']);
+ }
+
+ // group or individual
+ $container_guid = page_owner();
+
+?>
+<div class="contentWrapper">
+ <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" => "tidypicstitle", "value" => $title,)); ?>
+ </p>
+<?php
+ if ($subtype == 'album') {
+?>
+ <p>
+ <label><?php echo elgg_echo('album:desc'); ?></label>
+ <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,)); ?>
+ </p>
+<?php
+ } else {
+?>
+ <p>
+ <label><?php echo elgg_echo('caption'); ?></label>
+ <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?>
+ </p>
+<?php
+ }
+?>
+ <p>
+ <label><?php echo elgg_echo("tags"); ?></label>
+ <?php echo elgg_view("input/tags", array( "internalname" => "tidypicstags","value" => $tags,)); ?>
+ </p>
+
+<?php
+ if ($subtype == 'image') {
+ $container_guid = $vars['entity']->container_guid;
+
+ // should this image be the cover for the album - only ask for non-cover photos
+ // determine if it is already the cover
+ $img_guid = $vars['entity']->guid;
+ $album = get_entity($container_guid);
+ $cover_guid = $album->cover;
+
+ if ($cover_guid != $img_guid) {
+
+?>
+ <p>
+<?php echo elgg_view('input/checkboxes', array('internalname' => "cover",
+ 'options' => array(elgg_echo("album:cover")),
+ ));
+?>
+ </p>
+<?php
+ }
+
+ } else {
+ // album so display access control
+?>
+ <p>
+ <label><?php echo elgg_echo('access'); ?></label>
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </p>
+
+<?php
+ }
+
+ if (isset($vars['entity'])) {
+?>
+ <input type="hidden" name="guid" value="<?php echo $vars['entity']->getGUID(); ?>" />
+<?php
+ }
+
+ echo elgg_view('input/securitytoken');
+?>
+ <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+ <input type="hidden" name="subtype" value="<?php echo $subtype; ?>" />
+ <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
+ </form>
</div> \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
index 4c4a111f5..4031b7968 100644
--- a/views/default/tidypics/forms/edit_multi.php
+++ b/views/default/tidypics/forms/edit_multi.php
@@ -1,58 +1,58 @@
-<?php
- /**
- * form for mass editing all uploaded images
- */
-?>
-<div class="contentWrapper">
-<form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post">
-<?php
-
- $file_array = $vars['file_array'];
-
- // make sure one of the images becomes the cover if there isn't one already
- $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;
- $title = $entity->title;
- $tags = $entity->tags;
- $container_guid = $entity->container_guid;
-
- // first one is default cover if there isn't one already
- if ($no_cover) {
- $val = $guid;
- $no_cover = false;
- }
-
- echo '<div class="tidypics_edit_image_container">';
- echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" class="tidypics_edit_images" alt="' . $title . '"/>';
- echo '<div class="tidypics_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/longtext",array("internalname" => "caption[$key]", "value" => $body, "class" => 'tidypics_caption_input',)) . "\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 elgg_view('input/securitytoken');
-
- echo elgg_view("input/radio", array("internalname" => "cover",
- "value" => $val,
- 'options' => array( elgg_echo('album:cover') => $guid,
- ),
- ));
- echo '</div>';
- echo '</div>';
- }
-
-?>
-<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>
+<?php
+ /**
+ * form for mass editing all uploaded images
+ */
+?>
+<div class="contentWrapper">
+<form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post">
+<?php
+
+ $file_array = $vars['file_array'];
+
+ // make sure one of the images becomes the cover if there isn't one already
+ $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;
+ $title = $entity->title;
+ $tags = $entity->tags;
+ $container_guid = $entity->container_guid;
+
+ // first one is default cover if there isn't one already
+ if ($no_cover) {
+ $val = $guid;
+ $no_cover = false;
+ }
+
+ echo '<div class="tidypics_edit_image_container">';
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" class="tidypics_edit_images" alt="' . $title . '"/>';
+ echo '<div class="tidypics_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/longtext",array("internalname" => "caption[$key]", "value" => $body, "class" => 'tidypics_caption_input',)) . "\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 elgg_view('input/securitytoken');
+
+ echo elgg_view("input/radio", array("internalname" => "cover",
+ "value" => $val,
+ 'options' => array( elgg_echo('album:cover') => $guid,
+ ),
+ ));
+ echo '</div>';
+ echo '</div>';
+ }
+
+?>
+<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>
</div> \ No newline at end of file
diff --git a/views/default/tidypics/forms/settings.php b/views/default/tidypics/forms/settings.php
index 6ab9dfcc9..6cfed661f 100644
--- a/views/default/tidypics/forms/settings.php
+++ b/views/default/tidypics/forms/settings.php
@@ -1,145 +1,145 @@
-<?php
- /**
- * Tidypics admin settings form
- */
-
-
-
- $action = $vars['url'] . 'action/tidypics/settings';
-
- $plugin = find_plugin_settings('tidypics');
-
-
- // bootstrap the plugin version here for now
- if (!$plugin->version) {
- set_plugin_setting('version', 1.62, 'tidypics');
- }
-
- if (extension_loaded('imagick'))
- $img_lib_options['ImageMagickPHP'] = 'imagick PHP extension';
-
- $disablefunc = explode(',', ini_get('disable_functions'));
- if (is_callable('exec') && !in_array('exec',$disablefunc))
- $img_lib_options['ImageMagick'] = 'ImageMagick Cmdline';
-
- $img_lib_options['GD'] = 'GD';
-
-
- // Image Library
- $image_lib = $plugin->image_lib;
- if (!$image_lib) $image_lib = 'GD';
- $form_body = '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
- ));
- $form_body .= '<br/>Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.</p>';
-
- if (is_callable('exec') && !in_array('exec',$disablefunc)) {
- // Image Magick Path
- $im_path = $plugin->im_path;
- if(!$im_path) $im_path = "/usr/bin/";
- $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";
- }
-
- // Tagging
- $tagging = $plugin->tagging;
- if(!$tagging) $tagging = "enabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "</p>";
-
- // Download Link
- $download_link = $plugin->download_link;
- if(!$download_link) $download_link = "enabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . "</p>";
-
- // Ratings
- $photo_ratings = $plugin->photo_ratings;
- if(!$photo_ratings) $photo_ratings = "disabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . "</p>";
-
- // Show EXIF
- $exif = $plugin->exif;
- if(!$exif) $exif = "disabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "</p>";
-
- // Show View count
- $view_count = $plugin->view_count;
- if(!$view_count) $view_count = "enabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "</p>";
-
- // Watermark Text
- $form_body .= "<p>" . elgg_echo('tidypics:settings:watermark') . "<br />";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "</p>";
-
- // Max Image Size
- $maxfilesize = $plugin->maxfilesize;
- if (!$maxfilesize) $maxfilesize = (int)5; // 5 MB
- $form_body .= "<p>" . elgg_echo('tidypics:settings:maxfilesize') . "<br />";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "</p>";
-
- // Quota Size
- $quota = $plugin->quota;
- if (!$quota) $quota = 0;
- $form_body .= "<p>" . elgg_echo('tidypics:settings:quota') . "<br />";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "</p>";
-
- // River Image options
- $img_river_view = $plugin->img_river_view;
- if (!$img_river_view) $img_river_view = '1';
- $form_body .= '<p>' . elgg_echo('tidypics:settings:img_river_view');
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[img_river_view]',
- 'options_values' => array(
- 'all' => 'all',
- '1' => '1',
- 'none' => 'none',
- ),
- 'value' => $img_river_view
- ));
- $form_body .= '</p>';
-
- // River Album options
- $album_river_view = $plugin->album_river_view;
- if (!$album_river_view) $album_river_view = 'set';
- $form_body .= '<p>' . elgg_echo('tidypics:settings:album_river_view');
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[album_river_view]',
- 'options_values' => array(
- 'cover' => 'cover',
- 'set' => 'set',
- ),
- 'value' => $album_river_view
- ));
- $form_body .= '</p>';
-
- // Thumbnail sizes
- $image_sizes = $plugin->image_sizes;
- if(!$image_sizes) {
- $image_sizes = array(); // set default values
- $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
- $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
- $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
- } else {
- $image_sizes = unserialize($image_sizes);
- }
- $form_body .= "<p>" . elgg_echo('tidypics:settings:largesize') . "<br />";
- $form_body .= 'width: <input style="width: 20%;" type="text" name="large_thumb_width" value=' . "\"{$image_sizes['large_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
- $form_body .= 'height: <input style="width: 20%;" type="text" name="large_thumb_height" value=' . "\"{$image_sizes['large_image_height']}\"" . ' class="input-text" /></p>';
- $form_body .= "<p>" . elgg_echo('tidypics:settings:smallsize') . "<br />";
- $form_body .= 'width: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
- $form_body .= 'height: <input style="width: 20%;" type="text" name="small_thumb_height" value=' . "\"{$image_sizes['small_image_height']}\"" . ' class="input-text" /></p>';
- $form_body .= "<p>" . elgg_echo('tidypics:settings:thumbsize') . "<br />";
- $form_body .= 'width: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
- $form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
-
-
- // Group permission override
- $grp_perm_override = $plugin->grp_perm_override;
- if(!$grp_perm_override) $grp_perm_override = "enabled";
- $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "</p>";
-
- $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
-
+<?php
+ /**
+ * Tidypics admin settings form
+ */
+
+
+
+ $action = $vars['url'] . 'action/tidypics/settings';
+
+ $plugin = find_plugin_settings('tidypics');
+
+
+ // bootstrap the plugin version here for now
+ if (!$plugin->version) {
+ set_plugin_setting('version', 1.62, 'tidypics');
+ }
+
+ if (extension_loaded('imagick'))
+ $img_lib_options['ImageMagickPHP'] = 'imagick PHP extension';
+
+ $disablefunc = explode(',', ini_get('disable_functions'));
+ if (is_callable('exec') && !in_array('exec',$disablefunc))
+ $img_lib_options['ImageMagick'] = 'ImageMagick Cmdline';
+
+ $img_lib_options['GD'] = 'GD';
+
+
+ // Image Library
+ $image_lib = $plugin->image_lib;
+ if (!$image_lib) $image_lib = 'GD';
+ $form_body = '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[image_lib]',
+ 'options_values' => $img_lib_options,
+ 'value' => $image_lib
+ ));
+ $form_body .= '<br/>Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.</p>';
+
+ if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ // Image Magick Path
+ $im_path = $plugin->im_path;
+ if(!$im_path) $im_path = "/usr/bin/";
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";
+ }
+
+ // Tagging
+ $tagging = $plugin->tagging;
+ if(!$tagging) $tagging = "enabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "</p>";
+
+ // Download Link
+ $download_link = $plugin->download_link;
+ if(!$download_link) $download_link = "enabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . "</p>";
+
+ // Ratings
+ $photo_ratings = $plugin->photo_ratings;
+ if(!$photo_ratings) $photo_ratings = "disabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . "</p>";
+
+ // Show EXIF
+ $exif = $plugin->exif;
+ if(!$exif) $exif = "disabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "</p>";
+
+ // Show View count
+ $view_count = $plugin->view_count;
+ if(!$view_count) $view_count = "enabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "</p>";
+
+ // Watermark Text
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:watermark') . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "</p>";
+
+ // Max Image Size
+ $maxfilesize = $plugin->maxfilesize;
+ if (!$maxfilesize) $maxfilesize = (int)5; // 5 MB
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:maxfilesize') . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "</p>";
+
+ // Quota Size
+ $quota = $plugin->quota;
+ if (!$quota) $quota = 0;
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:quota') . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "</p>";
+
+ // River Image options
+ $img_river_view = $plugin->img_river_view;
+ if (!$img_river_view) $img_river_view = '1';
+ $form_body .= '<p>' . elgg_echo('tidypics:settings:img_river_view');
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[img_river_view]',
+ 'options_values' => array(
+ 'all' => 'all',
+ '1' => '1',
+ 'none' => 'none',
+ ),
+ 'value' => $img_river_view
+ ));
+ $form_body .= '</p>';
+
+ // River Album options
+ $album_river_view = $plugin->album_river_view;
+ if (!$album_river_view) $album_river_view = 'set';
+ $form_body .= '<p>' . elgg_echo('tidypics:settings:album_river_view');
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[album_river_view]',
+ 'options_values' => array(
+ 'cover' => 'cover',
+ 'set' => 'set',
+ ),
+ 'value' => $album_river_view
+ ));
+ $form_body .= '</p>';
+
+ // Thumbnail sizes
+ $image_sizes = $plugin->image_sizes;
+ if(!$image_sizes) {
+ $image_sizes = array(); // set default values
+ $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
+ $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
+ $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
+ } else {
+ $image_sizes = unserialize($image_sizes);
+ }
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:largesize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="large_thumb_width" value=' . "\"{$image_sizes['large_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="large_thumb_height" value=' . "\"{$image_sizes['large_image_height']}\"" . ' class="input-text" /></p>';
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:smallsize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="small_thumb_height" value=' . "\"{$image_sizes['small_image_height']}\"" . ' class="input-text" /></p>';
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:thumbsize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
+
+
+ // Group permission override
+ $grp_perm_override = $plugin->grp_perm_override;
+ if(!$grp_perm_override) $grp_perm_override = "enabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "</p>";
+
+ $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
+
echo elgg_view('input/form', array('action' => $action, 'body' => $form_body));
diff --git a/views/default/tidypics/gallery.php b/views/default/tidypics/gallery.php
index 29c706bb1..dd7c1cdcf 100644
--- a/views/default/tidypics/gallery.php
+++ b/views/default/tidypics/gallery.php
@@ -1,64 +1,64 @@
-<?php
-/**
- * view a gallery of photos or albums
- *
- */
-
-$context = $vars['context'];
-$offset = $vars['offset'];
-$entities = $vars['entities'];
-$limit = $vars['limit'];
-$count = $vars['count'];
-$baseurl = $vars['baseurl'];
-$context = $vars['context'];
-$viewtype = $vars['viewtype'];
-$pagination = $vars['pagination'];
-$fullview = $vars['fullview'];
-
-$html = "";
-$nav = "";
-
-if (isset($vars['viewtypetoggle'])) {
- $viewtypetoggle = $vars['viewtypetoggle'];
-} else {
- $viewtypetoggle = true;
-}
-
-if ($context == "search" && $count > 0 && $viewtypetoggle) {
- $nav .= elgg_view('navigation/viewtype', array(
- 'baseurl' => $baseurl,
- 'offset' => $offset,
- 'count' => $count,
- 'viewtype' => $viewtype,
- ));
-}
-
-if ($pagination) {
- $nav .= elgg_view('navigation/pagination',array(
- 'baseurl' => $baseurl,
- 'offset' => $offset,
- 'count' => $count,
- 'limit' => $limit,
- ));
-}
-
-$html .= $nav;
-if ($viewtype == 'list') {
- if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- $html .= elgg_view_entity($entity, $fullview);
- }
- }
-} else {
- if (is_array($entities) && sizeof($entities) > 0) {
- $html .= elgg_view('entities/gallery', array('entities' => $entities));
- }
-}
-
-$html .= '<div class="clearfloat"></div>';
-
-if ($count) {
- $html .= $nav;
-}
-
+<?php
+/**
+ * view a gallery of photos or albums
+ *
+ */
+
+$context = $vars['context'];
+$offset = $vars['offset'];
+$entities = $vars['entities'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+$baseurl = $vars['baseurl'];
+$context = $vars['context'];
+$viewtype = $vars['viewtype'];
+$pagination = $vars['pagination'];
+$fullview = $vars['fullview'];
+
+$html = "";
+$nav = "";
+
+if (isset($vars['viewtypetoggle'])) {
+ $viewtypetoggle = $vars['viewtypetoggle'];
+} else {
+ $viewtypetoggle = true;
+}
+
+if ($context == "search" && $count > 0 && $viewtypetoggle) {
+ $nav .= elgg_view('navigation/viewtype', array(
+ 'baseurl' => $baseurl,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'viewtype' => $viewtype,
+ ));
+}
+
+if ($pagination) {
+ $nav .= elgg_view('navigation/pagination',array(
+ 'baseurl' => $baseurl,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+ ));
+}
+
+$html .= $nav;
+if ($viewtype == 'list') {
+ if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ $html .= elgg_view_entity($entity, $fullview);
+ }
+ }
+} else {
+ if (is_array($entities) && sizeof($entities) > 0) {
+ $html .= elgg_view('entities/gallery', array('entities' => $entities));
+ }
+}
+
+$html .= '<div class="clearfloat"></div>';
+
+if ($count) {
+ $html .= $nav;
+}
+
echo $html; \ No newline at end of file
diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php
index 7f28705c7..a7e143ae9 100644
--- a/views/default/tidypics/groupprofile_albums.php
+++ b/views/default/tidypics/groupprofile_albums.php
@@ -1,15 +1,15 @@
-<?php
-
-/***********************************************
- *
- * This is used on the group profile page
- *
- ***********************************************/
-
-if ($vars['entity']->photos_enable != 'no') {
- echo '<div id="tidypics_group_profile">';
- echo '<h2>' . elgg_echo('album:group') . '</h2>';
- echo elgg_view('tidypics/albums', array('num_albums' => 5));
- echo '</div>';
-}
+<?php
+
+/***********************************************
+ *
+ * This is used on the group profile page
+ *
+ ***********************************************/
+
+if ($vars['entity']->photos_enable != 'no') {
+ echo '<div id="tidypics_group_profile">';
+ echo '<h2>' . elgg_echo('album:group') . '</h2>';
+ echo elgg_view('tidypics/albums', array('num_albums' => 5));
+ echo '</div>';
+}
?> \ No newline at end of file
diff --git a/views/default/tidypics/hover_menu.php b/views/default/tidypics/hover_menu.php
index a36c4be17..240891f51 100644
--- a/views/default/tidypics/hover_menu.php
+++ b/views/default/tidypics/hover_menu.php
@@ -1,12 +1,12 @@
-<?php
-
- /**
- * Elgg hoverover extender for tidypics
- *
- */
-
-?>
-
- <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>
+<?php
+
+ /**
+ * Elgg hoverover extender for tidypics
+ *
+ */
+
+?>
+
+ <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/tidypics/image_menu.php b/views/default/tidypics/image_menu.php
index 9e7a53969..983f900b4 100644
--- a/views/default/tidypics/image_menu.php
+++ b/views/default/tidypics/image_menu.php
@@ -1,51 +1,51 @@
-<?php
-
- /**************************************************************************
- *
- * Tidypics Image Menu
- *
- * This is the menu that appears below an image. Admins can override the
- * menu with a different view to provide a look and feel that matches
- * their themes. The view can be extended to provide additional controls.
- *
- **************************************************************************/
-
- $image_guid = $vars['image_guid'];
- $viewer = $vars['viewer'];
- $owner = $vars['owner'];
- $anytags = $vars['anytags'];
- $album = $vars['album'];
-
- if (get_plugin_setting('tagging', 'tidypics') != "disabled") {
-
- $can_tag = false;
-
- $container = get_entity($album->container_guid);
- if ($container instanceof ElggGroup) {
- $can_tag = $viewer && $container->isMember($viewer);
- } else {
- $can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid);
- }
-
- // only owner and friends of owner can tag
- if ($can_tag) {
-?>
-<li id="start_tagging"><a id="tidypics_tag_control" href="javascript:void(0)" onclick="startTagging()"><?php echo elgg_echo('tidypics:tagthisphoto'); ?></a></li>
-<?php
- }
-
- // only owner can delete tags
- if ($anytags && $viewer && $viewer->guid == $owner->guid) {
-?>
-<li id="delete_tags"><a href="javascript:void(0)" onclick="deleteTags()"><?php elgg_echo('tidypics:deletetag'); ?></a></li>
-<?php
- }
- }
-
- if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
- $download_url = $vars['url'] . "pg/photos/download/{$image_guid}/";
-?>
-<li id="download_image"><a href="<?php echo $download_url; ?>"><?php echo elgg_echo("image:download"); ?></a></li>
-<?php
- }
+<?php
+
+ /**************************************************************************
+ *
+ * Tidypics Image Menu
+ *
+ * This is the menu that appears below an image. Admins can override the
+ * menu with a different view to provide a look and feel that matches
+ * their themes. The view can be extended to provide additional controls.
+ *
+ **************************************************************************/
+
+ $image_guid = $vars['image_guid'];
+ $viewer = $vars['viewer'];
+ $owner = $vars['owner'];
+ $anytags = $vars['anytags'];
+ $album = $vars['album'];
+
+ if (get_plugin_setting('tagging', 'tidypics') != "disabled") {
+
+ $can_tag = false;
+
+ $container = get_entity($album->container_guid);
+ if ($container instanceof ElggGroup) {
+ $can_tag = $viewer && $container->isMember($viewer);
+ } else {
+ $can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid);
+ }
+
+ // only owner and friends of owner can tag
+ if ($can_tag) {
+?>
+<li id="start_tagging"><a id="tidypics_tag_control" href="javascript:void(0)" onclick="startTagging()"><?php echo elgg_echo('tidypics:tagthisphoto'); ?></a></li>
+<?php
+ }
+
+ // only owner can delete tags
+ if ($anytags && $viewer && $viewer->guid == $owner->guid) {
+?>
+<li id="delete_tags"><a href="javascript:void(0)" onclick="deleteTags()"><?php elgg_echo('tidypics:deletetag'); ?></a></li>
+<?php
+ }
+ }
+
+ if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
+ $download_url = $vars['url'] . "pg/photos/download/{$image_guid}/";
+?>
+<li id="download_image"><a href="<?php echo $download_url; ?>"><?php echo elgg_echo("image:download"); ?></a></li>
+<?php
+ }
?> \ No newline at end of file
diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php
index 9ebec7c1e..ae3fa2b27 100644
--- a/views/default/tidypics/tagging.php
+++ b/views/default/tidypics/tagging.php
@@ -1,87 +1,87 @@
-<?php
-
- $image = $vars['image'];
- $viewer = $vars['viewer'];
- $owner = $vars['owner'];
-
- // get photo tags
- $tag_info = $image->getPhotoTags();
-
- // defining json text as "" makes sure the tagging javascript code doesn't throw errors if no tags
- $photo_tags_json = "\"\"";
- if ($tag_info) {
- $photo_tags_json = $tag_info['json'];
- }
-
- if ($tag_info) {
-?>
-<div id="tidypics_phototags_list">
- <h3><?php echo elgg_echo('tidypics:inthisphoto') ?></h3>
- <ul>
-<?php
- foreach ($tag_info['links'] as $id=>$link) {
- echo "<li><a class='tidypics_phototag_links' id='taglink{$id}' href='{$link['url']}'>{$link['text']}</a></li>";
- }
-?>
- </ul>
-</div>
-<?php
- }
-?>
-<div id='tidypics_tag_instructions'>
- <div id='tidypics_tag_instruct_text'><?php echo elgg_echo('tidypics:taginstruct'); ?></div>
- <div id='tidypics_tag_instruct_button_div'><button class='submit_button' id='tidypics_tag_instruct_button' onclick='stopTagging()'><?php echo elgg_echo('tidypics:finish_tagging'); ?></button></div>
-</div>
-<div id="tidypics_tag_menu" class="tidypics_popup">
- <div class='tidypics_popup_header'><h3><?php echo elgg_echo('tidypics:tagthisphoto'); ?></h3></div>
-<?php
-
- if ($viewer) {
-
- $people_list = tp_get_tag_list($viewer);
-
- $content = "<div id='tidypics_tagmenu_left'>";
- $content .= "<input type='hidden' name='image_guid' value='{$image->guid}' />";
- $content .= "<input type='hidden' name='coordinates' id='coordinates' value='' />";
- $content .= "<input type='hidden' name='user_id' id='user_id' value='' />";
- $content .= "<input type='hidden' name='word' id='word' value='' />";
-
- $content .= "<ul id='tidypics_phototag_list'>";
- $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$viewer->getGUID()},\"{$viewer->name}\")'> {$viewer->name} (" . elgg_echo('me') . ")</a></li>";
-
- if ($people_list) {
- foreach($people_list as $friend_guid => $friend_name) {
- $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$friend_guid}, \"{$friend_name}\")'>{$friend_name}</a></li>";
- }
- }
-
- $content .= "</ul></div>";
-
- $content .= "<div id='tidypics_tagmenu_right'><input type='submit' value='" . elgg_echo('tidypics:actiontag') . "' class='submit_button' /></div>";
-
- echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'tidypics_phototag_form', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'method' => 'post', 'body' => $content));
- }
-
-?>
-<div class="clearfloat"></div>
-</div>
-<div id="tidypics_delete_tag_menu" class="tidypics_popup">
-<div class='tidypics_popup_header'><h3><?php echo elgg_echo('tidypics:deltag_title'); ?></h3></div>
-<?php
- if ($tag_info) {
- $content = "<input type='hidden' name='image_guid' value='{$image->guid}' />";
- foreach ($tag_info['links'] as $id => $link) {
- $text = htmlentities($link['text'], ENT_QUOTES, 'UTF-8');
- $content .= "<label><input type=\"checkbox\" class=\"input-checkboxes\" name=\"tags[{$id}]\" value=\"{$text}\" />{$text}</label><br />";
- }
-
- $content .= "<input type='submit' value='" . elgg_echo('tidypics:actiondelete') . "' class='submit_button' />";
- $content .= "<input type='button' value='" . elgg_echo('cancel') . "' class='cancel_button' onclick='hideDeleteMenu();' />";
-
- echo elgg_view('input/form', array('internalname' => 'phototag_deletetag_form', 'action' => "{$vars['url']}action/tidypics/deletetag", 'method' => 'post', 'body' => $content));
-
- }
- echo '</div>'; // tidypics_delete_tag_menu
-
- echo elgg_view('js/tagging', array('photo_tags_json' => $photo_tags_json,) );
+<?php
+
+ $image = $vars['image'];
+ $viewer = $vars['viewer'];
+ $owner = $vars['owner'];
+
+ // get photo tags
+ $tag_info = $image->getPhotoTags();
+
+ // defining json text as "" makes sure the tagging javascript code doesn't throw errors if no tags
+ $photo_tags_json = "\"\"";
+ if ($tag_info) {
+ $photo_tags_json = $tag_info['json'];
+ }
+
+ if ($tag_info) {
+?>
+<div id="tidypics_phototags_list">
+ <h3><?php echo elgg_echo('tidypics:inthisphoto') ?></h3>
+ <ul>
+<?php
+ foreach ($tag_info['links'] as $id=>$link) {
+ echo "<li><a class='tidypics_phototag_links' id='taglink{$id}' href='{$link['url']}'>{$link['text']}</a></li>";
+ }
+?>
+ </ul>
+</div>
+<?php
+ }
+?>
+<div id='tidypics_tag_instructions'>
+ <div id='tidypics_tag_instruct_text'><?php echo elgg_echo('tidypics:taginstruct'); ?></div>
+ <div id='tidypics_tag_instruct_button_div'><button class='submit_button' id='tidypics_tag_instruct_button' onclick='stopTagging()'><?php echo elgg_echo('tidypics:finish_tagging'); ?></button></div>
+</div>
+<div id="tidypics_tag_menu" class="tidypics_popup">
+ <div class='tidypics_popup_header'><h3><?php echo elgg_echo('tidypics:tagthisphoto'); ?></h3></div>
+<?php
+
+ if ($viewer) {
+
+ $people_list = tp_get_tag_list($viewer);
+
+ $content = "<div id='tidypics_tagmenu_left'>";
+ $content .= "<input type='hidden' name='image_guid' value='{$image->guid}' />";
+ $content .= "<input type='hidden' name='coordinates' id='coordinates' value='' />";
+ $content .= "<input type='hidden' name='user_id' id='user_id' value='' />";
+ $content .= "<input type='hidden' name='word' id='word' value='' />";
+
+ $content .= "<ul id='tidypics_phototag_list'>";
+ $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$viewer->getGUID()},\"{$viewer->name}\")'> {$viewer->name} (" . elgg_echo('me') . ")</a></li>";
+
+ if ($people_list) {
+ foreach($people_list as $friend_guid => $friend_name) {
+ $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$friend_guid}, \"{$friend_name}\")'>{$friend_name}</a></li>";
+ }
+ }
+
+ $content .= "</ul></div>";
+
+ $content .= "<div id='tidypics_tagmenu_right'><input type='submit' value='" . elgg_echo('tidypics:actiontag') . "' class='submit_button' /></div>";
+
+ echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'tidypics_phototag_form', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'method' => 'post', 'body' => $content));
+ }
+
+?>
+<div class="clearfloat"></div>
+</div>
+<div id="tidypics_delete_tag_menu" class="tidypics_popup">
+<div class='tidypics_popup_header'><h3><?php echo elgg_echo('tidypics:deltag_title'); ?></h3></div>
+<?php
+ if ($tag_info) {
+ $content = "<input type='hidden' name='image_guid' value='{$image->guid}' />";
+ foreach ($tag_info['links'] as $id => $link) {
+ $text = htmlentities($link['text'], ENT_QUOTES, 'UTF-8');
+ $content .= "<label><input type=\"checkbox\" class=\"input-checkboxes\" name=\"tags[{$id}]\" value=\"{$text}\" />{$text}</label><br />";
+ }
+
+ $content .= "<input type='submit' value='" . elgg_echo('tidypics:actiondelete') . "' class='submit_button' />";
+ $content .= "<input type='button' value='" . elgg_echo('cancel') . "' class='cancel_button' onclick='hideDeleteMenu();' />";
+
+ echo elgg_view('input/form', array('internalname' => 'phototag_deletetag_form', 'action' => "{$vars['url']}action/tidypics/deletetag", 'method' => 'post', 'body' => $content));
+
+ }
+ echo '</div>'; // tidypics_delete_tag_menu
+
+ echo elgg_view('js/tagging', array('photo_tags_json' => $photo_tags_json,) );
?> \ No newline at end of file
diff --git a/views/default/widgets/album_view/edit.php b/views/default/widgets/album_view/edit.php
index 1fea6764a..992699cb0 100644
--- a/views/default/widgets/album_view/edit.php
+++ b/views/default/widgets/album_view/edit.php
@@ -1,24 +1,24 @@
-<p>
-<?php
-
- echo elgg_echo("tidypics:widget:num_albums") . ": ";
-
-
- 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>
+<?php
+
+ echo elgg_echo("tidypics:widget:num_albums") . ": ";
+
+
+ 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/latest_photos/edit.php b/views/default/widgets/latest_photos/edit.php
index 15a56af82..3b334d722 100644
--- a/views/default/widgets/latest_photos/edit.php
+++ b/views/default/widgets/latest_photos/edit.php
@@ -1,15 +1,15 @@
-<p>
-<?php
- echo elgg_echo("tidypics:widget:num_latest") . ": ";
-
- if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
-
-?>
- <select name="params[num_display]">
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="12" <?php if($vars['entity']->num_display == 12) echo "SELECTED"; ?>>12</option>
- <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
- <option value="18" <?php if($vars['entity']->num_display == 18) echo "SELECTED"; ?>>18</option>
- </select>
+<p>
+<?php
+ echo elgg_echo("tidypics:widget:num_latest") . ": ";
+
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
+
+?>
+ <select name="params[num_display]">
+ <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
+ <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
+ <option value="12" <?php if($vars['entity']->num_display == 12) echo "SELECTED"; ?>>12</option>
+ <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
+ <option value="18" <?php if($vars['entity']->num_display == 18) echo "SELECTED"; ?>>18</option>
+ </select>
</p> \ No newline at end of file
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index 990322baf..2ad4ed9f7 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -1,45 +1,45 @@
-<?php
- /**
- * Tidypics Album RSS View
- */
-
-// for now catch the albums view and ignore it
-if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
-
-} else {
-
- $album = $vars['entity'];
-
- // use fullsize image
- $base_url_fullsize = $vars['url'] . 'pg/photos/download/';
-
- // insert cover image if it exists image
- if ($album->cover) {
- // Set title
- $vars['title'] = $album->title;
- if (empty($vars['title'])) {
- $title = $vars['config']->sitename;
- } else if (empty($vars['config']->sitename)) {
- $title = $vars['title'];
- } else {
- $title = $vars['config']->sitename . ": " . $vars['title'];
- }
- $album_cover_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&amp;size=thumb';
-?> <image>
- <url><?php echo $album_cover_url; ?></url>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <link><?php echo $album->getURL() . '?view=rss'; ?></link>
- </image>
-<?php
- }
-
-
- $images = get_entities("object", "image", 0, "", 0, 0, false, 0, $album->guid);
-
-
- foreach ($images as $image) {
- echo elgg_view_entity($image);
- }
-
-}
+<?php
+ /**
+ * Tidypics Album RSS View
+ */
+
+// for now catch the albums view and ignore it
+if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
+
+} else {
+
+ $album = $vars['entity'];
+
+ // use fullsize image
+ $base_url_fullsize = $vars['url'] . 'pg/photos/download/';
+
+ // insert cover image if it exists image
+ if ($album->cover) {
+ // Set title
+ $vars['title'] = $album->title;
+ if (empty($vars['title'])) {
+ $title = $vars['config']->sitename;
+ } else if (empty($vars['config']->sitename)) {
+ $title = $vars['title'];
+ } else {
+ $title = $vars['config']->sitename . ": " . $vars['title'];
+ }
+ $album_cover_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&amp;size=thumb';
+?> <image>
+ <url><?php echo $album_cover_url; ?></url>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <link><?php echo $album->getURL() . '?view=rss'; ?></link>
+ </image>
+<?php
+ }
+
+
+ $images = get_entities("object", "image", 0, "", 0, 0, false, 0, $album->guid);
+
+
+ foreach ($images as $image) {
+ echo elgg_view_entity($image);
+ }
+
+}
?> \ No newline at end of file
diff --git a/views/rss/object/file.php b/views/rss/object/file.php
index e40da4f69..36740f003 100644
--- a/views/rss/object/file.php
+++ b/views/rss/object/file.php
@@ -1,23 +1,23 @@
-<?php
-
- /**
- * Tidypics RSS file object view - need to look into removing download link based on settings
- */
-
- $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']; ?>pg/photos/download/<?php echo $vars['entity']->getGUID(); ?>/" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- </item>
+<?php
+
+ /**
+ * Tidypics RSS file object view - need to look into removing download link based on settings
+ */
+
+ $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']; ?>pg/photos/download/<?php echo $vars['entity']->getGUID(); ?>/" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
+ </item>
diff --git a/views/rss/object/image.php b/views/rss/object/image.php
index dafc05f45..b93592081 100644
--- a/views/rss/object/image.php
+++ b/views/rss/object/image.php
@@ -1,19 +1,19 @@
-<?php
-
-$title = $vars['entity']->title;
-$descr = $vars['entity']->description;
-$download = $vars['url'] . 'pg/photos/download/' . $vars['entity']->guid . '/inline/';
-$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
-?>
-
- <item>
- <title><?php echo $title; ?></title>
- <link><?php echo $base_url . $vars['entity']->guid . '&amp;size=large'; ?></link>
- <description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
- <pubDate><?php echo date("r", $vars['entity']->time_created); ?></pubDate>
- <guid isPermaLink="true"><?php echo $vars['entity']->getURL(); ?></guid>
- <media:content url="<?php echo $download; ?>" medium="image" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- <media:title><?php echo $title; ?></media:title>
- <media:description><?php echo htmlentities($descr); ?></media:description>
- <media:thumbnail url="<?php echo $base_url . $vars['entity']->guid . '&amp;size=thumb'; ?>"></media:thumbnail>
+<?php
+
+$title = $vars['entity']->title;
+$descr = $vars['entity']->description;
+$download = $vars['url'] . 'pg/photos/download/' . $vars['entity']->guid . '/inline/';
+$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
+?>
+
+ <item>
+ <title><?php echo $title; ?></title>
+ <link><?php echo $base_url . $vars['entity']->guid . '&amp;size=large'; ?></link>
+ <description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
+ <pubDate><?php echo date("r", $vars['entity']->time_created); ?></pubDate>
+ <guid isPermaLink="true"><?php echo $vars['entity']->getURL(); ?></guid>
+ <media:content url="<?php echo $download; ?>" medium="image" type="<?php echo $vars['entity']->getMimeType(); ?>" />
+ <media:title><?php echo $title; ?></media:title>
+ <media:description><?php echo htmlentities($descr); ?></media:description>
+ <media:thumbnail url="<?php echo $base_url . $vars['entity']->guid . '&amp;size=thumb'; ?>"></media:thumbnail>
</item> \ No newline at end of file
diff --git a/views/rss/tidypics/gallery.php b/views/rss/tidypics/gallery.php
index 2fcf2ac76..2c285fca5 100644
--- a/views/rss/tidypics/gallery.php
+++ b/views/rss/tidypics/gallery.php
@@ -1,18 +1,18 @@
-<?php
- /**
- * Tidypics Listing RSS View
- */
-
-$context = $vars['context'];
-$entities = $vars['entities'];
-$count = $vars['count'];
-$baseurl = $vars['baseurl'];
-
-
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
-}
-
+<?php
+ /**
+ * Tidypics Listing RSS View
+ */
+
+$context = $vars['context'];
+$entities = $vars['entities'];
+$count = $vars['count'];
+$baseurl = $vars['baseurl'];
+
+
+if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ echo elgg_view_entity($entity);
+ }
+}
+
?> \ No newline at end of file