[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/admin/check/ -> check_anonymous_inc.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   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.
   8  #
   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.
  13  #
  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/>.
  16  
  17  /**
  18   * @package MantisBT
  19   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   *
  23   * @uses check_api.php
  24   * @uses config_api.php
  25   * @uses user_api.php
  26   */
  27  
  28  if ( !defined( 'CHECK_ANONYMOUS_INC_ALLOW' ) ) {
  29      return;
  30  }
  31  
  32  /**
  33   * MantisBT Check API
  34   */
  35  require_once ( 'check_api.php' );
  36  require_api( 'config_api.php' );
  37  require_api( 'user_api.php' );
  38  
  39  check_print_section_header_row( 'Anonymous access' );
  40  
  41  $t_anonymous_access_enabled = config_get_global( 'allow_anonymous_login' );
  42  check_print_info_row(
  43      'Anonymous access is enabled',
  44      $t_anonymous_access_enabled ? 'Yes' : 'No'
  45  );
  46  
  47  if( !$t_anonymous_access_enabled ) {
  48      return;
  49  }
  50  
  51  $t_anonymous_account = config_get_global( 'anonymous_account' );
  52  check_print_test_row(
  53      'anonymous_account configuration option is specified',
  54      $t_anonymous_account !== '',
  55      array(
  56          true => 'The account currently being used for anonymous access is: ' . htmlentities( $t_anonymous_account ),
  57          false => 'The anonymous_account configuration option must specify the username of an account to use for anonymous logins.'
  58      )
  59  );
  60  
  61  if( $t_anonymous_account === '' ) {
  62      return;
  63  }
  64  
  65  $t_anonymous_user_id = user_get_id_by_name( $t_anonymous_account );
  66  check_print_test_row(
  67      'anonymous_account is a valid user account',
  68      $t_anonymous_user_id !== false,
  69      array( false => 'You need to specify a valid user account to use with the anonymous_account configuration options.' )
  70  );
  71  
  72  check_print_test_row(
  73      'anonymous_account user has the enabled flag set',
  74      user_is_enabled( $t_anonymous_user_id ),
  75      array( false => 'The anonymous user account must be enabled before it can be used.' )
  76  );
  77  
  78  check_print_test_row(
  79      'anonymous_account user has the protected flag set',
  80      user_get_field( $t_anonymous_user_id, 'protected' ),
  81      array( false => 'The anonymous user account needs to have the protected flag set to prevent anonymous users modifying the account.' )
  82  );
  83  
  84  check_print_test_row(
  85      'anonymous_account user does not have administrator permissions',
  86      !user_is_administrator( $t_anonymous_user_id ),
  87      array(
  88          true => 'The anonymous user account currently has an access level of: ' . htmlentities( get_enum_element( 'access_levels', user_get_access_level( $t_anonymous_user_id ) ) ),
  89          false => 'The anonymous user account should not have administrator level permissions.'
  90      )
  91  );


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7