[ 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 - 2010  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  <br />
  91  <div align="center">
  92  <form method="post" action="account_prof_update.php">
  93  <?php  echo form_security_field( 'profile_update' )?>
  94  <input type="hidden" name="action" value="add" />
  95  <table class="width75" cellspacing="1">
  96  <tr>
  97      <td class="form-title">
  98          <input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
  99          <?php echo lang_get( 'add_profile_title' ) ?>
 100      </td>
 101      <td class="right">
 102      <?php
 103      if ( !$g_global_profiles ) {
 104          print_account_menu( 'account_prof_menu_page.php' );
 105      }
 106      ?>
 107      </td>
 108  </tr>
 109  <tr class="row-1">
 110      <th class="category" width="25%">
 111          <span class="required">*</span><?php echo lang_get( 'platform' ) ?>
 112      </th>
 113      <td width="75%">
 114          <input type="text" name="platform" size="32" maxlength="32" />
 115      </td>
 116  </tr>
 117  <tr class="row-2">
 118      <th class="category">
 119          <span class="required">*</span><?php echo lang_get( 'operating_system' ) ?>
 120      </th>
 121      <td>
 122          <input type="text" name="os" size="32" maxlength="32" />
 123      </td>
 124  </tr>
 125  <tr class="row-1">
 126      <th class="category">
 127          <span class="required">*</span><?php echo lang_get( 'os_version' ) ?>
 128      </th>
 129      <td>
 130          <input type="text" name="os_build" size="16" maxlength="16" />
 131      </td>
 132  </tr>
 133  <tr class="row-2">
 134      <th class="category">
 135          <?php echo lang_get( 'additional_description' ) ?>
 136      </th>
 137      <td>
 138          <textarea name="description" cols="60" rows="8"></textarea>
 139      </td>
 140  </tr>
 141  <tr>
 142      <td class="left">
 143          <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
 144      </td>
 145      <td class="center">
 146          <input type="submit" class="button" value="<?php echo lang_get( 'add_profile_button' ) ?>" />
 147      </td>
 148  </tr>
 149  </table>
 150  </form>
 151  </div>
 152  <?php
 153      # Add Profile Form END
 154      # Edit or Delete Profile Form BEGIN
 155  
 156      $t_profiles = profile_get_all_for_user( $t_user_id );
 157      if( $t_profiles ) {
 158  ?>
 159  <br />
 160  <div align="center">
 161  <form method="post" action="account_prof_update.php">
 162  <?php  echo form_security_field( 'profile_update' )?>
 163  <table class="width75" cellspacing="1">
 164  <tr>
 165      <td class="form-title" colspan="2">
 166          <?php echo lang_get( 'edit_or_delete_profiles_title' ) ?>
 167      </td>
 168  </tr>
 169  <tr class="row-1">
 170      <td class="center" colspan="2">
 171          <input type="radio" name="action" value="edit" checked="checked" /> <?php echo lang_get( 'edit_profile' ) ?>
 172  <?php
 173      if ( !$g_global_profiles ) {
 174  ?>
 175          <input type="radio" name="action" value="make_default" /> <?php echo lang_get( 'make_default' ) ?>
 176  <?php
 177      }
 178  ?>
 179          <input type="radio" name="action" value="delete" /> <?php echo lang_get( 'delete_profile' ) ?>
 180      </td>
 181  </tr>
 182  <tr class="row-2">
 183      <th class="category" width="25%">
 184          <?php echo lang_get( 'select_profile' ) ?>
 185      </th>
 186      <td width="75%">
 187          <select name="profile_id">
 188              <?php print_profile_option_list( $t_user_id, '', $t_profiles ) ?>
 189          </select>
 190      </td>
 191  </tr>
 192  <tr>
 193      <td class="center" colspan="2">
 194          <input type="submit" class="button" value="<?php echo lang_get( 'submit_button' ) ?>" />
 195      </td>
 196  </tr>
 197  </table>
 198  </form>
 199  </div>
 200  <?php
 201  } # Edit or Delete Profile Form END
 202  
 203  html_page_bottom();


Generated: Tue Sep 7 20:21:43 2010 Cross-referenced by PHPXref 0.7