[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> account_sponsor_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   * This page updates a user's sponsorships
  19   * If an account is protected then changes are forbidden
  20   * The page gets redirected back to account_page.php
  21   *
  22   * @package MantisBT
  23   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  24   * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  25   * @link http://www.mantisbt.org
  26   *
  27   * @uses core.php
  28   * @uses access_api.php
  29   * @uses authentication_api.php
  30   * @uses bug_api.php
  31   * @uses config_api.php
  32   * @uses form_api.php
  33   * @uses gpc_api.php
  34   * @uses html_api.php
  35   * @uses lang_api.php
  36   * @uses print_api.php
  37   * @uses sponsorship_api.php
  38   */
  39  
  40  /**
  41   * MantisBT Core API's
  42   */
  43  require_once ( 'core.php' );
  44  require_api( 'access_api.php' );
  45  require_api( 'authentication_api.php' );
  46  require_api( 'bug_api.php' );
  47  require_api( 'config_api.php' );
  48  require_api( 'form_api.php' );
  49  require_api( 'gpc_api.php' );
  50  require_api( 'html_api.php' );
  51  require_api( 'lang_api.php' );
  52  require_api( 'print_api.php' );
  53  require_api( 'sponsorship_api.php' );
  54  
  55  if ( !config_get( 'enable_sponsorship' ) ) {
  56      trigger_error( ERROR_SPONSORSHIP_NOT_ENABLED, ERROR );
  57  }
  58  
  59  form_security_validate( 'account_sponsor_update' );
  60  
  61  auth_ensure_user_authenticated();
  62  
  63  $f_bug_list = gpc_get_string( 'buglist', '' );
  64  $t_bug_list = explode( ',', $f_bug_list );
  65  
  66  foreach ( $t_bug_list as $t_bug ) {
  67      list( $t_bug_id, $t_sponsor_id ) = explode( ':', $t_bug );
  68      $c_bug_id = (int) $t_bug_id;
  69  
  70      bug_ensure_exists( $c_bug_id ); # dies if bug doesn't exist
  71  
  72      access_ensure_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $c_bug_id ); # dies if user can't handle bug
  73  
  74      $t_bug = bug_get( $c_bug_id );
  75      $t_sponsor = sponsorship_get( (int) $t_sponsor_id );
  76  
  77      $t_new_payment = gpc_get_int( 'sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid );
  78      if ( $t_new_payment != $t_sponsor->paid ) {
  79          sponsorship_update_paid( $t_sponsor_id, $t_new_payment );
  80      }
  81  }
  82  
  83  form_security_purge( 'account_sponsor_update' );
  84  
  85  $t_redirect = 'account_sponsor_page.php';
  86  html_page_top( null, $t_redirect );
  87  
  88  echo '<br /><div align="center">';
  89  
  90  echo lang_get( 'payment_updated' ) . '<br />';
  91  
  92  echo lang_get( 'operation_successful' ) . '<br />';
  93  print_bracket_link( $t_redirect, lang_get( 'proceed' ) );
  94  echo '</div>';
  95  html_page_bottom();


Generated: Fri Sep 3 00:31:45 2010 Cross-referenced by PHPXref 0.7