]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/BogoLogin.php
Activated Id substitution for Subversion
[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 // $Log: not supported by cvs2svn $
65 // Revision 1.5  2005/02/14 12:28:27  rurban
66 // fix policy strict. Thanks to Mikhail Vladimirov
67 //
68 // Revision 1.4  2004/12/26 17:11:15  rurban
69 // just copyright
70 //
71 // Revision 1.3  2004/11/06 03:07:03  rurban
72 // make use of dumped static config state in config/config.php (if writable)
73 //
74 // Revision 1.2  2004/11/05 20:53:36  rurban
75 // login cleanup: better debug msg on failing login,
76 // checked password less immediate login (bogo or anon),
77 // checked olduser pref session error,
78 // better PersonalPage without password warning on minimal password length=0
79 //   (which is default now)
80 //
81 // Revision 1.1  2004/11/01 10:43:58  rurban
82 // seperate PassUser methods into seperate dir (memory usage)
83 // fix WikiUser (old) overlarge data session
84 // remove wikidb arg from various page class methods, use global ->_dbi instead
85 // ...
86 //
87
88 // Local Variables:
89 // mode: php
90 // tab-width: 8
91 // c-basic-offset: 4
92 // c-hanging-comment-ender-p: nil
93 // indent-tabs-mode: nil
94 // End:
95 ?>