diff --git a/api/soap/mc_compat_api.php b/api/soap/mc_compat_api.php deleted file mode 100644 index 41c4e8b700..0000000000 --- a/api/soap/mc_compat_api.php +++ /dev/null @@ -1,317 +0,0 @@ -= $t_private_bugnote_threshold ) { - $t_private_bugnote_visible = true; - } else { - $t_private_bugnote_visible = false ; - } - - $t_bugnotes = array(); - foreach ( $t_all_bugnotes as $t_note_index => $t_bugnote ) { - if ( $t_private_bugnote_visible || ( VS_PUBLIC == $t_bugnote->view_state ) ) { - $t_bugnotes[$t_note_index] = $t_bugnote; - } - } - - return $t_bugnotes; - } - } - - - # This function was implemented in 1.0.0a1 - if ( !function_exists( 'bugnote_get_all_bugnotes' ) ) { - function bugnote_get_all_bugnotes( $p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bugnote_table = config_get( 'mantis_bugnote_table' ); - $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' ); - if ( 0 == $p_user_bugnote_limit ) { - ## Show all bugnotes - $t_bugnote_limit = -1; - $t_bugnote_offset = -1; - } else { - ## Use offset only if order is ASC to get the last bugnotes - if ( 'ASC' == $p_user_bugnote_order ) { - $result = db_query( "SELECT COUNT(*) AS row_count FROM $t_bugnote_table WHERE bug_id = '$c_bug_id'" ); - $row = db_fetch_array( $result ); - - $t_bugnote_offset = $row['row_count'] - $p_user_bugnote_limit; - } else { - $t_bugnote_offset = -1; - } - - $t_bugnote_limit = $p_user_bugnote_limit; - } - - $query = "SELECT b.*, t.note - FROM $t_bugnote_table AS b - LEFT JOIN $t_bugnote_text_table AS t ON b.bugnote_text_id = t.id - WHERE b.bug_id = '$c_bug_id' - ORDER BY b.date_submitted $p_user_bugnote_order"; - $t_bugnotes = array(); - - # BUILD bugnotes array - $result = db_query( $query, $t_bugnote_limit, $t_bugnote_offset ); - $count = db_num_rows( $result ); - for ( $i=0; $i < $count; $i++ ) { - $row = db_fetch_array( $result ); - - $t_bugnote = new BugnoteData; - - $t_bugnote->id = $row['id']; - $t_bugnote->bug_id = $row['bug_id']; - $t_bugnote->note = $row['note']; - $t_bugnote->view_state = $row['view_state']; - $t_bugnote->reporter_id = $row['reporter_id']; - $t_bugnote->date_submitted = db_unixtimestamp( $row['date_submitted'] ); - $t_bugnote->last_modified = db_unixtimestamp( $row['last_modified'] ); - $t_bugnote->note_type = $row['note_type']; - $t_bugnote->note_attr = $row['note_attr']; - - $t_bugnotes[] = $t_bugnote; - } - - return $t_bugnotes; - } - } - - - /** - * Enhanced version of version_get_all_rows from Mantis' - * core/version_api.php. Should be removed once it gets into Mantis. - * - * FIXED IN Mantis 1.0.0a1. - */ - function mci_version_get_all_rows( $p_project_id, $p_released = null ) { - $c_project_id = db_prepare_int( $p_project_id ); - - if ( $p_released === null ) { - $t_released_where = ''; - } else { - $c_released = db_prepare_int( $p_released ); - $t_released_where = "AND ( released = $c_released )"; - } - - $t_project_version_table = config_get( 'mantis_project_version_table' ); - - $query = "SELECT * - FROM $t_project_version_table - WHERE project_id='$c_project_id' $t_released_where - ORDER BY date_order DESC"; - $result = db_query( $query ); - $count = db_num_rows( $result ); - $rows = array(); - for ( $i = 0 ; $i < $count ; $i++ ) { - $row = db_fetch_array( $result ); - $rows[] = $row; - } - return $rows; - } - - - ############################ - # Added in Mantis 0.19.1 - ############################ - - - if ( !function_exists( 'project_get_id_by_name' ) ) { - # -------------------- - # Get the id of the project with the specified name. - # "project_get_id" was added to Mantis 0.19.1-CVS. - function project_get_id_by_name( $p_project_name ) { - $c_project_name = db_prepare_string( $p_project_name ); - - $t_project_table = config_get( 'mantis_project_table' ); - - $query = "SELECT id FROM $t_project_table WHERE name = '$c_project_name'"; - $t_result = db_query( $query, 1 ); - - if ( db_num_rows( $t_result ) == 0 ) { - return 0; - } else { - return db_result( $t_result ); - } - } - } - - # -------------------- - # In 0.19.0 this api has no parameters in Mantis, in 0.19.1-cvs, I changed it to the current implementation. - function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id = null ) { - $t_filters_table = config_get( 'mantis_filters_table' ); - $t_overall_query_arr = array(); - - if ( null === $p_project_id ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $p_project_id; - } - - if ( null === $p_user_id ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = $p_user_id; - } - - # If the user doesn't have access rights to stored queries, just return - if ( !access_has_project_level( config_get( 'stored_query_use_threshold' ) ) ) { - return $t_overall_query_arr; - } - - # Get the list of available queries. By sorting such that public queries are - # first, we can override any query that has the same name as a private query - # with that private one - $query = "SELECT * FROM $t_filters_table - WHERE (project_id='$t_project_id' - OR project_id='0') - AND name!='' - AND filter_string!='' - ORDER BY is_public DESC, name ASC"; - $result = db_query( $query ); - $query_count = db_num_rows( $result ); - - for ( $i = 0; $i < $query_count; $i++ ) { - $row = db_fetch_array( $result ); - if ( ( $row['user_id'] == $t_user_id ) || db_prepare_bool( $row['is_public'] ) ) { - $t_overall_query_arr[$row['name']] = $row; - } - } - - return array_values( $t_overall_query_arr ); - } -?> diff --git a/api/soap/mc_core.php b/api/soap/mc_core.php index f539e390cc..4b696250e8 100644 --- a/api/soap/mc_core.php +++ b/api/soap/mc_core.php @@ -30,9 +30,6 @@ require_once( $t_user_configs ); } - # APIs for compatability with older versions of Mantis - require_once( $t_current_dir . 'mc_compat_api.php' ); - # MantisConnect APIs # mc_* = public methods # mci_* = internal methods diff --git a/api/soap/mc_filter_api.php b/api/soap/mc_filter_api.php index 51e26af53b..072be6bd81 100644 --- a/api/soap/mc_filter_api.php +++ b/api/soap/mc_filter_api.php @@ -27,7 +27,7 @@ function mc_filter_get( $p_username, $p_password, $p_project_id ) { return new soap_fault( 'Client', '', 'Access Denied' ); } $t_result = array(); - foreach( mci_filter_db_get_available_queries( $p_project_id, $t_user_id ) as $t_filter_row ) { + foreach( filter_db_get_available_queries( $p_project_id, $t_user_id ) as $t_filter_row ) { $t_filter = array(); $t_filter['id'] = $t_filter_row['id']; $t_filter['owner'] = mci_account_get_array_by_id( $t_filter_row['user_id'] ); diff --git a/api/soap/mc_issue_api.php b/api/soap/mc_issue_api.php index 1290c3d171..c0d33d9d0c 100644 --- a/api/soap/mc_issue_api.php +++ b/api/soap/mc_issue_api.php @@ -535,7 +535,7 @@ function mc_issue_add( $p_username, $p_password, $p_issue ) { } $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - mci_bugnote_add( $t_issue_id, $t_note['text'], $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); + bugnote_add( $t_issue_id, $t_note['text'], '0:00', $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); } } @@ -699,7 +699,7 @@ function mc_issue_update( $p_username, $p_password, $p_issue_id, $p_issue ) { // TODO: consider supporting updating of bugnotes and detecting the ones that haven't changed. $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - mci_bugnote_add( $p_issue_id, $t_note['text'], $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); + bugnote_add( $p_issue_id, $t_note['text'], '0:00', $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); } } @@ -775,7 +775,7 @@ function mc_issue_note_add( $p_username, $p_password, $p_issue_id, $p_note ) { } $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - return mci_bugnote_add( $p_issue_id, $p_note['text'], $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); + return bugnote_add( $p_issue_id, $p_note['text'], '0:00', $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id ); } /** diff --git a/api/soap/mc_project_api.php b/api/soap/mc_project_api.php index ecc04c750a..574f35d036 100644 --- a/api/soap/mc_project_api.php +++ b/api/soap/mc_project_api.php @@ -99,17 +99,6 @@ function mc_projects_get_user_accessible( $p_username, $p_password ) { } $t_result = array(); - $t_result[] = array( - 'id'=>ALL_PROJECTS, - 'name'=>'*All Projects*', - 'status'=>array('id'=>50,'name'=>'stable'), - 'enabled'=>true, - 'view_state'=>array('id'=>10,'name'=>'public'), - 'access_min'=>array('id'=>10,'name'=>'viewer'), - 'file_path'=>'', - 'descriptionn'=>'All Projects Filter', - 'subprojects'=>array() - ); foreach( user_get_accessible_projects( $t_user_id ) as $t_project_id ) { $t_project_row = project_cache_row( $t_project_id ); $t_project = array(); @@ -179,12 +168,12 @@ function mc_project_get_versions( $p_username, $p_password, $p_project_id ) { } $t_result = array(); - foreach( mci_version_get_all_rows( $p_project_id, VERSION_ALL ) as $t_version) { + foreach( version_get_all_rows( $p_project_id, VERSION_ALL ) as $t_version) { $t_result[] = array( 'id' => $t_version['id'], 'name' => $t_version['version'], 'project_id' => $p_project_id, - 'date_order' => timestamp_to_iso8601( db_unixtimestamp( $t_version['date_order'] ) ), + 'date_order' => timestamp_to_iso8601( $t_version['date_order'] ), 'description' => mci_null_if_empty( $t_version['description'] ), 'released' => $t_version['released'], ); @@ -218,7 +207,7 @@ function mc_project_get_released_versions( $p_username, $p_password, $p_project_ $t_result = array(); - foreach( mci_version_get_all_rows( $p_project_id, VERSION_RELEASED ) as $t_version) { + foreach( version_get_all_rows( $p_project_id, VERSION_RELEASED ) as $t_version) { $t_result[] = array( 'id' => $t_version['id'], 'name' => $t_version['version'], @@ -257,12 +246,12 @@ function mc_project_get_unreleased_versions( $p_username, $p_password, $p_projec $t_result = array(); - foreach( mci_version_get_all_rows( $p_project_id, VERSION_FUTURE ) as $t_version) { + foreach( version_get_all_rows( $p_project_id, VERSION_FUTURE ) as $t_version) { $t_result[] = array( 'id' => $t_version['id'], 'name' => $t_version['version'], 'project_id' => $p_project_id, - 'date_order' => timestamp_to_iso8601( db_unixtimestamp( $t_version['date_order'] ) ), + 'date_order' => timestamp_to_iso8601( $t_version['date_order'] ), 'description' => mci_null_if_empty( $t_version['description'] ), 'released' => $t_version['released'], );