From 4fcf9c2c916140f8dc95fc975b4ff61cfb98c6cf Mon Sep 17 00:00:00 2001 From: Michael Save Date: Fri, 20 Apr 2012 19:47:55 +1000 Subject: [PATCH] Starting on ?/ban/ --- inc/mod/pages.php | 18 ++++++++++++++++++ mod.php | 1 + 2 files changed, 19 insertions(+) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 541a7c23..7bc970b0 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -365,6 +365,24 @@ function mod_bumplock($board, $unbumplock, $post) { header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']); } +function mod_ban_post($board, $delete, $post) { + global $config, $mod; + + if (!openBoard($board)) + error($config['error']['noboard']); + + if (!hasPermission($config['mod']['delete'], $board)) + error($config['error']['noaccess']); + + $query = prepare(sprintf('SELECT `ip` FROM `posts_%s` WHERE `id` = :id', $board)); + $query->bindValue(':id', $post); + $query->execute() or error(db_error($query)); + if(!$ip = $query->fetchColumn(0)) + error($config['error']['404']); + + mod_page("New ban", 'mod/ban_form.html', array()); +} + function mod_delete($board, $post) { global $config, $mod; diff --git a/mod.php b/mod.php index 85d10c6c..57967da5 100644 --- a/mod.php +++ b/mod.php @@ -44,6 +44,7 @@ $pages = array( '!^/bans/(\d+)$!' => 'bans', // ban list '!^/(\w+)/delete/(\d+)$!' => 'delete', // delete post + '!^/(\w+)/ban/(&delete/)?(\d+)$!' => 'ban_post', // ban poster '!^/(\w+)/(un)?lock/(\d+)$!' => 'lock', // lock thread '!^/(\w+)/(un)?sticky/(\d+)$!' => 'sticky', // sticky thread '!^/(\w+)/bump(un)?lock/(\d+)$!' => 'bumplock', // "bumplock" thread