Просмотр файла change.php

Размер файла: 4.18Kb
<?
// Скрипт Файлового Менеджера
// Результат 3-х дневного круглосуточного бдения =)
//
// Версия: 0.1d
// Обновления Ищите Здеся: http://wapinet.ru/script/
// Автор: Gemorroj
//
// Номера кошельков. Надеюсь понятно для чего =)
// WMR 167963845445
// WMZ 225757696726



require 'functions.php';

$current = c($_SERVER['QUERY_STRING'],$_GET['c']);

send_header();

print $top.'
<div class="w2">
'.$lng['title_change'].'<br/>
</div>
'.this($current);

switch($_GET['go'])
{
default:

if(!file_exists($current))
{
print '<div class="red">'.$lng['not_found'].'<br/></div>';
break;
}

$chmod = look_chmod($current);

/*
if(is_file($current))
{
$name = strrchr($current, '/');
}
else
{
$len = strlen($current)-1;
$name = substr($current,0,$len);
$name = strrchr($name,'/');
}

$name = str_replace('/',NULL,$name);
*/

if(is_dir($current))
{
$size = dir_size($current);
}
elseif(is_file($current))
{
$size = file_size($current);
}

print '<div>
'.$lng['sz'].' '.$size.'<br/>
</div>
<div class="input">
<form action="?go=rename&amp;c='.$current.'" method="post">
<div>
'.$lng['change_func'].'<br/>
<input type="text" name="name" value="'.$current.'"/><br/>
'.$lng['change_del'].'<br/>
<input type="checkbox" name="del" value="1"/><br/>
<input type="submit" value="'.$lng['ch'].'"/>
</div>
</form>
<form action="?go=chmod&amp;c='.$current.'" method="post">
<div>
'.$lng['change_chmod'].'<br/>
<input type="text" size="4" maxlength="4" name="chmod" value="'.$chmod.'"/><br/>
<input type="submit" value="'.$lng['ch'].'"/>
</div>
</form>
</div>
<div class="border"><a href="?go=del&amp;c='.$current.'">'.$lng['dl'].'</a><br/></div>';
break;


case 'del':
if(is_dir($current))
{
del_dir($current);
print '<div class="red">'.$lng['del_dir_true'].'<br/></div>';
}
else
{
print del_file($current);
}
break;


case 'chmod':
print rechmod($current,$_POST[chmod]);
break;

case 'create_dir':
if(!$_POST['name'] || !$_POST[chmod])
{
print '<div class="input">
<form action="?go=create_dir&amp;c='.$current.'" method="post">
<div>
'.$lng['change_name'].'<br/>
<input type="text" name="name" value="dir"/><br/>
'.$lng['change_chmod'].'<br/>
<input type="text" name="chmod" size="4" maxlength="4" value="0755"/><br/>
<input type="submit" value="'.$lng['cr'].'"/>
</div>
</form>
</div>';
}
else
{
$dir = trim($current.trim($_POST['name']));
print create_dir($dir,$_POST[chmod]);
}
break;


case 'create_file':
if(!$_POST['name'] || !$_POST[chmod])
{
print '<div class="input">
<form action="?go=create_file&amp;c='.$current.'" method="post">
<div>
'.$lng['change_name'].'<br/>
<input type="text" name="name" value="file.php"/><br/>
'.$lng['change_chmod'].'<br/>
<input type="text" name="chmod" size="4" maxlength="4" value="0644"/><br/>
'.$lng['only_write'].'<br/>
<input type="checkbox" name="w"/><br/>
<input type="submit" value="'.$lng['cr'].'"/>
</div>
</form>
</div>';
}
else
{
if(file_exists($current.$_POST['name']) && !$_POST[a])
{
print '<div class="red">'.$lng['warning'].'<br/></div>
<form action="?go=create_file&amp;c='.$current.'" method="post">
<div>
<input type="hidden" name="name" value="'.$_POST['name'].'"/>
<input type="hidden" name="chmod" value="'.$_POST['chmod'].'"/>';
if($_POST['w'])
{
print '<input type="hidden" name="w" value="1"/>';
}
print '<input type="hidden" name="a" value="1"/>
<input type="submit" value="'.$lng['ch'].'"/>
</div>
</form>';
}
else
{

$file = trim($current.trim($_POST['name']));
if($_POST['w'])
{
$mode = 'w';
}
else
{
$mode = 'w+';
}
print create_file($file,$mode,$_POST[chmod],NULL);

}
}
break;


case 'rename':

if(is_dir($current))
{
copy_d($_POST['name']);

$static = static_name($current,$_POST['name']);


if($_POST['del'])
{
print move_files($current, $_POST['name'], $static);
}
else
{
print copy_files($current, $_POST['name'], $static);
}
}
else
{

if($_POST['del'])
{
print move_file($current, $_POST['name']);
}
else
{
print copy_file($current, $_POST['name']);
}
}
break;
}

print $foot;
?>