diff options
-rw-r--r-- | core/controllers/items.php | 6 | ||||
-rw-r--r-- | core/helpers/album.php | 2 | ||||
-rw-r--r-- | core/helpers/photo.php | 2 | ||||
-rw-r--r-- | modules/comment/helpers/comment.php | 7 | ||||
-rw-r--r-- | modules/tag/hooks/photo_created.php | 2 | ||||
-rw-r--r-- | modules/user/controllers/logout.php | 1 | ||||
-rw-r--r-- | modules/user/helpers/user.php | 4 |
7 files changed, 19 insertions, 5 deletions
diff --git a/core/controllers/items.php b/core/controllers/items.php index 13071843..fd5e337d 100644 --- a/core/controllers/items.php +++ b/core/controllers/items.php @@ -101,6 +101,9 @@ class Items_Controller extends REST_Controller { if ($parent->id) { $item->delete(); } + + Event::run("gallery.{$item->type}.deleted", $item); + url::redirect("{$parent->type}s/{$parent->id}"); } @@ -131,6 +134,9 @@ class Items_Controller extends REST_Controller { // parent_id, owner_id $item->save(); + + Event::run("gallery.{$item->type}.changed", $item); + if (array_key_exists("_return", $post)) { print $item->{$post["_return"]}; } diff --git a/core/helpers/album.php b/core/helpers/album.php index e2163b4c..70f5222a 100644 --- a/core/helpers/album.php +++ b/core/helpers/album.php @@ -54,7 +54,7 @@ class album_Core { mkdir($thumbnail_dir); } - Event::run("gallery.album_created", $photo); + Event::run("gallery.album.created", $photo); return $album; } diff --git a/core/helpers/photo.php b/core/helpers/photo.php index 900322d2..05fb2fb1 100644 --- a/core/helpers/photo.php +++ b/core/helpers/photo.php @@ -78,7 +78,7 @@ class photo_Core { ->set_resize($filename, 640, 480) ->save(); - Event::run("gallery.photo_created", $photo); + Event::run("gallery.photo.created", $photo); return $result; } diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 099a3833..8bbb68d6 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -31,7 +31,7 @@ class comment_Core { const SECONDS_IN_A_YEAR = 31556926; /** - * Create a new photo. + * Create a new comment. * @param string $author author's name * @param string $email author's email * @param string $text comment body @@ -51,7 +51,10 @@ class comment_Core { $comment->datetime = $datetime; $comment->item_id = $item_id; - return $comment->save(); + $comment->save(); + Event::run("gallery.comment.created", $comment); + + return $comment; } static function get_add_form($item_id) { diff --git a/modules/tag/hooks/photo_created.php b/modules/tag/hooks/photo_created.php index 8f6cbab6..8d033317 100644 --- a/modules/tag/hooks/photo_created.php +++ b/modules/tag/hooks/photo_created.php @@ -1,2 +1,2 @@ <?php defined('SYSPATH') or die('No direct script access.'); -Event::add("gallery.photo_created", array('tag', 'on_photo_create')); +Event::add("gallery.photo.created", array('tag', 'on_photo_create')); diff --git a/modules/user/controllers/logout.php b/modules/user/controllers/logout.php index 524c79f8..c9ad1b6a 100644 --- a/modules/user/controllers/logout.php +++ b/modules/user/controllers/logout.php @@ -21,6 +21,7 @@ class Logout_Controller extends Controller { public function index() { try { Session::instance()->destroy(); + Event::run("gallery.user.logout", $user); } catch (Exception $e) { Kohana::log("error", $e); } diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index e035a7fb..0133a153 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -81,6 +81,8 @@ class user_Core { group::add_user(group::REGISTERED_USERS, $user->id); + Event::run("gallery.user.created", $user); + return $user; } @@ -91,6 +93,7 @@ class user_Core { */ static function delete($id) { ORM::factory("user", $id)->delete(); + Event::run("gallery.user.deleted", $user); } /** @@ -146,6 +149,7 @@ class user_Core { $user->save(); Session::instance()->set('user', $user); + Event::run("gallery.user.login", $user); } /** |