ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
download.php
Go to the documentation of this file.
1 <?php
15 // name and directory of package
16 $pkgName = "JAMA";
17 
18 // root of PHP/Math build directory
19 $buildDir = substr(dirname(__FILE__), 0, -5 - strlen($pkgName));
20 
21 // switch to PHP/Math build directory
22 chdir($buildDir);
23 
24 $tarName = "$pkgName.tar.gz";
25 
26 $tarPath = $buildDir.$pkgName."/downloads/".$tarName;
27 
28 if($_GET['op'] == "download") {
29 
30  require_once('Archive/Tar.php');
31 
32  $tar = new Archive_Tar($tarPath);
33 
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"));
42 
43  $tar->create($files);
44 
45  // create the download url
46  $webDir = substr($_SERVER['PHP_SELF'], 0, -18);
47  $urlPath = "http://".$_SERVER['HTTP_HOST'].$webDir."/downloads";
48 
49  // redirect to download url
50  header("Location: $urlPath/$tarName");
51 
52 }
53 
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 ?>