From ea63309a971762cca46a7b4010001627e228a998 Mon Sep 17 00:00:00 2001 From: "torrent.rus.ec@gmail.com" Date: Mon, 11 Mar 2013 05:37:31 +0000 Subject: [PATCH] r497 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- upload/ajax/view_profile.php | 158 +++++++++++++++ upload/config.php | 2 +- upload/includes/ucp/torrent_userprofile.php | 205 -------------------- 3 files changed, 159 insertions(+), 206 deletions(-) create mode 100644 upload/ajax/view_profile.php delete mode 100644 upload/includes/ucp/torrent_userprofile.php diff --git a/upload/ajax/view_profile.php b/upload/ajax/view_profile.php new file mode 100644 index 000000000..d0c725533 --- /dev/null +++ b/upload/ajax/view_profile.php @@ -0,0 +1,158 @@ +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 '; + } + elseif ($rowset[$i]['tor_type'] == TOR_TYPE_SILVER) + { + $is_gold = ' '; + } + } + $topic_title = ($rowset[$i]['update_time']) ? wbr($rowset[$i]['topic_title']) : ''. wbr($rowset[$i]['topic_title']) .''; + $topic_seeders = ''. $rowset[$i]['seeders'] .''; + $topic_leechers = ''. $rowset[$i]['leechers'] .''; + $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 = ''. $lang['RELEASER'] .''; + $releasing_count++; + } + else if ($rowset[$i]['seeder']) + { + $s = $s + $rowset[$i]['size']; + $type = $type = ''. $lang['SEEDER'] .''; + $seeding_count++; + } + else + { + $l = $l + $rowset[$i]['size']; + $type = ''. $lang['LEECHER'] .''; + + $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 = ''. $compl_perc .'%'; + $leeching_count++; + } + + $html .= ' + + '. $type .' + '. htmlCHR($rowset[$i]['forum_name']) .' + '. $is_gold .''. $topic_title .' + '. $compl_perc_html .' + +
+

'. $topic_seeders .' | '. $topic_leechers .'

+

'. $topic_speed_up .'

+
+ + + '; + } + + $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 = ' + '. $lang['SEARCH_DL_WILL_DOWNLOADS'] .' + :: + '. $lang['SEARCH_DL_DOWN'] .' + :: + '. $lang['SEARCH_DL_COMPLETE'] .' + :: + '. $lang['SEARCH_DL_CANCEL'] .' + '; + } + + $this->response['active_torrents'] = ' + + +
+
'. $lang['CUR_ACTIVE_DLS'] .'
+
'. $lang['RELEASING'] .': '. $releasing_count .' :: '. $lang['SEEDING'] .': ' . $seeding_count .' :: '. $lang['LEECHING'] .': ' . $leeching_count .'
+
+ +
+ + + + + + + + '. $html .' + + + +
'. $lang['TYPE'] .''. $lang['FORUM'] .''. $lang['TOPICS'] .''. $lang['TORRENT'] .'
+ '. $dl .' +
+
+ '; + } + else $this->ajax_die($lang['CUR_ACTIVE_DLS_ERROR']); + break; +} \ No newline at end of file diff --git a/upload/config.php b/upload/config.php index 17e742aa4..2d56e4d9e 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,7 +57,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do // Increase number of revision after update $bb_cfg['tp_version'] = '2.5 pre-stable'; $bb_cfg['tp_release_date'] = '11-03-2013'; -$bb_cfg['tp_release_state'] = 'R496'; +$bb_cfg['tp_release_state'] = 'R497'; // Database $charset = 'utf8'; diff --git a/upload/includes/ucp/torrent_userprofile.php b/upload/includes/ucp/torrent_userprofile.php deleted file mode 100644 index dd028bb88..000000000 --- a/upload/includes/ucp/torrent_userprofile.php +++ /dev/null @@ -1,205 +0,0 @@ -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 = ' '; - } - elseif ($releasing[$i]['tor_type'] == TOR_TYPE_SILVER) - { - $is_gold = ' '; - } - } - - $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']) : ''. wbr($releasing[$i]['topic_title']) .'', - '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 = ' '; - } - elseif ($seeding[$i]['tor_type'] == TOR_TYPE_SILVER) - { - $is_gold = ' '; - } - } - - $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']) : ''. wbr($seeding[$i]['topic_title']) .'', - '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 = ' '; - } - elseif ($leeching[$i]['tor_type'] == TOR_TYPE_SILVER) - { - $is_gold = ' '; - } - } - - $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']) : ''. wbr($leeching[$i]['topic_title']) .'', - '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'=> ''. $lang['RELEASING'] .''. (($releasing_count) ? "
[ $releasing_count ]" : ''), - 'L_SEEDINGS' => ''. $lang['SEEDING'] .''. (($seeding_count) ? "
[ $seeding_count ]" : ''), - 'L_LEECHINGS' => ''. $lang['LEECHING'] .''. (($leeching_count) ? "
[ $leeching_count ]" : ''), - - '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; -}