コード例 #1
0
ファイル: UserCenter.php プロジェクト: huangbinzd/kppwGit
 public static function oauthRoute($type)
 {
     global $kekezu, $weibo_list;
     require S_ROOT . "include/oauth/config.php";
     if ($type === 'sina') {
         require S_ROOT . "include/oauth/sina/saetv2.ex.class.php";
         $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
         $code_url = $o->getAuthorizeURL(WB_CALLBACK_URL);
     }
     if ($type === 'qq') {
         require S_ROOT . "include/oauth/qq/qqConnectAPI.php";
         $qqConnectAPI = new QC();
         $qqConnectAPI->qq_login();
         die;
     }
     if ($type === 'ten') {
         require S_ROOT . "include/oauth/ten/Tencent.php";
         OAuth::init(TEN_AKEY, TEN_SKEY);
         Tencent::$debug = false;
         $code_url = OAuth::getAuthorizeURL(TEN_CALLBACK_URL);
     }
     if ($type === 'renren') {
         require S_ROOT . "include/oauth/renren/rennclient/RennClient.php";
         $rennClient = new RennClient(APP_KEY, APP_SECRET);
         $state = uniqid('renren_', true);
         $_SESSION['renren_state'] = $state;
         $code_url = $rennClient->getAuthorizeURL(CALLBACK_URL, 'code', $state);
     }
     if ($type === 'douban') {
         require S_ROOT . 'include/oauth/douban/douban.php';
         $douBan = new doubanPHP(DB_APIKEY, DB_SECRET);
         $code_url = $douBan->login_url(DB_CALLBACK_URL, DB_SCOPE);
     }
     header("location:" . $code_url);
 }
コード例 #2
0
ファイル: p_sync.php プロジェクト: lyhiving/mini_class
             $me_photo = $me['avatar'];
             if ($r_dby['s_n'] != $me_url || $r_dby['s_id'] != $me['id']) {
                 $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($me_url, 'text'), SQLString($me['id'], 'text'), $r_dby['id']);
                 $result = mysql_query($u_db) or die('');
             }
             $content .= '当前已绑定豆瓣账号<table width="200"><tr><td align="center"><img src="' . $me_photo . '" alt=""/><br/><a href="' . $me_url . '" target="_blank">' . $me_title . '</a>(<a href="?m=profile&amp;t=sync&amp;n=' . $nct . '&amp;lt=1">取消绑定</a>)</td></tr></table>';
             $content .= '<br/><br/><form method="post" action=""><input type="checkbox" name="is_show" value="1"' . ($r_dby['is_show'] > 0 ? ' checked="checked"' : '') . '/>隐藏已绑定豆瓣账号相关信息<br/><input type="submit" value="更新" class="button"/><input type="hidden" name="isl_douban_h" value="' . $r_dby['id'] . '"/></form>';
         } else {
             $d_db = sprintf('delete from %s where aid=%s and name=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
             $result = mysql_query($d_db) or die('');
         }
     }
     mysql_free_result($q_dby);
     if ($is_sync == 0) {
         $db_o = new doubanPHP($config['douban_key'], $config['douban_se']);
         $aurl = $db_o->login_url($config['site_url'] . 'douban_callback.php', 'douban_basic_common');
         $content .= '<a href="' . $aurl . '">点击此处和您的豆瓣账号建立连接</a>';
     }
     $content .= '<br/><br/>绑定豆瓣账号后将实现以下功能:<ol><li>在<a href="?m=user&amp;id=' . $r_dbu['id'] . '">用户信息</a>页面显示豆瓣收藏秀</li><li>使用豆瓣账号登录</li><li>注:豆瓣账号不可以重复绑定,用户绑定后,其他用户绑定的同一豆瓣账号将自动解除绑定</li></ol>';
     break;
 case 'baidu':
     if (isset($_GET['lt']) && $_GET['lt'] == 1) {
         $d_db = sprintf('delete from %s where aid=%s and name=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
         $result = mysql_query($d_db) or die('');
         header('Location:./?m=profile&t=sync&n=' . $nct);
         exit;
     }
     require_once 'lib/baidu.php';
     $is_sync = 0;
     $s_dby = sprintf('select id, s_id, s_t, s_r, edate, is_show from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
     $q_dby = mysql_query($s_dby) or die('');