Esempio n. 1
0
     httpResponse();
     break;
 case validateRoute('GET', 'torrents/toplists'):
     $cacheId = 'toplists-' . $_GET["limit"];
     if ($memcache && ($cached = $memcache->get($cacheId))) {
         httpResponse($cached);
     } else {
         $torrent = new Torrent($db);
         $toplists = $torrent->getToplists($_GET["limit"] ?: 15);
         $memcache && $memcache->set($cacheId, $toplists, MEMCACHE_COMPRESSED, 60 * 60);
         httpResponse($toplists);
     }
     break;
 case validateRoute('GET', 'torrents/download/\\d+'):
     $torrent = new Torrent($db, $user);
     $torrent->download((int) $params[2]);
     break;
 case validateRoute('POST', 'torrents/upload'):
     $log = new Logs($db);
     $movieData = new MovieData($db);
     $sweTv = new SweTv($db);
     $mailbox = new Mailbox($db, $user);
     $requests = new Requests($db, $user);
     $adminlogs = new AdminLogs($db, $user);
     $torrent = new Torrent($db, $user, $log, $movieData, $sweTv, $requests, $mailbox, null, $adminlogs);
     $torrentId = $torrent->upload($_FILES["file"], $_POST);
     httpResponse($torrentId);
     break;
 case validateRoute('GET', 'requests'):
     $requests = new Requests($db, $user);
     list($requests, $total) = $requests->query((int) $_GET["index"], (int) $_GET["limit"], $_GET["sort"], $_GET["order"], $_GET["searchParams"]);