Subversion Repositories Applications.papyrus

Rev

Rev 1713 | Details | Compare with Previous | Last modification | View Log | RSS feed

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