Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1552)
+++ branches/2.8.x/CHANGELOG	(revision 1553)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 =========================== add small Features 2.8.2 ==========================
+31 Dez-2011 Build 1553 Dietmar Woellbrink (Luisehahne)
+! recoded  formmodul, add dropdown email_fromname_field
 31 Dez-2011 Build 1552 Dietmar Woellbrink (Luisehahne)
 # fix mdcr.js $scriptLink to absolute url
 ! change separator breadcrumb admintools
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1552)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1553)
@@ -52,5 +52,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.2');
-if(!defined('REVISION')) define('REVISION', '1552');
+if(!defined('REVISION')) define('REVISION', '1553');
 if(!defined('SP')) define('SP', 'SP2');
Index: branches/2.8.x/wb/modules/form/modify_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify_field.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/modify_field.php	(revision 1553)
@@ -22,22 +22,28 @@
 $update_when_modified = false;
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
+
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
 /* */
 // Get id
-$field_id = $admin->checkIDKEY('field_id', false, 'GET');
+$field_id = intval($admin->checkIDKEY('field_id', false, 'GET'));
 if (!$field_id) {
- $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']." MF: $field_id :-(", ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+ $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 }
+// load module language file
+$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
 
+$type = 'none';
 // Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
-$form = $query_content->fetchRow();
-$type = $form['type'];
-if($type == '') {
-	$type = 'none';
+$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+$sql .= 'WHERE `field_id` = '.$field_id.'';
+$sql .= '';
+if($query_content = $database->query($sql)) {
+	$form = $query_content->fetchRow(MYSQL_ASSOC);
+	$type = (($form['type'] == '') ? 'none' : $form['type']);
 }
-
-// set new token
+// set new idkey for save_field
 $field_id = $admin->getIDKEY($form['field_id']);
 // Set raw html <'s and >'s to be replaced by friendly html code
 $raw = array('<', '>');
@@ -44,13 +50,13 @@
 $friendly = array('&lt;', '&gt;');
 ?>
 
-<form name="modify" action="<?php echo WB_URL; ?>/modules/form/save_field.php" method="post" style="margin: 0;">
+<form name="modify" action="<?php echo WB_URL; ?>/modules/form/save_field_new.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="field_id" value="<?php echo $field_id; ?>" />
 <?php echo $admin->getFTAN(); ?>
 
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+<table summary="" class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
 	<tr>
 		<td colspan="2"><strong><?php echo $TEXT['MODIFY'].' '.$TEXT['FIELD']; ?></strong></td>
 	</tr>
@@ -66,11 +72,11 @@
 			<select name="type" style="width: 98%;">
 				<option value=""><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
 				<option value="heading"<?php if($type == 'heading') { echo ' selected="selected"'; } ?>><?php echo $TEXT['HEADING']; ?></option>
-				<option value="textfield"<?php if($type == 'textfield') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (Textfield)</option>
-				<option value="textarea"<?php if($type == 'textarea') { echo ' selected="selected"'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (Textarea)</option>
-				<option value="select"<?php if($type == 'select') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SELECT_BOX']; ?></option>
-				<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected="selected"'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?></option>
-				<option value="radio"<?php if($type == 'radio') { echo ' selected="selected"'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?></option>
+				<option value="textfield"<?php if($type == 'textfield') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (input)</option>
+				<option value="textarea"<?php if($type == 'textarea') { echo ' selected="selected"'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (textarea)</option>
+				<option value="select"<?php if($type == 'select') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SELECT_BOX']; ?> (select)</option>
+				<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected="selected"'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?> (checkbox)</option>
+				<option value="radio"<?php if($type == 'radio') { echo ' selected="selected"'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?> (radiobox)</option>
 				<option value="email"<?php if($type == 'email') { echo ' selected="selected"'; } ?>><?php echo $TEXT['EMAIL_ADDRESS']; ?></option>
 			</select>
 		</td>
@@ -107,6 +113,7 @@
 	<tr>
 		<td valign="top"><?php echo $TEXT['LIST_OPTIONS']; ?>:</td>
 		<td>
+			<table summary="<?php echo $TEXT['LIST_OPTIONS']; ?>" cellpadding="3" cellspacing="0" width="100%" border="0">
 			<?php
 			$option_count = 0;
 			$list = explode(',', $form['value']);
@@ -113,7 +120,6 @@
 			foreach($list AS $option_value) {
 				$option_count = $option_count+1;
 				?>
-				<table cellpadding="3" cellspacing="0" width="100%" border="0">
 				<tr>
 					<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
 					<td>
@@ -120,13 +126,11 @@
 						<input type="text" name="value<?php echo $option_count; ?>" value="<?php echo $option_value; ?>" style="width: 250px;" />
 					</td>
 				</tr>
-				</table>
 				<?php
 			}
 			for($i = 0; $i < 2; $i++) {
 				$option_count = $option_count+1;
 				?>
-				<table cellpadding="3" cellspacing="0" width="100%" border="0">
 				<tr>
 					<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
 					<td>
@@ -133,10 +137,10 @@
 						<input type="text" name="value<?php echo $option_count; ?>" value="" style="width: 250px;" />
 					</td>
 				</tr>
-				</table>
 				<?php
 			}
 			?>
+				</table>
 			<input type="hidden" name="list_count" value="<?php echo $option_count; ?>" />
 		</td>
 	</tr>
@@ -190,7 +194,7 @@
 <?php } ?>
 </table>
 
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<table summary="" 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;" />
@@ -200,13 +204,13 @@
 		if ($type<>'none') {
 		?>
 		<td align="center">
-			<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 200px; margin-top: 5px;" />
+			<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 200px; margin-top: 5px;" />
 		</td>
 		<?php } 
 		// end addition
 		?>
 		<td align="right">
-			<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
+			<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id.$sec_anchor; ?>';" style="width: 100px; margin-top: 5px;" />
 		</td>
 	</tr>
 </table>
Index: branches/2.8.x/wb/modules/form/add_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/add_field.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/add_field.php	(revision 1553)
@@ -20,6 +20,8 @@
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
 
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
 // Include the ordering class
 require(WB_PATH.'/framework/class.order.php');
 // Get new order
Index: branches/2.8.x/wb/modules/form/save_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_field.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/save_field.php	(revision 1553)
@@ -25,22 +25,23 @@
 require(WB_PATH.'/modules/admin.php');
 /* */
 
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
 // check FTAN
 if (!$admin->checkFTAN())
 {
 	$admin->print_header();
-	$admin->print_error('::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	$admin->print_error('::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 }
-// After check print the header
-$admin->print_header();
 
-
-/*  */
 // Get id
 $field_id = intval($admin->checkIDKEY('field_id', false ));
 if (!$field_id) {
- $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'].'::', ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+ $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'].'::', ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 }
+// After check print the header to get a new FTAN
+$admin->print_header();
+
 /*
 // Get id
 if(!isset($_POST['field_id']) OR !is_numeric($_POST['field_id'])) {
@@ -69,7 +70,12 @@
 $value = '';
 
 // Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET title = '$title', type = '$type', required = '$required' WHERE field_id = '$field_id'");
+$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_form_fields SET` ';
+$sql .= 'title = \''.$title.'\', ';
+$sql .= 'type = \''.$type.'\', ';
+$sql .= 'required = \''.$required.'\' ';
+$sql .= 'WHERE field_id = '.(int)$field_id.' ';
+if($database->query($sql)) { }
 
 // If field type has multiple options, get all values and implode them
 $list_count = $admin->get_post('list_count');
@@ -93,7 +99,7 @@
 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '' WHERE field_id = '$field_id'");
 } elseif($admin->get_post('type') == 'heading') {
 	$extra = str_replace(array("[[", "]]"), '', $admin->get_post('template'));
-	if(trim($extra) == '') $extra = '<tr><td class="field_heading" colspan="2">{TITLE}{FIELD}</td></tr>';
+	if(trim($extra) == '') $extra = '<tr><td class="frm-field_heading" colspan="2">{TITLE}{FIELD}</td></tr>';
 	$extra = $admin->add_slashes($extra);
 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '', extra = '$extra' WHERE field_id = '$field_id'");
 } elseif($admin->get_post('type') == 'select') {
Index: branches/2.8.x/wb/modules/form/delete_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/delete_field.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/delete_field.php	(revision 1553)
@@ -22,11 +22,13 @@
 require(WB_PATH.'/modules/admin.php');
 
 // Get id
-$field_id = $admin->checkIDKEY('field_id', false, 'GET');
+$field_id = intval($admin->checkIDKEY('field_id', false, 'GET'));
 if (!$field_id) {
  $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 }
 
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
 // Delete row
 $database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
 
@@ -36,10 +38,10 @@
 // Create new order object an reorder
 $order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id');
 
-if($order->clean($section_id)) {
-	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+if(!$order->clean($section_id)) {
+	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 } else {
-	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
+	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 }
 
 // Print admin footer
Index: branches/2.8.x/wb/modules/form/modify_settings.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify_settings.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/modify_settings.php	(revision 1553)
@@ -30,10 +30,22 @@
 $lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
 require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
 
-// Get header and footer
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
-$setting = $query_content->fetchRow();
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
 
+// Get Settings from DB
+$sql  = 'SELECT * FROM '.TABLE_PREFIX.'mod_form_settings ';
+$sql .= 'WHERE `section_id` = '.(int)$section_id.'';
+if($query_content = $database->query($sql)) {
+	$setting = $query_content->fetchRow(MYSQL_ASSOC);
+	$setting['email_to'] = ($setting['email_to'] != '' ? $setting['email_to'] : SERVER_EMAIL);
+	$setting['email_subject'] = ($setting['email_subject']  != '') ? $setting['email_subject'] : $MOD_FORM['EMAIL_SUBJECT'];
+	$setting['success_email_subject'] = ($setting['success_email_subject']  != '') ? $setting['success_email_subject'] : $MOD_FORM['SUCCESS_EMAIL_SUBJECT'];
+	$setting['success_email_from'] = ($setting['success_email_from'] != '' ? $setting['success_email_from'] : SERVER_EMAIL);
+	$setting['success_email_fromname'] = ($setting['success_email_fromname'] != '' ? $setting['success_email_fromname'] : WBMAILER_DEFAULT_SENDERNAME);
+	$setting['success_email_subject'] = ($setting['success_email_subject']  != '') ? $setting['success_email_subject'] : $MOD_FORM['SUCCESS_EMAIL_SUBJECT'];
+
+}
+
 // Set raw html <'s and >'s to be replace by friendly html code
 $raw = array('<', '>');
 $friendly = array('&lt;', '&gt;');
@@ -62,12 +74,12 @@
 <input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
 <?php echo $admin->getFTAN(); ?>
 
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
+<table summary="" class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
 	<tr>
 		<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
+		<td class="frm-setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
 		<td>
 			<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
 			<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
@@ -76,62 +88,69 @@
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
+		<td class="frm-setting_value">
 			<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
+		<td class="frm-setting_value">
 			<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
+		<td class="frm-setting_value">
 			<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
 		</td>
 	</tr>
 </table>	
-
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
+<!-- E-Mail Optionen -->
+<table summary="<?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?>" class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
 	<tr>
 		<td colspan="2"><strong><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?></strong></td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_TEXT['TO']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_TEXT['FROM']; ?>:</td>
+		<td class="frm-setting_value">
 			<select name="email_from_field" style="width: 98%;">
 			<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
 			<?php
+			$selected = false;
 			$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
-			$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR  type = 'email' ) ORDER BY position ASC");
-			if($query_email_fields->numRows() > 0) {
-				while($field = $query_email_fields->fetchRow()) {
-					?>
-					<option value="field<?php echo $field['field_id']; ?>"<?php if($email_from_value == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
-						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
-					</option>
-					<?php
+			// $query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR  type = 'email' ) ORDER BY position ASC");
+			$sql  = 'SELECT `field_id`, `title` FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+			$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+			$sql .= '  AND ( `type` = \'textfield\' OR  `type` = \'email\' )';
+			$sql .= 'ORDER BY `position` ASC ';
+			if($query_email_fields = $database->query($sql)) {
+				if($query_email_fields->numRows() > 0) {
+					while($field = $query_email_fields->fetchRow(MYSQL_ASSOC)) {
+						?>
+						<option value="field<?php echo $field['field_id']; ?>"<?php if($email_from_value == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
+							<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
+						</option>
+						<?php
+					}
 				}
 			}
 			?>
@@ -140,38 +159,63 @@
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
-		<td class="setting_value">
-			<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_fromname'])); ?>" />
+		<td class="frm-setting_name"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>
+		<td class="frm-setting_value">
+			<select name="email_fromname_field" style="width: 98%;">
+			<option value="" onclick="javascript: document.getElementById('email_fromname').style.display = 'block';" ><?php echo $TEXT['CUSTOM']; ?>:</option>
+<?php
+			$selected = false;
+			$email_fromname_value = str_replace($raw, $friendly, ($setting['email_fromname']));
+			if($query_email_fields->rewind()) {
+				if($query_email_fields->numRows() > 0) {
+						//!-- LOOP email_from_name -->
+					while($fieldFrom = $query_email_fields->fetchRow(MYSQL_ASSOC)) {
+?>
+						<option value="field<?php echo $fieldFrom['field_id']; ?>"<?php if($email_fromname_value == 'field'.$fieldFrom['field_id']) { echo ' selected'; $selected = true; } ?>  onclick="javascript: document.getElementById('email_fromname').style.display = 'none';">
+							<?php echo $TEXT['FIELD'].': '.$fieldFrom['title']; ?>
+						</option>
+<?php
+					}
+						//!-- ENDLOOP  -->
+				}
+			}
+?>
+			</select>
+			<input type="text" name="email_fromname" id="email_fromname" style="width: 98%; display: <?php if(isset($selected) AND $selected == true) { echo 'none'; } else { echo 'block'; } ?>;" maxlength="255" value="<?php if(substr($email_fromname_value, 0, 5) != 'field') { echo $email_fromname_value; } ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_subject'])); ?>" />
 		</td>
 	</tr>
 </table>	
-
-<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
+<!-- Erfolgreich Optionen -->
+<table summary="<?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?>" class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
 	<tr>
 		<td colspan="2"><strong><?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?></strong></td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_TEXT['TO']; ?>:</td>
+		<td class="frm-setting_value">
 			<select name="success_email_to" style="width: 98%;">
 			<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
 			<?php
 			$success_email_to = str_replace($raw, $friendly, ($setting['success_email_to']));
-			$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR  type = 'email' ) ORDER BY position ASC");
-			if($query_email_fields->numRows() > 0) {
-				while($field = $query_email_fields->fetchRow()) {
-					?>
-					<option value="field<?php echo $field['field_id']; ?>"<?php if($success_email_to == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
-						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
-					</option>
-					<?php
+			$sql  = 'SELECT `field_id`, `title` FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+			$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+			$sql .= '  AND ( `type` = \'textfield\' OR  `type` = \'email\' )';
+			$sql .= 'ORDER BY `position` ASC ';
+			if($query_email_fields = $database->query($sql)) {
+				if($query_email_fields->numRows() > 0) {
+					while($field = $query_email_fields->fetchRow(MYSQL_ASSOC)) {
+						?>
+						<option value="field<?php echo $field['field_id']; ?>"<?php if($success_email_to == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
+							<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
+						</option>
+						<?php
+					}
 				}
 			}
 			?>
@@ -179,38 +223,39 @@
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_TEXT['FROM']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="success_email_from" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_from'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>
+		<td class="frm-setting_value">
+			<?php $setting['success_email_fromname'] = ($setting['success_email_fromname'] != '' ? $setting['success_email_fromname'] : WBMAILER_DEFAULT_SENDERNAME); ?>
 			<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_fromname'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
+		<td class="frm-setting_value">
 			<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_subject'])); ?>" />
 		</td>
 	</tr>
 	<tr>
-		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
-		<td class="setting_value">
+		<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
+		<td class="frm-setting_value">
 			<textarea name="success_email_text" cols="80" rows="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['success_email_text'])); ?></textarea>
 		</td>
 	</tr>
 	<tr>
-		<td class="newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
-		<td class="newsection">
+		<td class="frm-newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
+		<td class="frm-newsection">
 			<select name="success_page">
 			<option value="none"><?php echo $TEXT['NONE']; ?></option>
 			<?php 
 			// Get exisiting pages and show the pagenames
 			$query = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility <> 'deleted'");
-			while($mail_page = $query->fetchRow()) {
+			while($mail_page = $query->fetchRow(MYSQL_ASSOC)) {
 				if(!$admin->page_is_visible($mail_page))
 					continue;
 				$mail_pagename = $mail_page['menu_title'];		
@@ -218,7 +263,7 @@
 			  //	echo $success_page.':'.$setting['success_page'].':'; not vailde
 				if($setting['success_page'] == $success_page) {
 					$selected = ' selected="selected"';
-				} else { 
+				} else {
 					$selected = '';
 				}
 				echo '<option value="'.$success_page.'"'.$selected.'>'.$mail_pagename.'</option>';
@@ -229,13 +274,13 @@
 	</tr>
 </table>
 
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<table summary="" 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;" />
+			<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.$sec_anchor; ?>';" style="width: 100px; margin-top: 5px;" />
 		</td>
 	</tr>
 </table>
Index: branches/2.8.x/wb/modules/form/save_field_new.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_field_new.php	(nonexistent)
+++ branches/2.8.x/wb/modules/form/save_field_new.php	(revision 1553)
@@ -0,0 +1,111 @@
+<?php
+/**
+ *
+ * @category        module
+ * @package         Form
+ * @author          WebsiteBaker Project
+ * @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$
+ * @description
+ * http://devzone.zend.com/703/php-built-in-input-filtering/
+ */
+
+require('../../config.php');
+
+// suppress to print the header, so no new FTAN will be set
+$admin_header = false;
+// Tells script to update when this page was last updated
+$update_when_modified = true;
+// Include WB admin wrapper script
+require(WB_PATH.'/modules/admin.php');
+/* */
+
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
+// check FTAN
+if (!$admin->checkFTAN())
+{
+	$admin->print_header();
+	$admin->print_error('::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
+}
+
+// Get id
+$field_id = intval($admin->checkIDKEY('field_id', false ));
+if (!$field_id) {
+	$admin->print_header();
+	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'].'::', ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
+}
+// After check print the header to get a new FTAN
+$admin->print_header();
+
+// Validate all fields
+if($admin->get_post('title') == '' OR $admin->get_post('type') == '') {
+	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'&section_id='.$section_id.'&field_id='.$admin->getIDKEY($field_id));
+} else {
+	$title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('title'), ENT_QUOTES));
+	$type = $admin->add_slashes($admin->get_post('type'));
+	$required = (int) $admin->add_slashes($admin->get_post('required'));
+}
+
+// If field type has multiple options, get all values and implode them
+	 $value = $extra = '';
+	$list_count = $admin->get_post('list_count');
+	if(is_numeric($list_count)) {
+		$values = array();
+		for($i = 1; $i <= $list_count; $i++) {
+			if($admin->get_post('value'.$i) != '') {
+				$values[] = str_replace(",","&#44;",$admin->get_post('value'.$i));
+			}
+		}
+		$value = implode(',', $values);
+	}
+// prepare sql-update
+	switch($admin->get_post('type')):
+		case 'textfield':
+			$value = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('value'));
+			$extra = $admin->get_post_escaped('length');
+			break;
+		case 'textarea':
+			$value = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('value'));
+			$extra = '';
+			break;
+		case 'heading':
+			$extra = str_replace(array("[[", "]]"), '', $admin->get_post('template'));
+			if(trim($extra) == '') $extra = '<tr><td class="frm-field_heading" colspan="2">{TITLE}{FIELD}</td></tr>';
+			$extra = $admin->add_slashes($extra);
+			break;
+		case 'select':
+			$extra = $admin->get_post_escaped('size').','.$admin->get_post_escaped('multiselect');
+			break;
+		case 'checkbox':
+			$extra = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('seperator'));
+			break;
+		case 'radio':
+			$extra = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('seperator'));
+			break;
+		default:
+			$value = '';
+			$extra = '';
+			break;
+	endswitch;
+// Update row
+	$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_form_fields` ';
+	$sql .= 'SET `title`=\''.$title.'\', ';
+	$sql .=     '`type`=\''.$type.'\', ';
+	$sql .=     '`required`=\''.$required.'\', ';
+	$sql .=     '`extra`=\''.$extra.'\', ';
+	$sql .=     '`value`=\''.$value.'\' ';
+	$sql .= 'WHERE field_id = '.(int)$field_id.' ';
+	if( $database->query($sql) ) {
+		$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'&section_id='.$section_id.'&field_id='.$admin->getIDKEY($field_id));
+	}else {
+		$admin->print_error($database->get_error(), WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'&section_id='.$section_id.'&field_id='.$admin->getIDKEY($field_id));
+	}
+// Print admin footer
+	$admin->print_footer();
\ No newline at end of file

Property changes on: branches/2.8.x/wb/modules/form/save_field_new.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision HeadURL
\ No newline at end of property
Index: branches/2.8.x/wb/modules/form/view.php
===================================================================
--- branches/2.8.x/wb/modules/form/view.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/view.php	(revision 1553)
@@ -12,7 +12,7 @@
  * @version         $Id$
  * @filesource		$HeadURL$
  * @lastmodified    $Date$
- * @description     
+ * @description
  */
 
 // Must include code to stop this file being access directly
@@ -24,69 +24,62 @@
 }
 /* -------------------------------------------------------- */
 
-// check if frontend.css file needs to be included into the <body></body> of view.php
-if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) &&
-	file_exists(WB_PATH .'/modules/form/frontend.css')) {
-	echo '<style type="text/css">';
-	include(WB_PATH .'/modules/form/frontend.css');
-	echo "\n</style>\n";
-} 
-
-require_once(WB_PATH.'/include/captcha/captcha.php');
-
-// obtain the settings of the output filter module
-if(file_exists(WB_PATH.'/modules/output_filter/filter-routines.php')) {
-	include_once(WB_PATH.'/modules/output_filter/filter-routines.php');
-	$filter_settings = getOutputFilterSettings();
-} else {
-	// no output filter used, define default settings
-	$filter_settings['email_filter'] = 0;
+// load module language file
+$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
+/*
+function removebreaks($value) {
+	return trim(preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', null, $value));
 }
-
+function checkbreaks($value) {
+	return $value === removebreaks($value);
+}
+*/
 // Function for generating an optionsfor a select field
 if (!function_exists('make_option')) {
-function make_option(&$n, $k, $values) {
-	// start option group if it exists
-	if (substr($n,0,2) == '[=') {
-	 	$n = '<optgroup label="'.substr($n,2,strlen($n)).'">';
-	} elseif ($n == ']') {
-		$n = '</optgroup>';
-	} else {
-		if(in_array($n, $values)) {
-			$n = '<option selected="selected" value="'.$n.'">'.$n.'</option>';
+	function make_option(&$n, $k, $values) {
+		// start option group if it exists
+		if (substr($n,0,2) == '[=') {
+		 	$n = '<optgroup label="'.substr($n,2,strlen($n)).'">'.PHP_EOL;
+		} elseif ($n == ']') {
+			$n = '</optgroup>'.PHP_EOL;
 		} else {
-			$n = '<option value="'.$n.'">'.$n.'</option>';
+			if(in_array($n, $values)) {
+				$n = '<option selected="selected" value="'.$n.'">'.$n.'</option>'.PHP_EOL;
+			} else {
+				$n = '<option value="'.$n.'">'.$n.'</option>'.PHP_EOL;
+			}
 		}
 	}
 }
-}
 // Function for generating a checkbox
 if (!function_exists('make_checkbox')) {
-function make_checkbox(&$n, $idx, $params) {
-	$field_id = $params[0][0];
-	$seperator = $params[0][1];
-	$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n);
-	if(in_array($n, $params[1])) {
-		$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</lable>'.$seperator;
-	} else {
-		$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</label>'.$seperator;
-	}	
+	function make_checkbox(&$key, $idx, $params) {
+		$field_id = $params[0][0];
+		$seperator = $params[0][1];
+
+		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $key).$field_id;
+		if(in_array($key, $params[1])) {
+			$key = '<input class="frm-field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$key.'" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$key.'</lable>'.$seperator.PHP_EOL;
+		} else {
+			$key = '<input class="frm-field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$key.'" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$key.'</label>'.$seperator.PHP_EOL;
+		}
+	}
 }
-}
 // Function for generating a radio button
 if (!function_exists('make_radio')) {
-function make_radio(&$n, $idx, $params) {
-	$field_id = $params[0];
-	$group = $params[1];
-	$seperator = $params[2];
-	$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n);
-	if($n == $params[3]) { 
-		$n = '<input class="field_radio" type="radio" id="'.$label_id.'" name="field'.$field_id.'" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="radio_label">'.$n.'</label>'.$seperator;
-	} else {
-		$n = '<input class="field_radio" type="radio" id="'.$label_id.'" name="field'.$field_id.'" value="'.$n.'" />'.'<label for="'.$label_id.'" class="radio_label">'.$n.'</label>'.$seperator;
+	function make_radio(&$n, $idx, $params) {
+		$field_id = $params[0];
+		$group = $params[1];
+		$seperator = $params[2];
+		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n).$field_id;
+		if($n == $params[3]) {
+			$n = '<input class="frm-field_checkbox" type="radio" id="'.$label_id.'" name="field'.$field_id.'" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$n.'</label>'.$seperator.PHP_EOL;
+		} else {
+			$n = '<input class="frm-field_checkbox" type="radio" id="'.$label_id.'" name="field'.$field_id.'" value="'.$n.'" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$n.'</label>'.$seperator.PHP_EOL;
+		}
 	}
 }
-}
 
 if (!function_exists("new_submission_id") ) {
 	function new_submission_id() {
@@ -106,151 +99,157 @@
 
 // Work-out if the form has been submitted or not
 if($_POST == array()) {
+	require_once(WB_PATH.'/include/captcha/captcha.php');
 
-// Set new submission ID in session
-$_SESSION['form_submission_id'] = new_submission_id();
-
-// Get settings
-$query_settings = $database->query("SELECT header,field_loop,footer,use_captcha FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
-if($query_settings->numRows() > 0) {
-	$fetch_settings = $query_settings->fetchRow();
-	$header = str_replace('{WB_URL}',WB_URL,$fetch_settings['header']);
-	$field_loop = $fetch_settings['field_loop'];
-	$footer = str_replace('{WB_URL}',WB_URL,$fetch_settings['footer']);
-	$use_captcha = $fetch_settings['use_captcha'];
-	$form_name = 'form';
-	$use_xhtml_strict = false;
-} else {
+	// Set new submission ID in session
+	$_SESSION['form_submission_id'] = new_submission_id();
+    $out = '';
 	$header = '';
 	$field_loop = '';
 	$footer = '';
 	$form_name = 'form';
 	$use_xhtml_strict = false;
-}
+	// Get settings
+	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_settings` ';
+	$sql .= 'WHERE section_id = '.$section_id.' ';
+	if($query_settings = $database->query($sql)) {
+		if($query_settings->numRows() > 0) {
+			$fetch_settings = $query_settings->fetchRow(MYSQL_ASSOC);
+			$header = str_replace('{WB_URL}',WB_URL,$fetch_settings['header']);
+			$field_loop = $fetch_settings['field_loop'];
+			$footer = str_replace('{WB_URL}',WB_URL,$fetch_settings['footer']);
+			$use_captcha = $fetch_settings['use_captcha'];
+			$form_name = 'form';
+			$use_xhtml_strict = false;
+		}
+	}
 
