tiny-slitaz view download.php @ rev 1
Auto-update files.list.lzma
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Aug 21 11:16:18 2012 +0200 (2012-08-21) |
parents | |
children | 577e6e91216d |
line source
1 <?php
3 function download($file,$name='')
4 {
5 if ($name == '')
6 $name = basename($file);
7 if (isset($_POST['tmp_dir']))
8 $file = $_POST['tmp_dir'].$file;
9 $cmd = "cat ".$file;
10 $size = filesize($file);
11 header("Content-Type: application/octet-stream");
12 header("Content-Length: ".$size);
13 header("Content-Disposition: attachment; filename=".$name);
14 print `$cmd`;
15 exit;
16 }
18 if (isset($_POST['download'])) {
19 switch (substr($_POST['download'],0,6)) {
20 case "Kernel" : download("fs/boot/bzImage","kernel");
21 case "Rootfs" : download("rootfs.gz");
22 case "packag" : download("fs/etc/packages.conf");
23 case "Config" : shell_exec("sudo ./helper --mkcfg ".$_POST['tmp_dir']);
24 download("config_files.cpio.gz");
25 case "Floppy" : shell_exec("./helper --mkimg ".$_POST['tmp_dir']);
26 download("slitaz.img");
27 case "ISO im" : shell_exec("sudo ./helper --mkiso ".$_POST['tmp_dir']);
28 download("slitaz.iso");
29 case "System" : download("fs/boot/System.map");
30 case "linux." : download("fs/boot/config","linux.config");
31 case "busybo" : download("fs/boot/config-busybox","busybox.config");
32 case "post_i" : download("post_install.log");
33 }
34 }
35 if (isset($_GET['dl'])) {
36 download(shell_exec("./helper --get-pkg ".$_GET['dl']." ".$_GET['tmp']));
37 }
38 ?>