static function deleteQuery($id) { $id = sqlescape($id); // Find all the stream content related to this query $q = sqlquery("SELECT item FROM btx_social_feed_stream_queries WHERE `query` = '{$id}'"); while ($f = sqlfetch($q)) { // See if the item is related to more than one query $r = sqlrows(sqlquery("SELECT `query` FROM btx_social_feed_stream_queries WHERE `item` = '" . $f["item"] . "'")); // If this is the only query related to the content, delete it. if ($r == 1) { BigTreeAutoModule::deleteItem("btx_social_feed_stream", $f["item"]); } } // Delete the query itself -- foreign key constraints will delete the reference table BigTreeAutoModule::deleteItem("btx_social_feed_queries", $id); }
<?php include "_setup.php"; // If you made this pending item, you should be allowed to delete it, or if you're a publisher of the module. if ($access_level != "p" && $current_item["owner"] != $admin->ID) { echo 'BigTree.growl("' . $module["name"] . '","You don\'t have permission to delete this item.");'; } else { echo 'BigTree.growl("' . $module["name"] . '","Deleted Item");'; if (substr($id, 0, 1) == "p") { BigTreeAutoModule::deletePendingItem($table, substr($id, 1)); } else { BigTreeAutoModule::deleteItem($table, $id); } }
<?php // Update the count sqlquery("UPDATE btx_form_builder_forms SET entries = (entries - 1) WHERE id = '" . sqlescape($_POST["form"]) . "'"); BigTreeAutoModule::recacheItem($_POST["form"], "btx_form_builder_forms"); // Delete the entry BigTreeAutoModule::deleteItem("btx_form_builder_entries", $_POST["id"]); // Show the growl and update the table header("Content-type: text/javascript"); ?> BigTree.growl("Form Builder","Deleted Entry"); $("#row_<?php echo $_POST["id"]; ?> ").remove();