web/hanna-arendt/client.php
author Raphael Velt <raph.velt@gmail.com>
Mon, 15 Apr 2013 12:48:04 +0200
changeset 840 9c645bec23c4
parent 836 9de4ed65f00c
permissions -rw-r--r--
Bugfix for oauth redirects
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
836
9de4ed65f00c Added Hanna Arendt
Raphael Velt <raph.velt@gmail.com>
parents:
diff changeset
     1
<?php
840
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     2
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     3
$config = array("rep" => basename(__DIR__));
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     4
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     5
include_once '../common.php';
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     6
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     7
if (isset($_SESSION['TWITTER_ACCESS_TOKEN']) ) {
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     8
	// Permanent redirection
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
     9
	header("HTTP/1.1 301 Moved Permanently");
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    10
	header("Location: index.php");
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    11
	exit();
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    12
} else {
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    13
	    /**
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    14
     * Guess we need to go get one!
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    15
     */
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    16
    $token = $consumer->getRequestToken();
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    17
    $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token);
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    18
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    19
    /**
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    20
     * Now redirect user to Twitter site so they can log in and
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    21
     * approve our access
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    22
     */
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    23
    $consumer->redirect();
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    24
}
9c645bec23c4 Bugfix for oauth redirects
Raphael Velt <raph.velt@gmail.com>
parents: 836
diff changeset
    25
836
9de4ed65f00c Added Hanna Arendt
Raphael Velt <raph.velt@gmail.com>
parents:
diff changeset
    26
?>