Example #1
0
 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"]);
     }
     httpResponse();
     break;
 case validateRoute('DELETE', 'start-torrents'):
     httpResponse($user->removeIndexList($_GET["id"]));
     break;
 case validateRoute('GET', 'users'):