Index: trunk/xpressme_integration_kit/class/config_from_xoops.class.php
===================================================================
--- trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 249)
+++ trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 252)
@@ -38,5 +38,6 @@
 	var $mu_domain_current_site;
 	var $mu_path_current_site;
-	
+	var $wp_db_version;
+	var $is_wp20;
 	
 	function __constructor()	//for PHP5
@@ -163,5 +164,5 @@
 		
 		$this->set_module_version();
-		$this->set_is_wpmu();
+		$this->set_wp_version();
 		$this->set_mu_current_site();
     }
@@ -194,5 +195,5 @@
     }
     
-    function set_is_wpmu(){
+    function set_wp_version(){
     	include dirname(dirname(__FILE__)) . '/wp-includes/version.php';
     	
@@ -201,4 +202,11 @@
     	else
     		$this->is_wpmu  = true;
+    	
+    	$this->wp_db_version = $wp_db_version;
+    	if ($wp_db_version == 3441)
+			$this->is_wp20 = true;
+		else
+			$this->is_wp20 = false;
+		
     }
     
Index: trunk/xpressme_integration_kit/include/old_template-loader.php
===================================================================
--- trunk/xpressme_integration_kit/include/old_template-loader.php	(revision 252)
+++ trunk/xpressme_integration_kit/include/old_template-loader.php	(revision 252)
@@ -0,0 +1,67 @@
+<?php
+if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
+	do_action('template_redirect');
+	if ( is_feed() ) {
+		include(ABSPATH . '/wp-feed.php');
+		return;
+	} else if ( is_trackback() ) {
+		include(ABSPATH . '/wp-trackback.php');
+		return;
+	} else if ( is_404() && $template = get_404_template() ) {
+		include($template);
+		return;
+	} else if ( is_search() && $template = get_search_template() ) {
+		include($template);
+		return;
+	} else if ( is_home() && $template = get_home_template() ) {
+		include($template);
+		return;
+	} else if ( is_attachment() && $template = get_attachment_template() ) {
+		include($template);
+		return;
+	} else if ( is_single() && $template = get_single_template() ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include($template);
+		return;
+	} else if ( is_page() && $template = get_page_template() ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include($template);
+		return;
+	} else if ( is_category() && $template = get_category_template()) {
+		include($template);
+		return;		
+	} else if ( is_author() && $template = get_author_template() ) {
+		include($template);
+		return;
+	} else if ( is_date() && $template = get_date_template() ) {
+		include($template);
+		return;
+	} else if ( is_archive() && $template = get_archive_template() ) {
+		include($template);
+		return;
+	} else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
+		include($template);
+		return;
+	} else if ( is_paged() && $template = get_paged_template() ) {
+		include($template);
+		return;
+	} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include(TEMPLATEPATH . "/index.php");
+		return;
+	}
+} else {
+	// Process feeds and trackbacks even if not using themes.
+	if ( is_feed() ) {
+		include(ABSPATH . '/wp-feed.php');
+		return;
+	} else if ( is_trackback() ) {
+		include(ABSPATH . '/wp-trackback.php');
+		return;
+	}
+}
+
+?>
Index: trunk/xpressme_integration_kit/include/oninstall.php
===================================================================
--- trunk/xpressme_integration_kit/include/oninstall.php	(revision 249)
+++ trunk/xpressme_integration_kit/include/oninstall.php	(revision 252)
@@ -126,4 +126,7 @@
 	$pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):'';
 	
