static function get_word_list($user_id, $word_list_id, $log) { global $con; $sql = "\n\t\tSELECT `list`.`id`, `list`.`name`, `list`.`creator`, `list`.`comment`, `list`.`language1`, `list`.`language2`, `list`.`creation_time`\n\t\tFROM `list`, `share`\n\t\tWHERE (`list`.`creator` = '" . $user_id . "' OR `share`.`user` = '" . $user_id . "' AND `share`.`list` = '" . $word_list_id . "') AND \n `list`.`id` = '" . $word_list_id . "' AND \n `list`.`active` = 1 AND `share`.`permissions` <> 0"; $query = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($query)) { $list = new WordList($row['id'], $row['name'], SimpleUser::get_by_id($row['creator']), $row['comment'], $row['language1'], $row['language2'], $row['creation_time'], null); $list->load_words(true, $user_id, "ASC"); $list->load_sharing_information($user_id); $list->set_labels(WordList::get_labels_of_list($user_id, $word_list_id)); // log the list access inside the loop to make sure it is only logged if the user has actually access to the list if ($log === true) { self::add_list_usage($user_id, $word_list_id); } return $list; } return NULL; }