public static function deleteWebPage($gameId, $webPageId) { Locations::deleteLocationsForObject($gameId, 'WebPage', $webPageId); Requirements::deleteRequirementsForRequirementObject($gameId, 'WebPage', $webPageId); PlayerStateChanges::deletePlayerStateChangesThatRefrenceObject($gameId, 'WebPage', $webPageId); $query = "DELETE FROM web_pages WHERE game_id = '{$gameId}' AND web_page_id = {$webPageId}"; $rsResult = Module::query($query); if (mysql_error()) { return new returnData(3, NULL, "SQL Error"); } if (mysql_affected_rows()) { return new returnData(0, TRUE); } else { return new returnData(0, FALSE); } }
public function deleteNode($gameId, $intNodeID) { Locations::deleteLocationsForObject($gameId, 'Node', $intNodeID); Requirements::deleteRequirementsForRequirementObject($gameId, 'Node', $intNodeID); PlayerStateChanges::deletePlayerStateChangesThatRefrenceObject($gameId, 'Node', $intNodeID); $query = "DELETE FROM nodes WHERE game_id = {$gameId} AND node_id = {$intNodeID}"; $rsResult = Module::query($query); if (mysql_error()) { return new returnData(3, NULL, "SQL Error"); } if (mysql_affected_rows()) { return new returnData(0); } else { return new returnData(2, NULL, 'invalid node id'); } }
public function deleteNote($noteId) { if ($noteId == 0) { return new returnData(0); } //if 0, it would delete ALL notes $noteObj = Module::queryObject("SELECT * FROM notes WHERE note_id = '{$noteId}' LIMIT 1"); Module::query("DELETE FROM note_tags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_likes WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_flags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_shares WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM folder_contents WHERE game_id = {$noteObj->game_id} AND content_type = 'PlayerNote' AND content_id = '{$noteId}'"); Module::query("DELETE FROM note_content WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_tags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_likes WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM notes WHERE note_id = '{$noteId}'"); Locations::deleteLocationsForObject($noteObj->game_id, "PlayerNote", $noteId); $result = Module::query("SELECT note_id FROM notes WHERE parent_note_id = '{$noteId}'"); while ($commentNote = mysql_fetch_object($result)) { Notebook::deleteNote($commentNote->note_id); } return new returnData(0); }
public static function deleteItem($gameId, $itemId) { Locations::deleteLocationsForObject($gameId, 'Item', $itemId); Requirements::deleteRequirementsForRequirementObject($gameId, 'Item', $itemId); PlayerStateChanges::deletePlayerStateChangesThatRefrenceObject($gameId, 'Item', $itemId); Module::removeItemFromAllPlayerInventories($gameId, $itemId); $query = "DELETE FROM items WHERE item_id = {$itemId} AND game_id = '{$gameId}'"; $rsResult = Module::query($query); if (mysql_error()) { return new returnData(3, NULL, "SQL Error"); } if (mysql_affected_rows()) { return new returnData(0, TRUE); } else { return new returnData(0, FALSE); } }
function deleteNote($noteId) { //If noteId is 0, it will rather elegantly delete EVERYTHING in the note database //becasue 0 is used for the parent_id of all new notes if ($noteId == 0) { return new returnData(0); } $noteObj = Module::queryObject("SELECT * FROM notes WHERE note_id = '{$noteId}' LIMIT 1"); Module::query("DELETE FROM note_tags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_likes WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_flags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_shares WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM folder_contents WHERE game_id = {$noteObj->game_id} AND content_type = 'PlayerNote' AND content_id = '{$noteId}'"); Module::query("DELETE FROM note_content WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_tags WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM note_likes WHERE note_id = '{$noteId}'"); Module::query("DELETE FROM notes WHERE note_id = '{$noteId}'"); Locations::deleteLocationsForObject($noteObj->game_id, "PlayerNote", $noteId); $result = Module::query("SELECT note_id FROM notes WHERE parent_note_id = '{$noteId}'"); while ($commentNote = mysql_fetch_object($result)) { Notes::deleteNote($commentNote->note_id); } return new returnData(0); }
function deleteNote($noteId) { //If noteId is 0, it will rather elegantly delete EVERYTHING in the note database //becasue 0 is used for the parent_id of all new notes if ($noteId == 0) { return new returnData(0); } $query = "SELECT * FROM notes WHERE note_id = '{$noteId}' LIMIT 1"; $result = Module::query($query); $noteObj = mysql_fetch_object($result); $query = "DELETE FROM note_tags WHERE note_id = '{$noteId}'"; Module::query($query); $query = "DELETE FROM note_likes WHERE note_id = '{$noteId}'"; Module::query($query); $query = "SELECT note_id FROM notes WHERE parent_note_id = '{$noteId}'"; $result = Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } while ($commentNote = mysql_fetch_object($result)) { Notes::deleteNote($commentNote->note_id); } //Delete Note locations Locations::deleteLocationsForObject($noteObj->game_id, "PlayerNote", $noteId); //Delete the folder record //EditorFolderContents::deleteContent($noteObj->game_id, "PlayerNote", $noteId); //This would cause an infinite loop becasue it deletes the note $query = "DELETE FROM folder_contents WHERE game_id = {$noteObj->game_id} AND content_type = 'PlayerNote' AND content_id = '{$noteId}'"; Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } //Delete the Note's Content $query = "DELETE FROM note_content WHERE note_id = '{$noteId}'"; Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } $query = "DELETE FROM note_tags WHERE note_id = '{$noteId}'"; Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } $query = "DELETE FROM note_likes WHERE note_id = '{$noteId}'"; Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } //Delete the Note itself $query = "DELETE FROM notes WHERE note_id = '{$noteId}'"; Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } return new returnData(0); }
public function deleteNpc($gameId, $intNpcId) { Locations::deleteLocationsForObject($gameId, 'Npc', $intNpcId); Requirements::deleteRequirementsForRequirementObject($gameId, 'Npc', $intNpcId); PlayerStateChanges::deletePlayerStateChangesThatRefrenceObject($gameId, 'Npc', $intNpcId); Nodes::deleteNodesReferencedByObject($gameId, 'Npc', $intNpcId); $query = "DELETE FROM npcs WHERE npc_id = {$intNpcId} AND game_id = {$gameId}"; $rsResult = Module::query($query); if (mysql_error()) { return new returnData(3, NULL, "SQL Error"); } $hasDeletedNPC = mysql_affected_rows(); $query = "DELETE FROM npc_conversations WHERE npc_id = {$intNpcId} AND game_id = {$gameId}"; $rsResult = Module::query($query); if (mysql_error()) { return new returnData(3, NULL, "SQL Error"); } if ($hasDeletedNPC) { return new returnData(0); } else { return new returnData(2, 'invalid npc id'); } }