| [ 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 project 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_project_attachment_get( $p_username, $p_password, $p_project_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_project_attachment_id, 'doc', $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 project. 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_project_id The id of the project to add the attachment to. 38 * @param string $p_name The name of the file. 39 * @param string $p_title The title for the attachment. 40 * @param string $p_description The description for the attachment. 41 * @param string $p_file_type The mime type of the file. 42 * @param base64Binary $p_content The attachment to add. 43 * @return integer The id of the added attachment. 44 */ 45 function mc_project_attachment_add( $p_username, $p_password, $p_project_id, $p_name, $p_title, $p_description, $p_file_type, $p_content ) { 46 $t_user_id = mci_check_login( $p_username, $p_password ); 47 if( $t_user_id === false ) { 48 return mci_soap_fault_login_failed(); 49 } 50 51 # Check if project documentation feature is enabled. 52 if( OFF == config_get( 'enable_project_documentation' ) ) { 53 return mci_soap_fault_access_denied( $t_user_id ); 54 } 55 if( !access_has_project_level( config_get( 'upload_project_file_threshold' ), $p_project_id, $t_user_id ) ) { 56 return mci_soap_fault_access_denied( $t_user_id ); 57 } 58 if( is_blank( $p_title ) ) { 59 return new soap_fault( 'Client', '', 'Title must not be empty.' ); 60 } 61 return mci_file_add( $p_project_id, $p_name, $p_content, $p_file_type, 'project', $p_title, $p_description, $t_user_id ); 62 } 63 64 /** 65 * Delete a project attachment given its id. 66 * 67 * @param string $p_username The name of the user trying to add an attachment to an issue. 68 * @param string $p_password The password of the user. 69 * @param integer $p_project_attachment_id The id of the attachment to be deleted. 70 * @return true: success, false: failure 71 */ 72 function mc_project_attachment_delete( $p_username, $p_password, $p_project_attachment_id ) { 73 $t_user_id = mci_check_login( $p_username, $p_password ); 74 if( $t_user_id === false ) { 75 return mci_soap_fault_login_failed(); 76 } 77 $t_project_id = file_get_field( $p_project_attachment_id, 'project_id', 'project' ); 78 if( !access_has_project_level( config_get( 'upload_project_file_threshold' ), $t_project_id, $t_user_id ) ) { 79 return mci_soap_fault_access_denied( $t_user_id ); 80 } 81 return file_delete( $p_project_attachment_id, 'project' ); 82 }
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 |