3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2011 Cool Dude 2k - http://idb.berlios.de/
12 Copyright 2004-2011 Game Maker 2k - http://intdb.sourceforge.net/
14 $FileInfo: index.php - Last Update: 01/04/2011 Ver. 2.0.5 RC 1 - Author: cooldude2k $
16 $disfunc = @ini_get("disable_functions");
17 $disfunc = @trim($disfunc);
18 $disfunc = @preg_replace("/([\\s+|\\t+|\\n+|\\r+|\\0+|\\x0B+])/i", "", $disfunc);
19 if($disfunc!="ini_set") { $disfunc = explode(",",$disfunc); }
20 if($disfunc=="ini_set") { $disfunc = array("ini_set"); }
21 if(!in_array("ini_set", $disfunc)) {
22 /* Change to your url. */
23 @ini_set("html_errors", false);
24 @ini_set("track_errors", false);
25 @ini_set("display_errors", false);
26 @ini_set("report_memleaks", false);
27 @ini_set("display_startup_errors", false);
28 //@ini_set("error_log","logs/error.log");
29 //@ini_set("log_errors","On");
30 @ini_set("docref_ext", "");
31 @ini_set("docref_root", "http://php.net/");
32 @ini_set("date.timezone","UTC");
33 @ini_set("default_mimetype","text/html"); }
34 if(!defined("E_DEPRECATED")) { define("E_DEPRECATED", 0); }
35 @error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
36 @set_time_limit(30); @ignore_user_abort(true);
37 if(function_exists("date_default_timezone_set")) {
38 @date_default_timezone_set("UTC"); }
39 function idb_output_handler($buffer) { return $buffer; }
40 @ob_start("idb_output_handler");
41 header("Cache-Control: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
42 header("Pragma: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
43 header("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
44 header("Date: ".gmdate("D, d M Y H:i:s")." GMT");
45 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
46 header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
47 output_reset_rewrite_vars();
48 $urltype = 1;//URL type to use can be 1 or 2
49 $urlview = "html";//URL view type can be html or view
50 $dirstyle = "old";//DIR list style can be old, new. :P
51 $url = "http://localhost/srcview/";//Program url path
52 $sourcedir = "./tarball";//Program url path
53 $urlfname = "index.php";//Not used dont ask why its here. :P
54 $appname = "TAR Source Viewer";//Name of program also not used. :P
55 $dwntarlink = "dwntargz";
56 $downloadlink = "downloadgz";
57 $appver = array(2,0,5,"RC 1");//Version of program
58 $PathSep = ":";//You can set this to : ! @ ;
59 //$PathSep = "!"; $PathSep = "@"; $PathSep = ";";
60 $dir_image = "icnres/dir.gif";
61 $unknown_image = "icnres/unknown.gif";
62 $back_image = "icnres/back.gif";
63 //List of text type files
64 $txt_type = "htm,html,php,txt,xml,xsl,js,css,htaccess,null,";
65 $txt_type = explode(",",$txt_type);
66 //List of text mime types
67 $txt_mine_type = array(
68 "htm" => "text/plain",
69 "html" => "text/plain",
70 "php" => "text/plain",
71 "txt" => "text/plain",
72 "xml" => "text/plain",
73 "xsl" => "text/plain",
75 "css" => "text/plain",
76 "htaccess" => "text/plain",
77 "null" => "text/plain",
79 //List of text highlight types
80 $txt_highlight_type = array(
81 "htm" => "highlight_php_source",
82 "html" => "highlight_php_source",
83 "php" => "highlight_php_source",
84 "txt" => "highlight_php_source",
85 "xml" => "highlight_php_source",
86 "xsl" => "highlight_php_source",
87 "js" => "highlight_php_source",
88 "css" => "highlight_php_source",
89 "htaccess" => "highlight_php_source",
90 "null" => "highlight_php_source",
91 "" => "highlight_php_source");
94 "htm" => "icnres/text.gif",
95 "html" => "icnres/text.gif",
96 "php" => "icnres/text.gif",
97 "txt" => "icnres/text.gif",
98 "xml" => "icnres/text.gif",
99 "xsl" => "icnres/text.gif",
100 "js" => "icnres/text.gif",
101 "css" => "icnres/text.gif",
102 "htaccess" => "icnres/text.gif",
103 "null" => "icnres/text.gif",
104 "" => "icnres/text.gif");
105 //List of image type files
106 $img_type = "gif,png,ico,jpg,jpeg,jpe,bmp";
107 $img_type = explode(",",$img_type);
108 //List of image mime types
109 $img_mine_type = array(
110 "gif" => "image/gif",
111 "png" => "image/png",
112 "ico" => "image/x-icon",
113 "jpg" => "image/jpeg",
114 "jpeg" => "image/jpeg",
115 "jpe" => "image/jpeg",
116 "bmp" => "image/bmp");
117 //List of image images
119 "gif" => "icnres/image.gif",
120 "png" => "icnres/image.gif",
121 "ico" => "icnres/image.gif",
122 "jpg" => "icnres/image.gif",
123 "jpeg" => "icnres/image.gif",
124 "jpe" => "icnres/image.gif",
125 "bmp" => "icnres/image.gif");
126 //List of binary type files
127 $bin_type = "ttf,tar";
128 //List of binary mime types
129 $bin_mine_type = array(
130 "ttf" => "application/x-font-ttf",
131 "tar" => "application/x-tar");
132 //List of binary images
134 "ttf" => "icnres/binary.gif",
135 "tar" => "icnres/binary.gif");
136 $bin_type = explode(",",$bin_type);
137 function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {
138 $return_var = $proname." ".$reltype." ".$subver.".".$ver.".".$supver;
139 if($showsvn==false) { $showsvn = null; }
140 if($showsvn==true) { $return_var .= " SVN ".$svnver; }
141 if($showsvn!=true&&$showsvn!=null) { $return_var .= " ".$showsvn." ".$svnver; }
142 return $return_var; }
143 $appversion = version_info($appname,$appver[0],$appver[1],$appver[2],$appver[3]." Ver.",null,false);
144 function highlight_php_source($text)
146 $phpsrcs = highlight_string($text, true);
147 $phpsrcs = str_replace("<br />", "<br />\n", $phpsrcs);
148 $phpsrcs = str_replace("<br>", "<br />\n", $phpsrcs);
149 $phpsrcs = preg_replace("/\<font color=\"(.*?)\"\>/i", "<span style=\"color: \\1;\">", $phpsrcs);
150 $phpsrcs = preg_replace("/\<\/font>/i", "</span>", $phpsrcs);
153 if(!isset($_GET['act'])) { $_GET['act'] = "list"; }
154 if($_GET['act']=="text") { $_GET['act'] = "view"; }
155 if(!isset($_GET['dir'])) { $_GET['dir'] = "/"; }
156 if(!isset($_GET['output'])) { $_GET['output'] = "none"; }
157 if($dirstyle=="neo") { $dirstyle = "new"; }
158 if($dirstyle!="new"&&$dirstyle!="old") {
160 if($_GET['act']=="downloadgz"||$_GET['act']=="downloadgzip") {
161 $_GET['act'] = "download";
162 $_GET['output'] = "gzip"; }
163 if($_GET['act']=="downloadbz"||$_GET['act']=="downloadbz2") {
164 $_GET['act'] = "download";
165 $_GET['output'] = "bzip2"; }
166 if($_GET['act']=="downloadbzip"||$_GET['act']=="downloadbzip2") {
167 $_GET['act'] = "download";
168 $_GET['output'] = "bzip2"; }
169 if($downloadlink!="downloadgz"&&$downloadlink!="downloadgzip"&&
170 $downloadlink!="downloadbz"&&$downloadlink!="downloadbz2"&&
171 $downloadlink!="downloadbzip"&&$downloadlink!="downloadbzip2"&&
172 $downloadlink!="download") { $downloadlink = "downloadgz"; }
173 if($dwntarlink!="dwntargz"&&$dwntarlink!="dwntargzip"&&
174 $dwntarlink!="dwntarbz"&&$dwntarlink!="dwntarbz2"&&
175 $dwntarlink!="dwntarbzip"&&$dwntarlink!="dwntarbzip2"&&
176 $dwntarlink!="dwntar") { $dwntarlink = "dwntargz"; }
177 if($_GET['act']=="dwntargz"||$_GET['act']=="dwntargzip") {
178 $_GET['act'] = "dwntar";
179 $_GET['output'] = "gzip"; }
180 if($_GET['act']=="dwntarbz"||$_GET['act']=="dwntarbz2") {
181 $_GET['act'] = "dwntar";
182 $_GET['output'] = "bzip2"; }
183 if($_GET['act']=="dwntarbzip"||$_GET['act']=="dwntarbzip2") {
184 $_GET['act'] = "dwntar";
185 $_GET['output'] = "bzip2"; }
186 if($_GET['output']=="gz") {
187 $_GET['output'] = "gzip"; }
188 if($_GET['output']=="bz2") {
189 $_GET['output'] = "bzip2"; }
190 if($_GET['output']!="none"&&$_GET['output']!="gzip"&&$_GET['output']!="bzip2") {
191 $_GET['output'] = "none"; }
192 require_once("./untar.php");
193 // http://www.php.net/manual/en/function.sort.php#99700
194 function array_sort($array, $on, $order='SORT_DESC')
196 $new_array = array();
197 $sortable_array = array();
199 if (count($array) > 0) {
200 foreach ($array as $k => $v) {
202 foreach ($v as $k2 => $v2) {
204 $sortable_array[$k] = $v2;
208 $sortable_array[$k] = $v;
216 asort($sortable_array);
220 arsort($sortable_array);
224 foreach($sortable_array as $k => $v) {
225 $new_array[] = $array[$k];
230 function format_size($size, $round = 0) {
231 //Size must be bytes!
232 $sizes = array(' B', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB');
233 for ($i=0; $size > 1024 && $i < count($sizes); $i++) $size /= 1024;
234 return round($size,$round).$sizes[$i];
236 // Change Time Stamp to a readable time
237 function GMTimeChange($format,$timestamp,$offset,$minoffset=null,$dst=null) {
238 global $utshour,$utsminute;
240 if(!is_numeric($minoffset)) { $minoffset = "00"; }
241 $ts_array = explode(":",$offset);
242 if(count($ts_array)!=2) {
243 if(!isset($ts_array[0])) { $ts_array[0] = "0"; }
244 if(!isset($ts_array[1])) { $ts_array[1] = "00"; }
245 $offset = $ts_array[0].":".$ts_array[1]; }
246 if(!is_numeric($ts_array[0])) { $ts_array[0] = "0"; }
247 if(!is_numeric($ts_array[1])) { $ts_array[1] = "00"; }
248 if($ts_array[1]<0) { $ts_array[1] = "00"; $offset = $ts_array[0].":".$ts_array[1]; }
249 $tsa = array("offset" => $offset, "hour" => $ts_array[0], "minute" => $ts_array[1]);
250 //$tsa['minute'] = $tsa['minute'] + $minoffset;
251 if($dst!="on"&&$dst!="off") { $dst = "off"; }
252 if($dst=="on") { if($dstake!="done") {
253 $dstake = "done"; $tsa['hour'] = $tsa['hour']+1; } }
254 $utimestamp = $tsa['hour'] * $utshour;
255 $utimestamp = $utimestamp + $tsa['minute'] * $utsminute;
256 $utimestamp = $utimestamp + $minoffset * $utsminute;
257 $timestamp = $timestamp + $utimestamp;
258 return date($format,$timestamp); }
259 // Change Time Stamp to a readable time
260 function TimeChange($format,$timestamp,$offset,$minoffset=null,$dst=null) {
261 return GMTimeChange($format,$timestamp,$offset,$minoffset,$dst); }
262 // Make a GMT Time Stamp
263 function GMTimeStamp() {
264 $GMTHour = gmdate("H");
265 $GMTMinute = gmdate("i");
266 $GMTSecond = gmdate("s");
267 $GMTMonth = gmdate("n");
268 $GMTDay = gmdate("d");
269 $GMTYear = gmdate("Y");
270 return mktime($GMTHour,$GMTMinute,$GMTSecond,$GMTMonth,$GMTDay,$GMTYear); }
272 function GetSeverZone() {
273 $TestHour1 = date("H");
274 @putenv("OTZ=".getenv("TZ"));
276 $TestHour2 = date("H");
277 @putenv("TZ=".getenv("OTZ"));
278 $TestHour3 = $TestHour1-$TestHour2;
280 // Get Server offset alt version
281 function SeverOffSet() {
282 $TestHour1 = date("H");
283 $TestHour2 = gmdate("H");
284 $TestHour3 = $TestHour1-$TestHour2;
286 // Get Server offset new version
287 function SeverOffSetNew() {
288 return gmdate("g",mktime(0,date("Z"))); }
289 function gmtime() { return time() - (int) date('Z'); }
290 if(!isset($_GET['dst'])) {
291 $_GET['dst'] = "on"; }
292 if($_GET['dst']!="on"&&
293 $_GET['dst']!="off") {
294 $_GET['dst'] = "off"; }
295 if(!isset($_GET['offset'])) {
296 $_GET['offset'] = "-6"; }
297 if(!is_numeric($_GET['offset'])) { $_GET['offset'] = "0"; }
298 if($_GET['offset']>=12) { $_GET['offset'] = "12"; }
299 if($_GET['offset']<=-12) { $_GET['offset'] = "-12"; }
300 if(!isset($_GET['minoffset'])) { $_GET['minoffset'] = "00"; }
301 if(!is_numeric($_GET['minoffset'])) { $_GET['minoffset'] = "00"; }
302 if($_GET['minoffset']>=59) { $_GET['minoffset'] = "59"; }
303 if($_GET['minoffset']<=0) { $_GET['minoffset'] = "00"; }
304 $TimeOffSet = $_GET['offset'].":".$_GET['minoffset'];
305 if(isset($_GET['tar'])&&$_GET['act']=="dwntar") {
306 if($_GET['output']=="none") {
307 $FileType = "application/x-tar";
308 header("Content-Disposition: attachment; filename=\"".basename($_GET['tar'])."\"");
309 header("Content-type: ".$FileType);
310 echo file_get_contents($sourcedir.$_GET['tar']); }
311 if($_GET['output']=="gzip") {
312 $FileType = "application/x-gzip";
313 header("Content-Disposition: attachment; filename=\"".basename($_GET['tar']).".gz\"");
314 header("Content-type: ".$FileType);
315 echo gzencode(file_get_contents($sourcedir.$_GET['tar'])); }
316 if($_GET['output']=="bzip2") {
317 $FileType = "application/x-bzip2";
318 header("Content-Disposition: attachment; filename=\"".basename($_GET['tar']).".bz2\"");
319 header("Content-type: ".$FileType);
320 echo bzcompress(file_get_contents($sourcedir.$_GET['tar'])); }
322 if(isset($_GET['tar'])&&$_GET['act']!="view"&&$_GET['act']!="html") {
323 $File = array_sort(untar($sourcedir.$_GET['tar'],"/",null,false,true),"FileType",'SORT_DESC'); }
324 if((isset($_GET['tar'])&&$_GET['act']=="view")||
325 (isset($_GET['tar'])&&$_GET['act']=="html")||
326 (isset($_GET['tar'])&&$_GET['act']=="download")) {
327 $File = array_sort(untar($sourcedir.$_GET['tar'],"/",null,false,false,$_GET['file']),"FileType",'SORT_DESC'); }
328 if($_GET['act']=="view"||$_GET['act']=="html"||$_GET['act']=="download") {
329 $i = 0; $num = count($File);
332 if($_GET['file']==$File[$i]['FileName']) {
333 if(count(explode(".",$File[$i]['FileName']))>1) {
334 $FileExp = strtolower(end(explode(".",$File[$i]['FileName']))); }
335 if(count(explode(".",$File[$i]['FileName']))<=1) {
337 if(isset($FileExp)) { $FileExt = $FileExp; }
338 if(!in_array($FileExt, $txt_type)) { $_GET['act'] = "view";
339 $FileType = "application/octet-stream"; }
340 if(in_array($FileExt, $txt_type)) {
341 $FileType = $txt_mine_type[$FileExt];
342 if($_GET['act']=="html") { $FileType = "text/html"; } }
343 if(in_array($FileExt, $bin_type)) {
344 if($_GET['act']=="html") { $_GET['act'] = "view"; }
345 $FileType = $bin_mine_type[$FileExt]; }
346 if(in_array($FileExt, $img_type)) {
347 if($_GET['act']=="html") { $_GET['act'] = "view"; }
348 $FileType = $img_mine_type[$FileExt]; }
349 if($_GET['act']=="download") {
350 if($_GET['output']=="none") {
351 $FileType = "application/octet-stream";
352 header("Content-Disposition: attachment; filename=\"".basename($File[$i]['FileName'])."\""); }
353 if($_GET['output']=="gzip") {
354 $FileType = "application/x-gzip";
355 header("Content-Disposition: attachment; filename=\"".basename($File[$i]['FileName']).".gz\""); }
356 if($_GET['output']=="bzip2") {
357 $FileType = "application/x-bzip2";
358 header("Content-Disposition: attachment; filename=\"".basename($File[$i]['FileName']).".bz2\""); } }
359 header("Content-type: ".$FileType);
360 if($_GET['act']=="html") {?>
361 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
362 <html xmlns="http://www.w3.org/1999/xhtml">
364 <title> Source Viewer 2k </title>
365 <meta name="generator" content="<?php echo $appversion; ?>" />
366 <base href="<?php echo $url; ?>" />
367 <link rel="icon" href="favicon.ico" type="image/icon" />
368 <link rel="shortcut icon" href="favicon.ico" type="image/icon" />
369 <style type="text/css">
370 img { border: 0; padding: 0 2px; vertical-align: text-bottom; }
372 td { font-family: monospace; padding: 2px 3px; text-align: right; vertical-align: bottom; }
373 td:first-child { text-align: left; padding: 2px 10px 2px 3px; }
375 a.symlink { font-style: italic; }
381 echo $txt_highlight_type[$FileExt]($File[$i]['FileContent']);
386 if($_GET['act']=="view") {
387 echo $File[$i]['FileContent']; }
388 if($_GET['act']=="download") {
389 if($_GET['output']=="none") {
390 echo $File[$i]['FileContent']; }
391 if($_GET['output']=="gzip") {
392 echo gzencode($File[$i]['FileContent']); }
393 if($_GET['output']=="bzip2") {
394 echo bzcompress($File[$i]['FileContent']); } }
397 if($fileview===false) { $_GET['act'] = "list"; } }
398 if($_GET['act']=="list") {
400 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
401 <html xmlns="http://www.w3.org/1999/xhtml">
403 <title> Source Viewer 2k </title>
404 <meta name="generator" content="<?php echo $appversion; ?>" />
405 <base href="<?php echo $url; ?>" />
406 <link rel="icon" href="favicon.ico" type="image/icon" />
407 <link rel="shortcut icon" href="favicon.ico" type="image/icon" />
408 <style type="text/css">
409 img { border: 0; padding: 0 2px; vertical-align: text-bottom; }
410 td { font-family: monospace; padding: 2px 3px; text-align: right; vertical-align: bottom; }
411 td:first-child { text-align: left; padding: 2px 10px 2px 3px; }
413 a.symlink { font-style: italic; }
419 header("Content-type: text/html");
420 if(!isset($_GET['tar'])) {
421 if(isset($_GET['dir'])) {
422 $_GET['dir'] = preg_replace("/(.*?)\.\/(.*?)/", "/", $_GET['dir']); }
423 chdir($sourcedir.$_GET['dir']);
424 if($dirstyle=="new") {
425 echo "Reading dir ".$_GET['dir']."<br />\n";
427 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&&dir=".$_GET['dir']."\">./</a><br />\n";
428 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&dir=".preg_replace("/^\\\\/isU", "",preg_replace('{/$}', '', dirname($_GET['dir'])))."/\">../</a><br />\n"; }
430 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".$_GET['dir']."\">./</a><br />\n";
431 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".preg_replace("/^\\\\/isU", "",preg_replace('{/$}', '', dirname($_GET['dir'])))."/\">../</a><br />\n"; } }
432 if($dirstyle=="old") {
433 echo "<h1>Index of ".$_GET['dir']."</h1>\n";
434 echo "<hr /><table><tbody>\n";
436 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&dir=".preg_replace("/^\\\\/isU", "",preg_replace('{/$}', '', dirname($_GET['dir'])))."/\">Parent Directory</a></td></tr>\n"; }
438 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".preg_replace("/^\\\\/isU", "",preg_replace('{/$}', '', dirname($_GET['dir'])))."/\">Parent Directory</a></td></tr>\n"; } }
439 if (is_array(glob("*",GLOB_ONLYDIR))) {
440 foreach (glob("*",GLOB_ONLYDIR) as $filename) {
441 $FilePic = $dir_image;
444 if($dirstyle=="new") {
445 echo "<img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"?act=list&dir=".$_GET['dir'].$filename."/\">".$filename."</a><br />\n"; }
446 if($dirstyle=="old") {
448 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"?act=list&dir=".$_GET['dir'].$filename."/\">".$filename."</a></td>";
449 echo "<td> </td>";
450 echo "<td>".GMTimeChange("n/j/Y",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
451 echo "<td>".GMTimeChange("g:i:s A",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
454 if($dirstyle=="new") {
455 echo "<img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"list".$_GET['dir'].$filename."/\">".$_GET['dir'].$filename."</a><br />\n"; }
456 if($dirstyle=="old") {
458 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"list".$_GET['dir'].$filename."/\">".$filename."</a></td>";
459 echo "<td> </td>";
460 echo "<td>".GMTimeChange("n/j/Y",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
461 echo "<td>".GMTimeChange("g:i:s A",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
462 echo "</tr>\n"; } } } }
463 if (is_array(glob("*.tar"))) {
464 foreach (glob("*.tar") as $filename) {
465 $FilePic = $bin_image['tar'];
468 if($dirstyle=="new") {
469 echo "<a href=\"?act=".$dwntarlink."&output=gzip&tar=".$_GET['dir'].$filename."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"?act=list&tar=".$_GET['dir'].$filename."&dir=/\" title=\"".format_size(filesize($filename))."\">".$_GET['dir'].$filename."</a><br />\n"; }
470 if($dirstyle=="old") {
472 echo "<td style=\"text-align: left;\"><a href=\"?act=".$dwntarlink."&output=gzip&tar=".$_GET['dir'].$filename."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"?act=list&tar=".$_GET['dir'].$filename."&dir=/\">".$filename."</a></td>";
473 echo "<td>".format_size(filesize($filename))."</td>";
474 echo "<td>".GMTimeChange("n/j/Y",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
475 echo "<td>".GMTimeChange("g:i:s A",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
478 if($dirstyle=="new") {
479 echo "<a href=\"".$dwntarlink.$_GET['dir'].$filename."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"list".$_GET['dir'].$filename.$PathSep."/\" title=\"".format_size(filesize($filename))."\">".$_GET['dir'].$filename."</a><br />\n"; }
480 if($dirstyle=="old") {
482 echo "<td style=\"text-align: left;\"><a href=\"".$dwntarlink.$_GET['dir'].$filename."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"list".$_GET['dir'].$filename.$PathSep."/\">".$filename."</a></td>";
483 echo "<td>".format_size(filesize($filename))."</td>";
484 echo "<td>".GMTimeChange("n/j/Y",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
485 echo "<td>".GMTimeChange("g:i:s A",filemtime($filename),$TimeOffSet,null,$_GET['dst'])."</td>";
486 echo "</tr>\n"; } } } }
487 if($dirstyle=="old") {
488 echo "</tbody></table><hr />"; } }
489 if(isset($_GET['tar'])) {
490 $_GET['tar'] = preg_replace("/(.*?)\.\/(.*?)/", "/iDB.tar", $_GET['tar']);
491 if(isset($_GET['dir'])&&strlen($_GET['dir'])>1) {
492 $_GET['dir'] = preg_replace('{/$}', '', $_GET['dir']); }
493 if($dirstyle=="new") {
494 echo "Reading dir ".$_GET['tar'].$PathSep.$_GET['dir']."<br />\n"; }
495 if($dirstyle=="old") {
496 echo "<h1>Index of ".$_GET['tar'].$PathSep.$_GET['dir']."</h1>\n";
497 echo "<hr /><table>\n<tbody>";
499 if(isset($_GET['dir'])&&strlen($_GET['dir'])>1) {
500 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".preg_replace("/^\\\\/isU", "/",dirname($_GET['dir']))."\">Parent Directory</a></td></tr>\n"; }
501 if(isset($_GET['dir'])&&strlen($_GET['dir'])<=1) {
502 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&dir=".preg_replace("/^\\\\/isU", "/",preg_replace('{/$}', '', dirname($_GET['tar'])))."/\">Parent Directory</a></td></tr>\n"; } }
504 if(isset($_GET['dir'])&&strlen($_GET['dir'])>1) {
505 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".$_GET['tar'].$PathSep.preg_replace("/^\\\\/isU", "/",dirname($_GET['dir']))."\">Parent Directory</a></td></tr>\n"; }
506 if(isset($_GET['dir'])&&strlen($_GET['dir'])<=1) {
507 echo "<tr><td style=\"text-align: left;\"><img src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".preg_replace("/^\\\\/isU", "/",preg_replace('{/$}', '', dirname($_GET['tar'])))."/\">Parent Directory</a></td></tr>\n"; } } }
508 if($dirstyle=="new") {
510 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".$_GET['dir']."\">./</a><br />\n";
511 if(isset($_GET['dir'])&&strlen($_GET['dir'])>1) {
512 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".preg_replace("/^\\\\/isU", "/",dirname($_GET['dir']))."\">../</a><br />\n"; }
513 if(isset($_GET['dir'])&&strlen($_GET['dir'])<=1) {
514 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"?act=list&dir=".preg_replace("/^\\\\/isU", "/",preg_replace('{/$}', '', dirname($_GET['tar'])))."/\">../</a><br />\n"; } }
516 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".$_GET['tar'].$PathSep.$_GET['dir']."\">./</a><br />\n";
517 if(isset($_GET['dir'])&&strlen($_GET['dir'])>1) {
518 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".$_GET['tar'].$PathSep.preg_replace("/^\\\\/isU", "/",dirname($_GET['dir']))."\">../</a><br />\n"; }
519 if(isset($_GET['dir'])&&strlen($_GET['dir'])<=1) {
520 echo "<img style=\"text-decoration: none;\" src=\"".$back_image."\" alt=\"dir\" /> <a href=\"list".preg_replace("/^\\\\/isU", "/",preg_replace('{/$}', '', dirname($_GET['tar'])))."/\">../</a><br />\n"; } } }
521 $i = 0; $num = count($File);
523 if($File[$i]['FileType']=="0"&&$_GET['dir']==preg_replace("/^\\\\/isU", "/",dirname($File[$i]['FileName']))) {
524 if(count(explode(".",$File[$i]['FileName']))>1) {
525 $FileExp = strtolower(end(explode(".",$File[$i]['FileName']))); }
526 if(count(explode(".",$File[$i]['FileName']))<=1) {
528 if(isset($FileExp)) { $FileExt = $FileExp; }
529 $FilePic = $unknown_image;
530 if(in_array($FileExt, $txt_type)) {
531 $FilePic = $txt_image[$FileExt]; }
532 if(in_array($FileExt, $bin_type)) {
533 $FilePic = $bin_image[$FileExt]; }
534 if(in_array($FileExt, $img_type)) {
535 $FilePic = $img_image[$FileExt]; }
536 if(!isset($FilePic)||$FilePic==""||$FilePic===null) {
537 $FilePic = $unknown_image; }
540 if($dirstyle=="new") {
541 echo "<a href=\"?act=".$downloadlink."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"?act=".$urlview."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\" title=\"".format_size($File[$i]['FileSize'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
542 if($dirstyle=="old") {
544 echo "<td style=\"text-align: left;\"><a href=\"?act=".$downloadlink."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"?act=".$urlview."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\">".basename($File[$i]['FileName'])."</a></td>";
545 echo "<td>".format_size($File[$i]['FileSize'])."</td>";
546 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
547 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
550 if($dirstyle=="new") {
551 echo "<a href=\"".$downloadlink.$_GET['tar'].$PathSep.$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"".$urlview.$_GET['tar'].$PathSep.$File[$i]['FileName']."\" title=\"".format_size($File[$i]['FileSize'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
552 if($dirstyle=="old") {
554 echo "<td style=\"text-align: left;\"><a href=\"".$downloadlink.$_GET['tar'].$PathSep.$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"".$urlview.$_GET['tar'].$PathSep.$File[$i]['FileName']."\">".basename($File[$i]['FileName'])."</a></td>";
555 echo "<td>".format_size($File[$i]['FileSize'])."</td>";
556 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
557 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
558 echo "</tr>\n"; } } }
559 if($File[$i]['FileType']=="5"&&$_GET['dir']==preg_replace("/^\\\\/isU", "/",dirname($File[$i]['FileName']))) {
560 $FilePic = $dir_image;
563 if($dirstyle=="new") {
564 echo "<img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
565 if($dirstyle=="old") {
567 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a></td>";
568 echo "<td> </td>";
569 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
570 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
573 if($dirstyle=="new") {
574 echo "<img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"list".$_GET['tar'].$PathSep.preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
575 if($dirstyle=="old") {
577 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"list".$_GET['tar'].$PathSep.preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a></td>";
578 echo "<td> </td>";
579 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
580 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
581 echo "</tr>\n"; } } }
582 if($File[$i]['FileType']=="7"&&$_GET['dir']==preg_replace("/^\\\\/isU", "/",dirname($File[$i]['FileName']))) {
583 if(count(explode(".",$File[$i]['FileName']))>1) {
584 $FileExp = strtolower(end(explode(".",$File[$i]['FileName']))); }
585 if(count(explode(".",$File[$i]['FileName']))<=1) {
587 if(isset($FileExp)) { $FileExt = $FileExp; }
588 if(in_array($FileExt, $txt_type)) {
589 $FilePic = $txt_image[$FileExt]; }
590 if(in_array($FileExt, $bin_type)) {
591 $FilePic = $bin_image[$FileExt]; }
592 if(in_array($FileExt, $img_type)) {
593 $FilePic = $img_image[$FileExt]; }
596 if($dirstyle=="new") {
597 echo "<a href=\"?act=".$downloadlink."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"?act=".$urlview."&tar=".$_GET['tar']."&file=".$File[$i]['FileName']."\" title=\"".format_size($File[$i]['FileSize'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
598 if($dirstyle=="old") {
600 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"?act=list&tar=".$_GET['tar']."&dir=".preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a></td>";
601 echo "<td> </td>";
602 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
603 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
606 if($dirstyle=="new") {
607 echo "<a href=\"".$urlview.$_GET['tar'].$PathSep.$File[$i]['FileName']."\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /></a> <a href=\"view".$_GET['tar'].$PathSep.$File[$i]['FileName']."\" title=\"".format_size($File[$i]['FileSize'])."\">".basename($File[$i]['FileName'])."</a><br />\n"; }
608 if($dirstyle=="old") {
610 echo "<td style=\"text-align: left;\"><img style=\"text-decoration: none;\" src=\"".$FilePic."\" alt=\"".$FileType."\" /> <a href=\"list".$_GET['tar'].$PathSep.preg_replace('{/$}', '', $File[$i]['FileName'])."\">".basename($File[$i]['FileName'])."</a></td>";
611 echo "<td> </td>";
612 echo "<td>".date("n/j/Y", $File[$i]['LastEdit'])."</td>";
613 echo "<td>".date("g:i:s A", $File[$i]['LastEdit'])."</td>";
614 echo "</tr>\n"; } } }
616 if($dirstyle=="old") {
617 echo "</tbody></table><hr />\n"; } }
618 if($dirstyle=="old") {
619 echo "<address>".$appversion."</address>\n"; }