Просмотр файла isp_api/func/errpage.edit.php

Размер файла: 12.28Kb
<?php

if (empty($_GET['elid'])) {
    if (empty($_POST['submit'])) {
        echo '<img src="images/t-new.png" alt="." />Создание страницы ошибки<br />' . "\n";
        echo '<br />' . "\n";
        echo '<form action="?func=errpage.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 '<select name="name">' . "\n";
        echo '<option value="400">400 - Bad Request</option>' . "\n";
        echo '<option value="401">401 - Unauthorized</option>' . "\n";
        echo '<option value="402">402 - Payment Required</option>' . "\n";
        echo '<option value="403">403 - Forbidden</option>' . "\n";
        echo '<option value="404">404 - Not Found</option>' . "\n";
        echo '<option value="405">405 - Method Not Allowed</option>' . "\n";
        echo '<option value="406">406 - Not Acceptable</option>' . "\n";
        echo '<option value="407">407 - Proxy Authentication Required</option>' . "\n";
        echo '<option value="408">408 - Request Timeout</option>' . "\n";
        echo '<option value="409">409 - Conflict</option>' . "\n";
        echo '<option value="411">411 - Length Required</option>' . "\n";
        echo '<option value="412">412 - Precondition Failed</option>' . "\n";
        echo '<option value="413">413 - Request Entity Too Large</option>' . "\n";
        echo '<option value="414">414 - Request-URI Too Long</option>' . "\n";
        echo '<option value="415">415 - Unsupported Media Type</option>' . "\n";
        echo '<option value="416">416 - Requested Range Not Satisfiable</option>' . "\n";
        echo '<option value="417">417 - Expectation Failed</option>' . "\n";
        echo '<option value="500">500 - Internal Server Error</option>' . "\n";
        echo '<option value="501">501 - Not Implemented</option>' . "\n";
        echo '<option value="502">502 - Bad Gateway</option>' . "\n";
        echo '<option value="503">503 - Service Unavailable</option>' . "\n";
        echo '<option value="504">504 - Gateway Timeout</option>' . "\n";
        echo '<option value="505">505 - HTTP Version Not Supported</option>' . "\n";
        echo '</select><br />' . "\n";
        echo 'URL:<br />' . "\n";
        echo '<input name="url" /><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=errpage';
        if (isset($_GET['plid'])) {
            echo '&amp;elid=' . urlencode($_GET['plid']);
        }
        echo '">Вернуться</a>' . "\n";
    } else {
        $content = api_query('https://' . $server . '/manager/ispmgr?func=errpage.edit&domain=' . urlencode($_POST['domain']) . '&name=' . urlencode($_POST['name']) . '&url=' . urlencode($_POST['url']) . '&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 'Страница ошибки успешно создана!<br />' . "\n";
            echo 'Подождите несколько секунд, для перезагрузки сервера, и нажмите &quot;продолжить&quot;.<br />' . "\n";
            echo '<a href="?func=errpage';
            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 'Ошибка при создании страницы ошибки!<br />' . "\n";
            echo '<a href="?func=errpage';
            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=errpage.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="." />Изменение страницы ошибки<br />' . "\n";
        echo '<br />' . "\n";
        echo '<form action="?func=errpage.edit&amp;elid=' . urlencode($_GET['elid']);
        if (isset($_GET['plid'])) {
            echo '&amp;plid=' . urlencode($_GET['plid']);
        }
        echo '" method="post">' . "\n";
        echo 'WWW домен:<br />' . "\n";
        echo '<input name="domain" value="' . htmlentities($_GET['plid'], ENT_QUOTES, 'UTF-8') . '" readonly="readonly" /><br />' . "\n";
        echo 'Код ошибки:<br />' . "\n";
        echo '<select name="name">' . "\n";
        echo '<option value="400"';
        if ((string)$parse_xml->name == '400') {
            echo ' selected="selected"';
        }
        echo '>400 - Bad Request</option>' . "\n";
        echo '<option value="401"';
        if ((string)$parse_xml->name == '401') {
            echo ' selected="selected"';
        }
        echo '>401 - Unauthorized</option>' . "\n";
        echo '<option value="402"';
        if ((string)$parse_xml->name == '402') {
            echo ' selected="selected"';
        }
        echo '>402 - Payment Required</option>' . "\n";
        echo '<option value="403"';
        if ((string)$parse_xml->name == '403') {
            echo ' selected="selected"';
        }
        echo '>403 - Forbidden</option>' . "\n";
        echo '<option value="404"';
        if ((string)$parse_xml->name == '404') {
            echo ' selected="selected"';
        }
        echo '>404 - Not Found</option>' . "\n";
        echo '<option value="405"';
        if ((string)$parse_xml->name == '405') {
            echo ' selected="selected"';
        }
        echo '>405 - Method Not Allowed</option>' . "\n";
        echo '<option value="406"';
        if ((string)$parse_xml->name == '406') {
            echo ' selected="selected"';
        }
        echo '>406 - Not Acceptable</option>' . "\n";
        echo '<option value="407"';
        if ((string)$parse_xml->name == '407') {
            echo ' selected="selected"';
        }
        echo '>407 - Proxy Authentication Required</option>' . "\n";
        echo '<option value="408"';
        if ((string)$parse_xml->name == '408') {
            echo ' selected="selected"';
        }
        echo '>408 - Request Timeout</option>' . "\n";
        echo '<option value="409"';
        if ((string)$parse_xml->name == '409') {
            echo ' selected="selected"';
        }
        echo '>409 - Conflict</option>' . "\n";
        echo '<option value="411"';
        if ((string)$parse_xml->name == '411') {
            echo ' selected="selected"';
        }
        echo '>411 - Length Required</option>' . "\n";
        echo '<option value="412"';
        if ((string)$parse_xml->name == '412') {
            echo ' selected="selected"';
        }
        echo '>412 - Precondition Failed</option>' . "\n";
        echo '<option value="413"';
        if ((string)$parse_xml->name == '413') {
            echo ' selected="selected"';
        }
        echo '>413 - Request Entity Too Large</option>' . "\n";
        echo '<option value="414"';
        if ((string)$parse_xml->name == '414') {
            echo ' selected="selected"';
        }
        echo '>414 - Request-URI Too Long</option>' . "\n";
        echo '<option value="415"';
        if ((string)$parse_xml->name == '415') {
            echo ' selected="selected"';
        }
        echo '>415 - Unsupported Media Type</option>' . "\n";
        echo '<option value="416"';
        if ((string)$parse_xml->name == '416') {
            echo ' selected="selected"';
        }
        echo '>416 - Requested Range Not Satisfiable</option>' . "\n";
        echo '<option value="417"';
        if ((string)$parse_xml->name == '417') {
            echo ' selected="selected"';
        }
        echo '>417 - Expectation Failed</option>' . "\n";
        echo '<option value="500"';
        if ((string)$parse_xml->name == '500') {
            echo ' selected="selected"';
        }
        echo '>500 - Internal Server Error</option>' . "\n";
        echo '<option value="501"';
        if ((string)$parse_xml->name == '501') {
            echo ' selected="selected"';
        }
        echo '>501 - Not Implemented</option>' . "\n";
        echo '<option value="502"';
        if ((string)$parse_xml->name == '502') {
            echo ' selected="selected"';
        }
        echo '>502 - Bad Gateway</option>' . "\n";
        echo '<option value="503"';
        if ((string)$parse_xml->name == '503') {
            echo ' selected="selected"';
        }
        echo '>503 - Service Unavailable</option>' . "\n";
        echo '<option value="504"';
        if ((string)$parse_xml->name == '504') {
            echo ' selected="selected"';
        }
        echo '>504 - Gateway Timeout</option>' . "\n";
        echo '<option value="505"';
        if ((string)$parse_xml->name == '505') {
            echo ' selected="selected"';
        }
        echo '>505 - HTTP Version Not Supported</option>' . "\n";
        echo '</select><br />' . "\n";
        echo 'URL:<br />' . "\n";
        echo '<input name="url" value="' . htmlentities((string)$parse_xml->url, 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=errpage';
        if (isset($_GET['plid'])) {
            echo '&amp;elid=' . urlencode($_GET['plid']);
        }
        echo '">Вернуться</a>' . "\n";
    } else {
        $content = api_query('https://' . $server . '/manager/ispmgr?func=errpage.edit&elid=' . urlencode($_GET['elid']) . '&domain=' . urlencode($_POST['domain']) . '&name=' . urlencode($_POST['name']) . '&url=' . urlencode($_POST['url']) . '&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 'Страница ошибки успешно изменена!<br />' . "\n";
            echo 'Подождите несколько секунд, для перезагрузки сервера, и нажмите &quot;продолжить&quot;.<br />' . "\n";
            echo '<a href="?func=errpage';
            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 'Ошибка при изменении страницы ошибки!<br />' . "\n";
            echo '<a href="?func=errpage';
            if (isset($_GET['plid'])) {
                echo '&amp;elid=' . urlencode($_GET['plid']);
            }
            echo '">Продолжить&#187;</a>' . "\n";
            echo '</div>' . "\n";
        }
    }
}

?>