slitaz-forge view mirror/floppies/download.php @ rev 599

Remove chub
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Sep 19 16:15:43 2015 +0200 (2015-09-19)
parents e6e4be1b2591
children 4ea260d6c590
line source
1 <?php
3 $fdsz=80*18*1024;
4 $cpiopad=512;
5 function download($name, $size, $cmd)
6 {
7 header("Content-Type: application/octet-stream");
8 header("Content-Length: ".$size);
9 header("Content-Disposition: attachment; filename=".$name);
10 echo `$cmd 2> /dev/null`;
11 exit;
12 }
14 function my_filesize($path) // 2G+ file support
15 {
16 return rtrim(shell_exec("stat -c %s '".$path."'"));
17 }
19 if (isset($_GET['iso']))
20 $_POST['iso'] = $_GET['iso'];
22 if (isset($_GET['file']))
23 {
24 $max = floor((my_filesize("../".$_GET["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
25 $cmd = "cd ../".dirname($_GET['iso'])."; ls ".
26 basename($_GET['iso'],".iso").".*".
27 " | cpio -o -H newc | cat - /dev/zero ";
28 if ($_GET['file'] == "md5sum") {
29 $cmd .= "| for i in \$(seq 1 $max); do dd bs=$fdsz ".
30 "count=1 2> /dev/null | md5sum | ".
31 "sed \"s/-\\\$/\$(printf 'fdiso%02d.img' \$i)/\"; done";
32 download("md5sum", 46 * $max, $cmd);
33 }
34 else {
35 $cmd .= "| dd bs=".$fdsz." count=1 skip=".($_GET['file'] - 1)." ";
36 download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
37 }
38 }
39 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
40 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41 <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
42 <head>
43 <title>SliTaz Boot Floppies</title>
44 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
45 <meta name="description" content="slitaz boot floppies" />
46 <meta name="robots" content="index, nofollow" />
47 <meta name="author" content="SliTaz Contributors" />
48 <link rel="shortcut icon" href="static/favicon.ico" />
49 <link rel="stylesheet" type="text/css" href="static/slitaz.css" />
50 <style type="text/css">
51 table {
52 background-color: inherit;
53 margin: 10px 0px 0px 0px;
54 }
55 #copy {
56 text-align: center;
57 }
59 #bottom {
60 text-align: center;
61 }
63 #block_nav {
64 padding: 10px 10px 10px;
65 }
66 </style>
67 </head>
68 <body bgcolor="#ffffff">
69 <!-- Header -->
70 <div id="header">
71 <a name="top"></a>
72 <div id="logo"></div>
73 <div id="network">
74 <a href="http://www.slitaz.org/">
75 <img src="static/home.png" alt="[ home ]" /></a>
76 <a href="floppy-grub4dos" title="Boot tools">Generic boot floppy</a>
77 <a href="http://tiny.slitaz.org/" title="SliTaz in one floppy !">Tiny SliTaz</a>
78 <a href="builder/index.php" title="Build floppies with your own kernel and initramfs">Floppy set web builder</a>
79 <a href="builder/bootloader" title="Build your floppy sets without Internet">Shell builder</a>
80 </div>
81 <h1><a href="http://www.slitaz.org/">Boot floppies</a></h1>
82 </div>
84 <!-- Block -->
85 <div id="block">
86 <!-- Navigation -->
87 <div id="block_nav">
88 <h4><img src="pics/floppy.png" alt="@" />Download 1.44Mb images for <?php $dir = explode('/',$_POST["iso"]); echo $dir[1]; ?></h4>
89 <table width="100%">
90 <?php
91 $max = floor((my_filesize("../".$_POST["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
92 for ($i = 1; $i <= $max ; $i++) {
93 if ($i % 6 == 1) echo "<tr>\n";
94 echo " <td> <a href=\"download.php?file=$i&amp;iso=".
95 urlencode($_POST["iso"])."\">fdiso".sprintf("%02d",$i);
96 echo "</a> </td>\n";
97 if ($i % 6 == 0) echo "</tr>\n";
98 }
99 if ($max % 6 != 0) {
100 while ($max % 6 != 5) { echo "<td></td>"; $max++; }
101 }
102 else echo "<tr>\n";
103 echo " <td><a href=\"download.php?file=md5sum&amp;iso=".
104 urlencode($_POST["iso"])."\">md5</a></td>\n</tr>";
105 ?>
106 </table>
107 </div>
108 <!-- Information/image -->
109 <div id="block_info">
110 <h4>Available boot floppies</h4>
111 <ul>
112 <?php
113 for ($i = 1; file_exists("index-$i.0.html") ; $i++);
114 while (--$i > 0) {
115 echo " <li><a href=\"index-$i.0.html\">SliTaz $i.0</a>";
116 if (file_exists("index-loram-".$i.".0.html"))
117 echo " - <a href=\"index-loram-$i.0.html\">loram</a>";
118 echo "</li>\n";
119 }
120 ?>
121 </ul>
122 </div>
123 </div>
125 <!-- Content top. -->
126 <div id="content_top">
127 <div class="top_left"></div>
128 <div class="top_right"></div>
129 </div>
131 <!-- Content -->
132 <div id="content">
134 <h2>ISO image floppy set</h2>
136 <p>
137 You can restore the <a href="../<?php echo $_POST['iso'].
138 '">'.basename($_POST['iso']); ?></a> ISO image on your hard disk using :
139 </p>
140 <pre>
141 # dd if=/dev/fd0 of=fdiso01.img
142 # dd if=/dev/fd0 of=fdiso02.img
143 # ...
144 # cat fdiso*.img | cpio -i
145 </pre>
147 <!-- End of content with round corner -->
148 </div>
149 <div id="content_bottom">
150 <div class="bottom_left"></div>
151 <div class="bottom_right"></div>
152 </div>
154 <!-- Start of footer and copy notice -->
155 <div id="copy">
156 <p>
157 Copyright &copy; <?php echo date('Y'); ?> <a href="http://www.slitaz.org/">SliTaz</a> -
158 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
159 </p>
160 <!-- End of copy -->
161 </div>
163 <!-- Bottom and logo's -->
164 <div id="bottom">
165 <p>
166 <a href="http://validator.w3.org/check?uri=referer"><img src="static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
167 </p>
168 <p>
169 <script type="text/javascript" src="static/qrcode.js"></script>
170 <img src="#" id="qrcodeimg" alt="#" width="60" height="60"
171 onmouseover="this.title = location.href"
172 onclick="this.width = this.height += 100;" />
173 <script type="text/javascript">
174 document.getElementById('qrcodeimg').src =
175 QRCode.generatePNG(location.href, {ecclevel: 'H'});
176 </script>
177 </p>
178 </div>
180 </body>
181 </html>