diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-07-09 11:22:07 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-07-09 11:22:07 -0700 |
commit | c981f5bcec02295482153e45b0d57f37260706c0 (patch) | |
tree | d45052e7a37ec944d28af966d5b589ac1dbd08aa /classes | |
parent | 43e0b308fdb32ed434d25b54b4a84b88d329d1bf (diff) | |
parent | 79c61e0c8c12f98fb4f3984a8297186a3dc847e8 (diff) |
Merge branch 'candrews-review' into 0.8.x
* candrews-review:
maildaemon makes mail attachments into notice attachments
File classes does not use the $FILES array directly, as users of this class aren't necessarily from the web
Diffstat (limited to 'classes')
-rw-r--r-- | classes/File.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/classes/File.php b/classes/File.php index 5dd7cd865..533cc6e71 100644 --- a/classes/File.php +++ b/classes/File.php @@ -122,17 +122,17 @@ class File extends Memcached_DataObject return $x; } - function isRespectsQuota($user) { - if ($_FILES['attach']['size'] > common_config('attachments', 'file_quota')) { + function isRespectsQuota($user,$fileSize) { + if ($fileSize > common_config('attachments', 'file_quota')) { return sprintf(_('No file may be larger than %d bytes ' . 'and the file you sent was %d bytes. Try to upload a smaller version.'), - common_config('attachments', 'file_quota'), $_FILES['attach']['size']); + common_config('attachments', 'file_quota'), $fileSize); } $query = "select sum(size) as total from file join file_to_post on file_to_post.file_id = file.id join notice on file_to_post.post_id = notice.id where profile_id = {$user->id} and file.url like '%/notice/%/file'"; $this->query($query); $this->fetch(); - $total = $this->total + $_FILES['attach']['size']; + $total = $this->total + $fileSize; if ($total > common_config('attachments', 'user_quota')) { return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } @@ -140,7 +140,7 @@ class File extends Memcached_DataObject $query .= ' month(modified) = month(now()) and year(modified) = year(now())'; $this->query($query); $this->fetch(); - $total = $this->total + $_FILES['attach']['size']; + $total = $this->total + $fileSize; if ($total > common_config('attachments', 'monthly_quota')) { return sprintf(_('A file this large would exceed your monthly quota of %d bytes.'), common_config('attachments', 'monthly_quota')); } |