####################################################################################################
## 
## MOD Title: Democracy MOD - Update from 0.1.2 to 0.1.3
## MOD Author: Carbofos < carbofos@mail.ru > (N/A) N/A
## MOD Description: Updates the Democracy MOD from 0.1.2 to 0.1.3
## MOD Version: 0.1.3
## 
## Installation Level: Easy
## Installation Time: 5 Minutes 
## Included Files: 4:
##	post_report.php
##	includes/usercp_reputation.php
##	templates/subSilver/profile_view_reputation.tpl
##	templates/subSilver/profile_warning.tpl
## Files To Edit: 5:
##	index.php
##	viewtopic.php
##	includes/page_header.php
##	includes/usercp_viewprofile.php
##	language/lang_english/lang_main.php
##
####################################################################################################
## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/ 
## 
####################################################################################################
## 
## Version 0.1.3
##  - Fixed bug that made all user's warnings expired
##  - Report post button now appears properly
##  - Fixed some bugs in templates
##  - Added compatibility with Global Moderator Mod and User Level Mod (beta support)
##  - Some more minor code improvements
##  
####################################################################################################
## 
## IMPORTANT:
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
## 
####################################################################################################
#
#------------------------[ COPY ]------------------------
# Overwrite old ones
#
copy post_report.php to post_report.php
copy usercp_reputation.php to includes/usercp_reputation.php
copy profile_view_reputation.tpl to templates/subSilver/profile_view_reputation.tpl
copy profile_warning.tpl to templates/subSilver/profile_warning.tpl
#
#------------------------[ OPEN ]------------------------
#
index.php
#
#------------------------[ FIND ]------------------------
#
//
// Check for post reports
//
if ( $board_config['reputation_check_reports'] == 1 && ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD
#
#---------------------[ IN-LINE FIND ]-------------------
#
$userdata['user_level'] == MOD
#
#------------------[ IN-LINE AFTER, ADD ]----------------
#
 || $userdata['user_level'] == GLOBAL_MOD || $userdata['user_level'] == MAIN_MOD
#
#------------------------[ FIND ]------------------------
#
	//
	// Make a link to reported posts (for authorized ppl only)
	//
	if ( $board_config['reputation_enable_reports'] == 1 && ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD
#
#---------------------[ IN-LINE FIND ]-------------------
#
$userdata['user_level'] == MOD
#
#------------------[ IN-LINE AFTER, ADD ]----------------
#
 || $userdata['user_level'] == GLOBAL_MOD || $userdata['user_level'] == MAIN_MOD
#
#------------------------[ FIND ]------------------------
#
		$u_reported_posts =
#
#--------------------[ REPLACE WITH ]--------------------
#
		$u_reported_posts = '<a href="' . append_sid("post_report.$phpEx?mode=view") . '" class="gensmall"' . $link_color . '>' . $l_reported_posts . '</a><br />';
#
#------------------------[ OPEN ]------------------------
#
viewtopic.php
#
#------------------------[ FIND ]------------------------
#
		if ( $board_config['warnings_enabled'] )
		{
			if ( $userdata['user_id'] != $postrow[$i]['user_id'] && $postrow[$i]['user_level']
#
#---------------------[ IN-LINE FIND ]-------------------
#
 && $postrow[$i]['user_level'] != MOD
#
#------------------[ IN-LINE AFTER, ADD ]----------------
#
 && $postrow[$i]['user_level'] != GLOBAL_MOD && $postrow[$i]['user_level'] != MAIN_MOD
#
#------------------------[ FIND ]------------------------
#
		if ( $board_config['warnings_enabled'] )
		{
			if( $userdata['user_id'] != ANONYMOUS )
			{
#
#---------------------[ IN-LINE FIND ]-------------------
#
warnings_enabled
#
#-----------------[ IN-LINE REPLACE WITH ]---------------
#
reputation_enable_reports
#
#------------------------[ OPEN ]------------------------
#
includes/page_header.php
#
#------------------------[ FIND ]------------------------
#
   $sql = 'SELECT id, user_id, modification FROM ' . REPUTATION_TABLE . ' 
           WHERE modification = ' . REPUTATION_WARNING . ' OR modification = ' . REPUTATION_BAN . " 
            AND expire < $current_time"; 
#
#--------------------[ REPLACE WITH ]--------------------
# Add round brackets around OR, without them all warnings would became expired
# 
   $sql = 'SELECT id, user_id, modification FROM ' . REPUTATION_TABLE . ' 
           WHERE (modification = ' . REPUTATION_WARNING . ' OR modification = ' . REPUTATION_BAN . ") 
            AND expire < $current_time"; 
#
#------------------------[ FIND ]------------------------
#
			if ( $row['modification'] == REPUTATION_BAN )
			{
				$sql = 'DELETE FROM ' . BANLIST_TABLE . "
					WHERE ban_userid = '" . $row['user_id'] . "'";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
				}
			}
#
#--------------------[ REPLACE WITH ]--------------------
# Remove these lines (actually move them elsewhere)
# 
#
#------------------------[ FIND ]------------------------
#
		$sql = 'UPDATE ' . USERS_TABLE . '
			SET warnings = warnings - 1
#
#--------------------[ BEFORE, ADD ]---------------------
#
		if ( $row['modification'] == REPUTATION_BAN )
		{
			$sql = 'DELETE FROM ' . BANLIST_TABLE . "
				WHERE ban_userid = '" . $row['user_id'] . "'";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
			}
		}
#
#------------------------[ OPEN ]------------------------
#
includes/usercp_viewprofile.php
#
#------------------------[ FIND ]------------------------
#
		'U_VIEW_REPUTATION' => $board_config['reputation_enabled']
#
#--------------------[ REPLACE WITH ]--------------------
#
		'U_VIEW_REPUTATION' => $board_config['reputation_enabled'] ? '' : append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;u=' . $profiledata['user_id']),
#
#------------------------[ FIND ]------------------------
#
		'WARNINGS' =>
#
#--------------------[ REPLACE WITH ]--------------------
#
		'WARNINGS' => $profiledata['warnings'] > 0 ? '<a class="gen" href="' . append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;u=' . $profiledata['user_id'] . '&amp;view=warn') . '">' . $profiledata['warnings'] . '</a>' : $profiledata['warnings'])
#
#------------------------[ FIND ]------------------------
#
		'U_VIEW_REPUTATION' => append_sid(
#
#--------------------[ REPLACE WITH ]--------------------
#
		'U_VIEW_REPUTATION' => append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;u=' . $profiledata['user_id']),
#
#------------------------[ FIND ]------------------------
#
		'REPUTATION' =>
#
#--------------------[ REPLACE WITH ]--------------------
#
		'REPUTATION' => '<a class="gen" href="' . append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;u=' . $profiledata['user_id'] . '&amp;view=rep') . '">' . $profiledata['reputation'] . '</a>')
#
#------------------------[ OPEN ]------------------------
#
language/lang_english/lang_main.php
#
#------------------------[ FIND ]------------------------
#
$lang['reputation_already_warned']
#
#---------------------[ AFTER, ADD ]---------------------
#
$lang['reputation_already_banned'] = 'This user is already banned'; 
#
#----------------[ SAVE/CLOSE ALL FILES ]----------------
#
# EoM 