- Timestamp:
- Nov 9, 2013, 3:43:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php
r843 r845 35 35 if (function_exists('wp_validate_auth_cookie')){ 36 36 if ( $user = wp_validate_auth_cookie() ) { 37 // When the user meta prefix is different according to the change in the xoops data base prefix, it restores it. 37 // When the user meta prefix is different according to the change in the xoops data base prefix, it restores it. 38 38 if (!check_user_meta_prefix($user)){ 39 39 repair_user_meta_prefix(); … … 42 42 return ; 43 43 } 44 } else { // for WP2.0 44 } else { // for WP2.0 45 45 if ( !empty($_COOKIE[USER_COOKIE]) && !empty($_COOKIE[PASS_COOKIE])){ 46 46 if(wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { … … 51 51 } 52 52 } 53 } 54 return xpress_login(); 53 } 54 return xpress_login(); 55 55 } else { // For the xoops guest 56 57 if (function_exists('wp_validate_auth_cookie')){ 58 if ( ! $user = wp_validate_auth_cookie() ) { 59 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { 60 wp_set_current_user(0); 61 return false; 62 } 63 } 64 wp_set_current_user($user); 65 } else { // for WP2.0 66 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 67 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { 68 wp_set_current_user(0); 69 return false; 70 } 71 $user_login = $_COOKIE[USER_COOKIE]; 72 wp_set_current_user(0, $user_login); 73 } 56 wp_set_current_user(0); 74 57 return false; 75 58 } … … 91 74 wp_set_current_user($user); 92 75 } else { // for WP2.0 93 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 76 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 94 77 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { 95 78 wp_set_current_user(0); … … 107 90 global $current_user; 108 91 global $xoopsModule,$xoopsUser,$xoopsUserIsAdmin; 109 92 110 93 if(is_object($xoopsUser)){ 111 94 $u_name = $xoopsUser->getVar("uname"); … … 124 107 return true; 125 108 } 126 } 109 } 127 110 } 128 111 } … … 147 130 return false; 148 131 } 149 132 150 133 if(is_object($GLOBALS["xoopsModule"])){ 151 134 // && WP_BLOG_DIRNAME == $GLOBALS["xoopsModule"]->getVar("dirname")){ … … 162 145 $needle = '/modules/' . $mydirname . '/wp-admin/'; 163 146 if (strstr($org_url , $needle)){ 164 return true; 147 return true; 165 148 } 166 149 } … … 176 159 177 160 // For attestation when password has been sent as hash value. (When having logged it in from Xoops and ImpressCMS) 178 if ($hash == $password){ 161 if ($hash == $password){ 179 162 return apply_filters('check_password', true, $password, $hash, $user_id); 180 163 } 181 182 // Password authentication for Xoops 164 165 // Password authentication for Xoops 183 166 if ( strlen($hash) <= 32 ) { 184 167 $check = ( $hash == md5($password) ); 185 return apply_filters('check_password', $check, $password, $hash, $user_id); 186 } 187 188 // Password authentication for ImpressCMS 168 return apply_filters('check_password', $check, $password, $hash, $user_id); 169 } 170 171 // Password authentication for ImpressCMS 189 172 if($xoops_config->is_impress && function_exists('hash')){ 190 173 $mainSalt = $xoops_config->xoops_db_salt; … … 195 178 $user_salt = $xoops_db->get_var("SELECT salt FROM $xoops_user_db WHERE uname = '$login_name'"); 196 179 $enc_type = intval( $xoops_db->get_var("SELECT enc_type FROM $xoops_user_db WHERE uname = '$login_name'") ); 197 198 // Make Impress hash 180 181 // Make Impress hash 199 182 if($enc_type == 0) {$impress_hash = md5($password);} // no salt used for compatibility with external scripts such as ipb/phpbb etc. 200 183 elseif($enc_type == 1) {$impress_hash = hash('sha256', $user_salt.md5($password).$mainSalt);} … … 218 201 return apply_filters('check_password', true, $password, $hash, $user_id); 219 202 } 220 } 203 } 221 204 222 205 // If the hash is still md5... 223 206 if ( strlen($hash) <= 32 ) { 224 $check = ( $hash == md5($password) ); 225 /* A new hash is not used because it differs from the hash on the XOOPS password. 207 $check = ( $hash == md5($password) ); 208 /* A new hash is not used because it differs from the hash on the XOOPS password. 226 209 * if ( $check && $user_id ) { 227 210 * // Rehash using new hash. … … 250 233 function wp_redirect($location, $status = 302) { 251 234 global $is_IIS,$xoops_config,$action; 252 235 253 236 if ($location == 'wp-login.php?loggedout=true') $location = $xoops_config->xoops_url.'/user.php?op=logout'; //xoops logout at wp logout 254 237 if ($location == 'wp-login.php?action=register') $location = $xoops_config->xoops_url."/register.php"; //wp-register to xoops register … … 272 255 header("Location: $location"); 273 256 } 274 } else { // force redirect 257 } else { // force redirect 275 258 echo ("<HTML>"); 276 259 echo("<META http-equiv=\"Refresh\" content=\"0;url=$location\">");
Note: See TracChangeset
for help on using the changeset viewer.