Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
V2.08 Mods Completed [Pin a torrent]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2019-01-05 16:24:57
ALTER TABLE `torrents` ADD `sticky` enum('yes','no') NOT NULL default 'no';


In torrents. PHP, wherever you will find this line torrents-today etc...

$orderby = "ORDER BY torrents.id DESC";


Change to:

$orderby = "ORDER BY torrents.sticky ASC, torrents.id DESC";


The SQL call looks for the same here torrents. php, torrents-Search. PHP, torrents-Today. PHP:

torrents.category,


Add to the following:

torrents.sticky,


In index. PHP:

torrents.category,


Add to the following:

torrents.sticky,


Change this

ORDER BY id DESC LIMIT 25";


By this

ORDER BY sticky ASC, id DESC LIMIT 25";


In Torrent-edit. php adds after:

$updateset[] = "category = " . (int) $_POST["type"];


For this:

if(get_user_class() >= 5) {   // modo lowest class to make torrent sticky.
if ($_POST["sticky"] == "yes")
   $updateset[] = "sticky = 'yes'";
else
   $updateset[] = "sticky = 'no'";
}


After looking for this:

echo "<tr><td class='table_col1' align='right'><b>".T_("CATEGORIES").": </b></td><td class='table_col2'>".$catdropdown."</td></tr>";


Add:

if(get_user_class() >= 5)  // modo lowest class to make torrent sticky.
echo "<tr><td class='table_col1' align='right'><b>".T_("STICKY").": </b></td><td class='table_col2'><input type=\"checkbox\" name=\"sticky\"" . (($row["sticky"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" />Sticky this torrent!</td></tr>";


In search function. php:

if ($row["freeleech"] == 1)
   $dispname .= "<img src='images/free.gif' border='0' alt='' />";


Add after:

if ($row["sticky"] == "yes")
   $dispname .= "<img src='images/sticky.gif' bored='0' alt='sticky' title='sticky' />";
post-14-0-49884200-1494859761.rar
Download
2019-02-20 21:09:56
freeleech and/or sticky torrent during upload. In torrents-upload.php before
    //Uploaded ok message (update later)
   if ($external=='no')
       $message = sprintf( T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id );

add
        if ($CURUSER["edit_torrents"] == "yes")
           if(get_user_class($CURUSER) > 4){
               if ($_POST["sticky"] == "yes"){
               $updateset[] = "sticky = 'yes'";
                }else{
               $updateset[] = "sticky = 'no'";
       }
}
       $updateset[] = "freeleech = '".intval($_POST["freeleech"])."'";
       SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");


after
print ("<tr><td colspan='2' align='center'>".T_("MAX_FILE_SIZE").": ".mksize($site_config['image_max_filesize'])."<br />".T_("ACCEPTED_FORMATS").": ".implode(", ", array_unique($site_config["allowed_image_types"]))."<br /></td></tr><tr><td align='right'>".T_("IMAGE")." 1:&nbsp;&nbsp;</td><td><input type='file' name='image0' size='50' /></td></tr><tr><td align='right'>".T_("IMAGE")." 2:&nbsp;&nbsp;</td><td><input type='file' name='image1' size='50' /></td></tr>");

add
if ($row["external"] != "yes" && $CURUSER["edit_torrents"] == "yes"){
   echo "<tr><td align='right'><b>".T_("FREE_LEECH").": </b></td><td><input type=\"checkbox\" name=\"freeleech\"" . (($row["freeleech"] == "1") ? " checked=\"checked\"" : "" ) . " value=\"1\" />".T_("FREE_LEECH_MSG")."<br /></td></tr>";
   echo "<tr><td align=right><B>Sticky?</td><td><input type='checkbox' name='sticky'" .
(($row["sticky"] == "yes") ? " checked='checked'" : "" ) . " value='yes' />";
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2019-02-20 21:17:13
its not my work the above thread mate it was from the old DB way back so ill have to rewrite all the threads mate
2019-02-22 22:54:56
Thats fine. Do what you need to. I was asked to do that code a while back for tt 2.08. It works perfectly fine under php 7 unless you rewrote the language code, otherwise, there is really nothing to alter. I just wanted to post this for all to enjoy and edit as they see fit :)
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2019-02-22 23:20:48
nps at all
Unknown User
2019-11-19 18:51:55
how can i limit them to 10 Sticky
Unknown User
2019-11-19 20:31:56
Change

ORDER BY sticky ASC, id DESC LIMIT 25";


to

ORDER BY sticky ASC, id DESC LIMIT 10";
Unknown User
2019-11-20 17:27:14
[USER=1398]serph[/USER] not there bro .... theat was easy .... =))
"serph, post: 67523, member: 1398":

Change

ORDER BY sticky ASC, id DESC LIMIT 25";


to

ORDER BY sticky ASC, id DESC LIMIT 10";



in torrents.php

    if ($_GET["order"] == "asc" || ($_GET["sort"] != "id" && !$_GET["order"])) {
       $sort .= " ASC";
       $addparam .= "order=asc&";
   } else {
       $sort .= " DESC";
       $addparam .= "order=desc&";
   }

   $orderby = "ORDER BY $sort";

   }else{
       $orderby = "ORDER BY torrents.sticky ASC, torrents.id DESC ";
       $_GET["sort"] = "id";
       $_GET["order"] = "desc";
   }
//Get Total For Pager
$res = mysql_query("SELECT COUNT(*) FROM torrents LEFT JOIN categories ON category = categories.id $where") or die(mysql_error());
$row = mysql_fetch_array($res);
$count = $row[0];
//get sql info
if ($count) {
   list($pagertop, $pagerbottom, $limit) = pager(35, $count, "torrents.php?" . $addparam);
   $query = "SELECT torrents.id, torrents.anon, torrents.announce, torrents.category, torrents.sticky, torrents.viptorrents, torrents.description, torrents.imdb, torrents.leechers, torrents.nfo, torrents.views, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.torrentlang,  torrents.numfiles, torrents.filename, torrents.owner, torrents.external, torrents.freeleech, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat AS cat_parent, categories.image AS cat_pic, users.username, users.privacy,  IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit";
   $res = mysql_query($query) or die(mysql_error());
}else{
   unset($res);
Unknown User
2019-11-21 17:58:13
? glad you got it
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728