// Message did not exist header("HTTP/1.0 404 Not Found"); print "Message id: " . $message_id . " not found.<br>"; exit; } // Looking for the json of a specific message if ($path_length == 3 || $path_length == 4 && $path_components[3] == "") { header("Content-type: application/json"); print $message->getJSON(); exit; } else { if ($path_length == 4) { // Return user ids that favorited a given message id if ($path_components[3] == "favorite") { header("Content-type: application/json"); print json_encode(Favorite::get_user_ids_of_favorited_message($message_id)); exit; } } } } // Id not specified, looking for index of Messages header("Content-type: application/json"); print json_encode(Message::get_all_ids()); exit; } else { if ($path_components[1] == "group") { if (isset($path_components[2]) && $path_components[2] != "") { $group_id = intval($path_components[2]); $group = Group::find_by_id($group_id); if ($group == null) {