Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the doSearch function for getting new games on the front page #1196

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion www/components/games.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
. "</i></b></a>, by "
. htmlspecialcharx($g['author']);

if ($g['system']) echo " <div class=details>{$g['system']}</div>";
if ($g['devsys']) echo " <div class=details>{$g['devsys']}</div>";

echo "</div>";
}
Expand Down
27 changes: 13 additions & 14 deletions www/newitems.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

include_once "searchutil.php";

define("NEWITEMS_SITENEWS", 0x0001);
define("NEWITEMS_GAMES", 0x0002);
define("NEWITEMS_LISTS", 0x0004);
Expand Down Expand Up @@ -82,22 +84,19 @@ function getNewItems($db, $limit, $itemTypes = NEWITEMS_ALLITEMS, $options = [])
}

if ($itemTypes & NEWITEMS_GAMES) {
$term = "";
if ($days) $term = "added:" . $days . "d-";
$searchType = "game";
$sortby = "lnew";
$games_limit = $options['games_limit'] ?? $limit;
if ($days) $dayWhere = "created > date_sub(now(), interval $days day)";
$limit_clause = "limit $games_limit";
$browse = 0;
// query the recent games
$result = mysql_query(
"select id, title, author, `desc`, created as d,
date_format(created, '%M %e, %Y') as fmtdate,
system, pagevsn,
(coverart is not null) as hasart
from games
where $dayWhere
order by created desc
limit $games_limit", $db);
$gamecnt = mysql_num_rows($result);
for ($i = 0 ; $i < $gamecnt ; $i++) {
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$items[] = array('G', $row['d'], $row);
list($rows, $rowcnt, $sortList, $errMsg, $summaryDesc, $badges,
$specials, $specialsUsed, $orderBy) =
doSearch($db, $term, $searchType, $sortby, $limit_clause, $browse);
foreach ($rows as $row) {
$items[] = array('G', $row['createdate'], $row);
}
}

Expand Down
1 change: 1 addition & 0 deletions www/searchutil.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function doSearch($db, $term, $searchType, $sortby, $limit, $browse)
games.author as author,
games.desc as description,
games.tags as tags,
games.created as createdate,
games.moddate as moddate,
games.system as devsys,
if (time(games.published) = '00:00:00',
Expand Down