Separated code for IMAP into IMAP, POP3 and NNTP
This commit is contained in:
+18
@@ -52,6 +52,24 @@ imap - Uses an external IMAP server
|
||||
a new account is created
|
||||
|
||||
|
||||
pop3 - Uses an external POP3 server
|
||||
|
||||
- user logs in using username and password
|
||||
- these are checked against a POP3 server
|
||||
- if correct, user is logged in
|
||||
- if the username doesn't already exist then
|
||||
a new account is created
|
||||
|
||||
|
||||
nntp - Uses an external NNTP server
|
||||
|
||||
- user logs in using username and password
|
||||
- these are checked against an NNTP server
|
||||
- if correct, user is logged in
|
||||
- if the username doesn't already exist then
|
||||
a new account is created
|
||||
|
||||
|
||||
db - Uses an external database to check username/password
|
||||
|
||||
- user logs in using username and password
|
||||
|
||||
+3
-12
@@ -1,12 +1,12 @@
|
||||
<?PHP // $Id$
|
||||
// Authentication by looking up an IMAP, POP or NNTP server
|
||||
// Authentication by looking up an IMAP server
|
||||
|
||||
// This code is completely untested so far - IT NEEDS TESTERS!
|
||||
// Looks like it should work though ...
|
||||
|
||||
$CFG->auth_imaphost = "127.0.0.1"; // Should be IP number
|
||||
$CFG->auth_imaptype = "imap"; // imap, imapssl, imapcert, pop3, pop3cert, nntp
|
||||
$CFG->auth_imapport = "143"; // 143, 993, 100, 119
|
||||
$CFG->auth_imaptype = "imap"; // imap, imapssl, imapcert
|
||||
$CFG->auth_imapport = "143"; // 143, 993
|
||||
|
||||
|
||||
function auth_user_login ($username, $password) {
|
||||
@@ -25,15 +25,6 @@ function auth_user_login ($username, $password) {
|
||||
case "imapcert":
|
||||
$host = "{$CFG->auth_imaphost:$CFG->auth_imapport/imap/ssl/novalidate-cert}INBOX";
|
||||
break;
|
||||
case "pop3":
|
||||
$host = "{$CFG->auth_imaphost:$CFG->auth_imapport/pop3}INBOX";
|
||||
break;
|
||||
case "pop3cert":
|
||||
$host = "{$CFG->auth_imaphost:$CFG->auth_imapport/pop3/ssl/novalidate-cert}INBOX";
|
||||
break;
|
||||
case "nntp":
|
||||
$host = "{$CFG->auth_imaphost:$CFG->auth_imapport/nntp}";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?PHP // $Id$
|
||||
// Authentication by looking up an IMAP, POP or NNTP server
|
||||
|
||||
// This code is completely untested so far - IT NEEDS TESTERS!
|
||||
// Looks like it should work though ...
|
||||
|
||||
$CFG->auth_nntphost = "127.0.0.1"; // Should be IP number
|
||||
$CFG->auth_nntpport = "119";
|
||||
|
||||
|
||||
function auth_user_login ($username, $password) {
|
||||
// Returns true if the username and password work
|
||||
// and false if they are wrong or don't exist.
|
||||
|
||||
global $CFG;
|
||||
|
||||
$host = "{$CFG->auth_nntphost:$CFG->auth_nntpport/nntp}";
|
||||
|
||||
if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?PHP // $Id$
|
||||
// Authentication by looking up a POP3 server
|
||||
|
||||
// This code is completely untested so far - IT NEEDS TESTERS!
|
||||
// Looks like it should work though ...
|
||||
|
||||
$CFG->auth_pop3host = "127.0.0.1"; // Should be IP number
|
||||
$CFG->auth_pop3type = "pop3"; // pop3, pop3cert
|
||||
$CFG->auth_pop3port = "100"; // 143, 993, 100, 119
|
||||
|
||||
|
||||
function auth_user_login ($username, $password) {
|
||||
// Returns true if the username and password work
|
||||
// and false if they are wrong or don't exist.
|
||||
|
||||
global $CFG;
|
||||
|
||||
switch ($CFG->auth_pop3type) {
|
||||
case "pop3":
|
||||
$host = "{$CFG->auth_pop3host:$CFG->auth_pop3port/pop3}INBOX";
|
||||
break;
|
||||
case "pop3cert":
|
||||
$host = "{$CFG->auth_pop3host:$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
|
||||
imap_close($connection);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user