Subversion Repositories Applications.papyrus

Rev

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

Rev 320 Rev 1173
Line 1... Line 1...
1
<?PHP
1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4: */
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
 
3
 
-
 
4
/**
3
// +----------------------------------------------------------------------+
5
 * Storage driver for use against vpopmail setups
-
 
6
 *
-
 
7
 * PHP versions 4 and 5
-
 
8
 *
4
// | PHP Version 4                                                        |
9
 * LICENSE: This source file is subject to version 3.01 of the PHP license
5
// +----------------------------------------------------------------------+
10
 * that is available through the world-wide-web at the following URI:
6
// | Copyright (c) 1997-2003 The PHP Group                                |
11
 * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
7
// +----------------------------------------------------------------------+
12
 * the PHP License and are unable to obtain it through the web, please
8
// | This source file is subject to version 2.02 of the PHP license,      |
13
 * send a note to license@php.net so we can mail you a copy immediately.
-
 
14
 *
9
// | that is bundled with this package in the file LICENSE, and is        |
15
 * @category   Authentication
-
 
16
 * @package    Auth
10
// | available at through the world-wide-web at                           |
17
 * @author     Stanislav Grozev <tacho@orbitel.bg> 
11
// | http://www.php.net/license/2_02.txt.                                 |
18
 * @author     Adam Ashley <aashley@php.net>
12
// | If you did not receive a copy of the PHP license and are unable to   |
19
 * @copyright  2001-2006 The PHP Group
13
// | obtain it through the world-wide-web, please send a note to          |
20
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
14
// | license@php.net so we can mail you a copy immediately.               |
21
 * @version    CVS: $Id: vpopmail.php,v 1.2 2006-12-14 15:04:28 jp_milcent Exp $
15
// +----------------------------------------------------------------------+
22
 * @link       http://pear.php.net/package/Auth
16
// | Author: Stanislav Grozev <tacho@orbitel.bg>                          |
23
 * @since      File available since Release 1.2.0
-
 
24
 */
-
 
25
 
-
 
26
/**
17
// +----------------------------------------------------------------------+
27
 * Include Auth_Container base class
18
//
28
 */
19
// $Id: vpopmail.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
29
require_once "Auth/Container.php";
20
//
30
/**
-
 
31
 * Include PEAR package for error handling
21
 
32
 */
22
require_once "Auth/Container.php";
33
require_once "PEAR.php";
23
 
34
 
24
/**
35
/**
25
 * Storage driver for fetching login data from vpopmail
36
 * Storage driver for fetching login data from vpopmail
26
 *
37
 *
27
 * @author   Stanislav Grozev <tacho@orbitel.bg>
38
 * @category   Authentication
28
 * @package  Auth
39
 * @package    Auth
-
 
40
 * @author     Stanislav Grozev <tacho@orbitel.bg>
-
 
41
 * @author     Adam Ashley <aashley@php.net>
-
 
42
 * @copyright  2001-2006 The PHP Group
-
 
43
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
29
 * @version  $Revision: 1.1 $
44
 * @version    Release: 1.4.3  File: $Revision: 1.2 $
-
 
45
 * @link       http://pear.php.net/package/Auth
-
 
46
 * @since      Class available since Release 1.2.0
30
 */
47
 */
31
class Auth_Container_vpopmail extends Auth_Container {
48
class Auth_Container_vpopmail extends Auth_Container {
32
 
49
 
33
    // {{{ Constructor
50
    // {{{ Constructor
34
 
51
 
35
    /**
52
    /**
36
     * Constructor of the container class
53
     * Constructor of the container class
37
     *
54
     *
38
     * @return integer Always returns 1.
55
     * @return void
39
     */
56
     */
40
    function Auth_Container_vpopmail()
57
    function Auth_Container_vpopmail()
41
    {
58
    {
-
 
59
        if (!extension_loaded('vpopmail')) {
-
 
60
            return PEAR::raiseError('Cannot use VPOPMail authentication, '
-
 
61
                    .'VPOPMail extension not loaded!', 41, PEAR_ERROR_DIE);
42
        return 1;
62
        }
43
    }
63
    }
44
 
64
 
45
    // }}}
65
    // }}}
46
    // {{{ fetchData()
66
    // {{{ fetchData()
47
 
67
 
48
    /**
68
    /**
49
     * Get user information from vpopmail
69
     * Get user information from vpopmail
50
     *
70
     *
51
     * @param   string Username - has to be valid email address
71
     * @param   string Username - has to be valid email address
52
     * @param   string Password
72
     * @param   string Password
53
     * @return  boolean
73
     * @return  boolean
54
     */
74
     */
55
    function fetchData($username, $password)
75
    function fetchData($username, $password)
56
    {
76
    {
57
        $userdata = array();
77
        $userdata = array();
58
        $userdata = preg_split("/@/", $username, 2);
78
        $userdata = preg_split("/@/", $username, 2);
59
        $result = @vpopmail_auth_user($userdata[0], $userdata[1], $password);
79
        $result = @vpopmail_auth_user($userdata[0], $userdata[1], $password);
60
 
80
 
61
        return $result;
81
        return $result;
62
    }
82
    }
63
 
83
 
64
    // }}}
84
    // }}}
-
 
85
 
65
}
86
}
66
?>
87
?>