Файл: hostbiter.ru/Modules/install.php
Строк: 124
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/core.php');
$title = 'Установка движков';
require ($_SERVER['DOCUMENT_ROOT'].'/Core/myhead.php');
if(!$user){
header("Location: /");
exit;
}
switch($_GET['do']){
default:
$engines = $db->prepare("SELECT * FROM `engines`");
$engines->execute();
$engines = $engines->fetchAll();
foreach($engines as $row){
?>
<div class="border1" id="border" title="Информация о движке <?=$row['name']?>">
<a href="/install.php?do=view&id=<?=$row['id']?>"><img src="/image/forward.png" alt="" /> <?=$row['name']?></a><br />
</div>
<?
}
echo '<img src="/image/dir.gif" alt="" /> <a href="/explode">Файловый менеджер</a><br />';
break;
case 'view':
$id = abs(intval($_GET['id']));
$engine = $db->prepare("SELECT * FROM `engines` WHERE `id` = ?");
$engine->execute([$id]);
$engine = $engine->fetch();
$domains = $db->prepare("SELECT * FROM `domains` WHERE `user` = ?");
$domains->execute([$user['id']]);
$domains = $domains->fetchAll();
?>
<div id="border">Подготовка к установке</div><?=$engine['desc']?>
<div class="border2" id="border" title="Установка движка">
<form method="post" action="/install.php?do=postinstall&id=<?=$engine['id']?>">
Куда ставить: <br />
<select name="domain">
<?
foreach($domains as $row){
?>
<option value="<?=$row['domain']?>"><?=$row['domain']?></option>
<?
}
?>
<option value="<?=$user['login']?>.<?=$config['HostSite']?>"><?=$user['login']?>.<?=$config['HostSite']?></option>
</select><br />
<input type="submit" value="Установить" />
</form>
</div>
<div>
<img src="http://hostbiter.ru/image/dir.gif" alt="" /> <a href="/explode">Файловый менеджер</a><br />
<img src="http://hostbiter.ru/image/reload.gif" alt="" /> <a href="/install.php">Назад</a><br />
<?
break;
case 'postinstall':
$id = abs(intval($_GET['id']));
$domain = htmlspecialchars(trim($_POST['domain']));
$engine = $db->prepare("SELECT * FROM `engines` WHERE `id` = ?");
$engine->execute([$id]);
$engine = $engine->fetch();
$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();
$engarc = $_SERVER['DOCUMENT_ROOT'].'/engines/'.$engine['zip'];
$dir = '/www/'.$domain.'/';
$dir2 = '/www/'.$domain;
ftp_login($connect_ftp,$ftp['login'],$ftp['password']);
ftp_rmdir($connect_ftp,$dir);
ftp_mkdir($connect_ftp,$dir);
ftp_chdir($connect_ftp,$dir);
ftp_put($connect_ftp,$engine['zip'],$engarc,FTP_ASCII);
ftp_delete($connect_ftp,$dir.$engine['zip']);
ftp_close($connect_ftp);
file_get_contents($config['PanelUrl']."/ispmgr?authinfo=".$user['login'].":".decode($user['password'])."&func=file.folder&out=xml&elid=".$dir2."");
file_get_contents($config['PanelUrl']."/ispmgr?authinfo=".$user['login'].":".decode($user['password'])."&func=file.extract&out=xml&sok=ok&elid=".$engine['zip']."");
header("Location: http://".$domain."/".$engine['install']);
exit;
break;
}
require ($_SERVER['DOCUMENT_ROOT'].'/Core/myfoot.php');
?>