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) { $services[] = get_reader_service($service_id); } $reader['services'] = $services; $response = array("version" => $version, "response" => $reader); echo json_encode($response); } elseif ('readers' == $_GET['uri']) { send_headers(); $readers = get_all_readers(); $response = array("version" => $version, "response" => $readers); echo json_encode($response); } elseif ('payments' == $_GET['uri'] && isset($_GET['id'])) { send_headers();
function modify_reader_action($session_uid, $id) { // needed to set the tab active $readers_active = true; //check if the user is admin if (user_is_admin($session_uid)) { $reader = get_reader_by_id($id); require 'templates/reader.php'; } else { require 'templates/login.php'; } }