Run this on your database against the gazelle database
ALTER TABLE `gazelle`.`torrents` ADD COLUMN `FreeLeechTime` DATETIME NULL DEFAULT '0000-00-00 00:00:00' AFTER `FreeLeechType` ;
Add to sections/schedule/index.php
Under the line
echo "Ran every-time functions\n";
ADD
$Time = sqltime();
$DB->query("SELECT DISTINCT ID FROM torrents WHERE FreeTorrent='1' AND FreeLeechType='2' AND FreeLeechTime>'$Time'");
while(list($ID) = $DB->next_record()) {
$Cache->delete_value('torrents_details_'.$ID);
$Cache->delete_value('torrent_group_'.$ID);
}
$DB->query("UPDATE torrents SET FreeTorrent='0',FreeLeechType='0',flags='2',FreeLeechTime='0000-00-00 00:00:00' WHERE FreeTorrent='1' AND FreeLeechType='2' AND FreeLeechTime>'$Time'");
The Query to set a torrent freeleech is
UPDATE torrents SET Freeleech = 1, FreeLeechType = 2, FreeLeechTime = '.time_plus(time in seconds).' WHERE ID = '.$TorrentID