Example #1
0
             $movie["torrents"] = $torrent->getByMovieId($movie["id"]);
             $result[] = $movie;
         }
         $memcache && $memcache->set($cacheId, $result, MEMCACHE_COMPRESSED, 60 * 60 * 6);
         httpResponse($result);
     }
     break;
 case validateRoute('GET', 'start-torrents'):
     $torrent = new Torrent($db);
     $index = explode(',', $user->getIndexList());
     if (!$index[0]) {
         $index = array();
     }
     $result = [];
     foreach ($index as $i) {
         $customIndex = $user->getCustomIndex($i);
         list($headline, $torrents) = $torrent->getHighlightTorrents($customIndex["tid"], $customIndex["typ"], $customIndex["format"], $customIndex["sektion"], $customIndex["sort"], $customIndex["genre"]);
         $result[] = ["headline" => $headline, "id" => $i, "torrents" => $torrents];
     }
     httpResponse($result);
     break;
 case validateRoute('POST', 'start-torrents'):
     $arr = $user->addIndexList($postdata);
     httpResponse($arr);
     break;
 case validateRoute('PATCH', 'start-torrents'):
     if ($postdata["action"] == "move") {
         $user->moveIndexList($postdata["id"], $postdata["direction"]);
     }
     if ($postdata["action"] == "reset") {
         $user->resetIndexList($postdata["category"]);