##############################################################
## MOD Title: Torrent Status Mod
## MOD Author: RoadTrain < N/A >  http://www.torrentpier.info/
## MOD Version: 0.1
## Описание: мод позволяет делать модераторам и админам
## менять статус раздач.
## Installation Level: Easy
## Installation Time: 20 Minutes
## Files To Edit: templates/default/viewtopic_attach.tpl
##				  language/lang_russian/lang_main.php
##				  attach_mod/displaying_torrent.php
##				  torrent.php
##				  templates/default/tracker.tpl
##				  tracker.php
##				  viewforum.php
## Included Files: torstatus.php
## 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
##############################################################
## MOD History:
##    2008-04-23 - Version 0.2.0
##    	- fixed major bugs
##    	- new functions added (status user & date)
##    2008-04-14 - Version 0.1.0
##    	- initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

# 
#-----[ COPY ]---------------------------------
#
torstatus.php to forum root

# 
#-----[ SQL QUERY ]---------------------------------
# 
alter table bb_bt_torrents add (
  checked_user_id mediumint(8) NOT NULL default '0',
  checked_time int(11) NOT NULL default '0'
);

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

# 
#-----[ FIND ]---------------------------------
#
<td width="15%" rowspan="4" class="tCenter pad_6">

# 
#-----[ REPLACE WITH ]---------------------------------
#
<td width="15%" rowspan="5" class="tCenter pad_6">

# 
#-----[ FIND ]---------------------------------
#
	<tr class="row1">
		<td>{L_IS_REGISTERED}:</td>
		<td>{postrow.attach.tor_reged.REGED_TIME}</td>
	</tr>
	
# 
#-----[ BEFORE, ADD / Раньше ДОБАВИТЬ ]---------------------------------
#
	<tr class="row1">
		<td>{L_TOR_STATUS}:</td>
		<td><!-- IF postrow.attach.tor_reged.TOR_STATUS == 0 --><b><span style="color: purple;">*</span> {L_TOR_STATUS_NOT_CHECKED}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 1 --><b><span style="color: red;">x</span> {L_TOR_STATUS_CLOSED}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 2 --><b><span style="color: green;">&radic;</span> {L_TOR_STATUS_CHECKED}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 3 --><b><span style="color: blue;">D</span> {L_TOR_STATUS_D}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 4 --><b><span style="color: red;">!</span> {L_TOR_STATUS_NOT_PERFECT}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 5 --><b><span style="color: red;">?</span> {L_TOR_STATUS_PART_PERFECT}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 6 --><b><span style="color: green;">#</span> {L_TOR_STATUS_FISHILY}</b><!-- ENDIF -->
			<!-- IF postrow.attach.tor_reged.TOR_STATUS == 7 --><b><span style="color: red;">&copy;</span> {L_TOR_STATUS_COPY}</b><!-- ENDIF -->
		<span>{postrow.attach.tor_reged.TOR_STATUS_BY}</span>	
		<!-- IF AUTH_MOD -->	</br>
		<form method="POST" action="{TOR_STATUS}">
			<input type="hidden" name="id" value="{postrow.attach.tor_reged.ATTACH_ID}" />

			<select name="tor_status" id="tor-select-{postrow.attach.tor_reged_.ATTACH_ID}" onchange="$('#tor-status_confirm-{postrow.attach.tor_reged_.ATTACH_ID}').attr('checked', 0); $('#tor-submit-{postrow.attach.tor_reged_.ATTACH_ID}').attr('disabled', 1)">
				<option value="" selected="selected" class="select-action">&raquo; {L_TOR_STATUS_SELECT_ACTION}</option>
				<option value="2">{L_TOR_STATUS_CHECKED}</option>
				<option value="gy">{L_TOR_STATUS_NOT_CHECKED}</option>
				<option value="1">{L_TOR_STATUS_CLOSED}</option>
				<option value="3">{L_TOR_STATUS_D}</option>
				<option value="4">{L_TOR_STATUS_NOT_PERFECT}</option>		
				<option value="5">{L_TOR_STATUS_PART_PERFECT}</option>
				<option value="6">{L_TOR_STATUS_FISHILY}</option>
				<option value="7">{L_TOR_STATUS_COPY}</option>				
			</select>
			<label>
				<input name="status_confirm" id="tor-status_confirm-{postrow.attach.tor_reged_.ATTACH_ID}" type="checkbox" value="1" onclick="if( $('#tor-select-{postrow.attach.tor_reged_.ATTACH_ID}')[0].selectedIndex != 0 ){ $('#tor-submit-{postrow.attach.tor_reged_.ATTACH_ID}').attr('disabled', !this.checked); } else { return false; }" />&nbsp;{L_CONFIRM}&nbsp;
			</label>
			<input name="" id="tor-submit-{postrow.attach.tor_reged_.ATTACH_ID}" type="submit" value="{L_DO_SUBMIT}" class="liteoption" style="width: 110px;" disabled="disabled" />&nbsp;

		</form><!-- ENDIF --></td>
	</tr>

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


# 
#-----[ FIND ]---------------------------------
#
$lang['IS_REGISTERED'] = 'Зарегистрирован';


# 
#-----[ AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
//torrent status mod
$lang['TOR_STATUS'] = 'Статус';
$lang['TOR_STATUS_SELECT_ACTION'] = 'Выберите статус';
$lang['TOR_STATUS_CHECKED'] = 'проверено'; // 2
$lang['TOR_STATUS_NOT_CHECKED'] = 'не проверено';//0
$lang['TOR_STATUS_CLOSED'] = 'закрыто';//1
$lang['TOR_STATUS_D'] = 'повтор';//3
$lang['TOR_STATUS_NOT_PERFECT'] = 'неоформлено';//4
$lang['TOR_STATUS_PART_PERFECT'] = 'недооформлено';//5
$lang['TOR_STATUS_FISHILY'] = 'сомнительно';//6
$lang['TOR_STATUS_COPY'] = 'закрыто правообладателем';//7
//end torrent status mod
# 
#-----[ OPEN ]---------------------------------
# 
attach_mod/displaying_torrent.php

# 
#-----[ FIND ]---------------------------------
#
		'TOR_ACTION'    => "torrent.$phpEx",

# 
#-----[ AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
		//torrent status mod
		'TOR_STATUS'    => "torstatus.$phpEx", 
		//end torrent status mod
	
