]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/IMAP.php
add PdoDbPassUser
[SourceForge/phpwiki.git] / lib / WikiUser / IMAP.php
1 <?php //-*-php-*-
2 rcs_id('$Id: IMAP.php,v 1.5 2005-04-25 19:46:08 rurban Exp $');
3 /* Copyright (C) 2004 $ThePhpWikiProgrammingTeam
4  * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
5  */
6
7 class _IMAPPassUser
8 extends _PassUser
9 /**
10  * Define the var IMAP_AUTH_HOST in config/config.ini (with port probably)
11  *
12  * Preferences are handled in _PassUser
13  */
14 {
15     function checkPass($submitted_password) {
16         if (!$this->isValidName()) {
17             trigger_error(_("Invalid username."),E_USER_WARNING);
18             return $this->_tryNextPass($submitted_password);
19         }
20         if (!$this->_checkPassLength($submitted_password)) {
21             return WIKIAUTH_FORBIDDEN;
22         }
23         $userid = $this->_userid;
24         $mbox = @imap_open( "{" . IMAP_AUTH_HOST . "}",
25                             $userid, $submitted_password, OP_HALFOPEN );
26         if ($mbox) {
27             imap_close($mbox);
28             $this->_authmethod = 'IMAP';
29             $this->_level = WIKIAUTH_USER;
30             return $this->_level;
31         } else {
32             if ($submitted_password != "") { // if LENGTH 0 is allowed
33                 trigger_error(_("Unable to connect to IMAP server "). IMAP_AUTH_HOST, 
34                               E_USER_WARNING);
35             }
36         }
37
38         return $this->_tryNextPass($submitted_password);
39     }
40
41     //CHECKME: this will not be okay for the auth policy strict
42     function userExists() {
43         return true;
44
45         if (checkPass($this->_prefs->get('passwd')))
46             return true;
47         return $this->_tryNextUser();
48     }
49
50     function mayChangePass() {
51         return false;
52     }
53 }
54
55 // $Log: not supported by cvs2svn $
56 // Revision 1.4  2004/12/26 17:11:17  rurban
57 // just copyright
58 //
59 // Revision 1.3  2004/12/20 16:05:01  rurban
60 // gettext msg unification
61 //
62 // Revision 1.2  2004/12/19 00:58:02  rurban
63 // Enforce PASSWORD_LENGTH_MINIMUM in almost all PassUser checks,
64 // Provide an errormessage if so. Just PersonalPage and BogoLogin not.
65 // Simplify httpauth logout handling and set sessions for all methods.
66 // fix main.php unknown index "x" getLevelDescription() warning.
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 ?>