/** * Make the index view */ public function get_index() { $fname = ""; if (Auth::check()) { $fname = User::getFirstName(Auth::user()->get()->cid); } //Pull category data $publicCategories = Category::where('hidden', '!=', 1)->get(); $categories = Category::all(); //Figure out which categories have children $categoryChildren = array(); foreach ($categories as $categoryParent) { if (Category::isParent($categoryParent->id)) { $categoryChildren[$categoryParent->id] = Category::getChildren($categoryParent->id); } } //Get our news $news = News::where("visible", "=", 1)->orderBy("updated_at", "DESC")->get(); return View::make('index')->with(array('fname' => $fname, 'categories' => $categories, 'categoryChildren' => $categoryChildren, 'publicCategories' => $publicCategories, 'news' => $news)); }
/** * Get musicinfo rows for browse list by filters and limit. */ public function getMusicRange($cat, $start, $num, $orderby, $maxage = -1, $excludedcats = array()) { $db = new DB(); $browseby = $this->getBrowseBy(); if ($start === false) { $limit = ""; } else { $limit = " LIMIT " . $start . "," . $num; } $catsrch = ""; if (count($cat) > 0 && $cat[0] != -1) { $catsrch = " ("; foreach ($cat as $category) { if ($category != -1) { $categ = new Category(); if ($categ->isParent($category)) { $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) { $chlist .= ", " . $child["ID"]; } if ($chlist != "-99") { $catsrch .= " r.categoryID in (" . $chlist . ") or "; } } else { $catsrch .= sprintf(" r.categoryID = %d or ", $category); } } } $catsrch .= "1=2 )"; } $maxagesql = ""; if ($maxage > 0) { $maxagesql = sprintf(" and r.postdate > now() - interval %d day ", $maxage); } $exccatlist = ""; if (count($excludedcats) > 0) { $exccatlist = " and r.categoryID not in (" . implode(",", $excludedcats) . ")"; } $order = $this->getMusicOrder($orderby); // query modified to join to musicinfo after limiting releases as performance issue prevented sane sql. $sql = sprintf(" SELECT r.*, r.ID as releaseID, m.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.ID, ',', c.ID) as category_ids, rn.ID as nfoID from releases r left outer join groups on groups.ID = r.groupID inner join musicinfo m on m.ID = r.musicinfoID and m.title != '' left outer join releasenfo rn on rn.releaseID = r.ID and rn.nfo is not null left outer join category c on c.ID = r.categoryID left outer join category cp on cp.ID = c.parentID left outer join genres g on g.ID = m.genreID inner join (select r.ID from releases r inner join musicinfo m ON m.ID = r.musicinfoID and m.title != '' where r.musicinfoID > 0 and r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s order by %s %s %s) x on x.ID = r.ID order by %s %s", $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1], $limit, $order[0], $order[1]); return $db->query($sql, true); }
/** * Creates part of a query for searches requiring the categoryid's. * * @param array $categories * * @return string */ public function categorySQL($categories) { $sql = ''; if (count($categories) > 0 && $categories[0] != -1) { $Category = new \Category(['Settings' => $this->pdo]); $sql = ' AND ('; foreach ($categories as $category) { if ($category != -1) { if ($Category->isParent($category)) { $children = $Category->getChildren($category); $childList = '-99'; foreach ($children as $child) { $childList .= ', ' . $child['id']; } if ($childList != '-99') { $sql .= ' r.categoryid IN (' . $childList . ') OR '; } } else { $sql .= sprintf(' r.categoryid = %d OR ', $category); } } } $sql .= '1=2 )'; } return $sql; }
/** * Constructs a SphinxQL query. * * @param array $search * @param array $cat * @param int $offset * @param int $limit * @param array $order * @param int $maxage * @param array $excludedcats * @param array $grp * @param array $indexes * @param boolean $lookup * @param array $where * @param string $lookupQuery * */ public function buildQuery($search, $cat = array(), $offset = 0, $limit = 100, $order = array("postdate", "desc"), $maxage = -1, $excludedcats = array(), $grp = array(), $indexes = array(), $lookup = true, $where = array(), &$lookupQuery = "") { $ndb = new DB(); $offset = intval($offset); $limit = intval($limit); if ($lookup) { // Since we're going to look up the data from MySQL, we don't need // to get all the fields from Sphinx. $select = "ID, name "; } else { $select = "* "; } // Create a comma separated string of indexes, but only of enabled // indexes $searchIndexes = array(); foreach ($indexes as $index) { if ($this->isIndexEnabled($index)) { $searchIndexes[] = $index; } } if (count($searchIndexes) == 0) { $searchIndexes = array_reverse($this->getAllEnabledIndexes(true)); } $from = implode(", ", $searchIndexes); // Check to see if this is an extended query. If it is, remove the // leading "!" and don't touch the rest of the query. if (count($search) > 0) { if (substr($search[0], 0, 2) == "! ") { /* Extended Query */ $search[0] = substr($search[0], 2, strlen($search[0]) - 2); } else { /* Basic Query */ // Check to see if the the query contains any field specifiers like: // "@(field1,field2)"--if not, add in the default search fields. foreach ($search as $i => $q) { if ($q && !preg_match('/@\\(?\\w+/i', $q)) { // No field specifiers were found, so use the site-defaults. This // turns the query for "ubuntu" into something like: // "@(name,searchname) ubuntu" $fields = str_replace(" ", "", $this->site->sphinxsearchfields); // Remove single "-" so that Sphinx doesn't use it as an // exclusion modifier $q = preg_replace('/([^\\-])\\-/', '\\1 ', $q); // "basic" search syntax allows a "--" exclusion modifier, // but Sphinx uses "-" as a the exclusion modifier $q = str_replace("--", "-", $q); // always add on * to Season based searches $q = preg_replace('/([\\. ]S\\d{2})( |$)/i', '\\1*\\2', $q); // Construct the basic query $search[$i] = sprintf("@(%s) ", $fields) . $q; } } } } // Create the actual MATCH() query. Per the Sphinx docs, each query // can only have one MATCH() statement. if (count($search) > 0) { if (!(count($search) == 1 && $search[0] == "")) { // If we are searching across multiple indexes, it is safer to prepend // "@@relaxed" to the query to ensure that Sphinx doesn't choke on // differences in schemas. See: // http://sphinxsearch.com/docs/2.0.2/extended-syntax.html if (count($searchIndexes) > 1 && strpos($search[0], "@@relaxed") !== 0) { // We are searching across multiple indexes and the term // "@@relaxed" wasn't found at the beginning, $search[0] = "@@relaxed " . $search[0]; } $where[] = sprintf("MATCH(%s)", $ndb->escapeString(implode(' ', $search))); } } // Build the category query. If any of the categories are a "parent" // then we need to explicitly include their children as well. $categoryIDs = array(); if (count($cat) > 0 && $cat[0] != -1) { foreach ($cat as $category) { if ($category != -1) { if (!in_array($category, $categoryIDs)) { $categoryIDs[] = $category; } $categ = new Category(); if ($categ->isParent($category)) { // Inlcude all children $children = $categ->getChildren($category); foreach ($children as $child) { if (!in_array($child["ID"], $categoryIDs)) { $categoryIDs[] = $child["ID"]; } } } } } } // Only include the category filter if we created one. if ($categoryIDs) { $where[] = sprintf("categoryID IN (%s)", implode(",", $categoryIDs)); } // Filter on postdate. if ($maxage > 0) { // TODO: This probably isn't the best way to do this... $where[] = sprintf("postdate >= %d", time() - $maxage * 86400); } // Categories to exclude. if (count($excludedcats) > 0) { $where[] = sprintf("categoryID NOT IN (%s)", implode(",", $excludedcats)); } // Usenet groups to include. if ($grp) { foreach ($grp as $i => $g) { if (strpos($g, "a.b.") !== false) { $sql = sprintf("SELECT ID FROM groups " . "WHERE name = %s", $ndb->escapeString(str_replace("a.b.", "alt.binaries.", $g))); $row = $ndb->queryOneRow($sql); $grp[$i] = $row["ID"]; } } $where[] = sprintf("groupID IN (%s)", implode(",", $grp)); } // Order the results. // TODO: implement better default ordering behavior. $orderby = ""; if (count($order) == 2) { $orderby = sprintf("ORDER BY %s %s", $order[0], $order[1]); // Add in the ORDER BY parameters if there is a $lookupQuery if ($lookupQuery) { $lookupQuery = $lookupQuery . " " . $orderby; } } // Build the full query. $q = sprintf("SELECT %s FROM %s " . (!empty($where) ? "WHERE " : "") . " %s %s LIMIT %d,%d", $select, $from, implode(" AND ", $where), $orderby, $offset, $limit); // Sphinx imposes a 1000 result limit (max_matches) by default, so in // order to access results beyond this, we need to tell it to do so if ($offset >= 1000) { $q .= sprintf(" OPTION max_matches=%d", $offset + $limit); } return $q; }
public function getMovieRange($cat, $start, $num, $orderby, $maxage = -1, $excludedcats = array()) { $db = new DB(); $browseby = $this->getBrowseBy(); if ($start === false) { $limit = ""; } else { $limit = " LIMIT " . $start . "," . $num; } $catsrch = ""; if (count($cat) > 0 && $cat[0] != -1) { $catsrch = " ("; foreach ($cat as $category) { if ($category != -1) { $categ = new Category(); if ($categ->isParent($category)) { $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) { $chlist .= ", " . $child["ID"]; } if ($chlist != "-99") { $catsrch .= " r.categoryID in (" . $chlist . ") or "; } } else { $catsrch .= sprintf(" r.categoryID = %d or ", $category); } } } $catsrch .= "1=2 )"; } $maxage = ""; if ($maxage > 0) { $maxage = sprintf(" and r.postdate > now() - interval %d day ", $maxage); } $exccatlist = ""; if (count($excludedcats) > 0) { $exccatlist = " and r.categoryID not in (" . implode(",", $excludedcats) . ")"; } $order = $this->getMovieOrder($orderby); $sql = sprintf(" SELECT GROUP_CONCAT(r.ID ORDER BY r.postdate desc SEPARATOR ',') as grp_release_id, GROUP_CONCAT(r.guid ORDER BY r.postdate desc SEPARATOR ',') as grp_release_guid, GROUP_CONCAT(rn.ID ORDER BY r.postdate desc SEPARATOR ',') as grp_release_nfoID, GROUP_CONCAT(groups.name ORDER BY r.postdate desc SEPARATOR ',') as grp_release_grpname, GROUP_CONCAT(r.searchname ORDER BY r.postdate desc SEPARATOR '#') as grp_release_name, GROUP_CONCAT(r.postdate ORDER BY r.postdate desc SEPARATOR ',') as grp_release_postdate, GROUP_CONCAT(r.size ORDER BY r.postdate desc SEPARATOR ',') as grp_release_size, GROUP_CONCAT(r.totalpart ORDER BY r.postdate desc SEPARATOR ',') as grp_release_totalparts, GROUP_CONCAT(r.comments ORDER BY r.postdate desc SEPARATOR ',') as grp_release_comments, GROUP_CONCAT(r.grabs ORDER BY r.postdate desc SEPARATOR ',') as grp_release_grabs, m.*, groups.name as group_name, rn.ID as nfoID from releases r left outer join groups on groups.ID = r.groupID inner join movieinfo m on m.imdbID = r.imdbID and m.title != '' left outer join releasenfo rn on rn.releaseID = r.ID and rn.nfo is not null where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s group by m.imdbID order by %s %s" . $limit, $browseby, $catsrch, $maxage, $exccatlist, $order[0], $order[1]); return $db->query($sql); }
/** * Get range of consoleinfo rows for browse list. */ public function getConsoleRange($cat, $start, $num, $orderby, $maxage = -1, $excludedcats = []) { $browseby = $this->getBrowseBy(); if ($start === false) { $limit = ""; } else { $limit = " LIMIT " . $start . "," . $num; } $catsrch = ""; if (count($cat) > 0 && $cat[0] != -1) { $catsrch = " ("; foreach ($cat as $category) { if ($category != -1) { $categ = new Category(); if ($categ->isParent($category)) { $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) { $chlist .= ", " . $child["id"]; } if ($chlist != "-99") { $catsrch .= " r.categoryid in (" . $chlist . ") or "; } } else { $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } $catsrch .= "1=2 )"; } $maxagesql = ""; if ($maxage > 0) { $maxagesql = sprintf(" and r.postdate > now() - interval %d day ", $maxage); } $exccatlist = ""; if (count($excludedcats) > 0) { $exccatlist = " and r.categoryid not in (" . implode(",", $excludedcats) . ")"; } $order = $this->getConsoleOrder($orderby); $sql = sprintf(" SELECT r.*, r.id as releaseid, con.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.id, ',', c.id) as category_ids, rn.id as nfoid from releases r left outer join groups on groups.id = r.groupid inner join consoleinfo con on con.id = r.consoleinfoid left outer join releasenfo rn on rn.releaseid = r.id and rn.nfo is not null left outer join category c on c.id = r.categoryid left outer join category cp on cp.id = c.parentid left outer join genres g on g.id = con.genreid where r.passwordstatus <= (select value from settings where setting='showpasswordedrelease') and %s %s %s %s order by %s %s" . $limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); return $this->pdo->query($sql, true); }
/** * Search for releases by imdbid/movieinfo. Used by API/Couchpotato. */ public function searchbyImdbId($imdbId, $offset = 0, $limit = 100, $name = "", $cat = array(-1), $genre = "", $maxage = -1) { $s = new Sites(); $site = $s->get(); if ($site->sphinxenabled) { $sphinx = new Sphinx(); $results = $sphinx->searchbyImdbId($imdbId, $offset, $limit, $name, $cat, $genre, $maxage, array(), true); if (is_array($results)) { return $results; } } $db = new DB(); if ($imdbId != "-1" && is_numeric($imdbId)) { //pad id with zeros just in case $imdbId = str_pad($imdbId, 7, "0", STR_PAD_LEFT); $imdbId = sprintf(" and releases.imdbID = %d ", $imdbId); } else { $imdbId = ""; } // // if the query starts with a ^ it indicates the search is looking for items which start with the term // still do the fulltext match, but mandate that all items returned must start with the provided word // $words = explode(" ", $name); $searchsql = ""; $intwordcount = 0; if (count($words) > 0) { foreach ($words as $word) { if ($word != "") { // // see if the first word had a caret, which indicates search must start with term // if ($intwordcount == 0 && strpos($word, "^") === 0) { $searchsql .= sprintf(" and releases.searchname like %s", $db->escapeString(substr($word, 1) . "%")); } elseif (substr($word, 0, 2) == '--') { $searchsql .= sprintf(" and releases.searchname not like %s", $db->escapeString("%" . substr($word, 2) . "%")); } else { $searchsql .= sprintf(" and releases.searchname like %s", $db->escapeString("%" . $word . "%")); } $intwordcount++; } } } $catsrch = ""; if (count($cat) > 0 && $cat[0] != -1) { $catsrch = " and ("; foreach ($cat as $category) { if ($category != -1) { $categ = new Category(); if ($categ->isParent($category)) { $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) { $chlist .= ", " . $child["ID"]; } if ($chlist != "-99") { $catsrch .= " releases.categoryID in (" . $chlist . ") or "; } } else { $catsrch .= sprintf(" releases.categoryID = %d or ", $category); } } } $catsrch .= "1=2 )"; } if ($maxage > 0) { $maxage = sprintf(" and releases.postdate > now() - interval %d day ", $maxage); } else { $maxage = ""; } if ($genre != "") { $genre = sprintf(" and movieinfo.genre like %s", $db->escapeString("%" . $genre . "%")); } $sql = sprintf("select releases.*, movieinfo.title as moi_title, movieinfo.tagline as moi_tagline, movieinfo.rating as moi_rating, movieinfo.plot as moi_plot, movieinfo.year as moi_year, movieinfo.genre as moi_genre, movieinfo.director as moi_director, movieinfo.actors as moi_actors, movieinfo.cover as moi_cover, movieinfo.backdrop as moi_backdrop, concat(cp.title, ' > ', c.title) as category_name, concat(cp.ID, ',', c.ID) as category_ids, groups.name as group_name, rn.ID as nfoID from releases left outer join groups on groups.ID = releases.groupID left outer join category c on c.ID = releases.categoryID left outer join releasenfo rn on rn.releaseID = releases.ID and rn.nfo is not null left outer join category cp on cp.ID = c.parentID left outer join movieinfo on releases.imdbID = movieinfo.imdbID where releases.passwordstatus <= (select value from site where setting='showpasswordedrelease') %s %s %s %s %s order by postdate desc limit %d, %d ", $searchsql, $imdbId, $catsrch, $maxage, $genre, $offset, $limit); $orderpos = strpos($sql, "order by"); $wherepos = strpos($sql, "where"); $sqlcount = "select count(releases.ID) as num from releases left outer join movieinfo on releases.imdbID = movieinfo.imdbID " . substr($sql, $wherepos, $orderpos - $wherepos); $countres = $db->queryOneRow($sqlcount, true); $res = $db->query($sql, true); if (count($res) > 0) { $res[0]["_totalrows"] = $countres["num"]; } return $res; }
/** * Get movieinfo rows for browse list by limit. */ public function getMovieRange($cat, $start, $num, $orderby, $maxage = -1, $excludedcats = array()) { $browseby = $this->getBrowseBy(); if ($start === false) { $limit = ""; } else { $limit = " LIMIT " . $start . "," . $num; } $catsrch = ""; if (count($cat) > 0 && $cat[0] != -1) { $catsrch = " ("; foreach ($cat as $category) { if ($category != -1) { $categ = new Category(); if ($categ->isParent($category)) { $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) { $chlist .= ", " . $child["id"]; } if ($chlist != "-99") { $catsrch .= " r.categoryid in (" . $chlist . ") or "; } } else { $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } $catsrch .= "1=2 )"; } else { $catsrch = " 1=1 "; } $maxagesql = ""; if ($maxage > 0) { $maxagesql = sprintf(" and r.postdate > now() - interval %d day ", $maxage); } $exccatlist = ""; if (count($excludedcats) > 0) { $exccatlist = " and r.categoryid not in (" . implode(",", $excludedcats) . ")"; } $order = $this->getMovieOrder($orderby); $sql = sprintf(" SELECT r.imdbid, max(r.postdate) as postdate, m.* from releases r inner join movieinfo m on m.imdbid = r.imdbid where r.passwordstatus <= (select value from settings where setting='showpasswordedrelease') and m.title != '' and r.imdbid != 0000000 and %s %s %s %s group by r.imdbid order by %s %s" . $limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); $rows = $this->pdo->query($sql, true); // //get a copy of all the imdbs // $imdbds = ""; foreach ($rows as $row) { $imdbds .= $row["imdbid"] . ", "; } if (strlen($imdbds) > 0) { $imdbds = substr($imdbds, 0, -2); // // get all releases matching these ids // $sql = sprintf("select r.*, releasenfo.id as nfoid, groups.name as grpname, concat(cp.title, ' > ', c.title) as categoryname from releases r left outer join category c on c.id = r.categoryid left outer join category cp on cp.id = c.parentid left outer join releasenfo on releasenfo.releaseid = r.id left outer join groups on groups.id = r.groupid where imdbid in (%s) and %s %s %s order by r.postdate desc", $imdbds, $catsrch, $maxagesql, $exccatlist); $allrows = $this->pdo->query($sql, true); $arr = array(); // // build array indexed by imdbid // foreach ($allrows as &$allrow) { $arr[$allrow["imdbid"]]["id"] = (isset($arr[$allrow["imdbid"]]["id"]) ? $arr[$allrow["imdbid"]]["id"] : "") . $allrow["id"] . ","; $arr[$allrow["imdbid"]]["rarinnerfilecount"] = (isset($arr[$allrow["imdbid"]]["rarinnerfilecount"]) ? $arr[$allrow["imdbid"]]["rarinnerfilecount"] : "") . $allrow["rarinnerfilecount"] . ","; $arr[$allrow["imdbid"]]["haspreview"] = (isset($arr[$allrow["imdbid"]]["haspreview"]) ? $arr[$allrow["imdbid"]]["haspreview"] : "") . $allrow["haspreview"] . ","; $arr[$allrow["imdbid"]]["passwordstatus"] = (isset($arr[$allrow["imdbid"]]["passwordstatus"]) ? $arr[$allrow["imdbid"]]["passwordstatus"] : "") . $allrow["passwordstatus"] . ","; $arr[$allrow["imdbid"]]["guid"] = (isset($arr[$allrow["imdbid"]]["guid"]) ? $arr[$allrow["imdbid"]]["guid"] : "") . $allrow["guid"] . ","; $arr[$allrow["imdbid"]]["nfoid"] = (isset($arr[$allrow["imdbid"]]["nfoid"]) ? $arr[$allrow["imdbid"]]["nfoid"] : "") . $allrow["nfoid"] . ","; $arr[$allrow["imdbid"]]["grpname"] = (isset($arr[$allrow["imdbid"]]["grpname"]) ? $arr[$allrow["imdbid"]]["grpname"] : "") . $allrow["grpname"] . ","; $arr[$allrow["imdbid"]]["searchname"] = (isset($arr[$allrow["imdbid"]]["searchname"]) ? $arr[$allrow["imdbid"]]["searchname"] : "") . $allrow["searchname"] . "#"; $arr[$allrow["imdbid"]]["postdate"] = (isset($arr[$allrow["imdbid"]]["postdate"]) ? $arr[$allrow["imdbid"]]["postdate"] : "") . $allrow["postdate"] . ","; $arr[$allrow["imdbid"]]["size"] = (isset($arr[$allrow["imdbid"]]["size"]) ? $arr[$allrow["imdbid"]]["size"] : "") . $allrow["size"] . ","; $arr[$allrow["imdbid"]]["totalpart"] = (isset($arr[$allrow["imdbid"]]["totalpart"]) ? $arr[$allrow["imdbid"]]["totalpart"] : "") . $allrow["totalpart"] . ","; $arr[$allrow["imdbid"]]["comments"] = (isset($arr[$allrow["imdbid"]]["comments"]) ? $arr[$allrow["imdbid"]]["comments"] : "") . $allrow["comments"] . ","; $arr[$allrow["imdbid"]]["grabs"] = (isset($arr[$allrow["imdbid"]]["grabs"]) ? $arr[$allrow["imdbid"]]["grabs"] : "") . $allrow["grabs"] . ","; $arr[$allrow["imdbid"]]["categoryid"] = (isset($arr[$allrow["imdbid"]]["categoryid"]) ? $arr[$allrow["imdbid"]]["categoryid"] : "") . $allrow["categoryid"] . ","; $arr[$allrow["imdbid"]]["categoryname"] = (isset($arr[$allrow["imdbid"]]["categoryname"]) ? $arr[$allrow["imdbid"]]["categoryname"] : "") . $allrow["categoryname"] . ","; } // // stuff back into the results set // foreach ($rows as &$row) { $row["grp_release_id"] = substr($arr[$row["imdbid"]]["id"], 0, -1); $row["grp_rarinnerfilecount"] = substr($arr[$row["imdbid"]]["rarinnerfilecount"], 0, -1); $row["grp_haspreview"] = substr($arr[$row["imdbid"]]["haspreview"], 0, -1); $row["grp_release_password"] = substr($arr[$row["imdbid"]]["passwordstatus"], 0, -1); $row["grp_release_guid"] = substr($arr[$row["imdbid"]]["guid"], 0, -1); $row["grp_release_nfoid"] = substr($arr[$row["imdbid"]]["nfoid"], 0, -1); $row["grp_release_grpname"] = substr($arr[$row["imdbid"]]["grpname"], 0, -1); $row["grp_release_name"] = substr($arr[$row["imdbid"]]["searchname"], 0, -1); $row["grp_release_postdate"] = substr($arr[$row["imdbid"]]["postdate"], 0, -1); $row["grp_release_size"] = substr($arr[$row["imdbid"]]["size"], 0, -1); $row["grp_release_totalparts"] = substr($arr[$row["imdbid"]]["totalpart"], 0, -1); $row["grp_release_comments"] = substr($arr[$row["imdbid"]]["comments"], 0, -1); $row["grp_release_grabs"] = substr($arr[$row["imdbid"]]["grabs"], 0, -1); $row["grp_release_categoryid"] = substr($arr[$row["imdbid"]]["categoryid"], 0, -1); $row["grp_release_categoryname"] = substr($arr[$row["imdbid"]]["categoryname"], 0, -1); } } return $rows; }