1 <?php
3 class sieve_fileinto
4 {
5 var $data = array();
6 var $object_id= -1;
7 var $options = array();
9 function save_object()
10 {
11 $mbs = $this->get_mail_boxes();
13 if(isset($_POST['fileinto_'.$this->object_id])){
14 $mb = $_POST['fileinto_'.$this->object_id];
16 if(isset($mbs[$mb])) {
17 $this->data[0] = $mb;
18 }
19 }
20 }
22 function sieve_fileinto($data,$object_id)
23 {
24 $this->object_id = $object_id;
25 foreach($data['ELEMENTS'] as $node ){
26 if(in_array($node['class'],array("quoted-string","text"))){
27 $this->data[] = preg_replace("/\"/","",$node['text']);
28 }
29 }
30 }
32 function get_sieve_script_part()
33 {
34 $tmp = "";
35 foreach($this->data as $dat){
36 $tmp.= "\"".$dat."\", ";
37 }
38 $tmp = preg_replace("/,$/","",trim($tmp));
39 $tmp = preg_replace ("/\"\"/","\"",$tmp);
40 return("fileinto ".$tmp.";\n");
41 }
43 function execute()
44 {
45 $smarty = get_smarty();
46 $smarty->assign("Selected",$this->data[0]);
47 $smarty->assign("Boxes", $this->get_mail_boxes());
48 $smarty->assign("ID", $this->object_id);
49 $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
50 $object= $smarty->fetch(get_template_path("templates/element_fileinto.tpl",TRUE,dirname(__FILE__)));
51 $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
53 return($str);
54 }
56 function get_mail_boxes()
57 {
58 return(array("not"=>"not","impplemented/yet"=>"impplemented/yet"));
59 }
60 }
62 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
63 ?>