Fix games cover page

This commit is contained in:
DariusIII
2018-04-30 12:43:59 +02:00
parent ad5556de73
commit 8e74127cc1
4 changed files with 28 additions and 45 deletions
+25 -27
View File
@@ -224,20 +224,7 @@ class Games
*/
public function getGamesRange($page, $cat, array $excludedcats = [])
{
$sql = Release::query()->selectRaw("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.releases_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,
GROUP_CONCAT(df.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed")
$sql = Release::query()
->select(
[
'gi.*',
@@ -245,6 +232,20 @@ class Games
'g.name as group_name',
'gn.title as genre',
'rn.releases_id as nfoid',
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(rn.releases_id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(g.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs"),
\Illuminate\Support\Facades\DB::raw("GROUP_CONCAT(df.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed"),
]
)
->from('releases as r')
@@ -340,25 +341,22 @@ class Games
}
/**
* @return string
* @param $query
*
* @return \Illuminate\Database\Query\Builder
*/
public function getBrowseBy(): string
public function getBrowseBy($query)
{
$browseBy = ' ';
$browseByArr = $this->getBrowseByOptions();
foreach ($browseByArr as $bbk => $bbv) {
if (isset($_REQUEST[$bbk]) && ! empty($_REQUEST[$bbk])) {
$bbs = stripslashes($_REQUEST[$bbk]);
foreach ($this->getBrowseByOptions() as $bbk => $bbv) {
if (request()->has($bbk) && request()->input($bbk) !== null) {
$bbs = stripslashes(request()->input($bbk));
if ($bbk === 'year') {
$browseBy .= 'AND YEAR (gi.releasedate) '.$this->pdo->likeString($bbs, true, true);
} else {
$browseBy .= 'AND gi.'.$bbv.' '.$this->pdo->likeString($bbs, true, true);
return $query->where('gi.releasedate', 'LIKE', '%'.$bbs.'%');
}
return $query->where('gi.'.$bbv, 'LIKE', '%'.$bbs.'%');
}
}
return $browseBy;
}
/**
+1
View File
@@ -1,4 +1,5 @@
2018-04-30 DariusIII
* Fix: Fix games cover page
* Chg: Update getBrowseBy function in XXX class
* Fix: Fix XXX ordering
* Fix: Fix column and table names used in Games, Music and XXX get range functions
+1 -17
View File
@@ -38,23 +38,7 @@ class GamesController extends BasePageController
$page = $request->has('page') ? $request->input('page') : 1;
$games2 = [];
$results = $games->getGamesRange($page, $catarray, $this->userdata['categoryexclusions']);
$maxwords = 50;
foreach ($results as $result) {
if (! empty($result['review'])) {
// remove "Overview" from start of review if present
if (0 === strpos($result['review'], 'Overview')) {
$result['review'] = substr($result['review'], 8);
}
$words = explode(' ', $result['review']);
if (\count($words) > $maxwords) {
$newwords = \array_slice($words, 0, $maxwords);
$result['review'] = implode(' ', $newwords).'...';
}
}
$games2[] = $result;
}
$title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : '';
$this->smarty->assign('title', $title);
@@ -87,7 +71,7 @@ class GamesController extends BasePageController
}
}
$this->smarty->assign('results', $games2);
$this->smarty->assign('results', $results);
$meta_title = 'Browse Games';
$meta_keywords = 'browse,nzb,games,description,details';
+1 -1
View File
@@ -116,7 +116,7 @@
rel="nfo">
NFO</a>{/if}
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/browse?g={$result.group_name}"
href="{$smarty.const.WWW_TOP}/browse/group?g={$result.group_name}"
title="Browse releases in {$result.group_name|replace:"alt.binaries":"a.b"}">Group</a>
{if !empty($mfailed[$m@index])}
<span class="btn btn-default btn-xs"