KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4KB

  1. <?php die("KXStudio pastebin is temporarily disabled"); ?>
  2. <?php
  3. if (file_exists("/home/sites/kxstudio.linuxaudio.org/docroot/paste/")) {
  4. $base_dir = "/home/sites/kxstudio.linuxaudio.org/docroot/paste/";
  5. } else if (file_exists("/var/www/kxstudio/paste/")) {
  6. $base_dir = "/var/www/kxstudio/paste/";
  7. } else {
  8. $base_dir = "/home/groups/k/kx/kxstudio/htdocs/paste/";
  9. }
  10. function downloadFile($fullPath) {
  11. // Must be fresh start
  12. if (headers_sent()) {
  13. die('Headers Sent');
  14. }
  15. // Required for some browsers
  16. if (ini_get('zlib.output_compression')) {
  17. ini_set('zlib.output_compression', 'Off');
  18. }
  19. $fsize = filesize($fullPath);
  20. header("Pragma: public"); // required
  21. header("Expires: 0");
  22. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  23. header("Cache-Control: private", false); // required for certain browsers
  24. header("Content-Type: application/force-download");
  25. header("Content-Disposition: attachment; filename=\"".basename($fullPath)."\";" );
  26. header("Content-Transfer-Encoding: binary");
  27. header("Content-Length: " . $fsize);
  28. ob_clean();
  29. flush();
  30. readfile($fullPath);
  31. }
  32. if (! empty($_GET["id"])) {
  33. $paste_id = htmlspecialchars($_GET["id"]);
  34. $paste_file = $base_dir . "raw/" . $paste_id;
  35. if (! file_exists($paste_file)) {
  36. die("File does not exist");
  37. }
  38. downloadFile($paste_file);
  39. }
  40. ?>