Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 313)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 328)
@@ -192,50 +192,48 @@
 	}
 	
-	function ReadPostData()
-	{
-		$this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path']));
-		$this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp']));
-		$this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision']));
-		$this->is_postnavi_title_disp = stripslashes(trim($_POST['ch_is_postnavi_title_disp']));
-		$this->is_left_postnavi_old = stripslashes(trim($_POST['ch_is_left_postnavi_old']));
-		$this->old_post_link_text = stripslashes($_POST['ch_old_post_link_text']);
-		if(empty($this->old_post_link_text)) $this->old_post_link_text = __('Older Post', 'xpressme');
-		$this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
-		if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('Newer Post', 'xpressme');
-		$this->is_left_page_navi_old = stripslashes(trim($_POST['ch_is_left_page_navi_old']));
-		$this->old_page_link_text = stripslashes($_POST['ch_old_page_link_text']);
-		if(empty($this->old_page_link_text)) $this->old_page_link_text = __('Older Entries', 'xpressme');
-		$this->newer_page_link_text = stripslashes($_POST['ch_newer_page_link_text']);
-		if(empty($this->newer_page_link_text)) $this->newer_page_link_text = __('Newer Entries', 'xpressme');
-		$this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
-		$this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
-		//d3forum
-		$d3forum_select = stripslashes(trim($_POST['ch_d3forum']));
-		if ($d3forum_select == 'none') {
-			$this->is_use_d3forum = false;
-			$this->d3forum_module_dir = '';
-			$this->d3forum_forum_id = '';
-			$this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
-		} else {
-			$d3f_set = explode('|', $d3forum_select);
-			$this->is_use_d3forum = true;
-			$this->d3forum_module_dir = $d3f_set[1];
-			$this->d3forum_forum_id = $d3f_set[2];
-			$this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
-		}
-		$this->is_d3forum_flat = stripslashes(trim($_POST['ch_d3forum_type']));
-		$this->is_d3forum_desc = stripslashes(trim($_POST['ch_d3forum_order']));
-		$this->d3forum_views_num = stripslashes(trim($_POST['ch_d3forum_view_num']));
-		
-		$this->is_content_excerpt = stripslashes(trim($_POST['ch_is_content_excerpt']));
-		$this->ascii_judged_rate = stripslashes(trim($_POST['ch_ascii_judged_rate']));
-		$this->excerpt_length_word = stripslashes(trim($_POST['ch_excerpt_length_word']));
-		$this->excerpt_length_character = stripslashes(trim($_POST['ch_excerpt_length_character']));
-		$this->more_link_text = stripslashes(trim($_POST['ch_more_link_text']));
-		$this->viewer_type = stripslashes(trim($_POST['ch_viewer_type']));
-		$this->is_multi_user = stripslashes(trim($_POST['ch_is_multi_user']));
-		$this->meta_keyword_type = stripslashes(trim($_POST['ch_meta_keyword_type']));
-		$this->meta_description_type = stripslashes(trim($_POST['ch_meta_description_type']));
-		$this->meta_robot_type = stripslashes(trim($_POST['ch_meta_robot_type']));
+	function ReadPostData($post_data = null)
+	{
+		global $xoops_db;
+		
+		foreach ( (array) $post_data as $index_key => $value ){
+			if (preg_match('/^ch_/',$index_key)){  // case ch_
+				$indedx = preg_replace('/^ch_/', '', $index_key);
+				$set_value = stripslashes(trim($value));
+				// post d3forum
+				if ($indedx === 'd3forum') {
+					if ($value == 'none'){
+						$this->is_use_d3forum = false;
+						$this->d3forum_module_dir = '';
+						$this->d3forum_forum_id = '';
+						$this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
+					} else {
+						$d3f_set = explode('|', $value);
+						$this->is_use_d3forum = true;
+						$this->d3forum_module_dir = $d3f_set[1];
+						$this->d3forum_forum_id = $d3f_set[2];
+						$this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
+					}
+				} else { //post other
+					if(empty($set_value)){
+						switch ($indedx) {
+							case 'old_post_link_text':
+								$set_value = __('Older Post', 'xpressme');
+								break;
+							case 'newer_post_link_text':
+								$set_value = __('Newer Post', 'xpressme');
+								break;
+							case 'old_page_link_text':
+								$set_value = __('Older Entries', 'xpressme');
+								break;
+							case 'newer_page_link_text':
+								$set_value = __('Newer Entries', 'xpressme');
+								break;
+							default:
+						}
+					}
+					$this->$indedx = $value;
+				}
+			} // end of case 'ch_'
+		} // end of loop
 
 		global $xoops_db;
@@ -245,17 +243,19 @@
 		
 		foreach ($this->groupe_role as $groupe) {
-			$post_name = 'role_gid_' . $groupe->groupid;
-			$role = stripslashes(trim($_POST[$post_name]));
-			$post_name = 'login_all_gid_' . $groupe->groupid;
-			$login_all = stripslashes(trim($_POST[$post_name]));
-			if (empty($login_all)) $login_all = '0';
-			$groupe->role = $role;
-			$groupe->login_all = $login_all;
-			$update_sql  = "UPDATE  $table ";
-			$update_sql .= 'SET ';
-			$update_sql .= "role  = '$role' , ";
-			$update_sql .= "login_all  = $login_all ";
-			$update_sql .= "WHERE (groupid = '$groupe->groupid' )";
-			$xoops_db->query($update_sql);			
+			$post_role_gid = 'role_gid_' . $groupe->groupid;
+			$login_all_gid = 'login_all_gid_' . $groupe->groupid;
+			if (isset($post_data[$post_role_gid])){
+				$role = stripslashes(trim($post_data[$post_role_gid]));
+				$login_all = stripslashes(trim($post_data[$login_all_gid]));
+				if (empty($login_all)) $login_all = '0';
+				$groupe->role = $role;
+				$groupe->login_all = $login_all;
+				$update_sql  = "UPDATE  $table ";
+				$update_sql .= 'SET ';
+				$update_sql .= "role  = '$role' , ";
+				$update_sql .= "login_all  = $login_all ";
+				$update_sql .= "WHERE (groupid = '$groupe->groupid' )";
+				$xoops_db->query($update_sql);	
+			}		
 		}
 	}
@@ -516,22 +516,22 @@
 		$form .=  __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp";
 		if ($this->is_d3forum_flat){
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' />". __('Threaded','xpressme') . "</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' />". __('Threaded','xpressme') . "</label>\n";
 		}else{
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' />" . __('Flat','xpressme') . "</label>\n";
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' />" . __('Flat','xpressme') . "</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
 		}
 		$form .= '<br />';
 		$form .=  __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp";
 		if ($this->is_d3forum_desc){
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' />". __('ASC','xpressme') . "</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' />". __('ASC','xpressme') . "</label>\n";
 		}else{
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' />" . __('DESC','xpressme') . "</label>\n";
-			$form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' />" . __('DESC','xpressme') . "</label>\n";
+			$form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
 		}
 		$form .= '<br />';
 		$form .=  __('Number of displays of D3Forum comments.', 'xpressme') ." \n";
-		$form .= '&emsp<label> <input name="ch_d3forum_view_num" type="text" size="3" maxlength="3" value="'  . $this->d3forum_views_num . '" /></label>'."\n";
+		$form .= '&emsp<label> <input name="ch_d3forum_views_num" type="text" size="3" maxlength="3" value="'  . $this->d3forum_views_num . '" /></label>'."\n";
 
 		$form .= '<div class="submit">'."\n";		
@@ -679,89 +679,4 @@
 	}
 
