09 Vip Torrents

Started by Mindless, July 24, 2012, 10:45:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

ALTER TABLE `torrents` ADD `vip` ENUM('1','0') NOT NULL default '0';

Upload.php :

if ($CURUSER['class'] >= UC_UPLOADER){
     $HTMLOUT .= tr("Vip Torrent", "<input type='checkbox' name='vip' value='1' />If this one is checked, only Vip's can download this torrent", 1);
     }


Takeupload.php find :

$torrent = str_replace("_", " ", $torrent);

Under it add :

$vip = (isset($_POST["vip"]) ? "1" : "0");

Next add vip and $vip into the insert query - can add it just after visible.

Edit.php add :

if ($CURUSER['class'] >= UC_UPLOADER){
$HTMLOUT  .= tr("VIP Torrent", "<input type='checkbox' name='vip'" . (($row["vip"] == "1") ? " checked='checked'" : "" ) . " value='1' /> If this one is checked, only VIPs can download this torrent", 1);
}


Takeedit.php add vip to the query.

Still on takeedit.php add :

//==09 vip tor
                if (($vip = (isset($_POST['vip']) != '' ? '1':'0')) != $row['vip']){
                $updateset[] = 'vip = ' . sqlesc($vip);
                }


Browse.php add to the query :

torrents.vip,

Details.php add to the query

torrents.vip,

Still in Details.php add :

if ($row["vip"] == "1" && $CURUSER["class"] < UC_VIP)
stderr("VIP Access Required", "You must be a VIP In order to view details or download this torrent! You may become a Vip By Donating to our site. Donating ensures we stay online to provide you more Vip-Only Torrents!");


Above :

if (!$row || ($row["banned"] == "yes" && !$moderator))
    stderr("{$lang['details_error']}", "{$lang['details_torrent_id']}");


Torrenttable_functions.php add :

$viponly = ($row["vip"]== "1" ? "<img src='pic/star.png' border='0' alt='Vip Torrent' title='Vip Torrent' />" : "");

Then add :

$viponly

To the dispname line beside say :

$sticky

Download.php add :

vip,

To the query then add :

if ($row["vip"] == "1" && $CURUSER["class"] < UC_VIP)
  stderr("VIP Access Required", "You must be a VIP In order to view details or download this torrent! You may become a Vip By Donating to our site. Donating ensures we stay online to provide you more Vip-Only Torrents!");


Below :

if (!($CURUSER["id"] == $row["owner"])) {
  if ($CURUSER["downloadpos"] == 0 || $CURUSER["downloadpos"] > 1 || $CURUSER['suspended'] == 'yes')
  stderr("Error","Your download rights have been disabled.");
  }


Announce.php :

$res = mysql_query("SELECT torrents.id, torrents.banned, torrents.free, torrents.seeders + torrents.leechers AS numpeers, torrents.added AS ts, freeslots.free AS freeslot, freeslots.double AS doubleslot FROM torrents LEFT JOIN freeslots ON (torrents.id=freeslots.tid AND freeslots.uid=".sqlesc($user['id']).") WHERE info_hash = ".sqlesc($info_hash));//" . hash_where("info_hash", $info_hash));

To :

$res = mysql_query("SELECT torrents.id, torrents.banned, torrents.free, torrents.vip, torrents.seeders + torrents.leechers AS numpeers, torrents.added AS ts, freeslots.free AS freeslot, freeslots.double AS doubleslot FROM torrents LEFT JOIN freeslots ON (torrents.id=freeslots.tid AND freeslots.uid=".sqlesc($user['id']).") WHERE info_hash = ".sqlesc($info_hash));//" . hash_where("info_hash", $info_hash));


Find :

//// Up/down stats ////////////////////////////////////////////////////////////

Under it add :

if ($torrent['vip'] == '1' && $user['class'] < UC_VIP)
err('VIP Access Required, You must be a VIP In order to view details or download this torrent! You may become a Vip By Donating to our site. Donating ensures we stay online to provide you more Vip-Only Torrents!');


Finally this :

if (!($crazyhour || $user['free_switch'] != 0 || $isfree || $torrent['free'] != 0 || ($torrent['freeslot'] != 0)))

To :

if (!($crazyhour || $user['free_switch'] != 0 || $isfree || $torrent['free'] != 0 || $torrent['vip'] != 0 || ($torrent['freeslot'] != 0)))