# 
#-----[ FIND ]---------------------------------
# around line 200
			'TOR_BLOCKED_MSG' => sprintf($lang['Bt_Low_ratio_for_dl'], round($user_ratio, 2), "search.$phpEx?dlu=$bt_user_id&amp;dlc=1"),
		));
	}
	else
	{
			
# 
#-----[ AFTER, ADD ]---------------------------------
#
	$sql = 'SELECT t.*, u.username  FROM '. BT_TORRENTS_TABLE ." t left join ". USERS_TABLE ." u on t.checked_user_id=u.user_id           WHERE t.attach_id = $attach_id";
	$tor_row = $db->sql_fetchrow($db->sql_query($sql)); 

# 
#-----[ FIND ]---------------------------------
# around line 210
'TOR_FROZEN'      => ($tor_info['tor_status'] == TOR_STATUS_FROZEN),

# 
#-----[ REPLACE WITH ]---------------------------------
#
'TOR_FROZEN'      => ($tor_info['tor_status'] == TOR_STATUS_FROZEN || $tor_info['tor_status'] == 3 || $tor_info['tor_status'] == 4 || $tor_info['tor_status'] == 7),
# 
#-----[ AND ADD AFTER ]---------------------------------
#			
			// torrent status mod
			'TOR_STATUS'      => $tor_info['tor_status'],
			'TOR_STATUS_BY'   => $tor_row['checked_user_id'] ? ('(by <a href='. BB_ROOT . 'profile.php?mode=viewprofile&u=' . $tor_row['checked_user_id'] . '>' . $tor_row['username'] . '</a> in ' . create_date($bb_cfg['default_dateformat'], $tor_row['checked_time'],
			$bb_cfg['board_timezone']).')'):'',
			//end torrent status mod

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

# 
#-----[ FIND ]---------------------------------
#
<th>&nbsp;</th>
# 
#-----[ AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
<th>&nbsp;</th>

# 
#-----[ FIND ]---------------------------------
#
<td class="row1"><!-- IF tor.USER_AUTHOR --><p style="padding-bottom: 3px">&nbsp;<b>&reg;</b>&nbsp;</p><!-- ELSEIF tor.IS_NEW -->{MINIPOST_IMG_NEW}<!-- ELSE -->{MINIPOST_IMG}<!-- ENDIF --></td>

# 
#-----[ AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
	<td class="row1"><!-- IF tor.TOR_STATUS == 0 --><b><span title="{L_TOR_STATUS_NOT_CHECKED}" style="color: purple;">*</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 1 --><b><span title="{L_TOR_STATUS_CLOSED}" style="color: red;">x</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 2 --><b><span title="{L_TOR_STATUS_CHECKED}" style="color: green;">&radic;</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 3 --><b><span title="{L_TOR_STATUS_D}" style="color: blue;">D</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 4 --><b><span title="{L_TOR_STATUS_NOT_PERFECT}" style="color: red;">!</span></b><!-- ENDIF -->	
			<!-- IF tor.TOR_STATUS == 5 --><b><span title="{L_TOR_STATUS_PART_PERFECT}" style="color: red;">?</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 6 --><b><span title="{L_TOR_STATUS_FISHILY}" style="color:green;">#</span></b><!-- ENDIF -->
			<!-- IF tor.TOR_STATUS == 7 --><b><span title="{L_TOR_STATUS_COPY}" style="color: red;">&copy;</span></b><!-- ENDIF -->
	</td>
					
# 
#-----[ OPEN ]---------------------------------
#
tracker.php

# 
#-----[ FIND ]---------------------------------
#
$tor_colspan         = 12;                     // torrents table colspan with all columns		

# 
#-----[ REPLACE WITH ]---------------------------------
#
$tor_colspan         = 13;                     // torrents table colspan with all columns
			
# 
#-----[ FIND ]---------------------------------
#
				'TOR_FROZEN'   => ($tor['tor_status'] == TOR_STATUS_FROZEN),
				
# 
#-----[ REPLACE WITH ]---------------------------------
#
				'TOR_FROZEN'   => ($tor['tor_status'] == TOR_STATUS_FROZEN || $tor['tor_status'] == 3 || $tor['tor_status'] == 4 || $tor['tor_status'] == 7),
# 
#-----[ AND AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
				// torrent status mod
				'TOR_STATUS'   => ($tor['tor_status']),
				//end torrent status mod				
								
# 
#-----[ OPEN ]---------------------------------
#
vewforum.php
			
# 
#-----[ FIND ]---------------------------------
#
		'TOR_FROZEN'       => (isset($topic['tor_status']) && $topic['tor_status'] == TOR_STATUS_FROZEN),
# 
#-----[ REPLACE WITH ]---------------------------------
#
		'TOR_FROZEN'       => ((isset($topic['tor_status']) && $topic['tor_status'] == TOR_STATUS_FROZEN) || $topic['tor_status'] == 3 || $topic['tor_status'] == 4 || $topic['tor_status'] == 7),
# 
#-----[ AND AFTER, ADD / ПОСЛЕ, ДОБАВИТЬ ]---------------------------------
#
		// Torrent status mod
		'TOR_STATUS'       => ($forum_data['allow_reg_tracker'] && ($topic['tor_status'] == 1 || $topic['tor_status'] == 3)),
		// end torrent status mod	
#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
#
# EoM
