
  |
How do you rate this Hack |
  |
|
| 5 |
|
100% |
[ 1 ] |
| 4 |
|
0% |
[ 0 ] |
| 3 |
|
0% |
[ 0 ] |
| 2 |
|
0% |
[ 0 ] |
| 1 |
|
0% |
[ 0 ] |
 |
|
|
|
Total Votes : 1 |
|
 |
 |
  |
|
  |
 |
mozes

UL: 5 GB DL: 1 B Ratio: 5368709120
Joined: 2006-01-16
Posts: 195
|
|
if you want to put Quakes last 5 torrents in
open
medal.php
find
| Code:
|
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
init_userprefs($userdata);
|
After add
| Code:
|
// Top 5 Torrent START
// Option of Toplist Start
$MAX_STR_LEN = 40; // Topics text length
$MAX_TOPICS = 5; // Topics to display (Default: 5)
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;
$sortby="topic_last_post_id"; // Order by topic_last_post_id (Default) topic_replies topic_views
// Option of Toplist End
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
// Find which forums are visible for this user
$is_auth_ary_top5 = array();
$is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$auth_forum_ary_top5 = array();
// Get forum info
// $sql = "SELECT forum_id, forum_icon FROM " . FORUMS_TABLE;
if( !$q_forums = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch forum info fail', __LINE__, __FILE__, $sql);
}
// Authorized forums info
while( $forum_row = $db->sql_fetchrow($q_forums) )
{
$forum_id1 = $forum_row['forum_id'];
if( $is_auth_ary_top5[$forum_id1]['auth_read'] == 1)
{
if(function_exists("array_push"))
{
array_push($auth_forum_ary_top5, $forum_id1);
} else {
$auth_id=count($auth_forum_ary_top5);
$auth_forum_ary_top5[$auth_id]=$forum_id1;
}
}
}
if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY )
{
$auth_forums_top5 = "";
}
else
{
$auth_forums_top5 = 'AND f.allow_reg_tracker IN(';
if(sizeOf($auth_forum_ary_top5) > 1)
{
$auth_forums_top5 .= implode (',', $auth_forum_ary_top5);
}
else
{
$auth_forums_top5 .= $auth_forum_ary_top5[0];
}
$auth_forums_top5 .= ')';
}
// query
$sql = "SELECT tor.*, t.*, f.*
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . BT_TORRENTS_TABLE . " tor
WHERE t.forum_id = f.forum_id
AND tor.topic_id = t.topic_id
AND topic_moved_id = '0'
$auth_forums_top5
ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic info fail', __LINE__, __FILE__, $sql);
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);
$topic_poster = $rows['topic_poster'];
$topic_last_post_id = $rows['topic_last_post_id'];
//$icon = $rows['forum_icon']; // Forum Icon Mod
$att_id = $rows['attach_id'];
$size = $rows['size'];
// Grab topic poster and last replier data
$sql = "SELECT post_username, user_id, username
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE topic_id = '" . $rows['topic_id'] . "'
AND poster_id = user_id
ORDER BY post_id LIMIT 0, 1";
if( !$p_result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic poster fail', __LINE__, __FILE__, $sql);
}
$p_row = $db->sql_fetchrow($p_result);
$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] :
$p_row['post_username']);
$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' .
append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name;
$sql = "SELECT post_username, user_id, username, post_time
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE post_id = '$topic_last_post_id'
AND poster_id = user_id";
if( !$r_result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic last replier fail', __LINE__, __FILE__, $sql);
}
$r_row = $db->sql_fetchrow($r_result);
$replier_id = $r_row['user_id'];
$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] :
$r_row['post_username']);
$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' .
append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;
$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id");
$template->assign_block_vars("toprow", array(
'FORUM_NAME' => $rows['forum_name'],
'FORUM_URL' => $forum_url,
// 'FORUM_ICON_IMG' => ($icon) ? '<img src="' . $phpbb_root_path . $icon . '" alt="'.$forum_data[$j]['forum_name'].'" //title="'.$forum_data[$j]['forum_name'].'" />' : '', // Forum Icon Mod
'DL_TOR_HREF' => append_sid("download.$phpEx?id=". $att_id),
'TOR_SIZE' => humn_size($size, '', '', ' '),
'TOPIC' => cutStr($rows['topic_title']),
'TOPIC_URL' => $topic_url,
'TOPIC_VIEWS' => $rows['topic_views'],
'TOPIC_REPLIES' => $rows['topic_replies'],
'POST_TIME' => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']),
'POSTER_URL' => $poster_url,
'REPLIER_URL' => $replier_url,
'LAST_POST_URL' => $last_post_url
));
}
// Top 5 Torrent END
|
find
| Code:
|
|
'LAST_POST_URL' => $last_post_url
|
change to
| Code:
|
|
'LAST_POST_URL' => $last_post_url,
|
add after
| Code:
|
// Top 5 Torrent
'L_LASTPOST' => $lang['Posted'],
'ICON_URL' => $images['icon_latest_reply'],
'ICON_ALT' => $lang['View_latest_post'],
'L_AUTHOR' => $lang['Author'],
'L_DL' => $lang['Download'],
'L_SIZE' => $lang['Tor_Size'],
'L_LEECHERS' => $lang['Leechers'],
'L_SEEDERS' => $lang['Seeders'],
'L_DL_SPEED' => $lang['Bt_DL_speed'],
'L_COMPL' => $lang['Completed'],
// End Top 5 Torrent
|
open medal_body.tpl
find
| Code:
|
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
</tr>
|
BEFORE ADD
| Code:
|
<!--BEGIN BT post-->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="6" height="25"><span class="genmed"><center><font color="#000095"><b>Laatste 10 torrents</b></font></center></span></td>
</tr>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="1" align="LEFT" width="50%" tittle="{L_FORUM}"><span class="genmed"> <font color="#D50000">Forums</font> </b></span></td>
<th colspan="1" align="center" width="10%" title="{L_DL}"><span class="genmed"> <font color="#D50000">DL</font> </span></td>
<th colspan="1" align="center" width="10%" title="{L_SIZE}"><span class="genmed"> <font color="#D50000">S</font> </span></td>
<th colspan="1" align="center" width="10%" title="{L_AUTHOR}"><span class="genmed"> <font color="#D50000">A</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_REPLIES}"><span class="genmed"> <font color="#D50000">R</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_VIEWS}"><span class="genmed"> <font color="#D50000">V</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_SEEDERS}"><span class="genmed"> <font color="#D50000">S</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_LEECHERS}"><span class="genmed"> <font color="#D50000">L</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_DL_SPEED}"><span class="genmed"> <font color="#D50000">S</font> </span></td>
<th colspan="1" align="center" width="5%" title="{L_COMPL}"><span class="genmed"> <font color="#D50000">C</font> </span></td>
<th colspan="1" align="center" width="30%" title="{L_LASTPOST}"><span class="genmed"> <font color="#D50000">P</font> </span></td>
</tr>
<!-- BEGIN toprow -->
<tr>
<td class="row1" align="LEFT"> <span class="forumlink"><i><a href="{toprow.FORUM_URL}" target="_top" class="forumlink">{toprow.FORUM_NAME}</a></i><li><span class="topictitle"><a href="{toprow.TOPIC_URL}" target="_top" class="topictitle"> {toprow.TOPIC} </a></span></td>
<td class="row1" align="center"> <a class="genmed" href="{toprow.DL_TOR_HREF}" border='0'><img src='images/icon_disk.gif' border='0' alt=''></span></a> </td>
<td class="row1" align="center"><span class="postdetails"> {toprow.TOR_SIZE} </span></td>
<td class="row1" align="center"><span class="name"> {toprow.POSTER_URL} </span></td>
<td class="row1" align="center"><span class="postdetails"> {toprow.TOPIC_REPLIES} </span></td>
<td class="row1" align="center"><span class="postdetails"> {toprow.TOPIC_VIEWS} </span></td>
<td class="row1" align="center"><span class="postdetails"><b> {toprow.SEEDS} </b></span></td>
<td class="row1" align="center"><span class="postdetails"><b> {toprow.LEECHS} </b></span></td>
<td class="row1" align="center"><span class="postdetails"> {toprow.DL_SPEED} </span></td>
<td class="row1" align="center" title="{toprow.COMPLETED} {L_COMPL} Torrents"><span class="postdetails"> {toprow.COMPLETED} </span></td>
<td class="row1" align="center" nowrap><span class="postdetails"> {toprow.POST_TIME} <br /> {toprow.REPLIER_URL} <a href="{toprow.LAST_POST_URL}" target="_top"><img src="{ICON_URL}" border="0" alt="{ICON_ALT}" /></a> </span></td>
</tr>
<!-- END toprow -->
</table>
<br />
<!--END BT post-->
|
|
|
|
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
  |
