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 16... Line 16...
16
 * @package    Auth
16
 * @package    Auth
17
 * @author     georg_1 at have2 dot com
17
 * @author     georg_1 at have2 dot com
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: Array.php,v 1.1 2006-12-14 15:04:28 jp_milcent Exp $
21
 * @version    CVS: $Id: Array.php,v 1.2 2007-11-19 15:11:00 jp_milcent Exp $
22
 * @since      File available since Release 1.4.0
22
 * @since      File available since Release 1.4.0
23
 */
23
 */
Line 24... Line 24...
24
 
24
 
25
/**
25
/**
Line 62... Line 62...
62
 * @package    Auth
62
 * @package    Auth
63
 * @author     georg_1 at have2 dot com
63
 * @author     georg_1 at have2 dot com
64
 * @author     Adam Ashley <aashley@php.net>
64
 * @author     Adam Ashley <aashley@php.net>
65
 * @copyright  2001-2006 The PHP Group
65
 * @copyright  2001-2006 The PHP Group
66
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
66
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
67
 * @version    Release: 1.4.3  File: $Revision: 1.1 $
67
 * @version    Release: 1.5.4  File: $Revision: 1.2 $
68
 * @since      File available since Release 1.4.0
68
 * @since      File available since Release 1.4.0
69
 */
69
 */
Line 70... Line 70...
70
 
70
 
Line 97... Line 97...
97
     */
97
     */
98
    function Auth_Container_Array($data)
98
    function Auth_Container_Array($data)
99
    {
99
    {
100
        if (!is_array($data)) {
100
        if (!is_array($data)) {
101
            PEAR::raiseError('The options for Auth_Container_Array must be an array');
101
            PEAR::raiseError('The options for Auth_Container_Array must be an array');
102
        } 
102
        }
103
        if (isset($data['users']) && is_array($data['users'])) {
103
        if (isset($data['users']) && is_array($data['users'])) {
104
            $this->users = $data['users'];
104
            $this->users = $data['users'];
105
        } else {
105
        } else {
106
            $this->users = array();
106
            $this->users = array();
107
            PEAR::raiseError('Auth_Container_Array: no user data found inoptions array');
107
            PEAR::raiseError('Auth_Container_Array: no user data found in options array');
108
        } 
108
        }
109
        if (isset($data['cryptType'])) {
109
        if (isset($data['cryptType'])) {
110
            $this->cryptType = $data['cryptType'];
110
            $this->cryptType = $data['cryptType'];
111
        } 
111
        }
112
    }
112
    }
Line 113... Line 113...
113
 
113
 
114
    // }}}
114
    // }}}
Line 126... Line 126...
126
     * @param  string Password
126
     * @param  string Password
127
     * @return boolean|PEAR_Error Error object or boolean
127
     * @return boolean|PEAR_Error Error object or boolean
128
     */
128
     */
129
    function fetchData($user, $pass)
129
    function fetchData($user, $pass)
130
    {
130
    {
-
 
131
        $this->log('Auth_Container_Array::fetchData() called.', AUTH_LOG_DEBUG);
131
        if (   isset($this->users[$user])
132
        if (   isset($this->users[$user])
132
            && $this->verifyPassword($pass, $this->users[$user], $this->cryptType)) {
133
            && $this->verifyPassword($pass, $this->users[$user], $this->cryptType)) {
133
            return true;
134
            return true;
134
        }
135
        }
135
        return false;
136
        return false;
136
    } 
137
    }
Line 137... Line 138...
137
 
138
 
138
    // }}}
139
    // }}}
Line 139... Line 140...
139
    // {{{ listUsers()
140
    // {{{ listUsers()
Line 143... Line 144...
143
     *
144
     *
144
     * @return array
145
     * @return array
145
     */
146
     */
146
    function listUsers()
147
    function listUsers()
147
    {
148
    {
-
 
149
        $this->log('Auth_Container_Array::listUsers() called.', AUTH_LOG_DEBUG);
148
        $ret = array();
150
        $ret = array();
149
        foreach ($this->users as $username => $password) {
151
        foreach ($this->users as $username => $password) {
150
            $ret[]['username'] = $username;
152
            $ret[]['username'] = $username;
151
        } 
153
        }
152
        return $ret;
154
        return $ret;
153
    } 
155
    }
Line 154... Line 156...
154
 
156
 
Line 155... Line 157...
155
    // }}}
157
    // }}}
Line 156... Line 158...
156
 
158