####################################################################################################
##
## MOD Title: Democracy MOD Update
## MOD Author: Carbofos < carbofos@mail.ru > (N/A) N/A
## MOD Author: ETZel < N/A > (N/A) N/A
## MOD Description: Updates the Democracy MOD from 0.1.3 to 0.1.4
## MOD Version: 0.1.4
##
## Installation Level: Intermediate
## Installation Time: ~10 Minutes
## Files To Edit (8):
##	  viewtopic.php
##	  admin/admin_db_utilities.php
##	  includes/page_header.php
##	  includes/usercp_viewprofile.php
##	  language/lang_english/lang_admin.php
##	  language/lang_english/lang_main.php
##	  templates/subSilver/profile_view_body.tpl
##	  templates/subSilver/viewtopic_body.tpl
## Included Files (10):
##	  post_report.php
##	  admin/admin_democracy.php
##	  includes/usercp_reputation.php
##	  language/lang_english/email/reputation_ban.tpl
##	  language/lang_english/email/reputation_warning.tpl
##	  templates/subSilver/modcp_post_report_body.tpl
##	  templates/subSilver/profile_modify_reputation.tpl
##	  templates/subSilver/profile_view_reputation.tpl
##	  templates/subSilver/profile_warning.tpl
##	  templates/subSilver/admin/reputation_body.tpl
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
####################################################################################################
##
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##
####################################################################################################
##
## Version 0.1.4
##  - Fixed LOTS of bugs
##  - Added MOD's tables to db_utilities tables list
##  - Removed compatibility with Global Moderator Mod and User Level Mod (they'll be later as add-ons)
##
####################################################################################################
##
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##
####################################################################################################
#
#-----[ COPY ]------------------------------------------
#
copy root/post_report.php                                          to post_report.php
copy root/admin/admin_democracy.php                                to admin/admin_democracy.php
copy root/includes/usercp_reputation.php                           to includes/usercp_reputation.php
copy root/language/lang_english/email/reputation_ban.tpl           to language/lang_english/email/reputation_ban.tpl
copy root/language/lang_english/email/reputation_warning.tpl       to language/lang_english/email/reputation_warning.tpl
copy root/templates/subSilver/modcp_post_report_body.tpl           to templates/subSilver/modcp_post_report_body.tpl
copy root/templates/subSilver/profile_modify_reputation.tpl        to templates/subSilver/profile_modify_reputation.tpl
copy root/templates/subSilver/profile_view_reputation.tpl          to templates/subSilver/profile_view_reputation.tpl
copy root/templates/subSilver/profile_warning.tpl                  to templates/subSilver/profile_warning.tpl
copy root/templates/subSilver/admin/reputation_body.tpl            to templates/subSilver/admin/reputation_body.tpl
#
#-----[ SQL ]-------------------------------------------
#
UPDATE phpbb_config
	SET config_name = 'reputation_ban_expire_default'
	WHERE config_name = 'reputation_autoban_exipre';

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
			$temp_url = append_sid("profile.$phpEx?mode=reputation&amp;");
			$user_reputation = $lang['Reputation'] . ': ' . $postrow[$i]['reputation'];

#
#-----[ REPLACE WITH ]------------------------------------------
#
			$user_reputation = '<a href="' . append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;' . POST_USERS_URL . '=' . $postrow[$i]['user_id'] . '&amp;view=rep') . '" title="' . $lang['reputation_view_details'] . '">' . $lang['Reputation'] . '</a>' . ': ' . $postrow[$i]['reputation'];

#
#-----[ FIND ]------------------------------------------
#
				$user_reputation .= '&nbsp;&nbsp;<a href="' . $temp_url . 'm=' . REPUTATION_INC . '&p=' . $postrow[$i]['post_id']. '">' . $thumb_up_img . '</a>&nbsp;&nbsp;<a href="' . $temp_url . 'm=' . REPUTATION_DEC . '&p=' . $postrow[$i]['post_id']. '">' . $thumb_dn_img . '</a>';

#
#-----[ REPLACE WITH ]------------------------------------------
#
				$user_reputation .= '&nbsp;&nbsp;<a href="' . append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_INC . '&amp;' . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '">' . $thumb_up_img . '</a>&nbsp;&nbsp;<a href="' . append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_DEC . '&amp;' . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '">' . $thumb_dn_img . '</a><br />';

#
#-----[ FIND ]------------------------------------------
#
			$user_reputation .= '';

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
				$user_warnings = '<div style="margin:4px 1px 4px 1px"><a href="' . $temp_url . POST_USERS_URL . '=' . $postrow[$i]['user_id'] . '&m=0">';