+	if (!function_exists('username_exists')){
+		require_once($mydirpath . '/wp-includes/registration-functions.php');
+	}
 	$user_id = username_exists($user_name);
 	if ( !$user_id ) {
@@ -150,5 +153,10 @@
 	if (!$xoops_config->is_wpmu){	// for WordPress 
 		// make WordPress Default data	
-		wp_install_defaults($user_id);
+		if (function_exists('wp_install_defaults')){
+			wp_install_defaults($user_id);
+		} else {
+			wp_install_old_defaults($user_id);
+		}
+		
 		$ret[] = 'The first sample post & comment was written.';
 		
@@ -210,3 +218,36 @@
 endif;
 
+if( ! function_exists( 'wp_install_old_defaults' ) ) :
+function wp_install_old_defaults($user_id) {
+	global $wpdb;
+
+	// Now drop in some default links
+	$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');");
+
+	// Default category
+	$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')");
+
+	// First post
+	$now = date('Y-m-d H:i:s');
+	$now_gmt = gmdate('Y-m-d H:i:s');
+	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");
+
+	$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
+
+	// Default comment
+	$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
+
+	// First Page
+
+	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')");
+}
+endif;
+
 ?>
Index: trunk/xpressme_integration_kit/include/onupdate.php
===================================================================
--- trunk/xpressme_integration_kit/include/onupdate.php	(revision 249)
+++ trunk/xpressme_integration_kit/include/onupdate.php	(revision 252)
@@ -27,4 +27,5 @@
 //XPressME Update
 	global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles,$wp_query;
+	global $xoops_db;
 	define('WP_INSTALLING', true);
 	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
@@ -48,6 +49,6 @@
 	
 	$site_url= XOOPS_URL."/modules/".$mydirname;		
-	update_option("home", $site_url);				// Site_url is set again. 
-	update_option("siteurl", $site_url);
+	xpress_put_siteurl($mydirname,$site_url);				// Site_url is set again. 
+	update_option("home", $site_url);
 
 	require_once($mydirpath . '/wp-admin/upgrade-functions.php');
Index: trunk/xpressme_integration_kit/wp-config.php
===================================================================
--- trunk/xpressme_integration_kit/wp-config.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-config.php	(revision 252)
@@ -111,17 +111,19 @@
 	}
 
+	ob_start();	
+		if($xoops_config->is_wp20 )
+			require_once dirname( __FILE__ ).'/include/old_template-loader.php' ;
+		else
+			require_once( ABSPATH . WPINC . '/template-loader.php' );
+		$wp_output = ob_get_contents();
+	ob_end_clean();
 	// It judges it here because it does in is_index_page() through feed to which the permalink is set. 
 	if (is_wordpress_style() || is_feed()) {
-		require_once( ABSPATH . WPINC . '/template-loader.php' );
+		echo $wp_output;
 	} else {
-		ob_start();	
-			require_once( ABSPATH . WPINC . '/template-loader.php' );
-			$wp_output = ob_get_contents();
-		ob_end_clean();
 		require_once( ABSPATH .'/include/xpress_render.php' );
 		xpress_render($wp_output);
 	}
-		
-	
+
 	//When there is no block cache, and an optional block is different, cache is refreshed. 
 	//When adding, and changing and deleting Post & Comment, block cache is refreshed by add_action at any time. 
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 252)
@@ -399,5 +399,7 @@
 	$blog_encoding = get_option('blog_charset');
 	$text = get_the_content('');
-	$text = strip_shortcodes( $text );
+	if (function_exists('strip_shortcodes')){ //@since WP2.5
+		$text = strip_shortcodes( $text );
+	}
 	$text = apply_filters('the_content', $text);
 	$text = str_replace(']]>', ']]&gt;', $text);
@@ -454,5 +456,11 @@
 function xpress_post_new_link($link_title = 'Post New',$display = true)
 {
-	$output = '<a href="'. get_xpress_url() . '/wp-admin/post-new.php' . '">' . $link_title . '</a>';
+	global $xoops_config;
+	
+	if ($xoops_config->wp_db_version  > 5000){
+		$output = '<a href="'. get_xpress_url() . '/wp-admin/post-new.php' . '">' . $link_title . '</a>';
+	} else {
+		$output = '<a href="'. get_xpress_url() . '/wp-admin/post.php' . '">' . $link_title . '</a>';
+	}	
 	if ($display) 
 		echo $output;
@@ -469,6 +477,8 @@
 	if (is_category())
 		$output = sprintf(__('Archive for the &#8216;%s&#8217; Category', 'xpressme'), single_cat_title('', false));
-	if (is_tag())
-		$output = sprintf(__('Posts Tagged &#8216;%s&#8217;', 'xpressme'), single_tag_title('', false) );
+	if (function_exists( 'is_tag' )){
+		if (is_tag())
+			$output = sprintf(__('Posts Tagged &#8216;%s&#8217;', 'xpressme'), single_tag_title('', false) );
+	}
 	if (is_day())
 		$output = sprintf(__('Archive for %s|Daily archive page', 'xpressme'), get_the_time(__('F jS, Y', 'xpressme')));
@@ -587,7 +597,17 @@
 
 function xpress_get_calendar($sun_color = '#DB0000' ,$sat_color = '#004D99' ,$initial = true) {
-	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
-
-
+	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts , $xoops_config;
+
+	if ($xoops_config->is_wp20){
+		ob_start();
+			get_calendar(true);
+			$output = ob_get_contents();
+		ob_end_clean();
+		$output = preg_replace('/<th abbr=/', '<th align="center"  abbr=', $output); //week name align center
+		$output = preg_replace('/<td>/', '<td align="center">', $output); //days align center
+		$output = preg_replace('/<td id="today">/', '<td id="today" align="center">', $output); //today align center
+
+		return $output;
+	}
 
 	ob_start();
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp20.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp20.php	(revision 252)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp20.php	(revision 252)
@@ -0,0 +1,256 @@
+<?php
+// wp_login override for wp2.0
+function wp_login($username, $password, $already_md5 = false) {
+	global $wpdb, $error;
+
+
+	if(is_object($GLOBALS["xoopsModule"]) && WP_BLOG_DIRNAME == $GLOBALS["xoopsModule"]->getVar("dirname")){
+		if(!is_object($GLOBALS["xoopsUser"])){
+			wp_clearcookie();
+			return false;
+		}
+	}			
+
+	$username = sanitize_user($username);
+
+	if ( '' == $username )
+		return false;
+
+	if ( '' == $password ) {
+		$error = __('<strong>ERROR</strong>: The password field is empty.');
+		return false;
+	}
+
+	$login = get_userdatabylogin($username);
+	//$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
+
+	if (!$login) {
+		$error = __('<strong>ERROR</strong>: Invalid username.');
+		return false;
+	} else {
+		if ($login->user_login == $username) {
+				if ($login->user_pass == $password) return true;
+				if ($login->user_pass == md5($password)) return true;
+		}
+
+		$error = __('<strong>ERROR</strong>: Incorrect password.');
+		$pwd = '';
+		return false;
+	}
+}
+if ( !function_exists('wp_sanitize_redirect') ) :
+/**
+ * Sanitizes a URL for use in a redirect.
+ *
+ * @since 2.3
+ *
+ * @return string redirect-sanitized URL
+ **/
+function wp_sanitize_redirect($location) {
+	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
+	$location = wp_kses_no_null($location);
+
+	// remove %0d and %0a from location
+	$strip = array('%0d', '%0a');
+	$found = true;
+	while($found) {
+		$found = false;
+		foreach( (array) $strip as $val ) {
+			while(strpos($location, $val) !== false) {
+				$found = true;
+				$location = str_replace($val, '', $location);
+			}
+		}
+	}
+	return $location;
+}
+endif;
+
+
+// Added WP2.7 separate_comments()
+function &separate_comments(&$comments) {
+	$comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array());
+	$count = count($comments);
+	for ( $i = 0; $i < $count; $i++ ) {
+		$type = $comments[$i]->comment_type;
+		if ( empty($type) )
+			$type = 'comment';
+		$comments_by_type[$type][] = &$comments[$i];
+		if ( 'trackback' == $type || 'pingback' == $type )
+			$comments_by_type['pings'][] = &$comments[$i];
+	}
+
+	return $comments_by_type;
+}
+
+// Added WP2.7 get_comments()
+function get_comments( $args = '' ) {
+	global $wpdb;
+
+	$defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	// $args can be whatever, only use the args defined in defaults to compute the key
+	$key = md5( serialize( compact(array_keys($defaults)) )  );
+	$last_changed = wp_cache_get('last_changed', 'comment');
+	if ( !$last_changed ) {
+		$last_changed = time();
+		wp_cache_set('last_changed', $last_changed, 'comment');
+	}
+	$cache_key = "get_comments:$key:$last_changed";
+
+	if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
+		return $cache;
+	}
+
+	$post_id = absint($post_id);
+
+	if ( 'hold' == $status )
+		$approved = "comment_approved = '0'";
+	elseif ( 'approve' == $status )
+		$approved = "comment_approved = '1'";
+	elseif ( 'spam' == $status )
+		$approved = "comment_approved = 'spam'";
+	else
+		$approved = "( comment_approved = '0' OR comment_approved = '1' )";
+
+	$order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
+
+	$orderby = 'comment_date_gmt';  // Hard code for now
+
+	$number = absint($number);
+	$offset = absint($offset);
+
+	if ( !empty($number) ) {
+		if ( $offset )
+			$number = 'LIMIT ' . $offset . ',' . $number;
+		else
+			$number = 'LIMIT ' . $number;
+
+	} else {
+		$number = '';
+	}
+
+	if ( ! empty($post_id) )
+		$post_where = "comment_post_ID = $post_id AND" ;
+	else
+		$post_where = '';
+
+	$comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
+	wp_cache_add( $cache_key, $comments, 'comment' );
+
+	return $comments;
+}
+
+// Added WP2.2 wp_parse_args()
+function wp_parse_args( $args, $defaults = '' ) {
+	if ( is_object( $args ) )
+		$r = get_object_vars( $args );
+	elseif ( is_array( $args ) )
+		$r =& $args;
+	else
+		wp_parse_str( $args, $r );
+
+	if ( is_array( $defaults ) )
+		return array_merge( $defaults, $r );
+	return $r;
+}
+
+// Added WP2.2.1 wp_parse_str()
+function wp_parse_str( $string, &$array ) {
+	parse_str( $string, $array );
+	if ( get_magic_quotes_gpc() )
+		$array = stripslashes_deep( $array );
+	$array = apply_filters( 'wp_parse_str', $array );
+}
+// Added WP2.5 absint()
+function absint( $maybeint ) {
+	return abs( intval( $maybeint ) );
+}
+
+// Added WP2.7 absint()
+function locate_template($template_names, $load = false) {
+	if (!is_array($template_names))
+		return '';
+
+	$located = '';
+	foreach($template_names as $template_name) {
+		if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
+			$located = STYLESHEETPATH . '/' . $template_name;
+			break;
+		} else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
+			$located = TEMPLATEPATH . '/' . $template_name;
+			break;
+		}
+	}
+
+	if ($load && '' != $located)
+		load_template($located);
+
+	return $located;
+}
+
+// Added WP2.5 translate_with_context()
+function translate_with_context( $text, $domain = 'default' ) {
+	return before_last_bar(translate( $text, $domain ) );
+
+}
+
+// Added WP2.2 translate()
+function translate($text, $domain = 'default') {
+	global $l10n;
+
+	if (isset($l10n[$domain]))
+		return apply_filters('gettext', $l10n[$domain]->translate($text), $text, $domain);
+	else
+		return apply_filters('gettext', $text, $text, $domain);
+}
+
+// Added WP2.2 translate_with_context()
+function before_last_bar( $string ) {
+	$last_bar = strrpos( $string, '|' );
+	if ( false == $last_bar )
+		return $string;
+	else
+		return substr( $string, 0, $last_bar );
+}
+
+// Added WP2.7 post_password_required()
+function post_password_required( $post = null ) {
+	$post = get_post($post);
+
+	if ( empty($post->post_password) )
+		return false;
+
+	if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )
+		return true;
+
+	if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
+		return true;
+
+	return false;
+}
+// Added WP2.7 comment_form_title()
+function comment_form_title( $noreplytext = 'Leave a Reply', $replytext = 'Leave a Reply to %s', $linktoparent = TRUE ) {
+	global $comment;
+
+	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
+
+	if ( 0 == $replytoid )
+		echo $noreplytext;
+	else {
+		$comment = get_comment($replytoid);
+		$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author() . '</a>' : get_comment_author();
+		printf( $replytext, $author );
+	}
+}
+
+/**
+ * @ignore
+ */
+function _c() {}
+
+
+?>
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 252)
@@ -51,5 +51,5 @@
 
 	} else {
-		// WP2.7 original
+		// WP original
 		if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST )
 			return false;
@@ -58,12 +58,21 @@
 			return;
 
-		if ( ! $user = wp_validate_auth_cookie() ) {
-			 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
-			 	wp_set_current_user(0);
-			 	return false;
-			 }
-		}
-
-		wp_set_current_user($user);
+		if (function_exists('wp_validate_auth_cookie')){
+			if ( ! $user = wp_validate_auth_cookie() ) {
+				 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
+				 	wp_set_current_user(0);
+				 	return false;
+				 }
+			}
+			wp_set_current_user($user);
+		} else { // for WP2.0
+			if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 
+				!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
+				wp_set_current_user(0);
+				return false;
+			}
+			$user_login = $_COOKIE[USER_COOKIE];
+			wp_set_current_user(0, $user_login);
+		}
 	}
 }
@@ -77,5 +86,5 @@
 	if(is_object($xoopsUser)){
 		$u_name = $xoopsUser->getVar("uname");
-		$u_pass_md5 = $xoopsUser->getVar("pass");	
+		$u_pass_md5 = $xoopsUser->getVar("pass");
 		if ( ! empty($u_name) && ! empty($u_pass_md5) ) {
 			include_once dirname( __FILE__ ).'/user_sync_xoops.php';
@@ -96,5 +105,5 @@
 	wp_set_current_user(0);
 	wp_clearcookie();
-	return 0;	
+	return 0;
 }
 endif;
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php	(revision 252)
@@ -20,4 +20,6 @@
 
 require_once dirname( __FILE__ ).'/include/pluggable-override.php' ;
+if ($xoops_config->is_wp20)
+	require_once dirname( __FILE__ ).'/include/functions_for_wp20.php' ;
 
 add_action('admin_menu', array(&$xpress_config, 'add_option_page'));
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme_class.php	(revision 252)
@@ -410,5 +410,5 @@
 
 	}
-	
+
 	function groupe_role_option(){
 		global $wp_roles , $xoops_db;
@@ -427,6 +427,6 @@
 		
 			$select_value = $groupe->role;
-		
-			
+
+
 				
 			foreach($wp_roles->role_names as $role => $name) {
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/category_block_theme.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/category_block_theme.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/category_block_theme.php	(revision 252)
@@ -17,25 +17,50 @@
 	$depth  = !is_numeric( $options[12] ) ? 0 : $options[12] ;
 	
-	$param = array(
-		'show_option_all' => $show_option_all, 
-		'orderby' => $orderby, 
-		'order' => $order, 
-		'show_last_update' => $show_last_updated, 
-		'style' => 'list',
-		'show_count' => $show_count, 
-		'hide_empty' => $hide_empty, 
-		'use_desc_for_title' => $use_desc_for_title, 
-		'child_of' => 0, 
-		'feed' => '', 
-		'feed_image' => '', 
-		'exclude' => $exclude, 
-		'include' => $includes, 
-		'hierarchical' => $hierarchical, 
-		'title_li' => '',
-		'number' => '',
-		'echo' => 0,
-		'depth' => $depth
-	);
-	$block['categories'] = wp_list_categories($param);
+	if (function_exists('wp_list_categories')){
+		$param = array(
+			'show_option_all' => $show_option_all, 
+			'orderby' => $orderby, 
+			'order' => $order, 
+			'show_last_update' => $show_last_updated, 
+			'style' => 'list',
+			'show_count' => $show_count, 
+			'hide_empty' => $hide_empty, 
+			'use_desc_for_title' => $use_desc_for_title, 
+			'child_of' => 0, 
+			'feed' => '', 
+			'feed_image' => '', 
+			'exclude' => $exclude, 
+			'include' => $includes, 
+			'hierarchical' => $hierarchical, 
+			'title_li' => '',
+			'number' => '',
+			'echo' => 0,
+			'depth' => $depth
+		);
+		$block['categories'] = wp_list_categories($param);
+	} else {
+		if (empty($show_option_all))
+			$optionall = 0;
+		else
+			$optionall = 1;
+		$param = array(
+			'optionall' => $optionall, 
+			'all' => $show_option_all,
+			'sort_column' => $orderby, 
+			'sort_order' => $order, 
+			'show_last_update' => $show_last_updated, 
+			'optioncount' => $show_count, 
+			'hide_empty' => $hide_empty, 
+			'use_desc_for_title' => $use_desc_for_title, 
+			'child_of' => 0, 
+			'feed' => '', 
+			'feed_image' => '', 
+			'exclude' => $exclude, 
+			'hierarchical' => $hierarchical, 
+			'recurse' => 1,
+		);
+		$block['categories'] = wp_list_cats($param);
+		
+	}
 	return $block ;	
 }
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/tag_cloud_block_theme.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/tag_cloud_block_theme.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/tag_cloud_block_theme.php	(revision 252)
@@ -25,9 +25,12 @@
 		'include' => $wp_include
 	);
-	ob_start();
-		wp_tag_cloud($param);
-		$output = ob_get_contents();
-	ob_end_clean();	
-
+	if (function_exists('wp_tag_cloud')) {
+		ob_start();
+			wp_tag_cloud($param);
+			$output = ob_get_contents();
+		ob_end_clean();	
+	} else {
+		$output = 'not function wp_tag_cloud()';
+	}
 	$block['tag_cloud'] = $output;								
 	return $block ;	
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/widget_block_theme.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/widget_block_theme.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/widget_block_theme.php	(revision 252)
@@ -38,5 +38,8 @@
 		}
 	}
-
+	if (!function_exists('wp_get_sidebars_widgets')) {
+		echo 'Not support sidebar widget';
+		return;
+	}
 	$sidebars_widgets = wp_get_sidebars_widgets();
 	$registered_sidebars = $wp_registered_sidebars[$index];
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/comments.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/comments.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/comments.php	(revision 252)
@@ -8,20 +8,48 @@
 		return;
 	}
+	
+	if (function_exists('have_comments'))
+		$have_comments= have_comments();
+	else
+		$have_comments= $comments;
+
 ?>
 
 <!-- You can start editing here. -->
-
-<?php if ( have_comments() ) : ?>
+<?php if ( $have_comments ) : ?>
 	<?php if ( ! empty($comments_by_type['comment']) ) : ?>
 		<h3 id="xpress_comments"><?php comments_number(__('No Responses', 'xpress'), __('One Response', 'xpress'), __('% Responses', 'xpress'));?> <?php printf(__('to &#8220;%s&#8221;', 'xpress'), the_title('', '', false)); ?></h3>
 		<div id="xpress_commentlist">
-			<?php wp_list_comments('type=comment&style=div'); ?>
+			<?php if (function_exists('wp_list_comments')) : ?>
+				<?php wp_list_comments('type=comment&style=div'); ?>
+			 		<ol class="commentlist">
+ 			<?php else : ?>
+				<?php foreach ($comments as $comment) : ?>
+					<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
+						<?php if (function_exists('get_avatar')) echo get_avatar( $comment, 32 ); ?>	
+						<?php printf(__('<cite>%s</cite> Says:', 'xpressme'), get_comment_author_link()); ?>
+						<?php if ($comment->comment_approved == '0') : ?>
+						<em><?php _e('Your comment is awaiting moderation.', 'xpressme'); ?></em>
+						<?php endif; ?>
+						<br />
+						<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php printf(__('%1$s at %2$s', 'xpressme'), get_comment_date(__('F jS, Y', 'xpressme')), get_comment_time()); ?></a> <?php edit_comment_link(__('Comment Edit', 'xpressme'),'&nbsp;&nbsp;',''); ?></small>
+						<?php comment_text() ?>
+					</li>
+				<?php
+					/* Changes every other comment to a different class */
+					$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
+				?>
+				<?php endforeach; /* end for each comment */ ?>
+				</ol>
+			<?php endif; ?>
 		</div>
 	<?php endif; ?>
-	
-	<div class="navigation">
-		<div class="alignleft"><?php previous_comments_link() ?></div>
-		<div class="alignright"><?php next_comments_link() ?></div>
-	</div>
+	<?php if (function_exists('wp_list_comments')) : ?>
+		<div class="navigation">
+			<div class="alignleft"><?php previous_comments_link() ?></div>
+			<div class="alignright"><?php next_comments_link() ?></div>
+		</div>
+	<?php endif; ?>
+				
 <?php else : // this is displayed if there are no comments so far ?>
 
@@ -39,7 +67,9 @@
 	</div>
 			
-	<div id="cancel-comment-reply"> 
-		<small><?php cancel_comment_reply_link() ?></small>
-	</div> 
+	<?php if ( function_exists('cancel_comment_reply_link') ): ?>
+		<div id="cancel-comment-reply"> 
+			<small><?php cancel_comment_reply_link() ?></small>
+		</div> 
+	<?php endif; ?>
 	
 	<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
@@ -49,5 +79,9 @@
 			<div id="xpress-comment-user">
 				<?php if ( $user_ID ) : ?>
-					<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'xpress'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account', 'xpress'); ?>"><?php _e('Log out &raquo;', 'xpress'); ?></a></p>
+					<?php if ( function_exists('wp_logout_url') ): ?>
+						<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'xpress'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account', 'xpress'); ?>"><?php _e('Log out &raquo;', 'xpress'); ?></a></p>
+					<?php else : ?>
+						<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'xpress'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account', 'xpress'); ?>"><?php _e('Log out &raquo;', 'xpress'); ?></a></p>
+					<?php endif; ?>
 				<?php else : ?>
 					<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
@@ -69,5 +103,9 @@
 					<input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit Comment', 'xpress'); ?>" />
 				</div>
-				<?php comment_id_fields(); ?> 	
+				<?php if (function_exists('comment_id_fields')) : ?>
+					<?php comment_id_fields(); //@since 2.7.0 ?>  
+				<?php else : ?>
+					<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
+				<?php endif; ?>
 				<?php do_action('comment_form', $post->ID); ?>
 			</div>
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/index.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/index.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/index.php	(revision 252)
@@ -26,5 +26,9 @@
 						<?php if (function_exists('hotDates')) { hotDates(); }?>
 						<div class ="xpress-post-title">
-							<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
+							<?php if(function_exists('the_title_attribute')) : ?>			
+								<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
+							<?php else : ?>
+								<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title('','',false)); ?>"><?php the_title(); ?></a></h2>
+							<?php endif; ?>
 						</div>
 					</div>
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/searchform.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/searchform.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/searchform.php	(revision 252)
@@ -1,5 +1,9 @@
 <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
 <label class="hidden" for="s"><?php _e('Search for:', 'xpress'); ?></label>
-<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
+<?php if(function_exists('the_search_query')) : ?>			
+	<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
+<?php else : ?>
+	<div><input type="text" value="<?php echo attribute_escape($s); ?>" name="s" id="s" />
+<?php endif; ?>
 <input type="submit" id="searchsubmit" value="<?php _e('Search', 'xpress'); ?>" />
 </div>
Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/single.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/single.php	(revision 249)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/single.php	(revision 252)
@@ -21,5 +21,9 @@
 						<?php if (function_exists('hotDates')) { hotDates(); }?>
 						<div class ="xpress-post-title">
-							<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
+							<?php if(function_exists('the_title_attribute')) : ?>			
+								<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
+							<?php else : ?>
+								<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'xpress'), the_title('','',false)); ?>"><?php the_title(); ?></a></h2>
+							<?php endif; ?>
 						</div>
 					</div>
@@ -61,5 +65,5 @@
 							
 					<div id ="xpress-comments-block">
-						<?php comments_template('', true); ?>
+						<?php comments_template(); ?>
 					</div>
 				</div>
Index: trunk/xpressme_integration_kit/xoops_version.php
===================================================================
--- trunk/xpressme_integration_kit/xoops_version.php	(revision 249)
+++ trunk/xpressme_integration_kit/xoops_version.php	(revision 252)
@@ -31,5 +31,5 @@
 $modversion['name'] = ucfirst($mydirname) . ' ' . constant('_MI_XP2_NAME') ;
 $modversion['description'] = constant( '_MI_XP2_DESC');
-$modversion['version'] = "2.00";
+$modversion['version'] = "2.10";
 $modversion['credits'] = "Wordpress DEV (http://wordpress.org/) XPressME DEV Toemon) (http://ja.xpressme.info) ;";
 $modversion['author'] = "toemon (http://ja.xpressme.info)";
@@ -40,5 +40,5 @@
 
 // status
-$modversion['codename'] = "";
+$modversion['codename'] = "Bata-1";
 
 // onInstall, onUpdate, onUninstall
@@ -81,5 +81,8 @@
 	if (@$current_user->user_level > 0) {
 	$modversion['sub'][1]['name'] = constant( '_MI_XP2_MENU_POST_NEW');
-	$modversion['sub'][1]['url'] = "wp-admin/post-new.php";
+	if ($wp_db_version > 5000)
+		$modversion['sub'][1]['url'] = "wp-admin/post-new.php";
+	else
+		$modversion['sub'][1]['url'] = "wp-admin/post.php";
 	$modversion['sub'][2]['name'] = constant( '_MI_XP2_MENU_EDIT');
 	$modversion['sub'][2]['url'] = "wp-admin/edit.php";
