| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 | 2 |
| 3 function getReferrerPath() { | 3 function getReferrerPath() { |
| 4 if (!isset($_SERVER["HTTP_REFERER"])) | 4 if (!isset($_SERVER["HTTP_REFERER"])) |
| 5 return ""; | 5 return ""; |
| 6 $url = parse_url($_SERVER["HTTP_REFERER"]); | 6 $url = parse_url($_SERVER["HTTP_REFERER"]); |
| 7 return $url['path']; | 7 return $url['path']; |
| 8 } | 8 } |
| 9 | 9 |
| 10 function putImage() { | 10 function putImage() { |
| 11 $image = "../../resources/square100.png"; | 11 $image = "../../resources/square100.png"; |
| 12 header("Content-Type: image/png"); | 12 header("Content-Type: image/png"); |
| 13 header("Content-Length: " . filesize($image)); | 13 header("Content-Length: " . filesize($image)); |
| 14 header("Access-Control-Allow-Origin: *"); | 14 header("Access-Control-Allow-Origin: *"); |
| 15 ob_clean(); | 15 ob_clean(); |
| 16 flush(); | 16 flush(); |
| 17 readfile($image); | 17 readfile($image); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function putFont() { | 20 function putFont() { |
| 21 $font = "../../../../resources/Ahem.ttf"; | 21 $font = "../../resources/Ahem.ttf"; |
| 22 header("Content-Type: font/truetype"); | 22 header("Content-Type: font/truetype"); |
| 23 header("Content-Length: " . filesize($font)); | 23 header("Content-Length: " . filesize($font)); |
| 24 header("Access-Control-Allow-Origin: *"); | 24 header("Access-Control-Allow-Origin: *"); |
| 25 ob_clean(); | 25 ob_clean(); |
| 26 flush(); | 26 flush(); |
| 27 readfile($font); | 27 readfile($font); |
| 28 } | 28 } |
| 29 | 29 |
| 30 $expectedReferrerPaths = array( | 30 $expectedReferrerPaths = array( |
| 31 "document" => "/css/css-resources-referrer.html", | 31 "document" => "/css/css-resources-referrer.html", |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 if ($resource === "image" || $resource === "image2") | 42 if ($resource === "image" || $resource === "image2") |
| 43 putImage(); | 43 putImage(); |
| 44 else if ($resource === "font") | 44 else if ($resource === "font") |
| 45 putFont(); | 45 putFont(); |
| 46 else | 46 else |
| 47 header("HTTP/1.1 500 Internal Server Error"); | 47 header("HTTP/1.1 500 Internal Server Error"); |
| 48 } else { | 48 } else { |
| 49 header("HTTP/1.1 500 Internal Server Error"); | 49 header("HTTP/1.1 500 Internal Server Error"); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ?> | 52 ?> |
| OLD | NEW |