[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> account_prof_menu_page.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   * This page allows users to add a new profile which is POSTed to
  19   * account_prof_add.php
  20   *
  21   * Users can also manage their profiles
  22   *
  23   * @package MantisBT
  24   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  25   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  26   * @link http://www.mantisbt.org
  27   *
  28   * @uses core.php
  29   * @uses access_api.php
  30   * @uses authentication_api.php
  31   * @uses config_api.php
  32   * @uses constant_inc.php
  33   * @uses current_user_api.php
  34   * @uses form_api.php
  35   * @uses html_api.php
  36   * @uses lang_api.php
  37   * @uses print_api.php
  38   * @uses profile_api.php
  39   */
  40  
  41  /**
  42   * MantisBT Core API's
  43   */
  44  require_once ( 'core.php' );
  45  require_api( 'access_api.php' );
  46  require_api( 'authentication_api.php' );
  47  require_api( 'config_api.php' );
  48  require_api( 'constant_inc.php' );
  49  require_api( 'current_user_api.php' );
  50  require_api( 'form_api.php' );
  51  require_api( 'html_api.php' );
  52  require_api( 'lang_api.php' );
  53  require_api( 'print_api.php' );
  54  require_api( 'profile_api.php' );
  55  
  56  if ( !config_get( 'enable_profiles' ) ) {
  57      trigger_error( ERROR_ACCESS_DENIED, ERROR );
  58  }
  59  
  60  if ( isset( $g_global_profiles ) ) {
  61      $g_global_profiles = true;
  62  } else {
  63      $g_global_profiles = false;
  64  }
  65  
  66  auth_ensure_user_authenticated();
  67  
  68  current_user_ensure_unprotected();
  69  
  70  if ( $g_global_profiles ) {
  71      access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
  72  } else {
  73      access_ensure_global_level( config_get( 'add_profile_threshold' ) );
  74  }
  75  
  76  html_page_top( lang_get( 'manage_profiles_link' ) );
  77  
  78  if ( $g_global_profiles ) {
  79      print_manage_menu( 'manage_prof_menu_page.php' );
  80  }
  81  
  82  if ( $g_global_profiles ) {
  83      $t_user_id = ALL_USERS;
  84  } else {
  85      $t_user_id = auth_get_current_user_id();
  86  }
  87  
  88  # Add Profile Form BEGIN
  89  ?>
  90  <div id="account-profile-div" class="form-container">
  91      <form id="account-profile-form" method="post" action="account_prof_update.php">
  92          <fieldset class="has-required">
  93              <legend><span><?php echo lang_get( 'add_profile_title' ) ?></span></legend>
  94              <?php  echo form_security_field( 'profile_update' )?>
  95              <input type="hidden" name="action" value="add" />
  96              <input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
  97              <?php
  98              if ( !$g_global_profiles ) {
  99                  print_account_menu( 'account_prof_menu_page.php' );
 100              }
 101              ?>
 102              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 103                  <label for="platform" class="required"><span><?php echo lang_get( 'platform' ) ?></span></label>
 104                  <span class="input"><input id="platform" type="text" name="platform" size="32" maxlength="32" /></span>
 105                  <span class="label-style"></span>
 106              </div>
 107              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 108                  <label for="os" class="required"><span><?php echo lang_get( 'operating_system' ) ?></span></label>
 109                  <span class="input"><input id="os" type="text" name="os" size="32" maxlength="32" /></span>
 110                  <span class="label-style"></span>
 111              </div>
 112              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 113                  <label for="os-version" class="required"><span><?php echo lang_get( 'os_version' ) ?></span></label>
 114                  <span class="input"><input id="os-version" type="text" name="os_build" size="16" maxlength="16" /></span>
 115                  <span class="label-style"></span>
 116              </div>
 117              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 118                  <label for="description"><span><?php echo lang_get( 'additional_description' ) ?></span></label>
 119                  <span class="textarea"><textarea id="description" name="description" cols="80" rows="8"></textarea></span>
 120                  <span class="label-style"></span>
 121              </div>
 122              <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'add_profile_button' ) ?>" /></span>
 123          </fieldset>
 124      </form>
 125  </div>
 126  <?php
 127      # Add Profile Form END
 128      # Edit or Delete Profile Form BEGIN
 129  
 130      $t_profiles = profile_get_all_for_user( $t_user_id );
 131      if( $t_profiles ) {
 132  ?>
 133  
 134  <div id="account-profile-update-div" class="form-container">
 135      <form id="account-profile-update-form" method="post" action="account_prof_update.php">
 136          <fieldset>
 137              <legend><span><?php echo lang_get( 'edit_or_delete_profiles_title' ) ?></span></legend>
 138              <?php  echo form_security_field( 'profile_update' )?>
 139              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 140                  <label for="action-edit"><span><?php echo lang_get( 'edit_profile' ) ?></span></label>
 141                  <span class="input"><input id="action-edit" type="radio" name="action" value="edit" /></span>
 142                  <span class="label-style"></span>
 143              </div>
 144              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 145                  <?php if ( !$g_global_profiles ) { ?>
 146                  <label for="action-default"><span><?php echo lang_get( 'make_default' ) ?></span></label>
 147                  <span class="input"><input id="action-default" type="radio" name="action" value="make_default" /></span>
 148                  <?php } ?>
 149                  <span class="label-style"></span>
 150              </div>
 151              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 152                  <label for="action-delete"><span><?php echo lang_get( 'delete_profile' ) ?></span></label>
 153                  <span class="input"><input id="action-delete" type="radio" name="action" value="delete" /></span>
 154                  <span class="label-style"></span>
 155              </div>
 156              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 157                  <label for="select-profile"><span><?php echo lang_get( 'select_profile' ) ?></span></label>
 158                  <span class="input">
 159                      <select id="select-profile" name="profile_id">
 160                          <?php print_profile_option_list( $t_user_id, '', $t_profiles ) ?>
 161                      </select>
 162                  </span>
 163                  <span class="label-style"></span>
 164              </div>
 165              <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'submit_button' ) ?>" /></span>
 166          </fieldset>
 167      </form>
 168  </div>
 169  <?php
 170  } # Edit or Delete Profile Form END
 171  
 172  html_page_bottom();


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