1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

upload handler XML troubles - switched to new xml parse method

This commit is contained in:
secretr
2010-01-12 09:56:57 +00:00
parent b56a380e86
commit 2c1c818e23

View File

@@ -9,9 +9,9 @@
* File Upload Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $
* $Revision: 1.28 $
* $Date: 2010-01-11 21:32:01 $
* $Author: e107steved $
* $Revision: 1.29 $
* $Date: 2010-01-12 09:56:57 $
* $Author: secretr $
*/
@@ -20,7 +20,7 @@
*
* @package e107
* @subpackage e107_handlers
* @version $Id: upload_handler.php,v 1.28 2010-01-11 21:32:01 e107steved Exp $;
* @version $Id: upload_handler.php,v 1.29 2010-01-12 09:56:57 secretr Exp $;
*
* @todo - option to restrict by total size irrespective of number of uploads
*/
@@ -735,18 +735,14 @@ function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = F
if ($def_file && is_readable(e_ADMIN.$def_file))
{
$xml = e107::getXml();
$temp_vars = $xml->loadXMLfile(e_ADMIN.$def_file, true, false);
// class tag should be always array
$xml->setOptArrayTags('class');
$temp_vars = $xml->loadXMLfile(e_ADMIN.$def_file, 'filetypes', false);
if ($temp_vars === FALSE)
{
echo "Error reading XML file: {$def_file}<br />";
return $ret;
}
if (count($temp_vars['class']) == 1)
{
$temp_vars['class'] = array(
$temp_vars['class']
);
}
foreach ($temp_vars['class'] as $v1)
{
$v = $v1['@attributes'];
@@ -759,6 +755,7 @@ function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = F
foreach ($a_filetypes as $ftype)
{
$ftype = strtolower(trim(str_replace('.', '', $ftype))); // File extension
if (!$file_mask || in_array($ftype, $file_array))
{ // We can load this extension
if (isset($ret[$ftype]))
@@ -774,6 +771,7 @@ function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = F
}
}
}
return $ret;
}