Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
4.0 kB
2
Indexable
Never
<script src="/lib/ajax/hxr.js"></script>
<style>
.visor{

display:none;
visibility:hidden;
padding:30px;
font-size:16px;
font-family:'gill sans';
}
.amenuv{

text-decoration:none;
color:#222313;
font-weight:bold;

font-size:13px;
}
.amenuv2{
float:left;
background:#dedefe;
padding:1px 2px 1px 2px;
border:outset 1px #cfcfcf;
}
</style>
<div style="width:840px;max-width:100%;min-height:100%;margin:0 auto 0 auto;">
<?
$fconf = "conf.conf";
include('aconf.php');
include 'lib.php';

//print_r($_SPECIALCONF);

if(!isset($_SESSION['bdir'])) $_SESSION['bdir'] = $cd_USER_ROOT;
if(!isset($_SESSION['path'])) {$_SESSION['path'] = "./";}
if(!isset($_REQUEST['mkdir'])) $mkdir = '';
else $mkdir = $_REQUEST["mkdir"];
if(!isset($_REQUEST["chdir"])) $chdir= "";
else $chdir = $_REQUEST["chdir"];

if(preg_match("@((/\.\.)|(\.\./)|(/\./)|(//))@si",$chdir)){

echo "<h1>dir error</h1>";
exit;
}


if($mkdir){
mkdir($mkdir,0777);
$_SESSION["path"] = $mkdir."/";
}
elseif($chdir) {
$_SESSION["path"] = $chdir."/";

}



$barra = explode("/",$_SESSION["path"]); 

if(($len=count($barra))>1){

$relay = 0;
$enlace[0] = "<a href='?chdir=.'>Inicio</a>";

for($i=1;$i<$len-1;$i++){
if($barra[$i]=="") continue;
$barra_l[$i] = $barra[$i];
$sl = implode("/",$barra_l);
if($i==$len-2) {$enlace[$i] = "<b>{$barra[$i]}</b>";}
else {$enlace[$i] = "<a href='?chdir=./$sl'>{$barra[$i]}</a>";}
$relay++;
} 

echo implode("/",$enlace);

} else echo "INICIO";


$lists = fdext($_SESSION["path"]);
//print_r($lists);exit
?>

<div style="text-align:right;">
<a href="javascript:void(0);" onclick='
if(d = prompt("CREAR DIRECTORIO NUEVO","")){
location.href="?mkdir=<?=$_SESSION["path"]?>"+d

} else{alert("Operación Cancelada")}
'>Nuevo Directorio</a>

 
<a href="javascript:void(0);" onclick='
location.reload()
'>Actualizar</a>

</div>
<div style="float:left;width:15%;min-width:5%;max-width:100%;height:100%" id="lsdir">

<?
if(isset($lists["DIR"])>0){
foreach($lists["DIR"] as $key => $value){
?>

<span><a href="?chdir=<?=$_SESSION["path"]?><?=$value[0]?>"><?=$value[1]?></a></span><br> 

<?
}} else echo "0 DIR";
?>
</div>


<div style="width:75%;text-align:left;min-width:20%;max-width:100%;height:100%" id="lsfile">

<?
if($lists["EXT"]){
$ext = explode("\/",$lists["EXT"]);
$menu = "";
$visor = "";
foreach($ext as $extvalue){

$menu .= "
<div class='amenuv2'>
<a class='amenuv' href='javascript:void(0)' onclick=\"dmenu('$extvalue','visor')\">$extvalue</a>
</div>
";


$visor .= "<div class='visor' id='$extvalue'>";
if(isset($lists["FILE"])){

$visor .= extoption($extvalue);

foreach($lists["FILE"] as $key => $value){

if($value[2] == $extvalue){


$visor .= fileoption($value[2],$value[0])."<span>$value[1]</span> <a href='".$_SESSION["path"].$value[0]."' target='_blank'>open</a><br>";



}
}}
$visor .= "</div>";
}
echo "".$menu."<br>".$visor;
} else echo "0 FILES";

?>
</div>

</div>

<?

function fileoption($ext,$file){
global $cd__MiTV;
switch(strtolower($ext)){
case 'ts';
$base1 = "file '{$_SERVER["DOCUMENT_ROOT"]}/{$_SESSION["path"]}";
$base2 = "'\n";
$file = base64_encode($base1.$file.$base2);


$TS=<<<TS


<input type="checkbox" class="check_$ext" value="$file">

TS;

return $TS;

break;
default:
return;
break;
}}


function extoption($ext){


switch(strtolower($ext)){
case 'ts';

$TS=<<<TS
 
<input type="button" value="Crear Lista TS" onclick="creaLista(document.getElementsByClassName('check_$ext'),'op_$ext')">

<span id='op_$ext'></span>

<br>
<script type="text/javascript">

function creaLista(tag,vret){


mklist = ""
openlist = ""
namelist = ""
intolist = ""
closelist = ""

n = 0;
for(i=0;i<tag.length;i++){
if(tag[i].checked == true) {
intolist += "*"+tag[i].value;n++;
}
}

if(n<1){
alert("Ningun archivo seleccionado");
return false;
}

if(namelist = prompt("CREAR LISTA TS Nombrar","lista")){

lista = mklist+openlist+intolist+closelist


ajaxPost("namelist="+namelist+"&files="+lista+"&div="+vret,vret,'mklist.php','POST')

} else{ alert("cancelado")}
}

</script>
TS;

return $TS;

break;
default:
return;
break;
}

}

?>