-?>
-<form <?php echo ( ( (strlen($form_name) > 0) AND (false == $use_xhtml_strict) ) ? "name=\"".$form_name."\"" : ""); ?> action="<?php echo htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])); ?>#wb_<?PHP echo $section_id;?>" method="post">
-<div>
-<input type="hidden" name="submission_id" value="<?php echo $_SESSION['form_submission_id']; ?>" />
-<?php echo $admin->getFTAN(); ?>
-</div>
-<?php
-if(ENABLED_ASP) { // first add some honeypot-fields
-?>
-<div>
-<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
-</div>
-<p class="nixhier">
-email address:
-<label for="email">Leave this field email-address blank:</label>
-<input id="email" name="email" size="56" value="" /><br />
-Homepage:
-<label for="homepage">Leave this field homepage blank:</label>
-<input id="homepage" name="homepage" size="55" value="" /><br />
-URL:
-<label for="url">Leave this field url blank:</label>
-<input id="url" name="url" size="61" value="" /><br />
-Comment:
-<label for="comment">Leave this field comment blank:</label>
-<textarea id="comment" name="comment" cols="50" rows="10"></textarea><br />
-</p>
+// do not use sec_anchor, can destroy some layouts
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
 
-<?php }
+	// Get list of fields
+	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+	$sql .= 'WHERE section_id = '.$section_id.' ';
+	$sql .= 'ORDER BY position ASC ';
 