|
  |
 |
usagi
UL: 25 GB DL: 1 MB Ratio: 25600
Joined: 2006-04-22
Posts: 65
|
|
I found that I was coming up with zeros for the second grouping, listing by uploaded amount. I changed the code:
Find:
| Code:
|
$sql = "SELECT DISTINCT u.username, u.user_id, u.user_regdate, tr.user_id, tr.u_up_total, tr.u_down_total, ROUND(tr.u_up_total-tr.u_down_total) AS rat1
FROM ( " . USERS_TABLE . " u LEFT JOIN " . BT_USERS_TABLE . " tr ON u.user_id=tr.user_id) LEFT JOIN " . BANLIST_TABLE . " bl ON u.user_id=bl.ban_userid
WHERE bl.ban_userid Is Null
ORDER BY rat1 DESC
LIMIT $medal_num_recent";
|
Replace with:
| Code:
|
$sql = "SELECT DISTINCT u.username, u.user_id, u.user_regdate, tr.user_id, tr.u_up_total, tr.u_down_total, ROUND(tr.u_up_total-tr.u_down_total) AS rat1
FROM ( " . USERS_TABLE . " u LEFT JOIN " . BT_USERS_TABLE . " tr ON u.user_id=tr.user_id) LEFT JOIN " . BANLIST_TABLE . " bl ON u.user_id=bl.ban_userid
WHERE bl.ban_userid Is Null
ORDER BY tr.u_up_total DESC
LIMIT $medal_num_recent";
|
_________________ Usagi
|
|
|
|
|
|
|
 |
|