Labs Tidy up, depreciate old trip planner tester, promote myway balance/service alerts to main site
[busui.git] / include / common-auth.inc.php
blob:a/include/common-auth.inc.php -> blob:b/include/common-auth.inc.php
--- a/include/common-auth.inc.php
+++ b/include/common-auth.inc.php
@@ -1,4 +1,20 @@
 <?php
+
+/*
+ *    Copyright 2010,2011 Alexander Sadleir 
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
 
 function getScheme() {
     $scheme = 'http';
@@ -19,10 +35,11 @@
 require_once "Auth/OpenID/AX.php";
 
 function login() {
+    global $basePath;
     // Just tested this with/for Google, needs trying with others ...
     $oid_identifier = 'https://www.google.com/accounts/o8/id';
     // Create file storage area for OpenID data
-    $store = new Auth_OpenID_FileStore('lib/openid-php/oid_store');
+    $store = new Auth_OpenID_FileStore(realpath($basePath) . '/lib/openid-php/oid_store');
     // Create OpenID consumer
     $consumer = new Auth_OpenID_Consumer($store);
     // Create an authentication request to the OpenID provider
@@ -52,11 +69,12 @@
 }
 
 function auth() {
+      global $basePath;
     if ($_SESSION['authed'] == true)
         return true;
 
     // Create file storage area for OpenID data
-    $store = new Auth_OpenID_FileStore('lib/openid-php/oid_store');
+    $store = new Auth_OpenID_FileStore(realpath($basePath) . '/lib/openid-php/oid_store');
     // Create OpenID consumer
     $consumer = new Auth_OpenID_Consumer($store);
     // Create an authentication request to the OpenID provider