Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1424)
+++ branches/2.8.x/CHANGELOG	(revision 1425)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.2 -------------------------------------
+03 Feb-2011 Build 1425 Dietmar Woellbrink (Luisehahne)
+! redefined wrong admin backlinks
 31 Jan-2011 Build 1424 Werner v.d.Decken(DarkViper)
 # typo fix and simplify used_octets calculation
 30 Jan-2011 Build 1423 Werner v.d.Decken(DarkViper)
Index: branches/2.8.x/wb/admin/groups/save.php
===================================================================
--- branches/2.8.x/wb/admin/groups/save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/groups/save.php	(revision 1425)
@@ -21,9 +21,12 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Access', 'groups_modify');
 
+// Create a javascript back link
+$js_back = ADMIN_URL.'/groups/index.php';
+
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
 	exit();
 }
 
@@ -38,9 +41,6 @@
 // Gather details entered
 $group_name = $admin->get_post_escaped('group_name');
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Check values
 if($group_name == "") {
 	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
Index: branches/2.8.x/wb/admin/groups/groups.php
===================================================================
--- branches/2.8.x/wb/admin/groups/groups.php	(revision 1424)
+++ branches/2.8.x/wb/admin/groups/groups.php	(revision 1425)
@@ -1,200 +1,201 @@
-<?php
-/**
- *
- * @category        admin
- * @package         groups
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-// Include config file and admin class file
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-
-// Create new database object
-// $database = new database();
-
-if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {
-	header("Location: index.php");
-	exit(0);
-}
-
-// Set parameter 'action' as alternative to javascript mechanism
-if(isset($_POST['modify']))
-	$_POST['action'] = "modify";
-if(isset($_POST['delete']))
-	$_POST['action'] = "delete";
-
-// Check if group group_id is a valid number and doesnt equal 1
-if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
-	header("Location: index.php");
-	exit(0);
-}
-
-if($_POST['action'] == 'modify') {
-	// Create new admin object
-	$admin = new admin('Access', 'groups_modify', false);
-
-	if (!$admin->checkFTAN())
-	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-		exit();
-	}
-	// Print header
-	$admin->print_header();
-	// Get existing values
-	$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'");
-	$group = $results->fetchRow();
-	// Setup template object
-	$template = new Template(THEME_PATH.'/templates');
-	$template->set_file('page', 'groups_form.htt');
-	$template->set_block('page', 'main_block', 'main');
-	$template->set_var(	array(
-							'ACTION_URL' => ADMIN_URL.'/groups/save.php',
-							'SUBMIT_TITLE' => $TEXT['SAVE'],
-							'GROUP_ID' => $group['group_id'],
-							'GROUP_NAME' => $group['name'],
-							'ADVANCED_ACTION' => 'groups.php',
-							'FTAN' => $admin->getFTAN()
-						));
-	// Tell the browser whether or not to show advanced options
-	if( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
-		$template->set_var('DISPLAY_ADVANCED', '');
-		$template->set_var('DISPLAY_BASIC', 'display:none;');
-		$template->set_var('ADVANCED', 'yes');
-		$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
-	} else {
-		$template->set_var('DISPLAY_ADVANCED', 'display:none;');
-		$template->set_var('DISPLAY_BASIC', '');
-		$template->set_var('ADVANCED', 'no');
-		$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].'  &gt;&gt;');
-	}
-
-	// Explode system permissions
-	$system_permissions = explode(',', $group['system_permissions']);
-	// Check system permissions boxes
-	foreach($system_permissions AS $name) {
-			$template->set_var($name.'_checked', ' checked="checked"');
-	}
-	// Explode module permissions
-	$module_permissions = explode(',', $group['module_permissions']);
-	// Explode template permissions
-	$template_permissions = explode(',', $group['template_permissions']);
-	
-	// Insert values into module list
-	$template->set_block('main_block', 'module_list_block', 'module_list');
-	$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
-	if($result->numRows() > 0) {
-		while($addon = $result->fetchRow()) {
-			$template->set_var('VALUE', $addon['directory']);
-			$template->set_var('NAME', $addon['name']);
-			if(!is_numeric(array_search($addon['directory'], $module_permissions))) {
-				$template->set_var('CHECKED', ' checked="checked"');
-			} else {
-				$template->set_var('CHECKED', '');
-			}
-			$template->parse('module_list', 'module_list_block', true);
-		}
-	}
-	
-	// Insert values into template list
-	$template->set_block('main_block', 'template_list_block', 'template_list');
-	$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
-	if($result->numRows() > 0) {
-		while($addon = $result->fetchRow()) {
-			$template->set_var('VALUE', $addon['directory']);
-			$template->set_var('NAME', $addon['name']);
-			if(!is_numeric(array_search($addon['directory'], $template_permissions))) {
-				$template->set_var('CHECKED', ' checked="checked"');
-			} else {
-				$template->set_var('CHECKED', '');
-			}
-			$template->parse('template_list', 'template_list_block', true);
-		}
-	}
-		
-	// Insert language text and messages
-	$template->set_var(array(
-				'TEXT_RESET' => $TEXT['RESET'],
-				'TEXT_ACTIVE' => $TEXT['ACTIVE'],
-				'TEXT_DISABLED' => $TEXT['DISABLED'],
-				'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
-				'TEXT_USERNAME' => $TEXT['USERNAME'],
-				'TEXT_PASSWORD' => $TEXT['PASSWORD'],
-				'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
-				'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
-				'TEXT_EMAIL' => $TEXT['EMAIL'],
-				'TEXT_GROUP' => $TEXT['GROUP'],
-				'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
-				'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
-				'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
-				'TEXT_NAME' => $TEXT['NAME'],
-				'SECTION_PAGES' => $MENU['PAGES'],
-				'SECTION_MEDIA' => $MENU['MEDIA'],
-				'SECTION_MODULES' => $MENU['MODULES'],
-				'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
-				'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
-				'SECTION_SETTINGS' => $MENU['SETTINGS'],
-				'SECTION_USERS' => $MENU['USERS'],
-				'SECTION_GROUPS' => $MENU['GROUPS'],
-				'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
-				'TEXT_VIEW' => $TEXT['VIEW'],
-				'TEXT_ADD' => $TEXT['ADD'],
-				'TEXT_LEVEL' => $TEXT['LEVEL'],
-				'TEXT_MODIFY' => $TEXT['MODIFY'],
-				'TEXT_DELETE' => $TEXT['DELETE'],
-				'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
-				'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
-				'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
-				'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
-				'TEXT_RENAME' => $TEXT['RENAME'],
-				'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
-				'TEXT_BASIC' => $TEXT['BASIC'],
-				'TEXT_ADVANCED' => $TEXT['ADVANCED'],
-				'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
-				'HEADING_MODIFY_GROUP' => $HEADING['MODIFY_GROUP'],
-			));
-	
-	// Parse template object
-	$template->parse('main', 'main_block', false);
-	$template->pparse('output', 'page');
-} elseif($_POST['action'] == 'delete') {
-	// Create new admin object
-	$admin = new admin('Access', 'groups_delete', false);
-
-	if (!$admin->checkFTAN())
-	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-		exit();
-	}
-
-	// Print header
-	$admin->print_header();
-	// Delete the group
-	$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1");
-	if($database->is_error()) {
-		$admin->print_error($database->get_error());
-	} else {
-		// Delete users in the group
-		$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'");
-		if($database->is_error()) {
-			$admin->print_error($database->get_error());
-		} else {
-			$admin->print_success($MESSAGE['GROUPS']['DELETED']);
-		}
-	}
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         groups
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+// Include config file and admin class file
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+
+// Create new database object
+// $database = new database();
+
+if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {
+	header("Location: index.php");
+	exit(0);
+}
+
+// Set parameter 'action' as alternative to javascript mechanism
+if(isset($_POST['modify']))
+	$_POST['action'] = "modify";
+if(isset($_POST['delete']))
+	$_POST['action'] = "delete";
+
+// Check if group group_id is a valid number and doesnt equal 1
+if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
+	header("Location: index.php");
+	exit(0);
+}
+
+if($_POST['action'] == 'modify') {
+	// Create new admin object
+	$admin = new admin('Access', 'groups_modify', false);
+/*  */
+	if (!$admin->checkFTAN())
+	{
+		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+		exit();
+	}
+
+	// Print header
+	$admin->print_header();
+	// Get existing values
+	$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'");
+	$group = $results->fetchRow();
+	// Setup template object
+	$template = new Template(THEME_PATH.'/templates');
+	$template->set_file('page', 'groups_form.htt');
+	$template->set_block('page', 'main_block', 'main');
+	$template->set_var(	array(
+							'ACTION_URL' => ADMIN_URL.'/groups/save.php',
+							'SUBMIT_TITLE' => $TEXT['SAVE'],
+							'GROUP_ID' => $group['group_id'],
+							'GROUP_NAME' => $group['name'],
+							'ADVANCED_ACTION' => 'groups.php',
+							'FTAN' => $admin->getFTAN()
+						));
+	// Tell the browser whether or not to show advanced options
+	if( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
+		$template->set_var('DISPLAY_ADVANCED', '');
+		$template->set_var('DISPLAY_BASIC', 'display:none;');
+		$template->set_var('ADVANCED', 'yes');
+		$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
+	} else {
+		$template->set_var('DISPLAY_ADVANCED', 'display:none;');
+		$template->set_var('DISPLAY_BASIC', '');
+		$template->set_var('ADVANCED', 'no');
+		$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].'  &gt;&gt;');
+	}
+
+	// Explode system permissions
+	$system_permissions = explode(',', $group['system_permissions']);
+	// Check system permissions boxes
+	foreach($system_permissions AS $name) {
+			$template->set_var($name.'_checked', ' checked="checked"');
+	}
+	// Explode module permissions
+	$module_permissions = explode(',', $group['module_permissions']);
+	// Explode template permissions
+	$template_permissions = explode(',', $group['template_permissions']);
+	
+	// Insert values into module list
+	$template->set_block('main_block', 'module_list_block', 'module_list');
+	$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
+	if($result->numRows() > 0) {
+		while($addon = $result->fetchRow()) {
+			$template->set_var('VALUE', $addon['directory']);
+			$template->set_var('NAME', $addon['name']);
+			if(!is_numeric(array_search($addon['directory'], $module_permissions))) {
+				$template->set_var('CHECKED', ' checked="checked"');
+			} else {
+				$template->set_var('CHECKED', '');
+			}
+			$template->parse('module_list', 'module_list_block', true);
+		}
+	}
+	
+	// Insert values into template list
+	$template->set_block('main_block', 'template_list_block', 'template_list');
+	$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
+	if($result->numRows() > 0) {
+		while($addon = $result->fetchRow()) {
+			$template->set_var('VALUE', $addon['directory']);
+			$template->set_var('NAME', $addon['name']);
+			if(!is_numeric(array_search($addon['directory'], $template_permissions))) {
+				$template->set_var('CHECKED', ' checked="checked"');
+			} else {
+				$template->set_var('CHECKED', '');
+			}
+			$template->parse('template_list', 'template_list_block', true);
+		}
+	}
+		
+	// Insert language text and messages
+	$template->set_var(array(
+				'TEXT_RESET' => $TEXT['RESET'],
+				'TEXT_ACTIVE' => $TEXT['ACTIVE'],
+				'TEXT_DISABLED' => $TEXT['DISABLED'],
+				'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
+				'TEXT_USERNAME' => $TEXT['USERNAME'],
+				'TEXT_PASSWORD' => $TEXT['PASSWORD'],
+				'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
+				'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
+				'TEXT_EMAIL' => $TEXT['EMAIL'],
+				'TEXT_GROUP' => $TEXT['GROUP'],
+				'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
+				'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
+				'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
+				'TEXT_NAME' => $TEXT['NAME'],
+				'SECTION_PAGES' => $MENU['PAGES'],
+				'SECTION_MEDIA' => $MENU['MEDIA'],
+				'SECTION_MODULES' => $MENU['MODULES'],
+				'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
+				'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
+				'SECTION_SETTINGS' => $MENU['SETTINGS'],
+				'SECTION_USERS' => $MENU['USERS'],
+				'SECTION_GROUPS' => $MENU['GROUPS'],
+				'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
+				'TEXT_VIEW' => $TEXT['VIEW'],
+				'TEXT_ADD' => $TEXT['ADD'],
+				'TEXT_LEVEL' => $TEXT['LEVEL'],
+				'TEXT_MODIFY' => $TEXT['MODIFY'],
+				'TEXT_DELETE' => $TEXT['DELETE'],
+				'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
+				'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
+				'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
+				'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
+				'TEXT_RENAME' => $TEXT['RENAME'],
+				'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
+				'TEXT_BASIC' => $TEXT['BASIC'],
+				'TEXT_ADVANCED' => $TEXT['ADVANCED'],
+				'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
+				'HEADING_MODIFY_GROUP' => $HEADING['MODIFY_GROUP'],
+			));
+	
+	// Parse template object
+	$template->parse('main', 'main_block', false);
+	$template->pparse('output', 'page');
+} elseif($_POST['action'] == 'delete') {
+	// Create new admin object
+	$admin = new admin('Access', 'groups_delete', false);
+/*  */
+	if (!$admin->checkFTAN())
+	{
+		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+		exit();
+	}
+
+	// Print header
+	$admin->print_header();
+	// Delete the group
+	$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1");
+	if($database->is_error()) {
+		$admin->print_error($database->get_error());
+	} else {
+		// Delete users in the group
+		$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'");
+		if($database->is_error()) {
+			$admin->print_error($database->get_error());
+		} else {
+			$admin->print_success($MESSAGE['GROUPS']['DELETED']);
+		}
+	}
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/admin/groups/add.php
===================================================================
--- branches/2.8.x/wb/admin/groups/add.php	(revision 1424)
+++ branches/2.8.x/wb/admin/groups/add.php	(revision 1425)
@@ -21,9 +21,12 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Access', 'groups_add');
 
+// Create a javascript back link
+$js_back = ADMIN_URL.'/groups/index.php';
+
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
 	exit();
 }
 
@@ -30,9 +33,6 @@
 // Gather details entered
 $group_name = $admin->get_post('group_name');
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Check values
 if($group_name == "") {
 	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
Index: branches/2.8.x/wb/admin/media/rename2.php
===================================================================
--- branches/2.8.x/wb/admin/media/rename2.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/rename2.php	(revision 1425)
@@ -23,7 +23,7 @@
 
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$admin->print_error('RN5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
@@ -54,7 +54,7 @@
 // Get the temp id
 $file_id = $admin->checkIDKEY('id', false, 'POST');
 if (!$file_id) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 }
 
 // Get home folder not to show
Index: branches/2.8.x/wb/admin/media/setparameter.php
===================================================================
--- branches/2.8.x/wb/admin/media/setparameter.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/setparameter.php	(revision 1425)
@@ -1,131 +1,131 @@
-<?php
-/**
- *
- * @category        admin
- * @package         admintools
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL:  $
- * @lastmodified    $Date:  $
- *
- */
-
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Media', 'media', false);
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// check if theme language file exists for the language set by the user (e.g. DE, EN)
-if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
-	// no theme language file exists for the language set by the user, include default theme language file EN.php
-	require_once(THEME_PATH .'/languages/EN.php');
-} else {
-	// a theme language file exists for the language defined by the user, load it
-	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
-}
-
-//Save post vars to the parameters file
-if ( !is_null($admin->get_post_escaped("save"))) {
-	if (!$admin->checkFTAN())
-	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
-		exit();
-	}
-	
-	//Check for existing settings entry, if not existing, create a record first!
-	if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
-		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
-	}
-	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
-	$dirs[] = WB_PATH.MEDIA_DIRECTORY;
-	foreach($dirs AS $name) {
-		$r = str_replace(WB_PATH, '', $name);
-		$r = str_replace(array('/',' '),'_',$r);
-		$w = (int)$admin->get_post_escaped($r.'-w');
-		$h = (int)$admin->get_post_escaped($r.'-h');
-		$pathsettings[$r]['width']=$w; 
-		$pathsettings[$r]['height']=$h;
-	}
-	$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
-	$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
-	$fieldSerialized = serialize($pathsettings);
-	$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
-	header ("Location: browse.php");
-}
-
-include ('parameters.php');
-if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
-	echo "Sorry, settings not available";
-	exit();
-}
-
-// Read data to display
-$caller = "setparameter";
-
-$template = new Template(THEME_PATH.'/templates');
-$template->set_file('page', 'setparameter.htt');
-$template->set_block('page', 'main_block', 'main');
-if ($_SESSION['GROUP_ID'] != 1) {
-	$template->set_var('DISPLAY_ADMIN', 'hide');
-}
-$template->set_var(array( 
-					'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
-					'SAVE_TEXT' => $TEXT['SAVE'],
-					'BACK' => $TEXT['BACK'],
-				)
-			);
-
-
-$template->set_block('main_block', 'list_block', 'list');
-$row_bg_color = '';
-$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
-$dirs[] = WB_PATH.MEDIA_DIRECTORY;
-
-$array_lowercase = array_map('strtolower', $dirs);
-array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
-
-foreach($dirs AS $name) {
-	$relative = str_replace(WB_PATH, '', $name);
-	$safepath = str_replace(array('/',' '),'_',$relative);
-	$cur_width = $cur_height = '';
-	if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
-	if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
-	$cur_width = ($cur_width ? (int)$cur_width : '-');
-	$cur_height = ($cur_height ? (int)$cur_height : '-');
-
-	if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
-	else $row_bg_color = 'DEDEDE';
-
-	$template->set_var(array( 
-								'ADMIN_URL' => ADMIN_URL,
-								'PATH_NAME' => $relative,
-								'WIDTH' => $TEXT['WIDTH'],
-								'HEIGHT' => $TEXT['HEIGHT'],
-								'FIELD_NAME_W' => $safepath.'-w',
-								'FIELD_NAME_H' => $safepath.'-h',
-								'CUR_WIDTH' => $cur_width,
-								'CUR_HEIGHT' => $cur_height,
-								'SETTINGS' => $TEXT['SETTINGS'],
-								'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
-								'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
-								'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
-								'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
-								'ROW_BG_COLOR' => $row_bg_color,
-								'FTAN' => $admin->getFTAN()
-							)
-					);
-	$template->parse('list', 'list_block', true);
-}
-
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         admintools
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL:  $
+ * @lastmodified    $Date:  $
+ *
+ */
+
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Media', 'media', false);
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// check if theme language file exists for the language set by the user (e.g. DE, EN)
+if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
+	// no theme language file exists for the language set by the user, include default theme language file EN.php
+	require_once(THEME_PATH .'/languages/EN.php');
+} else {
+	// a theme language file exists for the language defined by the user, load it
+	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
+}
+
+//Save post vars to the parameters file
+if ( !is_null($admin->get_post_escaped("save"))) {
+	if (!$admin->checkFTAN())
+	{
+		$admin->print_error('SP5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
+		exit();
+	}
+	
+	//Check for existing settings entry, if not existing, create a record first!
+	if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
+		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
+	}
+	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
+	$dirs[] = WB_PATH.MEDIA_DIRECTORY;
+	foreach($dirs AS $name) {
+		$r = str_replace(WB_PATH, '', $name);
+		$r = str_replace(array('/',' '),'_',$r);
+		$w = (int)$admin->get_post_escaped($r.'-w');
+		$h = (int)$admin->get_post_escaped($r.'-h');
+		$pathsettings[$r]['width']=$w; 
+		$pathsettings[$r]['height']=$h;
+	}
+	$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
+	$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
+	$fieldSerialized = serialize($pathsettings);
+	$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
+	header ("Location: browse.php");
+}
+
+include ('parameters.php');
+if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
+	echo "Sorry, settings not available";
+	exit();
+}
+
+// Read data to display
+$caller = "setparameter";
+
+$template = new Template(THEME_PATH.'/templates');
+$template->set_file('page', 'setparameter.htt');
+$template->set_block('page', 'main_block', 'main');
+if ($_SESSION['GROUP_ID'] != 1) {
+	$template->set_var('DISPLAY_ADMIN', 'hide');
+}
+$template->set_var(array( 
+					'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
+					'SAVE_TEXT' => $TEXT['SAVE'],
+					'BACK' => $TEXT['BACK'],
+				)
+			);
+
+
+$template->set_block('main_block', 'list_block', 'list');
+$row_bg_color = '';
+$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
+$dirs[] = WB_PATH.MEDIA_DIRECTORY;
+
+$array_lowercase = array_map('strtolower', $dirs);
+array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
+
+foreach($dirs AS $name) {
+	$relative = str_replace(WB_PATH, '', $name);
+	$safepath = str_replace(array('/',' '),'_',$relative);
+	$cur_width = $cur_height = '';
+	if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
+	if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
+	$cur_width = ($cur_width ? (int)$cur_width : '-');
+	$cur_height = ($cur_height ? (int)$cur_height : '-');
+
+	if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
+	else $row_bg_color = 'DEDEDE';
+
+	$template->set_var(array( 
+								'ADMIN_URL' => ADMIN_URL,
+								'PATH_NAME' => $relative,
+								'WIDTH' => $TEXT['WIDTH'],
+								'HEIGHT' => $TEXT['HEIGHT'],
+								'FIELD_NAME_W' => $safepath.'-w',
+								'FIELD_NAME_H' => $safepath.'-h',
+								'CUR_WIDTH' => $cur_width,
+								'CUR_HEIGHT' => $cur_height,
+								'SETTINGS' => $TEXT['SETTINGS'],
+								'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
+								'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
+								'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
+								'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
+								'ROW_BG_COLOR' => $row_bg_color,
+								'FTAN' => $admin->getFTAN()
+							)
+					);
+	$template->parse('list', 'list_block', true);
+}
+
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/admin/media/browse.php
===================================================================
--- branches/2.8.x/wb/admin/media/browse.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/browse.php	(revision 1425)
@@ -82,12 +82,12 @@
 
 // Check to see if it contains ../
 if (!check_media_path($directory)) {
-	$admin->print_header();
+	// $admin->print_header();
 	$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']);
 }
 
 if(!file_exists(WB_PATH.MEDIA_DIRECTORY.$directory)) {
-	$admin->print_header();
+	// $admin->print_header();
 	$admin->print_error($MESSAGE['MEDIA']['DIR_DOES_NOT_EXIST']);
 }
 
Index: branches/2.8.x/wb/admin/media/delete.php
===================================================================
--- branches/2.8.x/wb/admin/media/delete.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/delete.php	(revision 1425)
@@ -39,7 +39,7 @@
 // Get the temp id
 $file_id = $admin->checkIDKEY('id', false, 'GET');
 if (!$file_id) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL,false);
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.'/admin/media/browse.php?dir=',false);
 }
 
 // Get home folder not to show
Index: branches/2.8.x/wb/admin/media/create.php
===================================================================
--- branches/2.8.x/wb/admin/media/create.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/create.php	(revision 1425)
@@ -37,7 +37,7 @@
 
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$admin->print_error('CR5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/media/upload.php
===================================================================
--- branches/2.8.x/wb/admin/media/upload.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/upload.php	(revision 1425)
@@ -35,7 +35,7 @@
 
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$admin->print_error('UP5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
@@ -43,8 +43,9 @@
 require_once(WB_PATH.'/framework/functions.php');
 
 // Check to see if target contains ../
-if (!check_media_path($target, false)) {
-	$admin->print_error($MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH']);
+if (!check_media_path($target, false))
+{
+	$admin->print_error('TD5::'.$MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH']);
 }
 
 // Create relative path of the target location for the file
Index: branches/2.8.x/wb/admin/media/rename.php
===================================================================
--- branches/2.8.x/wb/admin/media/rename.php	(revision 1424)
+++ branches/2.8.x/wb/admin/media/rename.php	(revision 1425)
@@ -38,7 +38,7 @@
 // Get the temp id
 $file_id = $admin->checkIDKEY('id', false, 'GET');
 if (!$file_id) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 }
 
 // Get home folder not to show
Index: branches/2.8.x/wb/admin/templates/uninstall.php
===================================================================
--- branches/2.8.x/wb/admin/templates/uninstall.php	(revision 1424)
+++ branches/2.8.x/wb/admin/templates/uninstall.php	(revision 1425)
@@ -37,7 +37,7 @@
 
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/templates/details.php
===================================================================
--- branches/2.8.x/wb/admin/templates/details.php	(revision 1424)
+++ branches/2.8.x/wb/admin/templates/details.php	(revision 1425)
@@ -24,7 +24,7 @@
 
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/templates/install.php
===================================================================
--- branches/2.8.x/wb/admin/templates/install.php	(revision 1424)
+++ branches/2.8.x/wb/admin/templates/install.php	(revision 1425)
@@ -32,7 +32,7 @@
 
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/pages/save.php
===================================================================
--- branches/2.8.x/wb/admin/pages/save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/pages/save.php	(revision 1425)
@@ -22,12 +22,6 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Pages', 'pages_modify');
 
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
-	exit();
-}
-
 // Get page & section id
 if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id'])) {
 	header("Location: index.php");
@@ -43,6 +37,15 @@
 	$section_id = intval($_POST['section_id']);
 }
 
+// $js_back = "javascript: history.go(-1);";
+$js_back = ADMIN_URL.'/pages/modify.php?page_id='.$page_id
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back );
+	exit();
+}
+
 /*
 if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
 {
@@ -57,8 +60,6 @@
 }
 */
 
-$js_back = "javascript: history.go(-1);";
-
 // Get perms
 $sql  = 'SELECT `admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` ';
 $sql .= 'WHERE `page_id` = '.$page_id;
@@ -111,7 +112,7 @@
 // Check if there is a db error, otherwise say successful
 if($database->is_error())
 {
-	$admin->print_error($database->get_error(), $js_back);
+	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'] );
 } else {
 	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'] );
 }
Index: branches/2.8.x/wb/admin/pages/sections_save.php
===================================================================
--- branches/2.8.x/wb/admin/pages/sections_save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/pages/sections_save.php	(revision 1425)
@@ -33,7 +33,7 @@
 
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/pages/settings2.php
===================================================================
--- branches/2.8.x/wb/admin/pages/settings2.php	(revision 1424)
+++ branches/2.8.x/wb/admin/pages/settings2.php	(revision 1425)
@@ -22,12 +22,6 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Pages', 'pages_settings');
 
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
-	exit();
-}
-
 // Get page id
 if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id']))
 {
@@ -36,7 +30,15 @@
 } else {
 	$page_id = $_POST['page_id'];
 }
+$pagetree_url = ADMIN_URL.'/pages/index.php';
+$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id;
 
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$target_url);
+	exit();
+}
+
 /*
 if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
 {
@@ -310,8 +312,8 @@
 
 /* END page "access file" code */
 
-$pagetree_url = ADMIN_URL.'/pages/index.php';
-$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id;
+//$pagetree_url = ADMIN_URL.'/pages/index.php';
+//$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id;
 // Check if there is a db error, otherwise say successful
 if($database->is_error())
 {
Index: branches/2.8.x/wb/admin/pages/add.php
===================================================================
--- branches/2.8.x/wb/admin/pages/add.php	(revision 1424)
+++ branches/2.8.x/wb/admin/pages/add.php	(revision 1425)
@@ -23,7 +23,7 @@
 
 if (!$admin->checkFTAN())
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
 	exit();
 }
 
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1424)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1425)
@@ -52,6 +52,6 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.2.RC5');
-if(!defined('REVISION')) define('REVISION', '1424');
+if(!defined('REVISION')) define('REVISION', '1425');
 
 ?>
Index: branches/2.8.x/wb/admin/settings/save.php
===================================================================
--- branches/2.8.x/wb/admin/settings/save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/settings/save.php	(revision 1425)
@@ -33,15 +33,15 @@
 	$admin = new admin('Settings', 'settings_advanced');
 }
 
+// Create a javascript back link
+$js_back = ADMIN_URL.'/settings/index.php'.$advanced;
+
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back );
 	exit();
 }
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Ensure that the specified default email is formally valid
 if(isset($_POST['server_email']))
 {
@@ -189,7 +189,7 @@
         if (!$database->query($sql))
         {
 			if($database->is_error()) {
-				$admin->print_error($database->get_error, ADMIN_URL.'/settings/index.php'.$advanced);
+				$admin->print_error($database->get_error, $js_back );
 			}
         }
 	}
@@ -201,7 +201,7 @@
 $res_search = $database->query($sql);
 
 if($database->is_error()) {
-	$admin->print_error($database->is_error(), ADMIN_URL.'/settings/index.php'.$advanced);
+	$admin->print_error($database->is_error(), $js_back );
 }
 
 while($search_setting = $res_search->fetchRow())
@@ -229,9 +229,9 @@
 
 // Check if there was an error updating the db
 if($database->is_error()) {
-	$admin->print_error($database->get_error, ADMIN_URL.'/settings/index.php'.$advanced);
+	$admin->print_error($database->get_error, $js_back );
 } else {
-	$admin->print_success($MESSAGE['SETTINGS']['SAVED'], ADMIN_URL.'/settings/index.php'.$advanced);
+	$admin->print_success($MESSAGE['SETTINGS']['SAVED'], $js_back );
 }
 $admin->print_footer();
 
Index: branches/2.8.x/wb/admin/users/save.php
===================================================================
--- branches/2.8.x/wb/admin/users/save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/users/save.php	(revision 1425)
@@ -21,11 +21,15 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Access', 'users_modify');
 
+
+// Create a javascript back link
+$js_back = ADMIN_URL.'/users/index.php';
+
 // Create new database object
 //$database = new database();
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
 	exit();
 }
 
@@ -48,9 +52,6 @@
 $email = $admin->get_post_escaped('email');
 $home_folder = $admin->get_post_escaped('home_folder');
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Check values
 if($groups_id == "") {
 	$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
@@ -106,7 +107,7 @@
 }
 $database->query($query);
 if($database->is_error()) {
-	$admin->print_error($database->get_error());
+	$admin->print_error($database->get_error(),$js_back);
 } else {
 	$admin->print_success($MESSAGE['USERS']['SAVED']);
 }
Index: branches/2.8.x/wb/admin/users/add.php
===================================================================
--- branches/2.8.x/wb/admin/users/add.php	(revision 1424)
+++ branches/2.8.x/wb/admin/users/add.php	(revision 1425)
@@ -21,11 +21,14 @@
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Access', 'users_add');
 
+// Create a javascript back link
+$js_back = ADMIN_URL.'/users/index.php';
+
 // Create new database object
 //$database = new database();
 if( !$admin->checkFTAN() )
 {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back);
 	exit();
 }
 
@@ -42,9 +45,6 @@
 $home_folder = $admin->get_post_escaped('home_folder');
 $default_language = DEFAULT_LANGUAGE;
 
-// Create a javascript back link
-$js_back = 'javascript: history.go(-1);';
-
 // Check values
 if($groups_id == '') {
 	$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
Index: branches/2.8.x/wb/admin/preferences/save.php
===================================================================
--- branches/2.8.x/wb/admin/preferences/save.php	(revision 1424)
+++ branches/2.8.x/wb/admin/preferences/save.php	(revision 1425)
@@ -1,179 +1,179 @@
-<?php
-/**
- *
- * @category        admin
- * @package         preferences
- * @author          Independend-Software-Team
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-
-// Print admin header
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Preferences');
-$js_back = "javascript: history.go(-1);"; // Create a javascript back link
-
-function save_preferences( &$admin, &$database)
-{
-	global $MESSAGE;
-	$err_msg = array();
-	$min_pass_length = 6;
-// first check form-tan
-	if(!$admin->checkFTAN()){ $err_msg[] = $MESSAGE['GENERIC_SECURITY_ACCESS']; }
-// Get entered values and validate all
-	// remove any dangerouse chars from display_name
-	$display_name     = $admin->add_slashes(strip_tags(trim($admin->get_post('display_name'))));
-	$display_name     = ( $display_name == '' ? $admin->get_display_name() : $display_name );
-	// check that display_name is unique in whoole system (prevents from User-faking)
-	$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` ';
-	$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"';
-	if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['USERNAME_TAKEN']; }
-// language must be 2 upercase letters only
-	$language         = strtoupper($admin->get_post('language'));
-	$language         = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
-// timezone must be between -12 and +13  or -20 as system_default
-	$timezone         = $admin->get_post('timezone');
-	$timezone         = (is_numeric($timezone) ? $timezone : -20);
-	$timezone         = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600;
-// date_format must be a key from /interface/date_formats
-	$date_format      = $admin->get_post('date_format');
-	$date_format_key  = str_replace(' ', '|', $date_format);
-	$user_time = true;
-	include( ADMIN_PATH.'/interface/date_formats.php' );
-	$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default');
-	$date_format = ($date_format == 'system_default' ? '' : $date_format);
-	unset($DATE_FORMATS);
-// time_format must be a key from /interface/time_formats	
-	$time_format      = $admin->get_post('time_format');
-	$time_format_key  = str_replace(' ', '|', $time_format);
-	$user_time = true;
-	include( ADMIN_PATH.'/interface/time_formats.php' );
-	$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default');
-	$time_format = ($time_format == 'system_default' ? '' : $time_format);
-	unset($TIME_FORMATS);
-// email should be validatet by core
-	$email            = ( $admin->get_post('email') == null ? '' : $admin->get_post('email') );
-	if( !$admin->validate_email($email) )
-	{
-		$email = '';
-		$err_msg[] = $MESSAGE['USERS']['INVALID_EMAIL'];
-	}else {
-	// check that email is unique in whoole system
-		$email = $admin->add_slashes($email);
-		$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` ';
-		$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `email` LIKE "'.$email.'"';
-		if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['EMAIL_TAKEN']; }
-	}
-// receive password vars and calculate needed action
-	$current_password = $admin->get_post('current_password');
-	$current_password = ($current_password == null ? '' : $current_password);
-	$new_password_1   = $admin->get_post('new_password_1');
-	$new_password_1   = (($new_password_1 == null || $new_password_1 == '') ? '' : $new_password_1);
-	$new_password_2   = $admin->get_post('new_password_2');
-	$new_password_2   = (($new_password_2 == null || $new_password_2 == '') ? '' : $new_password_2);
-	if($current_password == '')
-	{
-		$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'];
-	}else {
-	// if new_password is empty, still let current one
-		if( $new_password_1 == '' )
-		{
-			$new_password_1 = $current_password;
-			$new_password_2 = $current_password;
-		}
-
-	// is password lenght matching min_pass_lenght ?
-		if( $new_password_1 != $current_password )
-		{
-			if( strlen($new_password_1) < $min_pass_length )
-			{
-				$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT'];
-			}
-			$pattern = '/[^'.$admin->password_chars.']/';
-			if( preg_match($pattern, $new_password_1) )
-			{
-				$err_msg[] = $MESSAGE['PREFERENCES']['INVALID_CHARS'];
-			}
-		}
-	// is password lenght matching min_pass_lenght ?
-		if( $new_password_1 != $current_password && strlen($new_password_1) < $min_pass_length )
-		{
-			$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT'];
-		}
-	// password_1 matching password_2 ?
-		if( $new_password_1 != $new_password_2 )
-		{
-			$err_msg[] = $MESSAGE['USERS']['PASSWORD_MISMATCH'];
-		}
-	}
-	$current_password = md5($current_password);
-	$new_password_1   = md5($new_password_1);
-	$new_password_2   = md5($new_password_2);
-// if no validation errors, try to update the database, otherwise return errormessages
-	if(sizeof($err_msg) == 0)
-	{
-		$sql  = 'UPDATE `'.TABLE_PREFIX.'users` ';
-		$sql .= 'SET `display_name` = "'.$display_name.'", ';
-		$sql .=     '`password` = "'.$new_password_1.'", ';
-		$sql .=     '`email` = "'.$email.'", ';
-		$sql .=     '`language` = "'.$language.'", ';
-		$sql .=     '`timezone` = "'.$timezone.'", ';
-		$sql .=     '`date_format` = "'.$date_format.'", ';
-		$sql .=     '`time_format` = "'.$time_format.'" ';
-		$sql .= 'WHERE `user_id` = '.(int)$admin->get_user_id().' AND `password` = "'.$current_password.'"';
-		if( $database->query($sql) )
-		{
-			$sql_info = mysql_info($database->db_handle);
-			if(preg_match('/matched: *([1-9][0-9]*)/i', $sql_info) != 1)
-			{  // if the user_id and password dosn't match
-				$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'];
-			}else {
-				// update successfull, takeover values into the session
-				$_SESSION['DISPLAY_NAME'] = $display_name;
-				$_SESSION['LANGUAGE'] = $language;
-				$_SESSION['TIMEZONE'] = $timezone;
-				$_SESSION['EMAIL'] = $email;
-				// Update date format
-				if($date_format != '') {
-					$_SESSION['DATE_FORMAT'] = $date_format;
-					if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
-				} else {
-					$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
-					if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
-				}
-				// Update time format
-				if($time_format != '') {
-					$_SESSION['TIME_FORMAT'] = $time_format;
-					if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
-				} else {
-					$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
-					if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
-				}
-			}
-		}else {
-			$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__;
-		}
-	}
-	return ( (sizeof($err_msg) > 0) ? implode('<br />', $err_msg) : '' );
-}
-$retval = save_preferences($admin, $database);
-if( $retval == '')
-{
-	$admin->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED']);
-	$admin->print_footer();
-}else {
-	$admin->print_error($retval, $js_back);
-}
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         preferences
+ * @author          Independend-Software-Team
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+
+// Print admin header
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Preferences');
+// $js_back = "javascript: history.go(-1);"; // Create a javascript back link
+
+function save_preferences( &$admin, &$database)
+{
+	global $MESSAGE;
+	$err_msg = array();
+	$min_pass_length = 6;
+// first check form-tan
+	if(!$admin->checkFTAN()){ $err_msg[] = $MESSAGE['GENERIC_SECURITY_ACCESS']; }
+// Get entered values and validate all
+	// remove any dangerouse chars from display_name
+	$display_name     = $admin->add_slashes(strip_tags(trim($admin->get_post('display_name'))));
+	$display_name     = ( $display_name == '' ? $admin->get_display_name() : $display_name );
+	// check that display_name is unique in whoole system (prevents from User-faking)
+	$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` ';
+	$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"';
+	if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['USERNAME_TAKEN']; }
+// language must be 2 upercase letters only
+	$language         = strtoupper($admin->get_post('language'));
+	$language         = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
+// timezone must be between -12 and +13  or -20 as system_default
+	$timezone         = $admin->get_post('timezone');
+	$timezone         = (is_numeric($timezone) ? $timezone : -20);
+	$timezone         = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600;
+// date_format must be a key from /interface/date_formats
+	$date_format      = $admin->get_post('date_format');
+	$date_format_key  = str_replace(' ', '|', $date_format);
+	$user_time = true;
+	include( ADMIN_PATH.'/interface/date_formats.php' );
+	$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default');
+	$date_format = ($date_format == 'system_default' ? '' : $date_format);
+	unset($DATE_FORMATS);
+// time_format must be a key from /interface/time_formats	
+	$time_format      = $admin->get_post('time_format');
+	$time_format_key  = str_replace(' ', '|', $time_format);
+	$user_time = true;
+	include( ADMIN_PATH.'/interface/time_formats.php' );
+	$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default');
+	$time_format = ($time_format == 'system_default' ? '' : $time_format);
+	unset($TIME_FORMATS);
+// email should be validatet by core
+	$email            = ( $admin->get_post('email') == null ? '' : $admin->get_post('email') );
+	if( !$admin->validate_email($email) )
+	{
+		$email = '';
+		$err_msg[] = $MESSAGE['USERS']['INVALID_EMAIL'];
+	}else {
+	// check that email is unique in whoole system
+		$email = $admin->add_slashes($email);
+		$sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` ';
+		$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `email` LIKE "'.$email.'"';
+		if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['EMAIL_TAKEN']; }
+	}
+// receive password vars and calculate needed action
+	$current_password = $admin->get_post('current_password');
+	$current_password = ($current_password == null ? '' : $current_password);
+	$new_password_1   = $admin->get_post('new_password_1');
+	$new_password_1   = (($new_password_1 == null || $new_password_1 == '') ? '' : $new_password_1);
+	$new_password_2   = $admin->get_post('new_password_2');
+	$new_password_2   = (($new_password_2 == null || $new_password_2 == '') ? '' : $new_password_2);
+	if($current_password == '')
+	{
+		$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'];
+	}else {
+	// if new_password is empty, still let current one
+		if( $new_password_1 == '' )
+		{
+			$new_password_1 = $current_password;
+			$new_password_2 = $current_password;
+		}
+
+	// is password lenght matching min_pass_lenght ?
+		if( $new_password_1 != $current_password )
+		{
+			if( strlen($new_password_1) < $min_pass_length )
+			{
+				$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT'];
+			}
+			$pattern = '/[^'.$admin->password_chars.']/';
+			if( preg_match($pattern, $new_password_1) )
+			{
+				$err_msg[] = $MESSAGE['PREFERENCES']['INVALID_CHARS'];
+			}
+		}
+	// is password lenght matching min_pass_lenght ?
+		if( $new_password_1 != $current_password && strlen($new_password_1) < $min_pass_length )
+		{
+			$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT'];
+		}
+	// password_1 matching password_2 ?
+		if( $new_password_1 != $new_password_2 )
+		{
+			$err_msg[] = $MESSAGE['USERS']['PASSWORD_MISMATCH'];
+		}
+	}
+	$current_password = md5($current_password);
+	$new_password_1   = md5($new_password_1);
+	$new_password_2   = md5($new_password_2);
+// if no validation errors, try to update the database, otherwise return errormessages
+	if(sizeof($err_msg) == 0)
+	{
+		$sql  = 'UPDATE `'.TABLE_PREFIX.'users` ';
+		$sql .= 'SET `display_name` = "'.$display_name.'", ';
+		$sql .=     '`password` = "'.$new_password_1.'", ';
+		$sql .=     '`email` = "'.$email.'", ';
+		$sql .=     '`language` = "'.$language.'", ';
+		$sql .=     '`timezone` = "'.$timezone.'", ';
+		$sql .=     '`date_format` = "'.$date_format.'", ';
+		$sql .=     '`time_format` = "'.$time_format.'" ';
+		$sql .= 'WHERE `user_id` = '.(int)$admin->get_user_id().' AND `password` = "'.$current_password.'"';
+		if( $database->query($sql) )
+		{
+			$sql_info = mysql_info($database->db_handle);
+			if(preg_match('/matched: *([1-9][0-9]*)/i', $sql_info) != 1)
+			{  // if the user_id and password dosn't match
+				$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'];
+			}else {
+				// update successfull, takeover values into the session
+				$_SESSION['DISPLAY_NAME'] = $display_name;
+				$_SESSION['LANGUAGE'] = $language;
+				$_SESSION['TIMEZONE'] = $timezone;
+				$_SESSION['EMAIL'] = $email;
+				// Update date format
+				if($date_format != '') {
+					$_SESSION['DATE_FORMAT'] = $date_format;
+					if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
+				} else {
+					$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
+					if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
+				}
+				// Update time format
+				if($time_format != '') {
+					$_SESSION['TIME_FORMAT'] = $time_format;
+					if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
+				} else {
+					$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
+					if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
+				}
+			}
+		}else {
+			$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__;
+		}
+	}
+	return ( (sizeof($err_msg) > 0) ? implode('<br />', $err_msg) : '' );
+}
+$retval = save_preferences($admin, $database);
+if( $retval == '')
+{
+	$admin->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED']);
+	$admin->print_footer();
+}else {
+	$admin->print_error($retval);
+}
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/admin/addons/reload.php
===================================================================
--- branches/2.8.x/wb/admin/addons/reload.php	(revision 1424)
+++ branches/2.8.x/wb/admin/addons/reload.php	(revision 1425)
@@ -1,144 +1,144 @@
-<?php
-/**
- *
- * @category        admin
- * @package         addons
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL:  $
- * @lastmodified    $Date:  $
- *
- */
-
-/**
- * check if there is anything to do
- */
-$post_check = array('reload_modules', 'reload_templates', 'reload_languages');
-foreach ($post_check as $index => $key) {
-	if (!isset($_POST[$key])) unset($post_check[$index]);
-}
-if (count($post_check) == 0) die(header('Location: index.php?advanced'));
-
-/**
- * check if user has permissions to access this file
- */
-// include WB configuration file and WB admin class
-require_once('../../config.php');
-require_once('../../framework/class.admin.php');
-
-// check user permissions for admintools (redirect users with wrong permissions)
-$admin = new admin('Admintools', 'admintools', false, false);
-if ($admin->get_permission('admintools') == false) die(header('Location: ../../index.php'));
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// check if the referer URL if available
-$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 
-	(isset($HTTP_SERVER_VARS['HTTP_REFERER']) ? $HTTP_SERVER_VARS['HTTP_REFERER'] : '');
-
-// if referer is set, check if script was invoked from "admin/modules/index.php"
-$required_url = ADMIN_URL . '/addons/index.php';
-if ($referer != '' && (!(strpos($referer, $required_url) !== false || strpos($referer, $required_url) !== false))) 
-	die(header('Location: ../../index.php'));
-
-// include WB functions file
-require_once(WB_PATH . '/framework/functions.php');
-
-// load WB language file
-require_once(WB_PATH . '/languages/' . LANGUAGE .'.php');
-
-// create Admin object with admin header
-$admin = new admin('Addons', '', true, false);
-$js_back = ADMIN_URL . '/addons/index.php?advanced';
-
-/**
- * Reload all specified Addons
- */
-$msg = array();
-$table = TABLE_PREFIX . 'addons';
-
-foreach ($post_check as $key) {
-	switch ($key) {
-		case 'reload_modules':
-			if ($handle = opendir(WB_PATH . '/modules')) {
-				// delete modules from database
-				$sql = "DELETE FROM `$table` WHERE `type` = 'module'";
-				$database->query($sql);
-
-				// loop over all modules
-				while(false !== ($file = readdir($handle))) {
-					if ($file != '' && substr($file, 0, 1) != '.' && $file != 'admin.php' && $file != 'index.php') {
-						load_module(WB_PATH . '/modules/' . $file);
-					}
-				}
-				closedir($handle);
-				// add success message
-				$msg[] = $MESSAGE['ADDON']['MODULES_RELOADED'];
-
-			} else {
-				// provide error message and stop
-				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
-			}
-			break;
-			
-		case 'reload_templates':
-			if ($handle = opendir(WB_PATH . '/templates')) {
-				// delete templates from database
-				$sql = "DELETE FROM `$table` WHERE `type` = 'template'";
-				$database->query($sql);
-
-				// loop over all templates
-				while(false !== ($file = readdir($handle))) {
-					if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
-						load_template(WB_PATH . '/templates/' . $file);
-					}
-				}
-				closedir($handle);
-				// add success message
-				$msg[] = $MESSAGE['ADDON']['TEMPLATES_RELOADED'];
-
-			} else {
-				// provide error message and stop
-				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
-			}
-			break;
-
-		case 'reload_languages':
-			if ($handle = opendir(WB_PATH . '/languages/')) {
-				// delete languages from database
-				$sql = "DELETE FROM `$table` WHERE `type` = 'language'";
-				$database->query($sql);
-			
-				// loop over all languages
-				while(false !== ($file = readdir($handle))) {
-					if ($file != '' && substr($file, 0, 1) != '.' && $file != 'index.php') {
-						load_language(WB_PATH . '/languages/' . $file);
-					}
-				}
-				closedir($handle);
-				// add success message
-				$msg[] = $MESSAGE['ADDON']['LANGUAGES_RELOADED'];
-				
-			} else {
-				// provide error message and stop
-				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
-			}
-			break;
-	}
-}
-
-// output success message
-$admin->print_success(implode($msg, '<br />'), $js_back);
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         addons
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL:  $
+ * @lastmodified    $Date:  $
+ *
+ */
+
+/**
+ * check if there is anything to do
+ */
+$post_check = array('reload_modules', 'reload_templates', 'reload_languages');
+foreach ($post_check as $index => $key) {
+	if (!isset($_POST[$key])) unset($post_check[$index]);
+}
+if (count($post_check) == 0) die(header('Location: index.php?advanced'));
+
+/**
+ * check if user has permissions to access this file
+ */
+// include WB configuration file and WB admin class
+require_once('../../config.php');
+require_once('../../framework/class.admin.php');
+
+// check user permissions for admintools (redirect users with wrong permissions)
+$admin = new admin('Admintools', 'admintools', false, false);
+
+if ($admin->get_permission('admintools') == false) die(header('Location: ../../index.php'));
+
+// check if the referer URL if available
+$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] :
+	(isset($HTTP_SERVER_VARS['HTTP_REFERER']) ? $HTTP_SERVER_VARS['HTTP_REFERER'] : '');
+// if referer is set, check if script was invoked from "admin/modules/index.php"
+$required_url = ADMIN_URL . '/addons/index.php';
+if ($referer != '' && (!(strpos($referer, $required_url) !== false || strpos($referer, $required_url) !== false)))
+	die(header('Location: ../../index.php'));
+
+// include WB functions file
+require_once(WB_PATH . '/framework/functions.php');
+
+// load WB language file
+require_once(WB_PATH . '/languages/' . LANGUAGE .'.php');
+
+// create Admin object with admin header
+$admin = new admin('Addons', '', true, false);
+$js_back = ADMIN_URL . '/addons/index.php?advanced';
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
+	exit();
+}
+
+/**
+ * Reload all specified Addons
+ */
+$msg = array();
+$table = TABLE_PREFIX . 'addons';
+
+foreach ($post_check as $key) {
+	switch ($key) {
+		case 'reload_modules':
+			if ($handle = opendir(WB_PATH . '/modules')) {
+				// delete modules from database
+				$sql = "DELETE FROM `$table` WHERE `type` = 'module'";
+				$database->query($sql);
+
+				// loop over all modules
+				while(false !== ($file = readdir($handle))) {
+					if ($file != '' && substr($file, 0, 1) != '.' && $file != 'admin.php' && $file != 'index.php') {
+						load_module(WB_PATH . '/modules/' . $file);
+					}
+				}
+				closedir($handle);
+				// add success message
+				$msg[] = $MESSAGE['ADDON']['MODULES_RELOADED'];
+
+			} else {
+				// provide error message and stop
+				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
+			}
+			break;
+			
+		case 'reload_templates':
+			if ($handle = opendir(WB_PATH . '/templates')) {
+				// delete templates from database
+				$sql = "DELETE FROM `$table` WHERE `type` = 'template'";
+				$database->query($sql);
+
+				// loop over all templates
+				while(false !== ($file = readdir($handle))) {
+					if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
+						load_template(WB_PATH . '/templates/' . $file);
+					}
+				}
+				closedir($handle);
+				// add success message
+				$msg[] = $MESSAGE['ADDON']['TEMPLATES_RELOADED'];
+
+			} else {
+				// provide error message and stop
+				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
+			}
+			break;
+
+		case 'reload_languages':
+			if ($handle = opendir(WB_PATH . '/languages/')) {
+				// delete languages from database
+				$sql = "DELETE FROM `$table` WHERE `type` = 'language'";
+				$database->query($sql);
+			
+				// loop over all languages
+				while(false !== ($file = readdir($handle))) {
+					if ($file != '' && substr($file, 0, 1) != '.' && $file != 'index.php') {
+						load_language(WB_PATH . '/languages/' . $file);
+					}
+				}
+				closedir($handle);
+				// add success message
+				$msg[] = $MESSAGE['ADDON']['LANGUAGES_RELOADED'];
+				
+			} else {
+				// provide error message and stop
+				$admin->print_error($MESSAGE['ADDON']['ERROR_RELOAD'], $js_back);
+			}
+			break;
+	}
+}
+
+// output success message
+$admin->print_success(implode($msg, '<br />'), $js_back);
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/admin/login/forgot/index.php
===================================================================
--- branches/2.8.x/wb/admin/login/forgot/index.php	(revision 1424)
+++ branches/2.8.x/wb/admin/login/forgot/index.php	(revision 1425)
@@ -1,164 +1,163 @@
-<?php
-/**
- *
- * @category        admin
- * @package         login
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
-*/
-
-// Include the configuration file
-require('../../../config.php');
-// Include the language file
-require(WB_PATH.'/languages/'.DEFAULT_LANGUAGE.'.php');
-// Include the database class file and initiate an object
-require(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Start', 'start', false, false);
-$database = new database();
-
-// Get the website title
-$results = $database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name = 'title'");
-$results = $results->fetchRow();
-$website_title = $results['value'];
-
-// Check if the user has already submitted the form, otherwise show it
-if(isset($_POST['email']) AND $_POST['email'] != "") {
-	
-	$email = htmlspecialchars($_POST['email'],ENT_QUOTES);
-	
-	// Check if the email exists in the database
-	$query = "SELECT user_id,username,display_name,email,last_reset,password FROM ".TABLE_PREFIX."users WHERE email = '".$admin->add_slashes($_POST['email'])."'";
-	$results = $database->query($query);
-	if($results->numRows() > 0) {
-
-		// Get the id, username, email, and last_reset from the above db query
-		$results_array = $results->fetchRow();
-		
-		// Check if the password has been reset in the last 2 hours
-		$last_reset = $results_array['last_reset'];
-		$time_diff = time()-$last_reset; // Time since last reset in seconds
-		$time_diff = $time_diff/60/60; // Time since last reset in hours
-		if($time_diff < 2) {
-			
-			// Tell the user that their password cannot be reset more than once per hour
-			$message = $MESSAGE['FORGOT_PASS']['ALREADY_RESET'];
-			
-		} else {
-			
-			$old_pass = $results_array['password'];
-			
-			// Generate a random password then update the database with it
-			$new_pass = '';
-			$salt = "abchefghjkmnpqrstuvwxyz0123456789";
-			srand((double)microtime()*1000000);
-			$i = 0;
-			while ($i <= 7) {
-				$num = rand() % 33;
-				$tmp = substr($salt, $num, 1);
-				$new_pass = $new_pass . $tmp;
-				$i++;
-			}
-			
-			$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".md5($new_pass)."', last_reset = '".time()."' WHERE user_id = '".$results_array['user_id']."'");
-			
-			if($database->is_error()) {
-				// Error updating database
-				$message = $database->get_error();
-			} else {
-				// Setup email to send
-				$mail_to = $email;
-				$mail_subject = $MESSAGE['SIGNUP2']['SUBJECT_LOGIN_INFO'];
-
-				// Replace placeholders from language variable with values
-				$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
-				$replace = array($results_array['display_name'], WEBSITE_TITLE, $results_array['username'], $new_pass); 
-				$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2']['BODY_LOGIN_FORGOT']);
-
-				// Try sending the email
-				if($admin->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) { 
-					$message = $MESSAGE['FORGOT_PASS']['PASSWORD_RESET'];
-					$display_form = false;
-				} else {
-					$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".$old_pass."' WHERE user_id = '".$results_array['user_id']."'");
-					$message = $MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'];
-				}
-			}
-		
-		}
-		
-	} else {
-		// Email doesn't exist, so tell the user
-		$message = $MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'];
-		// and delete the wrong Email
-		$email = '';
-	}
-	
-} else {
-	$email = '';
-}
-
-if(!isset($message)) {
-	$message = $MESSAGE['FORGOT_PASS']['NO_DATA'];
-	$message_color = '000000';
-} else {
-	$message_color = 'FF0000';
-}
-	
-// Setup the template
-$template = new Template(THEME_PATH.'/templates');
-$template->set_file('page', 'login_forgot.htt');
-$template->set_block('page', 'main_block', 'main');
-if(defined('FRONTEND')) {
-	$template->set_var('ACTION_URL', 'forgot.php');
-} else {
-	$template->set_var('ACTION_URL', 'index.php');
-}
-$template->set_var('EMAIL', $email);
-
-if(isset($display_form)) {
-	$template->set_var('DISPLAY_FORM', 'display:none;');
-}
-
-$template->set_var(array(
-								'SECTION_FORGOT' => $MENU['FORGOT'],
-								'MESSAGE_COLOR' => $message_color,
-								'MESSAGE' => $message,
-								'WB_URL' => WB_URL,
-								'ADMIN_URL' => ADMIN_URL,
-								'THEME_URL' => THEME_URL,
-								'LANGUAGE' => strtolower(LANGUAGE),
-								'TEXT_EMAIL' => $TEXT['EMAIL'],
-								'TEXT_SEND_DETAILS' => $TEXT['SEND_DETAILS'],
-								'TEXT_HOME' => $TEXT['HOME'],
-								'TEXT_NEED_TO_LOGIN' => $TEXT['NEED_TO_LOGIN']
-								)
-						);
-
-if(defined('FRONTEND')) {
-	$template->set_var('LOGIN_URL', WB_URL.'/account/login.php');
-} else {
-	$template->set_var('LOGIN_URL', ADMIN_URL);
-}
-$template->set_var('INTERFACE_URL', ADMIN_URL.'/interface');	
-
-if(defined('DEFAULT_CHARSET')) {
-	$charset=DEFAULT_CHARSET;
-} else {
-	$charset='utf-8';
-}
-
-$template->set_var('CHARSET', $charset);	
-
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         login
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+*/
+
+// Include the configuration file
+require('../../../config.php');
+// Include the language file
+require(WB_PATH.'/languages/'.DEFAULT_LANGUAGE.'.php');
+// Include the database class file and initiate an object
+require(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Start', 'start', false, false);
+
+// Get the website title
+$results = $database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name = 'title'");
+$results = $results->fetchRow();
+$website_title = $results['value'];
+
+// Check if the user has already submitted the form, otherwise show it
+if(isset($_POST['email']) AND $_POST['email'] != "") {
+	
+	$email = htmlspecialchars($_POST['email'],ENT_QUOTES);
+	
+	// Check if the email exists in the database
+	$query = "SELECT user_id,username,display_name,email,last_reset,password FROM ".TABLE_PREFIX."users WHERE email = '".$admin->add_slashes($_POST['email'])."'";
+	$results = $database->query($query);
+	if($results->numRows() > 0) {
+
+		// Get the id, username, email, and last_reset from the above db query
+		$results_array = $results->fetchRow();
+		
+		// Check if the password has been reset in the last 2 hours
+		$last_reset = $results_array['last_reset'];
+		$time_diff = time()-$last_reset; // Time since last reset in seconds
+		$time_diff = $time_diff/60/60; // Time since last reset in hours
+		if($time_diff < 2) {
+			
+			// Tell the user that their password cannot be reset more than once per hour
+			$message = $MESSAGE['FORGOT_PASS']['ALREADY_RESET'];
+			
+		} else {
+			
+			$old_pass = $results_array['password'];
+			
+			// Generate a random password then update the database with it
+			$new_pass = '';
+			$salt = "abchefghjkmnpqrstuvwxyz0123456789";
+			srand((double)microtime()*1000000);
+			$i = 0;
+			while ($i <= 7) {
+				$num = rand() % 33;
+				$tmp = substr($salt, $num, 1);
+				$new_pass = $new_pass . $tmp;
+				$i++;
+			}
+			
+			$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".md5($new_pass)."', last_reset = '".time()."' WHERE user_id = '".$results_array['user_id']."'");
+			
+			if($database->is_error()) {
+				// Error updating database
+				$message = $database->get_error();
+			} else {
+				// Setup email to send
+				$mail_to = $email;
+				$mail_subject = $MESSAGE['SIGNUP2']['SUBJECT_LOGIN_INFO'];
+
+				// Replace placeholders from language variable with values
+				$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
+				$replace = array($results_array['display_name'], WEBSITE_TITLE, $results_array['username'], $new_pass); 
+				$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2']['BODY_LOGIN_FORGOT']);
+
+				// Try sending the email
+				if($admin->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) { 
+					$message = $MESSAGE['FORGOT_PASS']['PASSWORD_RESET'];
+					$display_form = false;
+				} else {
+					$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".$old_pass."' WHERE user_id = '".$results_array['user_id']."'");
+					$message = $MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'];
+				}
+			}
+		
+		}
+		
+	} else {
+		// Email doesn't exist, so tell the user
+		$message = $MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'];
+		// and delete the wrong Email
+		$email = '';
+	}
+	
+} else {
+	$email = '';
+}
+
+if(!isset($message)) {
+	$message = $MESSAGE['FORGOT_PASS']['NO_DATA'];
+	$message_color = '000000';
+} else {
+	$message_color = 'FF0000';
+}
+	
+// Setup the template
+$template = new Template(THEME_PATH.'/templates');
+$template->set_file('page', 'login_forgot.htt');
+$template->set_block('page', 'main_block', 'main');
+if(defined('FRONTEND')) {
+	$template->set_var('ACTION_URL', 'forgot.php');
+} else {
+	$template->set_var('ACTION_URL', 'index.php');
+}
+$template->set_var('EMAIL', $email);
+
+if(isset($display_form)) {
+	$template->set_var('DISPLAY_FORM', 'display:none;');
+}
+
+$template->set_var(array(
+								'SECTION_FORGOT' => $MENU['FORGOT'],
+								'MESSAGE_COLOR' => $message_color,
+								'MESSAGE' => $message,
+								'WB_URL' => WB_URL,
+								'ADMIN_URL' => ADMIN_URL,
+								'THEME_URL' => THEME_URL,
+								'LANGUAGE' => strtolower(LANGUAGE),
+								'TEXT_EMAIL' => $TEXT['EMAIL'],
+								'TEXT_SEND_DETAILS' => $TEXT['SEND_DETAILS'],
+								'TEXT_HOME' => $TEXT['HOME'],
+								'TEXT_NEED_TO_LOGIN' => $TEXT['NEED_TO_LOGIN']
+								)
+						);
+
+if(defined('FRONTEND')) {
+	$template->set_var('LOGIN_URL', WB_URL.'/account/login.php');
+} else {
+	$template->set_var('LOGIN_URL', ADMIN_URL);
+}
+$template->set_var('INTERFACE_URL', ADMIN_URL.'/interface');	
+
+if(defined('DEFAULT_CHARSET')) {
+	$charset=DEFAULT_CHARSET;
+} else {
+	$charset='utf-8';
+}
+
+$template->set_var('CHARSET', $charset);	
+
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/admin/login/index.php
===================================================================
--- branches/2.8.x/wb/admin/login/index.php	(revision 1424)
+++ branches/2.8.x/wb/admin/login/index.php	(revision 1425)
@@ -1,63 +1,63 @@
-<?php
-/**
- *
- * @category        admin
- * @package         login
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
-*/
-
-require_once("../../config.php");
-require_once(WB_PATH."/framework/class.login.php");
-
-if(defined('SMART_LOGIN') AND SMART_LOGIN == 'enabled') {
-	// Generate username field name
-	$username_fieldname = 'username_';
-	$password_fieldname = 'password_';
-	$salt = "abchefghjkmnpqrstuvwxyz0123456789";
-	srand((double)microtime()*1000000);
-	$i = 0;
-	while ($i <= 7) {
-		$num = rand() % 33;
-		$tmp = substr($salt, $num, 1);
-		$username_fieldname = $username_fieldname . $tmp;
-		$password_fieldname = $password_fieldname . $tmp;
-		$i++;
-	}
-} else {
-	$username_fieldname = 'username';
-	$password_fieldname = 'password';
-}
-
-$thisApp = new Login(
-							array(
-									'MAX_ATTEMPS' => "3",
-									'WARNING_URL' => THEME_URL."/templates/warning.html",
-									'USERNAME_FIELDNAME' => $username_fieldname,
-									'PASSWORD_FIELDNAME' => $password_fieldname,
-									'REMEMBER_ME_OPTION' => SMART_LOGIN,
-									'MIN_USERNAME_LEN' => "2",
-									'MIN_PASSWORD_LEN' => "2",
-									'MAX_USERNAME_LEN' => "30",
-									'MAX_PASSWORD_LEN' => "30",
-									'LOGIN_URL' => ADMIN_URL."/login/index.php",
-									'DEFAULT_URL' => ADMIN_URL."/start/index.php",
-									'TEMPLATE_DIR' => THEME_PATH."/templates",
-									'TEMPLATE_FILE' => "login.htt",
-									'FRONTEND' => false,
-									'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
-									'USERS_TABLE' => TABLE_PREFIX."users",
-									'GROUPS_TABLE' => TABLE_PREFIX."groups",
-							)
-					);
-
+<?php
+/**
+ *
+ * @category        admin
+ * @package         login
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+*/
+
+require_once("../../config.php");
+require_once(WB_PATH."/framework/class.login.php");
+
+if(defined('SMART_LOGIN') AND SMART_LOGIN == 'enabled') {
+	// Generate username field name
+	$username_fieldname = 'username_';
+	$password_fieldname = 'password_';
+	$salt = "abchefghjkmnpqrstuvwxyz0123456789";
+	srand((double)microtime()*1000000);
+	$i = 0;
+	while ($i <= 7) {
+		$num = rand() % 33;
+		$tmp = substr($salt, $num, 1);
+		$username_fieldname = $username_fieldname . $tmp;
+		$password_fieldname = $password_fieldname . $tmp;
+		$i++;
+	}
+} else {
+	$username_fieldname = 'username';
+	$password_fieldname = 'password';
+}
+
+$thisApp = new Login(
+							array(
+									'MAX_ATTEMPS' => "3",
+									'WARNING_URL' => THEME_URL."/templates/warning.html",
+									'USERNAME_FIELDNAME' => $username_fieldname,
+									'PASSWORD_FIELDNAME' => $password_fieldname,
+									'REMEMBER_ME_OPTION' => SMART_LOGIN,
+									'MIN_USERNAME_LEN' => "2",
+									'MIN_PASSWORD_LEN' => "2",
+									'MAX_USERNAME_LEN' => "30",
+									'MAX_PASSWORD_LEN' => "30",
+									'LOGIN_URL' => ADMIN_URL."/login/index.php",
+									'DEFAULT_URL' => ADMIN_URL."/start/index.php",
+									'TEMPLATE_DIR' => THEME_PATH."/templates",
+									'TEMPLATE_FILE' => "login.htt",
+									'FRONTEND' => false,
+									'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
+									'USERS_TABLE' => TABLE_PREFIX."users",
+									'GROUPS_TABLE' => TABLE_PREFIX."groups",
+							)
+					);
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/account/password.php
===================================================================
--- branches/2.8.x/wb/account/password.php	(revision 1424)
+++ branches/2.8.x/wb/account/password.php	(revision 1425)
@@ -24,15 +24,15 @@
 $new_password = $_POST['new_password'];
 $new_password2 = $_POST['new_password2'];
 
+// Create a javascript back link
+$js_back = WB_URL.'/account/preferences.php';
+
 if (!$wb->checkFTAN())
 {
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back, false);
 	exit();
 }
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Get existing password
 // $database = new database();
 $query = "SELECT user_id FROM ".TABLE_PREFIX."users WHERE user_id = '".$wb->get_user_id()."' AND password = '".md5($current_password)."'";
@@ -42,6 +42,7 @@
 if($results->numRows() == 0) {
 	$wb->print_error($MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'], $js_back, false);
 }
+
 if(strlen($new_password) < 3) {
 	$wb->print_error($MESSAGE['USERS']['PASSWORD_TOO_SHORT'], $js_back, false);
 }
@@ -57,9 +58,9 @@
 $query = "UPDATE ".TABLE_PREFIX."users SET password = '$md5_password' WHERE user_id = '".$wb->get_user_id()."'";
 $database->query($query);
 if($database->is_error()) {
-	$wb->print_error($database->get_error, 'index.php', false);
+	$wb->print_error($database->get_error, $js_back, false);
 } else {
-	$wb->print_success($MESSAGE['PREFERENCES']['PASSWORD_CHANGED'], WB_URL.'/account/preferences.php');
+	$wb->print_success($MESSAGE['PREFERENCES']['PASSWORD_CHANGED']);
 }
 
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/account/details.php
===================================================================
--- branches/2.8.x/wb/account/details.php	(revision 1424)
+++ branches/2.8.x/wb/account/details.php	(revision 1425)
@@ -19,6 +19,15 @@
 // Must include code to stop this file being access directly
 if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
 
+// Create a javascript back link
+$js_back = WB_URL.'/account/preferences.php';
+
+if (!$wb->checkFTAN())
+{
+	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back);
+	exit();
+}
+
 // Get and sanitize entered values
 $display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
 $language = strtoupper($wb->get_post('language'));
@@ -43,23 +52,14 @@
 $time_format = ($time_format == 'system_default' ? '' : $time_format);
 unset($TIME_FORMATS);
 
-if (!$wb->checkFTAN())
-{
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
-	exit();
-}
-
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Update the database
 // $database = new database();
 $query = "UPDATE ".TABLE_PREFIX."users SET display_name = '$display_name', language = '$language', timezone = '$timezone', date_format = '$date_format', time_format = '$time_format' WHERE user_id = '".$wb->get_user_id()."'";
 $database->query($query);
 if($database->is_error()) {
-	$wb->print_error($database->get_error,'index.php',false);
+	$wb->print_error($database->get_error,$js_back,false);
 } else {
-	$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'], WB_URL.'/account/preferences.php');
+	$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'] );
 	$_SESSION['DISPLAY_NAME'] = $display_name;
 	$_SESSION['LANGUAGE'] = $language;
 	// Update date format
Index: branches/2.8.x/wb/account/email.php
===================================================================
--- branches/2.8.x/wb/account/email.php	(revision 1424)
+++ branches/2.8.x/wb/account/email.php	(revision 1425)
@@ -23,15 +23,15 @@
 $current_password = $wb->get_post('current_password');
 $email = $wb->get_post('email');
 
+// Create a javascript back link
+$js_back = WB_URL.'/account/preferences.php';
+
 if (!$wb->checkFTAN())
 {
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back, false);
 	exit();
 }
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Get existing password
 // $database = new database();
 $query = "SELECT user_id FROM ".TABLE_PREFIX."users WHERE user_id = '".$wb->get_user_id()."' AND password = '".md5($current_password)."'";
@@ -53,9 +53,9 @@
 $query = "UPDATE ".TABLE_PREFIX."users SET email = '$email' WHERE user_id = '".$wb->get_user_id()."' AND password = '".md5($current_password)."'";
 $database->query($query);
 if($database->is_error()) {
-	$wb->print_error($database->get_error,'index.php', false);
+	$wb->print_error($database->get_error,$js_back, false);
 } else {
-	$wb->print_success($MESSAGE['PREFERENCES']['EMAIL_UPDATED'], WB_URL.'/account/preferences.php');
+	$wb->print_success($MESSAGE['PREFERENCES']['EMAIL_UPDATED']);
 	$_SESSION['EMAIL'] = $email;
 }
 
Index: branches/2.8.x/wb/account/signup2.php
===================================================================
--- branches/2.8.x/wb/account/signup2.php	(revision 1424)
+++ branches/2.8.x/wb/account/signup2.php	(revision 1425)
@@ -32,15 +32,15 @@
 $display_name = strip_tags($wb->get_post_escaped('display_name'));
 $email = $wb->get_post('email');
 
+// Create a javascript back link
+$js_back = WB_URL.'/account/signup.php';
+
 if (!$wb->checkFTAN())
 {
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
+	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back, false);
 	exit();
 }
 
