, * Pascal Bellard * Christophe Lincoln * * * GNU License Agreement * --------------------- * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * http://www.gnu.org/licenses/gpl.txt */ // Get the path (cut out the query string from the request_uri) list($path) = explode('?', $_SERVER['REQUEST_URI']); // Get the path that we're supposed to show. $path = ltrim(rawurldecode($path), '/'); if(strlen($path) == 0) $path = "./"; // Can't call the script directly since REQUEST_URI won't be a directory if($_SERVER['PHP_SELF'] == '/' . $path) { redirect(); // die("Unable to call " . $path . " directly."); } $vpath = ($path != "./") ? $path : ""; // Make sure it is valid. if (!is_dir($path)) { // die("" . $path . " is not a valid path."); $path = dirname($_SERVER["SCRIPT_FILENAME"]); list($vpath) = explode('?', $_SERVER['REQUEST_URI']); $vpath = ltrim(rawurldecode($vpath), '/'); } // // This function returns the file size of a specified $file. // function format_bytes($size, $precision=1) { $sizes = array('Y', 'Z', 'E', 'P', 'T', 'G', 'M', 'K', ''); $total = count($sizes); while ($total-- && $size > 1024) $size /= 1024; if ($sizes[$total] == '') { $size /= 1024; $total--; } return sprintf('%.' . $precision . 'f', $size) . $sizes[$total]; } // // Get some variables from /etc/lighttpd/lighttpd.conf // $conf_lightty = file_get_contents("/etc/lighttpd/lighttpd.conf"); function get_conf($var, $start, $stop, $default='') { global $conf_lightty; if (!preg_match('/' . $var . '/', $conf_lightty)) return $default; $filter = '/(.*\n)*' . $var . '\s*=\s*' . $start . '(([^' . $stop . ']*\n*)*)' . $stop . '(.*\n)*/'; return preg_replace($filter, '$2', $conf_lightty); } $encoding = get_conf('dir-listing.encoding', '"', '"', 'ascii'); $external_css = get_conf('dir-listing.external-css', '"', '"'); $show_hidden_files = false; if (get_conf('dir-listing.hide-dotfile', '"', '"', 'disable') == "disable") $show_hidden_files = true; // get_conf('dir-listing.exclude','\(','\)'); // get_conf('dir-listing.set-footer','"','"'); $mime_types = array(); foreach (explode(',', get_conf('mimetype.assign','\(','\)')) as $item) { $filter = '/\s*"(.*)"\s*=>\s*"(.*)".*/'; $val = explode(',', preg_replace($filter, '$1,$2', $item)); if (isset($val[1])) $mime_types[$val[0]] = $val[1]; } // // This function returns the mime type of $file. // function get_file_type($file) { global $mime_types; $file = basename($file); $default_type = "application/octet-stream"; if (isset($mime_types[$file])) return $mime_types[$file]; $pos = strrpos($file, "."); if ($pos === false) return $default_type; //FIXME .tar.gz $ext = '.' . rtrim(substr($file, $pos+1), "~"); if (isset($mime_types[$ext])) return $mime_types[$ext]; return $default_type; } //$slitaz_style = (dirname($_SERVER["PHP_SELF"]) == '/'); //$slitaz_style = ($_SERVER["SERVER_NAME"] == "mirror1.slitaz.org"); $slitaz_style = preg_match("/mirror1\.slitaz\./", $_SERVER["SERVER_NAME"]); if (!$slitaz_style) $slitaz_style = preg_match("/mirror\.slitaz\./", $_SERVER["SERVER_NAME"]); if ($slitaz_style) { // SliTaz Style $modified = gmdate("D, d M Y H:i:s e", strtotime("-1 hour")); $expires = gmdate("D, d M Y H:i:s e", strtotime("+1 hour")); $fvalue = ""; if (isset($_GET['f'])) $fvalue = 'value="' . $_GET['f'] . '"'; header("Expires: " . $expires); header("Last-Modified: " . $modified); header('Referrer-policy: "no-referrer"'); header("Pragma: cache"); // header("Cache-Control: public"); // // // print " Index of /$vpath "; ?>

SliTaz Mirror

Welcome to Open Source!

This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz (stable) in a virtual machine gracefully hosted by balinor-technologies and is located in France.

Mirror info...

This is a SliTaz GNU/Linux mirror. The server is synchronized regularly with the Slitaz main mirror

$url) { print "$name\n"; } } print "
"; // end SliTaz Style } else { // not SliTaz Style // Print the heading stuff print " Index of /$vpath "; if ($external_css != '') { print " "; } else { print " "; } print "

Index of /$vpath

