Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1156)
+++ branches/2.8.x/CHANGELOG	(revision 1157)
@@ -12,6 +12,12 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.1 -------------------------------------
+09-Oct-2009 Dietmar Woellbrink
+#	Ticket #770, #785, #792, #807, #809, 
+#	fixes and recoded news module
+09-Oct-2009 Dietmar Woellbrink
+#	Ticket #815 Fix Warning: open_basedir restriction in effect. File is in wrong directory in load_module
+#	same fix to load_template
 07-Oct-2009 Dietrich Roland Pehlke
 #	Missing contiue inside search.php to avoid access to an non-object if the query fails. (ticket #793). Thanks to Thorn.
 06-Oct-2009 Dietmar Woellbrink
Index: branches/2.8.x/wb/modules/news/info.php
===================================================================
--- branches/2.8.x/wb/modules/news/info.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/info.php	(revision 1157)
@@ -1,35 +1,35 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-$module_directory = 'news';
-$module_name = 'News';
-$module_function = 'page';
-$module_version = '2.8';
-$module_platform = '2.8';
-$module_author = 'Ryan Djurovich, Rob Smith';
-$module_license = 'GNU General Public License';
-$module_description = 'This page type is designed for making a news page.';
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+$module_directory = 'news';
+$module_name = 'News v3.1';
+$module_function = 'page';
+$module_version = '3.1';
+$module_platform = '2.8';
+$module_author = 'Ryan Djurovich, Rob Smith';
+$module_license = 'GNU General Public License';
+$module_description = 'This page type is designed for making a news page.';
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/modify_post.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify_post.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/modify_post.php	(revision 1157)
@@ -46,7 +46,7 @@
 	}
 } else {
 	$id_list=array("short","long");
-			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
+	require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
 }
 
 // include jscalendar-setup
@@ -62,7 +62,7 @@
 <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
 <input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>" />
 
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+<table class="row_a" cellpadding="2" cellspacing="0" width="100%">
 <tr>
 	<td><?php echo $TEXT['TITLE']; ?>:</td>
 	<td width="80%">
@@ -80,7 +80,7 @@
 				// Loop through groups
 				while($group = $query->fetchRow()) {
 					?>
-					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option>
+					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
 					<?php
 				}
 			}
@@ -93,8 +93,8 @@
 	<td>
 		<select name="commenting" style="width: 100%;">
 			<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
-			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
-			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
+			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
+			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
 		</select>
 	</td>
 </tr>
@@ -137,7 +137,7 @@
 <tr>
 	<td>
 	<?php
-	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
+	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","150px");
 	?>
 	</td>
 </tr>
@@ -147,7 +147,7 @@
 <tr>
 	<td>
 	<?php
-	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
+	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","350px");
 	?>
 	</td>
 </tr>
@@ -172,10 +172,12 @@
 			ifFormat    : "<?php echo $jscal_ifformat ?>",
 			button      : "publishdate_trigger",
 			firstDay    : <?php echo $jscal_firstday ?>,
-			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
+			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE)
+            { ?>
 				showsTime   : "true",
 				timeFormat  : "24",
-			<?php } ?>
+			<?php
+            } ?>
 			date        : "<?php echo $jscal_today ?>",
 			range       : [1970, 2037],
 			step        : 1
@@ -187,10 +189,12 @@
 			ifFormat    : "<?php echo $jscal_ifformat ?>",
 			button      : "enddate_trigger",
 			firstDay    : <?php echo $jscal_firstday ?>,
-			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
+			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE)
+            { ?>
 				showsTime   : "true",
 				timeFormat  : "24",
-			<?php } ?>
+			<?php
+            } ?>
 			date        : "<?php echo $jscal_today ?>",
 			range       : [1970, 2037],
 			step        : 1
@@ -215,17 +219,17 @@
 		?>
 		<tr class="row_<?php echo $row; ?>" >
 			<td width="20" style="padding-left: 5px;">
-				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
+				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
 					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
 				</a>
 			</td>	
 			<td>
-				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>">
+				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>">
 					<?php echo $comment['title']; ?>
 				</a>
 			</td>
 			<td width="20">
-				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_comment.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
+				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $post_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
 					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
 				</a>
 			</td>
@@ -245,12 +249,7 @@
 	echo $TEXT['NONE_FOUND'];
 }
 
-?>
 
-
-
-<?php
-
 // Print admin footer
 $admin->print_footer();
 
Index: branches/2.8.x/wb/modules/news/comment_page.php
===================================================================
--- branches/2.8.x/wb/modules/news/comment_page.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/comment_page.php	(revision 1157)
@@ -24,17 +24,12 @@
 */
 
 // Make sure page cannot be accessed directly
-if(!defined('WB_URL')) { 
+if(!defined('WB_URL')) {
 	header('Location: ../index.php');
 	exit(0);
 }
 
-//overwrite php.ini on Apache servers for valid SESSION ID Separator
-if(function_exists('ini_set')) {
-	ini_set('arg_separator.output', '&amp;');
-}
-
-// check if frontend.css file needs to be included into the <body></body> of page
+/* check if frontend.css file needs to be included into the <body></body> of page  */
 if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
 	echo '<style type="text/css">';
 	include(WB_PATH .'/modules/news/frontend.css');
@@ -42,10 +37,13 @@
 }
 
 // check if module language file exists for the language set by the user (e.g. DE, EN)
-if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
+if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php'))
+{
 	// no module language file exists for the language set by the user, include default module language file EN.php
 	require_once(WB_PATH .'/modules/news/languages/EN.php');
-} else {
+}
+else
+{
 	// a module language file exists for the language defined by the user, load it
 	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
 }
@@ -54,10 +52,13 @@
 
 // Get comments page template details from db
 $query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
