From cd1c1730e4645fd2e5035ba38d209ee95f52a040 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 29 Mar 2015 19:42:25 -0700 Subject: [PATCH] Improve ?/reports API --- inc/mod/pages.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index af5f4f2d..046313e5 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2566,11 +2566,25 @@ function mod_reports() { } if ( $reportCount > 0 && $json ) { - array_walk($reports, function(&$v, $k, $global) { + array_walk($reports, function(&$v, $k, $ud) { + $global = $ud['global']; + $report_posts = $ud['report_posts']; + + $board = ($v['board'] ? $v['board'] : NULL); + if (isset($v['ip']) && !$global) { - $v['ip'] = less_ip($v['ip'], ($v['board']?$v['board']:'')); + $v['ip'] = less_ip($v['ip'], ($board?$board:'')); } - }, $global); + + if (isset($report_posts[ $v['board'] ][ $v['post'] ])) { + $post_content = $report_posts[ $v['board'] ][ $v['post'] ]; + unset($post_content['password']); + if (!$global) { + $post_content['ip'] = less_ip($post_content['ip'], ($board?$board:'')); + } + $v['post_content'] = $post_content; + } + }, array('global' => $global, 'report_posts' => $report_posts)); } }