<?php if(!isset($_SESSION["admin"]))
{
echo '<font color="red">You are not authorized to view this page </font>';
return;
}
if( isset($fmaction) && ( $fmaction=="logout") )
{
include($absolute_path."admin/logout.php");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>WEBInsta File manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="images/admin.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#E6E4E4">
<table width="770" border="0" valign="top" align="center" cellpadding="0" cellspacing="0" background="images/interface/bgmaintable.gif">
<tr>
<td width="21"> </td>
<td> <table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/top_bg.gif">
<tr>
<td width="34%"><img src="images/webinsta.gif" width="181" height="70"></td>
<td width="66%"> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="menuheader"><div align="right"><font color="#999999" size="4">WEBInsta file manager </font></div></td>
</tr>
<tr>
<td><div align="right">Simple , Easy , Powerful</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <?
/*Security problems */
if(isset($rel_dir))
{
$rel_dir=str_replace("../","",$rel_dir);
$rel_dir=str_replace(".","",$rel_dir);
}else $rel_dir='';
$base_dir=$base_path;
echo "<font color=\"#ff0000\">";
// here we handle the multiple files
//multiple delete
if(isset($m_delete))
{
if(isset($sel_d))
{
foreach($sel_d as $dir_to_del)
{
purge($dir_to_del."/");
rmdir($dir_to_del);
}
}
if(isset($sel_f))
{
foreach($sel_f as $file_to_del)
{
unlink($file_to_del);
}
}
}
//multiple cut / copy
if( isset($m_cut) || isset($m_copy) )
{
if(isset($m_cut))$act="cut";
else $act="copy";
$_SESSION['action']=$act;
if(isset($sel_d)){$_SESSION['sel_dirs']=$sel_d;}
if(isset($sel_f)){$_SESSION['sel_files']=$sel_f;}
}
if(isset($file))
{
$file=$base_dir.$rel_dir.$file;
if(touch($file))
{
echo "<br><BR><center>File ".$file." was success fully created .</center><br><Br>";
}else
{
echo "<br><BR><center>There was an Error creaing File ".$file."</center><br><Br>";
}
}
//multiple paste
if(isset($m_paste))
{
if(isset($_SESSION['sel_dirs']))
{
foreach($_SESSION['sel_dirs'] as $dir_to_copy)
{
mkdir($base_dir.$rel_dir.$dir_to_copy);
xcopy($base_dir.$dir_to_copy,$base_dir.$rel_dir.$dir_to_copy,$_SESSION['action']);
if($_SESSION['action']=="cut")rmdir($base_dir.$dir_to_copy);
}
}
if(isset($_SESSION['sel_files']))
{
foreach($_SESSION['sel_files'] as $file_to_copy)
{
copy($file_to_copy,$base_dir.$rel_dir.basename($file_to_copy));
if($_SESSION['action']=="cut")unlink($file_to_copy);
}
}
if($_SESSION['action']=="cut")$_SESSION['action']='';
}
//multiple chmod
if(isset($achmod) && ($achmod!=''))
{
if(isset($sel_d))
{
foreach($sel_d as $dir_name)chmoddir($dir_name,$achmod);
}
if(isset($sel_f)){
foreach($sel_f as $file_name)chmod($file_name,$achmod);
}
}
if( isset($dir))
{
$dir=$base_dir.$rel_dir.$dir;
if(mkdir($dir))
{
echo "<br><BR><center>Directory ".$dir." was success fully created .</center><br><Br>";
}else
{
echo "<br><BR><center>There was an Error creaing directory ".$dir."</center><br><Br>";
}
}
if( isset($ddel))
{
purge($ddel."/");
if(rmdir($ddel))
{
echo "<br><BR><center>Directoy ".$ddel." was success fully deleted .</center><br><Br>";
}else
{
echo "<br><BR><center>There was an Error Deleting Directoy ".$ddel."</center><br><Br>";
}
}
if(isset($cmode) )
{
if( chmod($cpath,$cmode) )
{
echo "<br><BR><center>Permissions for ".$cpath." were successfully changed .</center><br><Br>";
}else
{
echo "<br><BR><center>There was an error updating permissions for ".$cpath."</center><br><Br>";
}
}
if(isset($del))
{
if(unlink ($del))
{
echo "<br><BR><center>File ".$del." was success fully deleted .</center><br><Br>";
}else
{
echo "<br><BR><center>There was an Error Deleting File ".$del."</center><br><Br>";
}
}
echo "</font>";
if ( !isset($rel_dir) )
{
$show_dir=$base_dir;
$rel_dir="";
}
else if ( $rel_dir == $base_dir)
{
$show_dir=$base_dir;
$rel_dir="";
}
else
{
$rel_dir=urldecode($rel_dir);
$show_dir=$base_dir.$rel_dir;
}
$dir_list=array();
$file_list=array();
$dir_count=0;
$file_count=0;
if (!is_dir($show_dir))
{
echo $show_dir." is not a directory !!!";
return;
}
if (!( $dir = opendir($show_dir) ) )
{
echo $show_dir." Access denied . <br>You do not have enought rights to view the dir ";
return;
}
while ( $name = readdir($dir))
{
if($name == ".." || $name == "." ) continue;
if( is_dir($show_dir.$name) )$dir_list[$dir_count++] = $name ;
if( is_file($show_dir.$name) ) $file_list[$file_count++] = $name ;
}
closedir($dir);
?>
<div id="ie5menu" class="skin0" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none>
<div class="menuitems" url="admin.php"><img src="images/icons/home.gif" width="19" height="19" border="0" align="absmiddle"> Home</div>
<hr>
<div class="menuitems" url="<?php
$p_ar=explode("/",$rel_dir,strlen($rel_dir));
$prev_dir="";
for($i=0;$i<count($p_ar)-2;$i++)
{
$prev_dir=$prev_dir.$p_ar[$i];
if($i!=count($p_ar)-2)$prev_dir=$prev_dir."/";
}
if( $prev_dir =="" ){
echo "admin.php?page=fm";
$prev_dir="/";
}
else { echo "admin.php?rel_dir=".$prev_dir; }
?>">
<img src="images/icons/dir.gif" width="19" height="19" border="0" align="absmiddle"> One dir up</div>
<div class="menuitems" url="admin.php?page=fm&rel_dir=<?php echo $rel_dir; ?>"><img src="images/icons/back.gif" width="19" height="19" border="0" align="absmiddle"> Back</div>
<div class="menuitems" url="admin.php?fmaction=upload&rel_dir=<?php echo $rel_dir; ?>"><img src="images/icons/up.gif" width="19" height="19" border="0" align="absmiddle"> Upload</div>
<div class="menuitems" url="javascript:refresh_page('<?php echo $rel_dir;?>');"><img src="images/icons/refresh.gif" width="19" height="19" border="0" align="absmiddle"> Refresh</div>
<hr>
<div class="menuitems" url="javascript:document.filelist.m_copy.click();"><img src="images/icons/selectall.gif" width="19" height="19" border="0" align="absmiddle"> Copy</div>
<?php if(isset($_SESSION['action']) && $_SESSION['action']!='') {?>
<div class="menuitems" url="javascript:document.filelist.m_paste.click();"><img src="images/icons/unselectall.gif" width="19" height="19" border="0" align="absmiddle"> Paste</div>
<?php } ?>
<div class="menuitems" url="javascript:document.filelist.m_delete.click();"><img src="images/icons/delete.gif" width="19" height="19" border="0" align="absmiddle"> Delete</div>
<hr>
<div class="menuitems" url="javascript:CheckAll();"><img src="images/icons/selectall.gif" width="19" height="19" border="0" align="absmiddle"> Select all</div>
<div class="menuitems" url="javascript:ClearAll();javascript:refresh_page('<?php echo $rel_dir;?>');"><img src="images/icons/unselectall.gif" width="19" height="19" border="0" align="absmiddle"> Unselect all</div>
<hr>
<div class="menuitems" url="admin.php?fmaction=logout"><img src="images/icons/logout.gif" width="19" height="19" border="0" align="absmiddle"> Logout</div>
</div>
<script src="images/interface/rightclick.js" type="text/javascript"></script>
<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td> <div align="left">
<table border="0" align="right" cellpadding="2" cellspacing="0">
<tr>
<td> </td>
<td><strong><a href="admin.php"><img src="images/icons/home.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="admin.php" class="menulinkup">Home</a></strong></td>
<td> </td>
<td><strong><a href="admin.php?fmaction=upload&rel_dir=<?php echo $rel_dir; ?>"><img src="images/icons/up.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="admin.php?fmaction=upload&rel_dir=<?php echo $rel_dir; ?>" class="menulinkup">Upload</a></strong></td>
<td> </td>
<td><strong><a href="javascript:refresh_page('<?php echo $rel_dir;?>');"><img src="images/icons/refresh.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="javascript:refresh_page('<?php echo $rel_dir;?>');" class="menulinkup">Refresh</a></strong></td>
<td> </td>
<td><strong><a href="admin.php?fmaction=about"><img src="images/icons/about.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="admin.php?fmaction=about" class="menulinkup">About/Vote</a></strong></td>
<td> </td>
<td><strong><a href="admin.php?fmaction=logout"><img src="images/icons/logout.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="admin.php?fmaction=logout" class="menulinkup">Logout</a></strong></td>
<td> </td>
<td><strong><a href="admin.php?fmaction=about"><img src="images/icons/about.gif" width="19" height="19" border="0"></a></strong></td>
<td><strong><a href="help/index.htm" target="_blank" class="menulinkup">Help</a></strong></td>
<td> </td>
</tr>
</table>
</div></td>
</tr>
</table>
<br>
<table width="90%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="dddddd">
<tr>
<td width="59%" bgcolor="f7f7f7">Current Directory : <a href="<?php echo "admin.php?rel_dir=$rel_dir"; ?>" class="slink"><?php echo $show_dir; ?></a></td>
</tr>
</table>
<script language="JavaScript" type="text/JavaScript">
function editWin(link_open,rel_path)
{
var build_link="admin.php?action=edit&rel_dir="+rel_path+"&edit="+link_open;
var win1=window.open(build_link,"Edit",'scrollbars=yes,width=750,height=800');
win1.focus();
}
function chmod(path,rel_path)
{
var a= prompt("Please enter the new permissions [ x = 1 , w = 2 , r = 4 ]\nThe value should be octal ( 0666 , 0755 etc )","");
if( a!="" && a!=null )
{
window.location="admin.php?rel_dir="+rel_path+"&cpath="+path+"&cmode="+a;
}
}
function chmodAll()
{
var a= prompt("Please enter the new permissions for the selected [ x = 1 , w = 2 , r = 4 ]\nThe value should be octal ( 0666 , 0755 etc )","");
if( a!="" && a!=null )
{
document.filelist.achmod.value=a;
document.filelist.m_chmod.value='true';
document.filelist.submit();
}
}
function upload(rel_path)
{
var build_link="admin.php?action=upload&rel_dir="+rel_path;
var win1=window.open(build_link,"","");
win1.focus();
}
function viewWin(link_open,rel_path)
{
var build_link="admin.php?action=view&rel_dir="+rel_path+"&view="+link_open;
var win2=window.open(build_link,"View",'scrollbars=yes,width=750,height=800');
win2.focus();
}
function openWin( info) {
window.alert(info);
}
function clip_empty()
{
alert ("Please cut or copy some files first ")
}
function confirm_del(link_del,rel_path)
{
if( confirm ("Do you want to delete the file : "+ link_del))
{
window.location="admin.php?rel_dir="+rel_path+"&del="+link_del;
}
}
function dir_del(dir_del,rel_path)
{
if( confirm ("Do you want to delete the Directory : "+ dir_del))
{
window.location="admin.php?rel_dir="+rel_path+"&ddel="+dir_del;
}
}
function new_file(rel_path)
{
var a= prompt("Please enter the name of file you want to create :","");
if( a!="" && a!=null )
{
window.location="admin.php?rel_dir="+rel_path+"&file="+a;
}
}
function new_dir(rel_path)
{
var a= prompt("Please enter the Directory you wan to create :","");
if( a!="" && a!=null )
{
window.location="admin.php?rel_dir="+rel_path+"&dir="+a;
}
}
function refresh_page(rel_path)
{
window.location="admin.php?rel_dir="+rel_path;
}
function conf() {
return confirm("Do you want to delete this file(s) or folder(s) !");
}
// New stuff :) /////////////////////////////////
function Toggle(e)
{
if (e.checked) {
Highlight(e);
}
else {
Unhighlight(e);
}
}
function ToggleAll(e)
{
if (e.checked) {
CheckAll();
}
else {
ClearAll();refresh_page('<?php echo $rel_dir;?>');
}
}
function Check(e)
{
e.checked = true;
}
function Clear(e)
{
e.checked = false;
}
function CheckAll()
{
var ml = document.filelist;
var len = ml.elements.length;
for (var i = 0; i < len; i++) {
var e = ml.elements[i];
if (e.name == "sel_f[]" || e.name == "sel_d[]") {
Check(e);
}
}
}
function ClearAll()
{
var ml = document.filelist;
var len = ml.elements.length;
for (var i = 0; i < len; i++) {
var e = ml.elements[i];
if (e.name == "sel_f[]" || e.name == "sel_d[]") {
Clear(e);
}
}
}
function Highlight(e)
{
var r = null;
if (e.parentNode && e.parentNode.parentNode) {
r = e.parentNode.parentNode;
}
else if (e.parentElement && e.parentElement.parentElement) {
r = e.parentElement.parentElement;
}
if (r) {
if (r.className == "wbg") {
r.className = "wbgs";
}
else if (r.className == "gbg") {
r.className = "gbgs";
}
}
}
function Unhighlight(e)
{
var r = null;
if (e.parentNode && e.parentNode.parentNode) {
r = e.parentNode.parentNode;
}
else if (e.parentElement && e.parentElement.parentElement) {
r = e.parentElement.parentElement;
}
if (r) {
if (r.className == "wbgs") {
r.className = "wbg";
}
else if (r.className == "gbgs") {
r.className = "gbg";
}
}
}
</script>
<?php
if(!isset($fmaction))$fmaction="browse";
if($fmaction=="browse")
{
?>
<br>
<form name="filelist" method="post" action="">
<table width="90%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="dddddd">
<tr bgcolor="f7f7f7">
<td width="5%"> <center> </center></td>
<td width="50%"> <strong> <span class="f11">Name</span></strong></td>
<td width="15%"> <center>
<span class="f11"><strong>Size</strong></span>
</center></td>
<td width="15%"> <center>
<span class="f11"><strong>Permissions</strong></span>
</center></td>
<td width="10%"> <center>
<strong> </strong>
</center></td>
<td width="10%"> <center>
<strong> </strong>
</center></td>
<td width="10%"> <center>
<strong> </strong>
</center></td>
<td width="10%"> <center>
<strong> </strong>
</center></td>
<td width="10%"> </td>
</tr>
<tr bgcolor="#fafafa">
<td align="center"><img src="images/mime/folder.gif"></td>
<td ><strong> <a href="<?php
$p_ar=explode("/",$rel_dir,strlen($rel_dir));
$prev_dir="";
for($i=0;$i<count($p_ar)-2;$i++)
{
$prev_dir=$prev_dir.$p_ar[$i];
if($i!=count($p_ar)-2)$prev_dir=$prev_dir."/";
}
if( $prev_dir =="" ){
echo "admin.php?page=fm";
$prev_dir="/";
}
else { echo "admin.php?rel_dir=".$prev_dir; }
?>" class="slink"> .. </a></strong></td>
<td> </td>
<td> </td>
<td><img src="images/spacer.gif" width="19" height="19"> </td>
<td><img src="images/spacer.gif" width="19" height="19"> </td>
<td><img src="images/spacer.gif" width="19" height="19"> </td>
<td><img src="images/spacer.gif" width="19" height="19"></td>
<td><center>
<input type=checkbox name=toggleAll title="Select or deselect all messages" onClick="ToggleAll(this);">
</center> </td>
</tr>
<?php sort($dir_list);
$cdirs=0;
$cfiles=0;
for($i=0;$i<$dir_count;$i++)
{
if($cdirs%2==0){$color="wbg";}
else { $color="gbg";}
include($absolute_path."admin/dbar.php");
$cdirs++;
}
sort($file_list);
for($i=0;$i<$file_count;$i++)
{
if($cfiles%2==0){$color="wbg";}
else { $color="gbg";}
include($absolute_path."admin/fbar.php");
$cfiles++;
}?>
</table>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="43%">Directories : <?php echo $cdirs; ?> Files : <?php echo $cfiles; ?></td>
<td width="57%"> <div align="right">
<input name="achmod" type="hidden" value="">
<input name="m_cut" type="submit" class="textboxgray" id="m_cut" value=" Cut ">
<input name="m_copy" type="submit" class="textboxgray" id="m_copy" value=" Copy ">
<?php if(isset($_SESSION['action']) && $_SESSION['action']!='') {?>
<input name="m_paste" type="submit" class="textboxgray" id="m_paste" value=" Paste ">
<?php } ?>
<input name="m_chmod" type="button" class="textboxgray" value="Chmod" onClick="chmodAll();">
<input name="m_delete" type="submit" class="textboxgray" id="m_delete" value="Delete " onClick="event.returnValue=conf();">
</div></td>
</tr>
</table>
</form>
<br>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="dddddd">
<tr>
<td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="37%"><table border="0" cellspacing="0" cellpadding="3">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="19"><img src="images/icons/lock.gif" width="19" height="19" Alt="Change permissions" title="Change permissions"></td>
<td>Change Permissions</td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="19"><img src="images/icons/edit.gif" width="19" height="19" Alt="Edit this file" title="Edit this file"></td>
<td>Edit file</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="19"><img src="images/icons/delete.gif" width="19" height="19" Alt="Delete this file" title="Delete this file"></td>
<td>Delete file</td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="19"><img src="images/icons/view.gif" width="19" height="19" Alt="View this file" title="View this file"></td>
<td>View file</td>
</tr>
</table></td>
</tr>
</table></td>
<td width="63%" valign="top"><table border="0" align="right" cellpadding="3" cellspacing="0">
<tr>
<td><div align="right">New file :</div></td>
<td ><form name="form1" method="post" action="admin.php?rel_dir=<?php echo $rel_dir; ?>">
<input name="file" type="text" class="textboxgray" id="file2">
<input name="Submit" type="submit" class="textboxgray" value="Submit">
</form></td>
</tr>
<tr>
<td><div align="right">New Directory : </div></td>
<td><form name="form2" method="post" action="admin.php?rel_dir=<?php echo $rel_dir; ?>">
<input name="dir" type="text" class="textboxgray" id="dir2">
<input name="Submit2" type="submit" class="textboxgray" value="Submit">
</form></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<?php }
if($fmaction=="view")
{
include($absolute_path."admin/view.php");
}
if($fmaction=="edit")
{
include($absolute_path."admin/edit.php");
}
if($fmaction=="upload")
{
include($absolute_path."admin/upload.php");
}
if($fmaction=="about")
{
include($absolute_path."admin/about.php");
}
?>
<br> </td>
</tr>
</table></td>
<td width="20"> </td>
</tr>
</table>
<div align="center">
<table width="770" height="49" border="0" cellpadding="0" cellspacing="0" background="images/interface/bottom.gif">
<tr>
<td><div align="right"><span class="small" style="color:#BAB9B9"><strong>WEB</strong>insta FM manager V0.1<br>
Copyright 2004 <strong>WEB</strong>insta</span> </div></td>
<td width="40"><div align="right"></div></td>
</tr>
</table>
</tr>
</div>
<tr>
<td width="10" height="10" background="images/interface/bottom_left_corner.png"></td>
<td background="images/interface/bottom_line.png"></td>
<td width="10" height="10" background="images/interface/bottom_right_corner.png"></td>
</tr>
<div align="center">
</table>
</td>
</div>
<td background="images/interface/right_line.png"></td>
<div align="center">
</tr>
</div>
<tr>
<td width="10" height="10" background="images/interface/bottom_left_corner.png"></td>
<td background="images/interface/bottom_line.png"></td>
<td width="10" height="10" background="images/interface/bottom_right_corner.png"></td>
</tr>
<div align="center"> </div>
</div>
</body>
</html>