1 <?php
2 class goSpamServerRule extends plugin {
4 var $attributes = array("name","rule");
5 var $name = "";
6 var $rule = "";
8 var $orig_name = "";
9 var $view_logged =FALSE;
11 function goSpamServerRule(&$config,$dn,$name = "",$rule ="")
12 {
13 plugin::plugin($config,$dn);
14 $this->name = $this->orig_name= $name;
15 $this->rule = $rule;
16 }
19 function execute()
20 {
21 plugin::execute();
23 $smarty = get_smarty();
25 if($this->is_account && !$this->view_logged){
26 $this->view_logged = TRUE;
27 new log("view","server/".get_class($this),$this->dn);
28 }
30 foreach($this->attributes as $attr){
31 $smarty->assign($attr,$this->$attr);
32 }
33 return($smarty->fetch(get_template_path("goSpamServerRule.tpl",TRUE,dirname(__FILE__))));
34 }
36 function save_object()
37 {
38 foreach($this->attributes as $attr){
39 if(isset($_POST[$attr])){
40 $this->$attr = $_POST[$attr];
41 }
42 }
43 }
45 function acl_is_writeable($attribute,$skip_write = FALSE)
46 {
47 if($this->read_only) return(FALSE);
48 $ui= get_userinfo();
49 return preg_match('/w/', $ui->get_permissions($this->acl_base, $this->acl_category."gospamserver", $attribute, $skip_write));
50 }
52 function save()
53 {
54 $ret =array();
55 $ret['orig_name'] = $this->orig_name;
56 $ret['name'] = $this->name;
57 $ret['rule'] = $this->rule;
58 return($ret);
59 }
61 function check()
62 {
63 $messages = plugin::check();
64 return($messages);
65 }
66 }
67 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
68 ?>