09 Sticky Torrents

Started by Mindless, July 22, 2012, 07:27:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hyperion (noobKID)

Quote from: MelvinMeow on May 23, 2013, 12:46:03 AM
P.S. Your code for the page you posted is very very sloppy and should be cleaned up a little more.

could not agree more, and hey, sorry for late reply.

But as i see it, the code i posted earlier should work, not sure why id dosen't...

sorry, but the sticky you wish should be fine with the code i posted, and i got no clue how to fix this.

and again, sorry for late reply, i currently have exams in my schools, so i dont have so much time untill next month or so.
hope you will be able to fix this yourself x).

-NooBy x)

MelvinMeow

You pretty much have to set a sticky and non-sticky value as the other guy who posted code samples said.


Somewhere around this line in your code:
(I would say this exact line should be replaced with what I posted below but I didn't check your whole page of code you posted.)
if ($row["sticky"] == "no") // delete this line if you dont have sticky torrents or you   


You would make it like this:
if ($row["sticky"] == "yes"){
$htmlout .= "<tr bgcolor='#blahblahblah'>";
} else {
$htmlout .= "<tr>"; //use the default style colors...
}


P.S. Your code for the page you posted is very very sloppy and should be cleaned up a little more.


Hyperion (noobKID)

i will try and fix later then, but no promises, i do have school exams soon, so i need my head clear for a while, at least untill next month or so where i will be doing mostly book work instead of coding, but will try to see if i can get time to get it in my daily time-plan, so to speak x)...

BACDAFUCUP

you have understanding it right :) but i have tried to get it to work :( but with no luck.

Hyperion (noobKID)

hmm, ok, now im not sure if i understand you at all..

let me get this straight, you wish that if a row (full <tr> line) is sticky, you wish whole that line to be shown as a new color (overlayed in my own expression), so users can see the differences, am i right?...

if so, then the code i just gave you, would (basicly) be working fine, or, like i said, something close to that part at least, you basicly just need to figure out the rest :)...

BACDAFUCUP

hmm i did meen i did not get it to work at all.

i want if a torrent is sticky there is a image, but i need the row to be another color instead of a picture. :)

Hyperion (noobKID)

i see the function in the top if that is the one, but where should i look?, can you tell a little bit ect about what you did?, and please, give me the short version x)...

BACDAFUCUP

well thanks for the post.. ;) i did try it but it seems like i did get it to work.. :)

My torrenttable_functions.php is here:
Code (php) Select
<?php
/*
+------------------------------------------------
|   TBDev.net BitTorrent Tracker PHP
|   =============================================
|   by CoLdFuSiOn
|   (c) 2003 - 2009 TBDev.Net
|   http://www.tbdev.net
|   =============================================
|   svn: http://sourceforge.net/projects/tbdevnet/
|   Licence Info: GPL
+------------------------------------------------
|   $Date$
|   $Revision$
|   $Author$
|   $URL$
+------------------------------------------------
*/
function linkcolor($num) {
    if (!
$num)
        return 
"red";
//    if ($num == 1)
//        return "yellow";
    
return "green";
}

