Fix bug when user not in ldap
[mantis.git] / login_anon.php
blob0632b2082e4bb2ccd31ebf37802907fe3d1cfe09
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * login_anon.php logs a user in anonymously without having to enter a username
19 * or password.
21 * Depends on two global configuration variables:
22 * allow_anonymous_login - bool which must be true to allow anonymous login.
23 * anonymous_account - name of account to login with.
25 * TODO:
26 * Check how manage account is impacted.
27 * Might be extended to allow redirects for bug links etc.
29 * @package MantisBT
30 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
31 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
32 * @link http://www.mantisbt.org
34 * @uses core.php
35 * @uses config_api.php
36 * @uses gpc_api.php
37 * @uses print_api.php
38 * @uses string_api.php
41 /**
42 * MantisBT Core API's
44 require_once( 'core.php' );
45 require_api( 'config_api.php' );
46 require_api( 'gpc_api.php' );
47 require_api( 'print_api.php' );
48 require_api( 'string_api.php' );
50 $f_return = gpc_get_string( 'return', '' );
52 $t_anonymous_account = config_get( 'anonymous_account' );
54 if ( $f_return !== '' ) {
55 $t_return = string_url( string_sanitize_url( $f_return ) );
56 print_header_redirect( "login.php?username=$t_anonymous_account&perm_login=false&return=$t_return" );
57 } else {
58 print_header_redirect( "login.php?username=$t_anonymous_account&perm_login=false" );