[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> manage_user_create.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: manage_user_create.php,v 1.26.2.1 2007-10-13 22:33:51 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      require_once ( 'core.php' );
  25  
  26      $t_core_path = config_get( 'core_path' );
  27  
  28      require_once( $t_core_path.'email_api.php' );
  29  
  30      auth_reauthenticate();
  31  
  32      access_ensure_global_level( config_get( 'manage_user_threshold' ) );
  33  
  34      $f_username            = gpc_get_string( 'username' );
  35      $f_realname            = gpc_get_string( 'realname' );
  36      $f_password            = gpc_get_string( 'password', '' );
  37      $f_password_verify    = gpc_get_string( 'password_verify', '' );
  38      $f_email            = gpc_get_string( 'email' );
  39      $f_access_level        = gpc_get_string( 'access_level' );
  40      $f_protected        = gpc_get_bool( 'protected' );
  41      $f_enabled            = gpc_get_bool( 'enabled' );
  42  
  43      # check for empty username
  44      $f_username = trim( $f_username );
  45      if ( is_blank( $f_username ) ) {
  46          trigger_error( ERROR_EMPTY_FIELD, ERROR );
  47      }
  48  
  49      # Check the name for validity here so we do it before promting to use a
  50      #  blank password (don't want to prompt the user if the process will fail
  51      #  anyway)
  52      user_ensure_name_valid( $f_username );
  53      user_ensure_realname_valid( $f_realname );
  54  
  55      if ( $f_password != $f_password_verify ) {
  56          trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR );
  57      }
  58  
  59      $f_email = email_append_domain( $f_email );
  60      email_ensure_not_disposable( $f_email );
  61  
  62      if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) {
  63          # Check code will be sent to the user directly via email. Dummy password set to random
  64          # Create random password
  65          $t_seed = $f_email . $f_username;
  66          $f_password    = auth_generate_random_password( $t_seed );
  67      }
  68      else {
  69          # Password won't to be sent by email. It entered by the admin
  70          # Now, if the password is empty, confirm that that is what we wanted
  71          if ( is_blank( $f_password ) ) {
  72              helper_ensure_confirmed( lang_get( 'empty_password_sure_msg' ),
  73                       lang_get( 'empty_password_button' ) );
  74          }
  75      }
  76  
  77      $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname );
  78  
  79      if ( $t_cookie === false ) {
  80          $t_redirect_url = 'manage_user_page.php';
  81      } else {
  82          # ok, we created the user, get the row again
  83          $t_user_id = user_get_id_by_name( $f_username );
  84          $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $t_user_id;
  85      }
  86  
  87      html_page_top1();
  88      html_meta_redirect( $t_redirect_url );
  89      html_page_top2();
  90  ?>
  91  
  92  <br />
  93  <div align="center">
  94  <?php
  95      $t_access_level = get_enum_element( 'access_levels', $f_access_level );
  96      echo lang_get( 'created_user_part1' ) . ' <span class="bold">' . $f_username . '</span> ' . lang_get( 'created_user_part2' ) . ' <span class="bold">' . $t_access_level . '</span><br />';
  97  
  98      print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
  99  ?>
 100  </div>
 101  
 102  <?php html_page_bottom1( __FILE__ ) ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics