File Source for download.php

PHPExcel

# Source for file download.php

Documentation is available at download.php

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. */
15. // name and directory of package
16. $pkgName = "JAMA";
18. // root of PHP/Math build directory
19. $buildDir = substr( dirname(__FILE__), 0, -5 - strlen($pkgName));
21. // switch to PHP/Math build directory
22. chdir($buildDir);
24. $tarName = "$pkgName.tar.gz";
26. $tarPath = $buildDir.$pkgName."/downloads/".$tarName;
28. if($_GET['op'] == "download") {
30. require_once('Archive/Tar.php');
32. $tar = new Archive_Tar($tarPath);
34. // create $pkgName archive under $pkgName folder
35. $files = glob("$pkgName/*.php");
36. $files = array_merge($files, glob("$pkgName/*.TXT"));
37. $files = array_merge($files, glob("$pkgName/docs/*.php"));
38. $files = array_merge($files, glob("$pkgName/docs/includes/*.php"));
39. $files = array_merge($files, glob("$pkgName/examples/*.php"));
40. $files = array_merge($files, glob("$pkgName/tests/*.php"));
41. $files = array_merge($files, glob("$pkgName/utils/*.php"));
43. $tar->create($files);
45. // create the download url
46. $webDir = substr($_SERVER['PHP_SELF'], 0, -18);
47. $urlPath = "http://".$_SERVER['HTTP_HOST'].$webDir."/downloads";
49. // redirect to download url
50. header("Location: $urlPath/$tarName");
52. }
54. include_once "includes/header.php";
55. include_once "includes/navbar.php";
56. ?>
57. <p>
58. Download current version:
59. </p>
60. <ul>
61. <li><a href='<?php echo $_SERVER['PHP_SELF']."?op=download"; ?>'><?php echo $tarName ?></a></li>
62. </ul>
63. <?php
64. include_once "includes/footer.php";
65. ?>

Documentation generated on Sun, 27 Feb 2011 16:30:14 -0800 by phpDocumentor 1.4.3