[geeklog-cvs] geeklog-1.3/system/classes upload.class.php,1.23,1.23.2.1

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Fri May 23 07:43:49 EDT 2003


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

Modified Files:
      Tag: geeklog_1_3_7sr1_1
	upload.class.php 
Log Message:
Check for file extension (in addition to the MIME type) when uploading images.


Index: upload.class.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/system/classes/upload.class.php,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -C2 -d -r1.23 -r1.23.2.1
*** upload.class.php	1 Jan 2003 18:56:21 -0000	1.23
--- upload.class.php	23 May 2003 11:43:47 -0000	1.23.2.1
***************
*** 251,263 ****
                  'application/x-zip-compressed' 		=> '.zip',
                  'application/x-tar'					=> '.tar',
!                 'text/plain'						=> '.php, .txt, .inc (etc)',
!                 'text/html'							=> '.html, .htm (etc)',
!                 'image/bmp' 						=> '.bmp, .ico',
                  'image/gif' 						=> '.gif',
!                 'image/pjpeg'						=> '.jpg, .jpeg',
!                 'image/jpeg'						=> '.jpg, .jpeg',
!                 'image/png'						=> '.png',
                  'image/x-png'						=> '.png',
!                 'audio/mpeg'						=> '.mp3 etc',
                  'audio/wav'							=> '.wav',
                  'application/pdf'					=> '.pdf',
--- 251,263 ----
                  'application/x-zip-compressed' 		=> '.zip',
                  'application/x-tar'					=> '.tar',
!                 'text/plain'						=> '.phps,.txt,.inc',
!                 'text/html'							=> '.html,.htm',
!                 'image/bmp' 						=> '.bmp,.ico',
                  'image/gif' 						=> '.gif',
!                 'image/pjpeg'						=> '.jpg,.jpeg',
!                 'image/jpeg'						=> '.jpg,.jpeg',
!                 'image/png'							=> '.png',
                  'image/x-png'						=> '.png',
!                 'audio/mpeg'						=> '.mp3',
                  'audio/wav'							=> '.wav',
                  'application/pdf'					=> '.pdf',
***************
*** 265,269 ****
                  'application/msword'				=> '.doc',
                  'application/vnd.ms-excel'			=> '.xls',
!                 'application/octet-stream'			=> '.exe, .fla, .psd (etc)'
              );
          } else {
--- 265,269 ----
                  'application/msword'				=> '.doc',
                  'application/vnd.ms-excel'			=> '.xls',
!                 'application/octet-stream'			=> '.fla,.psd'
              );
          } else {
***************
*** 645,651 ****
      {
          if ($switch) {
!             $this->_continueOnError = $true;
          } else {
!             $this->_continueOnError = $false;
          }
      }
--- 645,651 ----
      {
          if ($switch) {
!             $this->_continueOnError = true;
          } else {
!             $this->_continueOnError = false;
          }
      }
***************
*** 823,834 ****
              $this->_currentFile['type'] = substr ($this->_currentFile['type'], 0, $sc);
          }
!         if (!in_array($this->_currentFile['type'],$this->getAllowedMimeTypes())) {
! 			$this->_addError('Mime type, ' . $this->_currentFile['type'] . ', not in list of allowed mime types');
! 			return false;
! 		} else {
! 			return true;
! 		}
      }
!     
      /**
      * Sets file upload path
--- 823,843 ----
              $this->_currentFile['type'] = substr ($this->_currentFile['type'], 0, $sc);
          }
!         $mimeTypes = $this->getAllowedMimeTypes ();
!         foreach ($mimeTypes as $mimeT => $extList) {
!             if ($mimeT == $this->_currentFile['type']) {
!                 $extensions = explode (',', $extList);
!                 $fileName = $this->_currentFile['name'];
!                 foreach ($extensions as $ext) {
!                     if (strcasecmp (substr ($fileName, -strlen ($ext)), $ext) == 0) {
!                         return true;
!                     }
!                 }
!             }
!         }
!         $this->_addError ('Mime type, ' . $this->_currentFile['type']
!                           . ', not in list of allowed mime types');
!         return false;
      }
! 
      /**
      * Sets file upload path





More information about the geeklog-cvs mailing list