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     Yavor Shahpasov <yavo@netsmart.com.cy>
17
 * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
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: Anonymous.php,v 1.1 2006-12-14 15:04:28 jp_milcent Exp $
21
 * @version    CVS: $Id: Anonymous.php,v 1.2 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.3.0
23
 * @since      File available since Release 1.3.0
24
 */
24
 */
Line 25... Line 25...
25
 
25
 
Line 28... Line 28...
28
 */
28
 */
29
require_once 'Auth.php';
29
require_once 'Auth.php';
Line 30... Line 30...
30
 
30
 
31
/**
31
/**
32
 * Anonymous Authentication
32
 * Anonymous Authentication
33
 * 
33
 *
34
 * This class provides anonymous authentication if username and password 
34
 * This class provides anonymous authentication if username and password
35
 * were not supplied
35
 * were not supplied
36
 *
36
 *
37
 * @category   Authentication
37
 * @category   Authentication
38
 * @package    Auth
38
 * @package    Auth
39
 * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
39
 * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
40
 * @author     Adam Ashley <aashley@php.net>
40
 * @author     Adam Ashley <aashley@php.net>
41
 * @copyright  2001-2006 The PHP Group
41
 * @copyright  2001-2006 The PHP Group
42
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
42
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
43
 * @version    Release: 1.4.3  File: $Revision: 1.1 $
43
 * @version    Release: 1.5.4  File: $Revision: 1.2 $
44
 * @link       http://pear.php.net/package/Auth
44
 * @link       http://pear.php.net/package/Auth
45
 * @since      Class available since Release 1.3.0
45
 * @since      Class available since Release 1.3.0
46
 */
46
 */
47
class Auth_Anonymous extends Auth 
47
class Auth_Anonymous extends Auth
Line 48... Line 48...
48
{
48
{
Line 49... Line 49...
49
 
49
 
Line 63... Line 63...
63
     */
63
     */
64
    var $anonymous_username = 'anonymous';
64
    var $anonymous_username = 'anonymous';
Line 65... Line 65...
65
 
65
 
66
    // }}}
66
    // }}}
67
    // {{{ Auth_Anonymous() [constructor]
67
    // {{{ Auth_Anonymous() [constructor]
68
    
68
 
69
    /**
69
    /**
70
     * Pass all parameters to Parent Auth class
70
     * Pass all parameters to Parent Auth class
71
     * 
71
     *
72
     * Set up the storage driver.
72
     * Set up the storage driver.
73
     *
73
     *
74
     * @param string    Type of the storage driver
74
     * @param string    Type of the storage driver
75
     * @param mixed     Additional options for the storage driver
75
     * @param mixed     Additional options for the storage driver
Line 85... Line 85...
85
        parent::Auth($storageDriver, $options, $loginFunction, $showLogin);
85
        parent::Auth($storageDriver, $options, $loginFunction, $showLogin);
86
    }
86
    }
Line 87... Line 87...
87
 
87
 
88
    // }}}
88
    // }}}
89
    // {{{ login()
89
    // {{{ login()
90
    
90
 
91
    /**
91
    /**
92
     * Login function
92
     * Login function
93
     * 
93
     *
94
     * If no username & password is passed then login as the username
94
     * If no username & password is passed then login as the username
95
     * provided in $this->anonymous_username else call standard login()
95
     * provided in $this->anonymous_username else call standard login()
96
     * function.
96
     * function.
97
     *
97
     *
98
     * @return void
98
     * @return void
99
     * @access private
99
     * @access private
100
     * @see Auth::login()
100
     * @see Auth::login()
101
     */
101
     */
102
    function login() {
102
    function login() {
103
        if (   $this->allow_anonymous 
103
        if (   $this->allow_anonymous
104
            && empty($this->username) 
104
            && empty($this->username)
105
            && empty($this->password) ) {
105
            && empty($this->password) ) {
106
            $this->setAuth($this->anonymous_username);
106
            $this->setAuth($this->anonymous_username);
107
            if (is_callable($this->loginCallback)) {
107
            if (is_callable($this->loginCallback)) {
108
                call_user_func_array($this->loginCallback, array($this->username, $this) );
108
                call_user_func_array($this->loginCallback, array($this->username, $this) );
Line 113... Line 113...
113
        }
113
        }
114
    }
114
    }
Line 115... Line 115...
115
 
115
 
116
    // }}}
116
    // }}}
117
    // {{{ forceLogin()
117
    // {{{ forceLogin()
118
    
118
 
119
    /**
119
    /**
120
     * Force the user to login
120
     * Force the user to login
121
     *
121
     *
122
     * Calling this function forces the user to provide a real username and
122
     * Calling this function forces the user to provide a real username and