Index: /trunk/extras/for_wordpressme2011/ja_EUC/language/japanese/modinfo.php
===================================================================
--- /trunk/extras/for_wordpressme2011/ja_EUC/language/japanese/modinfo.php	(revision 490)
+++ /trunk/extras/for_wordpressme2011/ja_EUC/language/japanese/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressME¤Ïlibxml2¤Î¥Ð¡¼¥¸¥ç¥ó¤ò¼«Æ°Åª¤Ë¼èÆÀ¤·¡¢É¬Í×¤Ç¤¢¤ì¤Ð¥Ñ¥Ã¥Á¤¬Å¬±þ¤µ¤ì¤Þ¤¹¡£
 XPressME¤¬libxml2¤Î¥Ð¡¼¥¸¥ç¥ó¤ò¼èÆÀ¤Ç¤­¤Ê¤¤¾ì¹ç¡¢¤³¤Î¥ª¥×¥·¥ç¥ó¤Ç¶¯À©Åª¤Ë¥Ñ¥Ã¥Á¤òÅ¬±þ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£");
+	
+	define("_MI_MEMORY_LIMIT","¥â¥¸¥å¡¼¥ë¤ËºÇÄã¸ÂÉ¬Í×¤Ê¥á¥â¥ê(MB)");
+	define("_MI_MEMORY_LIMIT_DESC","php.ini¤Îmemory_limitÃÍ¤¬¤³¤ÎÃÍ¤è¤ê¾®¤µ¤¤¤È¤­¡¢²ÄÇ½¤Ç¤¢¤ì¤Ðini_set('memory_limit', Value);¤ò¼Â¹Ô¤·memory_limit¤òºÆÀßÄê¤¹¤ë");
 
 	// Block Name
Index: /trunk/extras/for_wordpressme2011/ja_UTF/language/ja_utf8/modinfo.php
===================================================================
--- /trunk/extras/for_wordpressme2011/ja_UTF/language/ja_utf8/modinfo.php	(revision 490)
+++ /trunk/extras/for_wordpressme2011/ja_UTF/language/ja_utf8/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressMEはlibxml2のバージョンを自動的に取得し、必要であればパッチが適応されます。
 XPressMEがlibxml2のバージョンを取得できない場合、このオプションで強制的にパッチを適応させることができます。");
+	
+	define("_MI_MEMORY_LIMIT","モジュールに最低限必要なメモリ(MB)");
+	define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する");
 
 	// Block Name
Index: /trunk/extras/xpress_i18n/portuguese-br/xpressme_modules_root/language/pt-br_utf8/modinfo.php
===================================================================
--- /trunk/extras/xpress_i18n/portuguese-br/xpressme_modules_root/language/pt-br_utf8/modinfo.php	(revision 490)
+++ /trunk/extras/xpress_i18n/portuguese-br/xpressme_modules_root/language/pt-br_utf8/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressME adquire uma versão de libxml2 automaticamente, e é adaptado um remendo se for necessário. 
 Quando XPressME não puder adquirir uma versão de libxml2, o senhor pode deixar um remendo isto ajustar violentamente com esta opção.");
+	
+	define("_MI_MEMORY_LIMIT","Tamanho de memória (MB) pelo menos necessário para módulo");
+	define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する");
 
 	// Block Name
Index: /trunk/extras/xpress_i18n/template/xpressme_modules_root/language/english/modinfo.php
===================================================================
--- /trunk/extras/xpress_i18n/template/xpressme_modules_root/language/english/modinfo.php	(revision 490)
+++ /trunk/extras/xpress_i18n/template/xpressme_modules_root/language/english/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressME acquires a version of libxml2 automatically, and it is adapted a patch if it is necessary. 
 When XPressME cannot acquire a version of libxml2, you can let a patch fit it with this option forcibly.");
+	
+	define("_MI_MEMORY_LIMIT","Memory size(MB) at least necessary for module");
+	define("_MI_MEMORY_LIMIT_DESC","Se o memory_limit avaliam de php.ini &eacute; menor que este valor. Tente o re-coloca&ccedil;&atilde;o de memory_limit com ini_set ('memory_limit', Valor);.");
 
 	// Block Name
Index: /trunk/xpressme_integration_kit/admin/index.php
===================================================================
--- /trunk/xpressme_integration_kit/admin/index.php	(revision 490)
+++ /trunk/xpressme_integration_kit/admin/index.php	(revision 491)
@@ -164,5 +164,6 @@
 	global $xoopsModule;
 	include(dirname(__FILE__) . '/../wp-includes/version.php');
-	
+	require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
+
 	if ($is_report) {
 		echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
@@ -190,7 +191,13 @@
 		echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
 		echo "<br />\n";
-		echo "memory_limit:   " ;
+		echo "default memory_limit:   " ;
 		echo  ini_get( 'memory_limit' );
 		echo "<br />\n";
+		$xoops_config = new ConfigFromXoops;
+		$xoops_config->xpress_set_memory_limmit();
+		echo "change memory_limit:   " ;
+		echo  ini_get( 'memory_limit' );
+		echo "<br />\n";
+		
 		echo "post_max_size:   " ;
 		echo  ini_get( 'post_max_size' );
@@ -258,7 +265,13 @@
 		echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
 		echo "</text><br />";
-		echo "<label>memory_limit:</label><text>";
+		echo "<label>default memory_limit:</label><text>";
 		echo  ini_get( 'memory_limit' );
 		echo "</text><br />";
+		$xoops_config = new ConfigFromXoops;
+		$xoops_config->xpress_set_memory_limmit();
+		echo "<label>change memory_limit:</label><text>";
+		echo  ini_get( 'memory_limit' );
+		echo "</text><br />";
+
 		echo "<label>post_max_size:</label><text>";
 		echo  ini_get( 'post_max_size' );
@@ -571,10 +584,9 @@
 function xpress_block_state($is_report = false)
 {
-	require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
-	$xoops_config = new ConfigFromXoops;
-	
+	$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
+
 	include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
 	$xoops_block_check =& xoops_block_check::getInstance();
-	$xoops_block_check->check_blocks($xoops_config->module_name);
+	$xoops_block_check->check_blocks($mydirname);
 	if ($is_report){
 		echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
Index: /trunk/xpressme_integration_kit/class/config_from_xoops.class.php
===================================================================
--- /trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 490)
+++ /trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 491)
@@ -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;
+			}
+		}
+		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'];
+				}
+			}
+		}
+		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'];
+				}
+			}
+			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);
+	}
+
+
+
 }
 ?>
Index: /trunk/xpressme_integration_kit/include/add_xpress_config.php
===================================================================
--- /trunk/xpressme_integration_kit/include/add_xpress_config.php	(revision 490)
+++ /trunk/xpressme_integration_kit/include/add_xpress_config.php	(revision 491)
@@ -3,4 +3,5 @@
 require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
 $xoops_config = new ConfigFromXoops;
+$xoops_config->xpress_set_memory_limmit();
 require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ;
 ?>
Index: /trunk/xpressme_integration_kit/language/english/modinfo.php
===================================================================
--- /trunk/xpressme_integration_kit/language/english/modinfo.php	(revision 490)
+++ /trunk/xpressme_integration_kit/language/english/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressME acquires a version of libxml2 automatically, and it is adapted a patch if it is necessary. 
 When XPressME cannot acquire a version of libxml2, you can let a patch fit it with this option forcibly.");
+	
+	define("_MI_MEMORY_LIMIT","Memory size(MB) at least necessary for module");
+	define("_MI_MEMORY_LIMIT_DESC","If the memory_limit value of php.ini is smaller than this value. Try the re-setting of memory_limit with ini_set('memory_limit', Value);.");
 
 	// Block Name
Index: /trunk/xpressme_integration_kit/language/ja_utf8/modinfo.php
===================================================================
--- /trunk/xpressme_integration_kit/language/ja_utf8/modinfo.php	(revision 490)
+++ /trunk/xpressme_integration_kit/language/ja_utf8/modinfo.php	(revision 491)
@@ -29,4 +29,7 @@
 XPressMEはlibxml2のバージョンを自動的に取得し、必要であればパッチが適応されます。
 XPressMEがlibxml2のバージョンを取得できない場合、このオプションで強制的にパッチを適応させることができます。");
+	
+	define("_MI_MEMORY_LIMIT","モジュールに最低限必要なメモリ(MB)");
+	define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する");
 
 	// Block Name
Index: /trunk/xpressme_integration_kit/xoops_version.php
===================================================================
--- /trunk/xpressme_integration_kit/xoops_version.php	(revision 490)
+++ /trunk/xpressme_integration_kit/xoops_version.php	(revision 491)
@@ -134,4 +134,12 @@
 	'default'		=> 0 ,
 );
+$modversion['config'][] = array(
+	'name'			=> 'memory_limit' ,
+	'title'			=>  '_MI_MEMORY_LIMIT' ,
+	'description'	=>  '_MI_MEMORY_LIMIT_DESC' ,
+	'formtype'		=> 'textbox' ,
+	'valuetype'		=> 'int' ,
+	'default'		=> 64 ,
+);
 
 //BLOCKS
