Project

General

Profile

« Previous | Next » 

Revision 594

Added by thorn almost 17 years ago

fixed bug in news module: Dont allow comments if commenting is disabled or post or post's group is inactive

View differences:

comment.php
62 62
	define('SECTION_ID', $section_id);
63 63
	define('POST_ID', $post_id);
64 64
	define('POST_TITLE', $post_title);
65
	
66
	// don't allow commenting if its disabled, or if post or group is inactive
67
	$table_posts = TABLE_PREFIX."mod_news_posts";
68
	$table_groups = TABLE_PREFIX."mod_news_groups";
69
	$query = $database->query("
70
		SELECT p.post_id
71
		FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id
72
		WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' )
73
	");
74
	if($query->numRows() == 0) {
75
		header("Location: ".WB_URL.PAGES_DIRECTORY."");
76
		exit(0);
77
	}
78

  
65 79
	// Get page details
66 80
	$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
67 81
	if($query_page->numRows() == 0) {
......
77 91
}
78 92

  
79 93

  
80
?>
94
?>

Also available in: Unified diff