-if($query_settings->numRows() == 0) {
+if($query_settings->numRows() == 0)
+{
 	header("Location: ".WB_URL.PAGES_DIRECTORY."");
-	exit(0);
-} else {
+	exit( 0 );
+}
+else
+{
 	$settings = $query_settings->fetchRow();
 
 	// Print comments page
@@ -93,7 +94,7 @@
 	?>:
 	<br />
 	<?php if(ENABLED_ASP) { ?>
-		<textarea name="c0mment_<?php echo date('W'); ?>" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
+		<textarea name="comment_<?php echo date('W'); ?>" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
 	<?php } else { ?>
 		<textarea name="comment" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
 	<?php } ?>
@@ -110,8 +111,8 @@
 	<tr>
 		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
 		<td><?php call_captcha(); ?></td>
-	</tr></table>
-	<br />
+	</tr>
+    </table>
 	<?php
 	if(isset($_SESSION['captcha_error'])) {
 		unset($_SESSION['captcha_error']);
@@ -120,8 +121,17 @@
 	<?php
 	}
 	?>
-	<input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />
-	</form>	
+	<table class="news-table">
+	<tr>
+	    <td>
+            <input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" />
+        </td>
+        <td>
+		    <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="history.go(-1)"  />
+        </td>
+	</tr>
+    </table>
+	</form>
 	<?php
 }
 
Index: branches/2.8.x/wb/modules/news/comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/comment.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/comment.php	(revision 1157)
@@ -1,87 +1,97 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Include config file
-require('../../config.php');
-
-// Check if there is a post id
-if(!isset($_GET['id']) OR !is_numeric($_GET['id']) OR !isset($_GET['sid']) OR !is_numeric($_GET['sid'])) {
-	header("Location: ".WB_URL.PAGES_DIRECTORY."");
-	exit(0);
-}
-$post_id = $_GET['id'];
-$section_id = $_GET['sid'];
-
-// Query post for page id
-$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
-if($query_post->numRows() == 0) {
-	header("Location: ".WB_URL.PAGES_DIRECTORY."");
-	exit(0);
-} else {
-	$fetch_post = $query_post->fetchRow();
-	$page_id = $fetch_post['page_id'];
-	$section_id = $fetch_post['section_id'];
-	$post_id = $fetch_post['post_id'];
-	$post_title = $fetch_post['title'];
-	define('SECTION_ID', $section_id);
-	define('POST_ID', $post_id);
-	define('POST_TITLE', $post_title);
-	
-	// don't allow commenting if its disabled, or if post or group is inactive
-	$t = time();
-	$table_posts = TABLE_PREFIX."mod_news_posts";
-	$table_groups = TABLE_PREFIX."mod_news_groups";
-	$query = $database->query("
-		SELECT p.post_id
-		FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id
-		WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' )
-		AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t)
-	");
-	if($query->numRows() == 0) {
-		header("Location: ".WB_URL.PAGES_DIRECTORY."");
-		exit(0);
-	}
-
-	// don't allow commenting if ASP enabled and user doesn't comes from the right view.php
-	if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID)) {
-		header("Location: ".WB_URL.PAGES_DIRECTORY."");
-		exit(0);
-	}
-
-	// Get page details
-	$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
-	if($query_page->numRows() == 0) {
-		header("Location: ".WB_URL.PAGES_DIRECTORY."");
-		exit(0);
-	} else {
-		$page = $query_page->fetchRow();
-		// Required page details
-		define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php');
-		// Include index (wrapper) file
-		require(WB_PATH.'/index.php');
-	}
-}
-
-?>
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Include config file
+require('../../config.php');
+
+// Check if there is a post id
+if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])
+    OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id']))
+{
+	header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	exit( 0 );
+}
+$post_id = $_GET['post_id'];
+$section_id = $_GET['section_id'];
+
+// Query post for page id
+$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
+if($query_post->numRows() == 0)
+{
+    header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	exit( 0 );
+}
+else
+{
+	$fetch_post = $query_post->fetchRow();
+	$page_id = $fetch_post['page_id'];
+	$section_id = $fetch_post['section_id'];
+	$post_id = $fetch_post['post_id'];
+	$post_title = $fetch_post['title'];
+	define('SECTION_ID', $section_id);
+	define('POST_ID', $post_id);
+	define('POST_TITLE', $post_title);
+
+	// don't allow commenting if its disabled, or if post or group is inactive
+	$t = time();
+	$table_posts = TABLE_PREFIX."mod_news_posts";
+	$table_groups = TABLE_PREFIX."mod_news_groups";
+	$query = $database->query("
+		SELECT p.post_id
+		FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id
+		WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' )
+		AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t)
+	");
+	if($query->numRows() == 0)
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+	}
+
+	// don't allow commenting if ASP enabled and user doesn't comes from the right view.php
+	if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID))
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+	}
+
+	// Get page details
+	$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
+	if($query_page->numRows() == 0)
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+	}
+    else
+    {
+		$page = $query_page->fetchRow();
+		// Required page details
+		define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php');
+		// Include index (wrapper) file
+		require(WB_PATH.'/index.php');
+	}
+}
+
+?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/delete.php
===================================================================
--- branches/2.8.x/wb/modules/news/delete.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/delete.php	(revision 1157)
@@ -1,53 +1,56 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Must include code to stop this file being access directly
-if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
-
-//get and remove all php files created for the news section
-$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
-if($query_details->numRows() > 0) {
-	while($link = $query_details->fetchRow()) {
-		if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
-		unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION);
-		}
-	}
-}
-//check to see if any other sections are part of the news page, if only 1 news is there delete it
-$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'");
-if($query_details->numRows() == 1) {
-	$query_details2 = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
-	$link = $query_details2->fetchRow();
-	if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
-		unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION);
-	}
-}
-
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id'");
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE section_id = '$section_id'");
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Must include code to stop this file being access directly
+if(defined('WB_PATH') == false)
+{
+  exit("Cannot access this file directly");
+}
+
+//get and remove all php files created for the news section
+$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
+if($query_details->numRows() > 0) {
+	while($link = $query_details->fetchRow()) {
+		if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
+		unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION);
+		}
+	}
+}
+//check to see if any other sections are part of the news page, if only 1 news is there delete it
+$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'");
+if($query_details->numRows() == 1) {
+	$query_details2 = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
+	$link = $query_details2->fetchRow();
+	if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
+		unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION);
+	}
+}
+
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id'");
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE section_id = '$section_id'");
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/save_post.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_post.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/save_post.php	(revision 1157)
@@ -1,126 +1,170 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-
-require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php");
-
-// Get id
-if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$id = $_POST['post_id'];
-	$post_id = $id;
-}
-
-// Include WB admin wrapper script
-$update_when_modified = true; // Tells script to update when this page was last updated
-require(WB_PATH.'/modules/admin.php');
-
-// Validate all fields
-if($admin->get_post('title') == '' AND $admin->get_post('url') == '') {
-	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$id);
-} else {
-	$title = $admin->get_post_escaped('title');
-	$short = $admin->get_post_escaped('short');
-	$long = $admin->get_post_escaped('long');
-	$commenting = $admin->get_post_escaped('commenting');
-	$active = $admin->get_post_escaped('active');
-	$old_link = $admin->get_post_escaped('link');
-	$group_id = $admin->get_post_escaped('group');
-}
-
-// Get page link URL
-$query_page = $database->query("SELECT level,link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
-$page = $query_page->fetchRow();
-$page_level = $page['level'];
-$page_link = $page['link'];
-
-// Include WB functions file
-require(WB_PATH.'/framework/functions.php');
-
-// Work-out what the link should be
-$post_link = '/posts/'.page_filename($title).PAGE_SPACER.$post_id;
-
-// Make sure the post link is set and exists
-// Make news post access files dir
-make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/');
-if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/')) {
-	$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']);
-} elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.PAGE_EXTENSION)) {
-	// We need to create a new file
-	// First, delete old file if it exists
-	if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION)) {
-		unlink(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION);
-	}
-	// Specify the filename
-	$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.PAGE_EXTENSION;
-	// The depth of the page directory in the directory hierarchy
-	// '/pages' is at depth 1
-	$pages_dir_depth=count(explode('/',PAGES_DIRECTORY))-1;
-	// Work-out how many ../'s we need to get to the index page
-	$index_location = '../';
-	for($i = 0; $i < $pages_dir_depth; $i++) {
-		$index_location .= '../';
-	}
-	// Write to the filename
-	$content = ''.
-'<?php
-$page_id = '.$page_id.';
-$section_id = '.$section_id.';
-$post_id = '.$post_id.';
-define("POST_ID", $post_id);
-require("'.$index_location.'config.php");
-require(WB_PATH."/index.php");
-?>';
-	$handle = fopen($filename, 'w');
-	fwrite($handle, $content);
-	fclose($handle);
-	change_mode($filename);
-}
-
-// get publisedwhen and publisheduntil
-$publishedwhen = jscalendar_to_timestamp($admin->get_post_escaped('publishdate'));
-if($publishedwhen == '' || $publishedwhen < 1)
-	$publishedwhen=0;
-$publisheduntil = jscalendar_to_timestamp($admin->get_post_escaped('enddate'), $publishedwhen);
-if($publisheduntil == '' || $publisheduntil < 1)
-	$publisheduntil=0;
-
-// Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', published_when = '$publishedwhen', published_until = '$publisheduntil', posted_when = '".time()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+
+require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php");
+
+// Get id
+if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id']))
+{
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit( 0 );
+}
+else
+{
+	$id = $_POST['post_id'];
+	$post_id = $id;
+}
+
+function create_file($filename, $filetime=NULL )
+{
+global $page_id, $section_id, $post_id;
+
+	// We need to create a new file
+	// First, delete old file if it exists
+	if(file_exists(WB_PATH.PAGES_DIRECTORY.$filename.PAGE_EXTENSION))
+    {
+        $filetime = isset($filetime) ? $filetime :  filectime($filename);
+		unlink(WB_PATH.PAGES_DIRECTORY.$filename.PAGE_EXTENSION);
+	}
+    else {
+        $filetime = isset($filetime) ? $filetime : time();
+    }
+	// The depth of the page directory in the directory hierarchy
+	// '/pages' is at depth 1
+	$pages_dir_depth = count(explode('/',PAGES_DIRECTORY))-1;
+	// Work-out how many ../'s we need to get to the index page
+	$index_location = '../';
+	for($i = 0; $i < $pages_dir_depth; $i++)
+    {
+		$index_location .= '../';
+	}
+
+	// Write to the filename
+	$content = ''.
+'<?php
+$page_id = '.$page_id.';
+$section_id = '.$section_id.';
+$post_id = '.$post_id.';
+define("POST_SECTION", $section_id);
+define("POST_ID", $post_id);
+require("'.$index_location.'config.php");
+require(WB_PATH."/index.php");
+?>';
+	if($handle = fopen($filename, 'w+'))
+    {
+    	fwrite($handle, $content);
+    	fclose($handle);
+        if($filetime)
+        {
+        touch($filename, $filetime);
+        }
+    	change_mode($filename);
+    }
+
+}
+
+// Include WB admin wrapper script
+$update_when_modified = true; // Tells script to update when this page was last updated
+require(WB_PATH.'/modules/admin.php');
+
+// Validate all fields
+if($admin->get_post('title') == '' AND $admin->get_post('url') == '')
+{
+	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$id);
+}
+else
+{
+	$title = $admin->get_post_escaped('title');
+	$short = $admin->get_post_escaped('short');
+	$long = $admin->get_post_escaped('long');
+	$commenting = $admin->get_post_escaped('commenting');
+	$active = $admin->get_post_escaped('active');
+	$old_link = $admin->get_post_escaped('link');
+	$group_id = $admin->get_post_escaped('group');
+}
+
+// Get page link URL
+$query_page = $database->query("SELECT level,link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
+$page = $query_page->fetchRow();
+$page_level = $page['level'];
+$page_link = $page['link'];
+
+// Include WB functions file
+require(WB_PATH.'/framework/functions.php');
+
+// Work-out what the link should be
+$post_link = '/posts/'.page_filename($title).PAGE_SPACER.$post_id;
+
+// Make sure the post link is set and exists
+// Make news post access files dir
+make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/');
+$file_create_time = '';
+if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/'))
+{
+	$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']);
+}
+elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.PAGE_EXTENSION))
+{
+	// We need to create a new file
+	// First, delete old file if it exists
+	if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION))
+    {
+        $file_create_time = filectime($old_link);
+		unlink(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION);
+	}
+
+    // Specify the filename
+    $filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.PAGE_EXTENSION;
+    create_file($filename, $file_create_time);
+}
+
+
+// get publisedwhen and publisheduntil
+$publishedwhen = jscalendar_to_timestamp($admin->get_post_escaped('publishdate'));
+if($publishedwhen == '' || $publishedwhen < 1)
+	$publishedwhen=0;
+$publisheduntil = jscalendar_to_timestamp($admin->get_post_escaped('enddate'), $publishedwhen);
+if($publisheduntil == '' || $publisheduntil < 1)
+	$publisheduntil=0;
+
+// Update row
+$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', published_when = '$publishedwhen', published_until = '$publisheduntil', posted_when = '".time()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error())
+{
+	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$id);
+}
+else
+{
+	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/install.php
===================================================================
--- branches/2.8.x/wb/modules/news/install.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/install.php	(revision 1157)
@@ -25,8 +25,8 @@
 
 if(defined('WB_URL')) {
 	
-	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_posts`");
-	$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_posts` ( '
+	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_posts`");
+	$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_posts` ( '
 					 . '`post_id` INT NOT NULL AUTO_INCREMENT,'
 					 . '`section_id` INT NOT NULL DEFAULT \'0\','
 					 . '`page_id` INT NOT NULL DEFAULT \'0\','
@@ -46,8 +46,8 @@
 					 . ' )';
 	$database->query($mod_news);
 	
-	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_groups`");
-	$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_groups` ( '
+	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_groups`");
+	$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_groups` ( '
 					 . '`group_id` INT NOT NULL AUTO_INCREMENT,'
 					 . '`section_id` INT NOT NULL DEFAULT \'0\','
 					 . '`page_id` INT NOT NULL DEFAULT \'0\','
@@ -58,8 +58,8 @@
                 . ' )';
 	$database->query($mod_news);
 	
-	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_comments`");
-	$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_comments` ( '
+	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_comments`");
+	$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_comments` ( '
 					 . '`comment_id` INT NOT NULL AUTO_INCREMENT,'
 					 . '`section_id` INT NOT NULL DEFAULT \'0\','
 					 . '`page_id` INT NOT NULL DEFAULT \'0\','
@@ -72,8 +72,8 @@
                 . ' )';
 	$database->query($mod_news);
 	
-	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_settings`");
-	$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_settings` ( '
+	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_settings`");
+	$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_settings` ( '
 					 . '`section_id` INT NOT NULL DEFAULT \'0\','
 					 . '`page_id` INT NOT NULL DEFAULT \'0\','
 					 . '`header` TEXT NOT NULL ,'
@@ -93,44 +93,51 @@
                 . ' )';
 	$database->query($mod_news);
 		
-	// Insert info into the search table
-	// Module query info
-	$field_info = array();
-	$field_info['page_id'] = 'page_id';
-	$field_info['title'] = 'page_title';
-	$field_info['link'] = 'link';
-	$field_info['description'] = 'description';
-	$field_info['modified_when'] = 'modified_when';
-	$field_info['modified_by'] = 'modified_by';
-	$field_info = serialize($field_info);
-	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')");
-	// Query start
-	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_news_posts, [TP]mod_news_groups, [TP]mod_news_comments, [TP]mod_news_settings, [TP]pages WHERE ";
-	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')");
-	// Query body
-	$query_body_code = "
-	[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\'
-	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'";
-	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')");
-	// Query end
-	$query_end_code = "";	
-	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')");
-	
-	// Insert blank row (there needs to be at least on row for the search to work)
-	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')");
-	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')");
-	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')");
-	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')");
-	
+    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'mod_wysiwyg_query'";
+    $database->query($mod_search);
+    $insert_search = $database->is_error();
+
+    if( $insert_search )
+    {
+    	// Insert info into the search table
+    	// Module query info
+    	$field_info = array();
+    	$field_info['page_id'] = 'page_id';
+    	$field_info['title'] = 'page_title';
+    	$field_info['link'] = 'link';
+    	$field_info['description'] = 'description';
+    	$field_info['modified_when'] = 'modified_when';
+    	$field_info['modified_by'] = 'modified_by';
+    	$field_info = serialize($field_info);
+    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')");
+    	// Query start
+    	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_news_posts, [TP]mod_news_groups, [TP]mod_news_comments, [TP]mod_news_settings, [TP]pages WHERE ";
+    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')");
+    	// Query body
+    	$query_body_code = "
+    	[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\'
+    	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'";
+    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')");
+    	// Query end
+    	$query_end_code = "";
+    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')");
+
+    	// Insert blank row (there needs to be at least on row for the search to work)
+    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')");
+    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')");
+    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')");
+    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')");
+    }
+
 	// Make news post access files dir
 	require_once(WB_PATH.'/framework/functions.php');
 	if(make_dir(WB_PATH.PAGES_DIRECTORY.'/posts')) {
Index: branches/2.8.x/wb/modules/news/rss.php
===================================================================
--- branches/2.8.x/wb/modules/news/rss.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/rss.php	(revision 1157)
@@ -1,102 +1,105 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Check that GET values have been supplied
-if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) {
-	$page_id = $_GET['page_id'];
-	define('PAGE_ID', $page_id);
-} else {
-	header('Location: '.WB_URL);
-	exit(0);
-}
-if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
-	$group_id = $_GET['group_id'];
-	define('GROUP_ID', $group_id);
-}
-
-// Include WB files
-require_once('../../config.php');
-require_once(WB_PATH.'/framework/class.frontend.php');
-$database = new database();
-$wb = new frontend();
-$wb->page_id = $page_id;
-$wb->get_page_details();
-$wb->get_website_settings();
-
-//checkout if a charset is defined otherwise use UTF-8
-if(defined('DEFAULT_CHARSET')) {
-	$charset=DEFAULT_CHARSET;
-} else {
-	$charset='utf-8';
-}
-
-// Sending XML header
-header("Content-type: text/xml; charset=$charset" );
-
-// Header info
-// Required by CSS 2.0
-echo '<?xml version="1.0" encoding="'.$charset.'"?>';
-?> 
-<rss version="2.0">
-<channel>
-<title><?php echo PAGE_TITLE; ?></title>
-<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link>
-<description> <?php echo PAGE_DESCRIPTION; ?></description>
-<?php
-// Optional header info 
-?>
-<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language>
-<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright>
-<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor>
-<webMaster><?php echo SERVER_EMAIL; ?></webMaster>
-<category><?php echo WEBSITE_TITLE; ?></category>
-<generator>Website Baker Content Management System</generator>
-
-<?php
-// Get news items from database
-$t = TIME();
-$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")";
-//Query
-if(isset($group_id)) {
-	$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";
-} else {
-	$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";	
-}
-$result = $database->query($query);
-
-//Generating the news items
-while($item = $result->fetchRow($result)){ ?>
-
-<item>
-<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title>
-<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description>
-<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid>
-<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link>
-</item>
-
-<?php } ?>
-
-</channel>
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Check that GET values have been supplied
+if(isset($_GET['page_id']) AND is_numeric($_GET['page_id']))
+{
+	$page_id = $_GET['page_id'];
+	define('PAGE_ID', $page_id);
+}
+else
+{
+	header('Location: '.WB_URL);
+	exit( 0 );
+}
+if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
+	$group_id = $_GET['group_id'];
+	define('GROUP_ID', $group_id);
+}
+
+// Include WB files
+require_once('../../config.php');
+require_once(WB_PATH.'/framework/class.frontend.php');
+$database = new database();
+$wb = new frontend();
+$wb->page_id = $page_id;
+$wb->get_page_details();
+$wb->get_website_settings();
+
+//checkout if a charset is defined otherwise use UTF-8
+if(defined('DEFAULT_CHARSET')) {
+	$charset=DEFAULT_CHARSET;
+} else {
+	$charset='utf-8';
+}
+
+// Sending XML header
+header("Content-type: text/xml; charset=$charset" );
+
+// Header info
+// Required by CSS 2.0
+echo '<?xml version="1.0" encoding="'.$charset.'"?>';
+?>
+<rss version="2.0">
+<channel>
+<title><?php echo PAGE_TITLE; ?></title>
+<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link>
+<description> <?php echo PAGE_DESCRIPTION; ?></description>
+<?php
+// Optional header info
+?>
+<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language>
+<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright>
+<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor>
+<webMaster><?php echo SERVER_EMAIL; ?></webMaster>
+<category><?php echo WEBSITE_TITLE; ?></category>
+<generator>Website Baker Content Management System</generator>
+
+<?php
+// Get news items from database
+$t = TIME();
+$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")";
+//Query
+if(isset($group_id)) {
+	$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";
+} else {
+	$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";
+}
+$result = $database->query($query);
+
+//Generating the news items
+while($item = $result->fetchRow($result)){ ?>
+
+<item>
+<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title>
+<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description>
+<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid>
+<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link>
+</item>
+
+<?php } ?>
+
+</channel>
 </rss>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/modify_settings.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify_settings.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/modify_settings.php	(revision 1157)
@@ -61,7 +61,8 @@
 // include the button to edit the optional module CSS files (function added with WB 2.7)
 // Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
 // Place this call outside of any <form></form> construct!!!
-if(function_exists('edit_module_css')) {
+if(function_exists('edit_module_css'))
+{
 	edit_module_css('news');
 }
 ?>
@@ -68,12 +69,13 @@
 
 <form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;">
 
-	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
+	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
+	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
 
-	<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+	<table class="row_a" cellpadding="2" cellspacing="0" width="100%">
 		<tr>
 			<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
+		</tr>
 		<tr>
 			<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
 			<td class="setting_value">
@@ -111,7 +113,7 @@
 					<option value=""><?php echo $TEXT['UNLIMITED']; ?></option>
 					<?php
 					for($i = 1; $i <= 20; $i++) {
-						if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; }
+						if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected="selected"'; } else { $selected = ''; }
 						echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>';
 					}
 					?>
@@ -119,7 +121,7 @@
 			</td>
 		</tr>
 	</table>
-	<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
+	<table class="row_a" cellpadding="2" cellspacing="0" width="100%" style="margin-top: 3px;">
 		<tr>
 			<td colspan="2"><strong><?php echo $TEXT['COMMENTS']; ?></strong></td>
 		</tr>
@@ -128,8 +130,8 @@
 			<td class="setting_value">
 				<select name="commenting" style="width: 98%;">
 					<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
-					<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
-					<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
+					<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
+					<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
 				</select>
 			</td>
 		</tr>
@@ -155,7 +157,7 @@
 					$SIZES['125'] = '125x125px';
 					$SIZES['150'] = '150x150px';
 					foreach($SIZES AS $size => $size_name) {
-						if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; }
+						if($fetch_content['resize'] == $size) { $selected = ' selected="selected"'; } else { $selected = ''; }
 						echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
 					}
 					?>
Index: branches/2.8.x/wb/modules/news/modify_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify_comment.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/modify_comment.php	(revision 1157)
@@ -46,10 +46,10 @@
 
 <form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_comment.php" method="post" style="margin: 0;">
 
-<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
-<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
-<input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>">
-<input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>">
+<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
+<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
+<input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>" />
+<input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>" />
 
 <table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
 <tr>
@@ -69,15 +69,15 @@
 <table cellpadding="0" cellspacing="0" border="0" width="100%">
 <tr>
 	<td align="left">
-		<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
+		<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
 	</td>
 	<td align="right">
-		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />
+		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />
 	</td>
 </tr>
 </table>
+</form>
 
-
 <?php
 
 // Print admin footer
Index: branches/2.8.x/wb/modules/news/move_up.php
===================================================================
--- branches/2.8.x/wb/modules/news/move_up.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/move_up.php	(revision 1157)
@@ -1,61 +1,62 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-
-// Get id
-if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
-	if(!isset($_GET['group_id']) OR !is_numeric($_GET['group_id'])) {
-		header("Location: index.php");
-		exit(0);
-	} else {
-		$id = $_GET['group_id'];
-		$id_field = 'group_id';
-		$table = TABLE_PREFIX.'mod_news_groups';
-	}
-} else {
-	$id = $_GET['post_id'];
-	$id_field = 'post_id';
-	$table = TABLE_PREFIX.'mod_news_posts';
-}
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-// Include the ordering class
-require(WB_PATH.'/framework/class.order.php');
-
-// Create new order object an reorder
-$order = new order($table, 'position', $id_field, 'section_id');
-if($order->move_up($id)) {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-} else {
-	$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+
+// Get id
+if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
+	if(!isset($_GET['group_id']) OR !is_numeric($_GET['group_id'])) {
+
+		header("Location: index.php");
+	    exit( 0 );
+	} else {
+		$id = $_GET['group_id'];
+		$id_field = 'group_id';
+		$table = TABLE_PREFIX.'mod_news_groups';
+	}
+} else {
+	$id = $_GET['post_id'];
+	$id_field = 'post_id';
+	$table = TABLE_PREFIX.'mod_news_posts';
+}
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// Include the ordering class
+require(WB_PATH.'/framework/class.order.php');
+
+// Create new order object an reorder
+$order = new order($table, 'position', $id_field, 'section_id');
+if($order->move_up($id)) {
+	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+} else {
+	$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/save_group.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_group.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/save_group.php	(revision 1157)
@@ -1,105 +1,117 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-
-// Get id
-if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$group_id = $_POST['group_id'];
-}
-
-// Include WB admin wrapper script
-$update_when_modified = true; // Tells script to update when this page was last updated
-require(WB_PATH.'/modules/admin.php');
-
-// Include WB functions file
-require(WB_PATH.'/framework/functions.php');
-
-// Vagroup_idate all fields
-if($admin->get_post('title') == '') {
-	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
-} else {
-	$title = $admin->get_post_escaped('title');
-	$active = $admin->get_post_escaped('active');
-}
-
-// Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_groups SET title = '$title', active = '$active' WHERE group_id = '$group_id'");
-
-// Check if the user uploaded an image or wants to delete one
-if(isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name'] != '') {
-	// Get real filename and set new filename
-	$filename = $_FILES['image']['name'];
-	$new_filename = WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
-	// Make sure the image is a jpg file
-	$file4=substr($filename, -4, 4);
-	if(($file4 != '.jpg')and($file4 != '.JPG')and($file4 != '.png')and($file4 != '.PNG') and ($file4 !='jpeg') and ($file4 != 'JPEG')) {
-		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG a');
-	} elseif(
-	(($_FILES['image']['type']) != 'image/jpeg' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/jpg') 
-	and
-	(($_FILES['image']['type']) != 'image/png' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/png') 
-	){
-		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG b');
-	}
-	// Make sure the target directory exists
-	make_dir(WB_PATH.MEDIA_DIRECTORY.'/.news');
-	// Upload image
-	move_uploaded_file($_FILES['image']['tmp_name'], $new_filename);
-	// Check if we need to create a thumb
-	$query_settings = $database->query("SELECT resize FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-	$fetch_settings = $query_settings->fetchRow();
-	$resize = $fetch_settings['resize'];
-	if($resize != 0) {
-		// Resize the image
-		$thumb_location = WB_PATH.MEDIA_DIRECTORY.'/.news/thumb'.$group_id.'.jpg';
-		if(make_thumb($new_filename, $thumb_location, $resize)) {
-			// Delete the actual image and replace with the resized version
-			unlink($new_filename);
-			rename($thumb_location, $new_filename);
-		}
-	}
-}
-if(isset($_POST['delete_image']) AND $_POST['delete_image'] != '') {
-	// Try unlinking image
-	if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
-		unlink(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg');
-	}
-}
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+
+// Get id
+if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']))
+{
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit( 0 );
+}
+else
+{
+	$group_id = $_POST['group_id'];
+}
+
+// Include WB admin wrapper script
+$update_when_modified = true; // Tells script to update when this page was last updated
+require(WB_PATH.'/modules/admin.php');
+
+// Include WB functions file
+require(WB_PATH.'/framework/functions.php');
+
+// Vagroup_idate all fields
+if($admin->get_post('title') == '')
+{
+	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
+}
+else
+{
+	$title = $admin->get_post_escaped('title');
+	$active = $admin->get_post_escaped('active');
+}
+
+// Update row
+$database->query("UPDATE ".TABLE_PREFIX."mod_news_groups SET title = '$title', active = '$active' WHERE group_id = '$group_id'");
+
+// Check if the user uploaded an image or wants to delete one
+if(isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name'] != '')
+{
+	// Get real filename and set new filename
+	$filename = $_FILES['image']['name'];
+	$new_filename = WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
+	// Make sure the image is a jpg file
+	$file4=substr($filename, -4, 4);
+	if(($file4 != '.jpg')and($file4 != '.JPG')and($file4 != '.png')and($file4 != '.PNG') and ($file4 !='jpeg') and ($file4 != 'JPEG'))
+    {
+		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG a');
+	} elseif(
+	(($_FILES['image']['type']) != 'image/jpeg' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/jpg')
+	and
+	(($_FILES['image']['type']) != 'image/png' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/png')
+	){
+		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG b');
+	}
+	// Make sure the target directory exists
+	make_dir(WB_PATH.MEDIA_DIRECTORY.'/.news');
+	// Upload image
+	move_uploaded_file($_FILES['image']['tmp_name'], $new_filename);
+	// Check if we need to create a thumb
+	$query_settings = $database->query("SELECT resize FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+	$fetch_settings = $query_settings->fetchRow();
+	$resize = $fetch_settings['resize'];
+	if($resize != 0)
+    {
+		// Resize the image
+		$thumb_location = WB_PATH.MEDIA_DIRECTORY.'/.news/thumb'.$group_id.'.jpg';
+		if(make_thumb($new_filename, $thumb_location, $resize))
+        {
+			// Delete the actual image and replace with the resized version
+			unlink($new_filename);
+			rename($thumb_location, $new_filename);
+		}
+	}
+}
+if(isset($_POST['delete_image']) AND $_POST['delete_image'] != '')
+{
+	// Try unlinking image
+	if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'))
+    {
+		unlink(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg');
+	}
+}
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
+} else {
+	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/view.php
===================================================================
--- branches/2.8.x/wb/modules/news/view.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/view.php	(revision 1157)
@@ -1,400 +1,533 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Must include code to stop this file being access directly
-if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
-
-// check if frontend.css file needs to be included into the <body></body> of view.php
-if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) &&  file_exists(WB_PATH .'/modules/news/frontend.css')) {
-   echo '<style type="text/css">';
-   include(WB_PATH .'/modules/news/frontend.css');
-   echo "\n</style>\n";
-} 
-
-// check if module language file exists for the language set by the user (e.g. DE, EN)
-if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
-	// no module language file exists for the language set by the user, include default module language file EN.php
-	require_once(WB_PATH .'/modules/news/languages/EN.php');
-} else {
-	// a module language file exists for the language defined by the user, load it
-	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
-}
-
-//overwrite php.ini on Apache servers for valid SESSION ID Separator
-if(function_exists('ini_set')) {
-	ini_set('arg_separator.output', '&amp;');
-}
-
-// Check if there is a start point defined
-if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) {
-	$position = $_GET['p'];
-} else {
-	$position = 0;
-}
-
-// Get user's username, display name, email, and id - needed for insertion into post info
-$users = array();
-$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
-if($query_users->numRows() > 0) {
-	while($user = $query_users->fetchRow()) {
-		// Insert user info into users array
-		$user_id = $user['user_id'];
-		$users[$user_id]['username'] = $user['username'];
-		$users[$user_id]['display_name'] = $user['display_name'];
-		$users[$user_id]['email'] = $user['email'];
-	}
-}
-
-// Get groups (title, if they are active, and their image [if one has been uploaded])
-if (isset($groups)) {
-   unset($groups);
-}
-$groups[0]['title'] = '';
-$groups[0]['active'] = true;
-$groups[0]['image'] = '';
-$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
-if($query_users->numRows() > 0) {
-	while($group = $query_users->fetchRow()) {
-		// Insert user info into users array
-		$group_id = $group['group_id'];
-		$groups[$group_id]['title'] = ($group['title']);
-		$groups[$group_id]['active'] = $group['active'];
-		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
-			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
-		} else {
-			$groups[$group_id]['image'] = '';
-		}
-	}
-}
-
-// Check if we should show the main page or a post itself
-if(!defined('POST_ID') OR !is_numeric(POST_ID)) {
-	
-	// Check if we should only list posts from a certain group
-	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
-		$query_extra = " AND group_id = '".$_GET['g']."'";
-	} else {
-		$query_extra = '';
-	}
-	
-	// Get settings
-	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-	if($query_settings->numRows() > 0) {
-		$fetch_settings = $query_settings->fetchRow();
-		$setting_header = ($fetch_settings['header']);
-		$setting_post_loop = ($fetch_settings['post_loop']);
-		$setting_footer = ($fetch_settings['footer']);
-		$setting_posts_per_page = $fetch_settings['posts_per_page'];
-	} else {
-		$setting_header = '';
-		$setting_post_loop = '';
-		$setting_footer = '';
-		$setting_posts_per_page = '';
-	}
-	
-	$t = time();
-	// Get total number of posts
-	$query_total_num = $database->query("SELECT post_id FROM ".TABLE_PREFIX."mod_news_posts
-		WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra 
-		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
-	$total_num = $query_total_num->numRows();
-
-	// Work-out if we need to add limit code to sql
-	if($setting_posts_per_page != 0) {
-		$limit_sql = " LIMIT $position,$setting_posts_per_page";
-	} else {
-		$limit_sql = "";
-	}
-	
-	// Query posts (for this page)
-	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
-		WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra
-		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
-		ORDER BY position DESC".$limit_sql);
-	$num_posts = $query_posts->numRows();
-	
-	// Create previous and next links
-	if($setting_posts_per_page != 0) {
-		if($position > 0) {
-			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
-				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&amp;g='.$_GET['g'].'">&lt;&lt; ';
-			} else {
-				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'">&lt;&lt; ';
-			}
-			$pl_append = '</a>';
-			$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
-			$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;
-		} else {
-			$previous_link = '';
-			$previous_page_link = '';
-		}
-		if($position+$setting_posts_per_page >= $total_num) {
-			$next_link = '';
-			$next_page_link = '';
-		} else {
-			if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
-				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&amp;g='.$_GET['g'].'"> ';
-			} else {
-				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
-			}
-			$nl_append = ' &gt;&gt;</a>';
-			$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
-			$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
-		}
-		if($position+$setting_posts_per_page > $total_num) {
-			$num_of = $position+$num_posts;
-		} else {
-			$num_of = $position+$setting_posts_per_page;
-		}
-		$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;
-		$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;
-		$display_previous_next_links = '';
-	} else {
-		$display_previous_next_links = 'none';
-	}
-
-	if ($num_posts === 0) {
-		$setting_header = '';
-		$setting_post_loop = '';
-		$setting_footer = '';
-		$setting_posts_per_page = '';
-
-	}
-
-	// Print header
-	if($display_previous_next_links == 'none') {
-		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_header);
-	} else {
-		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
-	}
-	
-	if($num_posts > 0) {
-		if($query_extra != '') {
-			?>
-			<div class="selected_group_title">
-				<?php echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
-			</div>
-			<?php
-		}
-		while($post = $query_posts->fetchRow()) {
-			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
-				$uid = $post['posted_by']; // User who last modified the post
-				// Workout date and time of last modified post
-				if ($post['published_when'] === '0') $post['published_when'] = time();
-				if ($post['published_when'] > $post['posted_when']) {
-					$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
-					$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
-				} else {
-					$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
-					$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
-				}
-				$publ_date = date(DATE_FORMAT,$post['published_when']);
-				$publ_time = date(TIME_FORMAT,$post['published_when']);
-				// Work-out the post link
-				$post_link = page_link($post['link']);
-				if(isset($_GET['p']) AND $position > 0) {
-					$post_link .= '?p='.$position;
-				}
-				if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
-					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; }
-					$post_link .= 'g='.$_GET['g'];
-				}
-				// Get group id, title, and image
-				$group_id = $post['group_id'];
-				$group_title = $groups[$group_id]['title'];
-				$group_image = $groups[$group_id]['image'];
-				$display_image = ($group_image == '') ? "none" : "inherit";
-				$display_group = ($group_id == 0) ? 'none' : 'inherit'; 
-				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
-				// Replace [wblink--PAGE_ID--] with real link
-				$short = ($post['content_short']);
-				$wb->preprocess($short);
-				// Replace vars with values
-				$post_long_len = strlen($post['content_long']);
-				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
-				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
-					if($post_long_len < 9) {
-						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'none');
-					} else {
-						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible');
-					}
-				} else {
-					if($post_long_len < 9) {
-						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', '','none');
-					} else {
-						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible');
-					}
-				}
-				echo str_replace($vars, $values, $setting_post_loop);
-			}
-		}
-	}
-	
-	// Print footer
-	if($display_previous_next_links == 'none') {
-		echo  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer);
-	} else {
-		echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer);
-	}
-	
-} elseif(defined('POST_ID') AND is_numeric(POST_ID)) {
-	
-	// Get settings
-	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-	if($query_settings->numRows() > 0) {
-		$fetch_settings = $query_settings->fetchRow();
-		$setting_post_header = ($fetch_settings['post_header']);
-		$setting_post_footer = ($fetch_settings['post_footer']);
-		$setting_comments_header = ($fetch_settings['comments_header']);
-		$setting_comments_loop = ($fetch_settings['comments_loop']);
-		$setting_comments_footer = ($fetch_settings['comments_footer']);
-	} else {
-		$setting_post_header = '';
-		$setting_post_footer = '';
-		$setting_comments_header = '';
-		$setting_comments_loop = '';
-		$setting_comments_footer = '';
-	}
-	
-	// Get page info
-	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
-	if($query_page->numRows() > 0) {
-		$page = $query_page->fetchRow();
-		$page_link = page_link($page['link']);
-		if(isset($_GET['p']) AND $position > 0) {
-			$page_link .= '?p='.$_GET['p'];
-		}
-		if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
-			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
-			$page_link .= 'g='.$_GET['g'];
-		}
-	} else {
-		exit('Page not found');
-	}
-	
-	// Get post info
-	$t = time();
-	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
-		WHERE post_id = '".POST_ID."' AND active = '1'
-		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
-	");
-	if($query_post->numRows() > 0) {
-		$post = $query_post->fetchRow();
-		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
-			$uid = $post['posted_by']; // User who last modified the post
-			// Workout date and time of last modified post
-			if ($post['published_when'] === '0') $post['published_when'] = time();
-			if ($post['published_when'] > $post['posted_when']) {
-				$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
-				$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
-			} else {
-				$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
-				$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
-			}
-			$publ_date = date(DATE_FORMAT,$post['published_when']);
-			$publ_time = date(TIME_FORMAT,$post['published_when']);
-			// Get group id, title, and image
-			$group_id = $post['group_id'];
-			$group_title = $groups[$group_id]['title'];
-			$group_image = $groups[$group_id]['image'];
-			$display_image = ($group_image == '') ? "none" : "inherit";
-			$display_group = ($group_id == 0) ? 'none' : 'inherit'; 
-			if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
-			$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[TEXT_BACK]', '[TEXT_LAST_CHANGED]', '[MODI_DATE]', '[TEXT_AT]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
-			$post_short=$post['content_short'];
-			$wb->preprocess($post_short);
-			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
-				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);
-			} else {
-				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');
-			}
-			$post_long = ($post['content_long']);
-		}
-	} else {
-		$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
-		exit(0);
-	}
-	
-	// Print post header
-	echo str_replace($vars, $values, $setting_post_header);
-	
-	// Replace [wblink--PAGE_ID--] with real link
-  	$wb->preprocess($post_long);
-	// Print long
-	echo $post_long;
-	
-	// Print post footer
-	echo str_replace($vars, $values, $setting_post_footer);
-	
-	// Show comments section if we have to
-	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public') {
-		
-		// Print comments header
-		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
-		$values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&amp;sid='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
-		echo str_replace($vars, $values, $setting_comments_header);
-		
-		// Query for comments
-		$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
-		if($query_comments->numRows() > 0) {
-			while($comment = $query_comments->fetchRow()) {
-				// Display Comments without slashes, but with new-line characters
-				$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
-				$comment['title'] = $wb->strip_slashes($comment['title']);
-				// Print comments loop
-				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
-				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
-				$uid = $comment['commented_by'];
-				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
-				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
-					$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
-				} else {
-					$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
-				}
-				echo str_replace($vars, $values, $setting_comments_loop);
-			}
-		} else {
-			// Say no comments found
-			$content = '';
-			if(isset($TEXT['NONE_FOUND'])) {
-				$content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';
-			} else {
-				$content .= '<tr><td>None Found<br /></td></tr>';
-			}
-			echo $content;
-		}
-		
-		// Print comments footer
-		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
-		$values = array(WB_URL.'/modules/news/comment.php?id='.POST_ID.'&amp;sid='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
-		echo str_replace($vars, $values, $setting_comments_footer);
-	}
-	if(ENABLED_ASP) {
-		$_SESSION['comes_from_view'] = POST_ID;
-		$_SESSION['comes_from_view_time'] = time();
-	}
-}
-
+<?php
+
+// $Id$
+
+/**
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Must include code to stop this file being access directly
+if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
+
+// load module language file
+$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
+
+//overwrite php.ini on Apache servers for valid SESSION ID Separator
+if(function_exists('ini_set')) {
+	ini_set('arg_separator.output', '&amp;');
+}
+
+// Check if there is a start point defined
+if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0)
+{
+	$position = $_GET['p'];
+}
+else
+{
+	$position = 0;
+}
+
+// Get user's username, display name, email, and id - needed for insertion into post info
+$users = array();
+$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users");
+if($query_users->numRows() > 0)
+{
+	while($user = $query_users->fetchRow())
+    {
+		// Insert user info into users array
+		$user_id = $user['user_id'];
+		$users[$user_id]['username'] = $user['username'];
+		$users[$user_id]['display_name'] = $user['display_name'];
+		$users[$user_id]['email'] = $user['email'];
+	}
+}
+// Get groups (title, if they are active, and their image [if one has been uploaded])
+if (isset($groups))
+{
+   unset($groups);
+}
+
+$groups[0]['title'] = '';
+$groups[0]['active'] = true;
+$groups[0]['image'] = '';
+
+$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
+if($query_users->numRows() > 0)
+{
+	while($group = $query_users->fetchRow())
+    {
+		// Insert user info into users array
+		$group_id = $group['group_id'];
+		$groups[$group_id]['title'] = ($group['title']);
+		$groups[$group_id]['active'] = $group['active'];
+		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'))
+        {
+			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
+		}
+        else
+        {
+			$groups[$group_id]['image'] = '';
+		}
+	}
+}
+
+
+
+// Check if we should show the main page or a post itself
+if(!defined('POST_ID') OR !is_numeric(POST_ID))
+{
+
+	// Check if we should only list posts from a certain group
+	if(isset($_GET['g']) AND is_numeric($_GET['g']))
+    {
+		$query_extra = " AND group_id = '".$_GET['g']."'";
+	}
+    else
+    {
+		$query_extra = '';
+	}
+
+	// Check if we should only list posts from a certain group
+	if(isset($_GET['g']) AND is_numeric($_GET['g']))
+    {
+		$query_extra = " AND group_id = '".$_GET['g']."'";
+	}
+    else
+    {
+		$query_extra = '';
+	}
+
+	// Get settings
+	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+	if($query_settings->numRows() > 0)
+    {
+		$fetch_settings = $query_settings->fetchRow();
+		$setting_header = ($fetch_settings['header']);
+		$setting_post_loop = ($fetch_settings['post_loop']);
+		$setting_footer = ($fetch_settings['footer']);
+		$setting_posts_per_page = $fetch_settings['posts_per_page'];
+	}
+    else
+    {
+		$setting_header = '';
+		$setting_post_loop = '';
+		$setting_footer = '';
+		$setting_posts_per_page = '';
+	}
+
+	$t = time();
+	// Get total number of posts
+	$query_total_num = $database->query("SELECT post_id, section_id FROM ".TABLE_PREFIX."mod_news_posts
+		WHERE section_id = '$section_id' AND active = '1' AND title != '' $query_extra
+		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)");
+	$total_num = $query_total_num->numRows();
+
+	// Work-out if we need to add limit code to sql
+	if($setting_posts_per_page != 0)
+    {
+		$limit_sql = " LIMIT $position, $setting_posts_per_page";
+	}
+    else
+    {
+		$limit_sql = "";
+	}
+
+	// Query posts (for this page)
+	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
+		WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra
+		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
+		ORDER BY position DESC".$limit_sql);
+	$num_posts = $query_posts->numRows();
+
+	// Create previous and next links
+	if($setting_posts_per_page != 0)
+    {
+		if($position > 0)
+        {
+			if(isset($_GET['g']) AND is_numeric($_GET['g']))
+            {
+				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&amp;g='.$_GET['g'].'">&lt;&lt; ';
+			}
+            else
+            {
+				$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'">&lt;&lt; ';
+			}
+			$pl_append = '</a>';
+			$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append;
+			$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append;
+		}
+        else
+        {
+			$previous_link = '';
+			$previous_page_link = '';
+		}
+		if($position + $setting_posts_per_page >= $total_num)
+        {
+			$next_link = '';
+			$next_page_link = '';
+		}
+        else
+        {
+			if(isset($_GET['g']) AND is_numeric($_GET['g']))
+            {
+				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&amp;g='.$_GET['g'].'"> ';
+			}
+            else
+            {
+				$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> ';
+			}
+			$nl_append = ' &gt;&gt;</a>';
+			$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append;
+			$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append;
+		}
+		if($position+$setting_posts_per_page > $total_num)
+        {
+			$num_of = $position+$num_posts;
+		}
+        else
+        {
+			$num_of = $position+$setting_posts_per_page;
+		}
+
+		$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num;
+		$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num;
+		$display_previous_next_links = '';
+	}
+    else
+    {
+		$display_previous_next_links = 'none';
+	}
+
+	if ($num_posts === 0)
+    {
+		$setting_header = '';
+		$setting_post_loop = '';
+		$setting_footer = '';
+		$setting_posts_per_page = '';
+	}
+
+	// Print header
+	if($display_previous_next_links == 'none')
+    {
+		print  str_replace( array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
+                            array('','','','','','', $display_previous_next_links), $setting_header);
+	}
+    else
+    {
+		print str_replace(  array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'),
+                            array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header);
+	}
+	if($num_posts > 0)
+    {
+		if($query_extra != '')
+        {
+			?>
+			<div class="selected-group-title">
+				<?php print '<a href="'.htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
+			</div>
+			<?php
+		}
+		while($post = $query_posts->fetchRow())
+        {
+			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
+            { // Make sure parent group is active
+				$uid = $post['posted_by']; // User who last modified the post
+				// Workout date and time of last modified post
+				if ($post['published_when'] === '0') $post['published_when'] = time();
+				if ($post['published_when'] > $post['posted_when'])
+                {
+					$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
+					$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
+				}
+                else
+                {
+					$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
+					$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+				}
+
+				$publ_date = date(DATE_FORMAT,$post['published_when']);
+				$publ_time = date(TIME_FORMAT,$post['published_when']);
+
+				// Work-out the post link
+				$post_link = page_link($post['link']);
+
+                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
+                if(file_exists($post_link_path))
+                {
+    				$create_date = date(DATE_FORMAT, filectime ( $post_link_path ));
+    				$create_time = date(TIME_FORMAT, filectime ( $post_link_path ));
+                }
+                else
+                {
+                    $create_date = $publ_date;
+                    $create_time = $publ_time;
+                }
+
+				if(isset($_GET['p']) AND $position > 0)
+                {
+					$post_link .= '?p='.$position;
+				}
+				if(isset($_GET['g']) AND is_numeric($_GET['g']))
+                {
+					if(isset($_GET['p']) AND $position > 0) { $post_link .= '&amp;'; } else { $post_link .= '?'; }
+                    {
+					$post_link .= 'g='.$_GET['g'];
+                    }
+				}
+
+				// Get group id, title, and image
+				$group_id = $post['group_id'];
+				$group_title = $groups[$group_id]['title'];
+				$group_image = $groups[$group_id]['image'];
+				$display_image = ($group_image == '') ? "none" : "inherit";
+				$display_group = ($group_id == 0) ? 'none' : 'inherit';
+
+				if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
+
+				// Replace [wblink--PAGE_ID--] with real link
+				$short = ($post['content_short']);
+				$wb->preprocess($short);
+
+				// Replace vars with values
+				$post_long_len = strlen($post['content_long']);
+				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]','[SHOW_READ_MORE]');
+				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
+                {
+					if($post_long_len < 9)
+                    {
+						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'none');
+					}
+                    else
+                    {
+					   	$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $MOD_NEWS['TEXT_READ_MORE'], 'visible');
+					}
+				}
+                else
+                {
+					if($post_long_len < 9)
+                    {
+						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;', $post_date, $post_time, $publ_date, $publ_time, '', '', '', '', '','none');
+					}
+                    else
+                    {
+						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', $MOD_NEWS['TEXT_READ_MORE'],'visible');
+					}
+				}
+				print str_replace($vars, $values, $setting_post_loop);
+			}
+		}
+	}
+    // Print footer
+    if($display_previous_next_links == 'none')
+    {
+    	print  str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer);
+    }
+    else
+    {
+    	print str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer);
+    }
+
+}
+elseif(defined('POST_ID') AND is_numeric(POST_ID))
+{
+
+  // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
+  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
+  {
+	// Get settings
+	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+	if($query_settings->numRows() > 0)
+    {
+		$fetch_settings = $query_settings->fetchRow();
+		$setting_post_header = ($fetch_settings['post_header']);
+		$setting_post_footer = ($fetch_settings['post_footer']);
+		$setting_comments_header = ($fetch_settings['comments_header']);
+		$setting_comments_loop = ($fetch_settings['comments_loop']);
+		$setting_comments_footer = ($fetch_settings['comments_footer']);
+	} else
+    {
+		$setting_post_header = '';
+		$setting_post_footer = '';
+		$setting_comments_header = '';
+		$setting_comments_loop = '';
+		$setting_comments_footer = '';
+    }
+	// Get page info
+	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'");
+	if($query_page->numRows() > 0)
+    {
+		$page = $query_page->fetchRow();
+		$page_link = page_link($page['link']);
+		if(isset($_GET['p']) AND $position > 0)
+        {
+			$page_link .= '?p='.$_GET['p'];
+		}
+		if(isset($_GET['g']) AND is_numeric($_GET['g']))
+        {
+			if(isset($_GET['p']) AND $position > 0) { $page_link .= '&amp;'; } else { $page_link .= '?'; }
+			$page_link .= 'g='.$_GET['g'];
+		}
+	}
+    else
+    {
+		exit($MESSAGE['PAGES']['NOT_FOUND']);
+	}
+
+	// Get post info
+	$t = time();
+	$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
+		WHERE post_id = '".POST_ID."' AND active = '1'
+		AND (published_when = '0' OR published_when <= $t) AND (published_until = 0 OR published_until >= $t)
+	");
+
+	if($query_post->numRows() > 0)
+    {
+		$post = $query_post->fetchRow();
+		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
+        { // Make sure parent group is active
+			$uid = $post['posted_by']; // User who last modified the post
+			// Workout date and time of last modified post
+			if ($post['published_when'] === '0') $post['published_when'] = time();
+			if ($post['published_when'] > $post['posted_when'])
+            {
+				$post_date = gmdate(DATE_FORMAT, $post['published_when']+TIMEZONE);
+				$post_time = gmdate(TIME_FORMAT, $post['published_when']+TIMEZONE);
+			}
+            else
+            {
+				$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
+				$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+			}
+
+			$publ_date = date(DATE_FORMAT,$post['published_when']);
+			$publ_time = date(TIME_FORMAT,$post['published_when']);
+
+				// Work-out the post link
+				$post_link = page_link($post['link']);
+
+                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
+                if(file_exists($post_link_path))
+                {
+    				$create_date = date(DATE_FORMAT, filectime ( $post_link_path ));
+    				$create_time = date(TIME_FORMAT, filectime ( $post_link_path ));
+                }
+                else
+                {
+                    $create_date = $publ_date;
+                    $create_time = $publ_time;
+                }
+			// Get group id, title, and image
+			$group_id = $post['group_id'];
+			$group_title = $groups[$group_id]['title'];
+			$group_image = $groups[$group_id]['image'];
+			$display_image = ($group_image == '') ? "none" : "inherit";
+			$display_group = ($group_id == 0) ? 'none' : 'inherit';
+
+			if ($group_image != "") $group_image= "<img src='".$group_image."' alt='".$group_title."' />";
+
+			$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[TEXT_BACK]', '[TEXT_LAST_CHANGED]', '[MODI_DATE]', '[TEXT_AT]', '[MODI_TIME]', '[CREATED_DATE]', '[CREATED_TIME]', '[PUBLISHED_DATE]', '[PUBLISHED_TIME]', '[TEXT_POSTED_BY]', '[TEXT_ON]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
+			$post_short=$post['content_short'];
+			$wb->preprocess($post_short);
+			if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '')
+            {
+				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'],$post_date, $MOD_NEWS['TEXT_AT'], $post_time, $create_date, $create_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);
+			}
+            else
+            {
+				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $MOD_NEWS['TEXT_BACK'], $MOD_NEWS['TEXT_LAST_CHANGED'], $post_date, $MOD_NEWS['TEXT_AT'], $post_time, $create_date, $create_time, $publ_date, $publ_time, $MOD_NEWS['TEXT_POSTED_BY'], $MOD_NEWS['TEXT_ON'], '', '', '', '');
+			}
+
+			$post_long = ($post['content_long']);
+		}
+	}
+    else
+    {
+	    	$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], "javascript: history.go(-1);", false);
+	    	exit(0);
+	}
+
+	// Print post header
+	print str_replace($vars, $values, $setting_post_header);
+
+	// Replace [wblink--PAGE_ID--] with real link
+  	$wb->preprocess($post_long);
+	// Print long
+	print $post_long;
+
+	// Print post footer
+	print str_replace($vars, $values, $setting_post_footer);
+
+	// Show comments section if we have to
+	if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
+    {
+		// Print comments header
+		$vars = array('[ADD_COMMENT_URL]','[TEXT_COMMENTS]');
+		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
+		print str_replace($vars, $values, $setting_comments_header);
+
+		// Query for comments
+		$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
+		if($query_comments->numRows() > 0) {
+			while($comment = $query_comments->fetchRow()) {
+				// Display Comments without slashes, but with new-line characters
+				$comment['comment'] = nl2br($wb->strip_slashes($comment['comment']));
+				$comment['title'] = $wb->strip_slashes($comment['title']);
+				// Print comments loop
+				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
+				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
+				$uid = $comment['commented_by'];
+				$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
+				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
+					$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
+				} else {
+					$values = array(($comment['title']), ($comment['comment']), $MOD_NEWS['TEXT_ON'], $commented_date, $MOD_NEWS['TEXT_AT'], $commented_time, $MOD_NEWS['TEXT_BY'], '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
+				}
+				print str_replace($vars, $values, $setting_comments_loop);
+			}
+		} else {
+			// Say no comments found
+			$content = '';
+			if(isset($TEXT['NONE_FOUND'])) {
+				$content .= '<tr><td>'.$TEXT['NONE_FOUND'].'<br /></td></tr>';
+			}
+            else
+            {
+				$content .= '<tr><td>None Found<br /></td></tr>';
+			}
+			print $content;
+		}
+
+		// Print comments footer
+		$vars = array('[ADD_COMMENT_URL]','[TEXT_ADD_COMMENT]');
+		$values = array(WB_URL.'/modules/news/comment.php?post_id='.POST_ID.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_ADD_COMMENT']);
+		print str_replace($vars, $values, $setting_comments_footer);
+
+	}
+
+}
+
+	if(ENABLED_ASP) {
+		$_SESSION['comes_from_view'] = POST_ID;
+		$_SESSION['comes_from_view_time'] = time();
+	}
+
+}
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/languages/DE.php
===================================================================
--- branches/2.8.x/wb/modules/news/languages/DE.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/languages/DE.php	(revision 1157)
@@ -1,44 +1,45 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-//Modul Description
-$module_description = 'Mit diesem Modul k&ouml;nnen sie eine News Seite ihrer Seite hinzuf&uuml;gen.';
-
-//Variables for the backend
-$MOD_NEWS['SETTINGS'] = 'News Einstellungen';
-
-//Variables for the frontend
-$MOD_NEWS['TEXT_READ_MORE'] = 'Weiterlesen';
-$MOD_NEWS['TEXT_POSTED_BY'] = 'Ver&ouml;ffentlicht von';
-$MOD_NEWS['TEXT_ON'] = 'am';
-$MOD_NEWS['TEXT_LAST_CHANGED'] = 'Zuletzt ge&auml;ndert am';
-$MOD_NEWS['TEXT_AT'] = 'um';
-$MOD_NEWS['TEXT_BACK'] = 'Zur&uuml;ck';
-$MOD_NEWS['TEXT_COMMENTS'] = 'Kommentare';
-$MOD_NEWS['TEXT_COMMENT'] = 'Kommentar';
-$MOD_NEWS['TEXT_ADD_COMMENT'] = 'Kommentar hinzuf&uuml;gen';
-$MOD_NEWS['TEXT_BY'] = 'von';
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+//Modul Description
+$module_description = 'Mit diesem Modul k&ouml;nnen sie eine News Seite ihrer Seite hinzuf&uuml;gen.';
+
+//Variables for the backend
+$MOD_NEWS['SETTINGS'] = 'News Einstellungen';
+
+//Variables for the frontend
+$MOD_NEWS['TEXT_READ_MORE'] = 'Weiterlesen';
+$MOD_NEWS['TEXT_POSTED_BY'] = 'Ver&ouml;ffentlicht von';
+$MOD_NEWS['TEXT_ON'] = 'am';
+$MOD_NEWS['TEXT_LAST_CHANGED'] = 'Zuletzt ge&auml;ndert am';
+$MOD_NEWS['TEXT_AT'] = 'um';
+$MOD_NEWS['TEXT_BACK'] = 'Zur&uuml;ck';
+$MOD_NEWS['TEXT_COMMENTS'] = 'Kommentare';
+$MOD_NEWS['TEXT_COMMENT'] = 'Kommentar';
+$MOD_NEWS['TEXT_ADD_COMMENT'] = 'Kommentar hinzuf&uuml;gen';
+$MOD_NEWS['TEXT_BY'] = 'von';
+$MOD_NEWS['PAGE_NOT_FOUND'] = 'Seite nicht gefunden';
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/frontend.css
===================================================================
--- branches/2.8.x/wb/modules/news/frontend.css	(revision 1156)
+++ branches/2.8.x/wb/modules/news/frontend.css	(revision 1157)
@@ -1,49 +1,56 @@
-.post_title, .post_date {
+.captcha-table,
+.captcha_table,
+.news-table {
+	border: 0px;
+}
+
+.post_title, .post_date,
+.post-title, .post-date {
 	border-bottom: 1px solid #DDDDDD;
 }
-
-.post_title {
+.post_title,
+.post-title {
 	font-weight: bold;
 	font-size: 12px;
 	color: #000000;
 }
-
-.post_date {
+.post_date,
+.post-date {
 	text-align: right;
 	font-weight: bold;
 }
-
-.post_short {
+.post_short,
+.post-short {
 	text-align: justify;
 	padding-bottom: 5px;
 }
-
-.comment_title {
+.comment_title,
+.comment-title {
 	font-weight: bold;
 }
-
-.comment_text {
-	font-weight: bold;
+.comment_text,
+.comment-text {
+	font-weight: normal;
 	background-color: #FDFDFD;
 	border-bottom: 1px solid #DDDDDD;
 	padding-bottom: 15px;
 }
-
-.comment_title, .comment-text {
+.comment_title, .comment_text,
+.comment-title, .comment-text {
 	border-left: 1px solid #DDDDDD;
 }
-
-.comment_info {
+.comment_info,
+.comment-info {
 	text-align: right;
 	border-right: 1px solid #DDDDDD;
 }
-
-.comment_title, .comment_info {
+.comment_title, .comment_info,
+.comment-title, .comment-info {
 	border-top: 1px solid #DDDDDD;
 	background-color: #EEEEEE;
 }
-
-.selected_group_title { 
+.selected_group_title,
+.selected-group-title { 
 	font-size: 14px;
 	text-align: center;
 }
@@ -51,37 +58,39 @@
 .nixhier {
 	display:none;
 }
-
+.loop_header,
 .loop-header {
 	width: 100%;
 }
-
+.page_header,
 .page-header {
 	width: 100%;	
 }
+.post_header,
 .post-header {
 	width: 100%;	
 }
-
+.page_left,
 .page-left {
 	text-align: left;	
 }
+.page_center,
 .page-center {
 	text-align: center;
 }
-
+.page_right,
 .page-right {
 	text-align: right;	
 }
-
+.comment_header,
 .comment-header {
 	width: 100%;
 }
-
+.public_info,
 .public-info {
 	text-align: right;
 }
-
+.group_page,
 .group-page {
 	text-align: center;
 }
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/save_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_comment.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/save_comment.php	(revision 1157)
@@ -1,62 +1,72 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-
-// Get id
-if(!isset($_POST['comment_id']) OR !is_numeric($_POST['comment_id']) OR !isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$comment_id = $_POST['comment_id'];
-}
-
-// Include WB admin wrapper script
-$update_when_modified = true; // Tells script to update when this page was last updated
-require(WB_PATH.'/modules/admin.php');
-
-// Validate all fields
-if($admin->get_post('title') == '' AND $admin->get_post('comment') == '') {
-	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'comment_id='.$id);
-} else {
-	$title = strip_tags($admin->get_post_escaped('title'));
-	$comment = strip_tags($admin->get_post_escaped('comment'));
-	$post_id = $admin->get_post('post_id');
-}
-
-// Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_comments SET title = '$title', comment = '$comment' WHERE comment_id = '$comment_id'");
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'&comment_id='.$id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+
+// Get id
+if(!isset($_POST['comment_id']) OR !is_numeric($_POST['comment_id']) OR !isset($_POST['post_id']) OR !is_numeric($_POST['post_id']))
+{
+
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit( 0 );
+}
+else
+{
+	$comment_id = $_POST['comment_id'];
+}
+
+// Include WB admin wrapper script
+$update_when_modified = true; // Tells script to update when this page was last updated
+require(WB_PATH.'/modules/admin.php');
+
+// Validate all fields
+if($admin->get_post('title') == '' AND $admin->get_post('comment') == '')
+{
+	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'comment_id='.$id);
+}
+else
+{
+	$title = strip_tags($admin->get_post_escaped('title'));
+	$comment = strip_tags($admin->get_post_escaped('comment'));
+	$post_id = $admin->get_post('post_id');
+}
+
+// Update row
+$database->query("UPDATE ".TABLE_PREFIX."mod_news_comments SET title = '$title', comment = '$comment' WHERE comment_id = '$comment_id'");
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error())
+{
+	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'&comment_id='.$id);
+}
+else
+{
+	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/delete_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/delete_comment.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/delete_comment.php	(revision 1157)
@@ -1,61 +1,71 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-
-// Get id
-if(!isset($_GET['comment_id']) OR !is_numeric($_GET['comment_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$comment_id = $_GET['comment_id'];
-}
-
-// Get post id
-if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$post_id = $_GET['post_id'];
-}
-
-// Include WB admin wrapper script
-$update_when_modified = true; // Tells script to update when this page was last updated
-require(WB_PATH.'/modules/admin.php');
-
-// Update row
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments  WHERE comment_id = '$comment_id'");
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+
+// Get id
+if(!isset($_GET['comment_id']) OR !is_numeric($_GET['comment_id'])) {
+
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit( 0 );
+}
+else
+{
+	$comment_id = $_GET['comment_id'];
+}
+
+// Get post id
+if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id']))
+{
+
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit( 0 );
+}
+else
+{
+	$post_id = $_GET['post_id'];
+}
+
+// Include WB admin wrapper script
+$update_when_modified = true; // Tells script to update when this page was last updated
+require(WB_PATH.'/modules/admin.php');
+
+// Update row
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments  WHERE comment_id = '$comment_id'");
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error())
+{
+	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
+}
+else
+{
+	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/submit_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/submit_comment.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/submit_comment.php	(revision 1157)
@@ -1,118 +1,161 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Include config file
-require('../../config.php');
-
-//overwrite php.ini on Apache servers for valid SESSION ID Separator
-if(function_exists('ini_set')) {
-	ini_set('arg_separator.output', '&amp;');
-}
-
-require_once(WB_PATH.'/framework/class.wb.php');
-$wb = new wb;
-
-// Check if we should show the form or add a comment
-if(isset($_GET['page_id']) AND is_numeric($_GET['page_id']) AND isset($_GET['section_id']) AND is_numeric($_GET['section_id']) AND isset($_GET['post_id']) AND is_numeric($_GET['post_id'])
-	AND (( ENABLED_ASP AND isset($_POST['c0mment_'.date('W')]) AND $_POST['c0mment_'.date('W')] != '')
-		OR  (!ENABLED_ASP AND isset($_POST['comment']) AND $_POST['comment'] != ''))
-) {
-	
-	if(ENABLED_ASP)
-		$comment = $_POST['c0mment_'.date('W')];
-	else
-		$comment = $_POST['comment'];
-	$comment = $wb->add_slashes(strip_tags($comment));
-	$title = $wb->add_slashes(strip_tags($_POST['title']));
-	$page_id = $_GET['page_id'];
-	$section_id = $_GET['section_id'];
-	$post_id = $_GET['post_id'];
-
-	// Check captcha
-	$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-	if($query_settings->numRows() == 0) { 
-		exit(header("Location: ".WB_URL.PAGES_DIRECTORY.""));
-	} else {
-		$settings = $query_settings->fetchRow();
-		$t=time();
-		if(ENABLED_ASP && ( // Advanced Spam Protection
-			($_SESSION['session_started']+ASP_SESSION_MIN_AGE > $t) OR // session too young
-			(!isset($_SESSION['comes_from_view'])) OR // user doesn't come from view.php
-			(!isset($_SESSION['comes_from_view_time']) OR $_SESSION['comes_from_view_time'] > $t-ASP_VIEW_MIN_AGE) OR // user is too fast
-			(!isset($_SESSION['submitted_when']) OR !isset($_POST['submitted_when'])) OR // faked form
-			($_SESSION['submitted_when'] != $_POST['submitted_when']) OR // faked form
-			($_SESSION['submitted_when'] > $t-ASP_INPUT_MIN_AGE && !isset($_SESSION['captcha_retry_news'])) OR // user too fast
-			($_SESSION['submitted_when'] < $t-43200) OR // form older than 12h
-			($_POST['email'] OR $_POST['url'] OR $_POST['homepage'] OR $_POST['comment']) // honeypot-fields
-		)) {
-			exit(header("Location: ".WB_URL.PAGES_DIRECTORY.""));
-		}
-		if(ENABLED_ASP) {
-			if(isset($_SESSION['captcha_retry_news'])) unset($_SESSION['captcha_retry_news']);
-		}
-		if($settings['use_captcha']) {
-			if(isset($_POST['captcha']) AND $_POST['captcha'] != '') {
-				// Check for a mismatch
-				if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
-					$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
-					$_SESSION['comment_title'] = $title;
-					$_SESSION['comment_body'] = $comment;
-					exit(header('Location: '.WB_URL."/modules/news/comment.php?id=$post_id&amp;sid=$section_id"));
-				}
-			} else {
-				$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
-				$_SESSION['comment_title'] = $title;
-				$_SESSION['comment_body'] = $comment;
-				exit(header('Location: '.WB_URL."/modules/news/comment.php?id=$post_id&amp;sid=$section_id"));
-			}
-		}
-	}
-	if(isset($_SESSION['captcha'])) { unset($_SESSION['captcha']); }
-	if(ENABLED_ASP) {
-		unset($_SESSION['comes_from_view']);
-		unset($_SESSION['comes_from_view_time']);
-		unset($_SESSION['submitted_when']);
-	}
-
-	// Insert the comment into db
-	$commented_when = time();
-	if($wb->is_authenticated() == true) {
-		$commented_by = $wb->get_user_id();
-	} else {
-		$commented_by = '';
-	}
-	$query = $database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id,post_id,title,comment,commented_when,commented_by) VALUES ('$section_id','$page_id','$post_id','$title','$comment','$commented_when','$commented_by')");
-	// Get page link
-	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
-	$page = $query_page->fetchRow();
-	header('Location: '.$wb->page_link($page['link']).'?id='.$post_id);
-} else {
-	if(isset($_GET['post_id']) AND is_numeric($_GET['post_id']) AND isset($_GET['section_id']) AND is_numeric($_GET['section_id']))
-		header('Location: '.WB_URL."/modules/news/comment.php?id={$_GET['post_id']}&amp;sid={$_GET['section_id']}");
-	else
-		exit(header("Location: ".WB_URL.PAGES_DIRECTORY.""));
-}
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Include config file
+require('../../config.php');
+
+/*overwrite php.ini on Apache servers for valid SESSION ID Separator
+if(function_exists('ini_set')) {
+	ini_set('arg_separator.output', '&amp;');
+}
+*/
+require_once(WB_PATH.'/framework/class.wb.php');
+$wb = new wb;
+         /*  */
+
+// Check if we should show the form or add a comment
+if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])
+    AND isset($_GET['section_id']) AND is_numeric($_GET['section_id'])
+        AND isset($_GET['post_id']) AND is_numeric($_GET['post_id'])
+            AND ( ( ENABLED_ASP AND isset($_POST['comment_'.date('W')]) AND $_POST['comment_'.date('W')] != '')
+            OR ( !ENABLED_ASP AND isset($_POST['comment']) AND $_POST['comment'] != '' ) ) )
+{
+
+	if(ENABLED_ASP){
+        $comment = $_POST['comment_'.date('W')];
+	}
+	else
+    {
+        $comment = $_POST['comment'];
+	}
+
+	$comment = $wb->add_slashes(strip_tags($comment));
+	$title = $wb->add_slashes(strip_tags($_POST['title']));
+	$page_id = $_GET['page_id'];
+	$section_id = $_GET['section_id'];
+	$post_id = $_GET['post_id'];
+
+	// Check captcha
+	$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+	if( !$query_settings->numRows())
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+	}
+    else
+    {
+		$settings = $query_settings->fetchRow();
+		$t=time();
+
+        // Advanced Spam Protection
+	    if(ENABLED_ASP AND ( ($_SESSION['session_started']+ASP_SESSION_MIN_AGE > $t)  // session too young
+            OR (!isset($_SESSION['comes_from_view']))// user doesn't come from view.php
+            OR (!isset($_SESSION['comes_from_view_time']) OR $_SESSION['comes_from_view_time'] > $t-ASP_VIEW_MIN_AGE) // user is too fast
+            OR (!isset($_SESSION['submitted_when']) OR !isset($_POST['submitted_when'])) // faked form
+            OR ($_SESSION['submitted_when'] != $_POST['submitted_when']) // faked form
+            OR ($_SESSION['submitted_when'] > $t-ASP_INPUT_MIN_AGE && !isset($_SESSION['captcha_retry_news'])) // user too fast
+            OR ($_SESSION['submitted_when'] < $t-43200) // form older than 12h
+            OR ($_POST['email'] OR $_POST['url'] OR $_POST['homepage'] OR $_POST['comment']) /* honeypot-fields */ ) )
+        {
+            header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	        exit( 0 );
+		}
+
+		if(ENABLED_ASP)
+        {
+			if(isset($_SESSION['captcha_retry_news']))
+            {
+              unset($_SESSION['captcha_retry_news']);
+            }
+		}
+
+		if($settings['use_captcha'])
+        {
+			if(isset($_POST['captcha']) AND $_POST['captcha'] != '')
+            {
+				// Check for a mismatch
+				if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha'])
+                {
+					$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
+					$_SESSION['comment_title'] = $title;
+					$_SESSION['comment_body'] = $comment;
+					header("Location: ".WB_URL."/modules/news/comment.php?post_id=".$post_id."&section_id=".$section_id."" );
+	                exit( 0 );
+				}
+			}
+            else
+            {
+				$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
+				$_SESSION['comment_title'] = $title;
+				$_SESSION['comment_body'] = $comment;
+				header("Location: ".WB_URL."/modules/news/comment.php?post_id=".$post_id."&section_id=".$section_id."" );
+	            exit( 0 );
+			}
+		}
+	}
+
+	if(isset($_SESSION['captcha'])) { unset($_SESSION['captcha']); }
+
+	if(ENABLED_ASP)
+    {
+		unset($_SESSION['comes_from_view']);
+		unset($_SESSION['comes_from_view_time']);
+		unset($_SESSION['submitted_when']);
+	}
+
+	// Insert the comment into db
+	$commented_when = time();
+	if($wb->is_authenticated() == true)
+    {
+		$commented_by = $wb->get_user_id();
+	}
+    else
+    {
+		$commented_by = '';
+	}
+
+	$query = $database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id,post_id,title,comment,commented_when,commented_by) VALUES ('$section_id','$page_id','$post_id','$title','$comment','$commented_when','$commented_by')");
+	// Get page link
+	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
+	$page = $query_page->fetchRow();
+	header('Location: '.$wb->page_link($page['link']).'?post_id='.$post_id.'' );
+	exit( 0 );
+}
+else
+{
+	if( isset($_GET['post_id']) AND is_numeric($_GET['post_id'])
+        AND isset($_GET['section_id']) AND is_numeric($_GET['section_id']) )
+    {
+ 		header("Location: ".WB_URL."/modules/news/comment.php?post_id=".($_GET['post_id'])."&section_id=".($_GET['section_id'])."" ) ;
+	    exit( 0 );
+    }
+	else
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+    }
+}
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/add.php
===================================================================
--- branches/2.8.x/wb/modules/news/add.php	(revision 1156)
+++ branches/2.8.x/wb/modules/news/add.php	(revision 1157)
@@ -27,12 +27,12 @@
 if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
 
 $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
