treasury
[ class tree: treasury ] [ index: treasury ] [ all elements ]

Source for file download.php

Documentation is available at download.php

  1. <?php
  2. /**
  3.  * @version      $Header: /cvsroot/bitweaver/_bit_treasury/download.php,v 1.9 2007/01/20 10:24:41 squareing Exp $
  4.  *
  5.  * @author       xing  <xing@synapse.plus.com>
  6.  * @package      treasury
  7.  * @copyright    2003-2006 bitweaver
  8.  * @license      LGPL {@link http://www.gnu.org/licenses/lgpl.html}
  9.  ***/
  10.  
  11. /**
  12.  * Setup
  13.  */ 
  14. require_once'../bit_setup_inc.php' );
  15.  
  16. $gBitSystem->verifyPackage'treasury' );
  17.  
  18. require_onceTREASURY_PKG_PATH.'TreasuryItem.php');
  19. require_onceTREASURY_PKG_PATH.'item_lookup_inc.php');
  20.  
  21. // Make sure we have the correct permissions for this item to download it
  22. // file specific permissions are not yet available
  23. //$gContent->updateUserPermissions();
  24.  
  25. $gContent->hasGalleryPermissions'p_treasury_download_item'TRUE );
  26.  
  27. // TODO: make sure this works reliably - not sure what is better:
  28. //       - add hit after download is complete
  29. //       - add hit as soon as user executes this script
  30. //$gContent->addHit();
  31.  
  32. if$download_function $gTreasurySystem->getPluginFunction$gContent->mInfo['plugin_guid']'download_function' )) {
  33.     if$download_function$gContent->mInfo )) {
  34.         // add hit if download was successful
  35.         $gContent->addHit();
  36.     else {
  37.         if!empty$gContent->mInfo['errors')) {
  38.             $msg '';
  39.             foreach$gContent->mInfo['errors'as $error {
  40.                 $msg .= $error.'<br />';
  41.             }
  42.             $gBitSystem->fatalError$msg );
  43.         else {
  44.             $gBitSystem->fatalError'There was an undetermined problem trying to prepare the file for download.' );
  45.         }
  46.     }
  47. else {
  48.     $gBitSystem->fatalErrortra"No suitable download function found." ));
  49. }
  50. ?>

Documentation generated on Thu, 15 Feb 2007 20:38:04 +0000 by phpDocumentor 1.3.0