#
#-----[ REPLACE WITH ]------------------------------------------
#
				$temp_url = append_sid("profile.$phpEx?mode=reputation&amp;" . POST_USERS_URL . '=' . $postrow[$i]['user_id'] . '&amp;m=' . REPUTATION_VIEW . '&amp;view=warn');
				$user_warnings = '<a href="' . $temp_url . '" title="' . sprintf($lang['reputation_warnings_to'], $poster) . '">';


#
#-----[ FIND ]------------------------------------------
#
				$user_warnings .= '</a></div>';

#
#-----[ REPLACE WITH ]------------------------------------------
#
				$user_warnings .= '</a>';

#
#-----[ FIND ]------------------------------------------
#
			$reviews_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_reviews'] . '" alt="' . $lang['reputation_view_reviews'] . '" title="' . sprintf($lang['reputation_view_reviews'], $postrow[$i]['post_reviews']) . '" border="0" /></a>';
			$reviews = '<a href="' . $temp_url . '">' . sprintf($lang['reputation_view_reviews'], $postrow[$i]['post_reviews']) . '</a>';

#
#-----[ REPLACE WITH ]------------------------------------------
#
			$post_reviews = sprintf($lang['reputation_view_reviews'], $postrow[$i]['post_reviews']);
			$reviews_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_reviews'] . '" alt="' . $post_reviews . '" title="' . $post_reviews . '" border="0" /></a>';
			$reviews = '<a href="' . $temp_url . '" title="' . $post_reviews . '">' . $lang['Reviews'] . '</a>';

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_db_utilities.php
#
#-----[ FIND ]------------------------------------------
#
$tables = array(
#
#-----[ IN-LINE FIND ]------------------------------------------
#
);
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
, 'reputation', 'reputation_text', 'post_reports'
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
			if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
			if ( !$db->sql_query($sql) )

#
#-----[ FIND ]------------------------------------------
#
			if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
			if ( !$db->sql_query($sql) )

#
#-----[ FIND ]------------------------------------------
#
			if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
			if ( !$db->sql_query($sql) )

#
#-----[ FIND ]------------------------------------------
#
			if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
			if ( !$db->sql_query($sql) )

#
#-----[ FIND ]------------------------------------------
#
		if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
		if ( !$db->sql_query($sql) )


#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
		'U_VIEW_REPUTATION' => $board_config['reputation_enabled'] ? '' : append_sid("profile.$phpEx?mode=reputation&amp;m="
		'L_VIEW_REPUTATION' =>  $board_config['reputation_enabled'] ? '' : $lang['reputation_view_details'],
		'L_WARNINGS' => $lang['Warnings'],
		'WARNINGS' => $profiledata['warnings'] > 0 ? '<a class="gen" href="' . append_sid("profile.$phpEx?mode=reputation&amp;m="
	);

#
#-----[ REPLACE WITH ]------------------------------------------
#
		'U_VIEW_WARNINGS' => append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] . '&amp;view=warn'),
		'WARNINGS' => $profiledata['warnings'],
	));

#
#-----[ FIND ]------------------------------------------
#
		'U_VIEW_REPUTATION' => append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;u=' . $profiledata['user_id']),
		'L_VIEW_REPUTATION' =>  $lang['reputation_view_details'],
		'L_REPUTATION' => $lang['Reputation'],
		'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>')
	);

#
#-----[ REPLACE WITH ]------------------------------------------
#
		'U_VIEW_REPUTATION' => append_sid("profile.$phpEx?mode=reputation&amp;m=" . REPUTATION_VIEW . '&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] . '&amp;view=rep'),
		'REPUTATION' => $profiledata['reputation'],
	));

