##############################################################
## MOD Title: Null Ratio Mod
## MOD Author: RoadTrain < N/A >  http://www.torrentpier.info/
##   TPII: Lynx
## MOD Version: 0.2
## :       
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: profile.php
##                config.php
##                index.php
##				  language/lang_russian/lang_main.php
##				  language/lang_enlish/lang_main.php
##				  templates/default/index.tpl
## Included Files:  includes/usercp_nullratio.php
##					templates/default/usercp_nullratio.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/
##############################################################
## Author Notes:
## nah & poh
##############################################################
## MOD History:
##    2008-10-16 - Version 0.2.0
##    	- some updates
##    2008-06-16 - Version 0.1.0
##    	- initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

# 
#-----[ COPY ]---------------------------------
#
\root\*.* to forum root
# 
#-----[ SQL QUERY ]---------------------------------
# 
ALTER TABLE bb_bt_users ADD (
`ratio_nulled` tinyint(1) NOT NULL default '0'
)

# 
#-----[ OPEN ]---------------------------------
# 
profile.php

# 
#-----[ FIND ]---------------------------------
#
	case 'sendpassword':
		require(INC_DIR .'ucp/usercp_sendpasswd.php');
		break;

# 
#-----[ BEFORE, ADD ]---------------------------------
#
	//Null Ratio mod
	case 'nullratio':	

		if ( !$userdata['session_logged_in'] && $mode == 'nullratio' )
		{
			login_redirect();
		}

		require(INC_DIR . 'ucp/usercp_nullratio.php');
		break;

	//end

# 
#-----[ OPEN ]---------------------------------
# 
config.php 

# 
#-----[ FIND ]---------------------------------
#
// SEO
$bb_cfg['seo_link_home_page'] = false;

# 
#-----[ AFTER, ADD ]---------------------------------
#
//ratio null mod
$bb_cfg['rationull_enabled']		   = true ;
$bb_cfg['ratio_to_null']			   = 0.3 ;
//end
# 
#-----[ OPEN ]---------------------------------
# 
index.php
# 
#-----[ FIND ]---------------------------------
#
$template->assign_vars(array(
	'SHOW_FORUMS'           => $forums_count,
	'PAGE_TITLE'            => $lang['HOME'],
	
# 
#-----[ BEFORE, ADD ]---------------------------------
#
//nullratio
if ($bb_cfg['rationull_enabled']) {
	$btu = get_bt_userdata($userdata['user_id']);
	
	$up_total = $btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus'];
	$down_total =$btu['u_down_total'];
	$ratio = ($down_total) ? round((($up_total) / $down_total), 2) : '0';
	$ratio_nulled = $btu['ratio_nulled'];
	
	$template->assign_vars(array( 
		'SHOW_RATIO_WARN'   => (($down_total > MIN_DL_FOR_RATIO) && ($ratio < $bb_cfg['ratio_to_null']) && !$ratio_nulled)
	));
}
//end

# 
#-----[ OPEN ]---------------------------------
# 
language/lang_russian/lang_main.php


# 
#-----[ FIND ]---------------------------------
#
$lang['ONLY_NEW_TOPICS'] = '  ';


# 
#-----[ AFTER, ADD ]---------------------------------
#
// nullratio mod
$lang['NULLRATIO0'] = ' ';
$lang['NULLRATIO1'] = '   ';
$lang['NULLRATIO2'] = '!           .    ! ';
$lang['NULLRATIO3'] = ' !';
$lang['NULLRATIO4'] = '   !';
$lang['NULLRATIO5'] = '  .       ' . $bb_cfg['ratio_to_null'];
$lang['NULLRATIO6'] = ' !     !';
$lang['NULLRATIO7'] = ' !';
$lang['NULLRATIO8'] = '!    <b>'.$bb_cfg['ratio_to_null'].'</b> . ,      ,       .         .    <a href="profile.php?mode=nullratio"></a>.';
$lang['NULLRATIO9'] = '  ';
//end

# 
#-----[ OPEN ]---------------------------------
# 
language/lang_enlish/lang_main.php


# 
#-----[ FIND ]---------------------------------
#
$lang['ONLY_NEW_TOPICS'] = 'only new topics';


# 
#-----[ AFTER, ADD ]---------------------------------
#
// nullratio mod
$lang['NULLRATIO0'] = 'Zeroing Ratio';
$lang['NULLRATIO1'] = 'You downloaded less';
$lang['NULLRATIO2'] = 'Attention! When zeroing ratio the volume downloaded and given by you becomes equal to zero. Restoration will be back impossible!';
$lang['NULLRATIO3'] = 'To dump a ratio!';
$lang['NULLRATIO4'] = 'You already zeroing a ratio!';
$lang['NULLRATIO5'] = 'Your ratio is normal. Zeroing is possible only at a ratio less ' . $bb_cfg['ratio_to_null'];
$lang['NULLRATIO6'] = 'The ratio is nulled! From now on keep it in norm!';
$lang['NULLRATIO7'] = 'Low ratio!';
$lang['NULLRATIO8'] = 'Attention! Your ratio is lower <b>'.$bb_cfg['ratio_to_null'].'</b> . Probably, on ignorance you allowed such situation, and now it will be difficult to you to correct a ratio. For such a case on a site disposable zeroing of a ratio is provided. For this purpose proceed <a href="profile.php?mode=nullratio">here</a>.';
$lang['NULLRATIO9'] = 'This module is disconnected';
//end

# 
#-----[ OPEN ]---------------------------------
# 
templates/default/index.tpl

# 
#-----[ FIND ]---------------------------------
# 
<!-- IF TORHELP_TOPICS -->
	<!-- INCLUDE torhelp.tpl -->
	<div class="spacer_6"></div>
<!-- ENDIF / TORHELP_TOPICS -->


# 
#-----[ BEFORE, ADD ]---------------------------------
#
<!-- IF SHOW_RATIO_WARN -->
<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2" class="forumline"> 
      <tr> 
         <td align="center" nowrap="nowrap" class="catHead"><span class="cattitle"><b>{L_NULLRATIO7}</b></span></td> 
      </tr> 
      <tr>
         <td> 
         {L_NULLRATIO8}
         </td> 
  </tr> 
</table>
<br/>
<!-- ENDIF -->

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