09 catalogue

Started by ConYum, July 26, 2012, 07:59:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hyperion (noobKID)

damn small mod, i think its the smallest but biggest ive ever seemed :P..

thanks... will try in about 2 days when im back in the home sweet home :)...

ConYum

#1
credits to :
EnzoF1,putyn,Bigjoos

first create a new file; catalouge.php in root

Code (php) Select
<?php
/*
+------------------------------------------------
|   $Date$ 030810
|   $Revision$ 2.0
|   $Author$ EnzoF1,putyn,Bigjoos
|   $URL$
|   $catalogue
|   
+------------------------------------------------
*/
require_once "include/bittorrent.php";
require_once 
"include/html_functions.php";
require_once 
"include/user_functions.php";
require_once 
"include/pager_functions.php";
require_once 
"include/bbcode_functions.php";
dbconn(false);
loggedinorreturn();

$lang array_mergeload_language('global'));


$htmlout ='';

function 
readMore($text$char$link)
{
return (
strlen($text) > $char substr(htmlspecialchars($text), 0$char-1) . "...<br /><a href='$link'><b><font size=4><font color=red>Read more</font></font></b></a>"htmlspecialchars($text));
}

            function 
peer_list($array)
            {
            global 
$TBDEV$lang;
            
$htmlout '';
                        
$htmlout.="<table width='100%' border='1' cellpadding='5' style='border-collapse:collapse'>
                        <tr>
                  <td align='center' class='colhead'>User</td>
            <td align='center' class='colhead'>IP</td>
            <td align='center' class='colhead'>Ratio</td>
            <td align='center' class='colhead'>Downloaded</td>
            <td align='center' class='colhead'>Uploaded</td>
            <td align='center' class='colhead'>Started on</td>
            <td align='center' class='colhead'>completed on</td>
       </tr>"
;
       foreach (
$array as $p) {
       
$time max(1, (time() - $p["started"]) - (time() - $p["last_action"]));
                                                 


$htmlout.="<tr>";

if (
$p["p_anon"] == 'yes'$htmlout .= "<td align='center'><b><i>Anonymous</i></b></td>";

elseif (
$p["p_anon"] != 'yes'$htmlout .= "<td align='center'><a href='userdetails.php?id={$p["p_uid"]}'><b>{$p["p_user"]}</a></td>";
 

                
$htmlout .= "
            <td align='center'>"
.(get_user_class() >= UC_MODERATOR $p["ip"] . ":" $p["port"] : "Dolt!")."</td>
            <td align='center'>"
.($p["downloaded"] > number_format(($p["uploaded"] / $p["downloaded"]), 2) : ($p["uploaded"] > "&infin;" "---"))."</td>
            <td align='center'>"
.($p["downloaded"] > mksize($p["downloaded"]) . " @" . (mksize(($p["downloaded"] - $p["downloadoffset"]) / $time)) . "s""0kb")."</td>
            <td align='center'>"
.($p["uploaded"] > mksize($p["uploaded"]) . " @" . (mksize(($p["uploaded"] - $p["uploadoffset"]) / $time)) . "s""0kb")."</td>
            <td align='center'>"
.(get_date($p["started"], 'LONG',0,1))."</td>
            <td align='center'>"
.(get_date($p["finishedat"], 'LONG',0,1))."</td>
                        </tr>"
;
    }
    
$htmlout.="</table>";
    return 
$htmlout;
}

$vers = (isset($_GET["vers"]) ? $_GET["vers"] : "");
$search = (isset($_GET["search"]) ? htmlspecialchars($_GET["search"]) : "");

if (
strlen($search) > 4) {
    
$where "WHERE t.name LIKE" sqlesc("%" $search "%");
    
$p "search=" $search "&amp;";
} elseif (
strlen($vers) == && strpos("abcdefghijklmnopqrstuvwxyz0123456789"$vers) !== false) {
    
$where "WHERE t.name LIKE '" $vers "%'";
    
$p "vers=" $vers "&amp;";
} else {
    
$where "WHERE t.name LIKE 'a%'";
    
$p "vers=a&amp;";
    
$vers "a";
}

$count mysql_fetch_row(mysql_query("SELECT count(*) from torrents as t $where"));
$perpage 15;
//$perpage = $CURUSER['torrentsperpage'];

$pager pager($perpage$count[0], $_SERVER["PHP_SELF"] . "?" $p);

$top='';
$bottom='';
$rows = array();
$tids = array(); 

$t mysql_query("SELECT t.id,t.name,t.leechers,t.seeders,t.poster,t.times_completed as snatched,t.owner,t.size,t.added,t.descr,t.anonymous, u.username, u.anonymous as user FROM torrents as t LEFT JOIN users AS u on u.id=t.owner $where ORDER BY t.name ASC ".$pager['limit']."") or sqlerr(__FILE____LINE__);
while (
$ta mysql_fetch_assoc($t)) {
    
$rows[] = $ta;
    
$tid[] = $ta["id"];
$tids[] = $ta["seeders"];
}
if(isset(
$tids) && count($tids)) {

    
$p mysql_query("SELECT p.id,p.torrent as tid,p.seeder, p.finishedat, p.downloadoffset, p.uploadoffset, p.ip, p.port, p.uploaded, p.downloaded, p.started AS started, p.last_action AS last_action, u.id as p_uid , u.username as p_user, u.anonymous as p_anon FROM peers AS p LEFT JOIN users as u on u.id=p.userid WHERE p.torrent IN (" join(","$tid) . ") AND p.seeder = 'yes' AND to_go=0 LIMIT 5") or sqlerr(__FILE____LINE__);
    while (
$pa mysql_fetch_assoc($p))
    
$peers[$pa["tid"]][] = $pa;
}



               


     for (
$i 97$i 123; ++$i) {
    
$l chr($i);
    
$L chr($i 32);
    if (
$l == $vers)
    
    
$htmlout.="<font class=\"sublink-active\"><h2>$L</h2></font>\n";
    else
    
$htmlout.="<a class=\"sublink\" href=\"" $_SERVER["PHP_SELF"] . "?vers=" $l "\">" $L "</a>\n";
}

                        
$htmlout.="</fieldset></div><br />";

$htmlout .= begin_frame();


if (
count($rows) > 0) {
                
$htmlout.="<table width='95%' border='1' cellpadding='5' style='border-collapse:collapse'>
        <tr><td align='left' colspan='2' class='colhead'>Torrent catalouge</td></tr>

        <tr><td align='center' colspan='2' >
{$pager['pagertop']}</td></tr>";
    foreach(
$rows as $row) {
                
$htmlout.="<tr>
                 <td align='center' valign='top' nowrap='nowrap'>
                <table align='center' width='160' border='1' cellpadding='2'>
                <tr>"
;

if (
$row["anonymous"] == "yes") {
       
$htmlout .= "<td align='center' class='colhead'><i>Anonymous</i></td>\n";
       }
       else {
       
$htmlout .= "<td align='center' class='colhead'><a href='{$TBDEV['baseurl']}/userdetails.php?id=" $row["owner"] . "'><b>" htmlspecialchars($row["username"]) . "</b></a></td></tr>\n";
}                       

                
$htmlout .= "<tr><td align='center'>".($row["poster"] ? "<a href=\"" $row["poster"] . "\"><img src=\"" $row["poster"] . "\" border=\"0\" width=\"150\" height=\"195\" alt=\"No Poster\" title=\"No Poster\" /></a>" "<img src=\"pic/noposter.jpg\" border=\"0\" width=\"150\" alt=\"No Poster\" title=\"No Poster\" />")."</td></tr>
            </table>

        </td>

            <td align='center' width='100%' valign='top'>
<div class='shortdescription'>
                        <table width='100%' cellpadding='3' cellspacing='0' border='1' style='border-collapse:collapse;font-weight:bold;'>
                        <tr>
                                <td align='center' width='100%' rowspan='2' ><a href='details.php?id="
.$row["id"]."&amp;hit=1'><b>".substr($row["name"], 060)."</b></a><a href='download.php?torrent=".$row["id"]."'>  &nbsp;&nbsp;&nbsp; <img src='{$TBDEV['baseurl']}/pic/dl.png'  alt='Download' title='DOWNLOAD' /></td> 
                                <td align='center' class='colhead' width='80px'>Uploaded on</td>
                                <td align='center' class='colhead'>Size</td>
                                <td align='center' class='colhead'>Snatched</td>
                                <td align='center' class='colhead'><font color=green>SEED</font></td>
                                <td align='center' class='colhead'><font color=red>LEECH</font></td>
                        </tr>
                        <tr>
                                <td align='center'>"
.get_date($row["added"], 'LONG',0,1)."</td>
                                <td align='center' nowrap='nowrap'>"
.(mksize($row["size"]))."</td>
                                <td align='center' nowrap='nowrap'>"
.($row["snatched"] > ? ($row["snatched"] == $row["snatched"] . " Time" $row["snatched"] . " Times") : 0)."</td>
                                <td align='center'>"
.$row["seeders"]."</td>
                                <td align='center'>"
.$row["leechers"]."</td>
                        </tr>
                        <tr><td width='100%' colspan='6' class='colhead' >Info.</td></tr>
                        <tr><td width='100%' colspan='6' style='font-weight:normal;' >"
.readMore($row["descr"], 250"details.php?id=" $row["id"] . "&amp;hit=1")."</td></tr>
                        <tr><td width='100%' colspan='6' class='colhead'>Seeder Info</td></tr>
                        <tr><td width='100%' colspan='6' style='font-weight:normal;' >"
.(isset($peers[$row["id"]]) ? peer_list($peers[$row["id"]]) : "No Information....<br>Lack of seeders")."</td></tr>
                        </table></td></tr>"
;
                 }
  
                
$htmlout.="<tr><td align='center' colspan='2' >{$pager['pagerbottom']}</td></tr>
                
                </table>"
;
} else
    
$htmlout.="<h2>its very empty here.... aint it?</h2>";
$htmlout .="</div>";
$htmlout .= end_frame();

print 
stdhead('Torrent catalouge!') . $htmlout stdfoot();
?>


put attached pic in pic folder.


think thats all, else bark @ me :)

Ps you'll need Anonymous mod

[attachment deleted by admin]