Esempio n. 1
0
File: delete.php Progetto: rair/yacs
// not found
if (!isset($item['id'])) {
    include '../error.php';
    // permission denied
} elseif (!$permitted) {
    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') {
    // touch the related anchor before actual deletion, since the table has to be accessible at that time
    if (is_object($anchor)) {
        $anchor->touch('table:delete', $item['id']);
    }
    // delete and go back to the anchor or to the index page
    if (Tables::delete($item['id'])) {
        Tables::clear($item);
        if (is_object($anchor)) {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url());
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/');
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this table'), NULL, NULL, 'confirmed');
    if (is_object($anchor)) {
        $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
Esempio n. 2
0
File: edit.php Progetto: rair/yacs
        // post-processing
    } else {
        // a new post
        if (!$item['id']) {
            // touch the related anchor
            $anchor->touch('table:create', $_REQUEST['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y');
            // clear cache
            Tables::clear($_REQUEST);
            // increment the post counter of the surfer
            Users::increment_posts(Surfer::get_id());
            // an update
        } else {
            // touch the related anchor
            $anchor->touch('table:update', $_REQUEST['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y');
            // clear cache
            Tables::clear($_REQUEST);
        }
        // go to the updated page
        Safe::redirect($next);
    }
    // display the form on GET
} else {
    $with_form = TRUE;
}
// display the form
if ($with_form) {
    // reference the anchor page
    if (is_object($anchor) && $anchor->is_viewable()) {
        $context['text'] .= '<p>' . sprintf(i18n::s('In: %s'), Skin::build_link($anchor->get_url(), $anchor->get_title())) . "</p>\n";
    }
    // the form to edit an table