From b3438c2d88ba48529275cadd57849cad7fc08e02 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 21 Mar 2012 17:54:36 -0700 Subject: Fixes #23. Added a menu item for setting the cover image. --- languages/en.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'languages') diff --git a/languages/en.php b/languages/en.php index efae155b3..0d6ea2db8 100644 --- a/languages/en.php +++ b/languages/en.php @@ -163,6 +163,7 @@ $english = array( 'album:desc' => "Description", 'album:tags' => "Tags", 'album:cover' => "Make image album cover?", + 'album:cover_link' => 'Set cover image', 'tidypics:quota' => "Quota usage:", 'tidypics:uploader:choose' => "Choose photos", 'tidypics:uploader:upload' => "Upload photos", @@ -252,6 +253,7 @@ The photo can be viewed here: %s", '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.", + 'album:save_cover_image' => 'Cover image saved.', 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings', 'tidypics:album:sorted' => 'The album %s is sorted', 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success', @@ -277,6 +279,8 @@ The photo can be viewed here: %s", 'album:uploadfailed' => "Sorry; we could not save your album.", 'album:deletefailed' => "Your album could not be deleted.", 'album:blank' => "Please give this album a title.", + 'album:invalid_album' => 'Invalid album', + 'album:cannot_save_cover_image' => 'Cannot save cover image', 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed", ); -- cgit v1.2.3 From 7a4d1861e23798e2fda7d9d3c750b8d13b55c5a8 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 6 Apr 2012 10:30:26 -0700 Subject: Started adding back quota support. --- actions/photos/image/ajax_upload.php | 2 +- classes/TidypicsImage.php | 5 +++++ languages/en.php | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'languages') diff --git a/actions/photos/image/ajax_upload.php b/actions/photos/image/ajax_upload.php index d6b083cf6..daa824c42 100644 --- a/actions/photos/image/ajax_upload.php +++ b/actions/photos/image/ajax_upload.php @@ -22,7 +22,7 @@ if (empty($_FILES)) { exit; } -$file = $_FILES['Image']; +$file = $_FILES[$file_var_name]; $mime = tp_upload_get_mimetype($file['name']); if ($mime == 'unknown') { diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php index c0b5de723..dd4324468 100644 --- a/classes/TidypicsImage.php +++ b/classes/TidypicsImage.php @@ -244,6 +244,11 @@ class TidypicsImage extends ElggFile { trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING); throw new Exception(elgg_echo('tidypics:image_pixels')); } + + // make sure file fits quota + if (!tp_upload_check_quota($data['size'], elgg_get_logged_in_user_guid())) { + throw new Exception(elgg_echo('tidypics:cannot_upload_exceeds_quota')); + } } /** diff --git a/languages/en.php b/languages/en.php index 0d6ea2db8..b765508a6 100644 --- a/languages/en.php +++ b/languages/en.php @@ -274,6 +274,7 @@ The photo can be viewed here: %s", 'image:downloadfailed' => "Sorry; this image is not available.", 'tidypics:nosettings' => "Admin of this site has not set photo album settings.", 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator", + 'tidypics:cannot_upload_exceeds_quota' => 'Image not uploaded. File size exceeds available quota.', '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.", -- cgit v1.2.3 From 90b3ef93ab20ceb49d0e2f5b40a87dd6608d05f4 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 13 Apr 2012 18:18:08 -0700 Subject: Fixed incorrect error message when saving an image without a title. --- actions/photos/image/save.php | 2 +- languages/en.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'languages') diff --git a/actions/photos/image/save.php b/actions/photos/image/save.php index 535ae8bbb..1cb65b1e8 100644 --- a/actions/photos/image/save.php +++ b/actions/photos/image/save.php @@ -16,7 +16,7 @@ $guid = get_input('guid'); elgg_make_sticky_form('tidypics'); if (empty($title)) { - register_error(elgg_echo("album:blank")); + register_error(elgg_echo("image:blank")); forward(REFERER); } diff --git a/languages/en.php b/languages/en.php index b765508a6..0f7aa8d69 100644 --- a/languages/en.php +++ b/languages/en.php @@ -271,17 +271,22 @@ The photo can be viewed here: %s", 'tidypics:not_image' => "This is not a recognized image type", 'tidypics:deletefailed' => "Sorry. Deletion failed.", 'tidypics:deleted' => "Successful deletion.", - 'image:downloadfailed' => "Sorry; this image is not available.", 'tidypics:nosettings' => "Admin of this site has not set photo album settings.", 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator", 'tidypics:cannot_upload_exceeds_quota' => 'Image not uploaded. File size exceeds available quota.', - '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.", 'album:blank' => "Please give this album a title.", 'album:invalid_album' => 'Invalid album', 'album:cannot_save_cover_image' => 'Cannot save cover image', + + 'image:downloadfailed' => "Sorry; this image is not available.", + 'images:notedited' => "Not all images were successfully updated", + 'image:blank' => 'Please give this image a title.', + 'image:error' => 'Could not save image.', + 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed", ); -- cgit v1.2.3 From c1da32e6a7e2f4a15a3b2d69cd38a1c0c164a99d Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 8 Jun 2012 15:23:47 -0700 Subject: Fixed invalid SQL caused by sorting an empty album. Also hiding slideshow and sort links for albums with no images. --- actions/photos/album/sort.php | 7 +++++-- classes/TidypicsAlbum.php | 11 +++++++++-- languages/en.php | 2 ++ pages/photos/album/sort.php | 12 +++++++++++- start.php | 3 ++- views/default/photos/group_module.php | 2 +- 6 files changed, 30 insertions(+), 7 deletions(-) (limited to 'languages') diff --git a/actions/photos/album/sort.php b/actions/photos/album/sort.php index 453f51ac5..fd62a7ba7 100644 --- a/actions/photos/album/sort.php +++ b/actions/photos/album/sort.php @@ -12,7 +12,10 @@ if (!$album) { $guids = get_input('guids'); $guids = explode(',', $guids); -$album->setImageList($guids); +if ($album->setImageList($guids)) { + system_message(elgg_echo('tidypics:album:sorted', array($album->getTitle()))); +} else { + register_error(elgg_echo('tidypics:album:could_not_sort', array($album->getTitle()))); +} -system_message(elgg_echo('tidypics:album:sorted', array($album->getTitle()))); forward($album->getURL()); \ No newline at end of file diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php index 1fd98c76b..57bdcf707 100644 --- a/classes/TidypicsAlbum.php +++ b/classes/TidypicsAlbum.php @@ -207,7 +207,7 @@ class TidypicsAlbum extends ElggObject { $list = unserialize($listString); // if empty don't need to check the permissions. - if (!$list) { + if (!$list || $list[0] == '') { return array(); } @@ -231,8 +231,15 @@ class TidypicsAlbum extends ElggObject { * @param array $list An indexed array of image guids */ public function setImageList($list) { + // validate data + foreach ($list as $guid) { + if (!filter_var($guid, FILTER_VALIDATE_INT)) { + return false; + } + } + $listString = serialize($list); - $this->orderedImages = $listString; + return $this->orderedImages = $listString; } /** diff --git a/languages/en.php b/languages/en.php index 0f7aa8d69..624b5234c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -172,6 +172,7 @@ $english = array( 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: choosing, uploading, and describing them. If you do not have Flash, there is also a basic uploader available.', 'tidypics:uploader:basic' => 'You can upload up to 10 photos at a time (%s MB maximum per photo)', 'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.', + 'tidypics:sort:no_images' => 'No images found to sort. Upload images using the link above.', // albums 'album:num' => '%s photos', @@ -256,6 +257,7 @@ The photo can be viewed here: %s", 'album:save_cover_image' => 'Cover image saved.', 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings', 'tidypics:album:sorted' => 'The album %s is sorted', + 'tidypics:album:could_not_sort' => 'Could not sort the album %s. Make sure there are images in the album and try again.', 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success', //Error messages diff --git a/pages/photos/album/sort.php b/pages/photos/album/sort.php index 8b6d1bfc7..005205dd5 100644 --- a/pages/photos/album/sort.php +++ b/pages/photos/album/sort.php @@ -33,8 +33,18 @@ if (elgg_instanceof($owner, 'group')) { elgg_push_breadcrumb($album->getTitle(), $album->getURL()); elgg_push_breadcrumb(elgg_echo('album:sort')); +elgg_register_menu_item('title', array( + 'name' => 'upload', + 'href' => 'photos/upload/' . $album->getGUID(), + 'text' => elgg_echo('images:upload'), + 'link_class' => 'elgg-button elgg-button-action', +)); -$content = elgg_view_form('photos/album/sort', array(), array('album' => $album)); +if ($album->getSize()) { + $content = elgg_view_form('photos/album/sort', array(), array('album' => $album)); +} else { + $content = elgg_echo('tidypics:sort:no_images'); +} $body = elgg_view_layout('content', array( 'filter' => false, diff --git a/start.php b/start.php index c56382655..13a9e2d85 100644 --- a/start.php +++ b/start.php @@ -347,7 +347,8 @@ function tidypics_entity_menu_setup($hook, $type, $return, $params) { } } - if (elgg_instanceof($entity, 'object', 'album')) { + // only show these options if there are images + if (elgg_instanceof($entity, 'object', 'album') && $entity->getSize() > 0) { $url = $entity->getURL() . '?limit=50&view=rss'; $url = elgg_format_url($url); $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})"; diff --git a/views/default/photos/group_module.php b/views/default/photos/group_module.php index aa0e7b3ff..de7a451c4 100644 --- a/views/default/photos/group_module.php +++ b/views/default/photos/group_module.php @@ -3,7 +3,7 @@ * Group blog module */ -$group = elgg_get_page_owner_entity(); +$group = $vars['entity']; if ($group->photos_enable == "no") { return true; -- cgit v1.2.3