#
#-----[ FIND ]------------------------------------------
#
	'L_LOCATION' => $lang['Location'],
	'L_OCCUPATION' => $lang['Occupation'],
	'L_INTERESTS' => $lang['Interests'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
	'L_WARNINGS' => $lang['Warnings'],
	'L_REPUTATION' => $lang['Reputation'],
	'L_VIEW_DETAILS' => $lang['reputation_view_details'],

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
//
// Democracy MOD
//

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['reputation_board_mode'] = 'Board Mode';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_board_mode_exp'] = 'From this page you can change your Board\'s rules mode and setup its behaviour.<br />Note: The default option value is shown as <u>underlined</u>.';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['reputation_mode_1'] = 'Anarchy';		// 'none'
$lang['reputation_mode_2'] = 'Totality';	// 'warnings'
$lang['reputation_mode_3'] = 'Feudalism';	// 'reputation'
$lang['reputation_mode_4'] = 'Democracy';	// 'full'

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_check_rate'] = 'Expired warnings check rate';

#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['reputation_ban_expire_enabled'] = 'Bans can expire over time';
$lang['reputation_ban_expire_default'] = 'Default expire time for bans';
$lang['reputation_ban_expire_min'] = 'Minimal expire time for bans';
$lang['reputation_ban_expire_max'] = 'Maximal expire time for bans';
$lang['reputation_check_rate'] = 'Expired warnings and bans check rate';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_expired_warnings']

#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['reputation_expired_warnings'] = 'Expired warnings and bans';

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['New_warning'] = 'New warning';
$lang['Post_Reports'] = 'Post Reports';
$lang['Review'] = 'Review';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Reviews'] = 'Reviews';

#
#-----[ FIND ]------------------------------------------
#
$lang['Display'] = 'Display';
$lang['User'] = 'User';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Edit'] = 'Edit';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_board_mode'] = 'Board Mode';
$lang['reputation_mode_1'] = 'Anarchy';		// 'none'
$lang['reputation_mode_2'] = 'Totality';	// 'warnings'
$lang['reputation_mode_3'] = 'Feudalism';	// 'reputation'
$lang['reputation_mode_4'] = 'Democracy';	// 'full'

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_lock_post'] = 'Lock this post';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['reputation_for'] = 'for';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_warnings_to'] = 'Warnings given to';

#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['reputation_warnings_to'] = 'Warnings given to %s';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_of'] = 'Reputation of';

#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['reputation_of'] = 'Reputation of %s';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_reports'] = 'Report post';

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_no_access'] = 'You do not have the required access level';

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_already_warned'] = 'This user has been already warned for this post';

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_msg_delete_report'] = '%sDelete report%s';

#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['reputation_already_warned'] = 'This user has been already warned for this post';
$lang['reputation_already_banned'] = 'This user is already banned';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_msg_view_warning'] = '%sView this warning%s';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['reputation_msg_delete_report'] = '%sDelete report%s';

#
#-----[ FIND ]------------------------------------------
#
$lang['reputation_confirm_report2'] = 'Are you sure you want to report this review to moderator(s)?';
$lang['reputation_mail_warning'] = 'You have recieved a warning';
$lang['reputation_mail_ban'] = 'You have been banned';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['reputation_report_deleted'] = 'The report has been deleted.';
$lang['reputation_msg_back_to_reports'] = '%sBack to the Reports page%s';

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
		  <td valign="top" align="right" nowrap="nowrap"><span class="gen">{warnings.L_WARNINGS}:&nbsp;</span></td>
		  <td width="100%"><b><span class="gen">{warnings.WARNINGS}</span></b><br /><span class="genmed"><a href="{warnings.U_VIEW_REPUTATION}"

#
#-----[ REPLACE WITH ]------------------------------------------
#
		  <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_WARNINGS}:&nbsp;</span></td>
		  <td width="100%"><b><span class="gen">{warnings.WARNINGS}</span></b> <span class="genmed">[ <a href="{warnings.U_VIEW_WARNINGS}" class="genmed">{L_VIEW_DETAILS}</a> ]</span></td>

#
#-----[ FIND ]------------------------------------------
#
		  <td valign="top" align="right" nowrap="nowrap"><span class="gen">{reputation.L_REPUTATION}:&nbsp;</span></td>
		  <td width="100%"><b><span class="gen">{reputation.REPUTATION}</span></b><br /><span class="genmed"><a href="{reputation.U_VIEW_REPUTATION}"

#
#-----[ REPLACE WITH ]------------------------------------------
#
		  <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_REPUTATION}:&nbsp;</span></td>
		  <td width="100%"><b><span class="gen">{reputation.REPUTATION}</span></b> <span class="genmed">[ <a href="{reputation.U_VIEW_REPUTATION}" class="genmed">{L_VIEW_DETAILS}</a> ]</span></td>


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}{postrow.POSTER_WARNINGS}<br />{postrow.POSTER_REPUTATION}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_WARNINGS}<br />{postrow.POSTER_REPUTATION}

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
<div style="margin:4px 1px 4px 1px">{postrow.POSTER_WARNINGS}</div>{postrow.POSTER_REPUTATION}

#
#-----[ FIND ]------------------------------------------
#
<td class="{postrow.ROW_CLASS}"
#
#-----[ FIND ]------------------------------------------
#
>{postrow.PROFILE

#
#-----[ IN-LINE FIND ]------------------------------------------
#
valign="middle" width="100%"

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
valign="middle"

#
#-----[ FIND ]------------------------------------------
#
				<td valign="middle" nowrap="nowrap">{postrow.YELLOW_IMG} {postrow.RED_IMG}</td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
				<td align="right" width="100%" valign="middle" nowrap="nowrap">{postrow.YELLOW_IMG} {postrow.RED_IMG}</td>

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