<?php
if (empty($_POST['check']) and ($_POST['act']<>'paste')) {
    echo '<div class="post"><div style="text-align:center">' . "\n";
    echo 'Ничего не выбрано.<br />' . "\n";
    echo '<a href="?func=file';
    if (isset($_GET['elid'])) {
        echo '&amp;elid=' . urlencode($_GET['elid']);
    }
    if (isset($_GET['plid'])) {
        echo '&amp;plid=' . urlencode($_GET['plid']);
    }
    echo '">Продолжить&#187;</a>' . "\n";
    echo '</div></div>' . "\n";
} elseif ($_POST['act'] == 'delete') {
    require('./func/file.delete.php');
} elseif ($_POST['act'] == 'pack') {
    require('./func/file.pack.php');
} elseif ($_POST['act'] == 'pastec') {
    require('./func/file.pastec.php');
} elseif ($_POST['act'] == 'pastex') {
    require('./func/file.pastex.php');
} elseif ($_POST['act'] == 'paste') {
    require('./func/file.paste.php');
} elseif ($_POST['act'] == 'edit') {
header('location:/isp/index.php?func=file.edit&file='.urlencode(implode(', ', $_POST['check'])));
}
else{

    echo '<div class="post"><form id="form" action="?func=file.act';
    if (isset($_GET['plid']) and isset($_GET['elid'])) {
        echo '&amp;elid=' . urlencode($_GET['elid']) . '&amp;plid=' . urlencode($_GET['plid']);
    } elseif (isset($_GET['elid'])) {
        echo '&amp;elid=' . urlencode($_GET['elid']);
    }
    echo '" method="post">' . "\n";
    echo 'Действие:<br />' . "\n";
    if (!isset($_COOKIE['allfiles']))echo '<input name="act" type="radio" value="edit"/> Редактировать<br/>';
    echo '<input name="act" type="radio" value="pack"/> Запаковать<br/>';
    echo '<input name="act" type="radio" value="delete"/> Удалить<br/>';
    echo '<input name="act" type="radio" value="pastec"/> Копировать<br/>';
    echo '<input name="act" type="radio" value="pastex"/> Вырезать<br/>';
    if (isset($_SESSION['paste']))echo '<input name="act" type="radio" value="paste"/> Вставить<br/>';
    echo '<input name="check[]" type="hidden" value="' .implode(', ', $_POST['check']). '" />' . "\n";
    echo '<input type="submit" value="Выполнить" />' . "\n";
    echo '</form>' . "\n";
    echo '</div>' . "\n";
    setcookie('allfiles', 1, time()-60*60*24*14);
}
?>