Subversion Repositories Applications.papyrus

Rev

Rev 1173 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1173 Rev 1713
Line 12... Line 12...
12
 * the PHP License and are unable to obtain it through the web, please
12
 * the PHP License and are unable to obtain it through the web, please
13
 * send a note to license@php.net so we can mail you a copy immediately.
13
 * send a note to license@php.net so we can mail you a copy immediately.
14
 *
14
 *
15
 * @category   Authentication
15
 * @category   Authentication
16
 * @package    Auth
16
 * @package    Auth
17
 * @author     Jeroen Houben <jeroen@terena.nl> 
17
 * @author     Jeroen Houben <jeroen@terena.nl>
18
 * @author     Adam Ashley <aashley@php.net>
18
 * @author     Adam Ashley <aashley@php.net>
19
 * @copyright  2001-2006 The PHP Group
19
 * @copyright  2001-2006 The PHP Group
20
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
20
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
21
 * @version    CVS: $Id: IMAP.php,v 1.2 2006-12-14 15:04:28 jp_milcent Exp $
21
 * @version    CVS: $Id: IMAP.php,v 1.3 2007-11-19 15:11:00 jp_milcent Exp $
22
 * @link       http://pear.php.net/package/Auth
22
 * @link       http://pear.php.net/package/Auth
23
 * @since      File available since Release 1.2.0
23
 * @since      File available since Release 1.2.0
24
 */
24
 */
Line 25... Line 25...
25
 
25
 
26
/**
26
/**
27
 * Include Auth_Container base class 
27
 * Include Auth_Container base class
28
 */
28
 */
Line 29... Line 29...
29
require_once "Auth/Container.php";
29
require_once "Auth/Container.php";
30
 
30
 
Line 75... Line 75...
75
 * @author     Jeroen Houben <jeroen@terena.nl>
75
 * @author     Jeroen Houben <jeroen@terena.nl>
76
 * @author     Cipriano Groenendal <cipri@campai.nl>
76
 * @author     Cipriano Groenendal <cipri@campai.nl>
77
 * @author     Adam Ashley <aashley@php.net>
77
 * @author     Adam Ashley <aashley@php.net>
78
 * @copyright  2001-2006 The PHP Group
78
 * @copyright  2001-2006 The PHP Group
79
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
79
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
80
 * @version    Release: 1.4.3  File: $Revision: 1.2 $
80
 * @version    Release: 1.5.4  File: $Revision: 1.3 $
81
 * @link       http://pear.php.net/package/Auth
81
 * @link       http://pear.php.net/package/Auth
82
 * @since      Class available since Release 1.2.0
82
 * @since      Class available since Release 1.2.0
83
 */
83
 */
84
class Auth_Container_IMAP extends Auth_Container
84
class Auth_Container_IMAP extends Auth_Container
85
{
85
{
Line 146... Line 146...
146
     * Check if the given server and port are reachable
146
     * Check if the given server and port are reachable
147
     *
147
     *
148
     * @access private
148
     * @access private
149
     */
149
     */
150
    function _checkServer() {
150
    function _checkServer() {
-
 
151
        $this->log('Auth_Container_IMAP::_checkServer() called.', AUTH_LOG_DEBUG);
151
        $fp = @fsockopen ($this->options['host'], $this->options['port'],
152
        $fp = @fsockopen ($this->options['host'], $this->options['port'],
152
                          $errno, $errstr, $this->options['timeout']);
153
                          $errno, $errstr, $this->options['timeout']);
153
        if (is_resource($fp)) {
154
        if (is_resource($fp)) {
154
            @fclose($fp);
155
            @fclose($fp);
155
        } else {
156
        } else {
Line 186... Line 187...
186
     * @param  string Password
187
     * @param  string Password
187
     * @return boolean
188
     * @return boolean
188
     */
189
     */
189
    function fetchData($username, $password)
190
    function fetchData($username, $password)
190
    {
191
    {
-
 
192
        $this->log('Auth_Container_IMAP::fetchData() called.', AUTH_LOG_DEBUG);
191
        $dsn = '{'.$this->options['host'].':'.$this->options['port'].$this->options['baseDSN'].'}';
193
        $dsn = '{'.$this->options['host'].':'.$this->options['port'].$this->options['baseDSN'].'}';
192
        $conn = @imap_open ($dsn, $username, $password, OP_HALFOPEN);
194
        $conn = @imap_open ($dsn, $username, $password, OP_HALFOPEN);
193
        if (is_resource($conn)) {
195
        if (is_resource($conn)) {
-
 
196
            $this->log('Successfully connected to IMAP server.', AUTH_LOG_DEBUG);
194
            $this->activeUser = $username;
197
            $this->activeUser = $username;
195
            @imap_close($conn);
198
            @imap_close($conn);
196
            return true;
199
            return true;
197
        } else {
200
        } else {
-
 
201
            $this->log('Connection to IMAP server failed.', AUTH_LOG_DEBUG);
198
            $this->activeUser = '';
202
            $this->activeUser = '';
199
            return false;
203
            return false;
200
        }
204
        }
201
    }
205
    }