source: branches/rel/html/test/kakinaka/pear/Auth/Container/vpopmail.php @ 12157

Revision 12157, 2.4 KB checked in by uehara, 17 years ago (diff)
Line 
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
17 * @author     Stanislav Grozev <tacho@orbitel.bg>
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
21 * @version    CVS: $Id: vpopmail.php 8713 2006-12-01 05:08:34Z kakinaka $
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 */
29require_once "Auth/Container.php";
30/**
31 * Include PEAR package for error handling
32 */
33require_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
44 * @version    Release: 1.4.2  File: $Revision: 8713 $
45 * @link       http://pear.php.net/package/Auth
46 * @since      Class available since Release 1.2.0
47 */
48class 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    {
77        $userdata = array();
78        $userdata = preg_split("/@/", $username, 2);
79        $result = @vpopmail_auth_user($userdata[0], $userdata[1], $password);
80
81        return $result;
82    }
83
84    // }}}
85
86}
87?>
Note: See TracBrowser for help on using the repository browser.