Subtitles::downloadByTorrentId PHP Method

downloadByTorrentId() public method

public downloadByTorrentId ( $id )
    public function downloadByTorrentId($id)
    {
        $sth = $this->db->prepare("SELECT * FROM subs WHERE torrentid = ? LIMIT 1");
        $sth->bindParam(1, $id, PDO::PARAM_INT);
        $sth->execute();
        $row = $sth->fetch(PDO::FETCH_ASSOC);
        $this->downloadRow($row);
    }

Usage Example

Esempio n. 1
0
     break;
 case validateRoute('DELETE', 'subtitles/\\d+'):
     $log = new Logs($db);
     $torrent = new Torrent($db, $user);
     $mailbox = new Mailbox($db, $user);
     $subtitles = new Subtitles($db, $user, $log, $torrent, $mailbox);
     httpResponse($subtitles->delete((int) $params[1], $_GET["reason"]));
     break;
 case validateRoute('GET', 'subtitles/\\d+/download'):
     $subtitles = new Subtitles($db, $user);
     $subtitles->download((int) $params[1]);
     die;
     break;
 case validateRoute('GET', 'torrents/\\d+/subtitle'):
     $subtitles = new Subtitles($db, $user);
     $subtitles->downloadByTorrentId((int) $params[1]);
     die;
     break;
 case validateRoute('GET', 'donations'):
     $donations = new Donations($db, $user);
     list($result, $totalCount) = $donations->query(array("limit" => $_GET["limit"], "index" => $_GET["index"]));
     httpResponse($result, $totalCount);
     break;
 case validateRoute('POST', 'donations'):
     $donate = new Donations($db, $user);
     httpResponse($donate->create($postdata));
     break;
 case validateRoute('PATCH', 'donations/\\d+'):
     $donate = new Donations($db, $user);
     httpResponse($donate->update((int) $params[1], $postdata));
     break;