/** * Delete Shop products by ajax */ function deleteShopProduct() { $userID = buckys_is_logged_in(); $paramProductID = get_secure_integer($_REQUEST['productID']); if (is_numeric($paramProductID) && $userID) { buckys_get_messages(); $shopProdIns = new BuckysShopProduct(); $shopProdIns->removeProductByUserID($paramProductID, $userID); } }
/** * Delete Objects * * @param Array $ids */ public static function deleteObjects($ids) { global $db; if (!is_array($ids)) { $ids = [$ids]; } $ids = $db->escapeInput($ids); $query = $db->prepare("SELECT * FROM " . TABLE_REPORTS . " WHERE reportID IN (" . implode(", ", $ids) . ")"); $rows = $db->getResultsArray($query); foreach ($rows as $row) { if ($row['objectType'] == 'post') { $post = $db->getRow("SELECT * FROM " . TABLE_POSTS . " WHERE postID=" . $row['objectID']); BuckysPost::deletePost($post['poster'], $post['postID']); } else { if ($row['objectType'] == 'comment') { //Getting Data $comment = $db->getRow("SELECT * FROM " . TABLE_POSTS_COMMENTS . " WHERE commentID=" . $row['objectID']); BuckysComment::deleteComment($comment['commenter'], $comment['commentID']); } else { if ($row['objectType'] == 'video_comment') { //Getting Data $comment = $db->getRow("SELECT * FROM " . TABLE_VIDEO_COMMENTS . " WHERE commentID=" . $row['objectID']); BuckysVideo::deleteVideoComment($comment['commentID']); } else { if ($row['objectType'] == 'message') { //Delete Message $db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE messageID=" . $row['objectID']); } else { if ($row['objectType'] == 'topic') { //Delete Topic BuckysForumTopic::deleteTopic($row['objectID']); } else { if ($row['objectType'] == 'reply') { //Delete Topic BuckysForumReply::deleteReply($row['objectID']); } else { if ($row['objectType'] == 'shop_item') { //Delete Shop Product $shopProdIns = new BuckysShopProduct(); $shopProdIns->removeProductByUserID($row['objectID'], $row['reportedID']); } else { if ($row['objectType'] == 'trade_item') { //Delete Trade Item $tradeItemIns = new BuckysTradeItem(); $tradeItemIns->removeItemByUserID($row['objectID'], $row['reportedID']); } } } } } } } } //Delete the row on the report table $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE reportID=" . $row['reportID']); } return; }