[geeklog-cvs] geeklog-1.3/system/classes upload.class.php,1.26,1.27
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Fri May 23 07:43:29 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/system/classes
In directory internal.geeklog.net:/tmp/cvs-serv3581/system/classes
Modified Files:
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.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** upload.class.php 27 Mar 2003 20:20:00 -0000 1.26
--- upload.class.php 23 May 2003 11:43:27 -0000 1.27
***************
*** 252,267 ****
$this->_availableMimeTypes =
array(
! 'application/x-gzip-compressed' => '.tar.gz, .tgz',
'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',
--- 252,267 ----
$this->_availableMimeTypes =
array(
! 'application/x-gzip-compressed' => '.tar.gz,.tgz',
'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',
***************
*** 269,273 ****
'application/msword' => '.doc',
'application/vnd.ms-excel' => '.xls',
! 'application/octet-stream' => '.exe, .fla, .psd (etc)'
);
} else {
--- 269,273 ----
'application/msword' => '.doc',
'application/vnd.ms-excel' => '.xls',
! 'application/octet-stream' => '.fla,.psd'
);
} else {
***************
*** 880,889 ****
$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;
! }
}
--- 880,898 ----
$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;
}
More information about the geeklog-cvs
mailing list