######################################################## ## Mod Title: Yellow Card Admin Mod (card ban system) ## Mod Version: 1.3.7. ## Author: Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. Rød) HTTP://mods.db9.dk ## ## This mod is for phpBB2!! ver 2.0.2 ## ## Description: This mod is the admin part of yellow card mod. ## It makes it posible for admin to control the limit of accepted yellow card ## the admin can also edit the users profile, ad change the yellow cards, given to the user ## ## Fetures (all in admin panel): ## board configuation, ability to set yellow card limit (limit before users ## are baned) ## board configuation, ability to set blue card limit (limit before ## modifyers are notified ) ## board configuation, ability to set blue card notification intervall ## board configuation, ability to set blue card "post a report" forum ID ## forum permissions, who shall gain green card rigths ## forum permissions, who shall gain ban rigths to specific forums ## forum permissions, who shall gain blue card rigths to specific forums ## users profile, posible for admin to change number af yellow cards ## the user currently have ## ## ## ## Installation Level: middle ## Installation Time: 10-20 Minutes ## Files To Edit: 9 ## admin/admin_board.php ## admin/admin_users.php ## admin/admin_ug_auth.php ## admin/admin_forums.php ## admin/admin_forumauth.php ## admin/admin_user_ban.php ## includes/auth.php ## language/lang_english/lang_admin.php ## templates/subsilver/admin/board_config_body.tpl ## templates/subsilver/admin/user_edit_body.tpl ## ## History: ## 0.9.0. - beta release ## 1.0.0. - release for phpBB RC-2 ## 1.1.0. - release for phpBB 2.0.0. ## 1.1.3. - history started, changed some entry in admin.php ## 1.1.4. - lang_admin.php changed ## 1.2.0. - re-written for phpBB2 version 2.0.2. ## 1.2.1. - seciruty update, semi vital (recormented) ## 1.3.0. - now posible to specify the "post a report" forum ID ## 1.3.1. - corrected a typo in the board_config_body.tpl ## 1.3.2. - the ADD SQL, had a syntax ## 1.3.3. - correction of typo in the how-to - thanks to "kreativ" ## 1.3.4. - now yellow/red cards can be made/removed with-in the admin ban interface ## 1.3.5. - Corrected a find tag in the how-to auth.php ## 1.3.6. - corrected the admin_users.php file ## 1.3.7. - missed a change in admin_ug_auth.php ## ############################################################## ## This MOD is released under the GPL License. ## Intellectual Property is retained by the MOD Author(s) listed above ############################################################## ## 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/ ############################################################## ## Authors Notes: ## ## if you are using a prefix to you DB tabels then you have to add this to ## the SQL commands, e.g. "phpbb_users" instead of just "users" - ONLY ## in the initial [ADD SQL] commands, not in the php code ! ## as a alternative I have also included the db_update.php file, witch you as ADMIN ## can run, it will then update the DB ## ## The most important thing to keep in mind is, take your time, make ## sure you are finding the correct lines to modify, then take care to paste the new code. ## Please also keep in mind, if you are using more than one language file or theme at your ## site, you will need to edit the corrosponding files for each occurrence. Good Luck! ################################################################# ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ## and the Database ################################################################# # #-----[ ADD SQL ]------------------------------------------ # or run the included db_update.php file as ADMIN # ALTER TABLE users ADD user_warnings SMALLINT (5) DEFAULT '0' # #-----[ ADD SQL ]------------------------------------------ # or run the included db_update.php file as ADMIN # ALTER TABLE forums ADD auth_ban TINYINT (2) DEFAULT '3' # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE auth_access ADD auth_ban TINYINT (1) DEFAULT '0' # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('max_user_bancard', '10') # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE forums ADD auth_greencard TINYINT (2) DEFAULT '5' # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE forums ADD auth_bluecard TINYINT (2) DEFAULT '1' # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE auth_access ADD auth_greencard TINYINT (1) DEFAULT '0' # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE auth_access ADD auth_bluecard TINYINT (1) DEFAULT '0' # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('bluecard_limit', '3') # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('bluecard_limit_2', '1') # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE posts ADD post_bluecard TINYINT (1) # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('report_forum', '0') # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every language your admin uses). language/lang_english/lang_admin.php # #-----[ FIND ]------------------------------------------ # // That's all Folks! // ------------------------------------------------- # #-----[ AFTER, ADD ]------------------------------------------ # //Added Yellow Card Admin mod $lang['Ban'] = 'Ban'; $lang['Max_user_bancard'] = 'Maximum number of warnings'; $lang['Max_user_bancard_explain'] = 'If a user gets more yellow cards than this limit, the user will be banned'; $lang['ban_card'] = 'Yellow card'; $lang['ban_card_explain'] = 'The user will be banned when he/she is in excess of %d yellow cards'; $lang['Greencard'] = 'Un-ban'; $lang['Bluecard'] = 'Post report'; $lang['Bluecard_limit'] = 'Interval of bluecard'; $lang['Bluecard_limit_explain'] = 'Notify the moderators again for every x bluecards given to a post'; $lang['Bluecard_limit_2'] = 'Limit of bluecard'; $lang['Bluecard_limit_2_explain'] = 'First notification to moderators is sent, when a post get this amount of blue cards'; $lang['Report_forum']= 'Report forum'; $lang['Report_forum_explain'] = 'Fill with the forum ID where users reports are to be posted, a value of 0 will disable this feature, users MUST atleast have post/reply access to this forum'; # #-----[ OPEN ]------------------------------------------ # admin/admin_board.php # #-----[ FIND ]------------------------------------------ # "L_ENABLE_PRUNE" => $lang['Enable_prune'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_BLUECARD_LIMIT' => $lang['Bluecard_limit'], 'L_BLUECARD_LIMIT_EXPLAIN' => $lang['Bluecard_limit_explain'], 'L_BLUECARD_LIMIT_2' => $lang['Bluecard_limit_2'], 'L_BLUECARD_LIMIT_2_EXPLAIN' => $lang['Bluecard_limit_2_explain'], 'L_MAX_USER_BANCARD' => $lang['Max_user_bancard'], 'L_MAX_USER_BANCARD_EXPLAIN' => $lang['Max_user_bancard_explain'], 'L_REPORT_FORUM' => $lang['Report_forum'], 'L_REPORT_FORUM_EXPLAIN' => $lang['Report_forum_explain'], # #-----[ FIND ]------------------------------------------ # "PRUNE_NO" => $prune_no, # #-----[ AFTER, ADD ]------------------------------------------ # 'BLUECARD_LIMIT' => $new['bluecard_limit'], 'BLUECARD_LIMIT_2' => $new['bluecard_limit_2'], 'MAX_USER_BANCARD' => $new['max_user_bancard'], 'REPORT_FORUM' => $new['report_forum'], # #-----[ OPEN ]------------------------------------------ # admin/admin_users.php # #-----[ FIND ]------------------------------------------ # $user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0; # #-----[ AFTER, ADD ]------------------------------------------ # $user_ycard = ( !empty($HTTP_POST_VARS['user_ycard']) ) ? intval( $HTTP_POST_VARS['user_ycard'] ) : 0; # #-----[ FIND ]------------------------------------------ # $sql = "UPDATE " . USERS_TABLE . " # #-----[ BEFORE, ADD ]------------------------------------------ # if ($user_ycard>$board_config['max_user_bancard']) { $sql = "SELECT ban_userid FROM " . BANLIST_TABLE . " WHERE ban_userid=$user_id"; if( $result = $db->sql_query($sql) ) { if (!$db->sql_fetchrowset($result)) { // insert the user in the ban list $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) VALUES ($user_id)"; if (!$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql); else $no_error_ban=true; } else $no_error_ban = true; } else message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql); } else { // remove the ban, if there is any $sql = "DELETE FROM " . BANLIST_TABLE . " WHERE ban_userid=$user_id"; if (!$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't remove ban_userid info into database", "", __LINE__, __FILE__, $sql); else $no_error_ban=true; } # #-----[ FIND ]------------------------------------------ # SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank " .$avatar_sql . " # #-----[ IN-LINE FIND ]------------------------------------------ # $user_status # #-----[ IN-LINE, AFTER, ADD ]------------------------------------------ # , user_warnings=$user_ycard # #-----[ FIND ]------------------------------------------ # $user_status = $this_userdata['user_active']; # #-----[ AFTER, ADD ]------------------------------------------ # $user_ycard = $this_userdata['user_warnings']; # #-----[ FIND ]------------------------------------------ # $s_hidden_fields .= ''; # #-----[ AFTER, ADD ]------------------------------------------ # $s_hidden_fields .= ''; # #-----[ FIND ]------------------------------------------ # 'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '', # #-----[ AFTER, ADD ]------------------------------------------ # 'BANCARD' => $user_ycard, # #-----[ FIND ]------------------------------------------ # 'L_INTERESTS' => $lang['Interests'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_BANCARD' => $lang['ban_card'], 'L_BANCARD_EXPLAIN' => sprintf($lang['ban_card_explain'], $board_config['max_user_bancard']), # #-----[ OPEN ]------------------------------------------ # admin/admin_forumauth.php # #-----[ FIND ]------------------------------------------ # // View Read # #-----[ IN-LINE FIND ]------------------------------------------ # Poll # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # Warn/ban Unban Repport # #-----[ FIND ]------------------------------------------ # $simple_auth_ary = array( 0 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 1 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 2 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 3 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 4 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 5 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # 6 => array( # #-----[ IN-LINE FIND ]------------------------------------------ # ), # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , AUTH_MOD, AUTH_ADMIN, AUTH_REG # #-----[ FIND ]------------------------------------------ # $forum_auth_fields = array( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , 'auth_ban', 'auth_greencard', 'auth_bluecard' # #-----[ FIND ]------------------------------------------ # 'auth_pollcreate' # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # ,'auth_ban' => $lang['Ban'], 'auth_greencard' => $lang['Greencard'], 'auth_bluecard' => $lang['Bluecard'] # #-----[ OPEN ]------------------------------------------ # admin/admin_forums.php # #-----[ FIND ]------------------------------------------ # "auth_pollcreate" => AUTH_REG ); # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # ,"auth_ban" => AUTH_MOD, "auth_greencard" => AUTH_ADMIN, "auth_bluecard" => AUTH_REG # #-----[ OPEN ]------------------------------------------ # admin/admin_ug_auth.php # #-----[ FIND ]------------------------------------------ # $forum_auth_fields = array( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # ,'auth_ban','auth_greencard','auth_bluecard' # #-----[ FIND ]------------------------------------------ # 'auth_pollcreate' => AUTH_POLLCREATE); # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # ,'auth_ban' => AUTH_BAN, 'auth_greencard' => AUTH_GREENCARD, 'auth_bluecard' => AUTH_BLUECARD # #-----[ FIND ]------------------------------------------ # 'auth_pollcreate' => $lang['Pollcreate']); # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # ,'auth_ban' => $lang['ban_card'], 'auth_greencard' => $lang['Greencard'] , 'auth_bluecard' => $lang['Bluecard'] # #-----[ FIND ]------------------------------------------ # // to change yourself from an admin to user! // $sql = "UPDATE " . AUTH_ACCESS_TABLE . " SET auth_view = 0, auth_read = 0, # #-----[ IN-LINE FIND ]------------------------------------------ # auth_announce = 0 # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , auth_ban=0, auth_greencard=0, auth_bluecard=0 # #-----[ OPEN ]------------------------------------------ # admin/admin_user_ban.php # #-----[ FIND ]------------------------------------------ # } if ( isset($HTTP_POST_VARS['unban_ip']) ) # #-----[ BEFORE, ADD ]------------------------------------------ # // added for yellow card ban system $sql = "SELECT ban_userid FROM ".BANLIST_TABLE." WHERE ban_id IN ($where_sql)"; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't get user warnings info from database".$sql, "", __LINE__, __FILE__, $sql); } while ($user_id_list = $db->sql_fetchrow($result)) { $where_user_sql .= ( ( $where_user_sql != '' ) ? ', ' : '' ) . $user_id_list['ban_userid']; } $sql = "UPDATE " . USERS_TABLE . " SET user_warnings='0' WHERE user_id IN ($where_user_sql)"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't update user warnings info from database".$sql, "", __LINE__, __FILE__, $sql); } # #-----[ OPEN ]------------------------------------------ # includes/auth.php # #-----[ FIND ]------------------------------------------ # , POLLCREATE # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # # add at the end of the line , BAN, GREENCARD, BLUECARD # #-----[ FIND ]------------------------------------------ # case AUTH_ALL: $a_sql = # #-----[ FIND ]------------------------------------------ # a.auth_pollcreate'; # #-----[ IN-LINE FIND ]------------------------------------------ # '; # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , a.auth_ban, a.auth_greencard, a.auth_bluecard # #-----[ FIND ]------------------------------------------ # $auth_fields = array( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # , 'auth_ban', 'auth_greencard', 'auth_bluecard' # #-----[ FIND ]------------------------------------------ # case AUTH_VOTE: $a_sql = 'a.auth_vote'; $auth_fields = array('auth_vote'); break; # #-----[ AFTER, ADD ]------------------------------------------ # case AUTH_BAN: $a_sql = 'a.auth_ban'; $auth_fields = array('auth_ban'); break; case AUTH_GREENCARD: $a_sql = 'a.auth_greencard'; $auth_fields = array('auth_greencard'); break; case AUTH_BLUECARD: $a_sql = 'a.auth_bluecard'; $auth_fields = array('auth_bluecard'); break; # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme your admin uses). templates/subSilver/admin/board_config_body.tpl # #-----[ FIND ]------------------------------------------ # {L_YES}   {L_NO} # #-----[ AFTER, ADD ]------------------------------------------ # {L_BLUECARD_LIMIT_2}
{L_BLUECARD_LIMIT_2_EXPLAIN} {L_BLUECARD_LIMIT}
{L_BLUECARD_LIMIT_EXPLAIN} {L_MAX_USER_BANCARD}
{L_MAX_USER_BANCARD_EXPLAIN} {L_REPORT_FORUM}
{L_REPORT_FORUM_EXPLAIN} # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme your admin uses). templates/subsilver/admin/user_edit_body.tpl # #-----[ FIND ]------------------------------------------ # {L_DELETE_USER_EXPLAIN} # #-----[ AFTER, ADD ]------------------------------------------ # {L_BANCARD}:
{L_BANCARD_EXPLAIN}
# #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # #EoM