-// Create a javascript back link
-$js_back = "javascript: history.go(-1);";
-
 // Check values
 if($groups_id == "") {
 	$wb->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back, false);
@@ -123,7 +123,7 @@
 	// Try sending the email
 	if($wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) { 
 		$display_form = false;
-		$wb->print_success($MESSAGE['FORGOT_PASS']['PASSWORD_RESET'], WB_URL.'/account/login.php');
+		$wb->print_success($MESSAGE['FORGOT_PASS']['PASSWORD_RESET'], WB_URL.'/account/login.php' );
 	} else {
 		$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE username = '$username'");
 		$wb->print_error($MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'], $js_back, false);
Index: branches/2.8.x/wb/templates/wb_theme/templates/header.htt
===================================================================
--- branches/2.8.x/wb/templates/wb_theme/templates/header.htt	(revision 1424)
+++ branches/2.8.x/wb/templates/wb_theme/templates/header.htt	(revision 1425)
@@ -7,6 +7,12 @@
 <meta http-equiv="content-language" content="{LANGUAGE}" />
 <meta name="description" content="{TEXT_ADMINISTRATION}" />
 <meta name="keywords" content="{TEXT_ADMINISTRATION}" />
+<meta http-equiv="cache-control" content="no-cache" />
+<meta http-equiv="cache-control" content="no-store" />
+<meta http-equiv="cache-control" content="max-age=0" />
+<meta http-equiv="cache-control" content="must-revalidate" />
+<meta http-equiv="expires" content="0" />
+<meta http-equiv="pragma" content="no-cache" />
 <link href="{THEME_URL}/theme.css" rel="stylesheet" type="text/css" />
 {BACKEND_MODULE_CSS}
 <script type="text/javascript">
Index: branches/2.8.x/wb/templates/argos_theme/theme.css
===================================================================
--- branches/2.8.x/wb/templates/argos_theme/theme.css	(revision 1424)
+++ branches/2.8.x/wb/templates/argos_theme/theme.css	(revision 1425)
@@ -124,6 +124,11 @@
 */
 .header_list_menu_title {text-align:left;}
 .header_list_page_title {width:300px; text-align:left;}
+td.list_page_title { line-height: 1.3em;
+	padding-top: 3px;
+	padding-bottom: 3px;
+}
+
 .header_list_page_id {width:50px; text-align: right; padding-right:15px;}
 .header_list_actions {width:150px; text-align:left;}
 
Index: branches/2.8.x/wb/templates/argos_theme/templates/header.htt
===================================================================
--- branches/2.8.x/wb/templates/argos_theme/templates/header.htt	(revision 1424)
+++ branches/2.8.x/wb/templates/argos_theme/templates/header.htt	(revision 1425)
@@ -7,6 +7,12 @@
 <meta http-equiv="content-language" content="{LANGUAGE}" />
 <meta name="description" content="{TEXT_ADMINISTRATION}" />
 <meta name="keywords" content="{TEXT_ADMINISTRATION}" />
+<meta http-equiv="cache-control" content="no-cache" />
+<meta http-equiv="cache-control" content="no-store" />
+<meta http-equiv="cache-control" content="max-age=0" />
+<meta http-equiv="cache-control" content="must-revalidate" />
+<meta http-equiv="expires" content="0" />
+<meta http-equiv="pragma" content="no-cache" />
 <link href="{THEME_URL}/theme.css" rel="stylesheet" type="text/css" />
 {BACKEND_MODULE_CSS}
 <script type="text/javascript">
Index: branches/2.8.x/wb/modules/menu_link/save.php
===================================================================
--- branches/2.8.x/wb/modules/menu_link/save.php	(revision 1424)
+++ branches/2.8.x/wb/modules/menu_link/save.php	(revision 1425)
@@ -1,58 +1,58 @@
-<?php
-/**
- *
- * @category        modules
- * @package         menu_link
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
-*/
-
-require_once('../../config.php');
-
-// 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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// Update id, anchor and target
-if(isset($_POST['menu_link'])) {
-	$foreign_page_id = $admin->add_slashes($_POST['menu_link']);
-	$page_target = $admin->add_slashes($_POST['page_target']);
-	$url_target = $admin->add_slashes($_POST['target']);
-	$r_type = $admin->add_slashes($_POST['r_type']);
-	if(isset($_POST['extern']))
-		$extern = $admin->add_slashes($_POST['extern']);
-	else
-		$extern='';
-
-	$table_pages = TABLE_PREFIX.'pages';
-	$table_mod = TABLE_PREFIX.'mod_menu_link';
-	$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
-	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
-}
-
-// Check if there is a database error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), $js_back);
-} else {
-	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         menu_link
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+*/
+
+require_once('../../config.php');
+
+// 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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
+	exit();
+}
+
+// Update id, anchor and target
+if(isset($_POST['menu_link'])) {
+	$foreign_page_id = $admin->add_slashes($_POST['menu_link']);
+	$page_target = $admin->add_slashes($_POST['page_target']);
+	$url_target = $admin->add_slashes($_POST['target']);
+	$r_type = $admin->add_slashes($_POST['r_type']);
+	if(isset($_POST['extern']))
+		$extern = $admin->add_slashes($_POST['extern']);
+	else
+		$extern='';
+
+	$table_pages = TABLE_PREFIX.'pages';
+	$table_mod = TABLE_PREFIX.'mod_menu_link';
+	$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
+	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
+}
+
+// Check if there is a database error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), $js_back);
+} else {
+	$admin->print_success($MESSAGE['PAGES']['SAVED'], 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/captcha_control/tool.php
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/tool.php	(revision 1424)
+++ branches/2.8.x/wb/modules/captcha_control/tool.php	(revision 1425)
@@ -36,13 +36,13 @@
 }
 
 $table = TABLE_PREFIX.'mod_captcha_control';
-$js_back = "javascript: history.go(-1);";
+$js_back = ADMIN_URL.'/admintools/tool.php?tool=captcha_control';
 
 // check if data was submitted
 if(isset($_POST['save_settings'])) {
 	if (!$admin->checkFTAN())
 	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back );
 		exit();
 	}
 	
@@ -70,7 +70,7 @@
 	if($database->is_error()) {
 		$admin->print_error($database->get_error(), $js_back);
 	} else {
-		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=captcha_control');
+		$admin->print_success($MESSAGE['PAGES']['SAVED'], $js_back);
 	}
 
 } else {
Index: branches/2.8.x/wb/modules/jsadmin/tool.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/tool.php	(revision 1424)
+++ branches/2.8.x/wb/modules/jsadmin/tool.php	(revision 1425)
@@ -41,7 +41,7 @@
 if(isset($_POST['submit']) AND $_POST['submit'] != '') {
 	if (!$admin->checkFTAN())
 	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
 		exit();
 	}
 
Index: branches/2.8.x/wb/modules/output_filter/tool.php
===================================================================
--- branches/2.8.x/wb/modules/output_filter/tool.php	(revision 1424)
+++ branches/2.8.x/wb/modules/output_filter/tool.php	(revision 1425)
@@ -33,7 +33,7 @@
 	
 	if (!$admin->checkFTAN())
 	{
-		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
+		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI'],false);
 		exit();
 	}
 	// get overall output filter settings
Index: branches/2.8.x/wb/modules/code/save.php
===================================================================
--- branches/2.8.x/wb/modules/code/save.php	(revision 1424)
+++ branches/2.8.x/wb/modules/code/save.php	(revision 1425)
@@ -1,49 +1,49 @@
-<?php
-/**
- *
- * @category        modules
- * @package         code
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// 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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// Update the mod_wysiwygs table with the contents
-if(isset($_POST['content'])) {
-	$tags = array('<?php', '?>' , '<?');
-	$content = $admin->add_slashes(str_replace($tags, '', $_POST['content']));
-	$query = "UPDATE ".TABLE_PREFIX."mod_code SET content = '$content' WHERE section_id = '$section_id'";
-	$database->query($query);	
-}
-
-// Check if there is a database error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), $js_back);
-} else {
-	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         code
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// 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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	exit();
+}
+
+// Update the mod_wysiwygs table with the contents
+if(isset($_POST['content'])) {
+	$tags = array('<?php', '?>' , '<?');
+	$content = $admin->add_slashes(str_replace($tags, '', $_POST['content']));
+	$query = "UPDATE ".TABLE_PREFIX."mod_code SET content = '$content' WHERE section_id = '$section_id'";
+	$database->query($query);	
+}
+
+// Check if there is a database error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), $js_back);
+} else {
+	$admin->print_success($MESSAGE['PAGES']['SAVED'], 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/fckeditor/fckeditor/editor/dialog/fck_link/fck_link.js
===================================================================
--- branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/dialog/fck_link/fck_link.js	(revision 1424)
+++ branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/dialog/fck_link/fck_link.js	(revision 1425)
@@ -466,15 +466,13 @@
 		}
 	}
 
-		var sLnkRel = GetE('cmbAttContentRel').value.Trim() ;
+		var sLnkRel = GetE('cmbAttContentRel') ;
 		if (  (sLnkRel.length == 0) && (oLink.rel.lenght != 0) )	// Modifying an existent rel.
 		{
 			sLnkRel = oLink.rel;
 		}
 
-		var sLinkRel = GetE('cmbAttContentRel');
-
-		if ( sLinkRel.lenght == null ) 
+		if ( sLnkRel.lenght == null ) 
 		{
 			var myselect = document.getElementById("cmbAttContentRel")
 			var found = false;
@@ -802,7 +800,7 @@
 		SetAttribute( oLink, 'tabindex'	, ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ;
 		SetAttribute( oLink, 'title'	, GetE('txtAttTitle').value ) ;
 		SetAttribute( oLink, 'type'		, GetE('txtAttContentType').value ) ;
-		SetAttribute( oLink, 'rel'		, sLnkRel ) ;
+		SetAttribute( oLink, 'rel'		, GetE('cmbAttContentRel').value  ) ;
 		SetAttribute( oLink, 'charset'	, GetE('txtAttCharSet').value ) ;
 
 		if ( oEditor.FCKBrowserInfo.IsIE )
Index: branches/2.8.x/wb/modules/droplets/modify_droplet.php
===================================================================
--- branches/2.8.x/wb/modules/droplets/modify_droplet.php	(revision 1424)
+++ branches/2.8.x/wb/modules/droplets/modify_droplet.php	(revision 1425)
@@ -1,183 +1,183 @@
-<?php
-/**
- *
- * @category        module
- * @package         droplet
- * @author          Ruud Eisinga (Ruud) John (PCWacht)
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-require_once(WB_PATH.'/framework/class.admin.php');
-require_once(WB_PATH.'/framework/functions.php');
-
-$admintool_link = ADMIN_URL .'/admintools/index.php';
-$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
-$admin = new admin('admintools', 'admintools');
-
-// Get id
-$droplet_id = $admin->checkIDKEY('droplet_id', false, 'GET');
-if (!$droplet_id) {
- $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
- exit();
-}
-
-// check if backend.css file needs to be included into the <body></body> of modify.php
-if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
-	echo '<style type="text/css">';
-	include(WB_PATH .'/modules/droplets/backend.css');
-	echo "n</style>n";
-}
-
-// Load Language file
-if(LANGUAGE_LOADED) {
-	if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
-		require_once(WB_PATH.'/modules/droplets/languages/EN.php');
-	} else {
-		require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
-	}
-}
-require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
-echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
-		
-
-$modified_when = time();
-$modified_by = $admin->get_user_id();
-
-// Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_droplets WHERE id = '$droplet_id'");
-$fetch_content = $query_content->fetchRow();
-$content = (htmlspecialchars($fetch_content['code']));
-?>
-<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
-	<a href="<?php echo $admintool_link;?>"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
-	->
-	<a href="<?php echo $module_edit_link;?>">Droplet Edit</a>
-</h4>
-<br />
-<form name="modify" action="<?php echo WB_URL; ?>/modules/droplets/save_droplet.php" method="post" style="margin: 0;">
-<input type="hidden" name="data_codepress" value="" />
-<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>" />
-<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>" />
-<?php echo $admin->getFTAN(); ?>
-
-<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
-		<tr>
-		<td width="10%" class="setting_name">
-			<?php echo $TEXT['NAME']; ?>:
-		</td>
-		<td width="90%">
-			<input type="text" name="title" value="<?php echo stripslashes($fetch_content['name']); ?>" style="width: 38%;" maxlength="32" />
-		</td>
-	</tr>
-	<tr>
-		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['DESCRIPTION']; ?>:</td>
-		<td>
-			<input type="text" name="description" value="<?php echo stripslashes($fetch_content['description']); ?>" style="width: 98%;" />
-		</td>
-	</tr>
-	<tr>
-		<td class="setting_name" width="60px">
-			<?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;">
-			<label><?php echo $TEXT['YES']; ?></label>
-			</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;">
-			<label><?php echo $TEXT['NO']; ?></label>
-			</a>
-		</td>
-	</tr>
-<?php
-// Next show only if admin is logged in, user_id = 1
-if ($modified_by == 1) {
-	?>
-	<tr>
-		<td class="setting_name" width="60px">
-			<?php echo $TEXT['ADMIN']; ?>:
-		</td>
-		<td> 
-			<?php echo $DR_TEXT['ADMIN_EDIT']; ?>&nbsp;   	
-			<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($fetch_content['admin_edit'] == 1) { echo ' checked="checked"'; } ?> />
-			<a href="#" onclick="javascript: document.getElementById('admin_edit_true').checked = true;">
-			<label><?php echo $TEXT['YES']; ?></label>
-			</a>
-			<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($fetch_content['admin_edit'] == 0) { echo ' checked="checked"'; } ?> />
-			<a href="#" onclick="javascript: document.getElementById('admin_edit_false').checked = true;">
-			<label><?php echo $TEXT['NO']; ?></label>
-			</a>
-			&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
-			<?php echo $DR_TEXT['ADMIN_VIEW']; ?>:
-			<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($fetch_content['admin_view'] == 1) { echo ' checked="checked"'; } ?> />
-			<a href="#" onclick="javascript: document.getElementById('admin_view_true').checked = true;">
-			<label><?php echo $TEXT['YES']; ?></label>
-			</a>
-			<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($fetch_content['admin_view'] == 0) { echo ' checked="checked"'; } ?> />
-			<a href="#" onclick="javascript: document.getElementById('admin_view_false').checked = true;">
-			<label><?php echo $TEXT['NO']; ?></label>
-			</a>
-		</td>
-	</tr>
-	<?php
-}
-?>
-	<tr>
-		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['CODE']; ?>:</td>
-		<td ><textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" rows="50" cols="120"><?php echo $content; ?></textarea>&nbsp;
-		</td>
-	</tr>
-	<tr>
-		<td colspan="2">					
-		</td>
-	</tr>
-	<tr>
-		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['COMMENTS']; ?>:</td>
-		<td>
-			<textarea name="comments" style="width: 98%; height: 100px;" rows="50" cols="120"><?php echo stripslashes($fetch_content['comments']); ?></textarea>
-		</td>
-	</tr>
-	<tr>
-		<td colspan="2">&nbsp;					
-		</td>
-	</tr>
-</table>
-<br />
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
-	<tr>
-		<td align="left">
-<?php
-// Show only save button if allowed....
-if ($modified_by == 1 OR $fetch_content['admin_edit'] == 0 ) {
-	?>
-			<button  class="save" name="save" type="submit"><?php echo $TEXT['SAVE']; ?></button>
-	<?php
-}
-?>
-
-		</td>
-		<td align="right">
-			<button class="cancel" type="button" onclick="javascript: window.location = '<?php echo $module_edit_link; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
-		</td>
-	</tr>
-</table>
-</form>
-<?php
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        module
+ * @package         droplet
+ * @author          Ruud Eisinga (Ruud) John (PCWacht)
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+require_once(WB_PATH.'/framework/class.admin.php');
+require_once(WB_PATH.'/framework/functions.php');
+
+$admintool_link = ADMIN_URL .'/admintools/index.php';
+$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
+$admin = new admin('admintools', 'admintools');
+
+// Get id
+$droplet_id = $admin->checkIDKEY('droplet_id', false, 'GET');
+if (!$droplet_id) {
+ $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
+ exit();
+}
+
+// check if backend.css file needs to be included into the <body></body> of modify.php
+if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
+	echo '<style type="text/css">';
+	include(WB_PATH .'/modules/droplets/backend.css');
+	echo "n</style>n";
+}
+
+// Load Language file
+if(LANGUAGE_LOADED) {
+	if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
+		require_once(WB_PATH.'/modules/droplets/languages/EN.php');
+	} else {
+		require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
+	}
+}
+require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
+echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
+		
+
+$modified_when = time();
+$modified_by = $admin->get_user_id();
+
+// Get header and footer
+$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_droplets WHERE id = '$droplet_id'");
+$fetch_content = $query_content->fetchRow();
+$content = (htmlspecialchars($fetch_content['code']));
+?>
+<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
+	<a href="<?php echo $admintool_link;?>"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
+	->
+	<a href="<?php echo $module_edit_link;?>">Droplet Edit</a>
+</h4>
+<br />
+<form name="modify" action="<?php echo WB_URL; ?>/modules/droplets/save_droplet.php" method="post" style="margin: 0;">
+<input type="hidden" name="data_codepress" value="" />
+<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>" />
+<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>" />
+<?php echo $admin->getFTAN(); ?>
+
+<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
+		<tr>
+		<td width="10%" class="setting_name">
+			<?php echo $TEXT['NAME']; ?>:
+		</td>
+		<td width="90%">
+			<input type="text" name="title" value="<?php echo stripslashes($fetch_content['name']); ?>" style="width: 38%;" maxlength="32" />
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['DESCRIPTION']; ?>:</td>
+		<td>
+			<input type="text" name="description" value="<?php echo stripslashes($fetch_content['description']); ?>" style="width: 98%;" />
+		</td>
+	</tr>
+	<tr>
+		<td class="setting_name" width="60px">
+			<?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;">
+			<label><?php echo $TEXT['YES']; ?></label>
+			</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;">
+			<label><?php echo $TEXT['NO']; ?></label>
+			</a>
+		</td>
+	</tr>
+<?php
+// Next show only if admin is logged in, user_id = 1
+if ($modified_by == 1) {
+	?>
+	<tr>
+		<td class="setting_name" width="60px">
+			<?php echo $TEXT['ADMIN']; ?>:
+		</td>
+		<td> 
+			<?php echo $DR_TEXT['ADMIN_EDIT']; ?>&nbsp;   	
+			<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($fetch_content['admin_edit'] == 1) { echo ' checked="checked"'; } ?> />
+			<a href="#" onclick="javascript: document.getElementById('admin_edit_true').checked = true;">
+			<label><?php echo $TEXT['YES']; ?></label>
+			</a>
+			<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($fetch_content['admin_edit'] == 0) { echo ' checked="checked"'; } ?> />
+			<a href="#" onclick="javascript: document.getElementById('admin_edit_false').checked = true;">
+			<label><?php echo $TEXT['NO']; ?></label>
+			</a>
+			&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
+			<?php echo $DR_TEXT['ADMIN_VIEW']; ?>:
+			<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($fetch_content['admin_view'] == 1) { echo ' checked="checked"'; } ?> />
+			<a href="#" onclick="javascript: document.getElementById('admin_view_true').checked = true;">
+			<label><?php echo $TEXT['YES']; ?></label>
+			</a>
+			<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($fetch_content['admin_view'] == 0) { echo ' checked="checked"'; } ?> />
+			<a href="#" onclick="javascript: document.getElementById('admin_view_false').checked = true;">
+			<label><?php echo $TEXT['NO']; ?></label>
+			</a>
+		</td>
+	</tr>
+	<?php
+}
+?>
+	<tr>
+		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['CODE']; ?>:</td>
+		<td ><textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" rows="50" cols="120"><?php echo $content; ?></textarea>&nbsp;
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2">					
+		</td>
+	</tr>
+	<tr>
+		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['COMMENTS']; ?>:</td>
+		<td>
+			<textarea name="comments" style="width: 98%; height: 100px;" rows="50" cols="120"><?php echo stripslashes($fetch_content['comments']); ?></textarea>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2">&nbsp;					
+		</td>
+	</tr>
+</table>
+<br />
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+	<tr>
+		<td align="left">
+<?php
+// Show only save button if allowed....
+if ($modified_by == 1 OR $fetch_content['admin_edit'] == 0 ) {
+	?>
+			<button  class="save" name="save" type="submit"><?php echo $TEXT['SAVE']; ?></button>
+	<?php
+}
+?>
+
+		</td>
+		<td align="right">
+			<button class="cancel" type="button" onclick="javascript: window.location = '<?php echo $module_edit_link; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
+		</td>
+	</tr>
+</table>
+</form>
+<?php
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/droplets/save_droplet.php
===================================================================
--- branches/2.8.x/wb/modules/droplets/save_droplet.php	(revision 1424)
+++ branches/2.8.x/wb/modules/droplets/save_droplet.php	(revision 1425)
@@ -1,80 +1,80 @@
-<?php
-/**
- *
- * @category        module
- * @package         droplet
- * @author          Ruud Eisinga (Ruud) John (PCWacht)
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// Get id
-if(!isset($_POST['droplet_id']) OR !is_numeric($_POST['droplet_id'])) {
-	header("Location: ".ADMIN_URL."/pages/index.php");
-} else {
-	$droplet_id = (int) $_POST['droplet_id'];
-}
-// Include WB admin wrapper script
-require_once(WB_PATH.'/framework/class.admin.php');
-require_once(WB_PATH.'/framework/functions.php');
-
-// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
-if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
-	$admintool_link = ADMIN_URL .'/admintools/index.php';
-	$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
-	$admin = new admin('admintools', 'admintools');
-} else {
-	$admintool_link = ADMIN_URL .'/settings/index.php?advanced=yes#administration_tools"';
-	$module_edit_link = ADMIN_URL .'/settings/tool.php?tool=droplets';
-	$admin = new admin('Settings', 'settings_advanced');
-}
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// Validate all fields
-if($admin->get_post('title') == '') {
-	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
-} else {
-	$title = $admin->add_slashes($admin->get_post('title'));
-	$active = (int) $admin->get_post('active');
-	$admin_view = (int) $admin->get_post('admin_view');
-	$admin_edit = (int) $admin->get_post('admin_edit');
-	$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
-	$description = $admin->add_slashes($admin->get_post('description'));
-	$tags = array('<?php', '?>' , '<?');
-	$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
-	
-	$comments = $admin->add_slashes($admin->get_post('comments'));
-	$modified_when = time();
-	$modified_by = (int) $admin->get_user_id(); 
-}
-
-// Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_droplets SET name = '$title', active = '$active', admin_view = '$admin_view', admin_edit = '$admin_edit', show_wysiwyg = '$show_wysiwyg', description = '$description', code = '$content', comments = '$comments', modified_when = '$modified_when', modified_by = '$modified_by' WHERE id = '$droplet_id'");
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
-} else {
-    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        module
+ * @package         droplet
+ * @author          Ruud Eisinga (Ruud) John (PCWacht)
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// Get id
+if(!isset($_POST['droplet_id']) OR !is_numeric($_POST['droplet_id'])) {
+	header("Location: ".ADMIN_URL."/pages/index.php");
+} else {
+	$droplet_id = (int) $_POST['droplet_id'];
+}
+// Include WB admin wrapper script
+require_once(WB_PATH.'/framework/class.admin.php');
+require_once(WB_PATH.'/framework/functions.php');
+
+// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
+if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
+	$admintool_link = ADMIN_URL .'/admintools/index.php';
+	$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
+	$admin = new admin('admintools', 'admintools');
+} else {
+	$admintool_link = ADMIN_URL .'/settings/index.php?advanced=yes#administration_tools"';
+	$module_edit_link = ADMIN_URL .'/settings/tool.php?tool=droplets';
+	$admin = new admin('Settings', 'settings_advanced');
+}
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
+	exit();
+}
+
+// Validate all fields
+if($admin->get_post('title') == '') {
+	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
+} else {
+	$title = $admin->add_slashes($admin->get_post('title'));
+	$active = (int) $admin->get_post('active');
+	$admin_view = (int) $admin->get_post('admin_view');
+	$admin_edit = (int) $admin->get_post('admin_edit');
+	$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
+	$description = $admin->add_slashes($admin->get_post('description'));
+	$tags = array('<?php', '?>' , '<?');
+	$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
+
+	$comments = $admin->add_slashes($admin->get_post('comments'));
+	$modified_when = time();
+	$modified_by = (int) $admin->get_user_id(); 
+}
+
+// Update row
+$database->query("UPDATE ".TABLE_PREFIX."mod_droplets SET name = '$title', active = '$active', admin_view = '$admin_view', admin_edit = '$admin_edit', show_wysiwyg = '$show_wysiwyg', description = '$description', code = '$content', comments = '$comments', modified_when = '$modified_when', modified_by = '$modified_by' WHERE id = '$droplet_id'");
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
+} else {
+    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ 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 1424)
+++ branches/2.8.x/wb/modules/news/modify_settings.php	(revision 1425)
@@ -1,203 +1,203 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
-@include_once(WB_PATH .'/framework/module.functions.php');
-
-// 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');
-}
-
-// Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
-$fetch_content = $query_content->fetchRow();
-
-// Set raw html <'s and >'s to be replace by friendly html code
-$raw = array('<', '>');
-$friendly = array('&lt;', '&gt;');
-
-// check if backend.css file needs to be included into the <body></body> of modify.php
-if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
-	echo '<style type="text/css">';
-	include(WB_PATH .'/modules/form/backend.css');
-	echo "\n</style>\n";
-}
-
-?>
-<h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2>
-<?php
-// 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'))
-{
-	edit_module_css('news');
-}
-?>
-
-<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; ?>" />
-	<?php echo $admin->getFTAN(); ?>
-	<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">
-				<textarea name="header" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="post_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="footer" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="post_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="post_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td>
-			<td class="setting_value">
-				<select name="posts_per_page" style="width: 98%;">
-					<option value=""><?php echo $TEXT['UNLIMITED']; ?></option>
-					<?php
-					for($i = 1; $i <= 20; $i++) {
-						if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected="selected"'; } else { $selected = ''; }
-						echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>';
-					}
-					?>
-				</select>
-			</td>
-		</tr>
-	</table>
-	<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>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['COMMENTING']; ?>:</td>
-			<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="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>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
-			<td>
-				<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
-				<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
-				<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
-				<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
-			</td>
-		</tr>
-		<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['RESIZE_IMAGE_TO']; ?>:</td>
-			<td class="setting_value">
-				<select name="resize" style="width: 98%;">
-					<option value=""><?php echo $TEXT['NONE']; ?></option>
-					<?php
-					$SIZES['50'] = '50x50px';
-					$SIZES['75'] = '75x75px';
-					$SIZES['100'] = '100x100px';
-					$SIZES['125'] = '125x125px';
-					$SIZES['150'] = '150x150px';
-					foreach($SIZES AS $size => $size_name) {
-						if($fetch_content['resize'] == $size) { $selected = ' selected="selected"'; } else { $selected = ''; }
-						echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
-					}
-					?>
-				</select>
-			</td>
-		</tr>
-		<?php } ?>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="comments_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="comments_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="comments_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
-			</td>
-		</tr>
-		<tr>
-			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>
-			<td class="setting_value">
-				<textarea name="comments_page" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
-			</td>
-		</tr>
-	</table>
-	<table cellpadding="0" cellspacing="0" border="0" width="100%">
-		<tr>
-			<td class="left">
-				<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
-			</td>
-			<td class="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();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
+@include_once(WB_PATH .'/framework/module.functions.php');
+
+// 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');
+}
+
+// Get header and footer
+$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
+$fetch_content = $query_content->fetchRow();
+
+// Set raw html <'s and >'s to be replace by friendly html code
+$raw = array('<', '>');
+$friendly = array('&lt;', '&gt;');
+
+// check if backend.css file needs to be included into the <body></body> of modify.php
+if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
+	echo '<style type="text/css">';
+	include(WB_PATH .'/modules/form/backend.css');
+	echo "\n</style>\n";
+}
+
+?>
+<h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2>
+<?php
+// 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'))
+{
+	edit_module_css('news');
+}
+?>
+
+<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; ?>" />
+	<?php echo $admin->getFTAN(); ?>
+	<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">
+				<textarea name="header" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="post_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="footer" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="post_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="post_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td>
+			<td class="setting_value">
+				<select name="posts_per_page" style="width: 98%;">
+					<option value=""><?php echo $TEXT['UNLIMITED']; ?></option>
+					<?php
+					for($i = 1; $i <= 20; $i++) {
+						if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected="selected"'; } else { $selected = ''; }
+						echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>';
+					}
+					?>
+				</select>
+			</td>
+		</tr>
+	</table>
+	<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>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['COMMENTING']; ?>:</td>
+			<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="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>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
+			<td>
+				<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
+				<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
+				<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
+				<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
+			</td>
+		</tr>
+		<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['RESIZE_IMAGE_TO']; ?>:</td>
+			<td class="setting_value">
+				<select name="resize" style="width: 98%;">
+					<option value=""><?php echo $TEXT['NONE']; ?></option>
+					<?php
+					$SIZES['50'] = '50x50px';
+					$SIZES['75'] = '75x75px';
+					$SIZES['100'] = '100x100px';
+					$SIZES['125'] = '125x125px';
+					$SIZES['150'] = '150x150px';
+					foreach($SIZES AS $size => $size_name) {
+						if($fetch_content['resize'] == $size) { $selected = ' selected="selected"'; } else { $selected = ''; }
+						echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
+					}
+					?>
+				</select>
+			</td>
+		</tr>
+		<?php } ?>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="comments_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="comments_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="comments_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
+			</td>
+		</tr>
+		<tr>
+			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>
+			<td class="setting_value">
+				<textarea name="comments_page" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
+			</td>
+		</tr>
+	</table>
+	<table cellpadding="0" cellspacing="0" border="0" width="100%">
+		<tr>
+			<td class="left">
+				<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
+			</td>
+			<td class="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: branches/2.8.x/wb/modules/news/delete_post.php
===================================================================
--- branches/2.8.x/wb/modules/news/delete_post.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/delete_post.php	(revision 1425)
@@ -1,65 +1,65 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// 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');
-
-$pid = $admin->checkIDKEY('post_id', false, 'GET');
-if (!$pid) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-} else {
-	$post_id = $pid;
-}
-
-// Get post details
-$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
-if($query_details->numRows() > 0) {
-	$get_details = $query_details->fetchRow();
-} else {
-	$admin->print_error($TEXT['NOT_FOUND'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Unlink post access file
-if(is_writable(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION)) {
-	unlink(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION);
-}
-
-// Delete post
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id' LIMIT 1");
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '$post_id'");
-
-// Clean up ordering
-require(WB_PATH.'/framework/class.order.php');
-$order = new order(TABLE_PREFIX.'mod_news_posts', 'position', 'post_id', 'section_id');
-$order->clean($section_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.'&post_id='.$post_id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// 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');
+
+$pid = $admin->checkIDKEY('post_id', false, 'GET');
+if (!$pid) {
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	exit();
+} else {
+	$post_id = $pid;
+}
+
+// Get post details
+$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
+if($query_details->numRows() > 0) {
+	$get_details = $query_details->fetchRow();
+} else {
+	$admin->print_error($TEXT['NOT_FOUND'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+}
+
+// Unlink post access file
+if(is_writable(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION)) {
+	unlink(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION);
+}
+
+// Delete post
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id' LIMIT 1");
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '$post_id'");
+
+// Clean up ordering
+require(WB_PATH.'/framework/class.order.php');
+$order = new order(TABLE_PREFIX.'mod_news_posts', 'position', 'post_id', 'section_id');
+$order->clean($section_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.'&post_id='.$post_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/modify_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify_comment.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/modify_comment.php	(revision 1425)
@@ -1,79 +1,79 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-$comment_id = $admin->checkIDKEY('comment_id', false, 'GET');
-if (!$comment_id) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-} 
-
-// Get header and footer
-$query_content = $database->query("SELECT post_id,title,comment FROM ".TABLE_PREFIX."mod_news_comments WHERE comment_id = '$comment_id'");
-$fetch_content = $query_content->fetchRow();
-?>
-
-<h2><?php echo $TEXT['MODIFY'].' '.$TEXT['COMMENT']; ?></h2>
-
-<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; ?>" />
-<?php echo $admin->getFTAN(); ?>
-<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 valign="top"><?php echo $TEXT['COMMENT']; ?>:</td>
-	<td>
-		<textarea name="comment" rows="10" cols="1" style="width: 98%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
-	</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 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 $admin->getIDKEY($fetch_content['post_id']); ?>';" style="width: 100px; margin-top: 5px;" />
-	</td>
-</tr>
-</table>
-</form>
-
-<?php
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+$comment_id = $admin->checkIDKEY('comment_id', false, 'GET');
+if (!$comment_id) {
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],  ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
+	exit();
+}
+
+// Get header and footer
+$query_content = $database->query("SELECT post_id,title,comment FROM ".TABLE_PREFIX."mod_news_comments WHERE comment_id = '$comment_id'");
+$fetch_content = $query_content->fetchRow();
+?>
+
+<h2><?php echo $TEXT['MODIFY'].' '.$TEXT['COMMENT']; ?></h2>
+
+<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; ?>" />
+<?php echo $admin->getFTAN(); ?>
+<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 valign="top"><?php echo $TEXT['COMMENT']; ?>:</td>
+	<td>
+		<textarea name="comment" rows="10" cols="1" style="width: 98%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
+	</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 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 $admin->getIDKEY($fetch_content['post_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: branches/2.8.x/wb/modules/news/view.php
===================================================================
--- branches/2.8.x/wb/modules/news/view.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/view.php	(revision 1425)
@@ -1,484 +1,484 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-// 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( false != ($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( false != ($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['SCRIPT_NAME'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
-			</div>
-			<?php
-		}
-		while( false != ($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, filemtime ( $post_link_path ));
-    				$create_time = date(TIME_FORMAT, filemtime ( $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, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'hidden');
-					} 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, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', '','hidden');
-					} 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, filemtime ( $post_link_path ));
-    				$create_time = date(TIME_FORMAT, filemtime ( $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]');
-		$pid = $admin->getIDKEY(POST_ID);
-		$values = array(WB_URL."/modules/news/comment.php?post_id=$pid&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( false != ($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=$pid&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();
-	}
-
-}
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+// 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( false != ($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( false != ($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['SCRIPT_NAME'])).'">'.PAGE_TITLE.'</a> &gt;&gt; '.$groups[$_GET['g']]['title']; ?>
+			</div>
+			<?php
+		}
+		while( false != ($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, filemtime ( $post_link_path ));
+    				$create_time = date(TIME_FORMAT, filemtime ( $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, $create_date, $create_time, $publ_date, $publ_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '', 'hidden');
+					} 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, $create_date, $create_time, $publ_date, $publ_time, '', '', '', '', '','hidden');
+					} 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, filemtime ( $post_link_path ));
+    				$create_time = date(TIME_FORMAT, filemtime ( $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'], 'view.php', 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]');
+		// $pid = $admin->getIDKEY(POST_ID);
+		$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( false != ($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/save_group.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_group.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/save_group.php	(revision 1425)
@@ -1,116 +1,116 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// 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
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	exit();
+}
+
+// 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='.$admin->getIDKEY($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='.$admin->getIDKEY($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/save_settings.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_settings.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/save_settings.php	(revision 1425)
@@ -1,69 +1,69 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// 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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// This code removes any <?php tags and adds slashes
-$friendly = array('&lt;', '&gt;', '?php');
-$raw = array('<', '>', '');
-$header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['header']));
-$post_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_loop']));
-$footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['footer']));
-$post_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_header']));
-$post_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_footer']));
-$comments_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_header']));
-$comments_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_loop']));
-$comments_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_footer']));
-$comments_page = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_page']));
-$commenting = $admin->add_slashes($_POST['commenting']);
-$posts_per_page = $admin->add_slashes($_POST['posts_per_page']);
-$use_captcha = $admin->add_slashes($_POST['use_captcha']);
-if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) {
-	$resize = $_POST['resize'];
-} else {
-	$resize = '';
-}
-
-// Update settings
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_settings SET header = '$header', post_loop = '$post_loop', footer = '$footer',
-				 posts_per_page = '$posts_per_page', post_header = '$post_header', post_footer = '$post_footer',
-				 comments_header = '$comments_header', comments_loop = '$comments_loop', comments_footer = '$comments_footer',
-				 comments_page = '$comments_page', commenting = '$commenting', resize = '$resize', use_captcha = '$use_captcha'
-				 WHERE section_id = '$section_id'");
-
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// 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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	exit();
+}
+
+// This code removes any <?php tags and adds slashes
+$friendly = array('&lt;', '&gt;', '?php');
+$raw = array('<', '>', '');
+$header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['header']));
+$post_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_loop']));
+$footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['footer']));
+$post_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_header']));
+$post_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_footer']));
+$comments_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_header']));
+$comments_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_loop']));
+$comments_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_footer']));
+$comments_page = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_page']));
+$commenting = $admin->add_slashes($_POST['commenting']);
+$posts_per_page = $admin->add_slashes($_POST['posts_per_page']);
+$use_captcha = $admin->add_slashes($_POST['use_captcha']);
+if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) {
+	$resize = $_POST['resize'];
+} else {
+	$resize = '';
+}
+
+// Update settings
+$database->query("UPDATE ".TABLE_PREFIX."mod_news_settings SET header = '$header', post_loop = '$post_loop', footer = '$footer',
+				 posts_per_page = '$posts_per_page', post_header = '$post_header', post_footer = '$post_footer',
+				 comments_header = '$comments_header', comments_loop = '$comments_loop', comments_footer = '$comments_footer',
+				 comments_page = '$comments_page', commenting = '$commenting', resize = '$resize', use_captcha = '$use_captcha'
+				 WHERE section_id = '$section_id'");
+
+// Check if there is a db error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_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/delete_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/delete_comment.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/delete_comment.php	(revision 1425)
@@ -1,51 +1,51 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// 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');
-
-$cid = $admin->checkIDKEY('comment_id', false, 'GET');
-$pid = $admin->checkIDKEY('post_id', false, 'GET');
-if (!$pid || !$cid) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-} else {
-	$comment_id = $cid;
-	$post_id = $admin->getIDKEY($pid);
-}
-
-// 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
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// 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');
+
+$cid = $admin->checkIDKEY('comment_id', false, 'GET');
+$pid = $admin->checkIDKEY('post_id', false, 'GET');
+if (!$pid || !$cid) {
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id/*.'&post_id='.$post_id */);
+	exit();
+} else {
+	$comment_id = $cid;
+	$post_id = $admin->getIDKEY($pid);
+}
+
+// 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/modify.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/modify.php	(revision 1425)
@@ -1,211 +1,212 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-// 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()) {
-		$pid = $admin->getIDKEY($post['post_id']);
-		?>
-		<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 $pid; ?>" 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 $pid; ?>">
-					<?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 $pid; ?>" 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 $pid; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
-					<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 $pid; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
-					<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 $pid; ?>');" 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()) {
-		$gid = $admin->getIDKEY($group['group_id']);
-		?>
-		<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 $gid; ?>" 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 $gid; ?>">
-					<?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 $gid; ?>" 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 $gid; ?>" 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;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>');" 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
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+// 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()) {
+		$pid = $admin->getIDKEY($post['post_id']);
+		?>
+		<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 $pid; ?>" 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 $pid; ?>">
+					<?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 $pid; ?>" 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 $pid; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
+					<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 $pid; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
+					<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 $pid; ?>');" 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()) {
+		$gid = $admin->getIDKEY($group['group_id']);
+		?>
+		<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 $gid; ?>" 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 $gid; ?>">
+					<?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 $gid; ?>" 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 $gid; ?>" 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;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>');" 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
Index: branches/2.8.x/wb/modules/news/comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/comment.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/comment.php	(revision 1425)
@@ -1,90 +1,93 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-// Include config file
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.wb.php');
-$wb = new wb;
-
-// Check if there is a post id
-$post_id = $wb->checkIDKEY('post_id', false, 'GET');
-if (!$post_id OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id'])) {
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
-	exit();
-}
-$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');
-	}
-}
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+// Include config file
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.wb.php');
+$wb = new wb;
+
+// Check if there is a post id
+// $post_id = $wb->checkIDKEY('post_id', false, 'GET');
+
+$post_id = (int)$_GET['post_id'];
+$section_id = (int)$_GET['section_id'];
+
+if (!$post_id OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id'])) {
+	$wb->print_error('ABORT::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.PAGES_DIRECTORY );
+	exit();
+}
+
+// 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/modify_group.php
===================================================================
--- branches/2.8.x/wb/modules/news/modify_group.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/modify_group.php	(revision 1425)
@@ -1,99 +1,99 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-$group_id = $admin->checkIDKEY('group_id', false, 'GET');
-if (!$group_id) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-// 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; ?>" />
-<?php echo $admin->getFTAN(); ?>
-<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();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+/* */
+$group_id = $admin->checkIDKEY('group_id', false, 'GET');
+if (!$group_id) {
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$admin->getIDKEY($group_id));
+	exit();
+}
+
+// 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; ?>" />
+<?php echo $admin->getFTAN(); ?>
+<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: branches/2.8.x/wb/modules/news/save_post.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_post.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/save_post.php	(revision 1425)
@@ -1,169 +1,169 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-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 :  filemtime($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);
-    }
-
-}
-
-// 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 = filemtime($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;
-    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();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+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 = (int)$_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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
+	exit();
+}
+
+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 :  filemtime($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);
+    }
+
+}
+
+// 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='.$admin->getIDKEY($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 = filemtime($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;
+    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='.$admin->getIDKEY($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/add_group.php
===================================================================
--- branches/2.8.x/wb/modules/news/add_group.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/add_group.php	(revision 1425)
@@ -1,46 +1,46 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$ 
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// Include WB admin wrapper script
-require(WB_PATH.'/modules/admin.php');
-
-// Include the ordering class
-require(WB_PATH.'/framework/class.order.php');
-// Get new order
-$order = new order(TABLE_PREFIX.'mod_news_groups', 'position', 'group_id', 'section_id');
-$position = $order->get_new($section_id);
-
-// Insert new row into database
-$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id,position,active) VALUES ('$section_id','$page_id','$position','1')");
-
-// Get the id
-$group_id = $admin->getIDKEY($database->get_one("SELECT LAST_INSERT_ID()"));
-
-// Say that a new record has been added, then redirect to modify page
-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'],     WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$ 
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+
+// Include the ordering class
+require(WB_PATH.'/framework/class.order.php');
+// Get new order
+$order = new order(TABLE_PREFIX.'mod_news_groups', 'position', 'group_id', 'section_id');
+$position = $order->get_new($section_id);
+
+// Insert new row into database
+$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id,position,active) VALUES ('$section_id','$page_id','$position','1')");
+
+// Get the id
+$group_id = $admin->getIDKEY($database->get_one("SELECT LAST_INSERT_ID()"));
+
+// Say that a new record has been added, then redirect to modify page
+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'],     WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$group_id);
+}
+
+// Print admin footer
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/delete_group.php
===================================================================
--- branches/2.8.x/wb/modules/news/delete_group.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/delete_group.php	(revision 1425)
@@ -1,46 +1,46 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-require('../../config.php');
-
-// 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');
-
-$gid = $admin->checkIDKEY('group_id', false, 'GET');
-if (!$pid) {
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-} else {
-	$group_id = $gid;
-}
-
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '0' where group_id='$group_id'");
-// Update row
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '$group_id'");
-// Check if there is a db error, otherwise say successful
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-} else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
-}
-
-// Print admin footer
-$admin->print_footer();
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+require('../../config.php');
+
+// 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');
+
+$gid = $admin->checkIDKEY('group_id', false, 'GET');
+if (!$gid) {
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	exit();
+} else {
+	$group_id = $gid;
+}
+
+$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '0' where group_id='$group_id'");
+// Update row
+$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '$group_id'");
+// Check if there is a db error, otherwise say successful
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_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/save_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/save_comment.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/save_comment.php	(revision 1425)
@@ -1,76 +1,76 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-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');
-
-if (!$admin->checkFTAN())
-{
-	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
-	exit();
-}
-
-$id = $admin->getIDKEY($comment_id);
-
-// 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->getIDKEY($admin->get_post('post_id'));
-	
-	// do not allow droplets in user input!
-	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
-	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
-}
-
-// 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
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+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 = (int)$_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');
+
+if (!$admin->checkFTAN())
+{
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
+	exit();
+}
+
+$id = $admin->getIDKEY($comment_id);
+
+// 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->getIDKEY($admin->get_post('post_id'));
+
+	// do not allow droplets in user input!
+	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
+	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
+}
+
+// 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'], 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/submit_comment.php
===================================================================
--- branches/2.8.x/wb/modules/news/submit_comment.php	(revision 1424)
+++ branches/2.8.x/wb/modules/news/submit_comment.php	(revision 1425)
@@ -1,163 +1,164 @@
-<?php
-/**
- *
- * @category        modules
- * @package         news
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL$
- * @lastmodified    $Date$
- *
- */
-
-// 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;
-         /*  */
-
-if (!$wb->checkFTAN())
-{
-	$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
-	exit();
-}
-
-// 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']));
-	// do not allow droplets in user input!
-	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
-	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
-	$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 );
-    }
-}
-
+<?php
+/**
+ *
+ * @category        modules
+ * @package         news
+ * @author          WebsiteBaker Project
+ * @copyright       2004-2009, Ryan Djurovich
+ * @copyright       2009-2011, Website Baker Org. e.V.
+ * @link			http://www.websitebaker2.org/
+ * @license         http://www.gnu.org/licenses/gpl.html
+ * @platform        WebsiteBaker 2.8.x
+ * @requirements    PHP 5.2.2 and higher
+ * @version         $Id$
+ * @filesource		$HeadURL$
+ * @lastmodified    $Date$
+ *
+ */
+
+// 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;
+$post_id = (int)$_GET['post_id'];
+$section_id = (int)$_GET['section_id'];
+if (!$wb->checkFTAN())
+{
+	$wb->print_error('SC5::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL."/modules/news/comment.php?post_id=".$post_id."&section_id=".$section_id);
+	exit();
+}
+
+// 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']));
+	// do not allow droplets in user input!
+	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
+	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
+	$page_id = (int)$_GET['page_id'];
+	$section_id = (int)$_GET['section_id'];
+	$post_id = (int)$_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=".(int)$_GET['post_id']."&section_id=".(int)$_GET['section_id']."" ) ;
+	    exit( 0 );
+    }
+	else
+    {
+		header("Location: ".WB_URL.PAGES_DIRECTORY."");
+	    exit( 0 );
+    }
+}
+
 ?>
\ No newline at end of file
