mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
* Filemanager/eTemplate: fix for MyStylite bug #2495: deleting files containing [ as first char deletes whole directory
added encoding of square brackets in eTemplate and improved etemplate_bo::(get|set|isset|unset)_array() to split indexes at ][ and not just [
This commit is contained in:
parent
0ec56da7a1
commit
108e95a51a
@ -194,7 +194,7 @@ class boetemplate extends soetemplate
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = str_replace(array("'",'"'),array('\\\'','"'),$value);
|
||||
$value = str_replace(array("'",'"','[',']'),array('\\\'','"','[',']'),$value);
|
||||
$name = str_replace(array('{'.$matches[1].'}',$matches[1]),$value,$name);
|
||||
}
|
||||
}
|
||||
@ -575,7 +575,10 @@ class boetemplate extends soetemplate
|
||||
*/
|
||||
static function isset_array($arr,$idx)
|
||||
{
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
if (count($idxs = explode('[', $idx, 2)) > 1)
|
||||
{
|
||||
$idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1)));
|
||||
}
|
||||
$last_idx = array_pop($idxs);
|
||||
$pos = &$arr;
|
||||
foreach($idxs as $idx)
|
||||
@ -602,7 +605,10 @@ class boetemplate extends soetemplate
|
||||
*/
|
||||
static function set_array(&$arr,$idx,$val)
|
||||
{
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
if (count($idxs = explode('[', $idx, 2)) > 1)
|
||||
{
|
||||
$idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1)));
|
||||
}
|
||||
$pos = &$arr;
|
||||
foreach($idxs as $idx)
|
||||
{
|
||||
@ -633,7 +639,10 @@ class boetemplate extends soetemplate
|
||||
}
|
||||
if (is_object($idx)) return false; // given an error in php5.2
|
||||
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
if (count($idxs = explode('[', $idx, 2)) > 1)
|
||||
{
|
||||
$idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1)));
|
||||
}
|
||||
$pos = &$arr;
|
||||
foreach($idxs as $idx)
|
||||
{
|
||||
@ -662,7 +671,10 @@ class boetemplate extends soetemplate
|
||||
{
|
||||
throw new egw_exception_assertion_failed(__METHOD__."(\$arr,'$idx') \$arr is no array!");
|
||||
}
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
if (count($idxs = explode('[', $idx, 2)) > 1)
|
||||
{
|
||||
$idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1)));
|
||||
}
|
||||
$last_idx = array_pop($idxs);
|
||||
$pos = &$arr;
|
||||
foreach($idxs as $idx)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - EditableTemplates - HTML User Interface
|
||||
* EGroupware - EditableTemplates - HTML User Interface
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
@ -2140,6 +2140,7 @@ class etemplate extends boetemplate
|
||||
{
|
||||
$attr = array();
|
||||
}
|
||||
$form_name = str_replace(array('[',']'), array('[',']'), $form_name);
|
||||
$value = etemplate::get_array($content_in,$form_name,True,$GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' ? false : true );
|
||||
// The comment below does only aplay to normal posts, not for xajax. Files are not supported anyway by xajax atm.
|
||||
// not checked checboxes are not returned in HTML and file is in $_FILES and not in $content_in
|
||||
|
Loading…
Reference in New Issue
Block a user