function 
torrenttable($res$variant "index") {
    global 
$TBDEV$CURUSER$lang;

    
$wait 0;
    
$htmlout '';
    
    
/*if ($CURUSER["class"] < UC_VIP)
    {
      $gigs = $CURUSER["uploaded"] / (1024*1024*1024);
      $ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0);
      if ($ratio < 0.5 || $gigs < 5) $wait = 48;
      elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
      elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
      elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
      else $wait = 0;
    }*/

        
$oldlink '';
        
$count_get 0;
        
$char '';
        
$description '';
        
$type '';
        
$sort '';
        
$row '';
        foreach (
$_GET as $get_name => $get_value) {
            
$get_name mysql_escape_string(strip_tags(str_replace(array("\"""'"), array(""""), $get_name)));
     
            
$get_value mysql_escape_string(strip_tags(str_replace(array("\"""'"), array(""""), $get_value)));
     
            if (
$get_name != "sort" && $get_name != "type") {
                if (
$count_get 0) {
                    
$oldlink $oldlink "&amp;" $get_name "=" $get_value;
                } else {
                    
$oldlink = ($oldlink) . $get_name "=" $get_value;
                }
                
$count_get++;
            }
        }
     
        if (
$count_get 0) {
            
$oldlink $oldlink "&amp;";
        }
     
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "1") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link1 "asc";
            } else {
                
$link1 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "2") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link2 "asc";
            } else {
                
$link2 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "3") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link3 "asc";
            } else {
                
$link3 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "4") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link4 "asc";
            } else {
                
$link4 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "5") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link5 "asc";
            } else {
                
$link5 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "6") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link6 "asc";
            } else {
                
$link6 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "7") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link7 "asc";
            } else {
                
$link7 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "8") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link8 "asc";
            } else {
                
$link8 "desc";
            }
        }
        if (isset(
$_GET["sort"]) && $_GET["sort"] == "9") {
            if (isset(
$_GET["type"]) && $_GET["type"] == "desc") {
                
$link9 "asc";
            } else {
                
$link9 "desc";
            }
        }
     
        if (empty(
$link1)) {
            
$link1 "asc";
        }
        if (empty(
$link2)) {
            
$link2 "desc";
        }
        if (empty(
$link3)) {
            
$link3 "desc";
        }
        if (empty(
$link4)) {
            
$link4 "desc";
        }
        if (empty(
$link5)) {
            
$link5 "desc";
        }
        if (empty(
$link6)) {
            
$link6 "desc";
        }
        if (empty(
$link7)) {
            
$link7 "desc";
        }
        if (empty(
$link8)) {
            
$link8 "desc";
        }
        if (empty(
$link9)) {
            
$link9 "desc";
        }
     
     
       
$htmlout .= "<table border='1' cellspacing='0' cellpadding='5'>
      <tr>
      <td class='colhead' align='center'>
{$lang["torrenttable_type"]}</td>
      <td class='colhead' align='left'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=1&amp;type={$link1}'>{$lang["torrenttable_name"]}</a></td>";
       
       if (
$wait)
       {
       
$htmlout .="<td class='colhead' align='center'>{$lang["torrenttable_wait"]}</td>\n";
       }    
     
       if (
$variant == "mytorrents")
       {
       
$htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
       
$htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
       }
     
       
