Index: trunk/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 95)
+++ trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 99)
@@ -15,5 +15,8 @@
 	var $is_sql_debug;
 	var $groupe_role;
-
+	var $is_use_d3forum;
+	var $d3forum_module_dir;
+	var $d3forum_forum_id;
+	var $d3forum_external_link_format;
 	//constructor
 	function XPressME_Class()
@@ -49,4 +52,8 @@
 		$this->is_author_view_count = false;
 		$this->is_sql_debug = false;
+		$this->is_use_d3forum = false;
+		$this->d3forum_module_dir = '';
+		$this->d3forum_forum_id = '';
+		$this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
 	}
 	
@@ -79,5 +86,9 @@
 			'newer_post_link_text' => $this->newer_post_link_text,
 			'is_author_view_count' => $this->is_author_view_count,
-			'is_sql_debug' => $this->is_sql_debug
+			'is_sql_debug' => $this->is_sql_debug,
+			'is_use_d3forum' =>	$this->is_use_d3forum,
+			'd3forum_module_dir' => $this->d3forum_module_dir,
+			'd3forum_forum_id' => $this->d3forum_forum_id,
+			'd3forum_external_link_format' => $this->d3forum_external_link_format
 		);
 		if ($mode == 'add_new') {
@@ -144,4 +155,18 @@
 		$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';
+		}
 		
 		global $xoops_db;
@@ -256,5 +281,61 @@
 
 	}
-		
+	
+	function d3forum_option(){
+		global $xoops_db;
+		
+		$d3frum_list = array();
+		$module_dir_path = get_xoops_root_path();
+		
+		$forum_list  = '<select name="ch_d3forum">' . "\n";
+		
+		if ($this->is_use_d3forum != true)
+			$selected = ' selected="selected"';
+		else
+			$selected = '';
+		$forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n";
+
+		// Form making for forum selection of D3forum
+		$modules_table = get_xoops_prefix() .'modules';
+		$sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1";
+		$modules = $xoops_db->get_results($sql);
+		foreach ($modules as $module) {
+			$file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';			
+			if (! file_exists($file_path)) continue;
+			$array_files = file($file_path);
+			// It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file.
+			foreach ($array_files as $aeey_file){
+				if( preg_match( "/\s*($mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) {
+					$forums_tb = get_xoops_prefix() . $module->dirname . '_forums';
+					$cat_tb = get_xoops_prefix() . $module->dirname . '_categories';
+					$sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id";
+					$forums = $xoops_db->get_results($sql);
+					foreach ($forums as $forum) {
+						if (($module->dirname == $this->d3forum_module_dir) &&  ($forum->forum_id == $this->d3forum_forum_id))
+							$selected = ' selected="selected"';
+						else
+							$selected = '';
+						$forum_div = 'forum|' . $module->dirname . '|' .  $forum->forum_id;
+						$forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)";
+						$forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n";
+					}
+					break;
+				}
+			}
+			$form .= '<br>';			
+		}
+		$forum_list .= '</select>' . "\n";
+
+		$form  = '<tr>' . "\n";
+		$form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n";
+		$form .=  "<td>\n";
+		$form .=  __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n";
+		$form .=  $forum_list."\n";
+		$form .= '<br /><br /><br /><br /><br /><br /><br />';
+		$form .=  "</td>\n";
+		$form .=  "</tr><tr>\n";
+		return $form;
+	}
+
 	function option_page()
 	{
@@ -316,5 +397,7 @@
 												);
 		
-		echo				$this->groupe_role_option();				
+		echo				$this->groupe_role_option();		
+		
+		echo				$this->d3forum_option();		
 //		$this->is_use_xoops_upload_path_html();
 		echo			"</table>\n";
