tiny-slitaz diff download.php @ rev 32

Do not suggest packages twice
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Sep 26 13:55:40 2019 +0200 (2019-09-26)
parents cb1743f12df8
children
line diff
     1.1 --- a/download.php	Tue Sep 17 08:38:04 2019 +0200
     1.2 +++ b/download.php	Thu Sep 26 13:55:40 2019 +0200
     1.3 @@ -2,6 +2,8 @@
     1.4  
     1.5  function download($file,$name='')
     1.6  {
     1.7 +	$files = explode(" ",$file);
     1.8 +	$file = $files[0];
     1.9  	if ($name == '')
    1.10  		$name = basename($file);
    1.11  	if (isset($_POST['tmp_dir']))
    1.12 @@ -18,14 +20,12 @@
    1.13  if (isset($_POST['download'])) {
    1.14  	switch (substr($_POST['download'],0,6)) {
    1.15  	case "Kernel" : download("fs/boot/bzImage","kernel");
    1.16 -	case "Memtes" : download("fs/boot/memtest");
    1.17 -	case "GPXE (" : download("fs/boot/gpxe");
    1.18 -	case "IPXE (" : download("fs/boot/ipxe");
    1.19  	case "Rootfs" : download("rootfs.gz");
    1.20  	case "packag" : download("fs/etc/packages.conf");
    1.21  	case "Config" : shell_exec("sudo ./helper --mkcfg ".$_POST['tmp_dir']); 
    1.22  			download("config_files.cpio.gz");
    1.23  	case "Floppy" : $n=substr($_POST['download'],6,1);
    1.24 +			if ($n == " ") $n="1";
    1.25  			shell_exec("./helper --mkimg ".$_POST['tmp_dir']." ".
    1.26  			$_POST['fdsize']." ".$n); 
    1.27  			download("floppy".$n.".img");
    1.28 @@ -37,6 +37,7 @@
    1.29  	case "linux." : download("fs/boot/config","linux.config");
    1.30  	case "busybo" : download("fs/boot/config-busybox","busybox.config");
    1.31  	case "post_i" : download("post_install.log");
    1.32 +	default       : download("fs/boot/".strtolower($_POST['download']));
    1.33  	}
    1.34  }
    1.35  if (isset($_GET['dl'])) {