$htmlout .= "<td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=2&amp;type={$link2}'>{$lang["torrenttable_files"]}</a></td>
      <td class='colhead' align='right'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=3&amp;type={$link3}'>{$lang["torrenttable_comments"]}</a></td>
      <td class='colhead' align='center'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=4&amp;type={$link4}'>{$lang["torrenttable_added"]}</a></td>
      
      <td class='colhead' align='center'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=5&amp;type={$link5}'>{$lang["torrenttable_size"]}</a></td>
      <td class='colhead' align='center'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=6&amp;type={$link6}'>{$lang["torrenttable_snatched"]}</a></td>
      <td class='colhead' align='right'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=7&amp;type={$link7}'>{$lang["torrenttable_seeders"]}</a></td>
      <td class='colhead' align='right'><a href='
{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=8&amp;type={$link8}'>{$lang["torrenttable_leechers"]}</a></td>";
     if (
$CURUSER['class'] >= UC_MODERATOR) {
       if (
$variant == 'index')
       
$htmlout .= "<td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=9&amp;type={$link9}'>{$lang["torrenttable_uppedby"]}</a></td>\n";
}
    
$htmlout .= "</tr>\n";

    while (
$row mysql_fetch_assoc($res)) 
    {
if (($CURUSER['split'] == "yes") && ($_SERVER["REQUEST_URI"] == "/browse.php") && !isset($_GET["page"])) { 
           
$day_added $row['added'];      
$day_show date($day_added);      
$thisdate date('M d Y'$day_show);    /** If date already exist, disable $cleandate varible **/   
if (isset($prevdate) && $thisdate == $prevdate) {      
$cleandate '';  /** If date does not exist, make some varibles **/ 
}else{  
$day_added "{$lang['torrenttable_upped']}.date('l d M Y',$row['added']); // You can change this to something else 
$cleandate "<tr><td colspan='15'><b><center><div class='cblock-lb2'>$day_added</div></center></b></td></tr>\n"// This also... 
/** Prevent that "torrents added..." wont appear again with the same date **/ 
$prevdate $thisdate;  $man = array('Jan' => 'January',
'Feb' => 'February',   
'Mar' => 'March',      
'Apr' => 'April',      
'May' => 'May',      
'Jun' => 'June',      
'Jul' => 'July',      
'Aug' => 'August',      
'Sep' => 'September',      
'Oct' => 'October',      
'Nov' => 'November',      
'Dec' => 'December');  
foreach(
$man as $eng => $ger){     
$cleandate str_replace($eng$ger,$cleandate); }  
$dag = array('Mon' => 'Monday',     
'Tues' => 'Tuesday',     
'Wednes' => 'Wednesday',     
'Thurs' => 'Thursday',     
'Fri' => 'Friday',     
'Satur' => 'Saturday',     
'Sun' => 'Sunday' );  
foreach(
$dag as $eng => $ger){     
$cleandate str_replace($eng.'day'$ger.'',$cleandate); }  
if (
$row["sticky"] == "no"// delete this line if you dont have sticky torrents or you   
$htmlout .= $cleandate."\n"; }
        
$id $row["id"];
        
$htmlout .= "<tr>\n";

        
$htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset(
$row["cat_name"])) 
        {
            
$htmlout .= "<a href='browse.php?cat={$row['category']}'>";
            if (isset(
$row["cat_pic"]) && $row["cat_pic"] != "")
                
$htmlout .= "<img border='0' src='{$TBDEV['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            else
            {
                
$htmlout .= $row["cat_name"];
            }
            
$htmlout .= "</a>";
        }
        else
        {
            
$htmlout .= "-";
        }
        
$htmlout .= "</td>\n";

        
$dispname htmlspecialchars($row["name"]);
        
        
$htmlout .= "<td align='left'><a href='details.php?";
        if (
$variant == "mytorrents")
            
$htmlout .= "returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        
$htmlout .= "id=$id";
        if (
$variant == "index")
            
$htmlout .= "&amp;hit=1";
    $sticky = ($row['sticky']=="yes" "<img src='{$TBDEV['pic_base_url']}sticky.gif' border='0' alt='Sticky' title='sticky' />" "");
            
$htmlout .= "'><b>$dispname</b></a>&nbsp;&nbsp;$sticky&nbsp;".($row['added'] >= $CURUSER['last_browse'] ? " <b><font color='red'>NEW!</font></b>" "")."\n";

if ($wait)
{
  $elapsed floor((time() - $row["added"]) / 3600);
        if ($elapsed $wait)
        {
          $color dechex(floor(127*($wait $elapsed)/48 128)*65536);
          $htmlout .= "<td align='center'><span style='white-space: nowrap;'><a href='faq.php#dl8'><font color='$color'>" number_format($wait $elapsed) . " ".$lang["torrenttable_wait_h"]."</font></a></span></td>\n";
        }
        else
          $htmlout .= "<td align='center'><span style='white-space: nowrap;'>{$lang["torrenttable_wait_none"]}</span></td>\n";
        }

/*
        if ($row["nfoav"] && get_user_class() >= UC_POWER_USER)
          print("<a href='viewnfo.php?id=$row[id]''><img src='{$TBDEV['pic_base_url']}viewnfo.gif" border='0' alt='".$lang["torrenttable_view_nfo_alt"]."' /></a>\n");
        if ($variant == "index")
            print("<a href='download.php/$id/" . rawurlencode($row["filename"]) . "'><img src='{$TBDEV['pic_base_url']}download.gif' border='0' alt='".$lang["torrenttable_download_alt"]."' /></a>\n");

        else */ 
        
if ($variant == "mytorrents")
            
$htmlout .= "</td><td align='center'><a href='edit.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;id={$row['id']}'>".$lang["torrenttable_edit"]."</a>\n";
        
$htmlout .= "</td>\n";
        
        if (
$variant == "mytorrents"
        {
            
$htmlout .= "<td align='right'>";
            if (
$row["visible"] == "no")
                
$htmlout .= "<b>".$lang["torrenttable_not_visible"]."</b>";
            else
                
$htmlout .= "".$lang["torrenttable_visible"]."";
            
$htmlout .= "</td>\n";
        }

        if (
$row["type"] == "single")
        {
            
$htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n";
        }
        else 
        {
            if (
$variant == "index")
            {
                
$htmlout .= "<td align='right'><b><a href='filelist.php?id=$id'>" $row["numfiles"] . "</a></b></td>\n";
            }
            else
            {
                
$htmlout .= "<td align='right'><b><a href='filelist.php?id=$id'>" $row["numfiles"] . "</a></b></td>\n";
            }
        }

        if (!
$row["comments"])
        {
            
$htmlout .= "<td align='right'>{$row["comments"]}</td>\n";
        }
        else 
        {
            if (
$variant == "index")
            {
                
$htmlout .= "<td align='right'><b><a href='details.php?id=$id&amp;hit=1&amp;tocomm=1'>" $row["comments"] . "</a></b></td>\n";
            }
            else
            {
                
$htmlout .= "<td align='right'><b><a href='details.php?id=$id&amp;page=0#startcomments'>" $row["comments"] . "</a></b></td>\n";
            }
        }

/*
        print("<td align='center'>");
        if (!isset($row["rating"]))
            print("---");
        else {
            $rating = round($row["rating"] * 2) / 2;
            $rating = ratingpic($row["rating"]);
            if (!isset($rating))
                print("---");
            else
                print($rating);
        }
        print("</td>\n");
*/
        
$htmlout .= "<td align='center'><span style='white-space: nowrap;'>" str_replace(",""<br />"get_date$row['added'],'')) . "</span></td>\n";
        

    
    
$htmlout .= "
    <td align='center'>" 
str_replace(" ""<br />"mksize($row["size"])) . "</td>\n";
//        print("<td align='right'>" . $row["views"] . "</td>\n");
//        print("<td align='right'>" . $row["hits"] . "</td>\n");

        
if ($row["times_completed"] != 1)
          
$_s "".$lang["torrenttable_time_plural"]."";
        else
          
$_s "".$lang["torrenttable_time_singular"]."";
         if( 
$CURUSER['class'] >= UC_MODERATOR )
      {
            
$htmlout .= "<td align='center'><a href=snatches.php?id=$id>" number_format($row["times_completed"]) . "<br />$_s</td>\n";
}
else
 
$htmlout .= "<td align='center'>" number_format($row["times_completed"]) . "<br />$_s</td>\n";
        if (
$row["seeders"]) 
        {
            if (
$variant == "index")
            {
               if (
$row["leechers"]) $ratio $row["seeders"] / $row["leechers"]; else $ratio 1;
  
   if( $CURUSER['class'] >= UC_MODERATOR )
      {
                
$htmlout .= "<td align='right'><b><a href='peerlist.php?id=$id#seeders'><font color='" .get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n";
}
else
 $htmlout .= "<td align=\"right\"><b><font color=\"" .get_slr_color($ratio) . "\">" $row["seeders"] . "</font></b></td>\n";
            }
            else
            {

                
$htmlout .= "<td align='right'><b><a class='" linkcolor($row["seeders"]) . "' href='peerlist.php?id=$id#seeders'>{$row["seeders"]}</a></b></td>\n";
            }
        }
        else
        {
            
$htmlout .= "<td align='right'><span class='" linkcolor($row["seeders"]) . "'>" $row["seeders"] . "</span></td>\n";
        }

        if (
$row["leechers"]) 
        {
            if (
$variant == "index")
                  if( 
$CURUSER['class'] >= UC_MODERATOR )
      {
                
$htmlout .= "<td align='right'><b><a href='peerlist.php?id=$id#leechers'>" .number_format($row["leechers"]) . "</a></b></td>\n";
}
            else
$htmlout .= "<td align=\"right\"><b>" .number_format($row["leechers"]) . ($peerlink "</a>" "") ."</b></td>\n";
   else
                
$htmlout .= "<td align='right'><b><a class='" linkcolor($row["leechers"]) . "' href='peerlist.php?id=$id#leechers'>{$row["leechers"]}</a></b></td>\n";
        }
        else
            
$htmlout .= "<td align='right'>0</td>\n";
if (
$CURUSER['class'] >= UC_MODERATOR) {
    if (
$variant == "index") {
           if (
$row["anonymous"] == "yes") {
   
           
$htmlout .= "<td align='center'><i>Anonymous</i> " . (isset($row["username"]) ? ("<a href='{$INSTALLER09['baseurl']}/userdetails.php?id=" $row["owner"] . "'><b>" htmlspecialchars($row["username"]) . "</b></a>") : "<i>(".$lang["torrenttable_unknown_uploader"].")</i>") . " </td>\n";
           }
           else {
           
$htmlout .= "<td align='center'>" . (isset($row["username"]) ? ("<a href='{$INSTALLER09['baseurl']}/userdetails.php?id=" $row["owner"] . "'><b>" htmlspecialchars($row["username"]) . "</b></a>") : "<i>(".$lang["torrenttable_unknown_uploader"].")</i>") . "</td>\n";
           }
           }
   }
           
$htmlout .= "</tr>\n";
           }
           
$htmlout .= "</table>\n";
           return 
$htmlout;
           }

    $uprow "<i>Anonymous</i>";
        
   
    function 
commenttable($rows$variant 'torrent') {
            global 
$CURUSER$TBDEV;
           
            
$lang load_language'torrenttable_functions' );
           
            
$htmlout '';
            
$count 0;
            
$variant_options = array('torrent' => 'details',
                                 
'request' => 'viewrequests',
                                 
//'user'    => 'userdetails'
                                 
);
                           
        if (isset(
$variant_options[$variant]))
            
$locale_link $variant_options[$variant];
        else
           return;
     
         
$extra_link = ($variant == 'request' '&type=request' '');
     
            
$htmlout .= begin_main_frame();
            
$htmlout .= begin_frame();
           
            foreach (
$rows as $row) {
               
//print_r($rows);
                    
$htmlout .= "<p class='sub'>#{$row["id"]} {$lang["commenttable_by"]} ";
        if (isset(
$row["username"])) {
            if (
$row['anonymous'] == 'yes') {
                
$htmlout .= ($CURUSER['class'] >= UC_MODERATOR 'Anonymous -
                   Posted by: <b>'
.htmlspecialchars($row['username']).'</b>
                   ID: '
.$row['user'].'' 'Anonymous').' ';
                } else {
                            
$title $row["title"];
                            if (
$title == "")
                                    
$title get_user_class_name($row["class"]);
                            else
                                    
$title htmlspecialchars($title);
                    
$htmlout .= "<a name='comm{$row["id"]}' href='userdetails.php?id={$row["user"]}'><b>" .
                    
htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" "<img src='{$TBDEV['pic_base_url']}star.gif' alt='".$lang["commenttable_donor_alt"]."' />" "") . ($row["warned"] == "yes" "<img src=".
                                    
"'{$TBDEV['pic_base_url']}warned.gif' alt='".$lang["commenttable_warned_alt"]."' />" "") . " ($title)\n";
                    }
            }
                    else
                    
$htmlout .= "<a name='comm{$row["id"]}'><i>(".$lang["commenttable_orphaned"].")</i></a>\n";
       
                    
$htmlout .= get_date$row['added'],'');
                    
