# HG changeset patch # User Raphael Velt # Date 1366022884 -7200 # Node ID 9c645bec23c47fb83845738ad17c4ff2968e6b49 # Parent 0d6069c5fb10d75e9ee92095691c6cba61c84f98 Bugfix for oauth redirects diff -r 0d6069c5fb10 -r 9c645bec23c4 web/hanna-arendt/client.php --- a/web/hanna-arendt/client.php Mon Apr 15 12:24:37 2013 +0200 +++ b/web/hanna-arendt/client.php Mon Apr 15 12:48:04 2013 +0200 @@ -1,6 +1,26 @@ basename(__DIR__)); + +include_once '../common.php'; + +if (isset($_SESSION['TWITTER_ACCESS_TOKEN']) ) { + // Permanent redirection + header("HTTP/1.1 301 Moved Permanently"); + header("Location: index.php"); + exit(); +} else { + /** + * Guess we need to go get one! + */ + $token = $consumer->getRequestToken(); + $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token); + + /** + * Now redirect user to Twitter site so they can log in and + * approve our access + */ + $consumer->redirect(); +} + ?> \ No newline at end of file diff -r 0d6069c5fb10 -r 9c645bec23c4 web/hanna-arendt/index.php --- a/web/hanna-arendt/index.php Mon Apr 15 12:24:37 2013 +0200 +++ b/web/hanna-arendt/index.php Mon Apr 15 12:48:04 2013 +0200 @@ -9,18 +9,13 @@ */ if (!isset($_SESSION['TWITTER_ACCESS_TOKEN']) ) { + $_SESSION['TWITTER_REDIRECT_URL'] = URL_ROOT . basename(__DIR__) . '/' . basename(__FILE__); - /** - * Guess we need to go get one! - */ - $token = $consumer->getRequestToken(); - $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token); - - /** - * Now redirect user to Twitter site so they can log in and - * approve our access - */ - $consumer->redirect(); + // Permanent redirection + header("HTTP/1.1 301 Moved Permanently"); + header("Location: client.php"); + exit(); + } ?> diff -r 0d6069c5fb10 -r 9c645bec23c4 web/hanna-arendt/paris.php --- a/web/hanna-arendt/paris.php Mon Apr 15 12:24:37 2013 +0200 +++ b/web/hanna-arendt/paris.php Mon Apr 15 12:48:04 2013 +0200 @@ -9,18 +9,13 @@ */ if (!isset($_SESSION['TWITTER_ACCESS_TOKEN']) ) { + $_SESSION['TWITTER_REDIRECT_URL'] = URL_ROOT . basename(__DIR__) . '/' . basename(__FILE__); - /** - * Guess we need to go get one! - */ - $token = $consumer->getRequestToken(); - $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token); - - /** - * Now redirect user to Twitter site so they can log in and - * approve our access - */ - $consumer->redirect(); + // Permanent redirection + header("HTTP/1.1 301 Moved Permanently"); + header("Location: client.php"); + exit(); + } ?>