b2evolution PHP Cross Reference Blogging Systems

Source: /inc/users/views/_user_password.form.php - 182 lines - 6067 bytes - Text - Print

Description: This file implements the UI view for the user properties. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the UI view for the user properties.
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * {@internal License choice
  12   * - If you have received this file as part of a package, please find the license.txt file in
  13   *   the same folder or the closest folder above for complete license terms.
  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15   *   then you must choose one of the following licenses before using the file:
  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18   * }}
  19   *
  20   * {@internal Open Source relicensing agreement:
  21   * The Evo Factory grants Francois PLANQUE the right to license
  22   * The Evo Factory's contributions to this file and the b2evolution project
  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  24   *
  25   * Daniel HAHLER grants Francois PLANQUE the right to license
  26   * Daniel HAHLER's contributions to this file and the b2evolution project
  27   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  28   * }}
  29   *
  30   * @package admin
  31   *
  32   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  33   * @author efy-maxim: Evo Factory / Maxim.
  34   * @author fplanque: Francois PLANQUE
  35   * @author blueyed: Daniel HAHLER
  36   *
  37   * @version $Id: _user_password.form.php 6136 2014-03-08 07:59:48Z manuel $
  38   */
  39  
  40  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  41  
  42  /**
  43   * @var instance of GeneralSettings class
  44   */
  45  global $Settings;
  46  /**
  47   * @var instance of User class
  48   */
  49  global $edited_User;
  50  /**
  51   * @var current action
  52   */
  53  global $action;
  54  /**
  55   * @var user permission, if user is only allowed to edit his profile
  56   */
  57  global $user_profile_only;
  58  /**
  59   * @var the action destination of the form (NULL for pagenow)
  60   */
  61  global $form_action;
  62  /**
  63   * @var instance of User class
  64   */
  65  global $current_User;
  66  
  67  global $Session;
  68  
  69  // Default params:
  70  $default_params = array(
  71          'skin_form_params' => array(),
  72      );
  73  
  74  if( isset( $params ) )
  75  {    // Merge with default params
  76      $params = array_merge( $default_params, $params );
  77  }
  78  else
  79  {    // Use a default params
  80      $params = $default_params;
  81  }
  82  
  83  // ------------------- PREV/NEXT USER LINKS -------------------
  84  user_prevnext_links( array(
  85          'block_start'  => '<table class="prevnext_user"><tr>',
  86          'prev_start'   => '<td width="33%">',
  87          'prev_end'     => '</td>',
  88          'prev_no_user' => '<td width="33%">&nbsp;</td>',
  89          'back_start'   => '<td width="33%" class="back_users_list">',
  90          'back_end'     => '</td>',
  91          'next_start'   => '<td width="33%" class="right">',
  92          'next_end'     => '</td>',
  93          'next_no_user' => '<td width="33%">&nbsp;</td>',
  94          'block_end'    => '</tr></table>',
  95          'user_tab'     => 'pwdchange'
  96      ) );
  97  // ------------- END OF PREV/NEXT USER LINKS -------------------
  98  
  99  // check if reqID exists. If exists it means that this form is displayed because a password change request by email.
 100  $reqID = param( 'reqID', 'string', '' );
 101  
 102  $Form = new Form( $form_action, 'user_checkchanges' );
 103  
 104  $Form->switch_template_parts( $params['skin_form_params'] );
 105  
 106  if( !$user_profile_only )
 107  {
 108      echo_user_actions( $Form, $edited_User, $action );
 109  }
 110  
 111  $is_admin = is_admin_page();
 112  if( $is_admin )
 113  {
 114      $form_title = get_usertab_header( $edited_User, 'pwdchange', T_( 'Change password' ) );
 115      $form_class = 'fform';
 116      $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>'."\n";
 117  }
 118  else
 119  {
 120      $form_title = '';
 121      $form_class = 'bComment';
 122  }
 123  
 124  $has_full_access = $current_User->check_perm( 'users', 'edit' );
 125  
 126  
 127  $Form->begin_form( $form_class, $form_title );
 128  
 129      $Form->add_crumb( 'user' );
 130      $Form->hidden_ctrl();
 131      $Form->hidden( 'user_tab', 'pwdchange' );
 132      $Form->hidden( 'password_form', '1' );
 133      $Form->hidden( 'reqID', $reqID );
 134  
 135      $Form->hidden( 'user_ID', $edited_User->ID );
 136      $Form->hidden( 'edited_user_login', $edited_User->login );
 137      if( isset( $Blog ) )
 138      {
 139          $Form->hidden( 'blog', $Blog->ID );
 140      }
 141  
 142      /***************  Password  **************/
 143  
 144  if( $action != 'view' )
 145  { // We can edit the values:
 146  
 147      $Form->begin_fieldset( $is_admin ? T_('Password') : '', array( 'class'=>'fieldset clear' ) );
 148  
 149          // current password is not required:
 150          //   - current user has full access and not editing his own pasword
 151          //   - password change requested by email
 152          if( !( ( $has_full_access && $edited_User->ID != $current_User->ID ) || ( !empty( $reqID ) && $reqID == $Session->get( 'core.changepwd.request_id' ) ) ) )
 153          {
 154              $Form->password_input( 'current_user_pass', '', 20, T_('Current password'), array( 'maxlength' => 50, 'required' => ($edited_User->ID == 0), 'autocomplete'=>'off' ) );
 155          }
 156          $Form->password_input( 'edited_user_pass1', '', 20, T_('New password'), array( 'note' => sprintf( T_('Minimum length: %d characters.'), $Settings->get('user_minpwdlen') ), 'maxlength' => 50, 'required' => ($edited_User->ID == 0), 'autocomplete'=>'off' ) );
 157          $Form->password_input( 'edited_user_pass2', '', 20, T_('Confirm new password'), array( 'maxlength' => 50, 'required' => ($edited_User->ID == 0), 'autocomplete'=>'off' ) );
 158  
 159      $Form->end_fieldset();
 160  }
 161  
 162      /***************  Buttons  **************/
 163  
 164  if( $action != 'view' )
 165  { // Edit buttons
 166      $Form->buttons( array( array( '', 'actionArray[update]', T_('Change password!'), 'SaveButton' ) ) );
 167  }
 168  
 169      $Form->info( '', '<div><a href="'.regenerate_url( 'disp', 'disp=profile' ).'">'.T_( 'Abandon password change' ).'</a></div>' );
 170  
 171  
 172  $Form->end_form();
 173  
 174  // Display javascript password strength indicator bar
 175  display_password_indicator( array(
 176              'pass1-id'    => 'edited_user_pass1',
 177              'pass2-id'    => 'edited_user_pass2',
 178              'login-id'    => 'edited_user_login',
 179              'field-width' => 165,
 180      ) );
 181  
 182  ?>

title

Description

title

Description

title

Description

title

title

Body