From 0e937d4af027502d1ce6c58191d98e6ffe640487 Mon Sep 17 00:00:00 2001 From: shish Date: Thu, 18 Oct 2007 02:04:22 +0000 Subject: [PATCH] RatingSetEvent git-svn-id: file:///home/shish/svn/shimmie2/trunk@528 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/rating/main.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/contrib/rating/main.php b/contrib/rating/main.php index 99cac1bf..bd617efc 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -7,6 +7,16 @@ * Description: Allow users to rate images */ +class RatingSetEvent extends Event { + var $image_id, $user, $rating; + + public function RatingSetEvent($image_id, $user, $rating) { + $this->image_id = $image_id; + $this->user = $user; + $this->rating = $rating; + } +} + class Ratings extends Extension { var $theme; @@ -29,11 +39,16 @@ class Ratings extends Extension { if(is_a($event, 'PageRequestEvent') && $event->page_name == "rating" && $event->get_arg(0) == "set" && $user->is_admin() && isset($_POST['rating']) && isset($_POST['image_id'])) { - $this->set_rating($_POST['image_id'], $_POST['rating']); + $i_image_id = int_escape($_POST['image_id']); + send_event(new RatingSetEvent($i_image_id, $user, $_POST['rating'])); $event->page->set_mode("redirect"); $event->page->set_redirect(make_link("post/view/".int_escape($_POST['image_id']))); } + if(is_a($event, 'RatingSetEvent')) { + $this->set_rating($event->image_id, $event->rating); + } + if(is_a($event, 'DisplayingImageEvent')) { global $user; if($user->is_admin()) {