mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r497
R496 - нерабочая! Не качать! Исправление по горячим следам. R496 - not working! No download! It is hot fix. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@497 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
0ddef30d06
commit
ea63309a97
3 changed files with 159 additions and 206 deletions
158
upload/ajax/view_profile.php
Normal file
158
upload/ajax/view_profile.php
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
global $user, $bb_cfg, $tr_cfg, $lang, $userdata;
|
||||||
|
|
||||||
|
$mode = (string) $this->request['mode'];
|
||||||
|
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 'active_torrents':
|
||||||
|
$user_id = (int) $this->request['user_id'];
|
||||||
|
if(!$user_id) $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||||
|
|
||||||
|
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
||||||
|
$not_auth_forums_sql = ($excluded_forums_csv) ? "
|
||||||
|
AND f.forum_id NOT IN($excluded_forums_csv)
|
||||||
|
AND f.forum_parent NOT IN($excluded_forums_csv)
|
||||||
|
" : '';
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
f.forum_id, f.forum_name,
|
||||||
|
t.topic_title,
|
||||||
|
tor.tor_type, tor.size,
|
||||||
|
trs.seeders, trs.leechers,
|
||||||
|
tr.*
|
||||||
|
FROM ". BB_FORUMS ." f, ". BB_TOPICS ." t, ". BB_BT_TRACKER ." tr, ". BB_BT_TORRENTS ." tor, ". BB_BT_TRACKER_SNAP ." trs
|
||||||
|
WHERE tr.user_id = $user_id
|
||||||
|
AND tr.topic_id = tor.topic_id
|
||||||
|
AND trs.topic_id = tor.topic_id
|
||||||
|
AND tor.topic_id = t.topic_id
|
||||||
|
AND t.forum_id = f.forum_id
|
||||||
|
$not_auth_forums_sql
|
||||||
|
GROUP BY tr.topic_id
|
||||||
|
ORDER BY tr.releaser DESC, tr.seeder DESC, f.forum_name ASC, t.topic_title ASC";
|
||||||
|
|
||||||
|
if (!$result = DB()->sql_query($sql))
|
||||||
|
{
|
||||||
|
$this->ajax_die('Could not query users torrent profile information', '', __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowset = DB()->sql_fetchrowset($result))
|
||||||
|
{
|
||||||
|
$html = '';
|
||||||
|
$r = $s = $l = $releasing_count = $seeding_count = $leeching_count = 0;
|
||||||
|
for ($i=0; $i<count($rowset); $i++)
|
||||||
|
{
|
||||||
|
$is_gold = '';
|
||||||
|
if ($tr_cfg['gold_silver_enabled'])
|
||||||
|
{
|
||||||
|
if ($rowset[$i]['tor_type'] == TOR_TYPE_GOLD)
|
||||||
|
{
|
||||||
|
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" /> ';
|
||||||
|
}
|
||||||
|
elseif ($rowset[$i]['tor_type'] == TOR_TYPE_SILVER)
|
||||||
|
{
|
||||||
|
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" /> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$topic_title = ($rowset[$i]['update_time']) ? wbr($rowset[$i]['topic_title']) : '<s>'. wbr($rowset[$i]['topic_title']) .'</s>';
|
||||||
|
$topic_seeders = '<span class="seedmed"><b>'. $rowset[$i]['seeders'] .'</b></span>';
|
||||||
|
$topic_leechers = '<span class="leechmed"><b>'. $rowset[$i]['leechers'] .'</b></span>';
|
||||||
|
$topic_speed_up = ($rowset[$i]['speed_up']) ? humn_size($rowset[$i]['speed_up'], 0, 'KB') .'/s' : '-';
|
||||||
|
|
||||||
|
$compl_perc_html = '';
|
||||||
|
$colspan = 'colspan="2" ';
|
||||||
|
if ($rowset[$i]['releaser'])
|
||||||
|
{
|
||||||
|
$r = $r + $rowset[$i]['size'];
|
||||||
|
$type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['RELEASER'] .'</td>';
|
||||||
|
$releasing_count++;
|
||||||
|
}
|
||||||
|
else if ($rowset[$i]['seeder'])
|
||||||
|
{
|
||||||
|
$s = $s + $rowset[$i]['size'];
|
||||||
|
$type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['SEEDER'] .'</td>';
|
||||||
|
$seeding_count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$l = $l + $rowset[$i]['size'];
|
||||||
|
$type = '<td class="row1 tCenter dlDown lh_150 pad_4 nowrap">'. $lang['LEECHER'] .'</td>';
|
||||||
|
|
||||||
|
$compl_size = ($rowset[$i]['remain'] && $rowset[$i]['size'] && $rowset[$i]['size'] > $rowset[$i]['remain']) ? ($rowset[$i]['size'] - $rowset[$i]['remain']) : 0;
|
||||||
|
|
||||||
|
if($bb_cfg['announce_type'] == 'xbt') $compl_perc = $rowset[$i]['complete_percent'];
|
||||||
|
else $compl_perc = ($compl_size) ? floor($compl_size * 100 / $rowset[$i]['size']) : 0;
|
||||||
|
|
||||||
|
$colspan = '';
|
||||||
|
$compl_perc_html = '<td class="tCenter med"><b>'. $compl_perc .'%</b></td>';
|
||||||
|
$leeching_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '
|
||||||
|
<tr class="row1">
|
||||||
|
'. $type .'
|
||||||
|
<td class="tCenter pad_4"><a class="gen" href="viewforum.php?'. POST_FORUM_URL .'='. $rowset[$i]['forum_id'] .'">'. htmlCHR($rowset[$i]['forum_name']) .'</a></td>
|
||||||
|
<td class="pad_4"><a class="med" href="viewtopic.php?'. POST_TOPIC_URL .'='. $rowset[$i]['topic_id'] .'&spmode=full#leechers">'. $is_gold .'<b>'. $topic_title .'</b></a></td>
|
||||||
|
'. $compl_perc_html .'
|
||||||
|
<td '. $colspan .'class="tCenter pad_4">
|
||||||
|
<div>
|
||||||
|
<p>'. $topic_seeders .'<span class="med"> | </span>'. $topic_leechers .'</p>
|
||||||
|
<p style="padding-top: 2px" class="seedsmall">'. $topic_speed_up .'</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
$releasing_count = ($releasing_count) ? $releasing_count .' ('. humn_size($r) .')' : 0;
|
||||||
|
$seeding_count = ($seeding_count) ? $seeding_count .' ('. humn_size($s) .')' : 0;
|
||||||
|
$leeching_count = ($leeching_count) ? $leeching_count .' ('. humn_size($l) .')' : 0;
|
||||||
|
|
||||||
|
$dl = ' ';
|
||||||
|
if (!empty($page_cfg['dl_links_user_id']))
|
||||||
|
{
|
||||||
|
$dl_link = "search.php?dlu={$page_cfg['dl_links_user_id']}&";
|
||||||
|
$dl = '
|
||||||
|
<a href="'. $dl_link .'dlw=1" class="med">'. $lang['SEARCH_DL_WILL_DOWNLOADS'] .'</a>
|
||||||
|
::
|
||||||
|
<a href="'. $dl_link .'dld=1" class="med">'. $lang['SEARCH_DL_DOWN'] .'</a>
|
||||||
|
::
|
||||||
|
<a href="'. $dl_link .'dlc=1" class="med">'. $lang['SEARCH_DL_COMPLETE'] .'</a>
|
||||||
|
::
|
||||||
|
<a href="'. $dl_link .'dla=1" class="med">'. $lang['SEARCH_DL_CANCEL'] .'</a>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response['active_torrents'] = '
|
||||||
|
<a name="torrent"></a>
|
||||||
|
|
||||||
|
<div class="spacer_8"></div>
|
||||||
|
<div class="pagetitle tCenter">'. $lang['CUR_ACTIVE_DLS'] .'</div>
|
||||||
|
<div class="bold tCenter">'. $lang['RELEASING'] .': <span class="dlComplete">'. $releasing_count .'</span> :: '. $lang['SEEDING'] .': <span class="dlComplete">' . $seeding_count .'</span> :: '. $lang['LEECHING'] .': <span class="dlDown">' . $leeching_count .'</span></div>
|
||||||
|
<div class="spacer_8"></div>
|
||||||
|
|
||||||
|
<div class="fon2">
|
||||||
|
<table class="forumline">
|
||||||
|
<tr>
|
||||||
|
<th><b class="tbs-text">'. $lang['TYPE'] .'</b></th>
|
||||||
|
<th><b class="tbs-text">'. $lang['FORUM'] .'</b></th>
|
||||||
|
<th><b class="tbs-text">'. $lang['TOPICS'] .'</b></th>
|
||||||
|
<th colspan="2"><b class="tbs-text">'. $lang['TORRENT'] .'</b></th>
|
||||||
|
</tr>
|
||||||
|
'. $html .'
|
||||||
|
<tr class="row2 tCenter">
|
||||||
|
<td class="catBottom pad_6" colspan="5">
|
||||||
|
'. $dl .'
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else $this->ajax_die($lang['CUR_ACTIVE_DLS_ERROR']);
|
||||||
|
break;
|
||||||
|
}
|
|
@ -57,7 +57,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
||||||
$bb_cfg['tp_release_date'] = '11-03-2013';
|
$bb_cfg['tp_release_date'] = '11-03-2013';
|
||||||
$bb_cfg['tp_release_state'] = 'R496';
|
$bb_cfg['tp_release_state'] = 'R497';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
|
|
@ -1,205 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('IN_VIEWPROFILE')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
if (!$profiledata['user_id'] || $profiledata['user_id'] == ANONYMOUS)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, $lang['NO_USER_ID_SPECIFIED']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$seeding = $leeching = $releasing = array();
|
|
||||||
|
|
||||||
$profile_user_id = intval($profiledata['user_id']);
|
|
||||||
$current_time = (isset($_GET['time']) && $_GET['time'] == 'all') ? 0 : TIMENOW;
|
|
||||||
|
|
||||||
// Get username
|
|
||||||
if (!$username = $profiledata['username'])
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($profile_user_id == $userdata['user_id'])
|
|
||||||
{
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'EDIT_PROF' => true,
|
|
||||||
'EDIT_PROF_HREF' => "profile.php?mode=editprofile",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template->assign_vars(array('EDIT_PROF' => false));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auth
|
|
||||||
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
|
||||||
$not_auth_forums_sql = ($excluded_forums_csv) ? "
|
|
||||||
AND f.forum_id NOT IN($excluded_forums_csv)
|
|
||||||
AND f.forum_parent NOT IN($excluded_forums_csv)
|
|
||||||
" : '';
|
|
||||||
|
|
||||||
// Get users active torrents
|
|
||||||
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_title, tor.tor_type, tor.size, tr.*
|
|
||||||
FROM '. BB_FORUMS .' f, '. BB_TOPICS .' t, '. BB_BT_TRACKER .' tr, '. BB_BT_TORRENTS ." tor
|
|
||||||
WHERE tr.user_id = $profile_user_id
|
|
||||||
AND tr.topic_id = tor.topic_id
|
|
||||||
AND tor.topic_id = t.topic_id
|
|
||||||
AND t.forum_id = f.forum_id
|
|
||||||
$not_auth_forums_sql
|
|
||||||
GROUP BY tr.topic_id
|
|
||||||
ORDER BY f.forum_name, t.topic_title";
|
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not query users torrent profile information', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rowset = @DB()->sql_fetchrowset($result))
|
|
||||||
{
|
|
||||||
DB()->sql_freeresult($result);
|
|
||||||
$rowset_count = count($rowset);
|
|
||||||
|
|
||||||
for ($i=0; $i<$rowset_count; $i++)
|
|
||||||
{
|
|
||||||
if ($rowset[$i]['releaser'])
|
|
||||||
{
|
|
||||||
$releasing[] = $rowset[$i];
|
|
||||||
}
|
|
||||||
else if ($rowset[$i]['seeder'])
|
|
||||||
{
|
|
||||||
$seeding[] = $rowset[$i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$leeching[] = $rowset[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($rowset);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($releasing_count = count($releasing))
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('released', array());
|
|
||||||
|
|
||||||
for ($i=0; $i<$releasing_count; $i++)
|
|
||||||
{
|
|
||||||
$is_gold = '';
|
|
||||||
if ($tr_cfg['gold_silver_enabled'])
|
|
||||||
{
|
|
||||||
if ($releasing[$i]['tor_type'] == TOR_TYPE_GOLD)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" /> ';
|
|
||||||
}
|
|
||||||
elseif ($releasing[$i]['tor_type'] == TOR_TYPE_SILVER)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" /> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('released.releasedrow', array(
|
|
||||||
'FORUM_NAME' => htmlCHR($releasing[$i]['forum_name']),
|
|
||||||
'TOPIC_TITLE' => ($releasing[$i]['update_time']) ? wbr($releasing[$i]['topic_title']) : '<s>'. wbr($releasing[$i]['topic_title']) .'</s>',
|
|
||||||
'U_VIEW_FORUM' => "viewforum.php?". POST_FORUM_URL .'='. $releasing[$i]['forum_id'],
|
|
||||||
'U_VIEW_TOPIC' => "viewtopic.php?". POST_TOPIC_URL .'='. $releasing[$i]['topic_id'] .'&spmode=full#seeders',
|
|
||||||
'TOR_TYPE' => $is_gold,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_releasing_none', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($seeding_count = count($seeding))
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('seed', array());
|
|
||||||
|
|
||||||
for ($i=0; $i<$seeding_count; $i++)
|
|
||||||
{
|
|
||||||
$is_gold = '';
|
|
||||||
if ($tr_cfg['gold_silver_enabled'])
|
|
||||||
{
|
|
||||||
if ($seeding[$i]['tor_type'] == TOR_TYPE_GOLD)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" /> ';
|
|
||||||
}
|
|
||||||
elseif ($seeding[$i]['tor_type'] == TOR_TYPE_SILVER)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" /> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('seed.seedrow', array(
|
|
||||||
'FORUM_NAME' => htmlCHR($seeding[$i]['forum_name']),
|
|
||||||
'TOPIC_TITLE' => ($seeding[$i]['update_time']) ? wbr($seeding[$i]['topic_title']) : '<s>'. wbr($seeding[$i]['topic_title']) .'</s>',
|
|
||||||
'U_VIEW_FORUM' => "viewforum.php?". POST_FORUM_URL .'='. $seeding[$i]['forum_id'],
|
|
||||||
'U_VIEW_TOPIC' => "viewtopic.php?". POST_TOPIC_URL .'='. $seeding[$i]['topic_id'] .'&spmode=full#seeders',
|
|
||||||
'TOR_TYPE' => $is_gold,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_seeding_none', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($leeching_count = count($leeching))
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('leech', array());
|
|
||||||
|
|
||||||
for ($i=0; $i<$leeching_count; $i++)
|
|
||||||
{
|
|
||||||
$is_gold = '';
|
|
||||||
if ($tr_cfg['gold_silver_enabled'])
|
|
||||||
{
|
|
||||||
if ($leeching[$i]['tor_type'] == TOR_TYPE_GOLD)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" /> ';
|
|
||||||
}
|
|
||||||
elseif ($leeching[$i]['tor_type'] == TOR_TYPE_SILVER)
|
|
||||||
{
|
|
||||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" /> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$compl_size = ($leeching[$i]['remain'] && $leeching[$i]['size'] && $leeching[$i]['size'] > $leeching[$i]['remain']) ? ($leeching[$i]['size'] - $leeching[$i]['remain']) : 0;
|
|
||||||
|
|
||||||
if($bb_cfg['announce_type'] == 'xbt')
|
|
||||||
{
|
|
||||||
$compl_perc = $leeching[$i]['complete_percent'];}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $leeching[$i]['size']) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('leech.leechrow', array(
|
|
||||||
'FORUM_NAME' => htmlCHR($leeching[$i]['forum_name']),
|
|
||||||
'TOPIC_TITLE' => ($leeching[$i]['update_time']) ? wbr($leeching[$i]['topic_title']) : '<s>'. wbr($leeching[$i]['topic_title']) .'</s>',
|
|
||||||
'U_VIEW_FORUM' => "viewforum.php?". POST_FORUM_URL .'='. $leeching[$i]['forum_id'],
|
|
||||||
'U_VIEW_TOPIC' => "viewtopic.php?". POST_TOPIC_URL .'='. $leeching[$i]['topic_id'] .'&spmode=full#leechers',
|
|
||||||
'COMPL_PERC' => $compl_perc,
|
|
||||||
'TOR_TYPE' => $is_gold,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_leeching_none', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'USERNAME' => $username,
|
|
||||||
'L_RELEASINGS'=> '<b>'. $lang['RELEASING'] .'</b>'. (($releasing_count) ? "<br />[ <b>$releasing_count</b> ]" : ''),
|
|
||||||
'L_SEEDINGS' => '<b>'. $lang['SEEDING'] .'</b>'. (($seeding_count) ? "<br />[ <b>$seeding_count</b> ]" : ''),
|
|
||||||
'L_LEECHINGS' => '<b>'. $lang['LEECHING'] .'</b>'. (($leeching_count) ? "<br />[ <b>$leeching_count</b> ]" : ''),
|
|
||||||
|
|
||||||
'RELEASED_ROWSPAN' => ($releasing_count) ? 'rowspan="'. ($releasing_count + 1) .'"' : '',
|
|
||||||
'SEED_ROWSPAN' => ($seeding_count) ? 'rowspan="'. ($seeding_count + 1) .'"' : '',
|
|
||||||
'LEECH_ROWSPAN' => ($leeching_count) ? 'rowspan="'. ($leeching_count + 1) .'"' : '',
|
|
||||||
));
|
|
||||||
|
|
||||||
$template->assign_vars(array('SHOW_SEARCH_DL' => false));
|
|
||||||
|
|
||||||
if (IS_AM || $profile_user_id == $userdata['user_id'])
|
|
||||||
{
|
|
||||||
$page_cfg['dl_links_user_id'] = $profile_user_id;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue