Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 1063)
+++ trunk/CHANGELOG	(revision 1064)
@@ -11,12 +11,11 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.0 -------------------------------------
+14-July 2009 Matthias Gallas
+#	Fixed some validiation bugs in news modul (Thanks to Luisehahne)
 14-July 2009 Dietrich Roland Pehlke
-#	Removed added marker, placed by mistake, to avoid double loading of backend.js files
-14-July 2009 Dietrich Roland Pehlke
 !	changes in frontend.functions.php, line 323: 'date' to 'gmdate' to avoid E_STRICT warnings.
 !	changes in wb-setup.php, line 50: 'date' to 'gmdate' to avoid E_STRICT warnings. See also #741.
-!	Add missing backend-js marker in the backend-themes templates (header.htt)
 13-July 2009 Matthias Gallas
 +	added changes from news/add.php to the upgrade-script.php
 13-July-2009 Ruud Eisinga
Index: trunk/wb/modules/news/modify_post.php
===================================================================
--- trunk/wb/modules/news/modify_post.php	(revision 1063)
+++ trunk/wb/modules/news/modify_post.php	(revision 1064)
@@ -1,256 +1,257 @@
-<?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'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$post_id = $_GET['post_id'];
-}
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-// Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
-$fetch_content = $query_content->fetchRow();
-
-if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
-	function show_wysiwyg_editor($name,$id,$content,$width,$height) {
-		echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
-	}
-} else {
-	$id_list=array("short","long");
-			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
-}
-
-// include jscalendar-setup
-$jscal_use_time = true; // whether to use a clock, too
-require_once(WB_PATH."/include/jscalendar/wb-setup.php");
-?>
-<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2>
-
-<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.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 $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%">
-<tr>
-	<td><?php echo $TEXT['TITLE']; ?>:</td>
-	<td width="80%">
-		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['GROUP']; ?>:</td>
-	<td>
-		<select name="group" style="width: 100%;">
-			<option value="0"><?php echo $TEXT['NONE']; ?></option>
-			<?php
-			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
-			if($query->numRows() > 0) {
-				// 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>
-					<?php
-				}
-			}
-			?>
-		</select>
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['COMMENTING']; ?>:</td>
-	<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>
-		</select>
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
-	<td>
-		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
-		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
-		<?php echo $TEXT['YES']; ?>
-		</a>
-		&nbsp;
-		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
-		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
-		<?php echo $TEXT['NO']; ?>
-		</a>
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
-	<td>
-	<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d H:i')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
-	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
-	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" />
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
-	<td>
-	<input type="text" id="enddate" name="enddate" value="<?php if($fetch_content['published_until']==0) print ""; else print date($jscal_format, $fetch_content['published_until'])?>" style="width: 120px;" />
-	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="enddate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
-	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.enddate.value=''" />
-	</td>
-</tr>
-</table>
-
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
-<tr>
-	<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
-</tr>
-<tr>
-	<td>
-	<?php
-	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
-	?>
-	</td>
-</tr>
-<tr>
-	<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
-</tr>
-<tr>
-	<td>
-	<?php
-	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
-	?>
-	</td>
-</tr>
-</table>
-
-<table cellpadding="2" 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>
-	</td>
-	<td align="right">
-		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
-	</td>
-</tr>
-</table>
-
-<script type="text/javascript">
-	Calendar.setup(
-		{
-			inputField  : "publishdate",
-			ifFormat    : "<?php echo $jscal_ifformat ?>",
-			button      : "publishdate_trigger",
-			firstDay    : <?php echo $jscal_firstday ?>,
-			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
-				showsTime   : "true",
-				timeFormat  : "24",
-			<?php } ?>
-			date        : "<?php echo $jscal_today ?>",
-			range       : [1970, 2037],
-			step        : 1
-		}
-	);
-	Calendar.setup(
-		{
-			inputField  : "enddate",
-			ifFormat    : "<?php echo $jscal_ifformat ?>",
-			button      : "enddate_trigger",
-			firstDay    : <?php echo $jscal_firstday ?>,
-			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
-				showsTime   : "true",
-				timeFormat  : "24",
-			<?php } ?>
-			date        : "<?php echo $jscal_today ?>",
-			range       : [1970, 2037],
-			step        : 1
-		}
-	);
-</script>
-
-<br />
-
-<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
-
-<?php
-
-// Loop through existing posts
-$query_comments = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_comments` WHERE section_id = '$section_id' AND post_id = '$post_id' ORDER BY commented_when DESC");
-if($query_comments->numRows() > 0) {
-	$row = 'a';
-	?>
-	<table cellpadding="2" cellspacing="0" border="0" width="100%">
-	<?php
-	while($comment = $query_comments->fetchRow()) {
-		?>
-		<tr class="row_<?php echo $row; ?>" height="20">
-			<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']; ?>">
-					<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']; ?>">
-					<?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']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
-				</a>
-			</td>
-		</tr>
-		<?php
-		// Alternate row color
-		if($row == 'a') {
-			$row = 'b';
-		} else {
-			$row = 'a';
-		}
-	}
-	?>
-	</table>
-	<?php
-} else {
-	echo $TEXT['NONE_FOUND'];
-}
-
-?>
-
-
-
-<?php
-
-// 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'])) {
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit(0);
+} else {
+	$post_id = $_GET['post_id'];
+}
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// Get header and footer
+$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
+$fetch_content = $query_content->fetchRow();
+
+if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
+	function show_wysiwyg_editor($name,$id,$content,$width,$height) {
+		echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
+	}
+} else {
+	$id_list=array("short","long");
+			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
+}
+
+// include jscalendar-setup
+$jscal_use_time = true; // whether to use a clock, too
+require_once(WB_PATH."/include/jscalendar/wb-setup.php");
+?>
+<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2>
+
+<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.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 $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%">
+<tr>
+	<td><?php echo $TEXT['TITLE']; ?>:</td>
+	<td width="80%">
+		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['GROUP']; ?>:</td>
+	<td>
+		<select name="group" style="width: 100%;">
+			<option value="0"><?php echo $TEXT['NONE']; ?></option>
+			<?php
+			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
+			if($query->numRows() > 0) {
+				// 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>
+					<?php
+				}
+			}
+			?>
+		</select>
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['COMMENTING']; ?>:</td>
+	<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>
+		</select>
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
+	<td>
+		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
+		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
+		<?php echo $TEXT['YES']; ?>
+		</a>
+		&nbsp;
+		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
+		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
+		<?php echo $TEXT['NO']; ?>
+		</a>
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
+	<td>
+	<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d H:i')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
+	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
+	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" />
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
+	<td>
+	<input type="text" id="enddate" name="enddate" value="<?php if($fetch_content['published_until']==0) print ""; else print date($jscal_format, $fetch_content['published_until'])?>" style="width: 120px;" />
+	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="enddate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
+	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.enddate.value=''" />
+	</td>
+</tr>
+</table>
+
+<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+<tr>
+	<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
+</tr>
+<tr>
+	<td>
+	<?php
+	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
+	?>
+	</td>
+</tr>
+<tr>
+	<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
+</tr>
+<tr>
+	<td>
+	<?php
+	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
+	?>
+	</td>
+</tr>
+</table>
+
+<table cellpadding="2" 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;" />
+	</td>
+	<td align="right">
+		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
+	</td>
+</tr>
+</table>
+</form>
+
+<script type="text/javascript">
+	Calendar.setup(
+		{
+			inputField  : "publishdate",
+			ifFormat    : "<?php echo $jscal_ifformat ?>",
+			button      : "publishdate_trigger",
+			firstDay    : <?php echo $jscal_firstday ?>,
+			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
+				showsTime   : "true",
+				timeFormat  : "24",
+			<?php } ?>
+			date        : "<?php echo $jscal_today ?>",
+			range       : [1970, 2037],
+			step        : 1
+		}
+	);
+	Calendar.setup(
+		{
+			inputField  : "enddate",
+			ifFormat    : "<?php echo $jscal_ifformat ?>",
+			button      : "enddate_trigger",
+			firstDay    : <?php echo $jscal_firstday ?>,
+			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
+				showsTime   : "true",
+				timeFormat  : "24",
+			<?php } ?>
+			date        : "<?php echo $jscal_today ?>",
+			range       : [1970, 2037],
+			step        : 1
+		}
+	);
+</script>
+
+<br />
+
+<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
+
+<?php
+
+// Loop through existing posts
+$query_comments = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_comments` WHERE section_id = '$section_id' AND post_id = '$post_id' ORDER BY commented_when DESC");
+if($query_comments->numRows() > 0) {
+	$row = 'a';
+	?>
+	<table cellpadding="2" cellspacing="0" border="0" width="100%">
+	<?php
+	while($comment = $query_comments->fetchRow()) {
+		?>
+		<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']; ?>">
+					<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']; ?>">
+					<?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']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
+				</a>
+			</td>
+		</tr>
+		<?php
+		// Alternate row color
+		if($row == 'a') {
+			$row = 'b';
+		} else {
+			$row = 'a';
+		}
+	}
+	?>
+	</table>
+	<?php
+} else {
+	echo $TEXT['NONE_FOUND'];
+}
+
+?>
+
+
+
+<?php
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: trunk/wb/modules/news/modify_group.php
===================================================================
--- trunk/wb/modules/news/modify_group.php	(revision 1063)
+++ trunk/wb/modules/news/modify_group.php	(revision 1064)
@@ -1,108 +1,108 @@
-<?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['group_id']) OR !is_numeric($_GET['group_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-	exit(0);
-} else {
-	$group_id = $_GET['group_id'];
-}
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-// Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '$group_id'");
-$fetch_content = $query_content->fetchRow();
-
-?>
-
-<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['GROUP']; ?></h2>
-
-<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_group.php" method="post" enctype="multipart/form-data" 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="group_id" value="<?php echo $group_id; ?>">
-
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
-<tr>
-	<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
-	<td>
-		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
-	</td>
-</tr>
-<tr>
-	<td><?php echo $TEXT['IMAGE']; ?>:</td>
-	<?php if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) { ?>
-	<td>
-		<a href="<?php echo WB_URL.MEDIA_DIRECTORY; ?>/.news/image<?php echo $group_id; ?>.jpg" target="_blank">View</a>
-		&nbsp;
-		<input type="checkbox" name="delete_image" id="delete_image" value="true" />
-		<label for="delete_image">Delete</label>
-	</td>
-	<?php } else { ?>
-	<td>
-		<input type="file" name="image" />
-	</td>
-	<?php } ?>
-</tr>
-<tr>
-	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
-	<td>
-		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
-		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
-		<?php echo $TEXT['YES']; ?>
-		</a>
-		-
-		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
-		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
-		<?php echo $TEXT['NO']; ?>
-		</a>
-	</td>
-</tr>
-</table>
-
-<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>
-	</td>
-	<td align="right">
-		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
-	</td>
-</tr>
-</table>
-
-
-<?php
-
-// 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['group_id']) OR !is_numeric($_GET['group_id'])) {
+	header("Location: ".ADMIN_URL."/pages/index.php");
+	exit(0);
+} else {
+	$group_id = $_GET['group_id'];
+}
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// Get header and footer
+$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '$group_id'");
+$fetch_content = $query_content->fetchRow();
+
+?>
+
+<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['GROUP']; ?></h2>
+
+<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_group.php" method="post" enctype="multipart/form-data" 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="group_id" value="<?php echo $group_id; ?>" />
+
+<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+<tr>
+	<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
+	<td>
+		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
+	</td>
+</tr>
+<tr>
+	<td><?php echo $TEXT['IMAGE']; ?>:</td>
+	<?php if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) { ?>
+	<td>
+		<a href="<?php echo WB_URL.MEDIA_DIRECTORY; ?>/.news/image<?php echo $group_id; ?>.jpg" target="_blank">View</a>
+		&nbsp;
+		<input type="checkbox" name="delete_image" id="delete_image" value="true" />
+		<label for="delete_image">Delete</label>
+	</td>
+	<?php } else { ?>
+	<td>
+		<input type="file" name="image" />
+	</td>
+	<?php } ?>
+</tr>
+<tr>
+	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
+	<td>
+		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
+		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
+		<?php echo $TEXT['YES']; ?>
+		</a>
+		-
+		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
+		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
+		<?php echo $TEXT['NO']; ?>
+		</a>
+	</td>
+</tr>
+</table>
+
+<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;" />
+	</td>
+	<td align="right">
+		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
+	</td>
+</tr>
+</table>
+</form>
+
+<?php
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: trunk/wb/modules/news/view.php
===================================================================
--- trunk/wb/modules/news/view.php	(revision 1063)
+++ trunk/wb/modules/news/view.php	(revision 1064)
@@ -1,386 +1,386 @@
-<?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';
-	}
-		
-	// 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'] > $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';
-				// 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'] > $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';
-			$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
-			if(isset($TEXT['NONE_FOUND'])) {
-				$content .= "<tr><td>".$TEXT['NONE_FOUND'].'<br /></td></tr>';
-			} else {
-				$content .= '<tr><td>None Found<br /></td></tr>';
-			}
-		}
-		
-		// 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"); }
+
+// 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';
+	}
+		
+	// 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'] > $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';
+				// 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'] > $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';
+			$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
+			if(isset($TEXT['NONE_FOUND'])) {
+				$content .= "<tr><td>".$TEXT['NONE_FOUND'].'<br /></td></tr>';
+			} else {
+				$content .= '<tr><td>None Found<br /></td></tr>';
+			}
+		}
+		
+		// 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();
+	}
+}
+
 ?>
