Index: branches/Ver2.2/xpressme_integration_kit/class/config_from_xoops.class.php
===================================================================
--- trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 439)
+++ branches/Ver2.2/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 493)
@@ -43,4 +43,7 @@
 	var $wp_version;
 	var $is_wp_me;
+	var $xoops_language;
+	var $module_id;
+	var $module_config= array();
 	
 	function __constructor()	//for PHP5
@@ -102,4 +105,7 @@
 		$this->set_wp_version();
 		$this->set_mu_current_site();
+		$this->xpress_get_module_id();
+		$this->xoops_language = $this->xpress_get_xoops_config('language');
+		$this->xpress_get_module_config();
     }
 
@@ -314,5 +320,75 @@
 		}
     }
-    
+
+	function xpress_get_xoops_config($config_name = '',$mid = 0){
+		$ret = '';
+		$cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass);
+		if (!$cn) return $ret;
+		
+		$db_selected = mysql_select_db($this->xoops_db_name, $cn);
+		if ($db_selected){
+			$table_name = $this->xoops_db_prefix . '_config';
+			$sql = "SELECT conf_value AS value FROM $table_name WHERE `conf_modid` = $mid AND `conf_name` = '$config_name'";
+			if($result = mysql_query($sql)){
+				$row = mysql_fetch_assoc($result);
+				$ret = $row['value'];
+			} else {
+				$ret = $sql;
+			}
+		}
+		if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn);
+		return $ret;
+	}
+
+	function xpress_get_module_config(){
+		$this->module_config= array();
+		$cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass);
+		if (!$cn) return $ret;
+		
+		$db_selected = mysql_select_db($this->xoops_db_name, $cn);
+		if ($db_selected){
+			$table_name = $this->xoops_db_prefix . '_config';
+			$sql = "SELECT conf_name AS name, conf_value AS value FROM $table_name WHERE `conf_modid` = $this->module_id";
+			if($result = mysql_query($sql)){
+				while ($row = mysql_fetch_assoc($result)) {
+	    			$this->module_config[$row['name']] = $row['value'];
+				}
+			}
+		}
+		if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn);
+		return $this->module_config;
+	}
+
+	function xpress_get_module_id(){
+		$this->module_id = '';
+		$cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass);
+		if ($cn){
+			$db_selected = mysql_select_db($this->xoops_db_name, $cn);
+			if ($db_selected){
+				$table_name = $this->xoops_db_prefix . '_modules';
+				$sql = "SELECT mid FROM $table_name WHERE `dirname` = '$this->module_name'";
+				if($result = mysql_query($sql)){
+					$row = mysql_fetch_assoc($result);
+					$this->module_id = $row['mid'];
+				}
+			}
+			if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn);
+		}
+		return $this->module_id;
+	}
+	
+	
+	// Set XPressME memory limit
+	function xpress_set_memory_limmit(){
+		$memory = $this->module_config['memory_limit'];
+		if (empty($memory)) return;
+ 		if ( !defined('WP_MEMORY_LIMIT') )
+			define('WP_MEMORY_LIMIT', $memory . 'M');
+		if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
+			@ini_set('memory_limit', WP_MEMORY_LIMIT);
+	}
+
+
+
 }
 ?>