$htmlout .= ($row["user"] == $CURUSER["id"] || $CURUSER["class"] >= UC_STAFF "- [<a href='comment.php?action=edit&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_edit"]."</a>]" "") .
                            (
$CURUSER["class"] >= UC_VIP " - [<a href='report.php?type=Comment&amp;id=".$row['id']."'>Report this Comment</a>]" "") .
                            (
$CURUSER["class"] >= UC_STAFF " - [<a href='comment.php?action=delete&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_delete"]."</a>]" "") .
                            (
$row["editedby"] && $CURUSER["class"] >= UC_STAFF "- [<a href='comment.php?action=vieworiginal&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_view_original"]."</a>]" "") . "</p>\n";
                    
$avatar = ($CURUSER["avatars"] == "yes" htmlspecialchars($row["avatar"]) : "");
                   
                    if (!
$avatar)
                            
$avatar "{$TBDEV['pic_base_url']}forumicons/default_avatar.gif";
                    
$text format_comment($row["text"]);
        if (
$row["editedby"])
            
$text .= "<p><font size='1' class='small'>".$lang["commenttable_last_edited_by"]." <a href='userdetails.php?id={$row['editedby']}'><b>{$row['username']}</b></a> ".$lang["commenttable_last_edited_at"]." ".get_date($row['editedat'],'DATE')."</font></p>\n";
                    
