Skip to content

Commit

Permalink
fix a session issue when registering a new account, add a php4 compat…
Browse files Browse the repository at this point in the history
…ibility fix
  • Loading branch information
François Hodierne committed May 18, 2009
1 parent 7bf9e05 commit 0360443
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
11 changes: 7 additions & 4 deletions action.php
Expand Up @@ -34,6 +34,8 @@

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');

require_once(dirname(__FILE__).'/compat.php');

require_once(DOKU_PLUGIN.'action.php');

class action_plugin_openid extends DokuWiki_Action_Plugin {
Expand All @@ -46,7 +48,7 @@ function getInfo()
return array(
'author' => 'h6e.net',
'email' => 'contact@h6e.net',
'date' => '2009-04-07',
'date' => '2009-05-18',
'name' => 'OpenID plugin',
'desc' => 'Authenticate on a DokuWiki with OpenID',
'url' => 'http://h6e.net/dokuwiki/plugins/openid',
Expand Down Expand Up @@ -353,7 +355,7 @@ function handle_profile_form(&$event, $param)
function login_user($openid)
{
global $USERINFO, $auth, $conf;

// look for associations passed from an auth backend in user infos
$users = $auth->retrieveUsers();
foreach ($users as $id => $user) {
Expand Down Expand Up @@ -399,7 +401,7 @@ function login_user($openid)
*/
function register_user()
{
global $USERINFO, $ID, $lang, $conf, $auth, $openid_associations;
global $ID, $lang, $conf, $auth, $openid_associations;

if(!$auth->canDo('addUser')) return false;

Expand Down Expand Up @@ -432,7 +434,6 @@ function register_user()
// we update the OpenID associations array
$this->register_openid_association($user, $openid);

$USERINFO = $auth->getUserData($user);
$this->update_session($user);

// account created, everything OK
Expand All @@ -449,6 +450,8 @@ function register_user()
*/
function update_session($user)
{
session_start();

global $USERINFO, $INFO, $conf, $auth;

$_SERVER['REMOTE_USER'] = $user;
Expand Down
17 changes: 17 additions & 0 deletions compat.php
@@ -0,0 +1,17 @@
<?php

if (!function_exists('file_put_contents')) {

function file_put_contents($filename, $data)
{
$f = @fopen($filename, 'w');
if (!$f) {
return false;
} else {
$bytes = fwrite($f, $data);
fclose($f);
return $bytes;
}
}

}

0 comments on commit 0360443

Please sign in to comment.