aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-17 23:38:47 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-17 23:38:47 +0200
commitf662a50e02abe50321766c84a23b977a455d401c (patch)
tree5268c678af6bfe4ba271de150c7ac79b12e20d0b
parente380a7f6aaefb1bbd16a595b6f855ce036501981 (diff)
downloadphorkie-f662a50e02abe50321766c84a23b977a455d401c.tar.gz
phorkie-f662a50e02abe50321766c84a23b977a455d401c.zip
get rid of openid config file
-rw-r--r--src/openid/config.php55
-rw-r--r--www/login.php35
2 files changed, 7 insertions, 83 deletions
diff --git a/src/openid/config.php b/src/openid/config.php
deleted file mode 100644
index 76ebc6a..0000000
--- a/src/openid/config.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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
- */
-
-set_include_path(dirname(__FILE__) . '/../../:' . get_include_path());
-
-/**
- * Required files
- */
-require_once 'OpenID/RelyingParty.php';
-require_once 'OpenID/Discover.php';
-require_once 'OpenID/Store.php';
-require_once 'OpenID/Extension/SREG10.php';
-require_once 'OpenID/Extension/SREG11.php';
-require_once 'OpenID/Extension/AX.php';
-require_once 'OpenID/Extension/UI.php';
-require_once 'OpenID/Extension/OAuth.php';
-require_once 'OpenID/Message.php';
-require_once 'OpenID/Observer/Log.php';
-require_once 'Net/URL2.php';
-
-// Determine realm and return_to
-$base = 'http';
-if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
- $base .= 's';
-}
-$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
-
-$realm = $base . '/';
-$returnTo = $base . dirname($_SERVER['PHP_SELF']);
-if ($returnTo[strlen($returnTo) - 1] != '/') {
- $returnTo .= '/';
-}
-$returnTo .= 'login';
-
-// SQL storage example
-// $storeOptions = array(
-// 'dsn' => 'mysql://user:pass@db.example.com/openid'
-// );
-// OpenID::setStore(OpenID_Store::factory('MDB2', $storeOptions));
-//
-// // The first time you run it, you'll also need to create the tables:
-// OpenID::getStore()->createTables();
-
-?>
diff --git a/www/login.php b/www/login.php
index e3d165d..6a13fa2 100644
--- a/www/login.php
+++ b/www/login.php
@@ -1,42 +1,18 @@
<?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
@@ -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) {