| [ 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 * Prepare API 19 * 20 * Handles preparation of strings prior to be printed or stored. 21 * 22 * @package CoreAPI 23 * @subpackage PrepareAPI 24 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 25 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 26 * @link http://www.mantisbt.org 27 * 28 * @uses access_api.php 29 * @uses config_api.php 30 * @uses constant_inc.php 31 * @uses string_api.php 32 * @uses user_api.php 33 * @uses version_api.php 34 */ 35 36 require_api( 'access_api.php' ); 37 require_api( 'config_api.php' ); 38 require_api( 'constant_inc.php' ); 39 require_api( 'string_api.php' ); 40 require_api( 'user_api.php' ); 41 require_api( 'version_api.php' ); 42 43 /** 44 * return the mailto: href string link 45 * @param string $p_email 46 * @param string $p_text 47 * @return string 48 */ 49 function prepare_email_link( $p_email, $p_text ) { 50 if( !access_has_project_level( config_get( 'show_user_email_threshold' ) ) ) { 51 return string_display_line( $p_text ); 52 } 53 54 # If we apply string_url() to the whole mailto: link then the @ 55 # gets turned into a %40 and you can't right click in browsers to 56 # do Copy Email Address. 57 $t_mailto = string_attribute( 'mailto:' . $p_email ); 58 $p_text = string_display_line( $p_text ); 59 60 return '<a href="' . $t_mailto . '">' . $p_text . '</a>'; 61 } 62 63 /** 64 * prepares the name of the user given the id. also makes it an email link. 65 * @param int $p_user_id 66 * @return string 67 */ 68 function prepare_user_name( $p_user_id ) { 69 # Catch a user_id of NO_USER (like when a handler hasn't been assigned) 70 if( NO_USER == $p_user_id ) { 71 return ''; 72 } 73 74 $t_username = user_get_name( $p_user_id ); 75 $t_username = string_display_line( $t_username ); 76 if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) { 77 return '<a class="user" href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>'; 78 } else { 79 return '<del class="user">' . $t_username . '</del>'; 80 } 81 } 82 83 /** 84 * A function that prepares the version string for outputting to the user on view / print issue pages. 85 * This function would add the version date, if appropriate. 86 * 87 * @param integer $p_project_id The project id. 88 * @param integer $p_version_id The version id. If false then this method will return an empty string. 89 * @return The formatted version string. 90 */ 91 function prepare_version_string( $p_project_id, $p_version_id ) { 92 if ( $p_version_id === false ) { 93 return ''; 94 } 95 96 $t_version_text = version_full_name( $p_version_id, /* showProject */ null, $p_project_id ); 97 98 if ( access_has_project_level( config_get( 'show_version_dates_threshold' ), $p_project_id ) ) { 99 $t_short_date_format = config_get( 'short_date_format' ); 100 101 $t_version = version_get( $p_version_id ); 102 $t_version_text .= ' (' . date( $t_short_date_format, $t_version->date_order ) . ')'; 103 } 104 105 return $t_version_text; 106 }
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 |