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:
@@ -9,9 +9,9 @@
|
|||||||
* File Upload Handler
|
* File Upload Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $
|
||||||
* $Revision: 1.28 $
|
* $Revision: 1.29 $
|
||||||
* $Date: 2010-01-11 21:32:01 $
|
* $Date: 2010-01-12 09:56:57 $
|
||||||
* $Author: e107steved $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @package e107
|
* @package e107
|
||||||
* @subpackage e107_handlers
|
* @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
|
* @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))
|
if ($def_file && is_readable(e_ADMIN.$def_file))
|
||||||
{
|
{
|
||||||
$xml = e107::getXml();
|
$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)
|
if ($temp_vars === FALSE)
|
||||||
{
|
{
|
||||||
echo "Error reading XML file: {$def_file}<br />";
|
echo "Error reading XML file: {$def_file}<br />";
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
if (count($temp_vars['class']) == 1)
|
|
||||||
{
|
|
||||||
$temp_vars['class'] = array(
|
|
||||||
$temp_vars['class']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
foreach ($temp_vars['class'] as $v1)
|
foreach ($temp_vars['class'] as $v1)
|
||||||
{
|
{
|
||||||
$v = $v1['@attributes'];
|
$v = $v1['@attributes'];
|
||||||
@@ -759,6 +755,7 @@ function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = F
|
|||||||
foreach ($a_filetypes as $ftype)
|
foreach ($a_filetypes as $ftype)
|
||||||
{
|
{
|
||||||
$ftype = strtolower(trim(str_replace('.', '', $ftype))); // File extension
|
$ftype = strtolower(trim(str_replace('.', '', $ftype))); // File extension
|
||||||
|
|
||||||
if (!$file_mask || in_array($ftype, $file_array))
|
if (!$file_mask || in_array($ftype, $file_array))
|
||||||
{ // We can load this extension
|
{ // We can load this extension
|
||||||
if (isset($ret[$ftype]))
|
if (isset($ret[$ftype]))
|
||||||
@@ -774,6 +771,7 @@ function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = F
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user