<?php

$content = api_query('https://' . $server . '/manager/ispmgr?func=wwwdomain&out=xml&auth=' . urlencode($_SESSION['auth']));
$parse_xml = simplexml_load_string($content);
echo '<div class="menu"><img src="images/t-new.png" alt="." /><a href="?func=wwwdomain.edit">Создать новый WWW домен</a>' . "\n";
echo '</div>' . "\n";
foreach($parse_xml->elem as $var) {
    echo '<div class="post"><b>Домен:</b> ' . htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '<b>Параметры:</b> ';
    if (isset($var->active)) {
        echo '<img src="images/p-on.png" alt="on" />';
    } else {
        echo '<img src="images/p-off.png" alt="off" />';
    }
    if (isset($var->php)) {
        echo '<img src="images/p-php.png" alt="php" />';
    }
    if (isset($var->cgi)) {
        echo '<img src="images/p-cgi.png" alt="cgi" />';
    }
    if (isset($var->ssi)) {
        echo '<img src="images/p-ssi.png" alt="ssi" />';
    }
    if (isset($var->ror)) {
        echo '<img src="images/p-ror.png" alt="ror" />';
    }
    if (isset($var->ssl)) {
        echo '<img src="images/p-ssl.png" alt="ssl" />';
    }
    echo '<br />' . "\n";
    echo '<b>IP-адрес:</b> ' . htmlentities((string)$var->ip, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '<b>Директория:</b> ' . htmlentities((string)$var->docroot, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '&#187; <a href="http://' . htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '/webstat/">Статистика посещений</a><br />' . "\n";
    echo '&#187; <a href="?func=wwwredirect&amp;elid=' . urlencode((string)$var->name) . '">Редиректы</a><br />' . "\n";
    echo '&#187; <a href="?func=errpage&amp;elid=' . urlencode((string)$var->name) . '">Страницы ошибок</a><br />' . "\n";
    echo '&#187; <a href="?func=wwwaddtypes&amp;elid=' . urlencode((string)$var->name) . '">MIME типы</a><br />' . "\n";
    echo '&#187; <a href="?func=wwwdomain.edit&amp;elid=' . urlencode((string)$var->name) . '">Изменить</a><br />' . "\n";
    if (isset($var->active)) {
        echo '&#187; <a href="?func=wwwdomain.disable&amp;elid=' . urlencode((string)$var->name) . '">Выключить</a><br />' . "\n";
    } else {
        echo '&#187; <a href="?func=wwwdomain.enable&amp;elid=' . urlencode((string)$var->name) . '">Включить</a><br />' . "\n";
    }
    echo '&#187; <a href="?func=wwwdomain.delete&amp;elid=' . urlencode((string)$var->name) . '">Удалить</a>' . "\n";
    echo '</div>' . "\n";
}
echo '<div class="menu"><img src="images/sb-menu.png" alt="." /><a href="?func=menu">Вернуться в меню</a>' . "\n</div>";

?>