| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisConnect - A webservice interface to Mantis Bug Tracker 3 # Copyright (C) 2004-2011 Victor Boctor - vboctor@users.sourceforge.net 4 # This program is distributed under dual licensing. These include 5 # GPL and a commercial licenses. Victor Boctor reserves the right to 6 # change the license of future releases. 7 # See docs/ folder for more details 8 9 require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'mc_core.php' ); 10 11 /** 12 * Get the issue attachment with the specified id. 13 * 14 * @param string $p_username The name of the user trying to access the filters. 15 * @param string $p_password The password of the user. 16 * @param integer $p_attachment_id The id of the attachment to be retrieved. 17 * @return Base64 encoded data that represents the attachment. 18 */ 19 function mc_issue_attachment_get( $p_username, $p_password, $p_issue_attachment_id ) { 20 $t_user_id = mci_check_login( $p_username, $p_password ); 21 if( $t_user_id === false ) { 22 return mci_soap_fault_login_failed(); 23 } 24 25 $t_file = mci_file_get( $p_issue_attachment_id, 'bug', $t_user_id ); 26 if ( get_class( (object) $t_file ) == 'soap_fault' ) { 27 return $t_file; 28 } 29 return base64_encode( $t_file ); 30 } 31 32 /** 33 * Add an attachment to an existing issue. 34 * 35 * @param string $p_username The name of the user trying to add an attachment to an issue. 36 * @param string $p_password The password of the user. 37 * @param integer $p_issue_id The id of the issue to add the attachment to. 38 * @param string $p_name The name of the file. 39 * @param string $p_file_type The mime type of the file. 40 * @param base64Binary $p_content The attachment to add. 41 * @return integer The id of the added attachment. 42 */ 43 function mc_issue_attachment_add( $p_username, $p_password, $p_issue_id, $p_name, $p_file_type, $p_content ) { 44 $t_user_id = mci_check_login( $p_username, $p_password ); 45 if( $t_user_id === false ) { 46 return mci_soap_fault_login_failed(); 47 } 48 if( !file_allow_bug_upload( $p_issue_id, $t_user_id ) ) { 49 return mci_soap_fault_access_denied( $t_user_id ); 50 } 51 if( !access_has_bug_level( config_get( 'upload_bug_file_threshold' ), $p_issue_id, $t_user_id ) ) { 52 return mci_soap_fault_access_denied( $t_user_id ); 53 } 54 return mci_file_add( $p_issue_id, $p_name, $p_content, $p_file_type, 'bug', '', '', $t_user_id ); 55 } 56 57 /** 58 * Delete an issue attachment given its id. 59 * 60 * @param string $p_username The name of the user trying to add an attachment to an issue. 61 * @param string $p_password The password of the user. 62 * @param integer $p_issue_attachment_id The id of the attachment to be deleted. 63 * @return true: success, false: failure 64 */ 65 function mc_issue_attachment_delete( $p_username, $p_password, $p_issue_attachment_id ) { 66 $t_user_id = mci_check_login( $p_username, $p_password ); 67 if( $t_user_id === false ) { 68 return mci_soap_fault_login_failed(); 69 } 70 $t_bug_id = file_get_field( $p_issue_attachment_id, 'bug_id' ); 71 if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id, $t_user_id ) ) { 72 return mci_soap_fault_access_denied( $t_user_id ); 73 } 74 return file_delete( $p_issue_attachment_id, 'bug' ); 75 }
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 |