slitaz-dev-tools rev 159

dir-generator.php: fix dates
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 14 19:02:31 2012 +0100 (2012-03-14)
parents 4bea43b9ed45
children e9cd3d0d6e6e
files mirror-tools/slitaz/mirror/dir-generator.php
line diff
     1.1 --- a/mirror-tools/slitaz/mirror/dir-generator.php	Tue Mar 13 16:31:07 2012 +0100
     1.2 +++ b/mirror-tools/slitaz/mirror/dir-generator.php	Wed Mar 14 19:02:31 2012 +0100
     1.3 @@ -143,10 +143,11 @@
     1.4  }
     1.5  
     1.6  //$slitaz_style = (dirname($_SERVER["PHP_SELF"]) == '/');
     1.7 -$slitaz_style = ($_SERVER["SERVER_NAME"] == "mirror.slitaz.org");
     1.8 +//$slitaz_style = ($_SERVER["SERVER_NAME"] == "mirror.slitaz.org");
     1.9 +$slitaz_style = preg_match("/mirror\.slitaz\./",$_SERVER["SERVER_NAME"]);
    1.10  if ($slitaz_style) {
    1.11  	$fvalue = "";
    1.12 -	if (isset($_GET[f])) $fvalue = 'value="'.$_GET[f].'"';
    1.13 +	if (isset($_GET['f'])) $fvalue = 'value="'.$_GET['f'].'"';
    1.14  	print <<<EOT
    1.15  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    1.16  	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    1.17 @@ -181,6 +182,7 @@
    1.18  		<a href="http://forum.slitaz.org/">Forum</a>
    1.19  		<a href="http://bugs.slitaz.org">Bugs</a>
    1.20  		<a href="http://hg.slitaz.org/">Hg</a>
    1.21 +		<a href="http://cook.slitaz.org/">BB</a>
    1.22  	</div>
    1.23  	<h1><a href="http://mirror.slitaz.org/">SliTaz Mirror</a> /${vpath}</h1>
    1.24  </div>
    1.25 @@ -223,7 +225,7 @@
    1.26  	<div id="block_info">
    1.27  		<h4>Welcome to Open Source!</h4>
    1.28  EOT;
    1.29 -	if ($_SERVER["SERVER_NAME"] == "mirror.slitaz.org") print <<<EOT
    1.30 +	if (preg_match("/mirror\.slitaz\./",$_SERVER["SERVER_NAME"])) print <<<EOT
    1.31  		<p>This is the SliTaz GNU/Linux main mirror. The server runs naturally 
    1.32  		SliTaz (stable) in an lguest virtual machine provided by 
    1.33  		<a href="http://www.ads-lu.com/">ADS</a>.
    1.34 @@ -298,6 +300,11 @@
    1.35  	return rtrim(shell_exec("stat -Lc %Y '".$path."'"));
    1.36  }
    1.37  
    1.38 +function my_filemtimeasc($path)	// 2G+ file support
    1.39 +{
    1.40 +	return rtrim(shell_exec("date -r '".$path."' '+%Y-%b-%d %H:%M:%S'"));
    1.41 +}
    1.42 +
    1.43  // Get all of the folders and files. 
    1.44  $folderlist = array();
    1.45  $filelist = array();
    1.46 @@ -316,6 +323,7 @@
    1.47  				'name' => $item, 
    1.48  				'size' => 0, 
    1.49  				'modtime'=> filemtime($path.'/'.$item),
    1.50 +				'modtimeasc'=> my_filemtimeasc($path.'/'.$item),
    1.51  				'file_type' => "Directory"
    1.52  			);
    1.53  		}
    1.54 @@ -329,6 +337,7 @@
    1.55  				'name'=> $item, 
    1.56  				'size'=> my_filesize($path.'/'.$item), 
    1.57  				'modtime'=> my_filemtime($path.'/'.$item),
    1.58 +				'modtimeasc'=> my_filemtimeasc($path.'/'.$item),
    1.59  				'file_type' => get_file_type($path.'/'.$item)
    1.60  			);
    1.61  		}
    1.62 @@ -394,7 +403,7 @@
    1.63  // Print folder information
    1.64  foreach($folderlist as $folder) {
    1.65  	print "<tr><td class='n'><a href='" . addslashes($folder['name']). "'>" .htmlentities($folder['name']). "</a>/</td>";
    1.66 -	print "<td class='m'>" . date('Y-M-d H:m:s', $folder['modtime']) . "</td>";
    1.67 +	print "<td class='m'>" . $folder['modtimeasc'] . "</td>";
    1.68  	print "<td class='s'>- &nbsp;</td>";
    1.69  	print "<td class='t'>" . $folder['file_type']                    . "</td></tr>\n";
    1.70  }
    1.71 @@ -403,7 +412,7 @@
    1.72  // Print file information
    1.73  foreach($filelist as $file) {
    1.74  	print "<tr><td class='n'><a href='" . addslashes($file['name']). "'>" .htmlentities($file['name']). "</a></td>";
    1.75 -	print "<td class='m'>" . date('Y-M-d H:m:s', $file['modtime'])   . "</td>";
    1.76 +	print "<td class='m'>" . $file['modtimeasc'] . "</td>";
    1.77  	print "<td class='s'>" . format_bytes($file['size'])           . "</td>";
    1.78  	print "<td class='t'>" . $file['file_type']                      . "</td></tr>\n";
    1.79  }
    1.80 @@ -437,6 +446,12 @@
    1.81  		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
    1.82  		<a href="http://flattr.com/profile/slitaz">Flattr</a>
    1.83  	</p>
    1.84 +	<p>
    1.85 +		<a href="http://validator.w3.org/check?uri=referer">
    1.86 +			<img src="/css/pics/website/xhtml10.png" 
    1.87 +			     alt="Valid XHTML 1.0" title="Code validé XHTML 1.0"
    1.88 +			     style="width: 80px; height: 15px;" /></a>
    1.89 +	</p>
    1.90  </div>
    1.91  
    1.92  <?php }