file.php 1004 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. function get_mime_type($name) {
  3. $extension = pathinfo($name, PATHINFO_EXTENSION);
  4. $type = match ($extension) {
  5. "css" => "text/css"
  6. };
  7. return $type;
  8. };
  9. function get_placeholder() {
  10. if (
  11. isset($_COOKIE["images"]) &&
  12. ($_COOKIE["images"] === "disabled" ||
  13. ($_COOKIE["images"] !== "enabled" && (isset($_SERVER["HTTP_SAVE_DATA"]) && $_SERVER["HTTP_SAVE_DATA"] === "on")))
  14. ) {
  15. // Base64-encoded gray (50% opacity) PNG pixel
  16. return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNsqAcAAYUBAdpOiIkAAAAASUVORK5CYII=";
  17. };
  18. };
  19. function proxy_file($ch) {
  20. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  21. curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($ch, $data) {
  22. echo $data;
  23. return strlen($data);
  24. });
  25. $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
  26. header("Content-Type: " . ($contentType ?: "application/octet-stream"));
  27. curl_exec($ch);
  28. };
  29. ?>