Exemplo n.º 1
0
     } else {
         if ($path_length >= 4) {
             // Return message ids owned by user
             if ($path_components[3] == "message") {
                 header("Content-type: application/json");
                 print json_encode(Message::get_message_ids_of_user($user_id));
                 exit;
             } else {
                 if ($path_components[3] == "group") {
                     header("Content-type: application/json");
                     print json_encode(Member::get_groups_of_user($user_id));
                     exit;
                 } else {
                     if ($path_components[3] == "favorite") {
                         header("Content-type: application/json");
                         print json_encode(Favorite::get_favorited_message_ids_of_user($user_id));
                         exit;
                     }
                 }
             }
         }
     }
     // Id not specified, looking for index of Users
     header("Content-type: application/json");
     print json_encode(User::get_all_ids());
     exit;
 } else {
     if ($path_components[1] == "message") {
         if (isset($path_components[2]) && $path_components[2] != "") {
             $message_id = intval($path_components[2]);
             $message = Message::find_by_id($message_id);