remove openid thingies we do not need
[phorkie.git] / www / login.php
index 1feb3ce5b0cd3aa24188e90a53907acadff953c6..5d2caa3a8d48e22b2ce23a8ef332ce8de9ef0e4c 100644 (file)
@@ -83,11 +83,6 @@ if (isset($_POST['start'])) {
         exit;
     }
 
-    // checkid_immediate
-    if (!empty($_POST['checkid_immediate'])) {
-        $authRequest->setMode('checkid_immediate');
-    }
-
     // SREG
     $sreg = new \OpenID_Extension_SREG11(\OpenID_Extension::REQUEST);
     $sreg->set('required', 'email,fullname');
@@ -102,36 +97,10 @@ if (isset($_POST['start'])) {
     $ax->set('required', 'email,firstname,lastname');
     $authRequest->addExtension($ax);
 
-    // UI
-    if (!empty($_POST['ui'])) {
-        $ui = new \OpenID_Extension_UI(\OpenID_Extension::REQUEST);
-        $ui->set('mode', 'popup');
-        $ui->set('language', 'en-US');
-        $authRequest->addExtension($ui);
-    }
-
-    // OAuth
-    if (!empty($_POST['oauth'])) {
-        $oauth = new \OpenID_Extension_OAuth(\OpenID_Extension::REQUEST);
-        $oauth->set('consumer', $_POST['oauth_consumer_key']);
-        $_SESSION['OAuth_consumer_key']    = $_POST['oauth_consumer_key'];
-        $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret'];
-
-        $oauth->set('scope', $_POST['oauth_scope']);
-        $_SESSION['OAuth_scope'] = $_POST['oauth_scope'];
-
-        $_SESSION['OAuth_access_token_url']    = $_POST['oauth_access_token_url'];
-        $_SESSION['OAuth_access_token_method'] = $_POST['oauth_access_token_method'];
-
-        $authRequest->addExtension($oauth);
-    }
-    
     $url = $authRequest->getAuthorizeURL();
     
-    if (empty($_POST['debug'])) {
-        header("Location: $url");
-        exit;
-    }
+    header("Location: $url");
+    exit;
     
 } else {
     if (isset($_SESSION['openid_url'])) {
@@ -197,16 +166,32 @@ if (isset($_POST['start'])) {
 
     $openid = $message->getArrayFormat();
 
-    $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null;
-    $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email;
-    $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email;
-    $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email;
-    $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail'];
-
-    $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null;
-    $name = (isset($openid['openid.sreg.fullname']) && !isset($name)) ? $openid['openid.sreg.fullname'] : $name;
-    $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR'];
-
+    $email = isset($openid['openid.ext1.value.email'])
+        ? $openid['openid.ext1.value.email']
+        : null;
+    $email = isset($openid['openid.ext2.value.email']) && !isset($email)
+        ? $openid['openid.ext2.value.email']
+        : $email;
+    $email = isset($openid['openid.sreg.email']) && !isset($email)
+        ? $openid['openid.sreg.email']
+        : $email;
+    $email = isset($openid['openid.ax.value.email']) && !isset($email)
+        ? $openid['openid.ax.value.email']
+        : $email;
+    $_SESSION['email'] = isset($email)
+        ? $email
+        : $GLOBALS['phorkie']['auth']['anonymousEmail'];
+
+    $name = isset($openid['openid.ext1.value.firstname'])
+        && isset($openid['openid.ext1.value.lastname'])
+        ? $openid['openid.ext1.value.firstname'] . ' '
+        . $openid['openid.ext1.value.lastname']
+        : null;
+    $name = isset($openid['openid.sreg.fullname']) && !isset($name)
+        ? $openid['openid.sreg.fullname']
+        : $name;
+
+    $_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR'];
     $_SESSION['identity'] = $openid['openid.identity'];
 
     $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI'];