Browse Source

Add board filter functionality to Recent Posts interface

main
Benjamin Southall 7 years ago
committed by discomrade
parent
commit
f458f08989
  1. 25
      inc/mod/pages.php
  2. 3
      mod.php

25
inc/mod/pages.php

@ -753,7 +753,13 @@ function mod_view_board($boardName, $page_no = 1) {
$overboard->settings['title'] = $config['overboards'][$boardName]['title'];
$overboard->settings['subtitle'] = $config['overboards'][$boardName]['subtitle'];
$overboard->settings['thread_limit'] = $config['overboards'][$boardName]['thread_limit'];
$overboard->settings['exclude'] = $config['overboards'][$boardName]['exclude'];
if (array_key_exists('exclude',$config['overboards'][$boardName])) {
$overboard->settings['exclude'] = $config['overboards'][$boardName]['exclude'];
}
if (array_key_exists('include',$config['overboards'][$boardName])) {
$overboard->settings['include'] = $config['overboards'][$boardName]['include'];
}
$overboard->settings['boards'] = listBoards();
echo $overboard->build($mod);
return;
@ -2653,7 +2659,7 @@ function mod_report_dismiss($id, $all = false) {
header('Location: ?/reports', true, $config['redirect_http']);
}
function mod_recent_posts($lim,$json = false) {
function mod_recent_posts($lim,$board_list = false,$json=false) {
global $config, $mod, $pdo;
if (!hasPermission($config['mod']['recent']))
@ -2675,6 +2681,21 @@ function mod_recent_posts($lim,$json = false) {
$mod_boards = $boards;
}
if ($board_list != false){
$board_array = explode(",",$board_list);
$new_board_array = array();
foreach ($board_array as $board) {
$newboard = $board;
$new_board_array[] = $newboard;
}
$mod_boards = array();
foreach ($boards as $board) {
if (in_array($board['uri'], $new_board_array)){
$mod_boards[] = $board;
}
}
}
// Manually build an SQL query
$query = 'SELECT * FROM (';
foreach ($mod_boards as $board) {

3
mod.php

@ -67,7 +67,8 @@ $pages = array(
'/ban-appeals' => 'secure_POST ban_appeals', // view ban appeals
'/recent/(\d+)' => 'recent_posts', // view recent posts
'/recent/(\d+)/(json)?' => 'recent_posts', // view recent posts JSON
'/recent/(\d+)/([\w,]+?)' => 'recent_posts', // view recent posts
'/recent/(\d+)/([\w,]+?)/(json)?' => 'recent_posts', // view recent posts JSON
'/search' => 'search_redirect', // search
'/search/(posts|IP_notes|bans|log)/(.+)/(\d+)' => 'search', // search

Loading…
Cancel
Save