Revision 600
Added by thorn almost 18 years ago
| view.php | ||
|---|---|---|
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
// Query posts (for this page) |
| 112 |
$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql);
|
|
| 112 |
$t = time(); |
|
| 113 |
$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
|
|
| 114 |
WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra |
|
| 115 |
AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t) |
|
| 116 |
ORDER BY position DESC".$limit_sql); |
|
| 113 | 117 |
$num_posts = $query_posts->numRows(); |
| 114 | 118 |
|
| 115 | 119 |
// Create previous and next links |
| ... | ... | |
| 256 | 260 |
} |
| 257 | 261 |
|
| 258 | 262 |
// Get post info |
| 259 |
$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '".POST_ID."' AND active = '1'");
|
|
| 263 |
$t = time(); |
|
| 264 |
$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
|
|
| 265 |
WHERE post_id = '".POST_ID."' AND active = '1' |
|
| 266 |
AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t) |
|
| 267 |
"); |
|
| 260 | 268 |
if($query_post->numRows() > 0) {
|
| 261 | 269 |
$post = $query_post->fetchRow(); |
| 262 | 270 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
|
| ... | ... | |
| 282 | 290 |
$post_long = ($post['content_long']); |
| 283 | 291 |
} |
| 284 | 292 |
} else {
|
| 285 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 293 |
$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
|
|
| 286 | 294 |
exit(0); |
| 287 | 295 |
} |
| 288 | 296 |
|
| ... | ... | |
| 298 | 306 |
echo str_replace($vars, $values, $setting_post_footer); |
| 299 | 307 |
|
| 300 | 308 |
// Show comments section if we have to |
| 301 |
if($post['commenting'] == 'private' AND isset($admin) AND $admin->is_authenticated() == true OR $post['commenting'] == 'public') {
|
|
| 309 |
if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public') {
|
|
| 302 | 310 |
|
| 303 | 311 |
// Print comments header |
| 304 | 312 |
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $setting_comments_header);
|
Also available in: Unified diff
module news: added publish_until field to control the visibility of a news-posting by date and time