<?php
/**
*
* @package ppkBB3cker
* @version $Id: viewtopic_add2_torrent.php 1.000 2009-03-02 12:17:00 PPK $
* @copyright (c) 2008, 2009 PPK
* http://ppkbb3cker.rx22.ru, http://protoneutron.narod.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}
				foreach ($torrents_attach['torrent'] as $torrent_data)
				{
					$req_upload='';
					if(!$is_canskiprequpload && $torrents[$torrent_data['attach_id']]['req_upload'])
					{
						if(!$user->data['user_uploaded'] || $user->data['user_uploaded'] < ($torrents[$torrent_data['attach_id']]['req_upload']*1024*1024*1024))
						{
							$req_upload=$forum_astracker ? '<img src="' . $phpbb_root_path . 'images/tracker/info_requpload_big.png" alt="'. sprintf($user->lang['TORRENT_REQ_UPLOAD_1'], @$torrents[$torrent_data['attach_id']]['req_upload'], '%') .'"  title="'. sprintf($user->lang['TORRENT_REQ_UPLOAD_1'], @$torrents[$torrent_data['attach_id']]['req_upload'], get_formatted_filesize($user->data['user_uploaded'], 0).get_size_lang($user->data['user_uploaded'])) .'"/>' : '';
						}
						else
						{
							$req_upload=$forum_astracker ? '<img src="' . $phpbb_root_path . 'images/tracker/button_ok_requpload_big.png" alt="'. sprintf($user->lang['TORRENT_REQ_UPLOAD_0'], @$torrents[$torrent_data['attach_id']]['req_upload'], '%') .'"  title="'. sprintf($user->lang['TORRENT_REQ_UPLOAD_0'], @$torrents[$torrent_data['attach_id']]['req_upload'], get_formatted_filesize($user->data['user_uploaded'], 0).get_size_lang($user->data['user_uploaded'])) .'"/>' : '';
						}
					}
					$req_ratio='';
					if(!$is_canskipreqratio && $torrents[$torrent_data['attach_id']]['req_ratio']!=0.000)
					{
						if($torrents[$torrent_data['attach_id']]['req_ratio']!=0.000 && ($user_ratio < $torrents[$torrent_data['attach_id']]['req_ratio'] || $user_ratio=='Leech.' || $user_ratio=='Inf.'))
						{
							$req_ratio=$forum_astracker ? '<img src="' . $phpbb_root_path . 'images/tracker/info_reqratio_big.png" alt="'. sprintf($user->lang['TORRENT_REQ_RATIO_1'], @$torrents[$torrent_data['attach_id']]['req_ratio'], '%') .'"  title="'. sprintf($user->lang['TORRENT_REQ_RATIO_1'], @$torrents[$torrent_data['attach_id']]['req_ratio'], $user_ratio) .'"/>' : '';
						}
						else
						{
							$req_ratio=$forum_astracker ? '<img src="' . $phpbb_root_path . 'images/tracker/button_ok_reqratio_big.png" alt="'. sprintf($user->lang['TORRENT_REQ_RATIO_0'], @$torrents[$torrent_data['attach_id']]['req_ratio'], '%') .'"  title="'. sprintf($user->lang['TORRENT_REQ_RATIO_0'], @$torrents[$torrent_data['attach_id']]['req_ratio'], $user_ratio) .'"/>' : '';
						}
					}
					$torrent_data['size_lang'] = get_size_lang($torrent_data['filesize']);
					$torrent_data['filesize'] = get_formatted_filesize($torrent_data['filesize'], false);
					$torrent_basename=basename($torrent_data['real_filename']);
					$template->assign_block_vars('postrow.torrent_fields', array(
						'TORRENT_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . (int) $torrent_data['attach_id'], true, ($torrent_data['is_orphan']) ? $user->session_id : false),
						'TORRENT_SRC' => $phpbb_root_path . 'images/tracker/filesave_big.png',
						'TORRENT_FILESIZE'			=> $torrent_data['filesize'],
						'TORRENT_SIZE_LANG'			=> $torrent_data['size_lang'],
						'TORRENT_DOWNLOAD_NAME'		=> utf8_strlen($torrent_basename)>$tracker_substr ? utf8_substr($torrent_basename, 0, $tracker_substr).'...' : $torrent_basename,
						'TORRENT_ALTITLE'			=> $torrent_basename,
						'TORRENT_COMMENT'			=> @$torrent_data['attach_comment'] ? '[<a href="#" title="'.$torrent_data['attach_comment'].'" alt="'.$torrent_data['attach_comment'].'">?</a>]' : '',
						'TORRENT_DOWNLOADED'			=>$torrent_data['download_count'],
						'TORRENT_FREE'			=> $forum_astracker && $is_canusefree && @$torrents[$torrent_data['attach_id']]['free'] ? '<img src="' . $phpbb_root_path . 'images/tracker/bookmark_big.png" alt="'. sprintf($user->lang['FORM_TORRENT_FREE'], @$torrents[$torrent_data['attach_id']]['free'], '%') .'"  title="'. sprintf($user->lang['FORM_TORRENT_FREE'], @$torrents[$torrent_data['attach_id']]['free'], '%') .'"/>' : '',
						'TORRENT_REQ_UPLOAD'			=> $req_upload,
						'TORRENT_REQ_RATIO'			=> $req_ratio,
						'TORRENT_WAIT'			=> $forum_astracker && !$is_canskiprcheck && ($t_wait>=0 || $t_wait2 >= 0) ? '<img src="' . $phpbb_root_path . 'images/tracker/xclock_big.png" title="' . (($t_wait > 0 || $t_wait2 >= 0) ? sprintf($user->lang['TORRENT_WAIT'], ($t_wait > $t_wait2 ? $t_wait : $t_wait2)) : $user->lang['TORRENT_WAIT_NEVER']).'" />' : '',
						'TORRENT_BONUS'			=> $forum_astracker && $is_canusebonus && @$torrents[$torrent_data['attach_id']]['size'] > ($config['ppkbb_tcbonus_fsize'] * 1024 * 1024) ? '<img src="' . $phpbb_root_path . 'images/tracker/add_big.png" alt="' . sprintf($user->lang['TORRENT_BONUS'], $config['ppkbb_tcbonus_upvalue'], $config['ppkbb_tcbonus_value']) .'"  title="' . sprintf($user->lang['TORRENT_BONUS'], $config['ppkbb_tcbonus_upvalue'], $config['ppkbb_tcbonus_value']) .'"/>' : ''
						)
					);
				}
?>