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 stores the reported bug 19 * 20 * @package MantisBT 21 * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 22 * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net 23 * @link http://www.mantisbt.org 24 * 25 * @uses core.php 26 * @uses api_token_api.php 27 * @uses string_api.php 28 */ 29 30require_once( 'core.php' ); 31require_api( 'api_token_api.php' ); 32require_api( 'string_api.php' ); 33 34form_security_validate( 'create_api_token_form' ); 35 36auth_ensure_user_authenticated(); 37auth_reauthenticate(); 38 39$f_token_name = gpc_get_string( 'token_name' ); 40 41$t_user_id = auth_get_current_user_id(); 42 43user_ensure_unprotected( $t_user_id ); 44 45if( !api_token_can_create() ) { 46 access_denied(); 47} 48 49$t_token = api_token_create( $f_token_name, $t_user_id ); 50$t_disclose_message = lang_get( 'api_token_disclose_message' ); 51$t_display_once_message = lang_get( 'api_token_displayed_once' ); 52 53 54layout_page_header( lang_get( 'api_tokens_link' ) ); 55 56layout_page_begin(); 57?> 58 59<div class="col-md-12 col-xs-12"> 60<h2><?php echo $t_disclose_message ?></h2> 61<div class="lead red"><?php echo $t_display_once_message ?></div> 62<div class="space-10"></div> 63<div class="well"><?php echo string_display_line( $t_token ) ?></div> 64<div class="space-10"></div> 65<?php print_link_button( 'api_tokens_page.php', lang_get( 'api_tokens_link' ) ) ?> 66</div> 67<?php 68layout_page_end(); 69 70