[geeklog-cvs] geeklog-1.3/system/classes downloader.class.php,1.2,1.3

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Tue Jun 24 05:50:17 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/system/classes
In directory internal.geeklog.net:/tmp/cvs-serv5596

Modified Files:
	downloader.class.php 
Log Message:
Bugfixes:
1) Correctly initialise lists of available extensions and MIME types
2) Send a proper file name with the downloaded file


Index: downloader.class.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/system/classes/downloader.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** downloader.class.php	13 May 2002 18:53:07 -0000	1.2
--- downloader.class.php	24 Jun 2003 09:50:15 -0000	1.3
***************
*** 6,15 ****
  // +---------------------------------------------------------------------------+
  // | downloader.class.php                                                      |
- // | Geeklog file download class library.                                      |
  // |                                                                           |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2002 by the following authors:                              |
  // |                                                                           |
! // | Authors: Tony Bibbs       - tony at tonybibbs.com                            | 	
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 6,15 ----
  // +---------------------------------------------------------------------------+
  // | downloader.class.php                                                      |
  // |                                                                           |
+ // | Geeklog file download class library.                                      |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2002 by the following authors:                              |
  // |                                                                           |
! // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 102,105 ****
--- 102,108 ----
          $this->_doLogging = false;
          $this->_limitByIP = false;
+ 
+         $this->_setAvailableExtensions ();
+ 
      }
      
***************
*** 191,195 ****
  			$this->_availableMimeTypes = 
  				array(
-                     
  					'tgz' => 'application/x-gzip-compressed',
                      'gz' =>  'application/x-gzip-compressed',
--- 194,197 ----
***************
*** 218,221 ****
--- 220,228 ----
  			$this->_availableMimeTypes = $extensions;
  		}
+ 
+         $this->_availableExtensions = array ();
+         foreach ($this->_availableMimeTypes as $ext => $mime) {
+             $this->_availableExtensions[] = $ext;
+         }
      }
      
***************
*** 422,426 ****
      function checkExtension($extension)
      {
!         if (!in_array($extensions,$this->getAllowedExtensions())) {
  			$this->_addError('File type, .' . $extension . ', not in list of allowed file types available for download');
  			return false;
--- 429,433 ----
      function checkExtension($extension)
      {
!         if (!in_array($extension,$this->getAllowedExtensions())) {
  			$this->_addError('File type, .' . $extension . ', not in list of allowed file types available for download');
  			return false;
***************
*** 497,500 ****
--- 504,508 ----
              header('Content-transfer-encoding: binary' . "\n");
              header('Content-length: ' . filesize($this->_sourceDirectory . $fileName) . "\n");
+             header('Content-Disposition: attachment; filename="' . $fileName . '"');
  
              // Send file contents.
***************
*** 509,511 ****
  }
  
! ?>
\ No newline at end of file
--- 517,519 ----
  }
  
! ?>





More information about the geeklog-cvs mailing list