Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1894)
+++ branches/2.8.x/CHANGELOG	(revision 1895)
@@ -13,6 +13,9 @@
 
 
 
+20 Mar-2013 Build 1895 Dietmar Woellbrink (Luisehahne)
+! update jsadmin module and set Version to 1.4.1
+! update news module and set Version to 3.8.7
 19 Mar-2013 Build 1894 Dietmar Woellbrink (Luisehahne)
 # bugfix form intall form284db.sql
 # bugfix wb_search_data.sql layout for table settings 
Index: branches/2.8.x/wb/upgrade-script.php
===================================================================
--- branches/2.8.x/wb/upgrade-script.php	(revision 1894)
+++ branches/2.8.x/wb/upgrade-script.php	(revision 1895)
@@ -953,8 +953,8 @@
 	 * $aModuleList list of proofed modules
 	 */
 	$aModuleList = array(
-	              'captcha_control','code','form','menu_link',
-	              'output_filter','wysiwyg');
+	              'captcha_control','code','form','jsadmin',
+	              'menu_link','news','output_filter','wysiwyg');
 	if(sizeof($aModuleList)) 
 	{
 		echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1894)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1895)
@@ -51,5 +51,5 @@
 
 // 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.3');
-if(!defined('REVISION')) define('REVISION', '1894');
+if(!defined('REVISION')) define('REVISION', '1895');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/modules/jsadmin/info.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/info.php	(revision 1894)
+++ branches/2.8.x/wb/modules/jsadmin/info.php	(revision 1895)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         jsadmin
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link            http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -18,8 +18,8 @@
 $module_directory = 'jsadmin';
 $module_name = 'Javascript Admin';
 $module_function = 'tool';
-$module_version = '1.4.0';
-$module_platform = '2.7 | 2.8.x';
+$module_version = '1.4.1';
+$module_platform = '2.8.4';
 $module_author = 'Stepan Riha, Swen Uth';
 $module_license	= 'BSD License';
 $module_description = 'This module adds Javascript functionality to the Website Baker Admin to improve some of the UI interactions. Uses the YahooUI library.';
Index: branches/2.8.x/wb/modules/jsadmin/install.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/install.php	(revision 1894)
+++ branches/2.8.x/wb/modules/jsadmin/install.php	(revision 1895)
@@ -4,54 +4,30 @@
  * @category        modules
  * @package         JsAdmin
  * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
- * @copyright       (C) 2006, Stepan Riha, 2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
+ * @copyright       2009-2013, WebsiteBaker 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$
+ * @filesource      $HeadURL$
  * @lastmodified    $Date$
  *
 */
 
