[pLog-svn] r4427 - plugins/branches/lifetype-1.1/openid
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Sun Dec 24 01:09:10 GMT 2006
Author: jondaley
Date: 2006-12-24 01:09:09 +0000 (Sun, 24 Dec 2006)
New Revision: 4427
Modified:
plugins/branches/lifetype-1.1/openid/OpenID.php
Log:
better integration with LifeType's login/session. If you are already logged into your blog, the openid check will pass without a prompt. If you aren't logged in, it will fall back to the browser authentication popup (and then your browser will remember you until you close the browser). LiveJournal doesn't support the email/full name, but we send it in either case
Modified: plugins/branches/lifetype-1.1/openid/OpenID.php
===================================================================
--- plugins/branches/lifetype-1.1/openid/OpenID.php 2006-12-24 00:00:04 UTC (rev 4426)
+++ plugins/branches/lifetype-1.1/openid/OpenID.php 2006-12-24 01:09:09 UTC (rev 4427)
@@ -25,11 +25,20 @@
* Default username = 'test', password = 'test'
*/
+if (!defined( "PLOG_CLASS_PATH" )) {
+ define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
+}
+include_once( PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" );
+include_once( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
+include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php");
+include_once( PLOG_CLASS_PATH."class/dao/users.class.php");
+
+/*
$profile = array(
'auth_username' => 'test',
'auth_password' => 'e8358914a32e1ce3c62836db4babaa01'
);
-
+*/
/*
* Optional - Simple Registration Extension:
*
@@ -353,11 +362,6 @@
}
}
*/
- if (!defined( "PLOG_CLASS_PATH" )) {
- define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
- }
- include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php");
- include_once( PLOG_CLASS_PATH."class/dao/users.class.php");
$users = new Users();
@@ -365,7 +369,6 @@
if ($auth)
{
- $_SESSION['auth_username'] = $username;
$user_authenticated = true;
// get the user's information
@@ -373,7 +376,9 @@
if($userInfo)
{
$sreg['email'] = $userInfo->getEmail();
- $sreg['fullname'] = $userInfo->getFullName();
+ $sreg['fullname'] = $userInfo->getFullName();
+ print $sreg['email'];
+ die;
}
}
}
@@ -783,19 +788,21 @@
* App Initialization
*/
-// Start the user session
-session_name('phpMyID_Server');
-session_set_cookie_params(0, dirname($_SERVER['PHP_SELF']), $profile['domain']);
-session_start();
+$user_authenticated = false;
+// Share LifeType's session information
+SessionManager::init();
+$session = HttpVars::getSession();
+$sessionInfo = $session["SessionInfo"];
+if(isset($sessionInfo)){
+ $userInfo = $sessionInfo->getValue("userInfo");
+ if(isset($userInfo)){
+ $user_authenticated = true;
+ $sreg['email'] = $userInfo->getEmail();
+ $sreg['fullname'] = $userInfo->getFullName();
+ }
+}
-// Decide if the user is authenticated
-$user_authenticated = (isset($_SESSION['auth_username'])
- && $_SESSION['auth_username'] == $profile['auth_username'])
- ? true
- : false;
-
-
// Decide which runmode, based on user request or default
$run_mode = (isset($_REQUEST['openid_mode'])
&& in_array($_REQUEST['openid_mode'], $known['openid_modes']))
More information about the pLog-svn
mailing list