]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/BogoLogin.php
make use of dumped static config state in config/config.php (if writable)
[SourceForge/phpwiki.git] / lib / WikiUser / BogoLogin.php
1 <?php //-*-php-*-
2 rcs_id('$Id: BogoLogin.php,v 1.3 2004-11-06 03:07:03 rurban Exp $');
3 /* Copyright (C) 2004 $ThePhpWikiProgrammingTeam
4  */
5
6 /** Without stored password. A _BogoLoginPassUser with password 
7  *  is automatically upgraded to a PersonalPagePassUser.
8  */
9 class _BogoLoginPassUser
10 extends _PassUser
11 {
12     var $_authmethod = 'BogoLogin';
13     function userExists() {
14         if (isWikiWord($this->_userid)) {
15             $this->_level = WIKIAUTH_BOGO;
16             return true;
17         } else {
18             $this->_level = WIKIAUTH_ANON;
19             return false;
20         }
21     }
22
23     /** A BogoLoginUser requires no password at all
24      *  But if there's one stored, we override it with the PersonalPagePassUser instead
25      */
26     function checkPass($submitted_password) {
27         if ($this->_prefs->get('passwd')) {
28             if (isset($this->_prefs->_method) and $this->_prefs->_method == 'HomePage') {
29                 $user = new _PersonalPagePassUser($this->_userid, $this->_prefs);
30                 if ($user->checkPass($submitted_password)) {
31                     if (!check_php_version(5))
32                         eval("\$this = \$user;");
33                     // /*PHP5 patch*/$this = $user;
34                     $user = UpgradeUser($this, $user);
35                     $this->_level = WIKIAUTH_USER;
36                     return $this->_level;
37                 } else {
38                     $this->_level = WIKIAUTH_ANON;
39                     return $this->_level;
40                 }
41             } else {
42                 $stored_password = $this->_prefs->get('passwd');
43                 if ($this->_checkPass($submitted_password, $stored_password)) {
44                     $this->_level = WIKIAUTH_USER;
45                     return $this->_level;
46                 } else {
47                     return $this->_tryNextPass($submitted_password);
48                 }
49             }
50         }
51         if (isWikiWord($this->_userid)) {
52             $this->_level = WIKIAUTH_BOGO;
53         } else {
54             $this->_level = WIKIAUTH_ANON;
55         }
56         return $this->_level;
57     }
58 }
59
60 // $Log: not supported by cvs2svn $
61 // Revision 1.2  2004/11/05 20:53:36  rurban
62 // login cleanup: better debug msg on failing login,
63 // checked password less immediate login (bogo or anon),
64 // checked olduser pref session error,
65 // better PersonalPage without password warning on minimal password length=0
66 //   (which is default now)
67 //
68 // Revision 1.1  2004/11/01 10:43:58  rurban
69 // seperate PassUser methods into seperate dir (memory usage)
70 // fix WikiUser (old) overlarge data session
71 // remove wikidb arg from various page class methods, use global ->_dbi instead
72 // ...
73 //
74
75 // Local Variables:
76 // mode: php
77 // tab-width: 8
78 // c-basic-offset: 4
79 // c-hanging-comment-ender-p: nil
80 // indent-tabs-mode: nil
81 // End:
82 ?>