Просмотр файла manager/edit.php

Размер файла: 3.33Kb
<?
// Файловый Менеджер + Редактор
// Gmanager
//
// Версия: 0.4.1b
// Автор: Gemorroj
// http://wapinet.ru
//
// Номера кошельков. Надеюсь понятно для чего =)
// WMR 167963845445
// WMZ 225757696726



require 'functions.php';

$charset = $_GET['charset'];
if($charset == 'utf-8' || $charset == 'windows-1251')
{$full_charset = 'charset='.$charset.'&amp;';}

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

send_header();

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

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

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

if($charset == 'windows-1251')
{$content = @iconv('UTF-8','windows-1251',htmlspecialchars(file_get_contents($current)));}
elseif($charset == 'utf-8')
{$content = @iconv('windows-1251','UTF-8',htmlspecialchars(file_get_contents($current)));}
else
{$content = htmlspecialchars(file_get_contents($current));}

print '<div>
'.$lng['sz'].' '.file_size($current).'<br/>
</div>
<div class="input">
<form action="?go=save&amp;c='.$current.'" method="post">
<div>
<textarea name="text" rows="16" cols="64">
'.$content.'
</textarea>
<br/>
'.$lng['only_write'].'<br/>
<input type="checkbox" name="w" value="1"/><br/>
CHMOD<br/>
<input type="text" name="chmod" value="'.look_chmod($current).'" size="4" maxlength="4"/><br/>
<input type="submit" value="'.$lng['ch'].'"/>
</div>
</form>
</div>
<div class="border">
<a href="?c='.$current.'&amp;'.$full_charset.'go=syntax">'.$lng['syntax'].'</a><br/>
</div>
<div class="border">
<a href="?c='.$current.'&amp;'.$full_charset.'go=validator">'.$lng['validator'].'</a><br/>
</div>
<div class="border">
'.$lng['charset'].'
<form action="" method="get">
<div>
<input type="hidden" name="c" value="'.$current.'"/>';

if($charset == 'windows-1251')
{
print '<input type="radio" name="charset"/>'.$lng['charset_no'].'
<input type="radio" name="charset" value="utf-8"/>'.$lng['charset_utf'].'
<input type="radio" name="charset" value="windows-1251" checked="checked"/>'.$lng['charset_win'];
}
elseif($charset == 'utf-8')
{
print '<input type="radio" name="charset"/>'.$lng['charset_no'].'
<input type="radio" name="charset" value="utf-8" checked="checked"/>'.$lng['charset_utf'].'
<input type="radio" name="charset" value="windows-1251"/>'.$lng['charset_win'];
}
else
{
print '<input type="radio" name="charset" checked="checked"/>'.$lng['charset_no'].'
<input type="radio" name="charset" value="utf-8"/>'.$lng['charset_utf'].'
<input type="radio" name="charset" value="windows-1251"/>'.$lng['charset_win'];
}

print '<input type="submit" value="'.$lng['ch'].'"/>
</div>
</form>
</div>';
break;

case 'save':
if($_POST['w'])
{$mode = 'w';}
else
{$mode = 'w+';}

print create_file($current,$mode,$_POST['chmod'],$_POST['text']);
break;

case 'syntax':
if(!$syntax)
{print syntax($current,$charset);}
else
{print syntax2($current);}
break;

case 'validator':
print validator('http://'.explode_url($_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'],substr_count($current,'../')+2).str_replace('../',null,$current),$charset);
break;
}

list($msec,$sec) = explode(' ',microtime());
print '<div class="border">'.round(($sec+$msec)-$HeadTime,4).'<br/></div>'.$foot;
?>