-$post_loop = '<tr class=\"post_top\">
-<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
-<td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
+$post_loop = '<tr class=\"post-top\">
+<td class=\"post-title\"><a href=\"[LINK]\">[TITLE]</a></td>
+<td class=\"post-date\">[PUBLISHED_DATE], [PUBLISHED_TIME]</td>
 </tr>
 <tr>
-<td class=\"post_short\" colspan=\"2\">
+<td class=\"post-short\" colspan=\"2\">
 [SHORT]
 <span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
 </td>
@@ -67,7 +67,7 @@
 <td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
 </tr>
 <tr>
-<td colspan="2" class="comment_text">[COMMENT]</td>
+<td colspan="2" class="comment-text">[COMMENT]</td>
 </tr>');
 $comments_footer = '</table>
 <br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
@@ -76,6 +76,7 @@
 <br />';
 $commenting = 'none';
 $use_captcha = true;
+
 $database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id,header,post_loop,footer,post_header,post_footer,comments_header,comments_loop,comments_footer,comments_page,commenting,use_captcha) VALUES ('$section_id','$page_id','$header','$post_loop','$footer','$post_header','$post_footer','$comments_header','$comments_loop','$comments_footer','$comments_page','$commenting','$use_captcha')");
 
 ?>
\ No newline at end of file
