Example #1
0
     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;
     // add word list usage
 // add word list usage
 case 'add-word-list-usage':
     session_required();
     Response::send(Database::add_list_usage($_SESSION['id'], Validation::format_text($_GET['word_list_id']), $_GET['word_list_id']));
     break;
     // rename word list
 // rename word list
 case 'rename-word-list':
     session_required();
     Response::send(Database::rename_word_list($_SESSION['id'], Validation::format_text($_GET['word_list_id']), Validation::format_text($_GET['word_list_name'])));
     break;
     // delete word list
 // delete word list
 case 'delete-word-list':
     session_required();
     Response::send(Database::delete_word_list($_SESSION['id'], Validation::format_text($_GET['word_list_id'])));
     break;
     // set word list language
 // set word list language