// Check add post id's. for ($i = 0; $i < count($_REQUEST['marked']); $i++) { $_REQUEST['marked'][$i] = posts_check_id($_REQUEST['marked'][$i]); } // Now post id's are safe. Get post by it's id's. $posts = posts_get_by_ids($_REQUEST['marked']); // Do action for each marked post. foreach ($posts as $post) { // Ban poster. switch ($a['ban_type']) { case 'simple': // Ban for 1 hour by default. bans_add($post['ip'], $post['ip'], 'Banned via Moderator\\\'s Main Script.', date(Config::DATETIME_FORMAT, time() + 60 * 60)); break; case 'hard': hard_ban_add($post['ip'], $post['ip']); break; } // Delete posts or attachments. switch ($a['del_type']) { case 'post': posts_delete($post['id']); break; case 'file': posts_attachments_delete_by_post($post['id']); break; case 'last': // Delete all posts posted from this IP-address in last // hour. posts_delete_last($post['id'], date(Config::DATETIME_FORMAT, time() - 60 * 60)); break;
if ($new_range_beg === FALSE) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, kotoba_last_error()); exit(1); } $new_range_end = bans_check_range_end($_POST['new_range_end']); if ($new_range_end === FALSE) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, kotoba_last_error()); exit(1); } hard_ban_add(long2ip($new_range_beg), long2ip($new_range_end)); } // Display page. $smarty->assign('show_control', is_admin() || is_mod()); $smarty->assign('boards', boards_get_visible($_SESSION['user'])); $smarty->display('hard_ban.tpl'); // Cleanup. DataExchange::releaseResources(); Logging::close_log(); exit(0); } catch (KotobaException $e) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_exception_page($smarty, $e, is_admin() || is_mod()); exit(1);