Index: trunk/xpressme_integration_kit/class/modInfo_class.php
===================================================================
--- trunk/xpressme_integration_kit/class/modInfo_class.php	(revision 785)
+++ trunk/xpressme_integration_kit/class/modInfo_class.php	(revision 786)
@@ -12,4 +12,12 @@
 
 class modInfoClass {
+	var $db_name;
+	var $db_user;
+	var $db_pass;
+	var $db_host;
+	var $db_salt;
+	var $xoops_db_prefix;
+	var $module_db_prefix;
+	
 	var $xoops_mainfile_path;
 	var $xoops_root_path;
@@ -22,7 +30,5 @@
 	var $xoops_db_salt;
 	var $xoops_salt;
-	var $xoops_db_prefix;
 	var $xoops_language;
-	var $module_db_prefix;
 	var $module_name;
 	var $module_path;
@@ -41,5 +47,7 @@
 	var $wp_version;
 	var $wpConfigInfo;
-	
+	var $factory;
+	var $module;
+	var $langInfo;
 	function __constructor()	//for PHP5
     {
@@ -50,26 +58,32 @@
     function modInfoClass()	//for PHP4 constructor
     {  
-    	global $xoopsModule,$wpConfigInfo,$xoopsConfig;
-    	if (!is_object($wpConfigInfo)){
-    		include_once dirname(__FILE__).'/wpConfigInfo_class.php';
-    		$this->wpConfigInfo = new wpConfigInfoClass;
-    	}
+    	global $xoopsModule;
+
+    		
     	if (! is_object($xoopsModule)){
-			$module_handler =& xoops_gethandler('module');
-			$xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__))));
-		}	
-
-    	$this->xoops_root_path = XOOPS_ROOT_PATH;
+//			$module_handler =& xoops_gethandler('module');
+//			$xoopsModule =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__))));
+		}
+		$this->_branches_cores();
+		if ($this->is_xoops_legacy) $this->factory = XOOPS::factory();
+		if (is_object($this->factory)){
+//			$module_handler = & XOOPS::getHandle('module');
+		} else {
+//			$module_handler =& xoops_gethandler('module');
+		}
+//		$this->module =& $module_handler->getByDirname(basename(dirname(dirname(__FILE__))));
+		$this->_get_db_ini();
+		$this->module_db_prefix = $this->_get_module_db_prefix();
+    	$this->xoops_root_path = $this->_get_xoops_root_path();
 		$this->xoops_trust_path = (defined('XOOPS_TRUST_PATH')) ? XOOPS_TRUST_PATH : '';
-		$this->xoops_url = XOOPS_URL;
-    	$this->xoops_mainfile_path = XOOPS_ROOT_PATH . '/mainfile.php';
-		$this->xoops_upload_path = XOOPS_UPLOAD_PATH;
-		$this->xoops_upload_url = XOOPS_UPLOAD_URL;
-		$this->xoops_cache_path = XOOPS_CACHE_PATH;
+		$this->xoops_var_path = $this->_get_xoops_var_path();
+		$this->xoops_url = $this->_get_xoops_url();
+    	$this->xoops_mainfile_path = $this->xoops_root_path . '/mainfile.php';
+		$this->xoops_upload_path = $this->_get_xoops_upload_path();
+		$this->xoops_upload_url = $this->_get_xoops_upload_url();
+		$this->xoops_cache_path = $this->_get_xoops_cache_path();
     	$this->module_path=dirname(dirname(__FILE__));
     	$this->module_name=basename($this->module_path);
 		$this->module_url = $this->xoops_url . '/modules/' . $this->module_name;
-		$this->xoops_db_prefix = XOOPS_DB_PREFIX . '_';
-		$this->module_db_prefix = $this->_get_module_db_prefix();
 		$this->xoops_lang =  @$GLOBALS["xoopsConfig"]['language'];
 		$this->module_id = ! empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0;
@@ -86,10 +100,69 @@
 			$this->xoops_time_zone = $xoopsConfig['default_TZ'];
 		}
