Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc37aa3

Browse files
committedJun 7, 2012
Merge tag 'release-1.2.11' into oracle
Stable release 1.2.11
2 parents b5851c4 + 7b8dad7 commit fc37aa3

File tree

180 files changed

+2371
-1308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+2371
-1308
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ docbook/*/*/builddate
1414
docbook/*/*/build
1515
docbook/*/*/install
1616
docbook/*/builddate
17+
docbook/*/tmp
1718

1819
# Build output
1920
build/
@@ -32,6 +33,7 @@ plugins/*
3233
.cache
3334
.project
3435
.settings
36+
.idea/
3537
*.kdev4
3638

3739
# IIS7

‎api/soap/mc_api.php

+33-65
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@
99
# set up error_handler() as the new default error handling function
1010
set_error_handler( 'mc_error_handler' );
1111

12-
# override some MantisBT configurations
13-
$g_show_detailed_errors = OFF;
14-
$g_stop_on_errors = ON;
15-
$g_display_errors = array(
16-
E_WARNING => 'halt',
17-
E_NOTICE => 'halt',
18-
E_USER_ERROR => 'halt',
19-
E_USER_WARNING => 'halt',
20-
E_USER_NOTICE => 'halt',
21-
);
22-
2312
/**
2413
* Get the MantisConnect webservice version.
2514
*/
@@ -86,10 +75,12 @@ function mci_has_administrator_access( $p_user_id, $p_project_id = ALL_PROJECTS
8675
}
8776