-// prevent this file from being accessed directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-	die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
-}
-/* -------------------------------------------------------- */
-
-// add new rows to table "settings"
-
-$msg = array ();
-$table = TABLE_PREFIX ."mod_jsadmin";
-$jsadminDefault = array (
-	array ( 'id' => '1','name' => 'mod_jsadmin_persist_order','value' => '1' ),
-	array ( 'id' => '2','name' => 'mod_jsadmin_ajax_order_pages','value' => '1' ),
-	array ( 'id' => '3','name' => 'mod_jsadmin_ajax_order_sections','value' => '1' ),
-);
-
-$database->query("DROP TABLE IF EXISTS `$table`");
-$sql = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_jsadmin` ('
-	. ' `id` INT(11) NOT NULL DEFAULT \'0\','
-	. ' `name` VARCHAR(255) NOT NULL DEFAULT \'0\','
-	. ' `value` INT(11) NOT NULL DEFAULT \'0\','
-	. ' PRIMARY KEY ( `id` )'
-	. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
-
-if($database->query($sql) ) {
-
-	for($x=0;$x<sizeof($jsadminDefault); $x++) {
-		$sql  = 'INSERT INTO '.$table.' SET ';
-		$sql .= '`id`=\''.$jsadminDefault[$x]['id'].'\', ';
-		$sql .= '`name`=\''.$jsadminDefault[$x]['name'].'\', ';
-		$sql .= '`value`=\''.$jsadminDefault[$x]['value'].'\' ';
-		if(!$database->query($sql) ) { $msg[] = $database->get_error();}
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
+} else {
+	$sError = array();
+	// Create table
+	if(!$database->SqlImport(dirname(__FILE__).'/sql/mod_jsadmin.sql','',false)){
+		$sError[] = $database->get_error();
 	}
-} else {
-	$msg[] = $database->get_error();
+// Create table
+	if(!$database->SqlImport(dirname(__FILE__).'/sql/data_jsadmin.sql','',false)){
+		$sError[] = $database->get_error();
+	}
 }
-
Index: branches/2.8.x/wb/modules/jsadmin/sql/mod_jsadmin.sql
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/sql/mod_jsadmin.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/jsadmin/sql/mod_jsadmin.sql	(revision 1895)
@@ -0,0 +1,22 @@
+-- phpMyAdmin SQL Dump
+-- Erstellungszeit: 15. Mrz 2013 um 18:21
+-- Server-Version: 5.5.27
+--
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+-- --------------------------------------------------------
+-- Database structure for WebsiteBaker core
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_jsadmin`
+--
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_jsadmin` (
+  `id` int(11) NOT NULL DEFAULT '0',
+  `name` varchar(255) NOT NULL DEFAULT '',
+  `value` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+){TABLE_ENGINE};
+-- EndOfFile
\ No newline at end of file
Index: branches/2.8.x/wb/modules/jsadmin/sql/data_jsadmin.sql
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/sql/data_jsadmin.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/jsadmin/sql/data_jsadmin.sql	(revision 1895)
@@ -0,0 +1,19 @@
+-- phpMyAdmin SQL Dump
+-- Erstellungszeit: 18. Mrz 2013 um 04:35
+-- Server Version: 5.5.27
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+-- --------------------------------------------------------
+-- Database structure for WebsiteBaker core
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Daten für Tabelle `mod_jsadmin`
+--
+
+INSERT INTO `{TABLE_PREFIX}mod_jsadmin` VALUES(1, 'mod_jsadmin_persist_order', 1);
+INSERT INTO `{TABLE_PREFIX}mod_jsadmin` VALUES(2, 'mod_jsadmin_ajax_order_pages', 1);
+INSERT INTO `{TABLE_PREFIX}mod_jsadmin` VALUES(3, 'mod_jsadmin_ajax_order_sections', 1);
+-- EndOfFile
\ No newline at end of file
Index: branches/2.8.x/wb/modules/jsadmin/upgrade.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/upgrade.php	(revision 1894)
+++ branches/2.8.x/wb/modules/jsadmin/upgrade.php	(revision 1895)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         jsadmin
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2013, WebsiteBaker Org. e.V.
  * @link            http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -16,22 +16,65 @@
  */
 // Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 
-$msg = '';
-$sTable = TABLE_PREFIX.'mod_jsadmin';
-if(($sOldType = $database->getTableEngine($sTable))) {
-	if(('myisam' != strtolower($sOldType))) {
-		if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) {
-			$msg = $database->get_error();
+	function mod_jsadmin_upgrade($bDebug=false) {
+		global $OK ,$FAIL;
+		$database=WbDatabase::getInstance();
+		$msg = array();
+		$callingScript = $_SERVER["SCRIPT_NAME"];
+		// check if upgrade startet by upgrade-script to echo a message
+		$tmp = 'upgrade-script.php';
+		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
+// check for missing tables, if true stop the upgrade
+		$aTable = array('mod_jsadmin');
+		$aPackage = UpgradeHelper::existsAllTables($aTable);
+		if( sizeof($aPackage) > 0){
+			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
+			$msg[] = 'Jsadmin upgrade failed'." $FAIL";
+			if($globalStarted) {
+				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+			}
+			return ( ($globalStarted==true ) ? $globalStarted : $msg);
+		} else {
+			for($x=0; $x<sizeof($aTable);$x++) {
+				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
+					if(('myisam' != strtolower($sOldType))) {
+						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
+							$msg[] = $database->get_error();
+						} else{
+							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
+						}
+					} else {
+						$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
+					}
+				} else {
+					$msg[] = $database->get_error();
+				}
+			}
+// only for upgrade-script
+			if($globalStarted) {
+				if($bDebug) {
+					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+				}
+			}
 		}
+		$msg[] = 'Jsadmin upgrade successfull finished '." $OK";
+		if($globalStarted) {
+			echo "<strong>Jsadmin upgrade successfull finished $OK</strong><br />";
+		}
+		return ( ($globalStarted==true ) ? $globalStarted : $msg);
 	}
-} else {
-	$msg = $database->get_error();
+// ------------------------------------
+
+$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
+// Don't show the messages twice
+if( is_array($msg = mod_jsadmin_upgrade($bDebugModus)) ) {
+	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
 }
 // ------------------------------------
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/info.php
===================================================================
--- branches/2.8.x/wb/modules/news/info.php	(revision 1894)
+++ branches/2.8.x/wb/modules/news/info.php	(revision 1895)
@@ -26,8 +26,8 @@
 $module_directory   = 'news';
 $module_name        = 'News';
 $module_function    = 'page';
-$module_version     = '3.5.6';
-$module_platform    = '2.8.2';
+$module_version     = '3.5.7';
+$module_platform    = '2.8.4';
 $module_author      = 'Ryan Djurovich, Rob Smith, Werner v.d.Decken';
 $module_license     = 'GNU General Public License';
 $module_description = 'This page type is designed for making a news page.';

Property changes on: branches/2.8.x/wb/modules/news/info.php
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: branches/2.8.x/wb/modules/news/view.php
===================================================================
--- branches/2.8.x/wb/modules/news/view.php	(revision 1894)
+++ branches/2.8.x/wb/modules/news/view.php	(revision 1895)
@@ -4,23 +4,22 @@
  * @category        modules
  * @package         news
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
+ * @copyright       2009-2013, WebsiteBaker 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$
+ * @filesource      $HeadURL$
  * @lastmodified    $Date$
  *
  */
 
-// Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 global $post_id, $post_section,$TEXT,$MESSAGE;
@@ -30,8 +29,7 @@
 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'))
-{
+if(function_exists('ini_set')) {
 	ini_set('arg_separator.output', '&amp;');
 }
 
@@ -48,7 +46,7 @@
 // Get groups (title, if they are active, and their image [if one has been uploaded])
 if (isset($groups))
 {
-   unset($groups);
+	unset($groups);
 }
 
 $groups[0]['title'] = '';
@@ -60,13 +58,12 @@
 {
 
 	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'))
-        {
+		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'] = '';
@@ -80,8 +77,7 @@
 {
 
 	// Check if we should only list posts from a certain group
-	if(isset($_GET['g']) AND is_numeric($_GET['g']))
-    {
+	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
 	} else {
 		$query_extra = '';
@@ -88,8 +84,7 @@
 	}
 
 	// Check if we should only list posts from a certain group
-	if(isset($_GET['g']) AND is_numeric($_GET['g']))
-    {
+	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
 		$query_extra = 'AND `group_id`='.(int)$_GET['g'].' ';
 	} else {
 		$query_extra = '';
@@ -116,8 +111,7 @@
 	$sql .=        'AND (`published_until`=0 OR `published_until`>='.$t.') ';
 	$total_num = intval($database->get_one($sql));
 	// Work-out if we need to add limit code to sql
-	if($setting_posts_per_page != 0)
-    {
+	if($setting_posts_per_page != 0) {
 		$limit_sql = " LIMIT $position, $setting_posts_per_page";
 	} else {
 		$limit_sql = "";
@@ -132,11 +126,10 @@
 
 	// Create previous and next links
 	if($setting_posts_per_page != 0)
-    {
+	{
 		if($position > 0)
-        {
-			if(isset($_GET['g']) AND is_numeric($_GET['g']))
-            {
+		{
+			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; ';
@@ -148,13 +141,11 @@
 			$previous_link = '';
 			$previous_page_link = '';
 		}
-		if($position + $setting_posts_per_page >= $total_num)
-        {
+		if($position + $setting_posts_per_page >= $total_num) {
 			$next_link = '';
 			$next_page_link = '';
 		} else {
-			if(isset($_GET['g']) AND is_numeric($_GET['g']))
-            {
+			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).'"> ';
@@ -163,8 +154,7 @@
 			$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)
-        {
+		if($position+$setting_posts_per_page > $total_num) {
 			$num_of = $position+$num_posts;
 		} else {
 			$num_of = $position+$setting_posts_per_page;
@@ -177,8 +167,7 @@
 		$display_previous_next_links = 'none';
 	}
 
-	if ($num_posts === 0)
-    {
+	if ($num_posts === 0) {
 		$setting_header = '';
 		$setting_post_loop = '';
 		$setting_footer = '';
@@ -186,18 +175,17 @@
 	}
 
 	// Print header
-	if($display_previous_next_links == 'none')
-    {
+	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);
+		                    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);
+		                    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']; ?>
@@ -205,14 +193,13 @@
 			<?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
+			{ // 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'])
-                {
+				if ($post['published_when'] === '0'){ $post['published_when'] = time();}
+				if ($post['published_when'] > $post['posted_when']) {
 					$post_date = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
 					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
 				} else {
@@ -220,26 +207,22 @@
 					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
 				}
 
-				$publ_date = date(DATE_FORMAT,$post['published_when']);
-				$publ_time = date(TIME_FORMAT,$post['published_when']);
+				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
+				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
 
-				// Work-out the post link
+// Work-out the post link
 				$post_link = page_link($post['link']);
+				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
+				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
+				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
 
-                $post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
-    			$create_date = date(DATE_FORMAT, $post['created_when']);
-    			$create_time = date(TIME_FORMAT, $post['created_when']);
-
-				if(isset($_GET['p']) AND $position > 0)
-                {
+				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 .= '?'; }
-                    {
+				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
@@ -257,16 +240,14 @@
 				$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)
-                    {
+				{
+					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');
+						$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)
-                    {
+					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');
@@ -276,173 +257,160 @@
 			}
 		}
 	}
-    // 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);
-    }
+// 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))
 elseif(isset($post_id) && is_numeric($post_id))
 {
-
-  // print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
+// print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
 //  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
-  if(isset($post_section) && ($post_section == $section_id))
-  {
-	// Get settings
-	$setting_post_header = $setting_post_footer = $setting_comments_header
-	                     = $setting_comments_loop = $setting_comments_footer = '';
-	$sql  = 'SELECT `post_header`, `post_footer`, `comments_header`, `comments_loop`, `comments_footer` ';
-	$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
-	$sql .= 'WHERE `section_id`='.(int)$section_id;
-	if( ($resSettings = $database->query($sql)) ){
-		if( ($recSettings = $resSettings->fetchRow()) ) {
-			foreach($recSettings as $key=>$val){
-				${'setting_'.$key} = $val;
+	if(isset($post_section) && ($post_section == $section_id))
+	{
+		// Get settings
+		$setting_post_header = $setting_post_footer = $setting_comments_header
+		                     = $setting_comments_loop = $setting_comments_footer = '';
+		$sql  = 'SELECT `post_header`, `post_footer`, `comments_header`, `comments_loop`, `comments_footer` ';
+		$sql .= 'FROM `'.TABLE_PREFIX.'mod_news_settings` ';
+		$sql .= 'WHERE `section_id`='.(int)$section_id;
+		if( ($resSettings = $database->query($sql)) ){
+			if( ($recSettings = $resSettings->fetchRow()) ) {
+				foreach($recSettings as $key=>$val){
+					${'setting_'.$key} = $val;
+				}
 			}
 		}
-	}
-	// 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'];
+// 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']);
 		}
-		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)");
+		// 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 = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
-				$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
-			}
-            else
-            {
-				$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
-				$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
-			}
+		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 = date(DATE_FORMAT, $post['published_when']+TIMEZONE);
+					$post_time = date(TIME_FORMAT, $post['published_when']+TIMEZONE);
+				} else {
+					$post_date = date(DATE_FORMAT, $post['posted_when']+TIMEZONE);
+					$post_time = date(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+				}
 
-			$publ_date = date(DATE_FORMAT,$post['published_when']);
-			$publ_time = date(TIME_FORMAT,$post['published_when']);
+				$publ_date = date(DATE_FORMAT,$post['published_when']+TIMEZONE);
+				$publ_time = date(TIME_FORMAT,$post['published_when']+TIMEZONE);
 
-			// Work-out the post link
-			$post_link = page_link($post['link']);
+				// Work-out the post link
+				$post_link = page_link($post['link']);
 
-			$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
-			$create_date = date(DATE_FORMAT, $post['created_when']);
-			$create_time = date(TIME_FORMAT, $post['created_when']);
-			// Get group id, title, and image
-			$group_id = $post['group_id'];
-			$group_title = $groups[$group_id]['title'];
-			$group_image = $groups[$group_id]['image'];
-			$display_image = ($group_image == '') ? "none" : "inherit";
-			$display_group = ($group_id == 0) ? 'none' : 'inherit';
+				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
+				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
+				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
+				// 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."' />";
+				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'];
-			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'], '', '', '', '');
+				$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'];
+				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']);
+				$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
 			}
-			// $post_long = ($post['content_long']);
-			$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
+		} else {
+				$wb->print_error($MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'], 'view.php', false);
 		}
-	} else {
-	    	$wb->print_error($MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'], 'view.php', false);
-	}
 
-	// Print post header
-	print str_replace($vars, $values, $setting_post_header);
-	// Print long
-	print $post_long;
+		// Print post header
+		print str_replace($vars, $values, $setting_post_header);
+		// Print long
+		print $post_long;
 
-	// Print post footer
-	print str_replace($vars, $values, $setting_post_footer);
+		// 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);
+		// 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 = date(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
-				$commented_time = date(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
-				$uid = $comment['commented_by'];
+			// 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 = date(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
+					$commented_time = date(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 = '';
 				$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'], '');
-				}
+				$values = array( '', $MOD_NEWS['NO_COMMENT_FOUND'], '', '', '', '', '', '', '', '');
 				print str_replace($vars, $values, $setting_comments_loop);
 			}
-		} else {
-			// Say no comments found
-			$content = '';
-			$vars = array('[TITLE]','[COMMENT]','[TEXT_ON]','[DATE]','[TEXT_AT]','[TIME]','[TEXT_BY]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
-			$values = array( '', $MOD_NEWS['NO_COMMENT_FOUND'], '', '', '', '', '', '', '', '');
-			print str_replace($vars, $values, $setting_comments_loop);
+
+			// 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);
+
 		}
 
-		// 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)
-    {
+	if(ENABLED_ASP) {
 		$_SESSION['comes_from_view'] = $post_id;
 		$_SESSION['comes_from_view_time'] = time();
 	}
Index: branches/2.8.x/wb/modules/news/upgrade.php
===================================================================
--- branches/2.8.x/wb/modules/news/upgrade.php	(revision 1894)
+++ branches/2.8.x/wb/modules/news/upgrade.php	(revision 1895)
@@ -37,160 +37,184 @@
 
 /* -------------------------------------------------------- */
 // Must include code to stop this file being accessed directly
-require_once( dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
-if(!defined('WB_PATH')) { throw new IllegalFileException(); }
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
+}
+
+
 /* -------------------------------------------------------- */
 /* **** START UPGRADE ******************************************************* */
-if(!function_exists('mod_news_Upgrade'))
-{
-	function mod_news_Upgrade()
+//if(!function_exists('mod_news_Upgrade'))
+//{
+	function mod_news_Upgrade($bDebug=false)
 	{
-		global $database, $admin, $MESSAGE,$bDebugModus;
-		$msg = array();
+		global $OK ,$FAIL;
+		$database=WbDatabase::getInstance();
+		$mLang = Translate::getinstance();
+		$sModName = basename(dirname(__FILE__));
+		$mLang->enableAddon('modules\\'.$sModName);
+		$msg    = array();
 		$callingScript = $_SERVER["SCRIPT_NAME"];
 // check if upgrade startet by upgrade-script to echo a message
 		$tmp = 'upgrade-script.php';
 		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
-		/**
-		 * check database engine
-		 */
+// check for missing tables, if true stop the upgrade
 		$aTable = array('mod_news_posts','mod_news_groups','mod_news_comments','mod_news_settings');
-		 for($x=0; $x<sizeof($aTable);$x++) {
-			if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
-				if(('myisam' != strtolower($sOldType))) {
-					if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
-						$msg[] = $database->get_error();
-					} else{
-		                $msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` changed to Engine = \'MyISAM\'';
+		$aPackage = UpgradeHelper::existsAllTables($aTable);
+		if( sizeof($aPackage) > 0){
+			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
+			$msg[] = "WYSIWYG upgrade failed $FAIL";
+			if($globalStarted) {
+				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+			}
+			$mLang->disableAddon();
+			return ( ($globalStarted==true ) ? $globalStarted : $msg);
+		} else {
+			/**
+			 * check database engine
+			 */
+			 for($x=0; $x<sizeof($aTable);$x++) {
+				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
+					if(('myisam' != strtolower($sOldType))) {
+						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
+							$msg[] = $database->get_error()." $FAIL";
+						} else{
+							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
+						}
+					} else {
+						 $msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
 					}
 				} else {
-							 $msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` has Engine = \'MyISAM\'';
+					$msg[] = $database->get_error()." $FAIL";
 				}
-			} else {
-				$msg[] = $database->get_error();
 			}
-		}
 
-		$sPagesPath = WB_PATH.PAGES_DIRECTORY;
-		$sPostsPath = $sPagesPath.'/posts';
+			$sPagesPath = WB_PATH.PAGES_DIRECTORY;
+			$sPostsPath = $sPagesPath.'/posts';
 	// create /posts/ - directory if not exists
-		if(is_writable($sPagesPath)) {
-			if(!($bRetval = is_dir($sPostsPath))) {
-				$iOldUmask = umask(0) ;
-				// sanitize directory mode to 'o+rwx/g+x/u+x' and create path
-				$bRetval = mkdir($sPostsPath, (OCTAL_DIR_MODE |0711), true); 
-				umask($iOldUmask);
-			}
-			if($bRetval) {
-				$msg[] = 'Directory "'.PAGES_DIRECTORY.'/posts/" already exists or created.';
+			if(is_writable($sPagesPath)) {
+				if(!($bRetval = is_dir($sPostsPath))) {
+					$iOldUmask = umask(0) ;
+					// sanitize directory mode to 'o+rwx/g+x/u+x' and create path
+					$bRetval = mkdir($sPostsPath, (OCTAL_DIR_MODE |0711), true); 
+					umask($iOldUmask);
+				}
+				if($bRetval) {
+					$msg[] = 'Directory "'.PAGES_DIRECTORY.'/posts/" already exists or created.'." $OK";
+				}else {
+					$msg[] = ($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE)." $FAIL";
+				}
 			}else {
-				$msg[] = ($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
+					$msg[] = ($mLang->MESSAGE_PAGES_CANNOT_CREATE_ACCESS_FILE)." $FAIL";
 			}
-		}else {
-				$msg[] = ($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
-		}
 	// check if new fields must be added
-		$doImportDate = true;
-		if(!$database->field_exists(TABLE_PREFIX.'mod_news_posts', 'created_when')) {
-			if(!$database->field_add(TABLE_PREFIX.'mod_news_posts', 'created_when',
-			                        'INT NOT NULL DEFAULT \'0\' AFTER `commenting`')) {
-					$msg[] = $MESSAGE['RECORD_MODIFIED_FAILED'];
-			} else {
-				$msg[] = 'TABLE `'.TABLE_PREFIX.'mod_news_posts` Datafield `created_when` added.';
+			$doImportDate = true;
+			if(!$database->field_exists($database->TablePrefix.'mod_news_posts', 'created_when')) {
+				if(!$database->field_add($database->TablePrefix.'mod_news_posts', 'created_when',
+				                        'INT NOT NULL DEFAULT \'0\' AFTER `commenting`')) {
+					$msg[] = $mLang->MESSAGE_RECORD_MODIFIED_FAILED." $FAIL";
+				} else {
+					$msg[] = 'TABLE `'.$database->TablePrefix.'mod_news_posts` Datafield `created_when` added.'." $OK";
+				}
+			} else { 
+				$msg[] = 'TABLE `'.$database->TablePrefix.'mod_news_posts` Datafield `created_when` already exists.'." $OK";
+				$doImportDate = false; 
 			}
-		} else { 
-			$msg[] = 'TABLE `'.TABLE_PREFIX.'mod_news_posts` Datafield `created_when` already exists.';
-			$doImportDate = false; 
-		}
 
-		if(!$database->field_exists(TABLE_PREFIX.'mod_news_posts', 'created_by')) {
-			if(!$database->field_add(TABLE_PREFIX.'mod_news_posts', 'created_by',
-			                        'INT NOT NULL DEFAULT \'0\' AFTER `created_when`')) {
-				$msg[] = $MESSAGE['RECORD_MODIFIED_FAILED'];
+			if(!$database->field_exists($database->TablePrefix.'mod_news_posts', 'created_by')) {
+				if(!$database->field_add($database->TablePrefix.'mod_news_posts', 'created_by',
+				                        'INT NOT NULL DEFAULT \'0\' AFTER `created_when`')) {
+					$msg[] = $mLang->MESSAGE_RECORD_MODIFIED_FAILED." $FAIL";
+				} else {
+					$msg[] = 'TABLE `'.$database->TablePrefix.'mod_news_posts` Datafield `created_by` added.'." $OK";
+				}
+			} else { 
+				$msg[] = 'TABLE `'.$database->TablePrefix.'mod_news_posts` Datafield `created_by` already exists.'." $OK";
+				$doImportDate = false; 
 			}
-		} else { 
-			$msg[] = 'TABLE `'.TABLE_PREFIX.'mod_news_posts` Datafield `created_by` already exists.';
-			$doImportDate = false; 
-		}
  	// preset new fields `created_by` and `created_by` from existing values
-		if($doImportDate) {
-			$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` ';
-			$sql .= 'SET `created_by`=`posted_by`, `created_when`=`posted_when`';
-			$database->query($sql);
-		}
+			if($doImportDate) {
+				$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
+				$sql .= 'SET `created_by`=`posted_by`, `created_when`=`posted_when`';
+				$database->query($sql);
+			}
 
 	/**
 	 * rebuild news post folder
 	 */
 //	$array = rebuildFolderProtectFile($sPostsPath);
