Esempio n. 1
0
    if (isset($_REQUEST['password']) && $_REQUEST['password'] != '') {
        $password = posts_check_password($_REQUEST['password']);
        if ($password === FALSE) {
            // Cleanup
            DataExchange::releaseResources();
            display_error_page($smarty, kotoba_last_error());
            exit(1);
        }
        if (!isset($_SESSION['password']) || $_SESSION['password'] != $password) {
            $_SESSION['password'] = $password;
        }
    }
    // Remove post.
    if (is_admin() || $post['password'] !== NULL && $post['password'] === $password) {
        posts_attachments_delete_by_post($post['id']);
        posts_delete($post['id']);
        // Redirection.
        header('Location: ' . Config::DIR_PATH . "/{$post['board']['name']}/");
    } else {
        // Display password request.
        $smarty->assign('show_control', is_admin() || is_mod());
        $smarty->assign('boards', boards_get_visible($_SESSION['user']));
        $smarty->assign('post', $post);
        $smarty->assign('password', $password);
        $smarty->assign('_SERVER', $_SERVER);
        $smarty->display('remove_post.tpl');
    }
    // Cleanup.
    DataExchange::releaseResources();
    exit(0);
} catch (KotobaException $e) {
Esempio n. 2
0
         if ($new_reason === FALSE) {
             // Cleanup.
             DataExchange::releaseResources();
             Logging::close_log();
             display_error_page($smarty, kotoba_last_error());
             exit(1);
         }
     }
     $new_untill = bans_check_untill($_POST['new_untill']);
     bans_add($new_range_beg, $new_range_end, $new_reason, date('Y-m-d H:i:s', time() + $new_untill));
     $reload_bans = true;
     if (isset($_POST['post'])) {
         if (isset($_POST['add_text'])) {
             posts_add_text_by_id(posts_check_id($_POST['post']), $smarty->fetch('uwb4tp.tpl'));
         } elseif (isset($_POST['del_post'])) {
             posts_delete(posts_check_id($_POST['post']));
         } elseif (isset($_POST['del_all'])) {
             posts_delete_last(posts_check_id($_POST['post']), date(Config::DATETIME_FORMAT, time() - 60 * 60));
         }
     }
 }
 // Delete bans.
 foreach ($bans as $ban) {
     if (isset($_POST['delete_' . $ban['id']])) {
         bans_delete_by_id($ban['id']);
         $reload_bans = true;
     }
 }
 // Unban specified ip.
 if (isset($_POST['unban']) && $_POST['unban'] !== '') {
     $ip = bans_check_range_beg($_POST['unban']);