<?php

if (isset($_GET['elid'])) {
    $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwaddtypes&elid=' . urlencode($_GET['elid']) . '&out=xml&auth=' . urlencode($_SESSION['auth']));
} else {
    $content = api_query('https://' . $server . '/manager/ispmgr?func=wwwaddtypes&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=wwwaddtypes.edit';
if (isset($_GET['elid'])) {
    echo '&amp;plid=' . urlencode($_GET['elid']);
}
echo '">Создать MIME-тип</a>' . "\n";
echo '</div>' . "\n";
foreach($parse_xml->elem as $var) {
    echo '<div class="post"><b>WWW домен:</b> ' . htmlentities((string)$var->domain, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '<b>Тип данных:</b> ' . htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '<b>Расширение файла:</b> ' . htmlentities((string)$var->val, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '&#187; <a href="?func=wwwaddtypes.edit&amp;elid=' . urlencode((string)$var->key);
    if (isset($_GET['elid'])) {
        echo '&amp;plid=' . urlencode($_GET['elid']);
    }
    echo '">Изменить</a><br />' . "\n";
    echo '&#187; <a href="?func=wwwaddtypes.delete&amp;elid=' . urlencode((string)$var->key);
    if (isset($_GET['elid'])) {
        echo '&amp;plid=' . urlencode($_GET['elid']);
    }
    echo '">Удалить</a>' . "\n";
    echo '</div>' . "\n";
}
if (isset($_GET['elid'])) {
    echo '<img src="images/t-back.png" alt=".." /><a href="?func=wwwdomain">Вернуться</a><br />' . "\n";
}
echo '<div class="menu"><img src="images/sb-menu.png" alt="." /><a href="?func=menu">Вернуться в меню</a>' . "\n</div>";

?>