PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Classes/PHPExcel/Shared/JAMA/docs/download.php

https://bitbucket.org/tedbundyjr/phpexcel
PHP | 65 lines | 10 code | 9 blank | 46 comment | 2 complexity | 4edf14a2f79db9dd99bdb1fae5e4d9f9 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * Script to create REGRESS package for download
  4. *
  5. * @author Mike Bommarito
  6. * @author Paul Meagher
  7. * @version 0.3
  8. * @modified Apr 2, 2006
  9. *
  10. * Note: Script requires the PEAR Archive_Tar package be installed:
  11. *
  12. * @see http://pear.php.net/package/Archive_Tar
  13. */
  14. // name and directory of package
  15. $pkgName = "JAMA";
  16. // root of PHP/Math build directory
  17. $buildDir = substr(dirname(__FILE__), 0, -5 - strlen($pkgName));
  18. // switch to PHP/Math build directory
  19. chdir($buildDir);
  20. $tarName = "$pkgName.tar.gz";
  21. $tarPath = $buildDir.$pkgName."/downloads/".$tarName;
  22. if($_GET['op'] == "download") {
  23. require_once('Archive/Tar.php');
  24. $tar = new Archive_Tar($tarPath);
  25. // create $pkgName archive under $pkgName folder
  26. $files = glob("$pkgName/*.php");
  27. $files = array_merge($files, glob("$pkgName/*.TXT"));
  28. $files = array_merge($files, glob("$pkgName/docs/*.php"));
  29. $files = array_merge($files, glob("$pkgName/docs/includes/*.php"));
  30. $files = array_merge($files, glob("$pkgName/examples/*.php"));
  31. $files = array_merge($files, glob("$pkgName/tests/*.php"));
  32. $files = array_merge($files, glob("$pkgName/utils/*.php"));
  33. $tar->create($files);
  34. // create the download url
  35. $webDir = substr($_SERVER['PHP_SELF'], 0, -18);
  36. $urlPath = "http://".$_SERVER['HTTP_HOST'].$webDir."/downloads";
  37. // redirect to download url
  38. header("Location: $urlPath/$tarName");
  39. }
  40. include_once "includes/header.php";
  41. include_once "includes/navbar.php";
  42. ?>
  43. <p>
  44. Download current version:
  45. </p>
  46. <ul>
  47. <li><a href='<?php echo $_SERVER['PHP_SELF']."?op=download"; ?>'><?php echo $tarName ?></a></li>
  48. </ul>
  49. <?php
  50. include_once "includes/footer.php";
  51. ?>