+		require_once dirname( __FILE__ ).'/langInfo_class.php' ;
+		$this->langInfo = new langInfoClass;
     }
-
+    function _get_xoops_root_path(){
+    	if (defined('XOOPS_ROOT_PATH')) return XOOPS_ROOT_PATH;
+    	return $this->factory->path('www');	//XOOPS Engine
+	}
+    function _get_xoops_var_path(){
+    	if (defined('XOOPS_VAR_PATH')) return XOOPS_VAR_PATH;
+    	return $this->factory->path('var');	//XOOPS Engine
+	}
+    function _get_xoops_cache_path(){
+    	if (defined('XOOPS_CACHE_PATH')) return XOOPS_CACHE_PATH;
+    	return $this->factory->path('var'). "/cache/system";	//XOOPS Engine
+	}
+    function _get_xoops_url(){
+    	if (defined('XOOPS_URL')) return XOOPS_URL;
+    	return $this->factory->url('',true);	//XOOPS Engine
+	}
+    function _get_xoops_upload_path(){
+    	if (defined('XOOPS_UPLOAD_PATH')) return XOOPS_UPLOAD_PATH;
+    	return $this->factory->path('upload');	//XOOPS Engine
+	}
+    function _get_xoops_upload_url(){
+    	if (defined('XOOPS_UPLOAD_URL')) return XOOPS_UPLOAD_URL;
+    	return $this->factory->url('upload',true);	//XOOPS Engine
+	}	
+	
+	function _get_db_ini(){
+		if (defined('XOOPS_DB_NAME')){
+			$this->xoops_db_prefix = XOOPS_DB_PREFIX . '_';
+			$this->db_name = XOOPS_DB_NAME;
+			$this->db_user = XOOPS_DB_USER;
+			$this->db_pass = XOOPS_DB_PASS;
+			$this->db_host = XOOPS_DB_HOST;
+			return;
+		}
+
+		if(!defined('XOOPS_VAR_PATH') ) {
+			$var_path = $this->factory->path('var');	//XOOPS Engine
+		} else {
+			$var_path = XOOPS_VAR_PATH;
+		}
+		$def_file = $var_path . '/etc/resource.db.ini.php';
+		if(! file_exists($def_file)) return;
+		$array_file = file($def_file);
+		foreach ($array_file as $line){
+			if (preg_match('/^\s*dbname\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
+				$this->db_name = $matchs[1];
+			if (preg_match('/^\s*host\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
+				$this->db_host = $matchs[1];
+			if (preg_match('/^\s*username\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
+				$this->db_user = $matchs[1];
+			if (preg_match('/^\s*password\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
+				$this->db_pass = $matchs[1];
+			if (preg_match('/^\s*prefix\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
+				$this->xoops_db_prefix = $matchs[1].'_';
+		}
+	}
 	function _get_module_db_prefix(){
-    	$module_db_prefix = XOOPS_DB_PREFIX . '_' . preg_replace('/wordpress/','wp',$this->module_name);
+		$module_name = basename(dirname(dirname(__FILE__)));
+    	$module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_name) . '_';
     	return $module_db_prefix;
 	}
+
     function _branches_cores(){
     	/*  XOOPS include/version.php define value */
@@ -106,20 +179,23 @@
 		$this->is_xoops_legacy = false;
 		$this->is_jpex = false;
-		
+		if (!defined('XOOPS_VERSION')){
+			$root_path = dirname(dirname(dirname(dirname(__FILE__))));
+			include_once $root_path . '/include/version.php';
+		}
 		$version = XOOPS_VERSION;
 		
 		
     	// branches by cores
-		if( preg_match('/JP$/', $this->xoops_version))
+		if( preg_match('/JP$/', $version))
 			$this->is_xoops2jp = true;
-		if( preg_match('/Cube\s*Legacy/', $this->xoops_version))
+		if( preg_match('/Cube\s*Legacy/', $version))
 			$this->is_cube_legacy = true;
-		if( preg_match('/ImpressCMS/', $this->xoops_version))
+		if( preg_match('/ImpressCMS/', $version))
 			$this->is_impress_cms = true;
-		if( preg_match('/JPEx/', $this->xoops_version))
+		if( preg_match('/JPEx/', $version))
 			$this->is_jpex = true;
-		if( preg_match('/XOOPS\s*[0-9|\.]*$/', $this->xoops_version))
+		if( preg_match('/XOOPS\s*[0-9|\.]*$/', $version))
 			$this->is_xoops2 = true;
-		if( preg_match('/Xoops\s*Legacy/', $this->xoops_version))
+		if( preg_match('/Xoops\s*Legacy/', $version))
 			$this->is_xoops_legacy = true;
 	}
@@ -150,4 +226,30 @@
 		return $this->xoops_db_prefix;
 	}
+	function get_module_db_prefix($module_dirnam=''){
+		if (empty($module_dirname)){
+			return $this->module_db_prefix;
+		} else {
+    		$module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_dirname) . '_';
+    		return $module_db_prefix;		
+		}
+	}
+	function get_db_name(){
+		return $this->db_name;
+	}
+	function get_db_user(){
+		return $this->db_user;
+	}
+	function get_db_pass(){
+		return $this->db_pass;
+	}
+	function get_db_host(){
+		return $this->db_host;
+	}
+	function get_db_salt(){
+		return $this->db_salt;
+	}
+	function get_wpLang($xoops_lang=''){
+		return $this->langInfo->get_wpLang($xoops_lang);
+	}
 	
 	function get_xoops_root_path(){
@@ -194,7 +296,4 @@
 		return $this->module_url;
 	}
- 	function get_module_db_prefix(){
-		return $this->xpress_db_prefix;
-	}
  	function get_xoops_time_zone(){
 		return $this->xoops_time_zone;
@@ -233,4 +332,5 @@
 	
 	function get_moduleID_ByDirname($dir_name){
+		if (! function_exists('xoops_gethandler')) return '';
 		$module_handler =& xoops_gethandler('module');
 		$module =& $module_handler->getByDirname($dir_name);
@@ -314,5 +414,5 @@
 		return $SV;
 	}
-	public function get_mod_image_link($file_name='') 
+	function get_mod_image_link($file_name='') 
 	{
 		$link_url = '';
@@ -324,7 +424,4 @@
 		return $link_url;
 	}
-	function get_wpLang($xoops_lang=''){
-		return $this->wpConfigInfo->get_wpLang($xoops_lang);
-	}
 	
 }
Index: trunk/xpressme_integration_kit/class/wpConfigInfo_class.php
===================================================================
--- trunk/xpressme_integration_kit/class/wpConfigInfo_class.php	(revision 785)
+++ 	(revision )
@@ -1,103 +1,0 @@
-<?php
-/*
- * XPressME - WordPress for XOOPS
- *
- * @copyright	XPressME Project http://www.toemon.com
- * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
- * @author		toemon
- * @package		module::xpress
- */
-
-if (defined( 'XOOPS_MAINFILE_INCLUDED')|| defined( 'XOOPS_BOOTSTRAP')) :
-require_once dirname( __FILE__ ).'/langInfo_class.php' ;
-
-class wpConfigInfoClass {
-	var $xoops_db_prefix;
-	var $db_prefix;
-	var $db_name;
-	var $db_user;
-	var $db_pass;
-	var $db_host;
-	var $db_salt;
-	var $langInfo;
-	
-	function __constructor()	//for PHP5
-    {
-        $this->wpConfigInfoClass();
-    }
-    
-    function wpConfigInfoClass()	//for PHP4 constructor
-    {
-		global $xoopsModule;
-		$this->xoops_db_prefix = XOOPS_DB_PREFIX . '_';
-		$this->db_name = XOOPS_DB_NAME;
-		$this->db_user = XOOPS_DB_USER;
-		$this->db_pass = XOOPS_DB_PASS;
-		$this->db_host = XOOPS_DB_HOST;
-		if(!defined('XOOPS_DB_NAME') ) $this->_get_resource_db_ini();
-		$this->db_prefix = $this->_get_wp_db_prefix();
-		$this->db_salt = (defined('XOOPS_DB_SALT')) ? XOOPS_DB_SALT : '';
-		require_once dirname( __FILE__ ).'/langInfo_class.php' ;
-		$this->langInfo = new langInfoClass;
-    }
-	function _get_wp_db_prefix(){
-		$module_name = basename(dirname(dirname(__FILE__)));
-    	$module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_name) . '_';
-    	return $module_db_prefix;
-	}
-
-	// XOOPS3 doesn't define the DB connection information in the constant.
-    function _get_resource_db_ini(){
-		if(!defined('XOOPS_VAR_PATH') ) return;
-		$def_file = XOOPS_VAR_PATH . '/etc/resource.db.ini.php';
-		if(! file_exists($def_file)) return;
-		$array_file = file($def_file);
-		foreach ($array_file as $line){
-			if (preg_match('/^\s*dbname\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
-				$this->db_name = $matchs[1];
-			if (preg_match('/^\s*host\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
-				$this->db_host = $matchs[1];
-			if (preg_match('/^\s*username\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
-				$this->db_user = $matchs[1];
-			if (preg_match('/^\s*password\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
-				$this->db_pass = $matchs[1];
-			if (preg_match('/^\s*prefix\s*=\s*[\'"](.*)[\'"]/' ,$line,$matchs))
-				$this->xoops_db_prefix = $matchs[1].'_';
-		}
-	}
-	
-	function get_xoops_db_prefix(){
-		return $this->xoops_db_prefix;
-	}
-	function get_db_prefix($module_dirname){
-		if (empty($module_dirname)){
-			return $this->db_prefix;
-		} else {
-    		$module_db_prefix = $this->xoops_db_prefix . preg_replace('/wordpress/','wp',$module_dirname) . '_';
-    		return $module_db_prefix;		
-		}
-	}
-	function get_wp_db_prefix(){
-		return $this->db_prefix;
-	}
-	function get_db_name(){
-		return $this->db_name;
-	}
-	function get_db_user(){
-		return $this->db_user;
-	}
-	function get_db_pass(){
-		return $this->db_pass;
-	}
-	function get_db_host(){
-		return $this->db_host;
-	}
-	function get_db_salt(){
-		return $this->db_salt;
-	}
-	function get_wpLang($xoops_lang=''){
-		return $this->langInfo->get_wpLang($xoops_lang);
-	}
-}
-endif;
-?>
Index: trunk/xpressme_integration_kit/include/add_xpress_config.php
===================================================================
--- trunk/xpressme_integration_kit/include/add_xpress_config.php	(revision 785)
+++ trunk/xpressme_integration_kit/include/add_xpress_config.php	(revision 786)
@@ -9,9 +9,11 @@
 if ( defined('WP_ADMIN') )	{
 	$nocommon_scripts = array(
+		'wp-admin',
 		'wp-admin/async-upload.php',
 	);
 	foreach($nocommon_scripts as $nocommon_script){
 		if (strstr($_SERVER['SCRIPT_NAME'],$nocommon_script) !== false) {
-			$xoopsOption['nocommon'] = 1;
+			defined('XOOPS_BOOTSTRAP') or define('XOOPS_BOOTSTRAP', false); // For XE
+			$xoopsOption['nocommon'] = 1;									// For Other
 			break;
 		}
@@ -24,10 +26,11 @@
 
 require_once dirname( __FILE__ ).'/xpress_debug_log.php' ;
-require_once dirname(dirname( __FILE__ )).'/class/wpConfigInfo_class.php' ;
-$wpConfigInfo = new wpConfigInfoClass;
 require_once dirname(dirname( __FILE__ )).'/class/modInfo_class.php' ;
 $modInfo = new modInfoClass;
-require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ;
-$userInfo = new userInfoClass;
+//require_once dirname(dirname( __FILE__ )).'/class/userInfo_class.php' ;
+//$userInfo = new userInfoClass;
+
 require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ;
+
+
 ?>
