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 246)
+++ 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 246)
+++ 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 246)
+++ 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 246)
+++ 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) {
