File size: 2.95Kb
<?php
if (empty($_POST['submit'])) {
echo '<form action="?func=file.pack';
if (isset($_GET['plid']) and isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']);
} elseif (isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']);
}
echo '" method="post">' . "\n";
echo 'Тип:<br />' . "\n";
echo '<select name="filetype">' . "\n";
echo '<option value="zip">Zip архив</option>' . "\n";
echo '<option value="tar">Tar архив</option>' . "\n";
echo '</select><br />' . "\n";
echo 'Имя архива:<br />' . "\n";
echo '<input name="name" /><br />' . "\n";
echo '<input name="files" type="hidden" value="' . implode(', ', $_POST['check']) . '" />' . "\n";
echo '<input name="submit" type="submit" value="Создать" />' . "\n";
echo '</form>' . "\n";
echo '<hr />' . "\n";
echo '<img src="images/t-back.png" alt=".." /><a href="?func=file';
if (isset($_GET['plid']) and isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']);
} elseif (isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']);
}
echo '">Вернуться</a>' . "\n";
} else {
if (isset($_GET['plid']) and isset($_GET['elid'])) {
$plid = $_GET['plid'] . '/' . $_GET['elid'];
} elseif (isset($_GET['elid'])) {
$plid = $_GET['elid'];
} else {
$plid = '';
}
$content = api_query('https://' . $server . '/manager/ispmgr?func=file.pack&plid=' . urlencode($plid) . '&filetype=' . urlencode($_POST['filetype']) . '&name=' . urlencode($_POST['name']) . '&files=' . urlencode($_POST['files']) . '&sok=ok&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
$parse_xml = simplexml_load_string($content);
if (isset($parse_xml->ok)) {
echo '<div style="text-align:center">' . "\n";
echo 'Архив успешно создан!<br />' . "\n";
echo '<a href="?func=file';
if (isset($_GET['plid']) and isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']);
} elseif (isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']);
}
echo '">Продолжить»</a>' . "\n";
echo '</div>' . "\n";
} else {
echo '<div style="text-align:center">' . "\n";
echo 'Ошибка при создании архива!<br />' . "\n";
echo '<a href="?func=file';
if (isset($_GET['plid']) and isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']);
} elseif (isset($_GET['elid'])) {
echo '&elid=' . urlencode($_GET['elid']);
}
echo '">Продолжить»</a>' . "\n";
echo '</div>' . "\n";
}
}
?>