public static function flagNote($pack) { $sql_note = dbconnection::queryObject("SELECT * FROM notes WHERE note_id = '{$pack->note_id}'"); $note = notes::noteObjectFromSQL($sql_note); // No authentication; anyone can flag a note that is not in APPROVED state if ($note->published == 'APPROVED') { return new return_package(1, NULL, "Cannot flag note because it has already been approved by the moderator"); } dbconnection::query("UPDATE notes SET published = 'PENDING' WHERE note_id = '{$pack->note_id}'"); return new return_package(0); }