2 rcs_id('$Id: POP3.php,v 1.3 2004-12-20 16:05:01 rurban Exp $');
3 /* Copyright (C) 2004 $ThePhpWikiProgrammingTeam
7 extends _IMAPPassUser {
9 * Define the var POP3_AUTH_HOST in config/config.ini
10 * Preferences are handled in _PassUser
12 function checkPass($submitted_password) {
13 if (!$this->isValidName()) {
14 trigger_error(_("Invalid username."),E_USER_WARNING);
15 return $this->_tryNextPass($submitted_password);
17 if (!$this->_checkPassLength($submitted_password)) {
18 return WIKIAUTH_FORBIDDEN;
20 $userid = $this->_userid;
21 $pass = $submitted_password;
22 $host = defined('POP3_AUTH_HOST') ? POP3_AUTH_HOST : 'localhost:110';
23 if (defined('POP3_AUTH_PORT'))
24 $port = POP3_AUTH_PORT;
25 elseif (strstr($host,':')) {
26 list(,$port) = split(':',$host);
31 $fp = fsockopen($host, $port, $errno, $errstr, 10);
34 $line = fgets($fp, 1024);
35 if (! strncmp("+OK ", $line, 4)) {
37 fputs($fp, "user $userid\n");
39 $line = fgets($fp, 1024);
40 if (! strncmp("+OK ", $line, 4)) {
42 fputs($fp, "pass $pass\n");
44 $line = fgets($fp, 1024);
45 if (! strncmp("+OK ", $line, 4)) {
50 // quit the connection
52 // Get the sayonara message
53 $line = fgets($fp, 1024);
56 trigger_error(_("Couldn't connect to %s","POP3_AUTH_HOST ".$host.':'.$port),
59 $this->_authmethod = 'POP3';
61 $this->_level = WIKIAUTH_USER;
63 $this->_level = WIKIAUTH_ANON;
69 // $Log: not supported by cvs2svn $
70 // Revision 1.2 2004/12/19 00:58:02 rurban
71 // Enforce PASSWORD_LENGTH_MINIMUM in almost all PassUser checks,
72 // Provide an errormessage if so. Just PersonalPage and BogoLogin not.
73 // Simplify httpauth logout handling and set sessions for all methods.
74 // fix main.php unknown index "x" getLevelDescription() warning.
76 // Revision 1.1 2004/11/01 10:43:58 rurban
77 // seperate PassUser methods into seperate dir (memory usage)
78 // fix WikiUser (old) overlarge data session
79 // remove wikidb arg from various page class methods, use global ->_dbi instead
87 // c-hanging-comment-ender-p: nil
88 // indent-tabs-mode: nil