Bugfix for oauth redirects
authorRaphael Velt <raph.velt@gmail.com>
Mon, 15 Apr 2013 12:48:04 +0200
changeset 840 9c645bec23c4
parent 839 0d6069c5fb10
child 841 bf648f325dc4
Bugfix for oauth redirects
web/hanna-arendt/client.php
web/hanna-arendt/index.php
web/hanna-arendt/paris.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 @@
 <?php
-// Permanent redirection
-header("HTTP/1.1 301 Moved Permanently");
-header("Location: index.php");
-exit();
+
+$config = array("rep" => 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
--- 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();
+	
 }
 
 ?>
--- 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();
+	
 }
 
 ?>