summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7707bd)
raw | patch | inline | side by side (parent: f7707bd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 23 Feb 2007 11:36:15 +0000 (11:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 23 Feb 2007 11:36:15 +0000 (11:36 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5730 594d385d-05f5-0310-b6e9-bd551577e9d8
index 703d44a1f8030815b8c0b52083d348ccf358179b..f0a3f9d89729b0d9867f7c54842ed356cd5e5371 100644 (file)
{
$this->status_text = "incomplete";
$this->script_ = $script;
- $this->tree_ = new My_Tree(Scanner::scriptStart());
+ $this->tree_ = new My_Tree(@Scanner::scriptStart());
$this->tree_->setDumpFunc(array(&$this, 'dumpToken_'));
$this->scanner_ = new Scanner($this->script_);
$this->scanner_->setCommentFunc(array($this, 'comment_'));
index 396634a6100fdad6b392611348b46eeed00958bc..744f974c0c49c4da064f9eeab52221135bab8c52 100644 (file)
$this->pap = array();
$this->doDump_(0, '', true);
- $this->dump_ ="<table width='100%'><tr><td style='background-color:#BBBBBB;border: solid 2px #FFFFFF;padding-left:20px;'>";
+ $this->dump_ ="<table width='100%'><tr><td style='background-color:#BBBBBB;border: 0px;padding-left:20px;'>";
foreach($this->pap as $object){
if(is_object($object)){
- $this->dump_ .= $object->execute()."<br>";
+ $this->dump_ .= preg_replace("/>/",">\n",$object->execute());
}
}
$this->dump_ .= "</td></tr></table>";
}
/* Handle identifiers */
- $identifiers = array("if","elsif","end","reject","redirect","vacation","keep","discard","comment","fileinto","require");
+ $identifiers = array("if","elsif","end","reject","redirect","vacation","keep","discard","comment","fileinto","require","stop");
if($node['class'] == "identifier" && in_array($node['text'],$identifiers)){
$this->mode_stack[] = array("TYPE" => $node['text']);
}
}
}
}
+
+
+function sieve_get_strings($data,$id)
+{
+ $ret = array();
+ if($data[$id]['class'] == "left-bracket"){
+ while($data[$id]['class'] != "right-bracket" && $id < count($data)){
+
+ if($data[$id]['class'] == "quoted-string"){
+ $ret[] = $data[$id]['text'];
+ }
+ $id ++;
+ }
+ }elseif($data[$id]['class'] == "quoted-string"){
+ $ret[] = $data[$id]['text'];
+ }elseif($data[$id]['class'] == "number"){
+ $ret[] = $data[$id]['text'];
+ }
+ return(array("OFFSET" => $id, "STRINGS" => $ret));
+}
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
index b6fde6fb591650a98d85503c2a0fac7108598bde..596bd6d008e6c144575d1f55258bb5513b21a3c6 100644 (file)
function resolve_to_object($data)
{
- $this->data = @nl2br($data->dumpParseTree());
+ $this->data = @$data->dumpParseTree();
}
function execute()
index 1bb693a987179902560f6d72747a581d783428d3..37031994e2b24c3e3417150dae538f6314db0677 100644 (file)
<?php
-class sieve_element
+class sieve_elsif extends sieve_if
{
-
- function execute()
- {
- return("NIY<br>");
- }
+ var $TYPE = "elsif";
}
-class sieve_elsif extends sieve_if {}
-class sieve_if extends sieve_element
-{
-
- /* Contains all tests with an uniqe id */
- var $test_list = array();
-
- /* Available test types */
- var $TESTS = array("address","allof","anyof","exists","false","header","not","size","true","envelope");
-
- var $elements = array();
-
- function sieve_if($elements)
- {
- $this->elements = $elements;
- $this->_parse($elements);
- }
-
- function execute()
- {
- return("-> "._("Condition"));
- }
-
-
- function _parse($data,$id = 0)
- {
- /* Objects that could be tested */
- $av_methods = array("address","allof","anyof","exists","false","header","not","size","true","envelope");
-
- /* Tests that could be used */
- $av_match_type= array(":is",":contains",":matches",":over",":count",":value");
-
- /* Variable initialization */
- $test_method = ""; // The object that we want to test, like 'header'
- $match_type = ""; // The operator like :contains
- $obj_attribute = ""; // The attribute we want to check, like 'from'
- $obj_match_value= ""; // The value that we want to match for.
- $comparator = ""; // The comperator specifies the type of values that should be matched.
-
- $node = $data['ELEMENTS'][$id];
-
- /* Skip the if / else identifier */
- if($node ['class'] == "identifier" && in_array($node['text'],array("if","elsif"))){
- $id ++;
- $node = $data['ELEMENTS'][$id];
- }
-
- /* Get current command like "allof" or "header" */
- if($node ['class'] == "identifier" && in_array($node['text'],$av_methods)){
- $test_method = $node['text'];
- }
-
- echo $id;
-
- /* switch different types */
- switch($test_method)
- {
- case "allof" : $this->_parse($elements,$id);
- case "anyof" : $this->_parse($elements,$id);
-
- case "address" :
- {
- /* header :comparator <string> :optional-operator :operator attribute match-value */
- $tmp = array();
- $tmp['OPTIONAL_OP'] ="";
- $tmp['COMPARATOR'] ="";
- $tmp['OPERATOR'] ="";
- $tmp['ATTRIBUTE'] ="";
- $tmp['MATCH-VALUE'] ="";
-
-
- }
- default : echo $test_method."<br>" ;
- }
- }
-};
-
-
-class sieve_comment extends sieve_element
+class sieve_comment
{
var $data = "";
function execute()
{
- return(_("Comment")." <input type='text' name='comment_' value='".$this->data."'>");
+ $str ="<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:#DDFFDD;'>"._("Comment");
+ $str .="<input type='text' name='comment_' value='".$this->data."'>";
+ $str .="</td></tr></table>";
+ return($str);
}
}
-class sieve_require extends sieve_element
+class sieve_require
+
{
var $data = array();
function execute()
{
- $str = _("Sieve includes");
+ $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:#DDDDFF;'>"._("Script includes");
foreach($this->data as $req){
$str .= " <i>".$req."</i>";
}
+ $str .="</td></tr></table>";
return($str);
}
}
-class sieve_discard extends sieve_element
+class sieve_discard
{
var $data = array();
function execute()
{
- $str = _("Discard mail");
+ $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:red;'>"._("Discard message");
+ $str .="</td></tr></table>";
return($str);
}
}
-class sieve_reject extends sieve_element
+class sieve_reject
{
var $data = array();
function execute()
{
- $str = _("Reject mail");
+ $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:gray;'>"._("Reject mail");
$str .= " <textarea name='test' style='width:90%'>".$this->data."</textarea>";
+ $str .="</td></tr></table>";
return($str);
}
}
-class sieve_redirect extends sieve_element
+class sieve_redirect
{
var $data = array();
function execute()
{
- $str = _("Redirect to");
+ $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:brown;'>"._("Redirect to");
foreach($this->data as $dest){
$str .= "<input type='text' name='bal' value='".$dest."'><br> ";
}
+ $str .="</td></tr></table>";
return($str);
}
}
-class sieve_fileinto extends sieve_element
+class sieve_fileinto
{
var $data = array();
function execute()
{
- $str = _("File into");
-
+ $str = "<table cellspacing=0 width='100%'><tr><td style='width:100%;background-color:green;'>"._("File into");
$str .= "<select name='test'>";
foreach($this->data as $folder){
$str .= "<option>".$folder."</option>";
}
$str .= "</select>";
+ $str .="</td></tr></table>";
return($str);
}
}
-class sieve_vacation extends sieve_element
+class sieve_vacation
{
var $days = FALSE;
var $subject = FALSE;
}
}
-class sieve_block_start extends sieve_element
+class sieve_block_start
{
function execute()
{
- return("<table width='100%'> <tr><td style='background-color:#BBBBBB;border: solid 2px #FFFFFF;padding-left:20px;'>");
+ return("<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:20px;'>
+ <img src='images/forward.png' class='center'>
+ </td>
+ <td style='background-color:#BBBBBB;border: solid 2px #FFFFFF;'>");
}
}
-class sieve_block_end extends sieve_element
+class sieve_block_end
{
function execute()
{
- return("</td></tr></table>");
+ return(" </td>
+ </tr>
+ </table>");
}
}
/* This class handles the keep statement */
-class sieve_keep extends sieve_element
+class sieve_keep
+{
+ function execute()
+ {
+ $str = "<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:green;'>".
+ _("Keep message");
+ $str .=" </td>
+ </tr>
+ </table>";
+ return($str);
+ }
+}
+
+/* This class handles the stop statement */
+class sieve_stop
{
function execute()
{
- return("-> "._("Keep message"));
+ $str = "<table cellspacing=0 width='100%'>
+ <tr>
+ <td style='width:100%;background-color:orange;'>".
+ _("Stop here");
+ $str .=" </td>
+ </tr>
+ </table>";
+ return($str);
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index c438a9ce29854cddd3552634a413bc40c140e260..3b94e4975ad433969882d6b781d2121acee5bc81 100644 (file)
require_once 'class_semantics.inc';
require_once 'class_tree.inc';
require_once 'class_sieve.inc';
+require_once 'class_sieveElement_If.inc';
?>