summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/helpers/comment_event.php27
-rw-r--r--modules/gallery/helpers/gallery_event.php28
-rw-r--r--modules/notification/helpers/notification_event.php7
3 files changed, 43 insertions, 19 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index ddf72e3c..a72102b9 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -24,23 +24,24 @@ class comment_event_Core {
static function user_deleted($user) {
$guest = identity::guest();
- Database::instance()
- ->query("UPDATE {comments}
- SET author_id = {$guest->id},
- guest_email = NULL,
- guest_name = 'guest',
- guest_url = NULL
- WHERE author_id = {$user->id}");
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where(array("author_id" => $user->id))
+ ->update();
}
static function identity_provider_changed($old_provider, $new_provider) {
$guest = identity::guest();
- Database::instance()
- ->query("UPDATE {comments}
- SET author_id = {$guest->id},
- guest_email = NULL,
- guest_name = 'guest',
- guest_url = null");
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where("1 = 1")
+ ->update();
}
static function admin_menu($menu, $theme) {
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 582e3267..67a6f41f 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -31,15 +31,35 @@ class gallery_event_Core {
static function user_deleted($user) {
$admin = identity::admin_user();
$db = Database::instance();
- $db->query("UPDATE {tasks} SET owner_id = {$admin->id} where owner_id = {$user->id}");
- $db->query("UPDATE {items} SET owner_id = {$admin->id} where owner_id = {$user->id}");
+ $db->from("tasks")
+ ->set(array("owner_id" => $admin->id))
+ ->where(array("owner_id" => $user->id))
+ ->update();
+ $db->from("items")
+ ->set(array("owner_id" => $admin->id))
+ ->where(array("owner_id" => $user->id))
+ ->update();
+ $db->from("logs")
+ ->set(array("user_id" => $admin->id))
+ ->where(array("user_id" => $user->id))
+ ->update();
}
static function identity_provider_changed($old_provider, $new_provider) {
$admin = identity::admin_user();
$db = Database::instance();
- $db->query("UPDATE {tasks} SET owner_id = {$admin->id}");
- $db->query("UPDATE {items} SET owner_id = {$admin->id}");
+ $db->from("tasks")
+ ->set(array("owner_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
+ $db->from("items")
+ ->set(array("owner_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
+ $db->from("logs")
+ ->set(array("user_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
}
static function group_created($group) {
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index b82e4f0f..6b2df574 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -53,11 +53,14 @@ class notification_event_Core {
}
static function user_deleted($user) {
- Database::instance()->query("DELETE FROM {subscriptions} where user_id = {$user->id}");
+ ORM::factory("subscriptions")
+ ->where(array("user_id", $user->id))
+ ->delete_all();
}
static function identity_provider_changed($old_provider, $new_provider) {
- Database::instance()->query("DELETE FROM {subscriptions}");
+ ORM::factory("subscriptions")
+ ->delete_all();
}
static function comment_created($comment) {