Displays all user pictures on one page.
[moodle.git] / auth / imap / lib.php
CommitLineData
d1b4e172 1<?PHP // $Id$
df3988ea 2 // Authentication by looking up an IMAP server
d1b4e172 3
d1b4e172 4function auth_user_login ($username, $password) {
5// Returns true if the username and password work
6// and false if they are wrong or don't exist.
7
8 global $CFG;
9
10 switch ($CFG->auth_imaptype) {
d1b4e172 11 case "imapssl":
35a48c9a 12 $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl}";
d1b4e172 13 break;
704da28e 14
d17bdf2b 15 case "imapcert":
35a48c9a 16 $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl/novalidate-cert}";
d17bdf2b 17 break;
704da28e 18
e1fb2ab5 19 case "imaptls":
35a48c9a 20 $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/notls}";
e1fb2ab5 21 break;
22
704da28e 23 default:
817c698e 24 $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport}";
d1b4e172 25 }
26
35a48c9a 27 error_reporting(0);
28 $connection = imap_open($host, $username, $password, OP_HALFOPEN);
a7514c09 29 error_reporting($CFG->debug);
35a48c9a 30
31 if ($connection) {
d1b4e172 32 imap_close($connection);
33 return true;
34
35 } else {
36 return false;
37 }
38}
39
40
41?>