8877
function mci_get_project_id( $p_project ) {
89-
if( (int) $p_project['id'] != 0 ) {
78+
if ( isset( $p_project['id'] ) && (int) $p_project['id'] != 0 ) {
9079
$t_project_id = (int) $p_project['id'];
91-
} else {
80+
} else if ( isset( $p_project['name'] ) && !is_blank( $p_project['name'] ) ) {
9281
$t_project_id = project_get_id_by_name( $p_project['name'] );
82+
} else {
83+
$t_project_id = ALL_PROJECTS;
9384
}
9485

9586
return $t_project_id;
@@ -177,7 +168,7 @@ function mci_null_if_empty( $p_value ) {
177168
* @return MantisBT URL terminated by a /.
178169
*/
179170
function mci_get_mantis_path() {
180-
171+
181172
return config_get( 'path' );
182173
}
183174

@@ -260,26 +251,26 @@ function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id =
260251
# first, we can override any query that has the same name as a private query
261252
# with that private one
262253
$query = "SELECT * FROM $t_filters_table
263-
WHERE (project_id='$t_project_id'
264-
OR project_id='0')
265-
AND name!=''
266-
ORDER BY is_public DESC, name ASC";
267-
$result = db_query( $query );
254+
WHERE (project_id=" . db_param() . "
255+
OR project_id=0)
256+
AND name!=''
257+
AND (is_public = " . db_prepare_bool(true) . "
258+
OR user_id = " . db_param() . ")
259+
ORDER BY is_public DESC, name ASC";
260+
$result = db_query_bound( $query, Array( $t_project_id, $t_user_id ) );
268261
$query_count = db_num_rows( $result );
269262

270263
for( $i = 0;$i < $query_count;$i++ ) {
271264
$row = db_fetch_array( $result );
272-
if(( $row['user_id'] == $t_user_id ) || db_prepare_bool( $row['is_public'] ) ) {
273-
274-
$t_filter_detail = explode( '#', $row['filter_string'], 2 );
275-
if ( !isset($t_filter_detail[1]) ) {
276-
continue;
277-
}
278-
$t_filter = unserialize( $t_filter_detail[1] );
279-
$t_filter = filter_ensure_valid_filter( $t_filter );
280-
$row['url'] = filter_get_url( $t_filter );
281-
$t_overall_query_arr[$row['name']] = $row;
265+
266+
$t_filter_detail = explode( '#', $row['filter_string'], 2 );
267+
if ( !isset($t_filter_detail[1]) ) {
268+
continue;
282269
}
270+
$t_filter = unserialize( $t_filter_detail[1] );
271+
$t_filter = filter_ensure_valid_filter( $t_filter );
272+
$row['url'] = filter_get_url( $t_filter );
273+
$t_overall_query_arr[$row['name']] = $row;
283274
}
284275

285276
return array_values( $t_overall_query_arr );
@@ -300,11 +291,11 @@ function mci_category_as_array_by_id( $p_category_id ) {
300291

301292
/**
302293
* Transforms a version array into an array suitable for marshalling into ProjectVersionData
303-
*
294+
*
304295
* @param array $p_version
305296
*/
306297
function mci_project_version_as_array( $p_version ) {
307-
298+
308299
return array(
309300
'id' => $p_version['id'],
310301
'name' => $p_version['version'],
@@ -318,31 +309,23 @@ function mci_project_version_as_array( $p_version ) {
318309

319310
/**
320311
* Returns time tracking information from a bug note.
321-
*
312+
*
322313
* @param int $p_issue_id The id of the issue
323314
* @param Array $p_note A note as passed to the soap api methods
324-
*
315+
*
325316
* @return String the string time entry to be added to the bugnote, in 'HH:mm' format
326317
*/
327318
function mci_get_time_tracking_from_note( $p_issue_id, $p_note) {
328-
319+
329320
if ( !access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $p_issue_id ) )
330321
return '00:00';
331322

332323
if ( !isset( $p_note['time_tracking'] ))
333324
return '00:00';
334-
325+
335326
return db_minutes_to_hhmm($p_note['time_tracking']);
336327
}
337328

338-
/**
339-
* SECURITY NOTE: these globals are initialized here to prevent them
340-
* being spoofed if register_globals is turned on
341-
*/
342-
$g_error_parameters = array();
343-
$g_error_handled = false;
344-
$g_error_proceed_url = null;
345-
346329
# Default error handler
347330
#
348331
# This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_*
@@ -352,9 +335,6 @@ function mci_get_time_tracking_from_note( $p_issue_id, $p_note) {
352335
# The others, being system errors, will come with a string in $p_error
353336
#
354337
function mc_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
355-
global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
356-
global $g_lang_overrides;
357-
global $g_error_send_page_header;
358338
global $l_oServer;
359339

360340
# check if errors were disabled with @ somewhere in this call chain
@@ -363,24 +343,13 @@ function mc_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
363343
return;
364344
}
365345

366-
$t_lang_pushed = false;
367-
368346
# flush any language overrides to return to user's natural default
369347
if( function_exists( 'db_is_connected' ) ) {
370348
if( db_is_connected() ) {
371349
lang_push( lang_get_default() );
372-
$t_lang_pushed = true;
373350
}
374351
}
375352

376-
$t_short_file = basename( $p_file );
377-
$t_method_array = config_get( 'display_errors' );
378-
if( isset( $t_method_array[$p_type] ) ) {
379-
$t_method = $t_method_array[$p_type];
380-
} else {
381-
$t_method = 'none';
382-
}
383-
384353
# build an appropriate error string
385354
switch( $p_type ) {
386355
case E_WARNING:
@@ -400,22 +369,21 @@ function mc_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
400369
$t_error_description = error_string( $p_error );
401370
break;
402371
case E_USER_NOTICE:
403-
404372
# used for debugging
405373
$t_error_type = 'DEBUG';
406374
$t_error_description = $p_error;
407375
break;
408376
default:
409-
410377
#shouldn't happen, just display the error just in case
411378
$t_error_type = '';
412379
$t_error_description = $p_error;
413380
}
414381

415-
$t_error_description = $t_error_description;
416382
$t_error_stack = error_get_stack_trace();
383+
384+
error_log("[mantisconnect.php] Error Type: $t_error_type,\nError Description: $t_error_description\nStack Trace:\n$t_error_stack");
417385

418-
$l_oServer->fault( 'Server', "Error Type: $t_error_type,\nError Description:\n$t_error_description,\nStack Trace:\n$t_error_stack" );
386+
$l_oServer->fault( 'Server', "Error Type: $t_error_type,\nError Description: $t_error_description" );
419387
$l_oServer->send_response();
420388
exit();
421389
}
@@ -480,9 +448,9 @@ function error_get_stack_trace() {
480448
}
481449

482450
/**
483-
* Returns a soap_fault signalling corresponding to a failed login
451+
* Returns a soap_fault signalling corresponding to a failed login
484452
* situation
485-
*
453+
*
486454
* @return soap_fault
487455
*/
488456
function mci_soap_fault_login_failed() {
@@ -492,7 +460,7 @@ function mci_soap_fault_login_failed() {
492460
/**
493461
* Returns a soap_fault signalling that the user does not have
494462
* access rights for the specific action.
495-
*
463+
*
496464
* @param int $p_user_id a valid user id
497465
* @param string $p_detail The optional details to append to the error message
498466
* @return soap_fault
@@ -502,6 +470,6 @@ function mci_soap_fault_access_denied( $p_user_id, $p_detail = '' ) {
502470
$t_reason = 'Access denied for user '. $t_user_name . '.';
503471
if ( !is_blank( $p_detail ))
504472
$t_reason .= ' Reason: ' . $p_detail . '.';
505-
473+
506474
return new soap_fault( 'Client', '', $t_reason );
507475
}

0 commit comments

Comments
 (0)