query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error()); $zapped = $db->result($result); if ($zapped == '') $db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error()); // Delete old reports (which cannot be viewed anyway) $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10,1') or error('Unable to fetch read reports to delete', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result) > 0) { $zapped_threshold = $db->result($result); $db->query('DELETE FROM '.$db->prefix.'reports WHERE zapped <= '.$zapped_threshold) or error('Unable to delete old read reports', __FILE__, __LINE__, $db->error()); } redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']); } $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Reports']); define('PUN_ACTIVE_PAGE', 'admin'); require PUN_ROOT.'header.php'; generate_admin_menu('reports'); ?>

query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, p.id AS pid, t.subject, f.forum_name, u.username AS reporter FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { while ($cur_report = $db->fetch_assoc($result)) { $reporter = ($cur_report['reporter'] != '') ? ''.pun_htmlspecialchars($cur_report['reporter']).'' : $lang_admin_reports['Deleted user']; $forum = ($cur_report['forum_name'] != '') ? ''.pun_htmlspecialchars($cur_report['forum_name']).'' : ''.$lang_admin_reports['Deleted'].''; $topic = ($cur_report['subject'] != '') ? '» '.pun_htmlspecialchars($cur_report['subject']).'' : '» '.$lang_admin_reports['Deleted'].''; $post = str_replace("\n", '
', pun_htmlspecialchars($cur_report['message'])); $post_id = ($cur_report['pid'] != '') ? '» '.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'' : '» '.$lang_admin_reports['Deleted'].''; $report_location = array($forum, $topic, $post_id); ?>

query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.message, r.zapped, r.zapped_by AS zapped_by_id, p.id AS pid, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$db->prefix.'users AS u2 ON r.zapped_by=u2.id WHERE r.zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) { while ($cur_report = $db->fetch_assoc($result)) { $reporter = ($cur_report['reporter'] != '') ? ''.pun_htmlspecialchars($cur_report['reporter']).'' : $lang_admin_reports['Deleted user']; $forum = ($cur_report['forum_name'] != '') ? ''.pun_htmlspecialchars($cur_report['forum_name']).'' : ''.$lang_admin_reports['Deleted'].''; $topic = ($cur_report['subject'] != '') ? '» '.pun_htmlspecialchars($cur_report['subject']).'' : '» '.$lang_admin_reports['Deleted'].''; $post = str_replace("\n", '
', pun_htmlspecialchars($cur_report['message'])); $post_id = ($cur_report['pid'] != '') ? '» '.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'' : '» '.$lang_admin_reports['Deleted'].''; $zapped_by = ($cur_report['zapped_by'] != '') ? ''.pun_htmlspecialchars($cur_report['zapped_by']).'' : $lang_admin_reports['NA']; $report_location = array($forum, $topic, $post_id); ?>