Файл: hostbiter.ru/Modules/explode/multi.php
Строк: 101
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/core.php');
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmhead.php');
if(!empty($_GET['dir']) AND $_GET['dir'] != encode('www')){
$dir = htmlspecialchars(trim($_GET['dir']));
$dir_api = decode($dir);
$dirname = dirname(decode($dir));
$api = file_get_contents($config['PanelUrl']."/ispmgr?authinfo=".$user['login'].":".decode($user['password'])."&func=file&out=xml&elid=".$dir_api."");
$api2 = file_get_contents($config['PanelUrl']."/ispmgr?authinfo=".$user['login'].":".decode($user['password'])."&func=file.unixattr&out=xml&elid=".$dirname."");
$parse2 = simplexml_load_string($api2);
echo '<span class="area"><a href="/explode?dir='.encode($dirname).'">
<img src="/image/up.png" title="Перейти на уровень выше" alt="up"/> </a> /'.$dir_api.'
(<a href="/explode/view/chmod.php?dir='.$dir.'">'.$parse2->mode.'</a>)</span><br /><br/>';
}else{
$dir = encode('www');
$api = file_get_contents($config['PanelUrl']."/ispmgr?authinfo=".$user['login'].":".decode($user['password'])."&func=file&out=xml&elid=www");
}
switch($_GET['case']){
default:
$parse = simplexml_load_string($api);
if(count($parse->elem) > 0){
?>
<script>
function file(form,name,checked){for(var i=0;i<form[name].length;i++){form[name][i].checked=checked;}}
</script>
<?
echo '<form action="/explode/multi.php?case=act" method="post">';
foreach($parse->elem as $row){
if($row->type == 'dir'){
echo '<input type="checkbox" name="file[]" value="'.encode(decode($dir).'/'.$row->name).'"><a href="?dir='.encode(decode($dir).'/'.$row->name).'"><img src="http://hostbiter.ru/image/dir.gif">'.$row->name.'</a><br/>';
}else{
echo '<input type="checkbox" name="file[]" value="'.encode(decode($dir).'/'.$row->name).'"><a href="/explode/viewfile.php?dir='.encode(decode($dir).'/'.$row->name).'">'.$row->name.'</a> '.$row->size.'<br/>';
}
}
?>
<input type="checkbox" value="file" onclick="file(this.form,'file[]',this.checked)" /> Отметить все
<br/>
<input type="submit" value="Выбрать"></form>
<?
}else{
echo 'Директория пуста!<br/>';
}
?><br/>
<img src="http://hostbiter.ru/image/reload.gif" alt="" /> <a href="/explode?dir=<?=$dir?>">К папке</a><br />
<?
break;
case 'act':
$file = $_POST['file'];
$strfile = implode(',',$file);
if(isset($_GET['send']))
{
$check = htmlspecialchars(trim($_POST['check']));
$files = htmlspecialchars(trim($_GET['files']));
header("Location: /explode/multi.php?case=".$check."&files=".$files);
exit;
}
?>
Всего выбрано: <b><?=count($file)?></b><br /><form method="post" action="/explode/multi.php?case=act&files=<?=$strfile?>&send">
<input type="radio" name="check" value="copy" /> Копировать <br />
<input type="radio" name="check" value="move" /> Переместить <br />
<input type="radio" name="check" value="delete" /> Удалить <br />
<div><input type="submit" value="Выбрать" name="send"/></div>
<img src="http://hostbiter.ru/image/reload.gif" alt="" /> <a href="/explode?dir=<?=$dir?>">К папке</a><br />
<?
break;
case 'copy':
$fil = htmlspecialchars(trim($_GET['files']));
if(isset($_GET['copypath'])){
$filess = htmlspecialchars(trim($_GET['filess']));
$exp = explode(',',$filess);
$path = htmlspecialchars(trim($_POST['path']));
$connect_ftp = ftp_connect($config['FTPHost'],21,300);
$ftp = $db->prepare("SELECT * FROM `ftp_users` WHERE `user` = ? LIMIT 1");
$ftp->execute([$user['id']]);
$ftp = $ftp->fetch();
ftp_login($connect_ftp,$ftp['login'],$ftp['password']);
for($i=0;$i = (count($exp)-1);$i++){
$tmp_name = 'tmp_'.$exp[$i];
$dirname_tmp = $_SERVER['DOCUMENT_ROOT'].'/tmp_ftp/'.$tmp_name;
ftp_get($connect_ftp,$dirname_tmp,'/'.decode($exp[$i]),FTP_ASCII);
ftp_put($connect_ftp,$path,$dirname_tmp,FTP_ASCII);
}
ftp_close($connect_ftp);
header("Location: /explode");
exit;
}
?>
<form action="/explode/multi.php?case=copy&filess=<?=$fil?>©path" method="post">
Скопировать в: <br />
<input class="com" name="path" value="/www" type="text" required/><br />
<input type="submit" value="Скопировать" name="copypath"/></div>
</form>
<?
break;
case 'move':
break;
case 'delete':
break;
}
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmfoot.php');
?>