\ No newline at end of file
Index: trunk/wb/modules/news/modify.php
===================================================================
--- trunk/wb/modules/news/modify.php	(revision 1063)
+++ trunk/wb/modules/news/modify.php	(revision 1064)
@@ -1,210 +1,216 @@
-<?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')) { exit("Cannot access this file directly"); }
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
-
-?>
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
-<tr>
-	<td align="left" width="33%">
-		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['POST']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
-	</td>
-	<td align="left" width="33%">
-		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['GROUP']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
-	</td>
-	<td align="right" width="33%">
-		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_settings.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
-	</td>
-</tr>
-</table>
-
-<br />
-
-<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['POST']; ?></h2>
-
-<?php
-
-// Loop through existing posts
-$query_posts = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_posts` WHERE section_id = '$section_id' ORDER BY position DESC");
-if($query_posts->numRows() > 0) {
-	$num_posts = $query_posts->numRows();
-	$row = 'a';
-	?>
-	<table cellpadding="2" cellspacing="0" border="0" width="100%">
-	<?php
-	while($post = $query_posts->fetchRow()) {
-		?>
-		<tr class="row_<?php echo $row; ?>" height="20">
-			<td width="20" style="padding-left: 5px;">
-				<a href="<?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 $post['post_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
-				</a>
-			</td>
-			<td>
-				<a href="<?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 $post['post_id']; ?>">
-					<?php echo ($post['title']); ?>
-				</a>
-			</td>
-			<td width="180">
-				<?php echo $TEXT['GROUP'].': ';
-				// Get group title
-				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '".$post['group_id']."'");
-				if($query_title->numRows() > 0) {
-					$fetch_title = $query_title->fetchRow();
-					echo ($fetch_title['title']);
-				} else {
-					echo $TEXT['NONE'];
-				}
-				?>
-			</td>
-			<td width="120">
-				<?php echo $TEXT['COMMENTS'].': ';
-				// Get number of comments
-				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post['post_id']."'");
-				echo $query_title->numRows();
-				?>
-			</td>
-			<td width="80">
-				<?php echo $TEXT['ACTIVE'].': '; if($post['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
-			</td>
-			<td width="20">
-			<?php
-			$start = $post['published_when'];
-			$end = $post['published_until'];
-			$t = time();
-			$icon = '';
-			if($start<=$t && $end==0)
-				$icon=THEME_URL.'/images/noclock_16.png';
-			elseif(($start<=$t || $start==0) && $end>=$t)
-				$icon=THEME_URL.'/images/clock_16.png';
-			else
-				$icon=THEME_URL.'/images/clock_red_16.png';
-			?>
-			<a href="<?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 $post['post_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
-				<img src="<?php echo $icon; ?>" border="0" alt="" />
-			</td>
-			<td width="20">
-			<?php if($post['position'] != $num_posts) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-			<?php if($post['position'] != 1) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
-				</a>
-			</td>
-		</tr>
-		<?php
-		// Alternate row color
-		if($row == 'a') {
-			$row = 'b';
-		} else {
-			$row = 'a';
-		}
-	}
-	?>
-	</table>
-	<?php
-} else {
-	echo $TEXT['NONE_FOUND'];
-}
-
-?>
-
-<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['GROUP']; ?></h2>
-
-<?php
-
-// Loop through existing groups
-$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
-if($query_groups->numRows() > 0) {
-	$num_groups = $query_groups->numRows();
-	$row = 'a';
-	?>
-	<table cellpadding="2" cellspacing="0" border="0" width="100%">
-	<?php
-	while($group = $query_groups->fetchRow()) {
-		?>
-		<tr class="row_<?php echo $row; ?>" height="20">
-			<td width="20" style="padding-left: 5px;">
-				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
-				</a>
-			</td>		
-			<td>
-				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>">
-					<?php echo $group['title']; ?>
-				</a>
-			</td>
-			<td width="80">
-				<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
-			</td>
-			<td width="20">
-			<?php if($group['position'] != 1) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-			<?php if($group['position'] != $num_groups) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_group.php?page_id=<?php echo $page_id; ?>&group_id=<?php echo $group['group_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
-				</a>
-			</td>
-		</tr>
-		<?php
-		// Alternate row color
-		if($row == 'a') {
-			$row = 'b';
-		} else {
-			$row = 'a';
-		}
-	}
-	?>
-	</table>
-	<?php
-} else {
-	echo $TEXT['NONE_FOUND'];
-}
+<?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')) { exit("Cannot access this file directly"); }
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
+
+//overwrite php.ini on Apache servers for valid SESSION ID Separator
+if(function_exists('ini_set')) {
+	ini_set('arg_separator.output', '&amp;');
+}
+
+?>
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+	<td align="left" width="33%">
+		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['POST']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
+	</td>
+	<td align="left" width="33%">
+		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['GROUP']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_group.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
+	</td>
+	<td align="right" width="33%">
+		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_settings.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
+	</td>
+</tr>
+</table>
+
+<br />
+
+<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['POST']; ?></h2>
+
+<?php
+
+// Loop through existing posts
+$query_posts = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_posts` WHERE section_id = '$section_id' ORDER BY position DESC");
+if($query_posts->numRows() > 0) {
+	$num_posts = $query_posts->numRows();
+	$row = 'a';
+	?>
+	<table cellpadding="2" cellspacing="0" border="0" width="100%">
+	<?php
+	while($post = $query_posts->fetchRow()) {
+		?>
+		<tr class="row_<?php echo $row; ?>">
+			<td width="20" style="padding-left: 5px;">
+				<a href="<?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 $post['post_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
+				</a>
+			</td>
+			<td>
+				<a href="<?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 $post['post_id']; ?>">
+					<?php echo ($post['title']); ?>
+				</a>
+			</td>
+			<td width="180">
+				<?php echo $TEXT['GROUP'].': ';
+				// Get group title
+				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '".$post['group_id']."'");
+				if($query_title->numRows() > 0) {
+					$fetch_title = $query_title->fetchRow();
+					echo ($fetch_title['title']);
+				} else {
+					echo $TEXT['NONE'];
+				}
+				?>
+			</td>
+			<td width="120">
+				<?php echo $TEXT['COMMENTS'].': ';
+				// Get number of comments
+				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post['post_id']."'");
+				echo $query_title->numRows();
+				?>
+			</td>
+			<td width="80">
+				<?php echo $TEXT['ACTIVE'].': '; if($post['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
+			</td>
+			<td width="20">
+			<?php
+			$start = $post['published_when'];
+			$end = $post['published_until'];
+			$t = time();
+			$icon = '';
+			if($start<=$t && $end==0)
+				$icon=THEME_URL.'/images/noclock_16.png';
+			elseif(($start<=$t || $start==0) && $end>=$t)
+				$icon=THEME_URL.'/images/clock_16.png';
+			else
+				$icon=THEME_URL.'/images/clock_red_16.png';
+			?>
+			<a href="<?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 $post['post_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
+				<img src="<?php echo $icon; ?>" border="0" alt="" />
+			</a>
+			</td>
+			<td width="20">
+			<?php if($post['position'] != $num_posts) { ?>
+				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
+				</a>
+			<?php } ?>
+			</td>
+			<td width="20">
+			<?php if($post['position'] != 1) { ?>
+				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
+				</a>
+			<?php } ?>
+			</td>
+			<td width="20">
+				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $post['post_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
+				</a>
+			</td>
+		</tr>
+		<?php
+		// Alternate row color
+		if($row == 'a') {
+			$row = 'b';
+		} else {
+			$row = 'a';
+		}
+	}
+	?>
+	</table>
+	<?php
+} else {
+	echo $TEXT['NONE_FOUND'];
+}
+
+?>
+
+<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['GROUP']; ?></h2>
+
+<?php
+
+// Loop through existing groups
+$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
+if($query_groups->numRows() > 0) {
+	$num_groups = $query_groups->numRows();
+	$row = 'a';
+	?>
+	<table cellpadding="2" cellspacing="0" border="0" width="100%">
+	<?php
+	while($group = $query_groups->fetchRow()) {
+		?>
+		<tr class="row_<?php echo $row; ?>">
+			<td width="20" style="padding-left: 5px;">
+				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
+				</a>
+			</td>		
+			<td>
+				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $group['group_id']; ?>">
+					<?php echo $group['title']; ?>
+				</a>
+			</td>
+			<td width="80">
+				<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
+			</td>
+			<td width="20">
+			<?php if($group['position'] != 1) { ?>
+				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
+				</a>
+			<?php } ?>
+			</td>
+			<td width="20">
+			<?php if($group['position'] != $num_groups) { ?>
+				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
+				</a>
+			<?php } ?>
+			</td>
+			<td width="20">
+				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_group.php?page_id=<?php echo $page_id; ?>&amp;group_id=<?php echo $group['group_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
+					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
+				</a>
+			</td>
+		</tr>
+		<?php
+		// Alternate row color
+		if($row == 'a') {
+			$row = 'b';
+		} else {
+			$row = 'a';
+		}
+	}
+	?>
+	</table>
+	<?php
+} else {
+	echo $TEXT['NONE_FOUND'];
+}
 ?>
\ No newline at end of file