-// Print header
-echo $header;
+	if($query_fields = $database->query($sql)) {
+		if($query_fields->numRows() > 0) {
+?>
+			<form <?php echo ( ( (strlen($form_name) > 0) AND (false == $use_xhtml_strict) ) ? "name=\"".$form_name."\"" : ""); ?> action="<?php echo htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'';?>" method="post">
+				<input type="hidden" name="submission_id" value="<?php echo $_SESSION['form_submission_id']; ?>" />
+				<?php // echo $admin->getFTAN(); ?>
+				<?php
+				if(ENABLED_ASP) { // first add some honeypot-fields
+				?>
+					<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
+					<p class="frm-nixhier">
+					email address:
+					<label for="email">Leave this field email-address blank:</label>
+					<input id="email" name="email" size="56" value="" /><br />
+					Homepage:
+					<label for="homepage">Leave this field homepage blank:</label>
+					<input id="homepage" name="homepage" size="55" value="" /><br />
+					URL:
+					<label for="url">Leave this field url blank:</label>
+					<input id="url" name="url" size="61" value="" /><br />
+					Comment:
+					<label for="comment">Leave this field comment blank:</label>
+					<textarea id="comment" name="comment" cols="50" rows="10"></textarea><br />
+					</p>
+			<?php }
 
-// Get list of fields
-$query_fields = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' ORDER BY position ASC");
-
-if($query_fields->numRows() > 0) {
-	while($field = $query_fields->fetchRow()) {
-		// Set field values
-		$field_id = $field['field_id'];
-		$value = $field['value'];
-		// Print field_loop after replacing vars with values
-		$vars = array('{TITLE}', '{REQUIRED}');
-		if (($field['type'] == "radio") || ($field['type'] == "checkbox")) {
-			$field_title = $field['title'];
-		} else {
-			$field_title = '<label for="field'.$field_id.'">'.$field['title'].'</label>';
-		}
-		$values = array($field_title);
-		if ($field['required'] == 1) {
-			$values[] = '<span class="required">*</span>';
-		} else {
-			$values[] = '';
-		}
-		if($field['type'] == 'textfield') {
-			$vars[] = '{FIELD}';
-			$max_lenght_para = (intval($field['extra']) ? ' maxlenght="'.intval($field['extra']).'"' : '');
-			$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'"'.$max_lenght_para.' value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value).'" class="textfield" />';
-		} elseif($field['type'] == 'textarea') {
-			$vars[] = '{FIELD}';
-			$values[] = '<textarea name="field'.$field_id.'" id="field'.$field_id.'" class="textarea" cols="25" rows="5">'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value).'</textarea>';
-		} elseif($field['type'] == 'select') {
-			$vars[] = '{FIELD}';
-			$options = explode(',', $value);
-			array_walk($options, 'make_option', (isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:array()));
-			$field['extra'] = explode(',',$field['extra']);
-			$values[] = '<select name="field'.$field_id.'[]" id="field'.$field_id.'" size="'.$field['extra'][0].'" '.$field['extra'][1].' class="select">'.implode($options).'</select>';		
-		} elseif($field['type'] == 'heading') {
-			$vars[] = '{FIELD}';
-			$str = '<input type="hidden" name="field'.$field_id.'" id="field'.$field_id.'" value="===['.$field['title'].']===" />';
-			$values[] = ( true == $use_xhtml_strict) ? "<div>".$str."</div>" : $str;
-			$tmp_field_loop = $field_loop;		// temporarily modify the field loop template
-			$field_loop = $field['extra'];
-		} elseif($field['type'] == 'checkbox') {
-			$vars[] = '{FIELD}';
-			$options = explode(',', $value);
-			array_walk($options, 'make_checkbox', array(array($field_id,$field['extra']),(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:array())));
-			$options[count($options)-1]=substr($options[count($options)-1],0,strlen($options[count($options)-1])-strlen($field['extra']));
-			$values[] = implode($options);
-		} elseif($field['type'] == 'radio') {
-			$vars[] = '{FIELD}';
-			$options = explode(',', $value);
-			array_walk($options, 'make_radio', array($field_id,$field['title'],$field['extra'], (isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:'')));
-			$options[count($options)-1]=substr($options[count($options)-1],0,strlen($options[count($options)-1])-strlen($field['extra']));
-			$values[] = implode($options);
-		} elseif($field['type'] == 'email') {
-			$vars[] = '{FIELD}';
-			$max_lenght_para = (intval($field['extra']) ? ' maxlenght="'.intval($field['extra']).'"' : '');
-			$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:'').'"'.$max_lenght_para.' class="email" />';
-		}
-		if(isset($_SESSION['field'.$field_id])) unset($_SESSION['field'.$field_id]);
-		if($field['type'] != '') {
-			echo str_replace($vars, $values, $field_loop);
-		}
-		if (isset($tmp_field_loop)) $field_loop = $tmp_field_loop;
-	}
-}
-
-// Captcha
-if($use_captcha) { ?>
-	<tr>
-	<td class="field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td>
-	<td><?php call_captcha(); ?></td>
-	</tr>
-	<?php
-}
-
-// Print footer
-echo $footer;
+	// Print header  MYSQL_ASSOC
+   echo $header.PHP_EOL;
+			while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
+				// Set field values
+				$field_id = $field['field_id'];
+				$value = $field['value'];
+				// Print field_loop after replacing vars with values
+				$vars = array('{TITLE}', '{REQUIRED}');
+				if (($field['type'] == "radio") || ($field['type'] == "checkbox")) {
+					$field_title = $field['title'];
+				} else {
+					$field_title = '<label for="field'.$field_id.'">'.$field['title'].'</label>'.PHP_EOL;
+				}
+				$values = array($field_title);
+				if ($field['required'] == 1) {
+					$values[] = '<span class="frm-required">*</span>'.PHP_EOL;
+				} else {
+					$values[] = '';
+				}
+				if($field['type'] == 'textfield') {
+					$vars[] = '{FIELD}';
+					$max_lenght_para = (intval($field['extra']) ? ' maxlenght="'.intval($field['extra']).'"' : '');
+					$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'"'.$max_lenght_para.' value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value).'" class="frm-textfield" />'.PHP_EOL;
+				} elseif($field['type'] == 'textarea') {
+					$vars[] = '{FIELD}';
+					$values[] = '<textarea name="field'.$field_id.'" id="field'.$field_id.'" class="frm-textarea" cols="30" rows="8">'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value).'</textarea>'.PHP_EOL;
+				} elseif($field['type'] == 'select') {
+					$vars[] = '{FIELD}';
+					$options = explode(',', $value);
+					array_walk($options, 'make_option', (isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:array()));
+					$field['extra'] = explode(',',$field['extra']);
+					$values[] = '<select name="field'.$field_id.'[]" id="field'.$field_id.'" size="'.$field['extra'][0].'" '.$field['extra'][1].' class="frm-select">'.implode($options).'</select>'.PHP_EOL;
+				} elseif($field['type'] == 'heading') {
+					$vars[] = '{FIELD}';
+					$str = '<input type="hidden" name="field'.$field_id.'" id="field'.$field_id.'" value="===['.$field['title'].']===" />';
+					$values[] = ( true == $use_xhtml_strict) ? "<div>".$str."</div>" : $str;
+					$tmp_field_loop = $field_loop;		// temporarily modify the field loop template
+					$field_loop = $field['extra'];
+				} elseif($field['type'] == 'checkbox') {
+					$vars[] = '{FIELD}';
+					$options = explode(',', $value);
+					array_walk($options, 'make_checkbox', array(array($field_id,$field['extra']),(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:array())));
+                    $x = sizeof($options)-1;
+					$options[$x]=substr($options[$x],0,strlen($options[$x]));
+					$values[] = implode($options);
+				} elseif($field['type'] == 'radio') {
+					$vars[] = '{FIELD}';
+					$options = explode(',', $value);
+					array_walk($options, 'make_radio', array($field_id,$field['title'],$field['extra'], (isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:'')));
+                    $x = sizeof($options)-1;
+					$options[$x]=substr($options[$x],0,strlen($options[$x]));
+					$values[] = implode($options);
+				} elseif($field['type'] == 'email') {
+					$vars[] = '{FIELD}';
+					$max_lenght_para = (intval($field['extra']) ? ' maxlenght="'.intval($field['extra']).'"' : '');
+					$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:'').'"'.$max_lenght_para.' class="frm-email" />'.PHP_EOL;
+				}
+				if(isset($_SESSION['field'.$field_id])) unset($_SESSION['field'.$field_id]);
+				if($field['type'] != '') {
+					echo str_replace($vars, $values, $field_loop);
+				}
+				if (isset($tmp_field_loop)){ $field_loop = $tmp_field_loop; }
+			}
+			// Captcha
+			if($use_captcha) { ?>
+				<tr>
+				<td class="frm-field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td>
+				<td><?php call_captcha(); ?></td>
+				</tr>
+				<?php
+			}
+		// Print footer
+		// $out = $footer.PHP_EOL;
+		$out .= str_replace('{SUBMIT_FORM}', $MOD_FORM['SUBMIT_FORM'], $footer);
+		echo $out;
 // Add form end code
 ?>
 </form>
 <?php
