[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> tag_update.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   * @package MantisBT
  19   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  20   * @link http://www.mantisbt.org
  21   *
  22   * @uses core.php
  23   * @uses access_api.php
  24   * @uses authentication_api.php
  25   * @uses compress_api.php
  26   * @uses config_api.php
  27   * @uses form_api.php
  28   * @uses gpc_api.php
  29   * @uses print_api.php
  30   * @uses tag_api.php
  31   * @uses user_api.php
  32   */
  33  
  34  /**
  35   * MantisBT Core API's
  36   */
  37  require_once ( 'core.php' );
  38  require_api( 'access_api.php' );
  39  require_api( 'authentication_api.php' );
  40  require_api( 'compress_api.php' );
  41  require_api( 'config_api.php' );
  42  require_api( 'form_api.php' );
  43  require_api( 'gpc_api.php' );
  44  require_api( 'print_api.php' );
  45  require_api( 'tag_api.php' );
  46  require_api( 'user_api.php' );
  47  
  48  form_security_validate( 'tag_update' );
  49  
  50  compress_enable();
  51  
  52  $f_tag_id = gpc_get_int( 'tag_id' );
  53  $t_tag_row = tag_get( $f_tag_id );
  54  
  55  if ( !( access_has_global_level( config_get( 'tag_edit_threshold' ) )
  56      || ( auth_get_current_user_id() == $t_tag_row['user_id'] )
  57          && access_has_global_level( config_get( 'tag_edit_own_threshold' ) ) ) )
  58  {
  59      access_denied();
  60  }
  61  
  62  if ( access_has_global_level( config_get( 'tag_edit_threshold' ) ) ) {
  63      $f_new_user_id = gpc_get_int( 'user_id', $t_tag_row['user_id'] );
  64  } else {
  65      $f_new_user_id = $t_tag_row['user_id'];
  66  }
  67  
  68  $f_new_name = gpc_get_string( 'name', $t_tag_row['name'] );
  69  $f_new_description = gpc_get_string( 'description', $t_tag_row['description'] );
  70  
  71  $t_update = false;
  72  
  73  if ( $t_tag_row['user_id'] != $f_new_user_id ) {
  74      user_ensure_exists( $f_new_user_id );
  75      $t_update = true;
  76  }
  77  
  78  if ( $t_tag_row['name'] != $f_new_name ||
  79       $t_tag_row['description'] != $f_new_description ) {
  80  
  81      $t_update = true;
  82  }
  83  
  84  tag_update( $f_tag_id, $f_new_name, $f_new_user_id, $f_new_description );
  85  
  86  form_security_purge( 'tag_update' );
  87  
  88  $t_url = 'tag_view_page.php?tag_id='.$f_tag_id;
  89  print_successful_redirect( $t_url );


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