Skip to content

Commit

Permalink
Merge branch 'master' into 13x
Browse files Browse the repository at this point in the history
Conflicts:
	library/README.libs
	library/adodb
	library/phpmailer
  • Loading branch information
dregad committed Oct 8, 2013
2 parents b30a312 + 542e686 commit 3793a8d
Show file tree
Hide file tree
Showing 37 changed files with 246 additions and 18,004 deletions.
4 changes: 2 additions & 2 deletions account_prefs_inc.php
Expand Up @@ -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 );
?>
</select>
</span>
Expand Down
57 changes: 57 additions & 0 deletions admin/check/check_webservice_inc.php
@@ -0,0 +1,57 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* @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 <em>library/nusoap</em> 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.' )
);

18 changes: 17 additions & 1 deletion admin/check/index.php
Expand Up @@ -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' );
Expand All @@ -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' );
}

?>
</table>
<?php if( $g_failed_test ) { ?>
Expand Down
2 changes: 1 addition & 1 deletion admin/install.php
Expand Up @@ -992,7 +992,7 @@ function InsertData( $p_table, $p_data ) {
<p><a href="../login_page.php">Continue</a> to log into Mantis</p>
<?php
} else {?>
<p>Please log in as the administrator and <a href="../manage_proj_create_page.php">create</a> your first project.</p>
<p>Please log in as the administrator and <a href="../login_page.php">create</a> your first project.</p>

<?php
}
Expand Down
67 changes: 13 additions & 54 deletions api/soap/mantisconnect.php
Expand Up @@ -52,6 +52,12 @@ function mci_is_webservice_call()
}
}

# If SOAP extension is not enabled, error out.
if ( !extension_loaded( 'soap' ) ) {
echo 'PHP SOAP extension is not enabled.';
exit();
}

if ( !mci_is_webservice_call() ) {
# 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 );
Expand All @@ -67,58 +73,11 @@ function mci_is_webservice_call()
exit();
}

if ( config_get('mc_use_nusoap') ) {
// NuSOAP already performs compression,
// so we prevent a double-compression.
// See issue #11868 for details
define( 'COMPRESSION_DISABLED', true);
ini_set( 'zlib.output_compression', false );

require_once( 'nusoap/nusoap.php' );

# create server
$l_oServer = new soap_server('mantisconnect.wsdl');
require_once( 'mc_core.php' );

// WS-I Basic Profile requires UTF-8 or UTF-16 as the encoding for interoperabilty
// reasons. This will correctly handle a large number of languages besides English.
$l_oServer->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();
52 changes: 16 additions & 36 deletions api/soap/mc_api.php
Expand Up @@ -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.
*
* <p>As long as we decide to support both implementations we should add all non-generic
* factory code to this class.</p>
* 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';
}
}

Expand Down
10 changes: 0 additions & 10 deletions api/soap/mc_config_defaults_inc.php
Expand Up @@ -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
*
* <p>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.</p>
*/
$g_mc_use_nusoap = extension_loaded('soap') && defined('SOAP_USE_XSI_ARRAY_TYPE') ? OFF : ON;
21 changes: 16 additions & 5 deletions bug_update_advanced_page.php
Expand Up @@ -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' ) );

Expand Down Expand Up @@ -263,10 +267,17 @@
echo '<th class="category"><label for="reporter_id">' . lang_get( 'reporter' ) . '</label></th>';
echo '<td>';

echo '<select ' . helper_get_tab_index() . ' id="reporter_id" name="reporter_id">';
print_reporter_option_list( $tpl_bug->reporter_id, $tpl_bug->project_id );
echo '</select>';

# 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 '<select ' . helper_get_tab_index() . ' id="reporter_id" name="reporter_id">';
print_reporter_option_list( $tpl_bug->reporter_id, $tpl_bug->project_id );
echo '</select>';
}
echo '</td>';
} else {
$t_spacer += 2;
Expand Down
12 changes: 7 additions & 5 deletions core/database_api.php
Expand Up @@ -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;
Expand Down
16 changes: 11 additions & 5 deletions core/filter_api.php
Expand Up @@ -3471,21 +3471,27 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
</div><?php
}
?>
<div class="filter-links"><?php

<div id="filter-links" class="filter-links">
<ul>
<?php
$f_switch_view_link = ( config_get( 'use_javascript' ) && config_get( 'use_dynamic_filters' ) ) ? 'view_all_set.php?type=6&amp;view_type=' : 'view_filters_page.php?view_type=';
$t_view_filters = config_get( 'view_filters' );
if(( SIMPLE_ONLY != $t_view_filters ) && ( ADVANCED_ONLY != $t_view_filters ) ) {
if( 'advanced' == $t_view_type ) {
echo '<span class="switch-view"><a href="', $f_switch_view_link, 'simple">', lang_get('simple_filters'), '</a></span>';
echo '<li><a href="', $f_switch_view_link, 'simple">', lang_get('simple_filters'), '</a></li>';
} else {
echo '<span class="switch-view"><a href="', $f_switch_view_link, 'advanced">', lang_get('advanced_filters'), '</a></span>';
echo '<li><a href="', $f_switch_view_link, 'advanced">', lang_get('advanced_filters'), '</a></li>';
}
}

if( access_has_project_level( config_get( 'create_permalink_threshold' ) ) ) {
echo '<span class="permalink"><a href="permalink_page.php?url=', urlencode( filter_get_url( $t_filter ) ), '">', lang_get( 'create_filter_link' ), '</a></span>';
} ?>
echo '<li><a href="permalink_page.php?url=', urlencode( filter_get_url( $t_filter ) ), '">', lang_get( 'create_filter_link' ), '</a></li>';
}
?>
</ul>
</div>

</div>
<br />
<?php
Expand Down

0 comments on commit 3793a8d

Please sign in to comment.