Project

General

Profile

« Previous | Next » 

Revision 902

Added by aldus over 15 years ago

Add time-check to the MySQL Query inside rss.php to avoid the problems described in #609

View differences:

rss.php
76 76

  
77 77
<?php
78 78
// Get news items from database
79

  
79
$t = TIME();
80
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")";
80 81
//Query
81 82
if(isset($group_id)) {
82
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 ORDER BY posted_when DESC";
83
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC";
83 84
} else {
84
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 ORDER BY posted_when DESC";	
85
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC";	
85 86
}
86 87
$result = $database->query($query);
87 88

  

Also available in: Unified diff