diff --git a/account_prefs_inc.php b/account_prefs_inc.php index 831147f637..a56fb3ffc0 100644 --- a/account_prefs_inc.php +++ b/account_prefs_inc.php @@ -99,8 +99,8 @@ function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_ if( $t_num_proj == 1 ) { $t_num_proj += count( current_user_get_accessible_subprojects( $t_projects[0] ) ); } - # Only display "All projects" in selection list if there is more than 1 - print_project_option_list( (int)$t_pref->default_project, $t_num_proj > 1 ); + # Don't display "All projects" in selection list if there is only 1 + print_project_option_list( (int)$t_pref->default_project, $t_num_proj != 1 ); ?> diff --git a/admin/check/check_webservice_inc.php b/admin/check/check_webservice_inc.php new file mode 100644 index 0000000000..4c0f36b834 --- /dev/null +++ b/admin/check/check_webservice_inc.php @@ -0,0 +1,57 @@ +. + +/** + * @package MantisBT + * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net + * @link http://www.mantisbt.org + * + * @uses check_api.php + * @uses config_api.php + * @uses constant_inc.php + */ + +if ( !defined( 'CHECK_WEBSERVICE_INC_ALLOW' ) ) { + return; +} + +/** + * MantisBT Check API + */ +require_once( 'check_api.php' ); +require_api( 'config_api.php' ); +require_api( 'constant_inc.php' ); + +check_print_section_header_row( 'Webservice' ); + +$t_library_path = config_get_global( 'library_path' ); +$t_library_path = realpath( $t_library_path ); +if ( $t_library_path[strlen( $t_library_path )-1] != '/' ) { + $t_library_path .= '/'; +} + +check_print_test_warn_row( + "Legacy library/nusoap folder must be deleted.", + !is_dir( $t_library_path . 'nusoap' ) +); + +check_print_test_warn_row( + 'SOAP Extension Enabled', + extension_loaded( 'soap' ), + array( false => 'Enable the PHP SOAP extension.' ) +); + diff --git a/admin/check/index.php b/admin/check/index.php index 49b33e7510..dedbb3a80e 100644 --- a/admin/check/index.php +++ b/admin/check/index.php @@ -100,6 +100,11 @@ include( 'check_paths_inc.php' ); } +if( !$g_failed_test ) { + define( 'CHECK_WEBSERVICE_INC_ALLOW', true ); + include( 'check_webservice_inc.php' ); +} + if( !$g_failed_test ) { define( 'CHECK_INTEGRITY_INC_ALLOW', true ); include( 'check_integrity_inc.php' ); @@ -108,26 +113,37 @@ if( !$g_failed_test ) { define( 'CHECK_CRYPTO_INC_ALLOW', true ); include( 'check_crypto_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_I18N_INC_ALLOW', true ); include( 'check_i18n_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_L10N_INC_ALLOW', true ); include( 'check_L10n_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_EMAIL_INC_ALLOW', true ); include( 'check_email_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_ANONYMOUS_INC_ALLOW', true ); include( 'check_anonymous_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_ATTACHMENTS_INC_ALLOW', true ); include( 'check_attachments_inc.php' ); +} +if( !$g_failed_test ) { define( 'CHECK_DISPLAY_INC_ALLOW', true ); include( 'check_display_inc.php' ); } - ?> diff --git a/admin/install.php b/admin/install.php index 2168cde244..8ec247e031 100644 --- a/admin/install.php +++ b/admin/install.php @@ -992,7 +992,7 @@ function InsertData( $p_table, $p_data ) {

Continue to log into Mantis

-

Please log in as the administrator and create your first project.

+

Please log in as the administrator and create your first project.

xml_encoding = "UTF-8"; - $l_oServer->soap_defencoding = "UTF-8"; - $l_oServer->decode_utf8 = false; - - ### - ### IMPLEMENTATION - ### - - # pass incoming (posted) data - if ( isset( $HTTP_RAW_POST_DATA ) ) { - $t_input = $HTTP_RAW_POST_DATA; - } else { - $t_input = implode( "\r\n", file( 'php://input' ) ); - } - - # only include the MantisBT / MantisConnect related files, if the current - # request is a webservice call (rather than webservice documentation request, - # eg: WSDL). - if ( mci_is_webservice_call() ) { - require_once( 'mc_core.php' ); - } else { - # if we have a documentation request, do some tidy up to prevent lame bot loops e.g. /mantisconnect.php/mc_enum_etas/mc_project_get_versions/ - $parts = explode ( 'mantisconnect.php/', strtolower($_SERVER['SCRIPT_NAME'] ), 2 ); - if (isset( $parts[1] ) && (strlen ( $parts[1] ) > 0 ) ) { - echo 'This is not a SOAP webservice request, for documentation, see ' . $parts[0] . 'mantisconnect.php'; - exit(); - } - } - - # Execute whatever is requested from the webservice. - $l_oServer->service( $t_input ); -} else { - - require_once( 'mc_core.php' ); - - $server = new SoapServer("mantisconnect.wsdl", - array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS) - ); - $server->addFunction(SOAP_FUNCTIONS_ALL); - $server->handle(); -} +$server = new SoapServer("mantisconnect.wsdl", + array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS) +); + +$server->addFunction(SOAP_FUNCTIONS_ALL); +$server->handle(); diff --git a/api/soap/mc_api.php b/api/soap/mc_api.php index 802968f5bd..34ec737f8b 100644 --- a/api/soap/mc_api.php +++ b/api/soap/mc_api.php @@ -10,73 +10,53 @@ set_error_handler( 'mc_error_handler' ); /** - * Abstract the differences in creating SOAP objects between the php5 soap extension and nusoap + * A factory class that can abstract away operations that can behave differently based + * on the underlying soap implementation. * - *

As long as we decide to support both implementations we should add all non-generic - * factory code to this class.

+ * TODO: Consider removing this class since it currently has one implementation which + * targets the php soap extension. */ class SoapObjectsFactory { - static function newSoapFault( $p_fault_code, $p_fault_string) { - if ( class_exists('soap_fault') ) - return new soap_fault( $p_fault_code, '', $p_fault_string ); - else - return new SoapFault( $p_fault_code, $p_fault_string ); + return new SoapFault( $p_fault_code, $p_fault_string ); } static function unwrapObject( $p_object ) { - if ( is_object( $p_object ) ) + if ( is_object( $p_object ) ) { return get_object_vars( $p_object ); + } return $p_object; } static function newDateTimeVar( $p_value ) { - $string_value = self::newDateTimeString( $p_value ); - if ( class_exists('soapval') ) - return new soapval( 'due_date', 'xsd:dateTime', $string_value ); - else - return new SoapVar( $string_value, XSD_DATETIME, 'xsd:dateTime'); + return new SoapVar( $string_value, XSD_DATETIME, 'xsd:dateTime'); } static function newDateTimeString ( $p_timestamp ) { - - if ( $p_timestamp == null || date_is_null( $p_timestamp) ) + if ( $p_timestamp == null || date_is_null( $p_timestamp ) ) { return null; - else if ( function_exists('timestamp_to_iso8601') ) - return timestamp_to_iso8601( $p_timestamp, false); - else { - return date('c', (int) $p_timestamp); } + + return date('c', (int) $p_timestamp); } static function parseDateTimeString ( $p_string ) { - - if ( function_exists('iso8601_to_timestamp') ) { - return iso8601_to_timestamp( $p_string ); - } else { - return strtotime( $p_string ); - } + return strtotime( $p_string ); } static function encodeBinary ( $p_binary ) { - if ( class_exists('soap_fault') ) - return base64_encode( $p_binary ); - else - return $p_binary; + return $p_binary; } static function isSoapFault ( $p_maybe_fault ) { - if ( ! is_object( $p_maybe_fault ) ) + if ( !is_object( $p_maybe_fault ) ) { return false; - - if ( class_exists('soap_fault') ) { - return get_class($p_maybe_fault ) == 'soap_fault'; - } else { - return get_class($p_maybe_fault ) == 'SoapFault'; } + + return get_class($p_maybe_fault ) == 'SoapFault'; } } diff --git a/api/soap/mc_config_defaults_inc.php b/api/soap/mc_config_defaults_inc.php index 79895440ab..a3406e42f2 100644 --- a/api/soap/mc_config_defaults_inc.php +++ b/api/soap/mc_config_defaults_inc.php @@ -45,13 +45,3 @@ # Default version to be used if the specified version is not found and $g_mc_error_when_version_not_found == OFF. # (at the moment this value does not depend on the project). $g_mc_version_when_not_found = ''; - -/** - * MantisConnect - use nusoap for SOAP handling - * - *

When the native PHP extension is available this flag default to OFF, which means that nusoap - * will not used. The native extension has the advantage of being faster, more memory efficient and - * maintained to work with recent versions on PHP. When the extension is not available - * MantisBT falls back to using nusoap.

- */ -$g_mc_use_nusoap = extension_loaded('soap') && defined('SOAP_USE_XSI_ARRAY_TYPE') ? OFF : ON; diff --git a/bug_update_advanced_page.php b/bug_update_advanced_page.php index 5c63d81f87..919c5e1eb0 100644 --- a/bug_update_advanced_page.php +++ b/bug_update_advanced_page.php @@ -139,7 +139,11 @@ $tpl_additional_information_textarea = $tpl_show_additional_information ? string_textarea( $tpl_bug->additional_information ) : ''; $tpl_show_steps_to_reproduce = in_array( 'steps_to_reproduce', $t_fields ); $tpl_steps_to_reproduce_textarea = $tpl_show_steps_to_reproduce ? string_textarea( $tpl_bug->steps_to_reproduce ) : ''; -$tpl_handler_name = string_display_line( user_get_name( $tpl_bug->handler_id ) ); +if( NO_USER == $tpl_bug->handler_id ) { + $tpl_handler_name = ''; +} else { + $tpl_handler_name = string_display_line( user_get_name( $tpl_bug->handler_id ) ); +} $tpl_can_change_view_state = $tpl_show_view_state && access_has_project_level( config_get( 'change_view_status_threshold' ) ); @@ -263,10 +267,17 @@ echo ''; echo ''; - echo ''; - + # Do not allow the bug's reporter to edit the Reporter field + # when limit_reporters is ON + if( ON == config_get( 'limit_reporters' ) + && !access_has_project_level( REPORTER + 1, $tpl_bug->project_id ) + ) { + echo string_attribute( user_get_name( $tpl_bug->reporter_id ) ); + } else { + echo ''; + } echo ''; } else { $t_spacer += 2; diff --git a/core/database_api.php b/core/database_api.php index 417130b22c..7a03cad611 100644 --- a/core/database_api.php +++ b/core/database_api.php @@ -575,11 +575,13 @@ function db_index_exists( $p_table_name, $p_index_name ) { $t_indexes = $g_db->MetaIndexes( $p_table_name ); - # Can't use in_array() since it is case sensitive - $t_index_name = utf8_strtolower( $p_index_name ); - foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) { - if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) { - return true; + if( !empty( $t_indexes ) ) { + # Can't use in_array() since it is case sensitive + $t_index_name = utf8_strtolower( $p_index_name ); + foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) { + if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) { + return true; + } } } return false; diff --git a/core/filter_api.php b/core/filter_api.php index e02722dc50..b7bb9695db 100644 --- a/core/filter_api.php +++ b/core/filter_api.php @@ -3471,21 +3471,27 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e - +
'; } } + print_menu(); echo '
', "\n"; event_signal( 'EVENT_LAYOUT_CONTENT_BEGIN' ); @@ -466,7 +467,7 @@ function html_body_begin() { function html_header() { $t_title = config_get( 'page_title' ); if( !is_blank( $t_title ) ) { - echo '
', string_display( $t_title ), '
', "\n"; + echo '
' . string_display( $t_title ) . "
\n"; } } @@ -519,6 +520,7 @@ function html_login_info() { $t_now = date( config_get( 'complete_date_format' ) ); $t_realname = current_user_get_field( 'realname' ); + # Login information echo '
'; if( current_user_is_anonymous() ) { $t_return_page = $_SERVER['SCRIPT_NAME']; @@ -543,16 +545,7 @@ function html_login_info() { } echo '
'; - # Project Selector hidden if only one project visisble to user - $t_show_project_selector = true; - $t_project_ids = current_user_get_accessible_projects(); - if( count( $t_project_ids ) == 1 ) { - $t_project_id = (int) $t_project_ids[0]; - if( count( current_user_get_accessible_subprojects( $t_project_id ) ) == 0 ) { - $t_show_project_selector = false; - } - } - + # RSS feed if( OFF != config_get( 'rss_enabled' ) ) { echo '
'; # Link to RSS issues feed for the selected project, including authentication details. @@ -562,7 +555,18 @@ function html_login_info() { echo '
'; } + # Project Selector (hidden if only one project visisble to user) + $t_show_project_selector = true; + $t_project_ids = current_user_get_accessible_projects(); + if( count( $t_project_ids ) == 1 ) { + $t_project_id = (int) $t_project_ids[0]; + if( count( current_user_get_accessible_subprojects( $t_project_id ) ) == 0 ) { + $t_show_project_selector = false; + } + } + if( $t_show_project_selector ) { + echo '
'; echo '
'; echo '
'; # CSRF protection not required here - form does not result in modifications @@ -574,7 +578,7 @@ function html_login_info() { echo ''; echo '
'; echo '
'; - echo '
' . $t_now . '
'; + echo '
'; } else { # User has only one project, set it as both current and default if( ALL_PROJECTS == helper_get_current_project() ) { @@ -591,8 +595,10 @@ function html_login_info() { html_meta_redirect( $t_redirect_url, 0, false ); } } - echo '
' . $t_now . '
'; } + + # Current time + echo '
' . $t_now . '
'; } /** @@ -906,26 +912,28 @@ function print_menu() { if( !current_user_is_anonymous() ) { $t_menu_options[] = '' ) . lang_get( 'logout_link' ) . ''; } - echo '
' ); - echo '
'; - # CSRF protection not required here - form does not result in modifications - $t_bug_label = lang_get( 'issue_id' ); - echo ''; - echo ' '; + # Display main menu + echo "\n" . '\n"; } } @@ -1049,7 +1057,7 @@ function print_manage_menu( $p_page = '' ) { } } - echo '
'; + echo "\n" . '
' . "\n"; echo '