Chez |
26th February 2013 18:40 |
1 Attachment(s)
Sticky Torrent Mod, credits to Alex2005
Add this to your database
PHP Code:
ALTER TABLE torrents ADD `sticky` enum('yes','no') NOT NULL default 'no';
open Browse.php and fine
PHP Code:
$orderby = "ORDER BY torrents.id DESC";
and change it to
PHP Code:
$orderby = "ORDER BY torrents.sticky ASC, torrents.id DESC";
still in browse look for the big query
PHP Code:
$query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.seeders...
and add this to it
now open Edit.php and fine this
and add this under it
PHP Code:
if(get_user_class() > UC_MODERATOR)
tr("sticky", "<input type='checkbox' name='sticky'" . (($row["sticky"] == "yes") ? " checked='checked'" : "" ) . " value='yes' />Set sticky this torrent!", 1);
open takeedit.php and fine
PHP Code:
$updateset[] = "category = " . (0 + $type);
and add this underneath
PHP Code:
if(get_user_class() > UC_MODERATOR){
if ($_POST["sticky"] == "yes")
$updateset[] = "sticky = 'yes'";
else
$updateset[] = "sticky = 'no'";
}
now open bittorrent.php and fine this
PHP Code:
$dispname = htmlspecialchars($row["name"]);
and add this underneath
PHP Code:
$sticky = ($row[sticky]=="yes" ? "<img src='pic/sticky.gif' bored='0' alt='sticky'>" : "");
this is only an example so don't copy this next part
and then add where you want it to be shown (the $sticky) in bittorrent.php (remember this is only an example)
PHP Code:
if (sql_timestamp_to_unix_timestamp($row['added']) >= $last_browse)
echo "\" title=\"" . $dispname . "\"><b>" . $dispname . "</b></a><img src='/pic/new.gif' border='0' alt=NEW>".$sticky."<b>" . $description . "</b>\n";
else
echo "\" title=\"" . $dispname ."\"><b>" . $dispname . "</b></a>".$sticky."<b>" . $description . "</b>\n";
then add sticky.gif to your pic folder, sticky.gif attached below
|