Example #1
0
 // add word list
 case 'add-word-list':
     session_required();
     Response::send(Database::add_word_list($_SESSION['id'], Validation::format_text($_GET['name'])));
     break;
     // list of word lists
 // list of word lists
 case 'list-of-word-lists':
     session_required();
     Response::send(Database::get_word_lists_of_user($_SESSION['id']));
     break;
     // list of shared word lists with user
 // list of shared word lists with user
 case 'list-of-shared-word-lists-with-user':
     session_required();
     Response::send(Database::get_list_of_shared_word_lists_with_user($_SESSION['id']));
     break;
     // get word list
 // get word list
 case 'get-word-list':
     session_required();
     $res = Database::get_word_list($_SESSION['id'], Validation::format_text($_GET['word_list_id']), true);
     if ($res !== NULL) {
         // list is null if it doesn't exist of has been deleted
         // stores whether the requesting unser is the list creator
         $res->allowSharing = $_SESSION['id'] == $res->creator->id;
         // stores whether the requesting user is allowed to edit the list
         $res->allowEdit = $res->allowSharing ? TRUE : $res->get_editing_permissions_for_user($_SESSION['id']);
     }
     Response::send($res);
     break;