]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/BogoLogin.php
seperate PassUser methods into seperate dir (memory usage)
[SourceForge/phpwiki.git] / lib / WikiUser / BogoLogin.php
1 <?php //-*-php-*-
2 rcs_id('$Id: BogoLogin.php,v 1.1 2004-11-01 10:43:58 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 should prefer PersonalPage 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
62 // Local Variables:
63 // mode: php
64 // tab-width: 8
65 // c-basic-offset: 4
66 // c-hanging-comment-ender-p: nil
67 // indent-tabs-mode: nil
68 // End:
69 ?>