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(-) 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