Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1508)
+++ branches/2.8.x/CHANGELOG	(revision 1509)
@@ -12,6 +12,8 @@
 
 =============================== FEATURES FREEZE ================================
 ----------------------------------- Fixes 2.8.2 --------------------------------
+07 Sep-2011 Build 1509 Dietmar Woellbrink (Luisehahne)
+# continue fixing frontend account
 07 Sep-2011 Build 1508 Dietmar Woellbrink (Luisehahne)
 # fixed print_error exit in frontend account
 06 Sep-2011 Build 1507 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1508)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1509)
@@ -52,4 +52,4 @@
 
 // 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');
-if(!defined('REVISION')) define('REVISION', '1508');
+if(!defined('REVISION')) define('REVISION', '1509');
Index: branches/2.8.x/wb/admin/preferences/index.php
===================================================================
--- branches/2.8.x/wb/admin/preferences/index.php	(revision 1508)
+++ branches/2.8.x/wb/admin/preferences/index.php	(revision 1509)
@@ -108,7 +108,6 @@
 // assign systemvars to template
 	$template->set_var(array( 'ADMIN_URL'  => ADMIN_URL,
 	                          'WB_URL'     => WB_URL,
-                              'WB_PATH'    => WB_PATH,
                               'THEME_URL'  => THEME_URL,
 		                      'ACTION_URL' => ADMIN_URL.'/preferences/save.php'
                             )
Index: branches/2.8.x/wb/account/frontend.css
===================================================================
--- branches/2.8.x/wb/account/frontend.css	(nonexistent)
+++ branches/2.8.x/wb/account/frontend.css	(revision 1509)
@@ -0,0 +1,28 @@
+/* <![CDATA[ */
+/*
+  CSS definition for Website Baker module: WB-Preferences
+  Copyright (C) 2008, Werner von der Decken
+  Contact me: wkl(at)isteam.de, http://isteam.de
+
+  This CSS file is free software. You can redistribute it and/or modify it
+  under the terms of the GNU General Public License  - version 2 or later,
+  as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
+
+  This CSS file is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+*/
+	.mod_preferences_error {
+		background-color:#ffb0b0;
+		padding:5px;
+		border:dotted 1px #ff0000;
+		color:#ff0000;
+	}
+	.mod_preferences_success {
+		background-color:#b0ffb0;
+		padding:5px;
+		border:dotted 1px #303030;
+		color:#303030;
+	}
+/* ]]> */

Property changes on: branches/2.8.x/wb/account/frontend.css
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Revision
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/css
\ No newline at end of property
Index: branches/2.8.x/wb/account/forgot_form.php
===================================================================
--- branches/2.8.x/wb/account/forgot_form.php	(revision 1508)
+++ branches/2.8.x/wb/account/forgot_form.php	(revision 1509)
@@ -101,8 +101,14 @@
 } else {
 	$message_color = 'FF0000';
 }
+
+$_SESSION['PAGE_LINK'] = get_page_link( $_SESSION['PAGE_ID'] );
+$_SESSION['HTTP_REFERER'] = page_link($_SESSION['PAGE_LINK']);
 	
 ?>
+<div style="margin: 1em auto;">
+	<button type="button" value="cancel" onClick="javascript: window.location = '<?php print $_SESSION['HTTP_REFERER'] ?>';"><?php print $TEXT['CANCEL'] ?></button>
+</div>
 <h1 style="text-align: center;"><?php echo $MENU['FORGOT']; ?></h1>
 
 <form name="forgot_pass" action="<?php echo WB_URL.'/account/forgot.php'; ?>" method="post">
Index: branches/2.8.x/wb/account/preferences_form.php
===================================================================
--- branches/2.8.x/wb/account/preferences_form.php	(revision 1508)
+++ branches/2.8.x/wb/account/preferences_form.php	(revision 1509)
@@ -73,29 +73,22 @@
 	$template->set_var('DISPLAY_NAME', $row['display_name']);
 	$template->set_var('EMAIL', $row['email']);
 
