Displays all user pictures on one page.
[moodle.git] / auth / imap / lib.php
1 <?PHP  // $Id$
2        // Authentication by looking up an IMAP server
4 function 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.
8     global $CFG;
10     switch ($CFG->auth_imaptype) {
11         case "imapssl":
12             $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl}";
13         break;
15         case "imapcert":
16             $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/ssl/novalidate-cert}";
17         break;
19         case "imaptls":
20             $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport/imap/notls}";
21         break;
23         default:
24             $host = "{".$CFG->auth_imaphost.":$CFG->auth_imapport}";
25     }
27     error_reporting(0);
28     $connection = imap_open($host, $username, $password, OP_HALFOPEN);
29     error_reporting($CFG->debug);   
31     if ($connection) {
32         imap_close($connection);
33         return true;
35     } else {
36         return false;
37     }
38 }
41 ?>