| [ 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 * @package MantisBT 19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 * 23 * @uses check_api.php 24 * @uses config_api.php 25 * @uses constant_inc.php 26 * @uses utility_api.php 27 */ 28 29 if ( !defined( 'CHECK_ATTACHMENTS_INC_ALLOW' ) ) { 30 return; 31 } 32 33 /** 34 * MantisBT Check API 35 */ 36 require_once ( 'check_api.php' ); 37 require_api( 'config_api.php' ); 38 require_api( 'constant_inc.php' ); 39 require_api( 'utility_api.php' ); 40 41 check_print_section_header_row( 'Attachments' ); 42 43 $t_file_uploads_allowed = config_get_global( 'allow_file_upload' ); 44 check_print_info_row( 45 'File uploads are allowed', 46 $t_file_uploads_allowed ? 'Yes' : 'No' 47 ); 48 49 if( !$t_file_uploads_allowed ) { 50 return; 51 } 52 53 check_print_test_row( 54 'file_uploads php.ini directive is enabled', 55 ini_get_bool( 'file_uploads' ), 56 array( false => 'The file_uploads directive in php.ini must be enabled in order for file uploads to work with MantisBT.' ) 57 ); 58 59 check_print_info_row( 60 'Maximum file upload size (per file)', 61 config_get_global( 'max_file_size' ) . ' bytes' 62 ); 63 64 check_print_test_row( 65 'max_file_size MantisBT option is less than or equal to the upload_max_filesize directive in php.ini', 66 config_get_global( 'max_file_size' ) <= ini_get_number( 'upload_max_filesize' ), 67 array( false => 'max_file_size is currently ' . htmlentities( config_get_global( 'max_file_size' ) ) . ' bytes which is greater than the limit of ' . htmlentities( ini_get_number( 'upload_max_filesize' ) ) . ' bytes imposed by the php.ini directive upload_max_filesize.' ) 68 ); 69 70 $t_use_xsendfile = config_get_global( 'file_download_xsendfile_enabled' ); 71 check_print_info_row( 72 '<a href="http://www.google.com/search?q=x-sendfile">X-Sendfile</a> file download technique enabled', 73 $t_use_xsendfile ? 'Yes' : 'No' 74 ); 75 76 if( $t_use_xsendfile ) { 77 check_print_test_row( 78 'file_download_xsendfile_enabled = ON requires file_upload_method = DISK', 79 config_get_global( 'file_upload_method' ) == DISK, 80 array( false => 'X-Sendfile file downloading only works when files are stored on a disk.' ) 81 ); 82 83 $t_xsendfile_header_name = config_get_global( 'file_download_xsendfile_header_name' ); 84 if( $t_xsendfile_header_name !== 'X-Sendfile' ) { 85 check_print_info_row( 86 'Alternative header name to use for X-Sendfile-like functionality', 87 $t_xsendfile_header_name 88 ); 89 } 90 } 91 92 $t_finfo_exists = class_exists( 'finfo' ); 93 check_print_test_warn_row( 94 'Fileinfo extension is available for determining file MIME types', 95 $t_finfo_exists, 96 array( false => 'Web clients may struggle to download files without knowing the MIME type of each attachment.' ) 97 ); 98 99 if( $t_finfo_exists ) { 100 $t_fileinfo_magic_db_file = config_get_global( 'fileinfo_magic_db_file' ); 101 if( $t_fileinfo_magic_db_file ) { 102 check_print_info_row( 103 'Name of magic.db file set with the fileinfo_magic_db_file configuration value', 104 config_get_global( 'fileinfo_magic_db_file' ) 105 ); 106 check_print_test_row( 107 'fileinfo_magic_db_file configuration value points to an existing magic.db file', 108 file_exists( $t_fileinfo_magic_db_file ) 109 ); 110 $t_finfo = new finfo( FILEINFO_MIME, $t_fileinfo_magic_db_file ); 111 } else { 112 $t_finfo = new finfo( FILEINFO_MIME ); 113 } 114 check_print_test_row( 115 'Fileinfo extension can find and load a valid magic.db file', 116 $t_finfo !== false, 117 array( false => 'Ensure that the fileinfo_magic_db_file configuration value points to a valid magic.db file.' ) 118 ); 119 }
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 |