]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/OpenID.php
rcs_id no longer makes sense with Subversion global version number
[SourceForge/phpwiki.git] / lib / WikiUser / OpenID.php
1 <?php //-*-php-*-
2 // rcs_id('$Id$');
3 /* Copyright (C) 2007,2009 ReiniUrban
4  * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
5  *
6  * See http://openid.net/specs/openid-authentication-1_1.html
7  */
8
9 class _OpenIDPassUser
10 extends _PassUser
11 /**
12  * Preferences are handled in _PassUser
13  */
14 {
15     // This can only be called from _PassUser, because the parent class
16     // sets the pref methods, before this class is initialized.
17     function _OpenIDPassUser($UserName='', $prefs=false, $file='') {
18         if (!$this->_prefs and isa($this, "_OpenIDPassUser")) {
19             if ($prefs) $this->_prefs = $prefs;
20             if (!isset($this->_prefs->_method))
21               _PassUser::_PassUser($UserName);
22         }
23         $this->_userid = $UserName;
24         return $this;
25     }
26
27     function userExists() {
28         if (!$this->isValidName($this->_userid)) {
29             return $this->_tryNextUser();
30         }
31         $this->_authmethod = 'OpenID';
32         return $this->_tryNextUser();
33     }
34     // no quotes and shorter than 128
35     function isValidName() {
36         if (!$this->_userid) return false;
37         return !preg_match('/[\"\']/', $this->_userid) and strlen($this->_userid) < 128;
38     }
39 }
40
41 // Local Variables:
42 // mode: php
43 // tab-width: 8
44 // c-basic-offset: 4
45 // c-hanging-comment-ender-p: nil
46 // indent-tabs-mode: nil
47 // End:
48 ?>