[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> account_page.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: account_page.php,v 1.52.2.1 2007-10-13 22:32:01 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      # CALLERS
  25      #    This page is called from:
  26      #    - print_menu()
  27      #    - print_account_menu()
  28      #    - header redirects from account_*.php
  29      #   - included by verify.php to allow user to change their password
  30  
  31      # EXPECTED BEHAVIOUR
  32      #    - Display the user's current settings
  33      #    - Allow the user to edit their settings
  34      #    - Allow the user to save their changes
  35      #    - Allow the user to delete their account if account deletion is enabled
  36  
  37      # CALLS
  38      #    This page calls the following pages:
  39      #    - account_update.php  (to save changes)
  40      #    - account_delete.php  (to delete the user's account)
  41  
  42      # RESTRICTIONS & PERMISSIONS
  43      #    - User must be authenticated
  44      #    - The user's account must not be protected
  45  
  46      require_once ( 'core.php' );
  47  
  48      $t_core_path = config_get( 'core_path' );
  49  
  50      require_once( $t_core_path.'current_user_api.php' );
  51  
  52      #============ Parameters ============
  53      # (none)
  54  
  55      #============ Permissions ============
  56      auth_ensure_user_authenticated();
  57  
  58      current_user_ensure_unprotected();
  59  ?>
  60  <?php
  61  
  62      # extracts the user information for the currently logged in user
  63      # and prefixes it with u_
  64      $row = user_get_row( auth_get_current_user_id() );
  65      extract( $row, EXTR_PREFIX_ALL, 'u' );
  66  
  67      $t_ldap = ( LDAP == config_get( 'login_method' ) );
  68  
  69      # In case we're using LDAP to get the email address... this will pull out
  70      #  that version instead of the one in the DB
  71      $u_email = user_get_email( $u_id, $u_username );
  72      
  73      # note if we are being included by a script of a different name, if so,
  74      #  this is a mandatory password change request
  75      $t_force_pw_reset = is_page_name( 'verify.php' );
  76  
  77      html_page_top1( lang_get( 'account_link' ) );
  78      html_page_top2();
  79  ?>
  80  
  81  <!-- # Edit Account Form BEGIN -->
  82  <br />
  83  <?php if ( $t_force_pw_reset ) { ?>
  84  <center><div style="color:red; width:75%">
  85          <?php 
  86              echo lang_get( 'verify_warning' ); 
  87              if ( helper_call_custom_function( 'auth_can_change_password', array() ) ) {
  88                  echo '<br />' . lang_get( 'verify_change_password' );
  89              }
  90          ?>
  91  </div></center>
  92  <br />
  93  <?php } ?>
  94  <div align="center">
  95  <form method="post" action="account_update.php">
  96  <table class="width75" cellspacing="1">
  97  
  98      <!-- Headings -->
  99      <tr>
 100          <td class="form-title">
 101              <?php echo lang_get( 'edit_account_title' ) ?>
 102          </td>
 103          <td class="right">
 104              <?php print_account_menu( 'account_page.php' ) ?>
 105          </td>
 106      </tr>
 107  
 108  <?php if ( !helper_call_custom_function( 'auth_can_change_password', array() ) ) { ?> <!-- With LDAP -->
 109  
 110      <!-- Username -->
 111      <tr class="row-1">
 112          <td class="category" width="25%">
 113              <?php echo lang_get( 'username' ) ?>
 114          </td>
 115          <td width="75%">
 116              <?php echo $u_username ?>
 117          </td>
 118      </tr>
 119  
 120      <!-- Password -->
 121      <tr class="row-2">
 122          <td class="category">
 123              <?php echo lang_get( 'password' ) ?>
 124          </td>
 125          <td>
 126              <?php echo lang_get( 'no_password_change' ) ?>
 127          </td>
 128      </tr>
 129  
 130  <?php } else { ?> <!-- Without LDAP -->
 131  
 132      <!-- Username -->
 133      <tr class="row-1">
 134          <td class="category" width="25%">
 135              <?php echo lang_get( 'username' ) ?>
 136          </td>
 137          <td width="75%">
 138              <?php echo $u_username ?>
 139          </td>
 140      </tr>
 141  
 142      <!-- Password -->
 143      <tr class="row-2">
 144          <td class="category">
 145              <?php echo lang_get( 'password' ) ?>
 146              <?php if ( $t_force_pw_reset ) { ?>
 147              <span class="required">*</span>
 148              <?php } ?>
 149          </td>
 150          <td>
 151              <input type="password" size="32" maxlength="32" name="password" />
 152          </td>
 153      </tr>
 154  
 155      <!-- Password confirmation -->
 156      <tr class="row-1">
 157          <td class="category">
 158              <?php echo lang_get( 'confirm_password' ) ?>
 159              <?php if ( $t_force_pw_reset ) { ?>
 160              <span class="required">*</span>
 161              <?php } ?>
 162          </td>
 163          <td>
 164              <input type="password" size="32" maxlength="32" name="password_confirm" />
 165          </td>
 166      </tr>
 167  
 168  <?php } ?> <!-- End LDAP conditional -->
 169  
 170  <?php if ( $t_ldap && ON == config_get( 'use_ldap_email' ) ) { ?> <!-- With LDAP Email-->
 171  
 172      <!-- Email -->
 173      <tr class="row-1">
 174          <td class="category">
 175              <?php echo lang_get( 'email' ) ?>
 176          </td>
 177          <td>
 178              <?php echo $u_email ?>
 179          </td>
 180      </tr>
 181  
 182  <?php } else { ?> <!-- Without LDAP Email -->
 183  
 184      <!-- Email -->
 185      <tr class="row-2">
 186          <td class="category">
 187              <?php echo lang_get( 'email' ) ?>
 188          </td>
 189          <td>
 190              <?php print_email_input( 'email', $u_email ) ?>
 191          </td>
 192      </tr>
 193  
 194  <?php } ?> <!-- End LDAP Email conditional -->
 195  
 196      <!-- Realname -->
 197      <tr class="row-1" valign="top">
 198          <td class="category">
 199              <?php echo lang_get( 'realname' ) ?>
 200          </td>
 201          <td>
 202              <input type="text" size="32" maxlength="64" name="realname" value="<?php echo string_attribute( $u_realname ) ?>" />
 203          </td>
 204      </tr>
 205  
 206      <!-- Access level -->
 207      <tr class="row-2">
 208          <td class="category">
 209              <?php echo lang_get( 'access_level' ) ?>
 210          </td>
 211          <td>
 212              <?php echo get_enum_element( 'access_levels', $u_access_level ) ?>
 213          </td>
 214      </tr>
 215  
 216      <!-- Project access level -->
 217      <tr class="row-1">
 218          <td class="category">
 219              <?php echo lang_get( 'access_level_project' ) ?>
 220          </td>
 221          <td>
 222              <?php echo get_enum_element( 'access_levels', current_user_get_access_level() ) ?>
 223          </td>
 224      </tr>
 225  
 226      <!-- Assigned project list -->
 227      <tr class="row-2" valign="top">
 228          <td class="category">
 229              <?php echo lang_get( 'assigned_projects' ) ?>
 230          </td>
 231          <td>
 232              <?php print_project_user_list( auth_get_current_user_id(), false ) ?>
 233          </td>
 234      </tr>
 235  
 236      <!-- BUTTONS -->
 237      <tr>
 238          <td class="left">
 239              <?php if ( $t_force_pw_reset ) { ?>
 240              <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
 241              <?php } ?>
 242          </td>
 243          <!-- Update Button -->
 244          <td>
 245              <input type="submit" class="button" value="<?php echo lang_get( 'update_user_button' ) ?>" />
 246          </td>
 247      </tr>
 248  </table>
 249  </form>
 250  </div>
 251  
 252  <br />
 253  <?php # Delete Account Form BEGIN ?>
 254  <?php
 255      # check if users can't delete their own accounts
 256      if ( ON == config_get( 'allow_account_delete' ) ) {
 257  ?>
 258  
 259  <!-- Delete Button -->
 260  <div class="border-center">
 261      <form method="post" action="account_delete.php">
 262      <input type="submit" class="button" value="<?php echo lang_get( 'delete_account_button' ) ?>" />
 263      </form>
 264  </div>
 265  
 266  <?php } ?>
 267  <?php # Delete Account Form END ?>
 268  
 269  <?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