diff --git a/include/sieve/class_sieveElement_Require.inc b/include/sieve/class_sieveElement_Require.inc
index 3b91b8205f8d0b065fb55953dd3be32e1f4c85af..535c591e86a73da987331e3766b6d2d89719b371 100644 (file)
{
var $data = array();
var $object_id = -1;
{
var $data = array();
var $object_id = -1;
-
- function sieve_require($data,$object_id)
+ var $parent = NULL;
+
+ function sieve_require($data,$object_id,$parent)
{
{
+ $this->parent = $parent;
+ $this->object_id = $object_id;
if($data != NULL){
if($data != NULL){
- $this->object_id = $object_id;
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
$this->data[] = preg_replace("/\"/","",$node['text']);
foreach($data['ELEMENTS'] as $node ){
if(in_array($node['class'],array("quoted-string","text"))){
$this->data[] = preg_replace("/\"/","",$node['text']);
}
}
}
}
+ /* Add a new require statement and ensure
+ * that it is not specified twice
+ */
+ function Add_Require($str)
+ {
+ $current = array();
+
+ foreach($this->data as $dat){
+ $current[] = preg_replace("/\"/","",$dat);
+ }
+ if(!in_array($str,$current)){
+ $this->data[] = $str;
+ }
+ $this->data = array_unique($this->data);;
+ }
+
function save_object()
{
/* Get the values should check for, they are seperated by , */
function save_object()
{
/* Get the values should check for, they are seperated by , */
if(empty($val)) continue;
if(empty($val)) continue;
- $tmp[] = "\"".$val."\"";
+ $tmp[] = $val;
}
$this->data = $tmp;
}
}
$this->data = $tmp;
}
function get_sieve_script_part()
{
function get_sieve_script_part()
{
+ if(count($this->data)){
$tmp = sieve_create_strings($this->data);
return("require ".$tmp.";\n");
$tmp = sieve_create_strings($this->data);
return("require ".$tmp.";\n");
+ }else{
+ return("");
+ }
}
function execute()
{
$Require = "";
foreach($this->data as $key){
}
function execute()
{
$Require = "";
foreach($this->data as $key){
- $Require .= $key.", ";
+ $Require .= "\"".$key."\"".", ";
}
$Require = preg_replace("/,$/","",trim($Require));
}
$Require = preg_replace("/,$/","",trim($Require));
$smarty->assign("ID", $this->object_id);
$object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
$object= $smarty->fetch(get_template_path("templates/element_require.tpl",TRUE,dirname(__FILE__)));
$smarty->assign("ID", $this->object_id);
$object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
$object= $smarty->fetch(get_template_path("templates/element_require.tpl",TRUE,dirname(__FILE__)));
- $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+ $str = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($object,"\\"),$object_container);
return($str);
}
}
return($str);
}
}