index 0dd19a21eab158856cb90dc5615415054f0ff403..8792f98f7a855b60f86f76dadf77a43b21b99ea3 100644 (file)
var $mode_stack = array();
var $pap = array();
+ var $parent = NULL;
+
+ function My_Tree(&$root,$parent)
+ {
+ $this->parent = $parent;
+ $this->_construct($root);
+ }
function execute()
{
if($node['class'] == "block-start"){
$tmp = array_pop($this->mode_stack);
$this->handle_elements($tmp,$node_id);
- $this->handle_elements(array("TYPE" => "block_start"),$node_id);
+ $this->handle_elements(array("TYPE" => "block_start"),preg_replace("/[^0-9]/","",microtime()));
}
/* This closes the last mode */
if($node['class'] == "block-end"){
$tmp = array_pop($this->mode_stack);
$this->handle_elements($tmp,$node_id);
- $this->handle_elements(array("TYPE" => "block_end"),$node_id);
+ $this->handle_elements(array("TYPE" => "block_end"),preg_replace("/[^0-9]/","",microtime()));
}
/* Semicolon indicates a new command */
$class_name= "sieve_".$type ;
if(class_exists($class_name)){
- $this->pap[] = new $class_name($data,$id);
+ $this->pap[] = new $class_name($data,$id,$this);
}else{
echo "<font color='red'>Missing : ".$class_name."</font>"."<br>";
}
function remove_object($key_id)
{
$class = get_class($this->pap[$key_id]);
- if(in_array($class,array("sieve_if"))){
+ if(in_array($class,array("sieve_if","sieve_elsif","sieve_else"))){
$block_start= $key_id;
$block_end = $this->get_block_end($key_id);
+
for($i = $block_start ; $i <= $block_end ; $i ++ ){
unset($this->pap[$i]);
}
/* Only execute if this is a really a block element.
* Block elements is only sieve_if
*/
- if(in_array(get_class($this->pap[$start]),array("sieve_if"))){
+ if(in_array(get_class($this->pap[$start]),array("sieve_if","sieve_elsif","sieve_else"))){
$class = get_class($this->pap[$start]);
$next_class = get_class($this->pap[$start+1]);
}
$start ++;
$class = get_class($this->pap[$start]);
- $next_class = get_class($this->pap[$start+1]);
+
+ if(isset($this->pap[$start+1])){
+ $next_class = get_class($this->pap[$start+1]);
+ }else{
+ $next_class ="";
+ }
}
}
return($start);
return($tmp);
}
- function Add_Element()
- {
- $tmp = array("ELEMENTS" => array(array("class" => "qouted-string","text"=> "Bla bla, later more")));
- $this->pap[] = new sieve_comment($tmp,rand(1000,100000));
- }
-
function check()
{
$msgs = array();