-// Insert language values
-	$template->set_block('main_block', 'language_list_block', 'language_list');
-	$sql = "SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name";
-	$rowset = $database->query($sql);
-	if($rowset->numRows() > 0) {
-		while($row = $rowset->fetchRow()) {
-			$l_codes[$row['name']] = $row['directory'];
-			$l_names[$row['name']] = entities_to_7bit($row['name']); // sorting-problem workaround
-		}
-		asort($l_names);
-		foreach($l_names as $l_name=>$v) {
-			// Insert code and name
-			$template->set_var(array( 'CODE' => $l_codes[$l_name], 'NAME' => $l_name ));
-		// Check if it is selected
-			if(LANGUAGE == $l_codes[$l_name]) {
-				$template->set_var('SELECTED', ' selected="selected"');
-			} else {
-				$template->set_var('SELECTED', '');
-			}
+// read available languages from table addons and assign it to the template
+	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` ';
+	$sql .= 'WHERE `type` = \'language\' ORDER BY `directory`';
+	if( $res_lang = $database->query($sql) )
+	{
+		$template->set_block('main_block', 'language_list_block', 'language_list');
+		while( $rec_lang = $res_lang->fetchRow() )
+		{
+	        $langIcons = (empty($rec_lang['directory'])) ? 'none' : strtolower($rec_lang['directory']);
+			$template->set_var('CODE',        $rec_lang['directory']);
+			$template->set_var('NAME',        $rec_lang['name']);
+			$template->set_var('FLAG',        THEME_URL.'/images/flags/'.$langIcons);
+			$template->set_var('SELECTED',    (LANGUAGE == $rec_lang['directory'] ? ' selected="selected"' : '') );
 			$template->parse('language_list', 'language_list_block', true);
 		}
 	}
-
 // Insert default timezone values
 	$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
 	foreach($TIMEZONES AS $hour_offset => $title) {
Index: branches/2.8.x/wb/account/details.php
===================================================================
--- branches/2.8.x/wb/account/details.php	(revision 1508)
+++ branches/2.8.x/wb/account/details.php	(revision 1509)
@@ -19,71 +19,42 @@
 // 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'));
-$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
-$timezone = (int) $wb->get_post_escaped('timezone')*60*60;
+// Get entered values
+	$display_name = $wb->add_slashes(strip_tags($admin->get_post('display_name')));
+	$language = $wb->get_post('language');
+	$timezone = $wb->get_post('timezone')*60*60;
+	$date_format = $wb->get_post('date_format');
+	$time_format = $wb->get_post('time_format');
 
-// date_format must be a key from /interface/date_formats
-$date_format = $wb->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 = $wb->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);
-
 // 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,$js_back,false);
-} else {
-	$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'] );
-	$_SESSION['DISPLAY_NAME'] = $display_name;
-	$_SESSION['LANGUAGE'] = $language;
-	// Update date format
-	if($date_format != '') {
-		$_SESSION['DATE_FORMAT'] = $date_format;
-		if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
+	$sql  = "UPDATE `".TABLE_PREFIX."users` SET ";
+	$sql .= "`display_name` = '".$display_name."', `language` = '".$language."', ";
+	$sql .= "`timezone` = '".$timezone."', `date_format` = '".$date_format."', ";
+	$sql .= "`time_format` = '".$time_format."' ";
+	$sql .=	"WHERE `user_id` = '".$wb->get_user_id()."'";
+	$database->query($sql);
+	if($database->is_error()) {
+		$error[] = $database->get_error();
 	} 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']); }
-	}
-	// Update timezone
-	if($timezone != '-72000') {
+		$success[] = $MOD_PREFERENCE['DETAILS_SAVED'];
+		$_SESSION['DISPLAY_NAME'] = $display_name;
+		$_SESSION['LANGUAGE'] = $language;
 		$_SESSION['TIMEZONE'] = $timezone;
-		if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
-	} else {
-		$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
-		if(isset($_SESSION['TIMEZONE'])) { unset($_SESSION['TIMEZONE']); }
+// 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']); }
+		}
 	}
-}
Index: branches/2.8.x/wb/account/email.php
===================================================================
--- branches/2.8.x/wb/account/email.php	(revision 1508)
+++ branches/2.8.x/wb/account/email.php	(revision 1509)
@@ -19,42 +19,29 @@
 // Must include code to stop this file being access directly
 if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
 
-// Get the values entered
-$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'], $js_back, false);
-	exit();
-}
-*/
-// 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)."'";
-$results = $database->query($query);
-
+// Get entered values
+	$password = $wb->get_post('current_password');
+	$email = $wb->get_post('email');
+// validate password
+	$sql  = "SELECT `user_id` FROM `".TABLE_PREFIX."users` ";
+	$sql .= "WHERE `user_id` = ".$wb->get_user_id()." AND `password` = '".md5($password)."'";
+	$rowset = $database->query($sql);
 // Validate values
-if($results->numRows() == 0) {
-	$wb->print_error($MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'], $js_back, false);
-}
-// Validate values
-if(!$wb->validate_email($email)) {
-	$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
-}
-
-$email = $wb->add_slashes($email);
-
+	if($rowset->numRows() == 0) {
+		$error[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'];
+	}else {
+		if(!$wb->validate_email($email)) {
+			$error[] = $MESSAGE['USERS']['INVALID_EMAIL'];
+		}else {
+			$email = $wb->add_slashes($email);
 // Update the database
-// $database = new database();
-$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,$js_back, false);
-} else {
-	$wb->print_success($MESSAGE['PREFERENCES']['EMAIL_UPDATED']);
-	$_SESSION['EMAIL'] = $email;
-}
+			$sql = "UPDATE `".TABLE_PREFIX."users` SET `email` = '".$email."' WHERE `user_id` = ".$wb->get_user_id();
+			$database->query($sql);
+			if($database->is_error()) {
+				$error[] = $database->get_error();
+			} else {
+				$success[] = $MESSAGE['PREFERENCES']['EMAIL_UPDATED'];
+				$_SESSION['EMAIL'] = $email;
+			}
+		}
+	}
Index: branches/2.8.x/wb/account/template.html
===================================================================
--- branches/2.8.x/wb/account/template.html	(revision 1508)
+++ branches/2.8.x/wb/account/template.html	(revision 1509)
@@ -26,10 +26,10 @@
 		<tr>
 			<td>{TEXT_LANGUAGE}:</td>
 			<td>
-				<select name="language" style="width: 98%;">
-<!-- BEGIN language_list_block -->
-					<option value="{CODE}"{SELECTED}>{NAME} ({CODE})</option>
-<!-- END language_list_block -->
+				<select name="language" id="language">
+					<!-- BEGIN language_list_block -->
+						<option value="{CODE}"{SELECTED} style="background: url({FLAG}.png) no-repeat center left; padding-left: 20px;">{NAME} ({CODE})</option>
+					<!-- END language_list_block -->
 				</select>
 			</td>
 		</tr>