"; // end not SliTaz Style } print "
Path: /$vpath
"; function my_is_file($path) { // 2G+ file support exec("[ -f '" . $path . "' ]", $tmp, $ret); return $ret == 0; //return is_file($path); } function my_filesize($path) { // 2G+ file support return rtrim(shell_exec("stat -Lc %s '" . $path . "'")); //return filesize($path); } function my_filemtime($path) { // 2G+ file support return rtrim(shell_exec("stat -Lc %Y '" . $path . "'")); //return filemtime($path); } function my_filemtimeasc($path) { // 2G+ file support return rtrim(shell_exec("LC_ALL=C date -r '" . $path . "' '+%Y-%b-%d %H:%M:%S'")); //return date('Y-M-d H:m:s', filemtime($path)); } if (filesize($path . "/.folderlist") > 0 && filesize($path . "/.filelist") > 0 && filemtime($path . "/.filelist") > filemtime($path)) { $folderlist = unserialize(file_get_contents($path . "/.folderlist")); $filelist = unserialize(file_get_contents($path . "/.filelist")); } else { proc_nice(10); // Get all of the folders and files. $folderlist = array(); $filelist = array(); if($handle = @opendir($path)) { while(($item = readdir($handle)) !== false) { if ($item == "index.php") continue; if ($item == ".folderlist") continue; if ($item == ".filelist") continue; if ($item == "dir-generator.php") continue; if ($item == "robots.txt") continue; if ($item == "humans.txt") continue; if ($item == "mirrors.html") continue; if (is_dir($path.'/'.$item) and $item != '.' and $item != '..') { $folderlist[] = array( 'name' => $item, 'size' => 0, 'modtime'=> filemtime($path . '/' . $item), 'modtimeasc'=> my_filemtimeasc($path . '/' . $item), 'file_type' => "Directory" ); } elseif (my_is_file($path . '/' . $item)) { if (!$show_hidden_files) { if (substr($item, 0, 1) == "." or substr($item, -1) == "~") continue; } $filelist[] = array( 'name'=> $item, 'size'=> my_filesize($path . '/' . $item), 'modtime'=> my_filemtime($path . '/' . $item), 'modtimeasc'=> my_filemtimeasc($path . '/' . $item), 'file_type' => get_file_type($path . '/' . $item) ); } } closedir($handle); file_put_contents($path . "/.folderlist", serialize($folderlist), LOCK_EX); file_put_contents($path . "/.filelist", serialize($filelist), LOCK_EX); } } if (isset($_GET['f'])) { $filter = $_GET['f']; if (substr($filter, 0, 1) != '/') $filter = '/' . $filter . '/i'; foreach ($filelist as $key => $value) if (!preg_match($filter, $value['name'])) unset($filelist[$key]); foreach ($folderlist as $key => $value) if (!preg_match($filter, $value['name'])) unset($folderlist[$key]); } if (!isset($_GET['s'])) $_GET['s'] = 'name'; // Figure out what to sort files by $file_order_by = array(); foreach ($filelist as $key => $row) $file_order_by[$key] = $row[$_GET['s']]; // Figure out what to sort folders by $folder_order_by = array(); foreach ($folderlist as $key => $row) $folder_order_by[$key] = $row[$_GET['s']]; // Order the files and folders $sort_type = SORT_ASC; $order = "&o=d"; if (isset($_GET['o'])) { $sort_type = SORT_DESC; $order = ""; } array_multisort($folder_order_by, $sort_type, $folderlist); array_multisort($file_order_by, $sort_type, $filelist); // Table caption: number of folders and files print ""; // Show sort methods print ""; $sort_methods = array(); $sort_methods['name'] = "Name"; $sort_methods['modtime'] = "Last Modified"; $sort_methods['size'] = "Size"; foreach($sort_methods as $key => $item) { if ($_GET['s'] == $key) $key = "$key$order"; print ""; } print "\n\n"; // Parent directory link if ($path != "./") print "" . "" . "\n"; // Print folder information foreach($folderlist as $folder) print "" . "" . "\n"; // Print file information foreach($filelist as $file) { $filename = $file['name']; $url = addslashes($filename); if (preg_match('/\.(tazpkg|deb)$/', $filename)) $class = "pkg"; elseif (preg_match('/\.iso$/', $filename)) $class = "iso"; elseif (preg_match('/\.(exe|com)$/', $filename)) $class = "exe"; elseif (preg_match('/^README$/', $filename)) $class = "rme"; elseif (preg_match('/^bzImage$/', $filename)) $class = "krn"; elseif (preg_match('/\.zip$/', $filename)) $class = "zip"; elseif (preg_match('/\.log$/', $filename)) $class = "log"; else { $classes = explode('/', $file['file_type']); $class = $classes[1]; } print "" . "" . "\n"; } // Print ending stuff print "
" . count($folderlist) . " folders and " . count($filelist) . " files.
$item
Parent Directory/ -  
" . htmlentities($folder['name']) . "/" . $folder['modtimeasc'] . "-  
" . htmlentities($filename) . "" . $file['modtimeasc'] . " #" . format_bytes($file['size']) . "
"; $soft = explode('/', $_SERVER["SERVER_SOFTWARE"]); $tag = get_conf('server.tag', '"', '"', $soft[0] . ' <' . $soft[1] . '>'); if (filesize($path . "/README")) print "
" .
		preg_replace('!(((f|ht)tp(s)?://)[-a-zA-Z()0-9@:%_+.~#?&;//=]+)!i',
			'$1', file_get_contents($path . "/README")) .
		"
\n"; if ($slitaz_style) { // SliTaz Style ?>
" . $tag . "
"; // end not SliTaz Style } print " "; ?>