[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/api/soap/ -> mc_project_attachment_api.php (source)

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


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics