getVar("uname"); $u_pass_md5 = $GLOBALS["xoopsUser"]->getVar("pass"); if ( ! empty($u_name) && ! empty($u_pass_md5) ) { include_once dirname( __FILE__ ).'/user_sync.php'; $messege = ''; $ret = xpress_user_sync($GLOBALS["xoopsUser"]->getVar("uid"),$messege); if ($ret){ $user = new WP_User(0, $u_name); if ( wp_login($u_name, $u_pass_md5) ) { wp_setcookie($u_name, $u_pass_md5, true, '', '', false); do_action('wp_login', $u_name); wp_set_current_user($user->ID); return true; } }else { echo $messege; } } } wp_set_current_user(0); return 0; } function check_xpress_auth_cookie() { // for wp2.5 if ( empty($_COOKIE[AUTH_COOKIE]) ){ return false; } $cookie = $_COOKIE[AUTH_COOKIE]; $cookie_elements = explode('|', $cookie); if ( count($cookie_elements) != 3 ){ return false; } if(is_object($GLOBALS["xoopsModule"])){ // && WP_BLOG_DIRNAME == $GLOBALS["xoopsModule"]->getVar("dirname")){ if(is_object($GLOBALS["xoopsUser"])){ $u_name = $GLOBALS["xoopsUser"]->getVar("uname"); list($username, $expiration, $hmac) = $cookie_elements; if ($u_name == $username) { return true; } } } else { $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; $org_url = $_SERVER['REQUEST_URI']; $needle = '/modules/' . $mydirname . '/wp-admin/'; if (strstr($org_url , $needle)){ return true; } } return false; } // for wordpress2.5 function wp_check_password($password, $hash, $user_id = '') { global $wp_hasher; // If the hash is still md5... if ( strlen($hash) <= 32 ) { if (( $hash == md5($password)) || ($hash == $password)) { // The password taken out of XOOPS is hash value. $check = true; } else { $check = false; } /* A new hash is not used because it differs from the hash on the XOOPS password. * if ( $check && $user_id ) { * // Rehash using new hash. * wp_set_password($password, $user_id); * $hash = wp_hash_password($password); * } */ return apply_filters('check_password', $check, $password, $hash, $user_id); } // If the stored hash is longer than an MD5, presume the // new style phpass portable hash. if ( empty($wp_hasher) ) { require_once( ABSPATH . 'wp-includes/class-phpass.php'); // By default, use the portable hash from phpass $wp_hasher = new PasswordHash(8, TRUE); } $check = $wp_hasher->CheckPassword($password, $hash); return apply_filters('check_password', $check, $password, $hash, $user_id); } // *********************************** End Of Pluggable Function Edit (wp-include/pluggable.php) ************************************ ?>