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 * A webservice interface to Mantis Bug Tracker 19 * 20 * @package MantisBT 21 * @copyright Copyright MantisBT Team - mantisbt-dev@lists.sourceforge.net 22 * @link http://www.mantisbt.org 23 */ 24 25$g_app->group('/config', function() use ( $g_app ) { 26 $g_app->get( '', 'rest_config_get' ); 27 $g_app->get( '/', 'rest_config_get' ); 28}); 29 30/** 31 * A method that does the work to handle getting a set of configs via REST API. 32 * 33 * @param \Slim\Http\Request $p_request The request. 34 * @param \Slim\Http\Response $p_response The response. 35 * @param array $p_args Arguments 36 * @return \Slim\Http\Response The augmented response. 37 */ 38function rest_config_get( \Slim\Http\Request $p_request, \Slim\Http\Response $p_response, array $p_args ) { 39 $t_data = array( 40 'query' => array( 41 'option' => $p_request->getParam( 'option' ), 42 'project_id' => $p_request->getParam( 'project_id' ), 43 'user_id' => $p_request->getParam( 'user_id' ), 44 ) 45 ); 46 47 $t_command = new ConfigsGetCommand( $t_data ); 48 $t_result = $t_command->execute( $t_data ); 49 50 return $p_response->withStatus( HTTP_STATUS_SUCCESS )->withJson( $t_result ); 51} 52 53