if (isset($_GET['uri'])) { if ('users' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $user = get_user_by_uid($_GET['id']); unset($user['password']); unset($user['locale']); $response = array("version" => $version, "response" => $user); echo json_encode($response); } elseif ('users' == $_GET['uri']) { send_headers(); $users = get_all_users(); $response = array("version" => $version, "response" => $users); echo json_encode($response); } elseif ('tags' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $tag = get_tag_by_uid($_GET['id']); $tag['type'] = get_tag_type($tag['type']); unset($tag['keya']); $response = array("version" => $version, "response" => $tag); echo json_encode($response); } elseif ('tags' == $_GET['uri']) { send_headers(); $tags = get_all_tags(); $response = array("version" => $version, "response" => $tags); echo json_encode($response); } elseif ('readers' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $reader = get_reader_by_id($_GET['id']); $reader['services'] = get_reader_services_by_id($reader['id']); $services = []; foreach (get_reader_services_by_id($reader['id']) as $service_id) {
function list_tags_action($uid) { // needed to set the tab active $tags_active = true; //check if the user is admin if (user_is_admin($uid)) { // dealing with tag add form if (isset($_POST['owner'])) { $tag_added = get_tag_by_uid($_POST['uid']); // tag exists if ($tag_added) { update_tag($_POST['uid'], $_POST); } else { add_tag($_POST); } } // list all the users $tags = get_all_tags(); $types = get_tag_types(); $uids = get_all_uids(); require 'templates/tags.php'; } else { require 'templates/login.php'; } }