getProject(); $customers = Core::$user->getCustomers(); $customer_ids = array_column($customers, "id"); if(!in_array($project->customer_id, $customer_ids)) throw new Exception(__("You do not have permission to access this resource.")); } if(!$is_pdf) { if(!Core::$user->canVerifyTests()) { if(Core::$user->id != $test->tester_id) throw new Exception(__("You do not have permission to access this resource.")); } } $directory = $test->getDirectory(); $path_jpg = $directory . "/" . $name . ".jpg"; $path_pdf = $directory . "/" . $name . ".pdf"; if(file_exists($path_jpg)) { header("Content-Type: image/jpeg"); readfile($path_jpg); } else if(file_exists($path_pdf)) { header("Content-Type: application/pdf"); readfile($path_pdf); } else { header("Content-Type: image/png"); readfile("public/img/blank.png"); }