public function deleteMessage($messageID, $message = array(), $action = true) { // Delete message $retval = $this->db->delete('timeline_messages', array('message_id' => $messageID), 1); if ($retval) { if ($action) { // Delete timeline action timeline_helper::delete('timeline_message_post', $message['user_id'], $messageID); } // Action hook hook::action('timeline/messages/delete', $messageID); } return $retval; }
public function deleteAd($adID, $userID, $ad) { // Load pictures model loader::model('classifieds/pictures', array(), 'classifieds_pictures_model'); // Delete pictures $this->classifieds_pictures_model->deletePictures($adID, $userID, $ad); // Delete ad $retval = $this->fields_model->deleteValues('classified_ad', $adID); if ($retval) { // Update counters $column = $ad['active'] == 1 ? 'total_classifieds' : 'total_classifieds_i'; $this->db->query("UPDATE `:prefix:users` SET `{$column}`=`{$column}`-1 WHERE `user_id`=? LIMIT 1", array($userID)); // Delete reports loader::model('reports/reports'); $this->reports_model->deleteReports('classified_ad', $adID); // Delete comments if ($ad['total_comments']) { loader::model('comments/comments'); $this->comments_model->deleteComments('classified_ad', $adID, $ad['total_comments']); } // Delete likes if ($ad['total_likes']) { loader::model('comments/likes'); $this->likes_model->deleteLikes('classified_ad', $adID, $ad['total_likes']); } // Delete votes if ($ad['total_votes']) { loader::model('comments/votes'); $this->votes_model->deleteVotes('classified_ad', $adID, $ad['total_votes']); } // Clean up counters $this->counters_model->deleteCounters('user', $userID); // Delete timeline action timeline_helper::delete('classified_ad_post', $userID, $adID); // Action hook hook::action('classifieds/delete', $adID, $ad); } return $retval; }
public function deletePicture($pictureID, $albumID, $userID, $picture, $album) { // Delete picture $retval = $this->fields_model->deleteValues('picture', $pictureID); if ($retval) { // Delete files $this->storage_model->deleteFiles($picture['file_id'], 3); // Update counters $column = $picture['active'] == 1 ? 'total_pictures' : 'total_pictures_i'; $this->db->query("UPDATE `:prefix:pictures_albums_data` SET `{$column}`=`{$column}`-1 WHERE `album_id`=? LIMIT 1", array($albumID)); $this->db->query("UPDATE `:prefix:users` SET `{$column}`=`{$column}`-1 WHERE `user_id`=? LIMIT 1", array($userID)); $this->db->query("UPDATE `:prefix:pictures_data` SET `order_id`=`order_id`-1 WHERE `album_id`=? AND `order_id`>? LIMIT ?", array($albumID, $picture['order_id'], $album['total_pictures'] + $album['total_pictures_i'] - $picture['order_id'])); // Is this a cover picture? if ($album['picture_id'] && $album['picture_id'] == $pictureID) { $this->pictures_albums_model->updateCover($albumID, 0); } // Delete reports loader::model('reports/reports'); $this->reports_model->deleteReports('picture', $pictureID); // Delete comments if ($picture['total_comments']) { loader::model('comments/comments'); $this->comments_model->deleteComments('picture', $pictureID, $picture['total_comments']); } // Delete likes if ($picture['total_likes']) { loader::model('comments/likes'); $this->likes_model->deleteLikes('picture', $pictureID, $picture['total_likes']); } // Delete votes if ($picture['total_votes']) { loader::model('comments/votes'); $this->votes_model->deleteVotes('picture', $pictureID, $picture['total_votes']); } // Delete timeline action timeline_helper::delete('picture_post', $userID, $albumID); // Action hook hook::action('pictures/delete', $pictureID, $picture); } return $retval; }
public function deleteBlog($blogID, $userID, $blog) { // Delete blog $retval = $this->fields_model->deleteValues('blog', $blogID); if ($retval) { // Update counters $column = $blog['active'] == 1 ? 'total_blogs' : 'total_blogs_i'; $this->db->query("UPDATE `:prefix:users` SET `{$column}`=`{$column}`-1 WHERE `user_id`=? LIMIT 1", array($userID)); // Delete reports loader::model('reports/reports'); $this->reports_model->deleteReports('blog', $blogID); // Delete comments if ($blog['total_comments']) { loader::model('comments/comments'); $this->comments_model->deleteComments('blog', $blogID, $blog['total_comments']); } // Delete likes if ($blog['total_likes']) { loader::model('comments/likes'); $this->likes_model->deleteLikes('blog', $blogID, $blog['total_likes']); } // Delete votes if ($blog['total_votes']) { loader::model('comments/votes'); $this->votes_model->deleteVotes('blog', $blogID, $blog['total_votes']); } // Clean up counters $this->counters_model->deleteCounters('user', $userID); // Delete timeline action timeline_helper::delete('blog_post', $userID, $blogID); // Action hook hook::action('blogs/delete', $blogID, $blog); } return $retval; }
public function deleteUser($userID, $user) { // Delete comments loader::model('comments/comments'); $this->comments_model->deleteUser($userID, $user); // Delete likes loader::model('comments/likes'); $this->likes_model->deleteUser($userID, $user); // Delete votes loader::model('comments/votes'); $this->votes_model->deleteUser($userID, $user); // Delete reports loader::model('reports/reports'); $this->reports_model->deleteUser($userID, $user); // Delete visitors loader::model('users/visitors', array(), 'users_visitors_model'); $this->users_visitors_model->deleteUser($userID, $user); // Delete timeline actions loader::model('timeline/timeline'); $this->timeline_model->deleteUser($userID, $user); // Delete friends $this->users_friends_model->deleteUser($userID, $user); // Delete picture if ($user['picture_id']) { $this->deletePicture($userID, $user['picture_id'], false); } // Delete user $this->db->delete('users_data_' . config::item('usertypes', 'core', 'keywords', $user['type_id']), array('profile_id' => $userID), 1); $this->db->delete('users_data_items', array('data_id' => $userID)); $this->db->delete('users_config', array('user_id' => $userID)); $retval = $this->db->delete('users', array('user_id' => $userID), 1); // Clean up counters $this->counters_model->deleteCounters('user', $userID); // Delete timeline action timeline_helper::delete('user_signup', $userID, $userID); // Action hook hook::action('users/account/delete', $userID, $user); return $retval; }
public function deleteAlbum($albumID, $userID, $album) { // Load pictures model loader::model('pictures/pictures'); // Delete pictures $this->pictures_model->deletePictures($albumID, $userID, $album); // Delete album $retval = $this->fields_model->deleteValues('picture_album', $albumID); if ($retval) { // Update counters $this->db->query("UPDATE `:prefix:users` SET `total_albums`=`total_albums`-1 WHERE `user_id`=? LIMIT 1", array($userID)); $this->db->query("UPDATE `:prefix:users` SET `total_pictures`=`total_pictures`-?, `total_pictures_i`=`total_pictures_i`-? WHERE `user_id`=? LIMIT 1", array($album['total_pictures'], $album['total_pictures_i'], $userID)); // Delete reports loader::model('reports/reports'); $this->reports_model->deleteReports('picture_album', $albumID); if ($album['total_likes']) { loader::model('comments/likes'); $this->likes_model->deleteLikes('picture_album', $albumID, $album['total_likes']); } // Delete votes if ($album['total_votes']) { loader::model('comments/votes'); $this->votes_model->deleteVotes('picture_album', $albumID, $album['total_votes']); } // Delete timeline action timeline_helper::delete('picture_post', $userID, $albumID); // Action hook hook::action('pictures/albums/delete', $albumID, $album); // Clean up counters $this->counters_model->deleteCounters('user', $userID); } return $retval; }