+		}
+	}
 
 } else {
 
 	// Check that submission ID matches
 	if(isset($_SESSION['form_submission_id']) AND isset($_POST['submission_id']) AND $_SESSION['form_submission_id'] == $_POST['submission_id']) {
-		
+
 		// Set new submission ID in session
 		$_SESSION['form_submission_id'] = new_submission_id();
-		
+
 		if(ENABLED_ASP && ( // form faked? Check the honeypot-fields.
-			(!isset($_POST['submitted_when']) OR !isset($_SESSION['submitted_when'])) OR 
+			(!isset($_POST['submitted_when']) OR !isset($_SESSION['submitted_when'])) OR
 			($_POST['submitted_when'] != $_SESSION['submitted_when']) OR
 			(!isset($_POST['email']) OR $_POST['email']) OR
 			(!isset($_POST['homepage']) OR $_POST['homepage']) OR
@@ -257,49 +256,53 @@
 			(!isset($_POST['comment']) OR $_POST['comment']) OR
 			(!isset($_POST['url']) OR $_POST['url'])
 		)) {
-			exit(header("Location: ".WB_URL.PAGES_DIRECTORY.""));
+			// spam
+			header("Location: ".WB_URL.PAGES_DIRECTORY."");
+            exit();
 		}
-/*
-		if (!$admin->checkFTAN())
-		{
-			$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
-			exit();
-		}
-*/
 		// Submit form data
 		// First start message settings
-		$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
-		if($query_settings->numRows() > 0) {
-			$fetch_settings = $query_settings->fetchRow();
-			$email_to = $fetch_settings['email_to'];
-			$email_from = $fetch_settings['email_from'];
-			if(substr($email_from, 0, 5) == 'field') {
-				// Set the email from field to what the user entered in the specified field
-				$email_from = htmlspecialchars($wb->add_slashes($_POST[$email_from]));
+		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_settings` ';
+		$sql .= 'WHERE `section_id` = '.(int)$section_id.'';
+		if($query_settings = $database->query($sql) ) {
+			if($query_settings->numRows() > 0) {
+				$fetch_settings = $query_settings->fetchRow(MYSQL_ASSOC);
+
+				$email_to = $fetch_settings['email_to'];
+				$email_from = $fetch_settings['email_from'];
+				if(substr($email_from, 0, 5) == 'field') {
+					// Set the email from field to what the user entered in the specified field
+					$email_from = htmlspecialchars($wb->add_slashes($_POST[$email_from]));
+				}
+				$email_fromname = $fetch_settings['email_fromname'];
+				if(substr($email_fromname, 0, 5) == 'field') {
+					// Set the email_fromname to field to what the user entered in the specified field
+					$email_fromname = htmlspecialchars($wb->add_slashes($_POST[$email_fromname]));
+				}
+				$email_subject = $fetch_settings['email_subject'];
+				$success_page = $fetch_settings['success_page'];
+				$success_email_to = $fetch_settings['success_email_to'];
+				if(substr($success_email_to, 0, 5) == 'field') {
+					// Set the success_email to field to what the user entered in the specified field
+					$success_email_to = htmlspecialchars($wb->add_slashes($_POST[$success_email_to]));
+				}
+				$success_email_from = $fetch_settings['success_email_from'];
+				$success_email_fromname = $fetch_settings['success_email_fromname'];
+				$success_email_text = htmlspecialchars($wb->add_slashes($fetch_settings['success_email_text']));
+				$success_email_text = (($success_email_text != '') ? $success_email_text : $MOD_FORM['SUCCESS_EMAIL_TEXT']);
+				$success_email_subject = $fetch_settings['success_email_subject'];
+				$max_submissions = $fetch_settings['max_submissions'];
+				$stored_submissions = $fetch_settings['stored_submissions'];
+				$use_captcha = $fetch_settings['use_captcha'];
+			} else {
+				exit($TEXT['UNDER_CONSTRUCTION']);
 			}
-			$email_fromname = $fetch_settings['email_fromname'];
-			$email_subject = $fetch_settings['email_subject'];
-			$success_page = $fetch_settings['success_page'];
-			$success_email_to = $fetch_settings['success_email_to'];
-			if(substr($success_email_to, 0, 5) == 'field') {
-				// Set the success_email to field to what the user entered in the specified field
-				$success_email_to = htmlspecialchars($wb->add_slashes($_POST[$success_email_to]));
-			}
-			$success_email_from = $fetch_settings['success_email_from'];
-			$success_email_fromname = $fetch_settings['success_email_fromname'];
-			$success_email_text = $fetch_settings['success_email_text'];
-			$success_email_subject = $fetch_settings['success_email_subject'];		
-			$max_submissions = $fetch_settings['max_submissions'];
-			$stored_submissions = $fetch_settings['stored_submissions'];
-			$use_captcha = $fetch_settings['use_captcha'];
-		} else {
-			exit($TEXT['UNDER_CONSTRUCTION']);
 		}
 		$email_body = '';
-		
+
 		// Create blank "required" array
 		$required = array();
-		
+
 		// Captcha
 		if($use_captcha) {
 			if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
@@ -315,141 +318,163 @@
 
 		// Loop through fields and add to message body
 		// Get list of fields
-		$query_fields = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' ORDER BY position ASC");
-		if($query_fields->numRows() > 0) {
-			while($field = $query_fields->fetchRow()) {
-				// Add to message body
-				if($field['type'] != '') {
-					if(!empty($_POST['field'.$field['field_id']])) {
-						// do not allow droplets in user input!
-						if (is_array($_POST['field'.$field['field_id']])) {
-							$_SESSION['field'.$field['field_id']] = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $_POST['field'.$field['field_id']]);
-						} else {
-							$_SESSION['field'.$field['field_id']] = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), htmlspecialchars($_POST['field'.$field['field_id']]));
-						}
-						// if the output filter is active, we need to revert (dot) to . and (at) to @ (using current filter settings)
-						// otherwise the entered mail will not be accepted and the recipient would see (dot), (at) etc.
-						if ($filter_settings['email_filter']) {
-							$field_value = $_POST['field'.$field['field_id']];
-							$field_value = str_replace($filter_settings['at_replacement'], '@', $field_value);
-							$field_value = str_replace($filter_settings['dot_replacement'], '.', $field_value);
-							$_POST['field'.$field['field_id']] = $field_value;
-						}
-						if($field['type'] == 'email' AND $admin->validate_email($_POST['field'.$field['field_id']]) == false) {
-							$email_error = $MESSAGE['USERS']['INVALID_EMAIL'];
-						}
-						if($field['type'] == 'heading') {
-							$email_body .= $_POST['field'.$field['field_id']]."\n\n";
-						} elseif (!is_array($_POST['field'.$field['field_id']])) {
-							$email_body .= $field['title'].': '.$_POST['field'.$field['field_id']]."\n\n";
-						} else {
-							$email_body .= $field['title'].": \n";
-							foreach ($_POST['field'.$field['field_id']] as $k=>$v) {
-								$email_body .= $v."\n";
+		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+		$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+		$sql .= 'ORDER BY position ASC';
+		if($query_fields = $database->query($sql)) {
+			if($query_fields->numRows() > 0) {
+				while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
+					// Add to message body
+					if($field['type'] != '') {
+						if(!empty($_POST['field'.$field['field_id']])) {
+							// do not allow droplets in user input!
+							if (is_array($_POST['field'.$field['field_id']])) {
+								$_SESSION['field'.$field['field_id']] = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $_POST['field'.$field['field_id']]);
+							} else {
+								$_SESSION['field'.$field['field_id']] = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), htmlspecialchars($_POST['field'.$field['field_id']]));
 							}
-							$email_body .= "\n";
+							if($field['type'] == 'email' AND $admin->validate_email($_POST['field'.$field['field_id']]) == false) {
+								$email_error = $MESSAGE['USERS']['INVALID_EMAIL'];
+							}
+							if($field['type'] == 'heading') {
+								$email_body .= $_POST['field'.$field['field_id']]."\n\n";
+							} elseif (!is_array($_POST['field'.$field['field_id']])) {
+								$email_body .= $field['title'].': '.$_POST['field'.$field['field_id']]."\n\n";
+							} else {
+								$email_body .= $field['title'].": \n";
+								foreach ($_POST['field'.$field['field_id']] as $k=>$v) {
+									$email_body .= $v."\n";
+								}
+								$email_body .= "\n";
+							}
+						} elseif($field['required'] == 1) {
+							$required[] = $field['title'];
 						}
-					} elseif($field['required'] == 1) {
-						$required[] = $field['title'];
 					}
-				}
-			}
-		}
-	
-		// Check if the user forgot to enter values into all the required fields
-		if($required != array()) {
-			if(!isset($MESSAGE['MOD_FORM']['REQUIRED_FIELDS'])) {
-				echo 'You must enter details for the following fields';
+				} //  while
+			}  // numRows
+		} //  query
+// Check if the user forgot to enter values into all the required fields
+		if(sizeof($required )) {
+
+			if(!isset($MESSAGE['MOD_FORM_REQUIRED_FIELDS'])) {
+				echo '<h3>You must enter details for the following fields</h3>';
 			} else {
-				echo $MESSAGE['MOD_FORM']['REQUIRED_FIELDS'];
+				echo '<h3>'.$MESSAGE['MOD_FORM_REQUIRED_FIELDS'].'</h3>';
 			}
-			echo ':<br /><ul>';
+			echo '<ul>'.PHP_EOL;
 			foreach($required AS $field_title) {
-				echo '<li>'.$field_title;
+				echo '<li>'.$field_title.PHP_EOL;
 			}
 			if(isset($email_error)) {
-				echo '<li>'.$email_error.'</li>';
+				echo '<li>'.$email_error.'</li>'.PHP_EOL;
 			}
 			if(isset($captcha_error)) {
-				echo '<li>'.$captcha_error.'</li>';
+				echo '<li>'.$captcha_error.'</li>'.PHP_EOL;
 			}
-			echo '</ul><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a>';
+			// Create blank "required" array
+			$required = array();
+			echo '</ul>'.PHP_EOL;
+			echo '<p>&nbsp;</p>'.PHP_EOL.'<p><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a></p>'.PHP_EOL;
 		} else {
 			if(isset($email_error)) {
-				echo '<br /><ul>';
-				echo '<li>'.$email_error.'</li>';
-				echo '</ul><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a>';
+				echo '<br /><ul>'.PHP_EOL;
+				echo '<li>'.$email_error.'</li>'.PHP_EOL;
+				echo '</ul>'.PHP_EOL;
+				echo '<a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a>';
 			} elseif(isset($captcha_error)) {
-				echo '<br /><ul>';
-				echo '<li>'.$captcha_error.'</li>';
-				echo '</ul><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a>';
+				echo '<br /><ul>'.PHP_EOL;
+				echo '<li>'.$captcha_error.'</li>'.PHP_EOL;
+				echo '</ul>'.PHP_EOL;
+				echo '<p>&nbsp;</p>'.PHP_EOL.'<p><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a></p>'.PHP_EOL;
 			} else {
 				// Check how many times form has been submitted in last hour
 				$last_hour = time()-3600;
-				$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions WHERE submitted_when >= '$last_hour'");
-				if($query_submissions->numRows() > $max_submissions) {
-					// Too many submissions so far this hour
-					echo $MESSAGE['MOD_FORM']['EXCESS_SUBMISSIONS'];
-					$success = false;
-				} else {
-					/**	
-					 *	Adding the IP to the body and try to send the email
-					 */
-					// $email_body .= "\n\nIP: ".$_SERVER['REMOTE_ADDR'];
+				$sql  = 'SELECT `submission_id` FROM `'.TABLE_PREFIX.'mod_form_submissions` ';
+				$sql .= 'WHERE `submitted_when` >= '.$last_hour.'';
+				$sql .= '';
+				if($query_submissions = $database->query($sql)){
+					if($query_submissions->numRows() > $max_submissions) {
+						// Too many submissions so far this hour
+						echo $MESSAGE['MOD_FORM_EXCESS_SUBMISSIONS'];
+						$success = false;
+					} else {
+						// Adding the IP to the body and try to send the email
+						// $email_body .= "\n\nIP: ".$_SERVER['REMOTE_ADDR'];
+						$recipient = preg_replace( "/[^a-z0-9 !?:;,.\/_\-=+@#$&\*\(\)]/im", "", $email_fromname );
+						$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $recipient );
+						$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $email_body );
+						if($email_to != '') {
+							if($email_from != '') {
+								if($wb->mail($email_from,$email_to,$email_subject,$email_body,$email_fromname)) {
+									$success = true;
+								}
+							} else {
+								if($wb->mail('',$email_to,$email_subject,$email_body,$email_fromname)) {
+									$success = true;
+								}
+							}
+						}
 
-					if($email_to != '') {
-						if($email_from != '') {
-							if($wb->mail($email_from,$email_to,$email_subject,$email_body,$email_fromname)) {
-								$success = true;
+						$recipient = preg_replace( "/[^a-z0-9 !?:;,.\/_\-=+@#$&\*\(\)]/im", "", $success_email_fromname );
+						$success_email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $recipient );
+						$success_email_text = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $success_email_text );
+						if($success_email_to != '') {
+							if($success_email_from != '') {
+								if($wb->mail($success_email_from,$success_email_to,$success_email_subject,$success_email_text,$success_email_fromname)) {
+									$success = true;
+								}
+							} else {
+								if($wb->mail('',$success_email_to,$success_email_subject,$success_email_text,$success_email_fromname)) {
+									$success = true;
+								}
 							}
-						} else {
-							if($wb->mail('',$email_to,$email_subject,$email_body,$email_fromname)) { 
-								$success = true; 
-							}
 						}
-					}				
-					if($success_email_to != '') {
-						if($success_email_from != '') {
-							if($wb->mail($success_email_from,$success_email_to,$success_email_subject,$success_email_text,$success_email_fromname)) {
-								$success = true;
-							}
+
+						// Write submission to database
+						if(isset($admin) AND $admin->is_authenticated() AND $admin->get_user_id() > 0) {
+							$submitted_by = $admin->get_user_id();
 						} else {
-							if($wb->mail('',$success_email_to,$success_email_subject,$success_email_text,$success_email_fromname)) {
-								$success = true;
-							}
+							$submitted_by = 0;
 						}
-					}				
-			
-					// Write submission to database
-					if(isset($admin) AND $admin->is_authenticated() AND $admin->get_user_id() > 0) {
-						$submitted_by = $admin->get_user_id();
-					} else {
-						$submitted_by = 0;
-					}
-					$email_body = htmlspecialchars($wb->add_slashes($email_body));
-					$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_submissions (page_id,section_id,submitted_when,submitted_by,body) VALUES ('".PAGE_ID."','$section_id','".time()."','$submitted_by','$email_body')");
-					// Make sure submissions table isn't too full
-					$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions ORDER BY submitted_when");
-					$num_submissions = $query_submissions->numRows();
-					if($num_submissions > $stored_submissions) {
-						// Remove excess submission
-						$num_to_remove = $num_submissions-$stored_submissions;
-						while($submission = $query_submissions->fetchRow()) {
-							if($num_to_remove > 0) {
-								$submission_id = $submission['submission_id'];
-								$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_submissions WHERE submission_id = '$submission_id'");
-								$num_to_remove = $num_to_remove-1;
+						$email_body = htmlspecialchars($wb->add_slashes($email_body));
+						$sql  = 'INSERT INTO '.TABLE_PREFIX.'mod_form_submissions ';
+						$sql .= 'SET ';
+						$sql .= 'page_id='.$wb->page_id.',';
+						$sql .= 'section_id='.$section_id.',';
+						$sql .= 'submitted_when='.time().',';
+						$sql .= 'submitted_by=\''.$submitted_by.'\', ';
+						$sql .= 'body=\''.$email_body.'\' ';
+						if($database->query($sql)) {
+/*
+						// Make sure submissions table isn't too full
+						$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions ORDER BY submitted_when");
+						$num_submissions = $query_submissions->numRows();
+						if($num_submissions > $stored_submissions) {
+							// Remove excess submission
+							$num_to_remove = $num_submissions-$stored_submissions;
+							while($submission = $query_submissions->fetchRow(MYSQL_ASSOC)) {
+								if($num_to_remove > 0) {
+									$submission_id = $submission['submission_id'];
+									$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_submissions WHERE submission_id = '$submission_id'");
+									$num_to_remove = $num_to_remove-1;
+								}
 							}
 						}
-					}
-					if(!$database->is_error()) {
-						$success = true;
-					}
-				}
-			}	
-		}
+*/
+						if(!$database->is_error()) {
+							$success = true;
+						}
+					}  // numRows
+	 			}
+	 			}
+			}
+		}  // email_error
+	} else {
+
+	echo '<p>&nbsp;</p>'.PHP_EOL.'<p><a href="'.htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])).'">'.$TEXT['BACK'].'</a></p>'.PHP_EOL;
 	}
-	
+
 	// Now check if the email was sent successfully
 	if(isset($success) AND $success == true) {
 	   if ($success_page=='none') {
@@ -457,15 +482,15 @@
   		} else {
 			$query_menu = $database->query("SELECT link,target FROM ".TABLE_PREFIX."pages WHERE `page_id` = '$success_page'");
 			if($query_menu->numRows() > 0) {
-  	        	$fetch_settings = $query_menu->fetchRow();
+  	        	$fetch_settings = $query_menu->fetchRow(MYSQL_ASSOC);
 			   $link = WB_URL.PAGES_DIRECTORY.$fetch_settings['link'].PAGE_EXTENSION;
 			   echo "<script type='text/javascript'>location.href='".$link."';</script>";
-			}    
+			}
 		}
 		// clearing session on success
 		$query_fields = $database->query("SELECT field_id FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id'");
-		while($field = $query_fields->fetchRow()) {
-			$field_id = $field[0];
+		while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
+			$field_id = $field['field_id'];
 			if(isset($_SESSION['field'.$field_id])) unset($_SESSION['field'.$field_id]);
 		}
 	} else {
@@ -473,4 +498,5 @@
 			echo $TEXT['ERROR'];
 		}
 	}
+
 }
Index: branches/2.8.x/wb/modules/form/delete_submission.php
===================================================================
--- branches/2.8.x/wb/modules/form/delete_submission.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/delete_submission.php	(revision 1553)
@@ -22,7 +22,7 @@
 require(WB_PATH.'/modules/admin.php');
 
 // Get id
-$submission_id = $admin->checkIDKEY('submission_id', false, 'GET');
+$submission_id = intval($admin->checkIDKEY('submission_id', false, 'GET'));
 if (!$submission_id) {
  $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 }
Index: branches/2.8.x/wb/modules/form/save_settings.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_settings.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/save_settings.php	(revision 1553)
@@ -30,6 +30,12 @@
 }
 $admin->print_header();
 
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
+// load module language file
+$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
+
 // This code removes any <?php tags and adds slashes
 $friendly = array('&lt;', '&gt;', '?php');
 $raw = array('<', '>', '');
@@ -37,20 +43,33 @@
 $field_loop = $admin->add_slashes($_POST['field_loop']);
 $footer = $admin->add_slashes($_POST['footer']);
 $email_to = $admin->add_slashes($_POST['email_to']);
+$email_to = ($email_to != '' ? $email_to : SERVER_EMAIL);
 $use_captcha = $admin->add_slashes($_POST['use_captcha']);
-if($_POST['email_from_field'] == '') {
+
+if( isset($_POST['email_from_field']) && ($_POST['email_from_field'] != '')) {
+	$email_from = $admin->add_slashes($_POST['email_from_field']);
+} else {
 	$email_from = $admin->add_slashes($_POST['email_from']);
+}
+
+if( isset($_POST['email_fromname_field']) && ($_POST['email_fromname_field'] != '')) {
+	$email_fromname = $admin->add_slashes($_POST['email_fromname_field']);
 } else {
-	$email_from = $admin->add_slashes($_POST['email_from_field']);
+	$email_fromname = $admin->add_slashes($_POST['email_fromname']);
 }
-$email_fromname = $admin->add_slashes($_POST['email_fromname']);
+
 $email_subject = $admin->add_slashes($_POST['email_subject']);
+$email_subject = ($email_subject  != '') ? $email_subject : $MOD_FORM['EMAIL_SUBJECT'];
 $success_page = $admin->add_slashes($_POST['success_page']);
 $success_email_to = $admin->add_slashes($_POST['success_email_to']);
 $success_email_from = $admin->add_slashes($_POST['success_email_from']);
 $success_email_fromname = $admin->add_slashes($_POST['success_email_fromname']);
+$success_email_fromname = ($success_email_fromname != '' ? $success_email_fromname : WBMAILER_DEFAULT_SENDERNAME);
 $success_email_text = $admin->add_slashes($_POST['success_email_text']);
+$success_email_text = (($success_email_text != '') ? $success_email_text : $MOD_FORM['SUCCESS_EMAIL_TEXT']);
 $success_email_subject = $admin->add_slashes($_POST['success_email_subject']);
+$success_email_subject = ($success_email_subject  != '') ? $success_email_subject : $MOD_FORM['SUCCESS_EMAIL_SUBJECT'];
+
 if(!is_numeric($_POST['max_submissions'])) {
 	$max_submissions = 50;
 } else {
@@ -65,16 +84,34 @@
 if($max_submissions > $stored_submissions) {
 	$max_submissions = $stored_submissions;
 }
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
 
 // Update settings
-$database->query("UPDATE ".TABLE_PREFIX."mod_form_settings SET header = '$header', field_loop = '$field_loop', footer = '$footer', email_to = '$email_to', email_from = '$email_from', email_fromname = '$email_fromname', email_subject = '$email_subject', success_page = '$success_page', success_email_to = '$success_email_to', success_email_from = '$success_email_from', success_email_fromname = '$success_email_fromname', success_email_text = '$success_email_text', success_email_subject = '$success_email_subject', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions', use_captcha = '$use_captcha' WHERE section_id = '$section_id'");
-
+$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_form_settings` SET ';
+$sql .= '`header` = \''.$header.'\', ';
+$sql .= '`field_loop` = \''.$field_loop.'\', ';
+$sql .= '`footer` = \''.$footer.'\', ';
+$sql .= '`email_to` = \''.$email_to.'\', ';
+$sql .= '`email_from` = \''.$email_from.'\', ';
+$sql .= '`email_fromname` = \''.$email_fromname.'\', ';
+$sql .= '`email_subject` = \''.$email_subject.'\', ';
+$sql .= '`success_page` = \''.$success_page.'\', ';
+$sql .= '`success_email_to` = \''.$success_email_to.'\', ';
+$sql .= '`success_email_from` = \''.$success_email_from.'\', ';
+$sql .= '`success_email_fromname` = \''.$success_email_fromname.'\', ';
+$sql .= '`success_email_text` = \''.$success_email_text.'\', ';
+$sql .= '`success_email_subject` = \''.$success_email_subject.'\', ';
+$sql .= '`max_submissions` = \''.$max_submissions.'\', ';
+$sql .= '`stored_submissions` = \''.$stored_submissions.'\', ';
+$sql .= '`use_captcha` = \''.$use_captcha.'\' ';
+$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+$sql .= '';
+if($database->query($sql)) {
+	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
+}
 // 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);
+	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
 }
-
 // Print admin footer
 $admin->print_footer();
Index: branches/2.8.x/wb/modules/form/languages/NL.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/NL.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/NL.php	(revision 1553)
@@ -27,6 +27,12 @@
 $module_description = 'Deze module makt het mogelijk om aangepaste online formulieren te maken zoals een feedback formulier. Met dank aan Rudolph Lartey voor het aanpassen van deze module.';
 
 //Variables for the  backend
-$MOD_FORM['SETTINGS'] = 'Formulier instellingen';
+$MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
 
-?>
\ No newline at end of file
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
Index: branches/2.8.x/wb/modules/form/languages/NO.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/NO.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/NO.php	(revision 1553)
@@ -27,6 +27,12 @@
 $module_description = 'Med denne modulen kan du lage d&iacute;ne egne spesialtilpassede elektroniske skjemaer, som for eksempe et tilbakemeldings skjema. En stor takk til Rudolph Lartey for hjelpen med &aring; videreutvikkle denne modulen, og for bidrag med koding av ekstra felt typer , osv.';
   
 //Variables for the  backend
-$MOD_FORM['SETTINGS'] = 'Skjema Innstillinger';
-  
-?>
\ No newline at end of file
+$MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
+
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
Index: branches/2.8.x/wb/modules/form/languages/EN.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/EN.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/EN.php	(revision 1553)
@@ -28,5 +28,11 @@
 
 //Variables for the  backend
 $MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
 
-?>
\ No newline at end of file
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
Index: branches/2.8.x/wb/modules/form/languages/DA.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/DA.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/DA.php	(revision 1553)
@@ -1,32 +1,40 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-//Modul Description
-$module_description = 'Dette modul giver mulighed for at lave tilpassede online formularer, f.eks. en kontaktformular. Tak til  Rudolph Lartey som har hjulpet med at forbedre dette modul ved at lave kode for ekstra felttyper osv.';
-
-//Variables for the  backend
-$MOD_FORM['SETTINGS'] = 'Formularindstillinger';
-
-?>
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+//Modul Description
+$module_description = 'Dette modul giver mulighed for at lave tilpassede online formularer, f.eks. en kontaktformular. Tak til  Rudolph Lartey som har hjulpet med at forbedre dette modul ved at lave kode for ekstra felttyper osv.';
+
+//Variables for the  backend
+$MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
+
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
+
+
Index: branches/2.8.x/wb/modules/form/languages/RU.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/RU.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/RU.php	(revision 1553)
@@ -27,6 +27,12 @@
 $module_description = '&#1052;&#1086;&#1076;&#1091;&#1083;&#1100; &#1087;&#1086;&#1079;&#1074;&#1086;&#1083;&#1103;&#1077;&#1090; &#1089;&#1086;&#1079;&#1076;&#1072;&#1074;&#1072;&#1090;&#1100; &#1088;&#1072;&#1079;&#1083;&#1080;&#1095;&#1085;&#1099;&#1077; &#1085;&#1072;&#1089;&#1090;&#1088;&#1072;&#1080;&#1074;&#1072;&#1077;&#1084;&#1099;&#1077; &#1092;&#1086;&#1088;&#1084;&#1099;, &#1085;&#1072;&#1087;&#1088;&#1080;&#1084;&#1077;&#1088; &#1092;&#1086;&#1088;&#1084;&#1099; &#1086;&#1073;&#1088;&#1072;&#1090;&#1085;&#1086;&#1081; &#1089;&#1074;&#1103;&#1079;&#1080;. Rudolph Lartey &#1087;&#1086;&#1084;&#1086;&#1075; &#1091;&#1083;&#1091;&#1095;&#1096;&#1080;&#1090;&#1100; &#1076;&#1072;&#1085;&#1085;&#1099;&#1081; &#1084;&#1086;&#1076;&#1091;&#1083;&#1100;.';
 
 //Variables for the  backend
-$MOD_FORM['SETTINGS'] = '&#1053;&#1072;&#1089;&#1090;&#1088;&#1086;&#1081;&#1082;&#1080; &#1092;&#1086;&#1088;&#1084;&#1099;';
+$MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
 
-?>
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
Index: branches/2.8.x/wb/modules/form/languages/FR.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/FR.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/FR.php	(revision 1553)
@@ -1,35 +1,41 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2009, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
- -----------------------------------------------------------------------------------------
-  FRENCH LANGUAGE FILE FOR THE MODULE: FORM
- -----------------------------------------------------------------------------------------
-*/
-//Module Description
-$module_description = 'This module allows you to create customised online forms, such as a feedback form. Thank-you to Rudolph Lartey who help enhance this module, providing code for extra field types, etc.';
-
-//Variables for the  backend
-$MOD_FORM['SETTINGS'] = 'Configurations du formulaire';
-
-?>
\ No newline at end of file
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2009, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+ -----------------------------------------------------------------------------------------
+  FRENCH LANGUAGE FILE FOR THE MODULE: FORM
+ -----------------------------------------------------------------------------------------
+*/
+//Module Description
+$module_description = 'This module allows you to create customised online forms, such as a feedback form. Thank-you to Rudolph Lartey who help enhance this module, providing code for extra field types, etc.';
+
+//Variables for the  backend
+$MOD_FORM['SETTINGS'] = 'Form Settings';
+$MOD_FORM['CONFIRM'] = 'Confirmation';
+$MOD_FORM['SUBMIT_FORM'] = 'Submit';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message to '.WEBSITE_TITLE;
+
+$MOD_TEXT['FROM'] = 'Sender';
+$MOD_TEXT['TO'] = 'Recipient';
Index: branches/2.8.x/wb/modules/form/languages/DE.php
===================================================================
--- branches/2.8.x/wb/modules/form/languages/DE.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/languages/DE.php	(revision 1553)
@@ -28,5 +28,15 @@
 
 //Variablen fuer backend Texte
 $MOD_FORM['SETTINGS'] = 'Formular Einstellungen';
-
-?>
\ No newline at end of file
+$MOD_FORM['CONFIRM'] = 'Bestätigung';
+$MOD_FORM['SUBMIT_FORM'] = 'Absenden';
+$MOD_FORM['EMAIL_SUBJECT'] = 'Erhalten einer Nachricht von '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'E-Mail wurde erfolgreich &uuml;ber '.WEBSITE_TITLE.' gesendet!';
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'Sie haben ein Forumlar an '.WEBSITE_TITLE.' gesendet';
+/*
+$MOD_FORM['EMAIL_SUBJECT'] = 'Delivering a message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_TEXT'] = 'Thank you for sending your message from '.WEBSITE_TITLE;
+$MOD_FORM['SUCCESS_EMAIL_SUBJECT'] = 'You have submitted a message';
+*/
+$MOD_TEXT['FROM'] = 'Absender';
+$MOD_TEXT['TO'] = 'Empf&auml;nger';
Index: branches/2.8.x/wb/modules/form/frontend.css
===================================================================
--- branches/2.8.x/wb/modules/form/frontend.css	(revision 1552)
+++ branches/2.8.x/wb/modules/form/frontend.css	(revision 1553)
@@ -1,46 +1,14 @@
-.required {
-	color: #FF0000;
-}
-.field_title {
-	font-size: 12px;
-	width: 100px;
-	vertical-align: top;
-	text-align:right;
-}
-.textfield {
-	font-size: 12px;
-	width: 200px;
-}
-.textarea {
-	font-size: 12px;
-	width: 90%;
-	height: 100px;
-}
-.field_heading {
-	font-size: 12px;
-	font-weight: bold;
-	border-bottom-width: 2px;
-	border-bottom-style: solid;
-	border-bottom-color: #666666;
-	padding-top: 10px;
-	color: #666666;
-}
-.select {
-	font-size: 12px;
-}
-.checkbox_label {
-	font-size: 11px;
-	cursor: pointer;
-}
-.radio_label {
-	font-size: 11px;
-	cursor: pointer;
-}
-.email {
-	font-size: 12px;
-	width: 200px;
-}
-/*** Don't remove the class nixhier, this is required for ASP ***/
-.nixhier {
-	display:none;
-}
\ No newline at end of file
+.frm-required { color :#ff0000; }
+.frm-field_title { font-size :12px; width :25%; vertical-align :top; white-space :nowrap; text-align :right; }
+.frm-textfield { font-size :12px; width :90%; }
+.frm-textarea { font-size :12px; width :100%; height :100px; }
+.frm-field_heading { font-size :12px; font-weight :bold; border-bottom-width :2px; border-bottom-style :solid; border-bottom-color :#666666; padding-top :10px; color :#666666; }
+.frm-select { font-size :12px; width :50%; }
+.frm-select option { font-size :12px; width :95%; }
+.frm-field_checkbox { font-size :11px; cursor :pointer; width :30px; vertical-align :middle; }
+.frm-checkbox_label { font-size :11px; cursor :pointer; width :auto; }
+.frm-radio_label { font-size :11px; cursor :pointer; }
+.frm-email { font-size :12px; width : 90%; }
+/*** Don't remove the class nixhier, this is required for ASP ***/
+.frm-nixhier { display :none; }
+.frm-submission { margin :0 auto; position :relative; width :auto; }		
\ No newline at end of file
Index: branches/2.8.x/wb/modules/form/view_submission.php
===================================================================
--- branches/2.8.x/wb/modules/form/view_submission.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/view_submission.php	(revision 1553)
@@ -21,28 +21,33 @@
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
 /* */
+
 // Get id
-$submission_id = $admin->checkIDKEY('submission_id', false, 'GET');
+$submission_id = intval($admin->checkIDKEY('submission_id', false, 'GET'));
 if (!$submission_id) {
  $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 }
 
 // Get submission details
-$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_submissions WHERE submission_id = '$submission_id'");
-$submission = $query_content->fetchRow();
-
+$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions` ';
+$sql .= 'WHERE submission_id = '.$submission_id.' ';
+if($query_content = $database->query($sql)) {
+	$submission = $query_content->fetchRow(MYSQL_ASSOC);
+}
 // Get the user details of whoever did this submission
-$query_user = "SELECT username,display_name FROM ".TABLE_PREFIX."users WHERE user_id = '".$submission['submitted_by']."'";
-$get_user = $database->query($query_user);
-if($get_user->numRows() != 0) {
-	$user = $get_user->fetchRow();
-} else {
-	$user['display_name'] = 'Unknown';
-	$user['username'] = 'unknown';
+$sql  = 'SELECT `username`,`display_name` FROM `'.TABLE_PREFIX.'users` ';
+$sql .= 'WHERE `user_id` = '.$submission['submitted_by'];
+if($get_user = $database->query($sql)) {
+	if($get_user->numRows() != 0) {
+		$user = $get_user->fetchRow(MYSQL_ASSOC);
+	} else {
+		$user['display_name'] = 'Unknown';
+		$user['username'] = 'unknown';
+	}
 }
-
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
 ?>
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<table class="frm-submission" summary="" cellpadding="0" cellspacing="0" border="0">
 <tr>
 	<td><?php echo $TEXT['SUBMISSION_ID']; ?>:</td>
 	<td><?php echo $submission['submission_id']; ?></td>
@@ -50,7 +55,7 @@
 <tr>
 	<td><?php echo $TEXT['SUBMITTED']; ?>:</td>
 	<td><?php echo gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
-</td>
+</tr>
 <tr>
 	<td><?php echo $TEXT['USER']; ?>:</td>
 	<td><?php echo $user['display_name'].' ('.$user['username'].')'; ?></td>
@@ -69,11 +74,9 @@
 
 <br />
 
-<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 150px; margin-top: 5px;" />
+<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id.$sec_anchor; ?>';" style="width: 150px; margin-top: 5px;" />
 <input type="button" value="<?php echo $TEXT['DELETE']; ?>" onclick="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $admin->getIDKEY($submission_id); ?>');" style="width: 150px; margin-top: 5px;" />
 <?php
 
 // Print admin footer
 $admin->print_footer();
-
-?>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/form/modify.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/modify.php	(revision 1553)
@@ -28,12 +28,21 @@
 if(function_exists('ini_set')) {
 	ini_set('arg_separator.output', '&amp;');
 }
+include_once(WB_PATH.'/framework/functions.php');
 
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+
 //Delete all form fields with no title
-$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
+$sql  = 'DELETE FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+$sql .= 'WHERE page_id = '.(int)$page_id.' ';
+$sql .=   'AND section_id = '.(int)$section_id.' ';
+$sql .=   'AND title=\'\' ';
+if( !$database->query($sql) ) {
+// error msg
+}
 
 ?>
-<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
 <tr>
 	<td align="left" width="33%">
 		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
@@ -50,96 +59,123 @@
 <?php
 
 // Loop through existing fields
-$query_fields = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC");
-if($query_fields->numRows() > 0) {
-	$num_fields = $query_fields->numRows();
-	$row = 'a';
-	?>
-	<table cellpadding="2" cellspacing="0" border="0" width="100%">
-	<?php
-	while($field = $query_fields->fetchRow()) {
+$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
+$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+$sql .= 'ORDER BY `position` ASC';
+if($query_fields = $database->query($sql)) {
+	if($query_fields->numRows() > 0) {
+		$num_fields = $query_fields->numRows();
+		$row = 'a';
 		?>
-		<tr class="row_<?php echo $row; ?>">
-			<td width="20" style="padding-left: 5px;">
-				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MODIFY']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
-				</a>
-			</td>		
-			<td>
-				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>">
-					<?php echo $field['title']; ?>
-				</a>
-			</td>
-			<td width="175">
+		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
+			<tr style="background-color: #dddddd; font-weight: bold;">
+				<td width="20" style="padding-left: 5px;">&nbsp;</td>
+				<td width="30" style="text-align: right;">ID</td>
+				<td width="400"><?php print $TEXT['FIELD']; ?></td>
+				<td width="175"><?php print $TEXT['TYPE']; ?></td>
+				<td width="100"><?php print $TEXT['REQUIRED']; ?></td>
+				<td width="175">
 				<?php
-				echo $TEXT['TYPE'].':';
-				if($field['type'] == 'textfield') {
-					echo $TEXT['SHORT_TEXT'];
-				} elseif($field['type'] == 'textarea') {
-					echo $TEXT['LONG_TEXT'];
-				} elseif($field['type'] == 'heading') {
-					echo $TEXT['HEADING'];
-				} elseif($field['type'] == 'select') {
-					echo $TEXT['SELECT_BOX'];
-				} elseif($field['type'] == 'checkbox') {
-					echo $TEXT['CHECKBOX_GROUP'];
-				} elseif($field['type'] == 'radio') {
-					echo $TEXT['RADIO_BUTTON_GROUP'];
-				} elseif($field['type'] == 'email') {
-					echo $TEXT['EMAIL_ADDRESS'];
+					echo $TEXT['MULTISELECT'];
+				?>
+				</td>
+				<td width="175" colspan="3">
+				<?php
+					echo $TEXT['ACTIONS'];
+				?>
+				</td>
+			</tr>
+		<?php
+		while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
+			?>
+			<tr class="row_<?php echo $row; ?>">
+				<td style="padding-left: 5px;">
+					<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MODIFY']; ?>">
+						<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
+					</a>
+				</td>
+				<td style="text-align: right;">
+					<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>">
+						<?php echo $field['field_id']; ?>
+					</a>
+				</td>
+				<td>
+					<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>">
+						<?php echo $field['title']; ?>
+					</a>
+				</td>
+				<td>
+					<?php
+					if($field['type'] == 'textfield') {
+						echo $TEXT['SHORT_TEXT'];
+					} elseif($field['type'] == 'textarea') {
+						echo $TEXT['LONG_TEXT'];
+					} elseif($field['type'] == 'heading') {
+						echo $TEXT['HEADING'];
+					} elseif($field['type'] == 'select') {
+						echo $TEXT['SELECT_BOX'];
+					} elseif($field['type'] == 'checkbox') {
+						echo $TEXT['CHECKBOX_GROUP'];
+					} elseif($field['type'] == 'radio') {
+						echo $TEXT['RADIO_BUTTON_GROUP'];
+					} elseif($field['type'] == 'email') {
+						echo $TEXT['EMAIL_ADDRESS'];
+					}
+					?>
+				</td>
+				<td>
+				<?php
+				if ($field['type'] != 'group_begin') {
+					if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
 				}
 				?>
-			</td>
-			<td width="95">		
-			<?php 
-			if ($field['type'] != 'group_begin') {
-				echo $TEXT['REQUIRED'].': '; if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
-			}
-			?>
-			</td>
-			<td width="110">
+				</td>
+				<td>
+				<?php
+				if ($field['type'] == 'select') {
+					$field['extra'] = explode(',',$field['extra']);
+					 if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
+				}
+				?>
+				</td>
+				<td width="20">
+				<?php if($field['position'] != 1) { ?>
+					<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
+						<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
+					</a>
+				<?php } ?>
+				</td>
+				<td width="20">
+				<?php if($field['position'] != $num_fields) { ?>
+					<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
+						<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
+					</a>
+				<?php } ?>
+				</td>
+				<td width="20">
+<?php
+				$url = (WB_URL.'/modules/form/delete_field.php?page_id='.$page_id.'&amp;section_id='.$section_id.'&amp;field_id='.$admin->getIDKEY($field['field_id']))
+ ?>
+					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
+						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
+					</a>
+				</td>
+			</tr>
 			<?php
-			if ($field['type'] == 'select') {
-				$field['extra'] = explode(',',$field['extra']);
-				echo $TEXT['MULTISELECT'].': '; if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
+			// Alternate row color
+			if($row == 'a') {
+				$row = 'b';
+			} else {
+				$row = 'a';
 			}
-			?>
-			</td>
-			<td width="20">
-			<?php if($field['position'] != 1) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-			<?php if($field['position'] != $num_fields) { ?>
-				<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
-				</a>
-			<?php } ?>
-			</td>
-			<td width="20">
-				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
-				</a>
-			</td>
-		</tr>
+		}
+		?>
+		</table>
 		<?php
-		// Alternate row color
-		if($row == 'a') {
-			$row = 'b';
-		} else {
-			$row = 'a';
-		}
+	} else {
+		echo $TEXT['NONE_FOUND'];
 	}
-	?>
-	</table>
-	<?php
-} else {
-	echo $TEXT['NONE_FOUND'];
 }
-
 ?>
 
 <br /><br />
@@ -149,40 +185,47 @@
 <?php
 
 // Query submissions table
-$query_submissions = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when ASC");
-if($query_submissions->numRows() > 0) {
-	?>
-	<table cellpadding="2" cellspacing="0" border="0" width="100%">
-	<?php
-	// List submissions
-	$row = 'a';
-	while($submission = $query_submissions->fetchRow()) {
+$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions` ';
+$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
+$sql .= 'ORDER BY `submitted_when` ASC ';
+if($query_submissions = $database->query($sql)) {
+	if($query_submissions->numRows() > 0) {
 		?>
-		<tr class="row_<?php echo $row; ?>">
-			<td width="20" style="padding-left: 5px;">
-				<a href="<?php echo WB_URL; ?>/modules/form/view_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $admin->getIDKEY($submission['submission_id']); ?>" title="<?php echo $TEXT['OPEN']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
-				</a>
-			</td>
-			<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
-			<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
-			<td width="20">
-				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $admin->getIDKEY($submission['submission_id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>">
-					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
-				</a>
-			</td>
-		</tr>
+		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
 		<?php
-		// Alternate row color
-		if($row == 'a') {
-			$row = 'b';
-		} else {
-			$row = 'a';
+		// List submissions
+		$row = 'a';
+		while($submission = $query_submissions->fetchRow(MYSQL_ASSOC)) {
+			?>
+			<tr class="row_<?php echo $row; ?>">
+				<td width="20" style="padding-left: 5px;">
+					<a href="<?php echo WB_URL; ?>/modules/form/view_submission.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;submission_id=<?php echo $admin->getIDKEY($submission['submission_id']); ?>" title="<?php echo $TEXT['OPEN']; ?>">
+						<img src="<?php echo THEME_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
+					</a>
+				</td>
+				<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
+				<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
+				<td width="20">
+<?php
+				$url = (WB_URL.'/modules/form/delete_submission.php?page_id='.$page_id.'&amp;section_id='.$section_id.'&amp;submission_id='.$admin->getIDKEY($submission['submission_id']))
+ ?>
+					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" 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'];
 	}
-	?>
-	</table>
-	<?php
-} else {
-	echo $TEXT['NONE_FOUND'];
-}
+}
\ No newline at end of file
Index: branches/2.8.x/wb/modules/form/backend.css
===================================================================
--- branches/2.8.x/wb/modules/form/backend.css	(revision 1552)
+++ branches/2.8.x/wb/modules/form/backend.css	(revision 1553)
@@ -1,27 +1,8 @@
-.setting_name {
-	vertical-align: top;
-	width: 30%;
-}
-.setting_value {
-	vertical-align: top;
-	width: 70%;
-}
-.newsection {
-	border-top: 1px dashed #fff;
-}
-
+.frm-setting_name { vertical-align :top; width :30%; white-space :nowrap; }
+.frm-setting_value { vertical-align :top; width :70%; }
+.frm-newsection { border-top :1px dashed #ffffff; }
 /* 
   The definitions below provide the style for the edit CSS button 
   Required CSS class name: input.mod_moduledirectory_edit_css
 */
-input.mod_form_edit_css {
-  color: #000;
-  background-color: #F0F0F0;
-  border: 1px solid gray;
-  padding: 2px;
-  margin: 0;
-  margin-left: 625px;
-  margin-top: -20px;
-  margin-bottom: 5px;
-  width: 110px;
-}
\ No newline at end of file
+input.mod_form_edit_css { color :#000000; background-color :#f0f0f0; border :1px solid #808080; padding :2px; margin :0; margin-left :625px; margin-top :-20px; margin-bottom :5px; width :110px; }
Index: branches/2.8.x/wb/modules/form/add.php
===================================================================
--- branches/2.8.x/wb/modules/form/add.php	(revision 1552)
+++ branches/2.8.x/wb/modules/form/add.php	(revision 1553)
@@ -24,27 +24,57 @@
 }
 /* -------------------------------------------------------- */
 
+// load module language file
+$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
+
 // Insert an extra rows into the database
-$header = '<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"98%\" summary=\"form\">';
-$field_loop = '<tr><td class=\"field_title\">{TITLE}{REQUIRED}:</td><td>{FIELD}</td></tr>';
-$footer = '<tr><td>&nbsp;</td>
-<td>
-<input type=\"submit\" name=\"submit\" value=\"Submit Form\" />
-</td>
-</tr>
-</table>';
+$header = '<table class="frm-field_table" cellpadding=\"2\" cellspacing=\"0\" border=\"0\" summary=\"form\">';
+$field_loop = '<tr>'.PHP_EOL.'<td class=\"frm-field_title\">{TITLE}{REQUIRED}:</td>'.PHP_EOL.'<td>{FIELD}</td>'.PHP_EOL.'</tr>';
+$footer = '<tr>'.PHP_EOL.'<td>&nbsp;</td>'.PHP_EOL.'
+<td>'.PHP_EOL.'
+<input type=\"submit\" name=\"submit\" value=\"{SUBMIT_FORM}\" />'.PHP_EOL.'
+</td>'.PHP_EOL.'
+</tr>'.PHP_EOL.'
+</table>'.PHP_EOL;
 $email_to = $admin->get_email();
 $email_from = '';
 $email_fromname = '';
-$email_subject = 'Results from form on website...';
+$email_subject = $MOD_FORM['EMAIL_SUBJECT'];
 $success_page = 'none';
-$success_email_to = '';
+$success_email_to = SERVER_EMAIL;
 $success_email_from = $admin->get_email();
-$success_email_fromname = '';
-$success_email_text = 'Thank you for submitting your form on '.WEBSITE_TITLE;
+$success_email_fromname = WBMAILER_DEFAULT_SENDERNAME;
+$success_email_text = $MOD_FORM['SUCCESS_EMAIL_TEXT'];
 $success_email_text = addslashes($success_email_text);
-$success_email_subject = 'You have submitted a form';
+$success_email_subject = $MOD_FORM['SUCCESS_EMAIL_SUBJECT'];
 $max_submissions = 50;
 $stored_submissions = 50;
 $use_captcha = true;
-$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_fromname,email_subject,success_page,success_email_to,success_email_from,success_email_fromname,success_email_text,success_email_subject,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_fromname','$email_subject','$success_page','$success_email_to','$success_email_from','$success_email_fromname','$success_email_text','$success_email_subject','$max_submissions','$stored_submissions','$use_captcha')");
+
+// $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_fromname,email_subject,success_page,success_email_to,success_email_from,success_email_fromname,success_email_text,success_email_subject,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_fromname','$email_subject','$success_page','$success_email_to','$success_email_from','$success_email_fromname','$success_email_text','$success_email_subject','$max_submissions','$stored_submissions','$use_captcha')");
+
+// Insert settings
+$sql  = 'INSERT INTO  `'.TABLE_PREFIX.'mod_form_settings` SET ';
+$sql .= '`section_id` = \''.$section_id.'\', ';
+$sql .= '`page_id` = \''.$page_id.'\', ';
+$sql .= '`header` = \''.$header.'\', ';
+$sql .= '`field_loop` = \''.$field_loop.'\', ';
+$sql .= '`footer` = \''.$footer.'\', ';
+$sql .= '`email_to` = \''.$email_to.'\', ';
+$sql .= '`email_from` = \''.$email_from.'\', ';
+$sql .= '`email_fromname` = \''.$email_fromname.'\', ';
+$sql .= '`email_subject` = \''.$email_subject.'\', ';
+$sql .= '`success_page` = \''.$success_page.'\', ';
+$sql .= '`success_email_to` = \''.$success_email_to.'\', ';
+$sql .= '`success_email_from` = \''.$success_email_from.'\', ';
+$sql .= '`success_email_fromname` = \''.$success_email_fromname.'\', ';
+$sql .= '`success_email_text` = \''.$success_email_text.'\', ';
+$sql .= '`success_email_subject` = \''.$success_email_subject.'\', ';
+$sql .= '`max_submissions` = \''.$max_submissions.'\', ';
+$sql .= '`stored_submissions` = \''.$stored_submissions.'\', ';
+$sql .= '`use_captcha` = \''.$use_captcha.'\' ';
+$sql .= '';
+if($database->query($sql)) {
+	// $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor);
+}
