mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-31 18:28:54 +00:00
Rework book, movie, console queries, use ceil instead of round in pager
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2015-11-19 DariusIII
|
||||
Upd: Rework book, movie, console queries, use ceil instead of round in pager
|
||||
Upd: Add queryCalc function to DB class
|
||||
Upd: Add nfo to api
|
||||
2015-11-18 DariusIII
|
||||
|
||||
+32
-48
@@ -152,28 +152,15 @@ class Books
|
||||
return $res['num'];
|
||||
}
|
||||
|
||||
public function getBookCount($cat, $maxage = -1, $excludedcats = [])
|
||||
{
|
||||
$res = $this->pdo->query(
|
||||
sprintf("
|
||||
SELECT COUNT(DISTINCT r.bookinfoid) AS num
|
||||
FROM releases r
|
||||
INNER JOIN bookinfo boo ON boo.id = r.bookinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND r.passwordstatus %s
|
||||
AND boo.title != ''
|
||||
AND boo.cover = 1
|
||||
AND %s %s %s %s",
|
||||
Releases::showPasswords($this->pdo),
|
||||
$this->getBrowseBy(),
|
||||
(count($cat) > 0 && $cat[0] != -1 ? (new Category(['Settings' => $this->pdo]))->getCategorySearch($cat) : ''),
|
||||
($maxage > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage) : ''),
|
||||
(count($excludedcats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')' : '')
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
return (isset($res[0]["num"]) ? $res[0]["num"] : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cat
|
||||
* @param $start
|
||||
* @param $num
|
||||
* @param $orderby
|
||||
* @param array $excludedcats
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBookRange($cat, $start, $num, $orderby, $excludedcats = [])
|
||||
{
|
||||
|
||||
@@ -196,18 +183,19 @@ class Books
|
||||
|
||||
$order = $this->getBookOrder($orderby);
|
||||
|
||||
$books = $this->pdo->query(
|
||||
$books = $this->pdo->queryCalc(
|
||||
sprintf("
|
||||
SELECT boo.id
|
||||
FROM bookinfo boo
|
||||
LEFT JOIN releases r ON boo.id = r.bookinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND boo.cover = 1
|
||||
AND boo.title != ''
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s %s
|
||||
GROUP BY boo.id
|
||||
ORDER BY %s %s %s",
|
||||
SELECT SQL_CALC_FOUND_ROWS boo.id,
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id
|
||||
FROM bookinfo boo
|
||||
LEFT JOIN releases r ON boo.id = r.bookinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND boo.cover = 1
|
||||
AND boo.title != ''
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s %s
|
||||
GROUP BY boo.id
|
||||
ORDER BY %s %s %s",
|
||||
Releases::showPasswords($this->pdo),
|
||||
$browseby,
|
||||
$catsrch,
|
||||
@@ -219,11 +207,12 @@ class Books
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
|
||||
$bookIDs = false;
|
||||
$bookIDs = $releaseIDs = false;
|
||||
|
||||
if (is_array($books)) {
|
||||
foreach ($books AS $book => $id) {
|
||||
if (is_array($books['result'])) {
|
||||
foreach ($books['result'] AS $book => $id) {
|
||||
$bookIDs[] = $id['id'];
|
||||
$releaseIDs[] = $id['grp_release_id'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,25 +239,20 @@ class Books
|
||||
LEFT OUTER JOIN groups g ON g.id = r.groupid
|
||||
LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
|
||||
INNER JOIN bookinfo boo ON boo.id = r.bookinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND boo.id IN (%s)
|
||||
AND boo.cover = 1
|
||||
AND boo.title != ''
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s %s
|
||||
WHERE boo.id IN (%s)
|
||||
AND r.id IN (%s)
|
||||
AND %s
|
||||
GROUP BY boo.id
|
||||
ORDER BY %s %s",
|
||||
(is_array($bookIDs) ? implode(',', $bookIDs) : -1),
|
||||
Releases::showPasswords($this->pdo),
|
||||
$browseby,
|
||||
(is_array($releaseIDs) ? implode(',', $releaseIDs) : -1),
|
||||
$catsrch,
|
||||
$maxage,
|
||||
$exccatlist,
|
||||
$order[0],
|
||||
$order[1]
|
||||
);
|
||||
|
||||
return $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
|
||||
$return = $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
|
||||
$return[0]['_totalcount'] = (isset($books['total']) ? $books['total'] : 0);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+33
-52
@@ -148,35 +148,17 @@ class Console
|
||||
return ($res === false ? 0 : $res['num']);
|
||||
}
|
||||
|
||||
public function getConsoleCount($cat, $maxage = -1, $excludedcats = [])
|
||||
{
|
||||
$catsrch = '';
|
||||
if (count($cat) > 0 && $cat[0] != -1) {
|
||||
$catsrch = (new Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
|
||||
}
|
||||
|
||||
$res = $this->pdo->query(
|
||||
sprintf("
|
||||
SELECT COUNT(DISTINCT r.consoleinfoid) AS num
|
||||
FROM releases r
|
||||
INNER JOIN consoleinfo con ON con.id = r.consoleinfoid AND con.title != '' AND con.cover = 1
|
||||
WHERE r.nzbstatus = 1
|
||||
AND r.passwordstatus %s
|
||||
AND con.title != ''
|
||||
AND %s %s %s %s",
|
||||
Releases::showPasswords($this->pdo),
|
||||
$this->getBrowseBy(),
|
||||
$catsrch,
|
||||
($maxage > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage) : ''),
|
||||
(count($excludedcats) > 0 ? (' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')') : '')
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
return (isset($res[0]["num"]) ? $res[0]["num"] : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cat
|
||||
* @param $start
|
||||
* @param $num
|
||||
* @param $orderby
|
||||
* @param array $excludedcats
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConsoleRange($cat, $start, $num, $orderby, $excludedcats = [])
|
||||
{
|
||||
|
||||
$browseby = $this->getBrowseBy();
|
||||
|
||||
$catsrch = '';
|
||||
@@ -191,18 +173,19 @@ class Console
|
||||
|
||||
$order = $this->getConsoleOrder($orderby);
|
||||
|
||||
$consoles = $this->pdo->query(
|
||||
$consoles = $this->pdo->queryCalc(
|
||||
sprintf("
|
||||
SELECT con.id
|
||||
FROM consoleinfo con
|
||||
LEFT JOIN releases r ON con.id = r.consoleinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND con.title != ''
|
||||
AND con.cover = 1
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s
|
||||
GROUP BY con.id
|
||||
ORDER BY %s %s %s",
|
||||
SELECT SQL_CALC_FOUND_ROWS con.id,
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id
|
||||
FROM consoleinfo con
|
||||
LEFT JOIN releases r ON con.id = r.consoleinfoid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND con.title != ''
|
||||
AND con.cover = 1
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s
|
||||
GROUP BY con.id
|
||||
ORDER BY %s %s %s",
|
||||
Releases::showPasswords($this->pdo),
|
||||
$browseby,
|
||||
$catsrch,
|
||||
@@ -213,15 +196,16 @@ class Console
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
|
||||
$consoleIDs = false;
|
||||
$consoleIDs = $releaseIDs = false;
|
||||
|
||||
if (is_array($consoles)) {
|
||||
foreach ($consoles AS $console => $id) {
|
||||
if (is_array($consoles['result'])) {
|
||||
foreach ($consoles['result'] AS $console => $id) {
|
||||
$consoleIDs[] = $id['id'];
|
||||
$releaseIDs[] = $id['grp_release_id'];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->pdo->query(
|
||||
$return = $this->pdo->query(
|
||||
sprintf("
|
||||
SELECT
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,
|
||||
@@ -246,24 +230,21 @@ class Console
|
||||
LEFT OUTER JOIN groups g ON g.id = r.groupid
|
||||
LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
|
||||
INNER JOIN consoleinfo con ON con.id = r.consoleinfoid
|
||||
INNER JOIN genres ON con.genreid = genres.id
|
||||
WHERE r.nzbstatus = 1
|
||||
AND con.id IN (%s)
|
||||
AND con.title != ''
|
||||
AND con.cover = 1
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s
|
||||
INNER JOIN genres ON con.genre_id = genres.id
|
||||
WHERE con.id IN (%s)
|
||||
AND r.id IN (%s)
|
||||
AND %s
|
||||
GROUP BY con.id
|
||||
ORDER BY %s %s",
|
||||
(is_array($consoleIDs) ? implode(',', $consoleIDs) : -1),
|
||||
Releases::showPasswords($this->pdo),
|
||||
$browseby,
|
||||
(is_array($releaseIDs) ? implode(',', $releaseIDs) : -1),
|
||||
$catsrch,
|
||||
$exccatlist,
|
||||
$order[0],
|
||||
$order[1]
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
$return[0]['_totalcount'] = (isset($consoles['total']) ? $consoles['total'] : 0);
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function getConsoleOrder($orderby)
|
||||
|
||||
+71
-68
@@ -243,42 +243,6 @@ class Movie
|
||||
return ($res === false ? 0 : $res['num']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of movies for movies browse page.
|
||||
*
|
||||
* @param $cat
|
||||
* @param $maxAge
|
||||
* @param array $excludedCats
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMovieCount($cat, $maxAge = -1, $excludedCats = [])
|
||||
{
|
||||
$catsrch = '';
|
||||
if (count($cat) > 0 && $cat[0] != -1) {
|
||||
$catsrch = (new Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
|
||||
}
|
||||
|
||||
$res = $this->pdo->query(
|
||||
sprintf("
|
||||
SELECT COUNT(DISTINCT r.imdbid) AS num
|
||||
FROM releases r
|
||||
INNER JOIN movieinfo m ON m.imdbid = r.imdbid
|
||||
WHERE r.nzbstatus = 1
|
||||
AND r.imdbid != '0000000'
|
||||
AND m.title != ''
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s %s ",
|
||||
$this->showPasswords,
|
||||
$this->getBrowseBy(),
|
||||
$catsrch,
|
||||
($maxAge > 0 ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . ' DAY' : ''),
|
||||
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : '')
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
return (isset($res[0]["num"]) ? $res[0]["num"] : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get movie releases with covers for movie browse page.
|
||||
*
|
||||
@@ -289,7 +253,7 @@ class Movie
|
||||
* @param $maxAge
|
||||
* @param array $excludedCats
|
||||
*
|
||||
* @return bool PDOStatement
|
||||
* @return bool|\PDOStatement
|
||||
*/
|
||||
public function getMovieRange($cat, $start, $num, $orderBy, $maxAge = -1, $excludedCats = [])
|
||||
{
|
||||
@@ -299,42 +263,81 @@ class Movie
|
||||
}
|
||||
|
||||
$order = $this->getMovieOrder($orderBy);
|
||||
|
||||
$movies = $this->pdo->queryCalc(
|
||||
sprintf("
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
m.imdbid,
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id
|
||||
FROM movieinfo m
|
||||
LEFT JOIN releases r USING (imdbid)
|
||||
WHERE r.nzbstatus = 1
|
||||
AND m.title != ''
|
||||
AND m.imdbid != '0000000'
|
||||
AND r.passwordstatus %s
|
||||
AND %s %s %s %s
|
||||
GROUP BY m.imdbid
|
||||
ORDER BY %s %s %s",
|
||||
$this->showPasswords,
|
||||
$this->getBrowseBy(),
|
||||
$catsrch,
|
||||
($maxAge > 0
|
||||
? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY '
|
||||
: ''
|
||||
),
|
||||
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
|
||||
$order[0],
|
||||
$order[1],
|
||||
($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start)
|
||||
), true, NN_CACHE_EXPIRY_MEDIUM
|
||||
);
|
||||
|
||||
$movieIDs = $releaseIDs = false;
|
||||
|
||||
if (is_array($movies['result'])) {
|
||||
foreach ($movies['result'] AS $movie => $id) {
|
||||
$movieIDs[] = $id['imdbid'];
|
||||
$releaseIDs[] = $id['grp_release_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf("
|
||||
SELECT
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,
|
||||
GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount,
|
||||
GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview,
|
||||
GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password,
|
||||
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
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,
|
||||
GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') AS grp_rarinnerfilecount,
|
||||
GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview,
|
||||
GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password,
|
||||
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(g.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.*,
|
||||
g.name AS group_name,
|
||||
rn.id AS nfoid
|
||||
FROM releases r
|
||||
LEFT OUTER JOIN groups g ON g.id = r.groupid
|
||||
LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
|
||||
INNER JOIN movieinfo m ON m.imdbid = r.imdbid
|
||||
WHERE r.nzbstatus = 1 AND r.imdbid != '0000000'
|
||||
AND m.title != ''
|
||||
AND r.passwordstatus %s AND %s %s %s %s
|
||||
GROUP BY m.imdbid ORDER BY %s %s %s",
|
||||
$this->showPasswords,
|
||||
$this->getBrowseBy(),
|
||||
$catsrch,
|
||||
($maxAge > 0
|
||||
? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY '
|
||||
: ''
|
||||
),
|
||||
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
|
||||
$order[0],
|
||||
$order[1],
|
||||
($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start)
|
||||
WHERE m.imdbid IN (%s)
|
||||
AND r.id IN (%s)
|
||||
AND %s
|
||||
GROUP BY m.imdbid
|
||||
ORDER BY %s %s",
|
||||
(is_array($movieIDs) ? implode(',', $movieIDs) : -1),
|
||||
(is_array($releaseIDs) ? implode(',', $releaseIDs) : -1),
|
||||
$catsrch,
|
||||
$order[0],
|
||||
$order[1]
|
||||
);
|
||||
return $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
|
||||
$return = $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
|
||||
$return[0]['_totalcount'] = (isset($movies['total']) ? $movies['total'] : 0);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
<precommit>9</precommit>
|
||||
<!-- this is the version of the pre-commit file in githooks NOT the files it calls -->
|
||||
</hooks>
|
||||
<commit>4405</commit></git>
|
||||
<commit>4406</commit></git>
|
||||
</versions>
|
||||
</newznab>
|
||||
|
||||
+1
-3
@@ -28,8 +28,6 @@ $catarray[] = $category;
|
||||
$page->smarty->assign('catlist', $btmp);
|
||||
$page->smarty->assign('category', $category);
|
||||
|
||||
$browsecount = $book->getBookCount($catarray, -1, $page->userdata["categoryexclusions"]);
|
||||
|
||||
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
|
||||
$ordering = $book->getBookOrdering();
|
||||
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
|
||||
@@ -58,7 +56,7 @@ $page->smarty->assign('title', $title);
|
||||
|
||||
$browseby_link = '&title=' . $title . '&author=' . $author;
|
||||
|
||||
$page->smarty->assign('pagertotalitems', $browsecount);
|
||||
$page->smarty->assign('pagertotalitems', $results[0]['_totalcount']);
|
||||
$page->smarty->assign('pageroffset', $offset);
|
||||
$page->smarty->assign('pageritemsperpage', ITEMS_PER_COVER_PAGE);
|
||||
$page->smarty->assign('pagerquerybase', WWW_TOP . "/books?t=" . $category . $browseby_link . "&ob=" . $orderby . "&offset=");
|
||||
|
||||
@@ -30,8 +30,6 @@ $catarray[] = $category;
|
||||
$page->smarty->assign('catlist', $ctmp);
|
||||
$page->smarty->assign('category', $category);
|
||||
|
||||
$browsecount = $console->getConsoleCount($catarray, -1, $page->userdata["categoryexclusions"]);
|
||||
|
||||
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
|
||||
$ordering = $console->getConsoleOrdering();
|
||||
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
|
||||
@@ -69,7 +67,7 @@ $page->smarty->assign('genre', $genre);
|
||||
|
||||
$browseby_link = '&title=' . $title . '&platform=' . $platform;
|
||||
|
||||
$page->smarty->assign('pagertotalitems', $browsecount);
|
||||
$page->smarty->assign('pagertotalitems', $results[0]['_totalcount']);
|
||||
$page->smarty->assign('pageroffset', $offset);
|
||||
$page->smarty->assign('pageritemsperpage', ITEMS_PER_COVER_PAGE);
|
||||
$page->smarty->assign('pagerquerybase', WWW_TOP . "/console?t=" . $category . $browseby_link . "&ob=" . $orderby . "&offset=");
|
||||
|
||||
@@ -38,8 +38,6 @@ if ($category != -1) {
|
||||
$page->smarty->assign('catlist', $mtmp);
|
||||
$page->smarty->assign('category', $category);
|
||||
|
||||
$browsecount = $movie->getMovieCount($catarray, -1, $page->userdata["categoryexclusions"]);
|
||||
|
||||
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
|
||||
$ordering = $movie->getMovieOrdering();
|
||||
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
|
||||
@@ -83,7 +81,7 @@ $page->smarty->assign('year', $year);
|
||||
|
||||
$browseby_link = '&title='.$title.'&actors='.$actors.'&director='.$director.'&rating='.$rating.'&genre='.$genre.'&year='.$year;
|
||||
|
||||
$page->smarty->assign('pagertotalitems',$browsecount);
|
||||
$page->smarty->assign('pagertotalitems', $results[0]['_totalcount']);
|
||||
$page->smarty->assign('pageroffset',$offset);
|
||||
$page->smarty->assign('pageritemsperpage',ITEMS_PER_COVER_PAGE);
|
||||
$page->smarty->assign('pagerquerybase', WWW_TOP."/movies?t=".$category.$browseby_link."&ob=".$orderby."&offset=");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|round}
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|ceil}
|
||||
{assign var="currentpage" value=($pageroffset+$pageritemsperpage)/$pageritemsperpage}
|
||||
{assign var="upperhalfwaypoint" value=((($pages-$currentpage)/2)|round)+$currentpage}
|
||||
{if $pages > 1}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|round}
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|ceil}
|
||||
{assign var="currentpage" value=($pageroffset+$pageritemsperpage)/$pageritemsperpage}
|
||||
{assign var="upperhalfwaypoint" value=((($pages-$currentpage)/2)|round)+$currentpage}
|
||||
{if $pages > 1}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|round}
|
||||
{assign var="pages" value=($pagertotalitems/$pageritemsperpage)|ceil}
|
||||
{assign var="currentpage" value=($pageroffset+$pageritemsperpage)/$pageritemsperpage}
|
||||
{assign var="upperhalfwaypoint" value=((($pages-$currentpage)/2)|round)+$currentpage}
|
||||
{if $pages > 1}
|
||||
|
||||
Reference in New Issue
Block a user