-	// now iterate through all existing accessfiles,
-	// write its creation date into database
-		$oDir = new DirectoryIterator($sPostsPath);
-		$count = 0;
-		foreach ($oDir as $fileinfo)
-		{
-			$fileName = $fileinfo->getFilename();
-			if((!$fileinfo->isDot()) &&
-			   ($fileName != 'index.php') &&
-			   (substr_compare($fileName,PAGE_EXTENSION,(0-strlen(PAGE_EXTENSION)),strlen(PAGE_EXTENSION)) === 0)
-			  )
-			{
-			// save creation date from old accessfile
-				if($doImportDate) {
-					$link = '/posts/'.preg_replace('/'.preg_quote(PAGE_EXTENSION).'$/i', '', $fileinfo->getFilename());
-					$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` ';
-					$sql .= 'SET `created_when`='.$fileinfo->getMTime().' ';
-					$sql .= 'WHERE `link`=\''.$link.'\'';
-					if($database->query($sql)) {
-						// delete old access file
-						unlink($fileinfo->getPathname());
-						$count++;
+		// now iterate through all existing accessfiles,
+		// write its creation date into database
+			if(is_writable($sPostsPath)) {
+				$oDir = new DirectoryIterator($sPostsPath);
+				$count = 0;
+				foreach ($oDir as $fileinfo)
+				{
+					$fileName = $fileinfo->getFilename();
+					if((!$fileinfo->isDot()) &&
+					   ($fileName != 'index.php') &&
+					   (substr_compare($fileName,PAGE_EXTENSION,(0-strlen(PAGE_EXTENSION)),strlen(PAGE_EXTENSION)) === 0)
+					  )
+					{
+					// save creation date from old accessfile
+						if($doImportDate) {
+							$link = '/posts/'.preg_replace('/'.preg_quote(PAGE_EXTENSION).'$/i', '', $fileinfo->getFilename());
+							$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
+							$sql .= 'SET `created_when`='.$fileinfo->getMTime().' ';
+							$sql .= 'WHERE `link`=\''.$link.'\'';
+							if($database->query($sql)) {
+								// delete old access file
+								unlink($fileinfo->getPathname());
+								$count++;
+							}
+						}
 					}
 				}
+				unset($oDir);
 			}
-		}
-		unset($oDir);
-
-		if($count > 0) {
-			$msg[] = 'Save date of creation from '.$count.' old accessfiles and delete these files.';
-		}
+			if($count > 0) {
+				$msg[] = 'Save date of creation from '.$count.' old accessfiles and delete these files.'." $OK";
+			}
 // ************************************************
-	// Check the validity of 'create-file-timestamp' and balance against 'posted-timestamp'
-		$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` ';
-		$sql .= 'SET `created_when`=`published_when` ';
-		$sql .= 'WHERE `published_when`<`created_when`';
-		$database->query($sql);
-		$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` ';
-		$sql .= 'SET `created_when`=`posted_when` ';
-		$sql .= 'WHERE `published_when`=0 OR `published_when`>`posted_when`';
-		$database->query($sql);
+		// Check the validity of 'create-file-timestamp' and balance against 'posted-timestamp'
+			$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
+			$sql .= 'SET `created_when`=`published_when` ';
+			$sql .= 'WHERE `published_when`<`created_when`';
+			$database->query($sql);
+			$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
+			$sql .= 'SET `created_when`=`posted_when` ';
+			$sql .= 'WHERE `published_when`=0 OR `published_when`>`posted_when`';
+			$database->query($sql);
 // ************************************************
 
-        // only for upgrade-script
-        if($globalStarted) {
-            if($bDebugModus) {
-                foreach($msg as $title) {
-                    echo '<strong>'.$title.'</strong><br />';
-                }
-            }
-        } 
-        return ( ($globalStarted==true ) ? $globalStarted : $msg);
+			// only for upgrade-script
+			if($globalStarted) {
+				if($bDebug) {
+					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+				}
+			} 
+		}
+		$msg[] = "News upgrade successfull finished $OK";
+		if($globalStarted) {
+			echo "<strong>News upgrade successfull finished $OK</strong><br />";
+		}
+		$mLang->disableAddon();
+		return ( ($globalStarted==true ) ? $globalStarted : $msg);
 	}
-}
+//}
 // end mod_news_Upgrade
 
 // ------------------------------------
 // only show if manuell upgrade
-if( is_array($msg = mod_news_Upgrade()) ) {
+$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
+// Don't show the messages twice
+if( is_array($msg = mod_news_Upgrade($bDebugModus)) ) {
 	$sModulReorg = 'm_news_Reorg';
 	if(class_exists($sModulReorg)) {
 		$oReorg = new $sModulReorg();
 		$msg = array_merge($msg, $oReorg->execute() ); // show details
-//		$msg = array_merge($msg,(new $sModulReorg())->execute()); // show details
 	}
-    foreach($msg as $title) {
-        echo '<strong>'.$title.'</strong><br />';
-    }
-	echo '<strong>News upgrade finished </strong><br /><br>';
+	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
 }
 /* **** END UPGRADE ********************************************************* */

Property changes on: branches/2.8.x/wb/modules/news/upgrade.php
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: branches/2.8.x/wb/modules/news/install.php
===================================================================
--- branches/2.8.x/wb/modules/news/install.php	(revision 1894)
+++ branches/2.8.x/wb/modules/news/install.php	(revision 1895)
@@ -19,10 +19,10 @@
 require_once( dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
 if(!defined('WB_PATH')) { throw new IllegalFileException(); }
 /* -------------------------------------------------------- */
-	$sDefaultSql = dirname(__FILE__).'/install.sql';
+	$sDefaultSql = dirname(__FILE__).'/sql/mod_news.sql';
 	if (is_readable($sDefaultSql)) {
 // create needet database tables and set default records
-		if ($database->SqlImport($sDefaultSql, TABLE_PREFIX)) {
+		if ($database->SqlImport($sDefaultSql, '',false)) {
 // Make news post access files dir
 			require_once(WB_PATH.'/framework/functions.php');
 			if(make_dir(WB_PATH.PAGES_DIRECTORY.'/posts')) {
Index: branches/2.8.x/wb/modules/news/sql/mod_news.sql
===================================================================
--- branches/2.8.x/wb/modules/news/sql/mod_news.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/news/sql/mod_news.sql	(revision 1895)
@@ -0,0 +1,88 @@
+-- phpMyAdmin SQL Dump
+-- Erstellungszeit: 20. Januar 2012 um 12:37
+-- Server Version: 5.1.41
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+-- --------------------------------------------------------
+-- Database structure for module 'news'
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_news_comments`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_news_comments`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_news_comments` (
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `post_id` int(11) NOT NULL DEFAULT '0',
+  `title` varchar(255){TABLE_COLLATION} NOT NULL,
+  `comment` text{TABLE_COLLATION} NOT NULL,
+  `commented_when` int(11) NOT NULL DEFAULT '0',
+  `commented_by` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`comment_id`)
+){TABLE_ENGINE};
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_news_groups`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_news_groups`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_news_groups` (
+  `group_id` int(11) NOT NULL AUTO_INCREMENT,
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `active` int(11) NOT NULL DEFAULT '0',
+  `position` int(11) NOT NULL DEFAULT '0',
+  `title` varchar(255){TABLE_COLLATION} NOT NULL,
+  PRIMARY KEY (`group_id`)
+){TABLE_ENGINE};
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_news_posts`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_news_posts`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_news_posts` (
+  `post_id` int(11) NOT NULL AUTO_INCREMENT,
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `group_id` int(11) NOT NULL DEFAULT '0',
+  `active` int(11) NOT NULL DEFAULT '0',
+  `position` int(11) NOT NULL DEFAULT '0',
+  `title` varchar(255){TABLE_COLLATION} NOT NULL,
+  `link` text{TABLE_COLLATION} NOT NULL,
+  `content_short` text{TABLE_COLLATION} NOT NULL,
+  `content_long` text{TABLE_COLLATION} NOT NULL,
+  `commenting` varchar(7){TABLE_COLLATION} NOT NULL,
+  `created_when` int(11) NOT NULL,
+  `created_by` int(11) NOT NULL,
+  `published_when` int(11) NOT NULL DEFAULT '0',
+  `published_until` int(11) NOT NULL DEFAULT '0',
+  `posted_when` int(11) NOT NULL DEFAULT '0',
+  `posted_by` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`post_id`)
+){TABLE_ENGINE};
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_news_settings`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_news_settings`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_news_settings` (
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `header` text{TABLE_COLLATION} NOT NULL,
+  `post_loop` text{TABLE_COLLATION} NOT NULL,
+  `footer` text{TABLE_COLLATION} NOT NULL,
+  `posts_per_page` int(11) NOT NULL DEFAULT '0',
+  `post_header` text{TABLE_COLLATION} NOT NULL,
+  `post_footer` text{TABLE_COLLATION} NOT NULL,
+  `comments_header` text{TABLE_COLLATION} NOT NULL,
+  `comments_loop` text{TABLE_COLLATION} NOT NULL,
+  `comments_footer` text{TABLE_COLLATION} NOT NULL,
+  `comments_page` text{TABLE_COLLATION} NOT NULL,
+  `commenting` varchar(7){TABLE_COLLATION} NOT NULL,
+  `resize` int(11) NOT NULL DEFAULT '0',
+  `use_captcha` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`section_id`)
+){TABLE_ENGINE};
+-- EndOfFile
\ No newline at end of file
Index: branches/2.8.x/wb/modules/news/sql
===================================================================
--- branches/2.8.x/wb/modules/news/sql	(nonexistent)
+++ branches/2.8.x/wb/modules/news/sql	(revision 1895)

Property changes on: branches/2.8.x/wb/modules/news/sql
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+install.php
