ext.php 911 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. if (!isset($_GET['e'])) {
  3. header('HTTP/1.1 400 Bad Request');
  4. die();
  5. }
  6. $extension = substr($_GET['e'], 0, 64);
  7. if (!ctype_alpha($extension)) {
  8. header('HTTP/1.1 400 Bad Request');
  9. die();
  10. }
  11. require('../constants.php');
  12. $filename = FRESHRSS_PATH . '/extensions/' . $extension . '/';
  13. if (isset($_GET['j'])) {
  14. header('Content-Type: application/javascript; charset=UTF-8');
  15. header('Content-Disposition: inline; filename="script.js"');
  16. $filename .= 'script.js';
  17. } elseif (isset($_GET['c'])) {
  18. header('Content-Type: text/css; charset=UTF-8');
  19. header('Content-Disposition: inline; filename="style.css"');
  20. $filename .= 'style.css';
  21. } else {
  22. header('HTTP/1.1 400 Bad Request');
  23. die();
  24. }
  25. $mtime = @filemtime($filename);
  26. if ($mtime == false) {
  27. header('HTTP/1.1 404 Not Found');
  28. die();
  29. }
  30. require(LIB_PATH . '/http-conditional.php');
  31. if (!httpConditional($mtime, 604800, 2)) {
  32. readfile($filename);
  33. }