Exemplo n.º 1
0
 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);
 }