-
-	function option_page()
-	{
-		global $xoops_config;
-		
-		$xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
-
-		$do_message ='';
-		if (!empty($_POST['submit_update'])) {
-			$this->ReadPostData();
-			$this->SettingValueWrite('update');
-		} else if (isset($_POST['submit_reset'])) {
-			$this->setDefault();
-			$this->SettingValueWrite('update');
-		} else if (isset($_POST['export_d3f'])) {
-			$do_message  = 'export(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
-			$do_message .= wp_to_d3forum($this->d3forum_forum_id, $this->d3forum_module_dir);
-			$do_message .= '....END';
-		} else if (isset($_POST['inport_d3f'])) {
-			$do_message  = 'Import(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
-			$do_message .= d3forum_to_wp($this->d3forum_forum_id, $this->d3forum_module_dir);
-			$do_message .= '....END';
-		} 		
-		
-		echo	'<div class="wrap">'."\n";
-		echo		'<div id="icon-options-general" class="icon32"><br /></div>'."\n";
-		echo		'<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2><br>\n";
-		echo 		'<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
-		echo		'<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
-		echo			'<table class="form-table">'."\n";
-		echo				$this->viewer_type_option();
-		echo				$this->yes_no_radio_option('is_use_xoops_upload_path',
-												__('Media Upload Base Path','xpressme'),
-												__('Use XOOPS UPLOAD PATH','xpressme'),
-												__('USE WordPress BASE_PATH','xpressme')
-												);
-		echo				$this->yes_no_radio_option('is_theme_sidebar_disp',
-												__('Thema Sidebar Display','xpressme'),
-												__('YES','xpressme'),
-												__('NO','xpressme')
-												);
-		echo				$this->yes_no_radio_option('is_save_post_revision',
-												__('The change tracking of the post is preserved','xpressme'),
-												__('YES','xpressme'),
-												__('NO','xpressme')
-												);
-		
-		echo				$this->yes_no_radio_option('is_multi_user',
-												__('Select Multi user mode','xpressme'),
-												__('YES','xpressme'),
-												__('NO','xpressme')
-												);
-		
-		
-		echo 				$this->single_post_navi_option();
-		echo 				$this->posts_page_navi_option();
-		echo 				$this->excerpt_option();
-		
-		echo				$this->yes_no_radio_option('is_author_view_count',
-												__('Is the posts author views counted?','xpressme'),
-												__('YES','xpressme'),
-												__('NO','xpressme')		
-												);
-		echo 				$this->header_meta_option();
-		echo				$this->yes_no_radio_option('is_sql_debug',
-												__('Is SQL debugging window displayed?','xpressme'),
-												__('YES','xpressme'),
-												__('NO','xpressme')		
-												);
-		
-		echo				$this->groupe_role_option();		
-		
-		echo				$this->d3forum_option($do_message);		
-//		$this->is_use_xoops_upload_path_html();
-		echo			"</table>\n";
-		
-		echo		'<p class="submit">'."\n";
-		echo		'<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
-		echo		'<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
-		echo		"</p>\n";
-
-		echo		"</form>\n" ;
-		echo	"</div>\n";
-	}
-	
 	function xpress_upload_filter($uploads)
 	{
@@ -836,40 +751,5 @@
 			</script>';
 		}
-	}	
-	
-	function set_d3forum_external_link_format()
-	{
-		global $xoops_db;
-/*		var $is_use_d3forum;
-		var $d3forum_module_dir;
-		var $d3forum_forum_id;
-		var $d3forum_external_link_format;
-		if ($this->$is_use_d3forum){
-			$content = '';
-			$content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
-			$content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
-			$content .= '<title>XPressME SQL DEBUG</title>' ;
-			$content .= '</head><body>';
-			$content .= $GLOBALS['XPress_SQL_Query'];
-			$content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
-
-			echo '<script type="text/javascript">
-				<!--//
-				xpress_debug_window = window.open("", "xpress_debug", "width=680 , height=600 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
-				xpress_debug_window.document.clear();
-				xpress_debug_window.focus();
-				';
-			$lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
-			foreach ($lines as $line) {
-				echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
-			}
-			echo '
-				xpress_debug_window.document.close();
-				//-->
-			</script>';
-		}
-*/
-	}	
-
+	}
 }
 ?>
