| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
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 * XMLHttpRequest API 19 * 20 * @package CoreAPI 21 * @subpackage XMLHttpRequestAPI 22 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 23 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 24 * @link http://www.mantisbt.org 25 * 26 * @uses access_api.php 27 * @uses bug_api.php 28 * @uses config_api.php 29 * @uses constant_inc.php 30 * @uses gpc_api.php 31 * @uses print_api.php 32 * @uses profile_api.php 33 */ 34 35 require_api( 'access_api.php' ); 36 require_api( 'bug_api.php' ); 37 require_api( 'config_api.php' ); 38 require_api( 'constant_inc.php' ); 39 require_api( 'gpc_api.php' ); 40 require_api( 'print_api.php' ); 41 require_api( 'profile_api.php' ); 42 43 /** 44 * Filter a set of strings by finding strings that start with a case-insensitive prefix. 45 * @param array $p_set An array of strings to search through. 46 * @param string $p_prefix The prefix to filter by. 47 * @return array An array of strings which match the supplied prefix. 48 */ 49 function xmlhttprequest_filter_by_prefix( $p_set, $p_prefix ) { 50 $t_matches = array(); 51 foreach ( $p_set as $p_item ) { 52 if ( utf8_strtolower( utf8_substr( $p_item, 0, utf8_strlen( $p_prefix ) ) ) === utf8_strtolower( $p_prefix ) ) { 53 $t_matches[] = $p_item; 54 } 55 } 56 return $t_matches; 57 } 58 59 /** 60 * Echos a serialized list of platforms starting with the prefix specified in the $_POST 61 * @return null 62 * @access public 63 */ 64 function xmlhttprequest_platform_get_with_prefix() { 65 $f_platform = gpc_get_string( 'platform' ); 66 67 $t_unique_entries = profile_get_field_all_for_user( 'platform' ); 68 $t_matching_entries = xmlhttprequest_filter_by_prefix( $t_unique_entries, $f_platform ); 69 70 echo json_encode( $t_matching_entries ); 71 } 72 73 /** 74 * Echos a serialized list of OSes starting with the prefix specified in the $_POST 75 * @return null 76 * @access public 77 */ 78 function xmlhttprequest_os_get_with_prefix() { 79 $f_os = gpc_get_string( 'os' ); 80 81 $t_unique_entries = profile_get_field_all_for_user( 'os' ); 82 $t_matching_entries = xmlhttprequest_filter_by_prefix( $t_unique_entries, $f_os ); 83 84 echo json_encode( $t_matching_entries ); 85 } 86 87 /** 88 * Echos a serialized list of OS Versions starting with the prefix specified in the $_POST 89 * @return null 90 * @access public 91 */ 92 function xmlhttprequest_os_build_get_with_prefix() { 93 $f_os_build = gpc_get_string( 'os_build' ); 94 95 $t_unique_entries = profile_get_field_all_for_user( 'os_build' ); 96 $t_matching_entries = xmlhttprequest_filter_by_prefix( $t_unique_entries, $f_os_build ); 97 98 echo json_encode( $t_matching_entries ); 99 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |