]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/BogoLogin.php
rcs_id no longer makes sense with Subversion global version number
[SourceForge/phpwiki.git] / lib / WikiUser / BogoLogin.php
1 <?php //-*-php-*-
2 // rcs_id('$Id$');
3 /* Copyright (C) 2004 ReiniUrban
4  * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
5  */
6
7 /** Without stored password. A _BogoLoginPassUser with password
8  *  is automatically upgraded to a PersonalPagePassUser.
9  */
10 class _BogoLoginPassUser extends _PassUser {
11
12     var $_authmethod = 'BogoLogin';
13
14     function userExists() {
15         if (isWikiWord($this->_userid)) {
16             $this->_level = WIKIAUTH_BOGO;
17             return true;
18         } else {
19             $this->_level = WIKIAUTH_ANON;
20             return false;
21         }
22     }
23
24     /** A BogoLoginUser requires no password at all
25      *  But if there's one stored, we override it with the PersonalPagePassUser instead
26      */
27     function checkPass($submitted_password) {
28         if ($this->_prefs->get('passwd')) {
29             if (isset($this->_prefs->_method) and $this->_prefs->_method == 'HomePage') {
30                 $user = new _PersonalPagePassUser($this->_userid, $this->_prefs);
31                 if ($user->checkPass($submitted_password)) {
32                     if (!check_php_version(5))
33                         eval("\$this = \$user;");
34                     // /*PHP5 patch*/$this = $user;
35                     $user = UpgradeUser($this, $user);
36                     $this->_level = WIKIAUTH_USER;
37                     return $this->_level;
38                 } else {
39                     $this->_level = WIKIAUTH_ANON;
40                     return $this->_level;
41                 }
42             } else {
43                 $stored_password = $this->_prefs->get('passwd');
44                 if ($this->_checkPass($submitted_password, $stored_password)) {
45                     $this->_level = WIKIAUTH_USER;
46                     return $this->_level;
47                 } elseif (USER_AUTH_POLICY === 'strict') {
48                     $this->_level = WIKIAUTH_FORBIDDEN;
49                     return $this->_level;
50                 } else {
51                     return $this->_tryNextPass($submitted_password);
52                 }
53             }
54         }
55         if (isWikiWord($this->_userid)) {
56             $this->_level = WIKIAUTH_BOGO;
57         } else {
58             $this->_level = WIKIAUTH_ANON;
59         }
60         return $this->_level;
61     }
62 }
63
64 // Local Variables:
65 // mode: php
66 // tab-width: 8
67 // c-basic-offset: 4
68 // c-hanging-comment-ender-p: nil
69 // indent-tabs-mode: nil
70 // End:
71 ?>