1: <?php
2:
3: $path_extra = dirname(__FILE__);
4: $path = ini_get('include_path');
5: $path = $path_extra . PATH_SEPARATOR . $path;
6: ini_set('include_path', $path);
7:
8: if (!defined('OFFSET_PATH'))
9: define('OFFSET_PATH', 4);
10: require_once(dirname(dirname(dirname(__FILE__))) . '/admin-functions.php');
11:
12: function displayError($message) {
13: $error = $message;
14: include 'OpenID_logon.php';
15: exit(0);
16: }
17:
18: function doIncludes() {
19: 20: 21:
22: require_once "Auth/OpenID/Consumer.php";
23:
24: 25: 26: 27:
28: require_once "Auth/OpenID/FileStore.php";
29:
30: 31: 32:
33: require_once "Auth/OpenID/SReg.php";
34:
35: 36: 37:
38: require_once "Auth/OpenID/PAPE.php";
39: }
40:
41: doIncludes();
42:
43: global $pape_policy_uris;
44: $pape_policy_uris = array(
45: PAPE_AUTH_MULTI_FACTOR_PHYSICAL,
46: PAPE_AUTH_MULTI_FACTOR,
47: PAPE_AUTH_PHISHING_RESISTANT
48: );
49:
50: function &getStore() {
51: 52: 53: 54: 55: 56:
57: $tmpfile = tempnam("dummy", "");
58: $store_path = dirname($tmpfile);
59: unlink($tmpfile);
60:
61: if (!file_exists($store_path) && !mkdir_recursive($store_path, FOLDER_MOD)) {
62: printf(gettext('Could not create the FileStore directory %s. Please check the effective permissions.'), $store_path);
63: exit(0);
64: }
65:
66: $store = new Auth_OpenID_FileStore($store_path);
67: return $store;
68: }
69:
70: function getConsumer() {
71: 72: 73: 74:
75: $store = getStore();
76: $consumer = new Auth_OpenID_Consumer($store);
77: return $consumer;
78: }
79:
80: function getScheme() {
81: $scheme = 'http';
82: if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
83: $scheme .= 's';
84: }
85: return $scheme;
86: }
87:
88: function getReturnTo() {
89: return sprintf("%s://%s:%s%s/OpenID_finish_auth.php", getScheme(), $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], dirname($_SERVER['PHP_SELF']));
90: }
91:
92: function getTrustRoot() {
93: return sprintf("%s://%s:%s%s/", getScheme(), $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], dirname($_SERVER['PHP_SELF']));
94: }
95:
96: ?>