ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Anonymous.php
Go to the documentation of this file.
1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
29require_once 'Auth.php';
30
47class Auth_Anonymous extends Auth
48{
49
50 // {{{ properties
51
57 var $allow_anonymous = true;
58
64 var $anonymous_username = 'anonymous';
65
66 // }}}
67 // {{{ Auth_Anonymous() [constructor]
68
84 function Auth_Anonymous($storageDriver, $options = '', $loginFunction = '', $showLogin = true) {
85 parent::Auth($storageDriver, $options, $loginFunction, $showLogin);
86 }
87
88 // }}}
89 // {{{ login()
90
102 function login() {
103 if ( $this->allow_anonymous
104 && empty($this->username)
105 && empty($this->password) ) {
106 $this->setAuth($this->anonymous_username);
107 if (is_callable($this->loginCallback)) {
108 call_user_func_array($this->loginCallback, array($this->username, $this) );
109 }
110 } else {
111 // Call normal login system
112 parent::login();
113 }
114 }
115
116 // }}}
117 // {{{ forceLogin()
118
127 function forceLogin() {
128 $this->allow_anonymous = false;
129 if( !empty($this->session['username']) && $this->session['username'] == $this->anonymous_username ) {
130 $this->logout();
131 }
132 }
133
134 // }}}
135
136}
137
138?>
forceLogin()
Force the user to login.
Definition: Anonymous.php:127
login()
Login function.
Definition: Anonymous.php:102
Auth_Anonymous($storageDriver, $options='', $loginFunction='', $showLogin=true)
Pass all parameters to Parent Auth class.
Definition: Anonymous.php:84
setAuth($username)
Register variable in a session telling that the user has logged in successfully.
Definition: Auth.php:823
$loginFunction
Definition: Auth.php:145
$showLogin
Definition: Auth.php:153
logout()
Logout function.
Definition: Auth.php:1077
if(!is_array($argv)) $options