All pastes #743565 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-20 15:45 UTC
rendered paste body
##############################################################
## MOD Title: tarb abuse control
## MOD Author: Karlg < karlg@email.net > (Karl Grindley)
## MOD Description: Highly effective abuse control
## over your users.  (Tarb stands for Brat, backwards)
## MOD Version: 0.0.4
##
## Installation Level: (easy)
## Installation Time: 45 Minutes
## Files To Edit: includes/functions_post.php
##                admin/admin_users.php
##                templates/subSilver/admin/user_edit_body.tpl
##                posting.php
##                viewforum.php
##                viewtopic.php
## Included Files: N/A
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
##   The theory behind this is to discourage cronic abusers,
##      spammers and rule breakers from using your forums,
##      and make them just go away.  The theory behind this mod
##      allows you the admin, to flag a user without their
##      knowledge, allow them to use the board, but all posts/
##      topics are flagged.  Any flagged topic/post is only view
##      able to the abusive user, and the administrator, but invisible
##      to everyone else. 
##
##      When you ban or delete an account, the user is immidiately aware
##      of this, which usually results in (attempted) retaliation.
##      This mod lets you secreatly flag their account and
##      lets the abuser waste their time, while leaving your
##      community alone.
##
##   To flag an abusive account, use the admin panel to edit
##      the uesr's account. Set the Tarb flag, and and all posts/
##      topics posted by that user are invisible to all other users,
##   but appears completely normal to the abusive user. All
##   tarbed posts/topics are visable to the Administarator
##   with a note next to the post/topic title.
##
## ToDo:
##   - Add PM support
##   - Add support for moderators to tarb users
##   - Add easy topic/post tarb pruning
##   - Add reports from the admin panel so an admin can see
##     all tarbed posts/topics
##   - Post/Topic tarb toggle (untarb/tarb a post/topic)
##   - Add cookie support, so when a user logs out, his/her
##     post is still viewable only to themselves
##   - Add (seperate Mod?) viral mode (so a tarbed user
##     creates/logs into another account, it will auto tarb
##     the dupe account based on the browser cookie)
##
##  NOTE: BACKUP YOUR DATABASE BEFORE PREFORMING THE BELOW
##        SQL STATEMENTS
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
alter table phpbb_users add user_tarb tinyint(1) default 0 not null;
alter table phpbb_posts add post_tarb tinyint(1) default '0' not null after post_username;
alter table phpbb_topics add topic_tarb tinyint(1) default '0' not null after topic_poster;


#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]------------------------------------------
#
                $user_avatar = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar'] : '';
                $user_avatar_type = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar_type'] : '';


#
#-----[ AFTER, ADD ]------------------------------------------
#
                $user_tarb = ( !empty($HTTP_POST_VARS['user_tarb']) ) ? intval( $HTTP_POST_VARS['user_tarb'] ) : 0;


#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status,


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_tarb = $user_tarb,

#
#-----[ FIND ]------------------------------------------
#
                $user_timezone = $this_userdata['user_timezone'];
                $user_dateformat = $this_userdata['user_dateformat'];


#
#-----[ AFTER, ADD ]------------------------------------------
#
      $user_tarb = $this_userdata['user_tarb'];


#
#-----[ FIND ]------------------------------------------
#
                        $s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />';
                        $s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . str_replace("\"", "&", $user_dateformat) . '" />';

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $s_hidden_fields .= '<input type="hidden" name="user_tarb" value="' . $user_tarb . '" />';


#
#-----[ FIND ]------------------------------------------
#
                        'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
                        'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]------------------------------------------
#
                        'USER_TARB_YES' => ($user_tarb) ? 'checked="checked"' : '',
                        'USER_TARB_NO' => (!$user_tarb) ? 'checked="checked"' : '',


#
#-----[ FIND ]------------------------------------------
#
                        'L_SPECIAL' => $lang['User_special'],
                        'L_SPECIAL_EXPLAIN' => $lang['User_special_explain'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
                        'L_USER_TARB' => $lang['User_tarb'],


#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
$sql  = ( $mode != "editpost" ) ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id
, topic_status, topic_type, topic_vote

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, topic_tarb

#
#-----[ IN-LINE, FIND ]------------------------------------------
# Same line as above...
) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id,
" . TOPIC_UNLOCKED . ", $topic_type, $topic_vote

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, " . $userdata['user_tarb'] . "

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
$sql = ( $mode != "editpost" ) ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time,
poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, post_tarb

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
) VALUES ($topic_id, $forum_id, " . $userdata['user_id']
. ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, " . $userdata['user_tarb'] . "

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#
$lang['User_status'] = 'User is active';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['User_tarb'] = 'User is tarbed';


#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
# After this line:
#submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_
#id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'",
#"''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
if ( $error_msg == ''

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&& $userdata['user_tarb'] != "1"


#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//

#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( $userdata['user_rank'] != "1" )
{
  $ignore_tarbed = "AND (p.post_tarb = '0' OR (p.poster_id = '" . $userdata['user_id'] . "'))";
}

#
#-----[ FIND ]------------------------------------------
#
                AND pt.post_id = p.post_id
                AND u.user_id = p.poster_id

#
#-----[ AFTER, ADD ]------------------------------------------
#
                $ignore_tarbed

#
#-----[ FIND ]------------------------------------------
#
        $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : ''; : '';

#
#-----[ AFTER, ADD ]------------------------------------------
#
        if ( $userdata['user_rank'] == "1" )
        {
                if ( $postrow[$i]['post_tarb'] == 1)
                        {
                                $post_subject .= " <font color=\"#AA5555\">(tarbed post)</font>" ;
                        }
                }

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

#
#-----[ FIND ]------------------------------------------
#
// Grab all the basic data (all topics except announcements)
// for this forum
//

#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( $userdata['user_rank'] != "1" )
{
  $ignore_tarbed = "AND (t.topic_tarb = '0' OR (t.topic_poster = '" . $userdata['user_id'] . "'))";
}


#
#-----[ FIND ]------------------------------------------
#
                AND u2.user_id = p2.poster_id
                AND t.topic_type <> " . POST_ANNOUNCE . "
                $limit_topics_time

#
#-----[ AFTER, ADD ]------------------------------------------
#
                $ignore_tarbed


#
#-----[ FIND ]------------------------------------------
#
...$topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
                if ( $userdata['user_rank'] == "1" )
                {
                        if ( $topic_rowset[$i]['topic_tarb'] == 1)
                        {
                                $topic_title .= " <font color=\"#AA5555\">(tarbed topic)</font>" ;
                        }
                }

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl


#
#-----[ FIND ]------------------------------------------
#
          <td class="row1" colspan="2"><span class="gensmall">{L_SPECIAL_EXPLAIN}</span></td>
        </tr>
        <tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
          <td class="row1"><span class="gen">{L_USER_TARB}</span></td>
          <td class="row2">
                <input type="radio" name="user_tarb" value="1" {USER_TARB_YES} />
                <span class="gen">{L_YES}</span>&&
                <input type="radio" name="user_tarb" value="0" {USER_TARB_NO} />
                <span class="gen">{L_NO}</span></td>
        </tr>
        <tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM