XPressME Integration Kit

Trac


Ignore:
Timestamp:
Jan 27, 2009, 8:52:57 AM (15 years ago)
Author:
toemon
Message:

ユーザ同期周りのコード整理
(不要分カット、まとめ)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/pluggable-override.php

    r65 r69  
    1919        global $current_user; 
    2020 
    21         if (is_root_index_page_call()){ 
    22                 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 
    23                         return false; 
    2421 
    25                 if ( ! empty($current_user) ) 
    26                         return; 
     22        if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 
     23                return false; 
    2724 
    28                 if (check_xpress_auth_cookie()){ 
     25        if ( ! empty($current_user) ) 
     26                return; 
     27 
     28        if (is_xpress_index_page_call()){ 
     29                if (check_xpress_auth_cookie()){        //The cookie is login user's or it checks it 
    2930                        if ( $user = wp_validate_auth_cookie() ) { 
    3031                                wp_set_current_user($user); 
     
    3334                }                                
    3435                xpress_login();          
    35         }else { 
     36 
     37        } else { 
    3638                // WP2.7 original 
    3739                if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 
     
    6062                                $u_pass_md5 = $GLOBALS["xoopsUser"]->getVar("pass");             
    6163                                if ( ! empty($u_name) && ! empty($u_pass_md5) ) {                
    62 //                                      include_once dirname( __FILE__ ).'/xpress_user.php'; 
    63 //                                      $mess = xpress_user_sync($GLOBALS["xoopsUser"]->getVar("uid")); 
    64 //                                      if ($mess != 'NOT XPRESS USER'){ 
     64                                        include_once dirname( __FILE__ ).'/user_sync.php'; 
     65                                        $messege = ''; 
     66                                        $ret = xpress_user_sync($GLOBALS["xoopsUser"]->getVar("uid"),$messege); 
     67                                        if ($ret){ 
    6568                                                $user = new WP_User(0, $u_name); 
    66                                                 if ( wp_login($u_name, $u_pass_md5, true) ) { 
     69                                                if ( wp_login($u_name, $u_pass_md5) ) { 
    6770                                                        wp_setcookie($u_name, $u_pass_md5, true, '', '', false); 
    6871                                                        do_action('wp_login', $u_name); 
     
    7073                                                        return  true; 
    7174                                                } 
    72 //                                      } 
     75                                        }else { 
     76                                                echo $messege; 
     77                                        } 
    7378                                } 
    7479                        } 
     
    8893        } 
    8994                                         
    90         if(is_object($GLOBALS["xoopsModule"]) && WP_BLOG_DIRNAME == $GLOBALS["xoopsModule"]->getVar("dirname")){ 
     95        if(is_object($GLOBALS["xoopsModule"])){ 
     96//              && WP_BLOG_DIRNAME == $GLOBALS["xoopsModule"]->getVar("dirname")){ 
    9197                if(is_object($GLOBALS["xoopsUser"])){ 
    9298                        $u_name = $GLOBALS["xoopsUser"]->getVar("uname"); 
     
    107113} 
    108114 
    109  
    110 /* 
    111  
    112 function wp_login($username, $password, $already_md5 = false) { 
    113         global $wpdb, $error; 
    114  
    115         $username = sanitize_user($username); 
    116  
    117         if ( '' == $username ) 
    118                 return false; 
    119  
    120         if ( '' == $password ) { 
    121                 $error = __('<strong>ERROR</strong>: The password field is empty.'); 
    122                 return false; 
    123         } 
    124  
    125         $login = get_userdatabylogin($username); 
    126         //$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'"); 
    127  
    128         if (!$login) { 
    129                 $error = __('<strong>ERROR</strong>: Invalid username.'); 
    130                 return false; 
    131         } else { 
    132                 if ($login->user_login == $username) { 
    133                                 if ($login->user_pass == $password) return true; 
    134                                 if ($login->user_pass == md5($password)) return true; 
    135                 } 
    136  
    137                 $error = __('<strong>ERROR</strong>: Incorrect password.'); 
    138                 $pwd = ''; 
    139                 return false; 
    140         } 
    141 } 
    142 */ 
    143115 
    144116// for wordpress2.5 
     
    177149} 
    178150 
    179  
    180 /* 
    181  
    182 function wp_mail($to, $subject, $message, $from_email="", $from_name="") { 
    183     $xoopsMailer =& getMailer(); 
    184     $xoopsMailer->useMail(); 
    185     $xoopsMailer->setToEmails($to); 
    186     $xoopsMailer->setFromEmail( empty($from_email) ? $GLOBALS["xoopsConfig"]['adminmail'] : $from_email); 
    187     $xoopsMailer->setFromName( empty($from_name) ? $GLOBALS["xoopsConfig"]['sitename'] : $from_name ); 
    188     $xoopsMailer->setSubject($subject); 
    189     $xoopsMailer->setBody($message); 
    190     return $xoopsMailer->send(); 
    191 } 
    192  
    193 */ 
    194 /* 
    195 function auth_redirect($force = false, $message = "") { 
    196         if(!is_object($GLOBALS["xoopsUser"])){ 
    197                 header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); 
    198                 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 
    199                 header('Cache-Control: no-cache, must-revalidate, max-age=0'); 
    200                 header('Pragma: no-cache'); 
    201          
    202                 header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); 
    203                 exit(); 
    204         }elseif(!empty($force)){ 
    205                 $redirect = xoops_getenv("HTTP_REFERER"); 
    206                 $redirect = (strpos($redirect, XOOPS_URL) === 0)? $redirect: XOOPS_URL."/".$redirect; 
    207                 redirect_header($redirect, 2, $message); 
    208         } 
    209 } 
    210 */ 
    211151// ***********************************  End Of Pluggable Function Edit (wp-include/pluggable.php) ************************************ 
    212152 
Note: See TracChangeset for help on using the changeset viewer.