View file isp_api/func/wwwaddtypes.edit.php

File size: 6.01Kb
<?php

if (empty($_GET['elid'])) {
    if (empty($_POST['submit'])) {
        echo '<img src="images/t-new.png" alt="." />Создание MIME-типа<br />' . "\n";
        echo '<br />' . "\n";
        echo '<form action="?func=wwwaddtypes.edit';
        if (isset($_GET['plid'])) {
            echo '&amp;plid=' . urlencode($_GET['plid']);
        }
        echo '" method="post">' . "\n";
        echo 'WWW домен:<br />' . "\n";
        if (isset($_GET['plid'])) {
            echo '<input name="domain" value="' . htmlentities($_GET['plid'], ENT_QUOTES, 'UTF-8') . '" readonly="readonly" /><br />' . "\n";
        } else {
            echo '<select name="domain">' . "\n";
            $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwdomain&out=xml&auth=' . urlencode($_SESSION['auth']));
            $parse_xml = simplexml_load_string($content);
            foreach($parse_xml->elem as $var) {
                echo '<option value="' . htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '">' . htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '</option>' . "\n";
            }
            echo '</select><br />' . "\n";
        }
        echo 'Тип данных:<br />' . "\n";
        echo '<input name="name" /><br />' . "\n";
        echo 'Расширение файла:<br />' . "\n";
        echo '<input name="val" /><br />' . "\n";
        echo '<input name="submit" type="submit" value="Создать" /><br />' . "\n";
        echo '</form>' . "\n";
        echo '<hr />' . "\n";
        echo '<img src="images/t-back.png" alt=".." /><a href="?func=wwwaddtypes';
        if (isset($_GET['plid'])) {
            echo '&amp;elid=' . urlencode($_GET['plid']);
        }
        echo '">Вернуться</a>' . "\n";
    } else {
        $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwaddtypes.edit&domain=' . urlencode($_POST['domain']) . '&name=' . urlencode($_POST['name']) . '&val=' . urlencode($_POST['val']) . '&sok=ok&out=xml&auth=' . urlencode($_SESSION['auth']));
        $parse_xml = simplexml_load_string($content);
        if (isset($parse_xml->ok)) {
            echo '<div style="text-align:center">' . "\n";
            echo 'MIME-тип успешно создан!<br />' . "\n";
            echo 'Подождите несколько секунд, для перезагрузки сервера, и нажмите &quot;продолжить&quot;.<br />' . "\n";
            echo '<a href="?func=wwwaddtypes';
            if (isset($_GET['plid'])) {
                echo '&amp;elid=' . urlencode($_GET['plid']);
            }
            echo '">Продолжить&#187;</a>' . "\n";
            echo '</div>' . "\n";
            api_query('https://' . $server . '/manager/ispmgr?func=restart&auth=' . urlencode($_SESSION['auth']));
        } else {
            echo '<div style="text-align:center">' . "\n";
            echo 'Ошибка при создании MIME-типа!<br />' . "\n";
            echo '<a href="?func=wwwaddtypes';
            if (isset($_GET['plid'])) {
                echo '&amp;elid=' . urlencode($_GET['plid']);
            }
            echo '">Продолжить&#187;</a>' . "\n";
            echo '</div>' . "\n";
        }
    }
} else {
    if (empty($_POST['submit'])) {
        $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwaddtypes.edit&elid=' . urlencode($_GET['elid']) . '&out=xml&auth=' . urlencode($_SESSION['auth']));
        $parse_xml = simplexml_load_string($content);
        echo '<img src="images/t-edit.png" alt="." />Изменение MIME-типа<br />' . "\n";
        echo '<br />' . "\n";
        echo '<form action="?func=wwwaddtypes.edit&amp;elid=' . urlencode($_GET['elid']);
        if (isset($_GET['plid'])) {
            echo '&amp;plid=' . urlencode($_GET['plid']);
        }
        echo '" method="post">' . "\n";
        echo 'Тип данных:<br />' . "\n";
        echo '<input name="name" value="' . htmlentities((string)$parse_xml->name, ENT_QUOTES, 'UTF-8') . '" /><br />' . "\n";
        echo 'Расширение файла:<br />' . "\n";
        echo '<input name="val" value="' . htmlentities((string)$parse_xml->val, ENT_QUOTES, 'UTF-8') . '" /><br />' . "\n";
        echo '<input name="submit" type="submit" value="Изменить" /><br />' . "\n";
        echo '</form>' . "\n";
        echo '<hr />' . "\n";
        echo '<img src="images/t-back.png" alt=".." /><a href="?func=wwwaddtypes';
        if (isset($_GET['plid'])) {
            echo '&amp;elid=' . urlencode($_GET['plid']);
        }
        echo '">Вернуться</a>' . "\n";
    } else {
        $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwaddtypes.edit&elid=' . urlencode($_GET['elid']) . '&name=' . urlencode($_POST['name']) . '&val=' . urlencode($_POST['val']) . '&sok=ok&out=xml&auth=' . urlencode($_SESSION['auth']));
        $parse_xml = simplexml_load_string($content);
        if (isset($parse_xml->ok)) {
            echo '<div style="text-align:center">' . "\n";
            echo 'MIME-тип успешно изменен!<br />' . "\n";
            echo 'Подождите несколько секунд, для перезагрузки сервера, и нажмите &quot;продолжить&quot;.<br />' . "\n";
            echo '<a href="?func=wwwaddtypes';
            if (isset($_GET['plid'])) {
                echo '&amp;elid=' . urlencode($_GET['plid']);
            }
            echo '">Продолжить&#187;</a>' . "\n";
            echo '</div>' . "\n";
            api_query('https://' . $server . '/manager/ispmgr?func=restart&auth=' . urlencode($_SESSION['auth']));
        } else {
            echo '<div style="text-align:center">' . "\n";
            echo 'Ошибка при изменении MIME-типа!<br />' . "\n";
            echo '<a href="?func=wwwaddtypes';
            if (isset($_GET['plid'])) {
                echo '&amp;elid=' . urlencode($_GET['plid']);
            }
            echo '">Продолжить&#187;</a>' . "\n";
            echo '</div>' . "\n";
        }
    }
}

?>