diff --git a/Blacklight/http/XML_Response.php b/Blacklight/http/XML_Response.php index 07d279191..1e79400fa 100755 --- a/Blacklight/http/XML_Response.php +++ b/Blacklight/http/XML_Response.php @@ -152,20 +152,18 @@ class XML_Response */ protected function returnCaps(): string { - $w = $this->xml; - $s = $this->server; - $w->startDocument('1.0', 'UTF-8'); - $w->startElement('caps'); - $this->addNode(['name' => 'server', 'data' => $s['server']]); - $this->addNode(['name' => 'limits', 'data' => $s['limits']]); - $this->addNode(['name' => 'registration', 'data' => $s['registration']]); - $this->addNodes(['name' => 'searching', 'data' => $s['searching']]); + $this->xml->startDocument('1.0', 'UTF-8'); + $this->xml->startElement('caps'); + $this->addNode(['name' => 'server', 'data' => $this->server['server']]); + $this->addNode(['name' => 'limits', 'data' => $this->server['limits']]); + $this->addNode(['name' => 'registration', 'data' => $this->server['registration']]); + $this->addNodes(['name' => 'searching', 'data' => $this->server['searching']]); $this->writeCategoryListing(); - $w->endElement(); - $w->endDocument(); + $this->xml->endElement(); + $this->xml->endDocument(); - return $w->outputMemory(); + return $this->xml->outputMemory(); } /** @@ -175,20 +173,19 @@ class XML_Response */ protected function returnApiRss(): string { - $w = $this->xml; $this->xml->startDocument('1.0', 'UTF-8'); $this->includeRssAtom(); // Open RSS - $w->startElement('channel'); // Open channel + $this->xml->startElement('channel'); // Open channel $this->includeRssAtomLink(); $this->includeMetaInfo(); $this->includeImage(); $this->includeTotalRows(); $this->includeReleases(); - $w->endElement(); // End channel - $w->endElement(); // End RSS - $w->endDocument(); + $this->xml->endElement(); // End channel + $this->xml->endElement(); // End RSS + $this->xml->endDocument(); - return $w->outputMemory(); + return $this->xml->outputMemory(); } /** @@ -243,14 +240,14 @@ class XML_Response protected function writeCategoryListing(): void { $this->xml->startElement('categories'); - foreach ($this->server['categories'] as $p) { + foreach ($this->server['categories'] as $this->parameters) { $this->xml->startElement('category'); - $this->xml->writeAttribute('id', $p['id']); - $this->xml->writeAttribute('name', html_entity_decode($p['title'])); - if ($p['description'] !== '') { - $this->xml->writeAttribute('description', html_entity_decode($p['description'])); + $this->xml->writeAttribute('id', $this->parameters['id']); + $this->xml->writeAttribute('name', html_entity_decode($this->parameters['title'])); + if ($this->parameters['description'] !== '') { + $this->xml->writeAttribute('description', html_entity_decode($this->parameters['description'])); } - foreach ($p['subcatlist'] as $c) { + foreach ($this->parameters['subcatlist'] as $c) { $this->xml->startElement('subcat'); $this->xml->writeAttribute('id', $c['id']); $this->xml->writeAttribute('name', html_entity_decode($c['title'])); @@ -520,28 +517,21 @@ class XML_Response */ protected function writeRssCdata(): void { - $this->cdata = ''; - - $w = $this->xml; - $r = $this->release; - $s = $this->server; - $p = $this->parameters; - $this->cdata = "\n\t
\n"; switch (1) { - case ! empty($r['cover']): + case ! empty($this->release['cover']): $dir = 'movies'; $column = 'imdbid'; break; - case ! empty($r['mu_cover']): + case ! empty($this->release['mu_cover']): $dir = 'music'; $column = 'musicinfo_id'; break; - case ! empty($r['co_cover']): + case ! empty($this->release['co_cover']): $dir = 'console'; $column = 'consoleinfo_id'; break; - case ! empty($r['bo_cover']): + case ! empty($this->release['bo_cover']): $dir = 'books'; $column = 'bookinfo_id'; break; @@ -550,20 +540,20 @@ class XML_Response $dcov = ($dir === 'movies' ? '-cover' : ''); $this->cdata .= "\t\"{$r['searchname']}\"\n"; + "src=\"{$this->server['server']['url']}covers/{$dir}/{$this->release[$column]}{$dcov}.jpg\" ". + "width=\"120\" alt=\"{$this->release['searchname']}\" />\n"; } - $size = Utility::bytesToSizeString($r['size']); + $size = Utility::bytesToSizeString($this->release['size']); $this->cdata .= - "\t
  • ID: {$r['guid']}
  • \n". - "\t
  • Name: {$r['searchname']}
  • \n". + "\t
  • ID: server['server']['url']}details/{$this->release['guid']}\">{$this->release['guid']}
  • \n". + "\t
  • Name: {$this->release['searchname']}
  • \n". "\t
  • Size: {$size}
  • \n". - "\t
  • Category: {$r['category_name']}
  • \n". - "\t
  • Group: {$r['group_name']}
  • \n". - "\t
  • Poster: {$r['fromname']}
  • \n". - "\t
  • Posted: {$r['postdate']}
  • \n"; + "\t
  • Category: server['server']['url']}browse?t={$this->release['categories_id']}\">{$this->release['category_name']}
  • \n". + "\t
  • Group: server['server']['url']}browse?g={$this->release['group_name']}\">{$this->release['group_name']}
  • \n". + "\t
  • Poster: {$this->release['fromname']}
  • \n". + "\t
  • Posted: {$this->release['postdate']}
  • \n"; - switch ($r['passwordstatus']) { + switch ($this->release['passwordstatus']) { case 0: $pstatus = 'None'; break; @@ -580,23 +570,23 @@ class XML_Response $pstatus = 'Unknown'; } $this->cdata .= "\t
  • Password: {$pstatus}
  • \n"; - if ($r['nfostatus'] === 1) { + if ($this->release['nfostatus'] === 1) { $this->cdata .= "\t
  • Nfo: ". - "". - "{$r['searchname']}.nfo
  • \n"; + "server['server']['url']}api?t=nfo&id={$this->release['guid']}&raw=1&i={$this->parameters['uid']}&r={$this->parameters['token']}\">". + "{$this->release['searchname']}.nfo\n"; } - if ($r['parentid'] === Category::MOVIE_ROOT && $r['imdbid'] !== '') { + if ($this->release['parentid'] === Category::MOVIE_ROOT && $this->release['imdbid'] !== '') { $this->writeRssMovieInfo(); - } elseif ($r['parentid'] === Category::MUSIC_ROOT && $r['musicinfo_id'] > 0) { + } elseif ($this->release['parentid'] === Category::MUSIC_ROOT && $this->release['musicinfo_id'] > 0) { $this->writeRssMusicInfo(); - } elseif ($r['parentid'] === Category::GAME_ROOT && $r['consoleinfo_id'] > 0) { + } elseif ($this->release['parentid'] === Category::GAME_ROOT && $this->release['consoleinfo_id'] > 0) { $this->writeRssConsoleInfo(); } - $w->startElement('description'); - $w->writeCdata($this->cdata."\t
    "); - $w->endElement(); + $this->xml->startElement('description'); + $this->xml->writeCdata($this->cdata."\t"); + $this->xml->endElement(); } /** @@ -604,8 +594,6 @@ class XML_Response */ protected function writeRssMovieInfo(): void { - $r = $this->release; - $movieCol = ['rating', 'plot', 'year', 'genre', 'director', 'actors']; $cData = $this->buildCdata($movieCol); @@ -613,7 +601,7 @@ class XML_Response $this->cdata .= "\t
  • Imdb Info: \t \t
  • @@ -625,15 +613,14 @@ class XML_Response */ protected function writeRssMusicInfo(): void { - $r = $this->release; $tData = $cDataUrl = ''; $musicCol = ['mu_artist', 'mu_genre', 'mu_publisher', 'mu_releasedate', 'mu_review']; $cData = $this->buildCdata($musicCol); - if ($r['mu_url'] !== '') { - $cDataUrl = "
  • Amazon: {$r['mu_title']}
  • "; + if ($this->release['mu_url'] !== '') { + $cDataUrl = "
  • Amazon: release['mu_url']}\">{$this->release['mu_title']}
  • "; } $this->cdata .= @@ -643,8 +630,8 @@ class XML_Response {$cData} \n"; - if ($r['mu_tracks'] !== '') { - $tracks = explode('|', $r['mu_tracks']); + if ($this->release['mu_tracks'] !== '') { + $tracks = explode('|', $this->release['mu_tracks']); if (\count($tracks) > 0) { foreach ($tracks as $track) { $track = trim($track); @@ -665,7 +652,6 @@ class XML_Response */ protected function writeRssConsoleInfo(): void { - $r = $this->release; $gamesCol = ['co_genre', 'co_publisher', 'year', 'co_review']; $cData = $this->buildCdata($gamesCol); @@ -673,7 +659,7 @@ class XML_Response $this->cdata .= "
  • Console Info:
  • \n"; @@ -688,19 +674,17 @@ class XML_Response */ protected function buildCdata($columns): string { - $r = $this->release; - $cData = ''; foreach ($columns as $info) { - if (! empty($r[$info])) { + if (! empty($this->release[$info])) { if ($info === 'mu_releasedate') { $ucInfo = 'Released'; - $rDate = date('Y-m-d', strtotime($r[$info])); + $rDate = date('Y-m-d', strtotime($this->release[$info])); $cData .= "
  • {$ucInfo}: {$rDate}
  • \n"; } else { $ucInfo = ucfirst(preg_replace('/^[a-z]{2}_/i', '', $info)); - $cData .= "
  • {$ucInfo}: {$r[$info]}
  • \n"; + $cData .= "
  • {$ucInfo}: {$this->release[$info]}
  • \n"; } } } diff --git a/Changelog b/Changelog index 93917abcc..2ce155cae 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-05-16 DariusIII + * Fix: Fix empty releases at bottom of browse pages * Fix: Fix category filter when searching for releases * Chg: Update release edit links in all themes * Fix: Fix movie view link from details page diff --git a/app/Http/Controllers/BrowseController.php b/app/Http/Controllers/BrowseController.php index 0cc155693..35e902ea2 100644 --- a/app/Http/Controllers/BrowseController.php +++ b/app/Http/Controllers/BrowseController.php @@ -87,11 +87,24 @@ class BrowseController extends BasePageController $rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions'], $grp); $results = $this->paginate($rslt ?? [], $rslt['_totalcount'] ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $browse = []; + + foreach ($results as $result) { + if (! empty($result->id)) { + $browse[] = $result; + } + } + $this->smarty->assign('catname', $id); $this->smarty->assign('lastvisit', $this->userdata['lastlogin']); - $this->smarty->assign('results', $results); + $this->smarty->assign( + [ + 'results' => $results, + 'resultsadd' => $browse, + ] + ); $covgroup = ''; if ($category === -1 && $grp === -1) { diff --git a/resources/views/themes/Charisma/browse.tpl b/resources/views/themes/Charisma/browse.tpl index 952d9b21e..b93622a24 100755 --- a/resources/views/themes/Charisma/browse.tpl +++ b/resources/views/themes/Charisma/browse.tpl @@ -62,7 +62,7 @@ - {if count($results) > 0} + {if count($results) > 0}
    {$results->links()}
    @@ -90,7 +90,7 @@ - {foreach $results as $result} + {foreach $resultsadd as $result} - {foreach $results as $result} + {foreach $resultsadd as $result} - {foreach $results as $result} + {foreach $resultsadd as $result}