$htmlout .= begin_table(true);
                    
$htmlout .= "<tr valign='top'>\n";
                    
$htmlout .= "<td align='center' width='150' style='padding: 0px'><img width='{$row['av_w']}' height='{$row['av_h']}' src='{$avatar}' alt='' /><br />".get_reputation($row'comments')."</td>\n";
                    
$htmlout .= "<td class='text'>$text</td>\n";
                    
$htmlout .= "</tr>\n";
         
$htmlout .= end_table();
      }
     
            
$htmlout .= end_frame();
            
$htmlout .= end_main_frame();
           
            return 
$htmlout;
    }


?>


Thanks for the help mate.

Hyperion (noobKID)

depends if your using if/else statements...

but here is an example i would be using, not sure if it's correct, it was a quick writing:

on torrenttable_functions.php file:

make sure in the Select SQL-Query to add in the sticky part, if already added, look away from this part.

now find a place to add this line of text, right after the SQL-Select Query:

Code (php) Select

#Basicly we are saying, if the <tr> line are set to be sticky, then change color, else piss off ;)...
$table_sticky_color = ($row['sticky']=="yes" ? "#333" : '');


now go down to where the torrent-table part starts off the ground, and find the first (<tr>) part, where it starts...

and simply add like this:

Code (php) Select

