Esempio n. 1
0
 /**
  * Get releases for RSS.
  *
  * @param     $cat
  * @param int $offset
  * @param int $userID
  * @param int $videosId
  * @param int $aniDbID
  * @param int $airDate
  *
  * @return array
  */
 public function getRss($cat, $offset, $videosId, $aniDbID, $userID = 0, $airDate = -1)
 {
     $catSearch = $cartSearch = '';
     $catLimit = "AND r.categoryid BETWEEN 5000 AND 5999";
     if (count($cat)) {
         if ($cat[0] == -2) {
             $cartSearch = sprintf(' INNER JOIN users_releases ON users_releases.user_id = %d AND users_releases.releaseid = r.id ', $userID);
         } else {
             if ($cat[0] != -1) {
                 $catSearch = $this->releases->categorySQL($cat);
             }
         }
     }
     $sql = $this->pdo->query(sprintf("SELECT r.*, m.cover, m.imdbid, m.rating, m.plot,\n\t\t\t\t\tm.year, m.genre, m.director, m.actors, g.name AS group_name,\n\t\t\t\t\tCONCAT(cp.title, ' > ', c.title) AS category_name,\n\t\t\t\t\t%s AS category_ids,\n\t\t\t\t\tCOALESCE(cp.id,0) AS parentCategoryid,\n\t\t\t\t\tmu.title AS mu_title, mu.url AS mu_url, mu.artist AS mu_artist,\n\t\t\t\t\tmu.publisher AS mu_publisher, mu.releasedate AS mu_releasedate,\n\t\t\t\t\tmu.review AS mu_review, mu.tracks AS mu_tracks, mu.cover AS mu_cover,\n\t\t\t\t\tmug.title AS mu_genre, co.title AS co_title, co.url AS co_url,\n\t\t\t\t\tco.publisher AS co_publisher, co.releasedate AS co_releasedate,\n\t\t\t\t\tco.review AS co_review, co.cover AS co_cover, cog.title AS co_genre\n\t\t\t\tFROM releases r\n\t\t\t\tINNER JOIN category c ON c.id = r.categoryid\n\t\t\t\tINNER JOIN category cp ON cp.id = c.parentid\n\t\t\t\tINNER JOIN groups g ON g.id = r.group_id\n\t\t\t\tLEFT OUTER JOIN movieinfo m ON m.imdbid = r.imdbid AND m.title != ''\n\t\t\t\tLEFT OUTER JOIN musicinfo mu ON mu.id = r.musicinfoid\n\t\t\t\tLEFT OUTER JOIN genres mug ON mug.id = mu.genre_id\n\t\t\t\tLEFT OUTER JOIN consoleinfo co ON co.id = r.consoleinfoid\n\t\t\t\tLEFT OUTER JOIN genres cog ON cog.id = co.genre_id %s\n\t\t\t\tLEFT OUTER JOIN tv_episodes tve ON tve.id = r.tv_episodes_id\n\t\t\t\tWHERE r.passwordstatus %s\n\t\t\t\tAND r.nzbstatus = %d\n\t\t\t\t%s %s %s %s\n\t\t\t\tORDER BY postdate DESC %s", $this->releases->getConcatenatedCategoryIDs(), $cartSearch, $this->releases->showPasswords, NZB::NZB_ADDED, $catSearch, $videosId > 0 ? sprintf(' AND r.videos_id = %d %s ', $videosId, $catSearch == '' ? $catLimit : '') : '', $aniDbID > 0 ? sprintf(' AND r.anidbid = %d %s ', $aniDbID, $catSearch == '' ? $catLimit : '') : '', $airDate > -1 ? sprintf(' AND tve.firstaired >= DATE_SUB(CURDATE(), INTERVAL %d DAY) ', $airDate) : '', ' LIMIT 0,' . ($offset > 100 ? 100 : $offset)), true, nZEDb_CACHE_EXPIRY_MEDIUM);
     return $sql;
 }