function wp_connect_douban() { if (!class_exists('doubanOAuth')) { include dirname(__FILE__) . '/OAuth/douban_OAuth.php'; } $to = new doubanOAuth(DOUBAN_APP_KEY, DOUBAN_APP_SECRET, $_GET['oauth_token'], $_SESSION["oauth_token_secret"]); $tok = $to->getAccessToken(); $to = new doubanOAuth(DOUBAN_APP_KEY, DOUBAN_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']); $douban = $to->OAuthRequest('http://api.douban.com/people/%40me', array(), 'GET'); if ($douban == "no auth") { return wp_noauth(); } $douban = simplexml_load_string($douban); $douban_xmlns = $douban->children('http://www.douban.com/xmlns/'); $douban_id = str_replace("http://api.douban.com/people/", "", $douban->id); $username = $douban_xmlns->uid; $douban_url = "http://www.douban.com/people/" . $username; $email = $douban_id . '@douban.com'; $tid = "dtid"; $uid = ifab(get_user_by_meta_value($tid, $douban_id), email_exists($email)); $userinfo = array($tid, $username, $douban->title, $douban_id, $douban_url, $douban_id, $tok['oauth_token'], $tok['oauth_token_secret']); if ($uid) { wp_connect_login($userinfo, $email, $uid); } else { wp_connect_login($userinfo, $email); } }
$only_id = $username = $result['screen_name']; // return var_dump($result); if ($only_id) { $tid = "ntid"; $id = 'neteaseid'; $email = $result['email']; $old_email = $only_id . '@t.163.com'; $name = $at = $result['name']; $url = 'http://t.163.com/' . $only_id; $head = $result['profile_image_url']; $uid = ifabc(email_exists($email), email_exists($old_email), get_user_by_meta_value($id, $only_id)); } break; case "douban": $to = new doubanOAuth(WEIBO_APP_KEY, WEIBO_SECRET, $last_key['oauth_token'], $last_key['oauth_token_secret']); $douban = $to->OAuthRequest('http://api.douban.com/people/%40me', array(), 'GET'); $douban = simplexml_load_string($douban); $douban_xmlns = $douban->children('http://www.douban.com/xmlns/'); $only_id = str_replace("http://api.douban.com/people/", "", $douban->id); // return var_dump($douban); if ($only_id) { $tid = $id = 'dtid'; $email = $only_id . '@douban.com'; $username = $douban_xmlns->uid; $name = $douban->title; $url = "http://www.douban.com/people/" . $username; $head = $only_id; $uid = ifab(get_user_by_meta_value($id, $only_id), email_exists($email)); } break; case "tianya":