Index: /trunk/xpressme_integration_kit/admin/index.php
===================================================================
--- /trunk/xpressme_integration_kit/admin/index.php	(revision 859)
+++ /trunk/xpressme_integration_kit/admin/index.php	(revision 860)
@@ -165,4 +165,5 @@
 	include(dirname(__FILE__) . '/../wp-includes/version.php');
 	require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ;
+	$db =& XoopsDatabaseFactory::getDatabaseConnection();
 
 	if ($is_report) {
@@ -173,5 +174,5 @@
 		if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
 		echo "<br />\n";;
-		echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />";
+		echo "MySQL Version:   " . mysqli_get_server_info($db->conn) . "</text><br />";
 		echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />";
 		echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
@@ -247,5 +248,5 @@
 		if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
 		echo "</text><br />";
-		echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
+		echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysqli_get_server_info($db->conn) . "</text><br />";
 		echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
 		echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
Index: /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php
===================================================================
--- /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php	(revision 859)
+++ /trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php	(revision 860)
@@ -9,8 +9,15 @@
 		{
 		//	include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ;
-			global $forum_id;
-			
+			if ( empty( $this->forum_id ) ) {
+				global $forum_id;
+				if ( !empty( $forum_id ) ) {
+					$this->forum_id = $forum_id;
+				} else {
+					return parent::fetchSummary( $external_link_id );
+				}
+			}
+
 			$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
-			$myts =& MyTextsanitizer::getInstance() ;
+			(method_exists('MyTextsanitizer', 'sGetInstance') && ($myts =& MyTextsanitizer::sGetInstance())) || ($myts =& MyTextsanitizer::getInstance()) ;
 
 			$module_handler =& xoops_gethandler( 'module' ) ;
@@ -24,5 +31,5 @@
 			
 			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
-			$blog_info = $this->get_comment_blog_info($forum_id);
+			$blog_info = $this->get_comment_blog_info($this->forum_id);
 			// query
 			$post_row = $db->fetchArray( $db->query( "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id" ) ) ;
@@ -68,6 +75,14 @@
 		function canAddComment($external_link_id)
 		{
-			global $forum_id;
 			global $post;
+
+			if ( empty( $this->forum_id ) ) {
+				global $forum_id;
+				if ( !empty( $forum_id ) ) {
+					$this->forum_id = $forum_id;
+				} else {
+					return false;
+				}
+			}
 			
 			if (is_object($post)){  // in wordpress 
@@ -92,5 +107,5 @@
 					if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
 					
-					$blog_info = $this->get_comment_blog_info($forum_id);
+					$blog_info = $this->get_comment_blog_info($this->forum_id);
 					$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
@@ -176,9 +191,16 @@
 		function validate_id( $link_id )
 		{
-			global $forum_id;
+			if ( empty( $this->forum_id ) ) {
+				global $forum_id;
+				if ( !empty( $forum_id ) ) {
+					$this->forum_id = $forum_id;
+				} else {
+					return false;
+				}
+			}
 			$post_id = intval( $link_id ) ;
 			$mydirname = $this->mydirname ;
 			$xpress_prefix = preg_replace('/wordpress/','wp',$mydirname);
-			$blog_info = $this->get_comment_blog_info($forum_id);		
+			$blog_info = $this->get_comment_blog_info($this->forum_id);
 			$db =& XoopsDatabaseFactory::getDatabaseConnection() ;
 			
Index: /trunk/xpressme_integration_kit/include/memory_limit.php
===================================================================
--- /trunk/xpressme_integration_kit/include/memory_limit.php	(revision 859)
+++ /trunk/xpressme_integration_kit/include/memory_limit.php	(revision 860)
@@ -15,7 +15,7 @@
 		$has_xoops_db = (!empty($xoopsDB));
 		if (!$has_xoops_db) {
-			$cn = mysql_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass);
+			$cn = mysqli_connect($xoops_config->xoops_db_host, $xoops_config->xoops_db_user, $xoops_config->xoops_db_pass);
 			if ($cn){
-				$db_selected = mysql_select_db($xoops_config->xoops_db_name, $cn);
+				$db_selected = mysqli_select_db($cn, $xoops_config->xoops_db_name);
 			}
 		}
@@ -31,6 +31,6 @@
 		} else {
 			if ($db_selected){
-				if($result = mysql_query($module_sql)){
-					$row = mysql_fetch_assoc($result);
+				if($result = mysqli_query($cn, $module_sql)){
+					$row = mysqli_fetch_assoc($result);
 					$module_id = $row['mid'];
 				}
@@ -48,6 +48,6 @@
 			} else {
 				if ($db_selected){
-					if($result = mysql_query($config_sql)){
-						$row = mysql_fetch_assoc($result);
+					if($result = mysqli_query($cn, $config_sql)){
+						$row = mysqli_fetch_assoc($result);
 						$memory = $row['conf_value'];
 					}
@@ -56,5 +56,5 @@
 		}
 		if (!$has_xoops_db) {
-			mysql_close($cn);
+			mysqli_close($cn);
 		}
 		
Index: /trunk/xpressme_integration_kit/include/oninstall.php
===================================================================
--- /trunk/xpressme_integration_kit/include/oninstall.php	(revision 859)
+++ /trunk/xpressme_integration_kit/include/oninstall.php	(revision 860)
@@ -90,5 +90,5 @@
 
 	$charset_collate = '';
-	if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
+	if ( version_compare($wpdb->get_var('SELECT VERSION()'), '4.1.0', '>=') ) {
 		if ( ! empty($wpdb->charset) )
 			$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php	(revision 859)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_disp.php	(revision 860)
@@ -34,5 +34,5 @@
 		$xoops_db->query( "UPDATE ".get_xoops_prefix() . $dir_name."_forums SET forum_external_link_format='".$external_link_format."' WHERE forum_id= $forum_id" ) ;
 		
-		$d3comment =& new xpressD3commentContent( $dir_name , $xpress_dirname ) ;
+		$d3comment = new xpressD3commentContent( $dir_name , $xpress_dirname ) ;
 
 		$post_title = get_the_title();
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 859)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 860)
@@ -486,5 +486,5 @@
 				$wp_res = 	$xoops_db->query($wp_sql);
 				if ($wp_res === false) die( '...Err. INSERT' . $wp_comments . '(' . $wp_sql . ')');
-				$comment_ID = mysql_insert_id();
+				$comment_ID = $xoops_db->insert_id;
 				$wp_sql  = "UPDATE $wp_posts SET  comment_count = comment_count +1 WHERE ID = $comment_post_ID";
 				$xoops_db->query($wp_sql);
@@ -696,5 +696,5 @@
 			$sql = "INSERT INTO ".$d3f_posts." SET $set4sql,pid=$reply_pid,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip";
 			$xoops_db->query($sql) ;
-			$post_id = mysql_insert_id();
+			$post_id = $xoops_db->insert_id;
 			wp_d3forum_sync_topic( $d3forum_dirname , $topic_id ) ;
 			
@@ -729,9 +729,9 @@
 			$sql = "INSERT INTO ".$d3f_topic." SET forum_id=$forum_id,topic_invisible=$topic_invisible,topic_external_link_id='".addslashes($topic_external_link_id)."'";
 			$xoops_db->query($sql) ;
-			$topic_id = mysql_insert_id();
+			$topic_id = $xoops_db->insert_id;
 			// create post in the topic
 			$sql = "INSERT INTO ".$d3f_posts." SET $set4sql,topic_id=$topic_id,post_time=$post_time,poster_ip=$poster_ip";
 			$xoops_db->query($sql) ;
-			$post_id = mysql_insert_id();
+			$post_id = $xoops_db->insert_id;
 			wp_d3forum_sync_topic( $d3forum_dirname , $topic_id , true , true ) ;
 			
@@ -1054,5 +1054,5 @@
 	}
 
-	$xoops_db->query( "INSERT INTO ".$d3forum_prefix."post_histories SET post_id=$post_id, history_time=UNIX_TIMESTAMP(), data='".mysql_real_escape_string( serialize( $data ) )."'" ) ;
+	$xoops_db->query( $xoops_db->prepare( "INSERT INTO ".$d3forum_prefix."post_histories SET post_id=$post_id, history_time=UNIX_TIMESTAMP(), data=%s", serialize( $data ) ) ) ;
 }
 
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php	(revision 859)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php	(revision 860)
@@ -267,5 +267,5 @@
 				$wu_sql .=		" , '$user_regist_time', $user_status, '$user_display_name')";
 				$xoops_db->query($wu_sql);
-				$wp_user_id = mysql_insert_id();
+				$wp_user_id = $xoops_db->insert_id;
 			} else {	 // WP User ID has not been used yet. 
 				$wu_sql  =	"INSERT INTO $db_xpress_users ";
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 859)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 860)
@@ -367,5 +367,5 @@
 		$sql .=    "('$cat_id', '', '$title','a:0:{}')";
 		$xoops_db->query($sql);
-		$insert_forum_id = mysql_insert_id();
+		$insert_forum_id = $xoops_db->insert_id;
 		$sql  = "INSERT INTO $d3forum_forum_access_tbl ";
 		$sql .=    "(forum_id, groupid, can_post, can_edit, can_delete, post_auto_approved, is_moderator) ";
