get rid of openid config file
[phorkie.git] / www / login.php
index 790a73a0acb9fee9d31d84305d2985d1fcf57310..6a13fa290d03603af6860f067b744756d34564c1 100644 (file)
@@ -1,46 +1,22 @@
 <?php
-/**
- * OpenID 
- * 
- * PHP Version 5.2.0+
- * 
- * @category  Auth
- * @package   OpenID
- * @author    Bill Shupp <hostmaster@shupp.org> 
- * @copyright 2009 Bill Shupp
- * @license   http://www.opensource.org/licenses/bsd-license.php FreeBSD
- * @link      http://github.com/shupp/openid
- */
 namespace phorkie;
-// A tool for testing Relying Party functionality
-set_include_path(
-    __DIR__ . '/../../src/'
-    . PATH_SEPARATOR . get_include_path()
-);
-
 $pageRequiresLogin = false;
 require_once 'www-header.php';
-require_once 'openid/config.php';
-
 
 if (isset($_REQUEST['logout'])) {
     unset($_SESSION);
     session_destroy();
-    $redirect = 'http://' . $_SERVER['HTTP_HOST'];
-    header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
-    exit;
+    header('Location: ' . Tools::fullUrl('/'));
+    exit();
 }
 
 if (!count($_GET) && !count($_POST)) {
-    render(
-        'login',
-        null
-    );
-    exit;
+    render('login');
+    exit();
 }
 
 // Hackaround Non-Javascript Login Page
-if (!count($_POST) && isset($_GET['start'])) {
+if (!count($_POST) && isset($_GET['openid_url'])) {
     $_POST = $_GET;
 }
 
@@ -52,6 +28,9 @@ if (isset($_POST['openid_url'])) {
     $openid_url = null;
 }
 
+$realm    = Tools::fullUrl('/');
+$returnTo = Tools::fullUrl('/login');
+
 try {
     $o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url);
 } catch (OpenID_Exception $e) {
@@ -70,7 +49,7 @@ if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associat
 $log = new \OpenID_Observer_Log;
 \OpenID::attach($log);
 
-if (isset($_POST['start'])) {
+if (isset($_POST['openid_url'])) {
 
     $_SESSION['openid_url'] = $openid_url;
     try {