[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # MantisConnect - A webservice interface to Mantis Bug Tracker 3 # Copyright (C) 2004-2007 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 # -------------------------------------------------------- 10 # $Id: mc_issue_attachment_api.php,v 1.1 2007-07-18 06:52:56 vboctor Exp $ 11 # -------------------------------------------------------- 12 13 require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'mc_core.php' ); 14 15 /** 16 * Get the issue attachment with the specified id. 17 * 18 * @param string $p_username The name of the user trying to access the filters. 19 * @param string $p_password The password of the user. 20 * @param integer $p_attachment_id The id of the attachment to be retrieved. 21 * @return Base64 encoded data that represents the attachment. 22 */ 23 function mc_issue_attachment_get( $p_username, $p_password, $p_issue_attachment_id ) { 24 $t_user_id = mci_check_login( $p_username, $p_password ); 25 if ( $t_user_id === false ) { 26 return new soap_fault( 'Client', '', 'Access Denied' ); 27 } 28 return mci_file_get( $p_issue_attachment_id, 'bug' ); 29 } 30 31 /** 32 * Add an attachment to an existing issue. 33 * 34 * @param string $p_username The name of the user trying to add an attachment to an issue. 35 * @param string $p_password The password of the user. 36 * @param integer $p_issue_id The id of the issue to add the attachment to. 37 * @param string $p_name The name of the file. 38 * @param string $p_file_type The mime type of the file. 39 * @param base64Binary $p_content The attachment to add. 40 * @return integer The id of the added attachment. 41 */ 42 function mc_issue_attachment_add( $p_username, $p_password, $p_issue_id, $p_name, $p_file_type, $p_content ) { 43 $t_user_id = mci_check_login( $p_username, $p_password ); 44 if ( $t_user_id === false ) { 45 return new soap_fault( 'Client', '', 'Access Denied' ); 46 } 47 if ( !file_allow_bug_upload( $p_issue_id, $t_user_id ) ) { 48 return new soap_fault( 'Client', '', 'Access Denied' ); 49 } 50 if ( !access_has_bug_level( config_get( 'upload_bug_file_threshold' ), $p_issue_id, $t_user_id ) ) { 51 return new soap_fault( 'Client', '', 'Access Denied' ); 52 } 53 return mci_file_add( $p_issue_id, $p_name, $p_content, $p_file_type, 'bug' ); 54 } 55 56 /** 57 * Delete an issue attachment given its id. 58 * 59 * @param string $p_username The name of the user trying to add an attachment to an issue. 60 * @param string $p_password The password of the user. 61 * @param integer $p_issue_attachment_id The id of the attachment to be deleted. 62 * @return true: success, false: failure 63 */ 64 function mc_issue_attachment_delete( $p_username, $p_password, $p_issue_attachment_id ) { 65 $t_user_id = mci_check_login( $p_username, $p_password ); 66 if ( $t_user_id === false ) { 67 return new soap_fault( 'Client', '', 'Access Denied' ); 68 } 69 $t_bug_id = file_get_field( $p_issue_attachment_id, 'bug_id' ); 70 if ( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id, $t_user_id ) ) { 71 return new soap_fault( 'Client', '', 'Access Denied' ); 72 } 73 return file_delete( $p_issue_attachment_id, 'bug' ); 74 } 75 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |