0) {
// echo $path;
// exit;
//}
//$view=false;
//echo urlencode($path);
//exit;
while(!is_dir($loc.$path) && !is_file($loc.$path) && $path<>"") {
//if(filesize($loc.$path)<=0) {
if(substr($path,strlen($substr)-1)=="/") {
$path=substr($path,0,strlen($path)-1);
} else {
$path=substr($path,0,strrpos($path,"/"));
}
//}
}
if(substr($path,strlen($path)-1)!="/" && is_dir($loc.$path) && $path<>"") $path.="/";
$fpath=$loc.$path;
$vpath="";
$dpath="";
$fname="";
if(is_file($fpath)) { // Preparing file preview
if(strpos($path,"/")) {
$path=substr($path,0,strrpos($path,"/")+1);
} else {
$path="";
}
$vpath=$fpath;
$fname=substr($vpath,strrpos($vpath,"/")+1);
$fpath=substr($fpath,0,strrpos($fpath,"/")+1);
$dpath=$dl.$path.$fname;
$view=true;
if(strpos($path.$fname,"secrets")==false) {
appendf($analytics,time()."\v".$path.$fname."\n");
}
}
$farr=array();
$darr=array();
if($handle=opendir($fpath)) { // List current directory
while(false!==($entry=readdir($handle))) {
if($entry!="." && $entry!="..") {
$ts_raw=filemtime($fpath.$entry);
$color="#000";
$fs_get=filesize($fpath.$entry);
$timestamp=date($dformat,$ts_raw);
$ts_get=time()-$ts_raw;
list($ts_get,$color)=colortime($ts_get);
if(is_dir($fpath.$entry)) {
//array_push($darr,$entry);
array_push($darr,array($ts_raw,$entry,$ts_get,$color,$timestamp,$fs_get));
} else {
//array_push($farr,$entry);
array_push($farr,array($ts_raw,$entry,$ts_get,$color,$timestamp,$fs_get));
}
// 0 raw = mtime
// 1 entry = filename
// 2 ts_get = mtime diff?date stamp?
// 3 color = hex
// 4 timestamp = 2 weeks ago~
// 5 fs_get filesize
}
}
}
closedir($handle);
foreach($darr as $key => $row) {
$ts[$key]=$row[0];
$nam[$key]=$row[1];
}
array_multisort($ts,SORT_DESC,$nam,SORT_ASC,$darr);
foreach($farr as $key => $row) {
$ts[$key]=$row[0];
$nam[$key]=$row[1];
}
array_multisort($ts,SORT_DESC,$nam,SORT_ASC,$farr);
//sort($darr);
//sort($farr);
$items=count($darr)+count($farr);
$items.=($items>1)?" items":" item";
session_set_cookie_params(["SameSite" => "Strict"]); //none, lax, strict
session_set_cookie_params(["Secure" => "true"]); //false, true
session_set_cookie_params(["HttpOnly" => "true"]); //false, true
session_start(); // Visit counter
$visits=intval(readf($visitpath));
if(!$_SESSION['visited']) {
$_SESSION['visited']=true;
$visits++;
if($visits>1) writef($visitpath,$visits);
}
?>
">
\n"; ?>
< >
Filter:
>
;">
" href="/" target="_self">~ ".$lpath[$i]."";
}
?>
"") $up.="/";
else $up="/";
$listhtml="";
$listhtml.="
";
$listhtml.="
";
$listhtml.="
";
$listhtml.="
\n";
//$listhtml.="
"; // ts ?
//$listhtml.="
$ts
"; // ts ?
//$listhtml.="
";
$listhtml.="
";
for($i=0;$i
$fnamelen) $cutn="...";
if($path.$darr[$i][1]=="stuff") $dimg="desktop.png";
if($darr[$i][1]!="secrets") {
//$ts_get=filemtime($fpath.$darr[$i][1]);
////$fs_get=filesize($fpath.$darr[$i][1]);
//$timestamp=date($dformat,$ts_get);
//$ts_get=time()-$ts_get;
//list($ts_get,$color)=colortime($ts_get);
$ts_get=$darr[$i][2];
$color=$darr[$i][3];
//$fs_get=$farr[$i][5];
$fs_get=" ";
//if($fs_get>(1024*1024*1024)) {//gb
// $fs_get=round($fs_get/1024/1024/1024,1)." GB";
//} else if($fs_get>(1024*1024)) {//mb
// $fs_get=round($fs_get/1024/1024,1)." MB";
//} else if($fs_get>(1024)) {// kb
// $fs_get=round($fs_get/1024)." KB";
//} else {
// $fs_get=$fs_get." B";
//}
$altcolor="";
$kw=strtolower($darr[$i][1]);
switch($kw) {
case (preg_match('/(prefa)|(materi)|(animat)|(vfx)/', $kw) ? true : false):
$altcolor=" style=\"color: #8695fb;\""; // blue/grey
break;
case (preg_match('/(model)|(fbx)|(mesh)|(blende)/', $kw) ? true : false):
$altcolor=" style=\"color: #ff7a93;\""; // red
break;
case (preg_match('/(audio)|(sound)|(copilot)/', $kw) ? true : false):
$altcolor=" style=\"color: #88e5ad;\""; // green
break;
case (preg_match('/(terra)|(textur)|(icon)|(image)|(ui)/', $kw) ? true : false):
$altcolor=" style=\"color: #2fa954;\""; // deep green
break;
//case (preg_match('/*textures*/', $kw) ? true : false):
//case (preg_match('/*icons*/', $kw) ? true : false):
//case (preg_match('/*audio*/', $kw) ? true : false):
//case (preg_match('/*video*/', $kw) ? true : false):
default:
//$altcolor=" style=\"color: #000;\"";
}
$listhtml.="";
$listhtml.="
$ts
"; // ts ?
//$listhtml.="
";
$listhtml.=" ";
}
}
for($i=0;$i
fgets();
$fh=fopen($fpath.$farr[$i][1],'r');
$line=fread($fh,64);
fclose($fh);
switch($line) {
case (preg_match('/#!.*sh.*/',$line)?true:false): // script match
$img="script.png"; break;
case (preg_match('/[^\x00-\x7F]/',$line)?true:false): // binary match
$img="application.png"; break;
case (preg_match('/[ -~]/',$line)?true:false): // ascii match
$img="text.png"; break;
default:
$img="unknown.png";
}
}
$selected="";
$hidden="";
$cutn="";
$new="";
if(time()-filemtime($fpath.$farr[$i][1])<$oldafter) { $new=" new"; }
if($view) if($fname==$farr[$i][1]) $selected=" selected";
if(substr($farr[$i][1],0,1)==".") $hidden=" hid";
if(strlen($farr[$i][1])>$fnamelen) $cutn="...";
$target="_self";
$href="".str_replace($bad,$good,$path.$farr[$i][1])."#view"; // Standard local file link
/* Make *.url files open the links directly */
/*if($info['extension']=="url") { // .url file - link contained url instead
$target="_blank";
$href=str_replace("\n","",readf($fpath.$farr[$i][1])); // just in case the .url file contains newline
}*/
$listhtml.="";
$listhtml.="
";
if($selected<>"") {
$listhtml.="
";
}
$limg="img/";
if($tmb) {
$limg="";
}
//$ts_get=filemtime($fpath.$farr[$i][1]);
//$fs_get=filesize($fpath.$farr[$i][1]);
//$timestamp=date($dformat,$ts_get);
//$ts_get=time()-$ts_get;
//list($ts_get,$color)=colortime($ts_get);
$fs_get=$farr[$i][5];
$ts_get=$farr[$i][2];
$color=$farr[$i][3];
if($fs_get>(1024*1024*1024)) {//gb
$fs_get=round($fs_get/1024/1024/1024,1)." GB";
} else if($fs_get>(1024*1024)) {//mb
$fs_get=round($fs_get/1024/1024,1)." MB";
} else if($fs_get>(1024)) {// kb
$fs_get=round($fs_get/1024)." KB";
} else {
$fs_get=$fs_get." B";
}
$listhtml.="
".substr($farr[$i][1],0,$fnamelen).$cutn."
$fs_get
$ts_get
\n";
//$listhtml.="
$ts
"; // ts ?
//$listhtml.="
";
$listhtml.=" ";
} // skip
}
$listhtml.="";
echo $listhtml;
?>
; position: relative;">
"") echo "
".$lpath[$i]." ";
}
echo "
".$fname." \n"
."
"
."
\n"
."
"
."".number_format($fviews,0,","," ")." • "
."".$mtime." • "
." \n"
."
Download "
."
Raw "
."
Close \n"
."
\n"
."
\n"
."
\n"
."".$mtime." • "
."".number_format($fviews,0,","," ")." \n"
."
\n";
$info=pathinfo($vpath);
$bprev="";
$prev="";
switch(strtolower($info['extension'])) { // Detect best way to preview by file extension
case "png": case "jpg": case "jpeg": case "bmp": case "gif": case "ico": case "webp": case "svg":
$prev="
\n";
break;
case "wav": case "mp3": case "ogg": // wma
$prev="
Play next in folder
\n";
$audiotrig=1;
break;
case "fbx": // gltf / obj / babylon files need different loader
$prev="
";
break;
case "mp4": case "webm": // avi mkv wmv
$prev="
\n";
break;
case "url":
$fc=readf($vpath);
$fctarget="_blank";
$fclnk="";
$fchref=$fc;
if(substr($fc,0,1)=="/") { // inside link
$fctarget="_self";
$fclnk="~";
$fchref="/".$root.substr($fc,1);
}
$prev="
".$fclnk.$fc." \n";
break;
case "$":
echo "
\n";
if(is_file($vpath)) include($vpath);
echo "
\n";
break;
default:
$bad=array("&","<",">");
$good=array("&","<",">");
$prev=true;
if(filesize($vpath)>(1024*1024*75)) {
$prev=false;
} else {
$fc=readf($vpath);
$tmp=explode("\n",$fc);
if(preg_match('/[^\x00-\x7F]/',$tmp[0])) { // Detect binary file
$prev=false;
}
if($info['extension']=='apk' ||
$info['extension']=='dex' ||
$info['extension']=='res' ||
$info['extension']=='jar' ||
$info['extension']=='idsig') {
$prev=false;
}
}
if($prev) {
$fc=str_replace($bad,$good,$fc);
$bprev="
{} ";
$prev="
".$fc."
\n";
//$prev.="
".$fc."
\n";
} else {
$prev="
<no preview>
\n";
}
?>
\n".$prev."\n
\n
Top \n\n";
}
}
?>
";
}
?>
visits
...
^
v
Auto-scroll