BootstrapSkin::displayInternalFooter(); die; } global $baseurl; $currentUser = User::getCurrent(); $currentUser->detachAccount(); header("Location: {$baseurl}/acc.php?action=logout"); } elseif ($action == "oauthattach") { $database = gGetDb(); $database->transactionally(function () use($database) { try { global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal; $user = User::getCurrent(); // Get a request token for OAuth $util = new OAuthUtility($oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal); $requestToken = $util->getRequestToken(); // save the request token for later $user->setOAuthRequestToken($requestToken->key); $user->setOAuthRequestSecret($requestToken->secret); $user->save(); $redirectUrl = $util->getAuthoriseUrl($requestToken); header("Location: {$redirectUrl}"); } catch (Exception $ex) { throw new TransactionException($ex->getMessage(), "Connection to Wikipedia failed.", "alert-error", 0, $ex); } }); } else { echo defaultpage(); BootstrapSkin::displayInternalFooter(); die; }
/** * Summary of reattachOAuthAccount * @param User $user * @throws TransactionException */ function reattachOAuthAccount(User $user) { global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal; try { // Get a request token for OAuth $util = new OAuthUtility($oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal); $requestToken = $util->getRequestToken(); // save the request token for later $user->setOAuthRequestToken($requestToken->key); $user->setOAuthRequestSecret($requestToken->secret); $user->save(); $redirectUrl = $util->getAuthoriseUrl($requestToken); header("Location: {$redirectUrl}"); die; } catch (Exception $ex) { throw new TransactionException($ex->getMessage(), "Connection to Wikipedia failed.", "alert-error", 0, $ex); } }