Browse code

#22 fix for correct recent browse

Jimako authored on 2023/09/08 03:19:18
Showing 1 changed files
... ...
@@ -21,10 +21,11 @@
21 21
 // To read the license please visit http://www.gnu.org/copyleft/gpl.html
22 22
 // ----------------------------------------------------------------------
23 23
 if(!defined("_CHARSET")) exit( );
24
-	$output .= "<div id=\"pagetitle\">".($recentdays ? _RECENTSTORIES : _MOSTRECENT)." ".$pagelinks['rss']['link']."</div>";
25
-	
26
-	$countquery .= ($recentdays ? " AND updated > '".date("Y-m-d H:i:s", mktime(0, 0, 0, date("m")  , date("d")-$recentdays, date("Y")))."'" : "");
27
-	$query = $storyquery.($recentdays ? " AND updated > '".date("Y-m-d H:i:s", mktime(0, 0, 0, date("m")  , date("d")-$recentdays, date("Y")))."'" : "");
28
-	$query .= " ORDER BY ".(isset($_REQUEST['sort']) && $_REQUEST['sort'] == "alpha" ? "stories.title" : "updated DESC");
29
-	$numrows = search(_STORYQUERY.$query, _STORYCOUNT.$countquery, "browse.php?");
30
-?>
31 24
\ No newline at end of file
25
+
26
+$output .= "<div id=\"pagetitle\">".($recentdays ? _RECENTSTORIES : _MOSTRECENT)." ".$pagelinks['rss']['link']."</div>";
27
+
28
+$update_date = time() - $recentdays * 24 * 60 * 60;
29
+$countquery .= ($recentdays ? " AND updated > '" . $update_date . "'" : "");
30
+$query = $storyquery . ($recentdays ? " AND updated > '" . $update_date . "'" : "");
31
+$query .= " ORDER BY ".(isset($_REQUEST['sort']) && $_REQUEST['sort'] == "alpha" ? "stories.title" : "updated DESC");
32
+$numrows = search(_STORYQUERY.$query, _STORYCOUNT.$countquery, "browse.php?");