download.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /*
  3. * This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. $file = '/tmp/cvgen.tar';
  15. try {
  16. $a = new PharData($file);
  17. $a->addFile('../cv.html', 'cv/cv.html');
  18. $a->addFile('../demo.html', 'cv/demo.html');
  19. $a->addFile('../cvgen.html', 'cv/cvgen.html');
  20. $a->addFile('../js/cv.js', 'cv/js/cv.js');
  21. $a->addFile('../js/reglages.js', 'cv/js/reglages.js');
  22. $a->addFile('../js/cvgen.js', 'cv/js/cvgen.js');
  23. $a->addFile('../js/info.js', 'cv/js/info.js');
  24. $a->addFile('../js/content.js', 'cv/js/content.js');
  25. $a->addFile('../server/ping.php', 'cv/server/ping.php');
  26. $a->addFile('../server/archive.php', 'cv/server/archive.php');
  27. $a->addFile('../server/download.php', 'cv/server/download.php');
  28. $a->addFile('../js/bootstrap.min.js', 'cv/js/bootstrap.min.js');
  29. $a->addFile('../js/jquery.min.js', 'cv/js/jquery.min.js');
  30. $a->addFile('../js/trianglify.min.js', 'cv/js/trianglify.min.js');
  31. $a->addFile('../js/background.js', 'cv/js/background.js');
  32. $a->addFile('../css/bootstrap.min.css', 'cv/css/bootstrap.min.css');
  33. $a->addFile('../css/cv.css', 'cv/css/cv.css');
  34. $a->addFile('../css/cvgen.css', 'cv/css/cvgen.css');
  35. $a->addFile('../data/demo.json', 'cv/data/demo.json');
  36. $a->addFile('../icons/johndoe.jpg', 'cv/icons/johndoe.jpg');
  37. $a->addFile('../README.md', 'cv/README.md');
  38. $a->addFile('../LICENSE', 'cv/LICENSE');
  39. $a->compress(Phar::GZ);
  40. } catch (Exception $e) {
  41. }
  42. $file= $file. ".gz";
  43. echo "A\n";
  44. if (file_exists($file)) {
  45. header('Content-Description: File Transfer');
  46. header('Content-Type: application/x-tgz');
  47. header('Content-Disposition: attachment; filename='.basename($file));
  48. header('Content-Transfer-Encoding: binary');
  49. header('Content-Length: ' . filesize($file));
  50. ob_clean();
  51. flush();
  52. ob_get_clean();
  53. readfile($file);
  54. ob_end_flush();
  55. unlink($file);
  56. exit;
  57. }
  58. ?>