From a46fcb8463adb30cb733bbd1d74b2b8e02cae40e Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 6 Jul 2007 06:41:13 +0000 Subject: [PATCH] allow parts of the upload process to say 'no, not ok!' git-svn-id: file:///home/shish/svn/shimmie2/trunk@234 7f39781d-f577-437e-ae19-be835c7a54ca --- core/events/uploadingimage.event.php | 2 ++ core/ext/image.ext.php | 2 +- ext/upload/main.php | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/events/uploadingimage.event.php b/core/events/uploadingimage.event.php index aa9ea662..b0b1d438 100644 --- a/core/events/uploadingimage.event.php +++ b/core/events/uploadingimage.event.php @@ -7,9 +7,11 @@ */ class UploadingImageEvent extends Event { var $image; + var $ok; public function UploadingImageEvent($image) { $this->image = $image; + $this->ok = false; } } ?> diff --git a/core/ext/image.ext.php b/core/ext/image.ext.php index dc986eaf..88abedc8 100644 --- a/core/ext/image.ext.php +++ b/core/ext/image.ext.php @@ -22,7 +22,7 @@ class ImageIO extends Extension { } if(is_a($event, 'UploadingImageEvent')) { - $this->add_image($event->image); + $event->ok = $this->add_image($event->image); } if(is_a($event, 'ImageDeletionEvent')) { diff --git a/ext/upload/main.php b/ext/upload/main.php index 081fb62a..426a9d25 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -74,8 +74,9 @@ class Upload extends Extension { $image = new Image($file['tmp_name'], $file['name'], $_POST['tags']); if($image->is_ok()) { - send_event(new UploadingImageEvent($image)); - $ok = true; + $event = new UploadingImageEvent($image); + send_event($event); + $ok = $event->ok; } else { $this->theme->display_upload_error("Error with ".html_escape($file['name']),