Esempio n. 1
0
}
$wt_open = new WTOpen();
$thirdAccount = new ThirdAccount();
$TEMPLATE['platform_list'] = $wt_open->getPlatformList();
$pid = intval($_GET['id']);
if ($pid == 0 && count($TEMPLATE['platform_list']) > 0) {
    $ids = array_keys($TEMPLATE['platform_list']);
    redirect('?id=' . $ids[0]);
}
if ($_GET['action'] == 'unbind' && $_GET['type']) {
    $third = $thirdAccount->getByType($_GET['type'], $pid);
    $api = Factory::CreateAPI2($_GET['type'], $pid, $third);
    if (method_exists($api, 'Logout')) {
        $api->Logout();
    }
    $thirdAccount->delete(array('uid' => Passport::GetLoginUid(), 'type' => $_GET['type'], 'pid' => $pid));
    redirect("?id={$pid}");
}
if ($_POST['action'] == 'bind') {
    $fields = $_POST['f'];
    $fields['pid'] = $pid;
    $fields['uid'] = Passport::GetLoginUid();
    $fields['nick'] = $fields['token'];
    $fields['valid'] = 1;
    if ($fields['token'] && $fields['token_secret']) {
        $api = Factory::CreateAPI2($fields['type'], $pid, $fields);
        $ret = $api->Login($_POST['verify_code']);
        if ($ret === true) {
            $fields['url'] = $api->getUrl();
            $user = new User();
            $users = $user->getsAll();