Beispiel #1
0
// the path to this page
$context['path_bar'] = array('servers/' => i18n::s('Servers'));
// the title of the page
$context['page_title'] = i18n::s('Delete a server');
// not found
if (!isset($item['id'])) {
    include '../error.php';
    // deletion is restricted to associates
} elseif (!Surfer::is_associate()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
    // delete and go back to the index page
    if (Servers::delete($item['id'])) {
        Servers::clear($item);
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'servers/');
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
}
// deletion is restricted to associates
if ($item['id'] && Surfer::is_associate()) {
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::build_submit_button(i18n::s('Yes, I want to suppress this server'), NULL, NULL, 'confirmed') . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the title of the server
    $context['text'] .= Skin::build_block($item['title'], 'title');
    // the nick name