Please help us to develop!
Reply to topic Reply to topic
Page 1 of 1 Tp MOD Forum Index / Hacks Submitted / [Addon] Top 10 (Uploaders-Ratio-Torrents)  

How do you rate this Hack
5
100%
 100%  [ 1 ]
4
0%
 0%  [ 0 ]
3
0%
 0%  [ 0 ]
2
0%
 0%  [ 0 ]
1
0%
 0%  [ 0 ]

Total Votes : 1

PostPost subject: [Addon] Top 10 (Uploaders-Ratio-Torrents) Posted: 05-16-2006 19:29
mozes



UL: 5 GB
DL: 1 B
Ratio: 5368709120
Joined: 2006-01-16
Posts: 195
  Top 10 Uploaders
Top 10 Users with highest Ratio
Top 10 Torrents (most full sources

its not my hack, find it on a rusian site (from meithar??
just changed some langue parts... (to dutch.
but its easy to change to for example English (self explaining)

copy
medal.php to forum root
medal_body.tpl to you forum template
link your browser to (example) www.yoursite.com/medal.php

no editing needed...

Edit:
Translation needed on Main TPL to your language
Example: http://tp-mod.sytes.net:6969/statistics.php



medal.rar
 Description:  Top 10 (Uploaders-Ratio-Torrents)
Download
 Filename:  medal.rar
 Filesize:  3.05 KB
 Downloaded:  342 Time(s)

  Reply with quote
View user's profile Send private message Visit poster's website
PostPost subject: Please Click to support this site Posted: 05-16-2006 19:29
Google

AdSense






 


 
PostPost subject: Posted: 05-16-2006 20:32
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&amp;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&amp;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">&nbsp;<font color="#D50000">Forums</font>&nbsp;</b></span></td>
          <th colspan="1" align="center" width="10%" title="{L_DL}"><span class="genmed">&nbsp;<font color="#D50000">DL</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="10%" title="{L_SIZE}"><span class="genmed">&nbsp;<font color="#D50000">S</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="10%" title="{L_AUTHOR}"><span class="genmed">&nbsp;<font color="#D50000">A</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_REPLIES}"><span class="genmed">&nbsp;<font color="#D50000">R</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_VIEWS}"><span class="genmed">&nbsp;<font color="#D50000">V</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_SEEDERS}"><span class="genmed">&nbsp;<font color="#D50000">S</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_LEECHERS}"><span class="genmed">&nbsp;<font color="#D50000">L</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_DL_SPEED}"><span class="genmed">&nbsp;<font color="#D50000">S</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="5%" title="{L_COMPL}"><span class="genmed">&nbsp;<font color="#D50000">C</font>&nbsp;</span></td>
          <th colspan="1" align="center" width="30%" title="{L_LASTPOST}"><span class="genmed">&nbsp;<font color="#D50000">P</font>&nbsp;</span></td>
        </tr>
        <!-- BEGIN toprow -->
        <tr>
        <td class="row1" align="LEFT">&nbsp;<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">&nbsp;{toprow.TOPIC}&nbsp;</a></span></td>
        <td class="row1" align="center">&nbsp;<a class="genmed" href="{toprow.DL_TOR_HREF}" border='0'><img src='images/icon_disk.gif' border='0' alt=''></span></a>&nbsp;</td>
        <td class="row1" align="center"><span class="postdetails">&nbsp;{toprow.TOR_SIZE}&nbsp;</span></td>
        <td class="row1" align="center"><span class="name">&nbsp;{toprow.POSTER_URL}&nbsp;</span></td>
        <td class="row1" align="center"><span class="postdetails">&nbsp;{toprow.TOPIC_REPLIES}&nbsp;</span></td>
        <td class="row1" align="center"><span class="postdetails">&nbsp;{toprow.TOPIC_VIEWS}&nbsp;</span></td>
        <td class="row1" align="center"><span class="postdetails"><b>&nbsp;{toprow.SEEDS}&nbsp;</b></span></td>
        <td class="row1" align="center"><span class="postdetails"><b>&nbsp;{toprow.LEECHS}&nbsp;</b></span></td>
        <td class="row1" align="center"><span class="postdetails">&nbsp;{toprow.DL_SPEED}&nbsp;</span></td>
        <td class="row1" align="center" title="{toprow.COMPLETED} {L_COMPL} Torrents"><span class="postdetails">&nbsp;{toprow.COMPLETED}&nbsp;</span></td>
        <td class="row1" align="center" nowrap><span class="postdetails">&nbsp;{toprow.POST_TIME}&nbsp;<br />&nbsp;{toprow.REPLIER_URL}&nbsp;<a href="{toprow.LAST_POST_URL}" target="_top"><img src="{ICON_URL}" border="0" alt="{ICON_ALT}" /></a>&nbsp;</span></td>
        </tr>
        <!-- END toprow -->
      </table>
      <br />

      <!--END BT post-->


  Reply with quote
View user's profile Send private message Visit poster's website
PostPost subject: Posted: 05-16-2006 23:20
Quake

Site Admin
Site Admin

UL: 4 MB
DL: 2 KB
Ratio: 2277.13
Joined: 2006-01-16
Posts: 486
  I have more then just last 5 and Also my name isn't quokes. Laughing

  Reply with quote
View user's profile Send private message
PostPost subject: Posted: 05-31-2006 01:47
usagi



UL: 25 GB
DL: 1 MB
Ratio: 25600
Joined: 2006-04-22
Posts: 65
  This will put the the add on the top menu as "Star Members"

Mozes - please feel free to add this to medal.rar


medal.txt
 Description:  To put Medal on the Menu
Download
 Filename:  medal.txt
 Filesize:  2.33 KB
 Downloaded:  214 Time(s)

  Reply with quote
View user's profile Send private message
PostPost subject: Posted: 05-31-2006 10:23
mozes



UL: 5 GB
DL: 1 B
Ratio: 5368709120
Joined: 2006-01-16
Posts: 195
  Lol i just have a direct link in my "overal_header.tpl" to the medal page..
The fast and durty way Wink

Place it wher you want, for example after FAQ
Find
Code:
<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a>&nbsp;

place after
Code:
&nbsp;<a href=http://www.your site.com/medal.php>Star members</a>


  Reply with quote
View user's profile Send private message Visit poster's website
PostPost subject: Posted: 10-02-2006 18:47
audioaddictz



UL: 0 B
DL: 0 B
Ratio: -
Joined: 2006-09-11
Posts: 32
  how easy would it be to convert this to show the worst 10 ??

would like to have both on my site

Smile

Thanks in advance for any help


_________________
Reality, It might look the same but it dont taste the same
______________________________
Like psy trance , listen online
http://radio.audioaddictz.co.uk
  Reply with quote
View user's profile Send private message Visit poster's website
PostPost subject: Posted: 10-19-2006 21:49
audioaddictz



UL: 0 B
DL: 0 B
Ratio: -
Joined: 2006-09-11
Posts: 32
  in not realy very good with all this php stuff so any help with my previouse request would be fantastic Smile


_________________
Reality, It might look the same but it dont taste the same
______________________________
Like psy trance , listen online
http://radio.audioaddictz.co.uk
  Reply with quote
View user's profile Send private message Visit poster's website
PostPost subject: Posted: 10-13-2007 03:56
swat5



UL: 0 B
DL: 0 B
Ratio: -
Joined: 2007-08-15
Posts: 11
  mmm..... thanks !!

How to add 5 last or 10 last torrents to index page ?

  Reply with quote
View user's profile Send private message
PostPost subject: Posted: 04-10-2009 08:27
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
  Reply with quote
View user's profile Send private message
Page 1 of 1
Reply to topic Reply to topic
 Tp MOD Forum Index / Hacks Submitted / [Addon] Top 10 (Uploaders-Ratio-Torrents)

Jump to: 



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB - 2001, 2002 phpBB Group
All times are GMT - 6 Hours ,
TorrentPier © Meithar - Support Tp MOD ©