Hack Name: Reported Posts Description: This hack will keep a record of all reported posts. It will provide Super Moderators and above with a little overview of who reported a post. Compatibilty: 1.9.11 Version: 1.0 Code Designed By: Mouser License Note: This mod is released under the GPL License. As always, give credit where credit is due. Notes: For your own safety, backup the effected PHP files and templates before proceeding with this hack. Admin Panel -> Insert RAW SQL -------------------------------------------------- CREATE TABLE IF NOT EXISTS `$table_reported` ( `rid` int(10) NOT NULL auto_increment, `tid` int(10) NOT NULL, `pid` int(10) NOT NULL, `reporter` varchar(32) NOT NULL, `reportline` int(10) NOT NULL default '0', `fixstatus` set('0','1') NOT NULL default '0', `fixer` varchar(32) NOT NULL default '', `fixline` int(10) NOT NULL default '0', `message` text NOT NULL, PRIMARY KEY (`rid`) ) ENGINE=MyISAM ; -------------------------------------------------- Edit PHP File: ./header.php Find: -------------------------------------------------- /* Set Up HTML Templates and Themes */ -------------------------------------------------- Add Code Above: -------------------------------------------------- if (!isset($lang['rep_reppsts'])) { require_once(ROOT.'include/translation.inc.php'); $phrases = array(); $phrases['rep_reppsts'] = 'Reported Posts'; $phrases['rep_txtopen'] = 'Open'; $phrases['rep_txtsolved'] = 'Solved'; $phrases['rep_txtmclose'] = 'Mark as Solved'; $phrases['rep_txtview0'] = '» View all solved Reported Posts «'; $phrases['rep_txtview1'] = '» View all open Reported Posts «'; $phrases['rep_txtnomsg'] = 'No message'; $phrases['rep_txtnorep'] = 'There are no reported posts for you to check at this time.'; setManyLangValues($phrases, $langfile); loadLang($langfile); } -------------------------------------------------- Edit PHP File: ./vtmisc.php Find: -------------------------------------------------- if ($action == 'report') { $pid = getRequestInt('pid'); -------------------------------------------------- Replace With: -------------------------------------------------- if ($action == 'report' || $action == 'report2') { $pid = getRequestInt('pid'); -------------------------------------------------- Find: -------------------------------------------------- } else { header('HTTP/1.0 404 Not Found'); error($lang['textnoaction']); } -------------------------------------------------- Add Code Above: -------------------------------------------------- } else if ($action == 'reported' && X_SMOD) { nav($lang['textreportpost']); eval('echo "'.template('header').'";'); $fixstatus = getInt('fixstatus', 'r'); $fixstatus = ($fixstatus < 0 || $fixstatus > 1 ? 0 : $fixstatus); $close = getInt('close', 'g'); if ( $close > 0 ) { $db->query("UPDATE ".X_PREFIX."reported SET fixstatus='1', fixer='$xmbuser', fixline=".$db->time(time())." WHERE rid=".$close); } $query = $db->query("SELECT count(rid) FROM ".X_PREFIX."reported WHERE fixstatus='$fixstatus'"); $num = $db->result($query, 0); // + 1 $db->free_result($query); $mpurl = 'vtmisc.php?action=reported&fixstatus='.$fixstatus; $mpage = multipage($num, '30', $mpurl); $multipage = ''; if (strlen($mpage['html']) != 0) { $multipage =& $mpage['html']; } echo '
'.$multipage.''.($fixstatus == 0 ? ''.$lang['rep_txtview0'].'' : ''.$lang['rep_txtview1'].'').'
'; $_p = getInt('page'); if ( $_p > 0 ) { $r_p = "&page=$_p"; } else { $r_p = ''; } echo '
'; $adjTime = ($timeoffset * 3600) + ($addtime * 3600); $i = 0; $modquery = $db->query("SELECT * FROM ".X_PREFIX."reported WHERE fixstatus='$fixstatus' LIMIT ".$mpage['start'].", 30"); while($R = $db->fetch_array($modquery)) { $THEME['altbg1'] = ($i % 2 ? $THEME['altbg1'] : $THEME['altbg2']); $rdate = gmdate($dateformat, $R['reportline'] + $adjTime); $rtime = gmdate($timecode, $R['reportline'] + $adjTime); $submitted = $rdate.' '.$lang['textat'].' '.$rtime; $closed = ''; if ( (int)$R['fixline'] > 0 ) { $sdate = gmdate($dateformat, $R['fixline'] + $adjTime); $stime = gmdate($timecode, $R['fixline'] + $adjTime); $closed = $sdate.' '.$lang['textat'].' '.$stime; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $i+=1; } $db->free_result($modquery); if ( $i == 0 ){ echo ''; } echo '
'.$lang['rep_reppsts'].'
'.$R['reporter'].' '.$submitted.' '.postify(($R['message'] == '' ? $lang['rep_txtnomsg'] : $R['message']), 'no', '', 'yes', 'no').' '.($R['fixstatus'] == 0 ? ''.$lang['rep_txtopen'].'' : $lang['rep_txtsolved']).' '.$R['fixer'].' '.$closed.'
'.$lang['rep_txtnorep'].'

'; echo '
'.$multipage.''.($fixstatus == 0 ? ''.$lang['rep_txtview0'].'' : ''.$lang['rep_txtview1'].'').'
'; end_time(); eval('echo "'.template('footer').'";'); exit; -------------------------------------------------- Find: -------------------------------------------------- } else if ($action == 'votepoll') { -------------------------------------------------- Add Code Above: -------------------------------------------------- } else if ($action == 'report2') { nav($lang['textreportpost']); eval('echo "'.template('header').'";'); if ($SETTINGS['reportpost'] == 'off') { header('HTTP/1.0 403 Forbidden'); eval('echo "'.template('misc_feature_notavailable').'";'); end_time(); eval('echo "'.template('footer').'";'); exit; } if (noSubmit('reportsubmit')) { if ($db->result($db->query("SELECT count(rid) FROM ".X_PREFIX."reported WHERE pid='$pid'"), 0) > 0) { error($lang['rep_already'], false, '', '', false, true, false, true); } eval('echo "'.template('vtmisc_report').'";'); } else { $messageinput = postedVar('reason', '', TRUE, FALSE); $dbmessage = $db->escape($messageinput); $db->query("INSERT INTO ".X_PREFIX."reported (tid, pid, reporter, reportline, message) VALUES ($tid, $pid, '$xmbuser', ".$db->time(time()).", '$dbmessage')"); //$rid = $db->insert_id(); require('include/u2u.inc.php'); $modquery = $db->query("SELECT username, ppp FROM ".X_PREFIX."members WHERE status='Super Administrator' OR status='Administrator' OR status='Super Moderator'"); while($modusr = $db->fetch_array($modquery)) { $mod = $db->escape_var($modusr['username']); $message = $lang['reportmessage'].' '.$full_url.'vtmisc.php?action=reported'; $message = $db->escape(addslashes($message)); //Messages are historically double-slashed. $subject = $db->escape(addslashes($lang['reportsubject'])); u2u_send_recp($mod, $subject, $message); } $db->free_result($modquery); message($lang['reportmsg'], false, '', '', $full_url.'viewthread.php?tid='.$tid.'&goto=search&pid='.$pid, true, false, true); } -------------------------------------------------- Edit PHP File: ./include/admin.inc.php Find: -------------------------------------------------- $db->query("UPDATE ".X_PREFIX."whosonline SET username='$dbuserto' WHERE username='$dbuserfrom'"); -------------------------------------------------- Add Code Below: -------------------------------------------------- $db->query("UPDATE ".X_PREFIX."reported SET reporter='$dbuserto' WHERE reporter='$dbuserfrom'"); $db->query("UPDATE ".X_PREFIX."reported SET fixer='$dbuserto' WHERE fixer='$dbuserfrom'"); -------------------------------------------------- Find: -------------------------------------------------- -------------------------------------------------- Add Code Above: -------------------------------------------------- » 
-------------------------------------------------- Edit Template: vtmisc_report Find: --------------------------------------------------
-------------------------------------------------- Replace With: -------------------------------------------------- --------------------------------------------------