<tr bgcolor='$table_sticky_color'>


and that should be it, i have not taken a look at the tbdev09 final code for a while, since im working on the V3 now with new templates and ideas to it, and also trying to learn it since i can see i am totally outdated with that version myself hehe :P...

anyhow, hoping i helped a little, else ask away, and ill take a look at the code for ya if so, and try my best x)...

-nooby x)

BACDAFUCUP

Thanks alot.. ;)
Great mod btw
is there someone out there know how get the torrent table to look like this when a torrent i sticky?

so the table change color ? i have searched and searched but did not find anything.

Hyperion (noobKID)


Mindless

Credits to tony.

Code (sql) Select
ALTER TABLE torrents ADD `sticky` enum('yes','no') NOT NULL default 'no';

in browse.php find

Code (php) Select
$orderby = "ORDER BY torrents.id DESC";

and change to

Code (php) Select
$orderby = "ORDER BY torrents.sticky ASC, torrents.id DESC";


find the big query(browse.php)

Code (php) Select
$query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.seeders...

and add

Code (php) Select
torrents.sticky


edit.php add :

Code (php) Select
if($CURUSER['class'] > UC_MODERATOR)
$HTMLOUT .= tr("Sticky", "<input type='checkbox' name='sticky'" . (($row["sticky"] == "yes") ? " checked='checked'" : "" ) . " value='yes' />Sticky this torrent !", 1);



takeedit.php add :

Code (php) Select
if($CURUSER['class'] > UC_MODERATOR){
if ($_POST["sticky"] == "yes")
  $updateset[] = "sticky = 'yes'";
   else
  $updateset[] = "sticky = 'no'";
}



in include/torrenttable_functions.php after :

Code (php) Select
if ($variant == "index")
   $htmlout .= "&amp;hit=1";


add :

Code (php) Select
$sticky = ($row['sticky']=="yes" ? "<img src='{$TBDEV['pic_base_url']}sticky.gif' border='0' alt='Sticky' title='sticky' />" : "");

find the dispname line :

Code (php) Select
$htmlout .= "'><b>$dispname</b></a>&nbsp;&nbsp;

and then add where you want it to be shown($sticky) :

Code (php) Select
$htmlout .= "'><b>$dispname</b></a>&nbsp;&nbsp;$sticky