Code

8afd4dda024a3274e20c69e5f30dc16a50b1d751
[gosa.git] / plugins / admin / systems / class_goMailServer.inc
1 <?php
3 class goMailServer extends plugin{
4         
5   var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports mailqueue listings and so on.";
6   var $cli_description  = "Some longer text\nfor help";
7   var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9   /* This plugin only writes its objectClass */
10   var $objectclasses    = array("goMailServer");
12   /* This class can't be assigned twice so it conflicts with itsself */
13   var $conflicts        = array("goMailServer");
15   var $DisplayName      = "";
16   var $dn               = NULL;
17   var $StatusFlag       = "goMailServerStatus";
18   var $attributes       = array("goMailServerStatus","description","postfixHeaderSizeLimit",
19       "postfixMailboxSizeLimit","postfixMessageSizeLimit",
20       "postfixMyDestinations","postfixMyDomain","postfixMyhostname",
21       "postfixMyNetworks","postfixRelayhost","postfixTransportTable",
22       "postfixSenderRestrictions","postfixRecipientRestrictions");
24   var $goMailServerStatus               ;
25   var $postfixHeaderSizeLimit           = 0;
26   var $postfixMailboxSizeLimit          = 0;
27   var $postfixMessageSizeLimit          = 0;
28   var $postfixMyDestinations            = array();
29   var $postfixMyDomain                  = "";
30   var $postfixMyhostname                = "";
31   var $postfixMyNetworks                = array();
32   var $postfixRelayhost                 = "";
33   var $postfixTransportTable            = array();
34   var $postfixSenderRestrictions        = array();
35   var $postfixRecipientRestrictions     = array();
36   var $description                      = "";
37   var $RestrictionFilters               = array();
38   var $TransportProtocols               = array(); 
39   var $Actions                          = array();
42   function goMailServer($config,$dn)
43   {
44     plugin::plugin($config,$dn);
45     $this->DisplayName = _("Mail service (SMTP)");
47     $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED,
48                             SERVICE_STARTED => SERVICE_STARTED,
49                             SERVICE_RESTARTED=>SERVICE_RESTARTED, 
50                             "mailqueue"=>"mailqueue");
52     /* Fill  RestrictionFilters   TransportProtocols  from external hooks */
53     $str = $this->config->data['TABS']['SERVERSERVICE'];
54     $this->TransportProtocols =array("smtp"=>"SMTP");
55     $this->RestrictionFilters = array("FILTER"=>"FILTER"); 
56     foreach(array("ADDITIONALRESTRICTIONFILTERS"=>"RestrictionFilters",
57           "ADDITIONALPROTOCOLLS"        =>"TransportProtocols") as $file => $var){
58       if(isset($this->config->data['MAIN'][$file])){
59         $file = $this->config->data['MAIN'][$file];
60         if((isset($file)) && is_readable($file)){
61           $tmp = file_get_contents($file);
62           $tmp2= split("\n",$tmp);
63           foreach($tmp2 as $entry){
64             if(empty($entry)) continue;
65             if(preg_match("/:/",$entry)){
66               $tmp3 = split(":",$entry);
67               $r = $this->$var;
68               $r[$tmp3[0]]=$tmp3[1];
69               $this->$var = $r;
70             }else{
71               $r = $this->$var;
72               $r[$entry] =$entry;
73               $this->$var = $r;
74             }
75           }
76         }
77       }
78     }
81     /* Get postfix my networks */
82     $this->postfixMyNetworks = array();
83     if(isset($this->attrs['postfixMyNetworks'][0])){
84       $tmp = split(",",$this->attrs['postfixMyNetworks'][0]);
85       foreach($tmp as $str){
86         if(!empty($str)){
87           $this->postfixMyNetworks[base64_encode($str)] = $str;
88         }
89       }
90     }
93     /* Create full name */
94     if(isset($this->attrs['postfixMyDomain'][0])){
95       $this->postfixMyhostname .= ".".$this->attrs['postfixMyDomain'][0];
96     }
97   
99     /* Get postfix my domains */
100     $this->postfixMyDestinations = array(); 
101     if(isset($this->attrs['postfixMyDestinations'][0])){
102       unset($this->attrs['postfixMyDestinations']['count']);
103       foreach($this->attrs['postfixMyDestinations'] as $str){
104         $this->postfixMyDestinations[base64_encode($str)] = $str;
105       }
106     }
109     /* Get transport tables */
110     $this->postfixTransportTable = array();
111     if(isset($this->attrs['postfixTransportTable'])){
112       $tmp = array();
113       unset($this->attrs['postfixTransportTable']['count']);
114       foreach($this->attrs['postfixTransportTable'] as $entry){ 
115         $nr  = preg_replace("/:.*$/","",$entry);
116         $rest= trim(preg_replace("/^[^:]+:/","",$entry));
117         $src = preg_replace("/ .*$/","",$rest);
118         $rest= preg_replace("/^[^ ]+ /","",$rest);
119         $dst = preg_replace("/^.*:/","",$rest); 
120         $prt = preg_replace("/:.*$/","",$rest);
121       
122         $tmp[$nr]['src'] = $src;
123         $tmp[$nr]['dst'] = $dst;
124         $tmp[$nr]['prt'] = $prt;
125         
126       }
127       ksort($tmp);
128       foreach($tmp as $entry){
129         $this->postfixTransportTable[] = $entry;
130       }
131     }
132    
134     /* Get sender restrictions */
135     $this->postfixSenderRestrictions = array();
136     if(isset($this->attrs['postfixSenderRestrictions'])){
137       unset($this->attrs['postfixSenderRestrictions']['count']);
138       foreach($this->attrs['postfixSenderRestrictions'] as $entry){
139         $nr  = preg_replace("/:.*$/","",$entry);
140         $rest= trim(preg_replace("/^[^:]+:/","",$entry));
141         $src = preg_replace("/ .*$/","",$rest);
142         $rest= preg_replace("/^[^ ]+ /","",$rest);
143         $dst = preg_replace("/^.* /","",$rest);
144         $prt = preg_replace("/ .*$/","",$rest);
145  
146         $tmp[$nr]['src'] = $src;
147         $tmp[$nr]['dst'] = $dst;
148         $tmp[$nr]['filter'] = $prt;
149       }
150       ksort($tmp);
151       foreach($tmp as $entry){
152         $this->postfixSenderRestrictions[] = $entry;
153       }
154     }
156  
157     /* Get sender restrictions */
158     $this->postfixRecipientRestrictions = array();
159     if(isset($this->attrs['postfixRecipientRestrictions'])){
160       unset($this->attrs['postfixRecipientRestrictions']['count']);
161       foreach($this->attrs['postfixRecipientRestrictions'] as $entry){
162         $nr  = preg_replace("/:.*$/","",$entry);
163         $rest= trim(preg_replace("/^[^:]+:/","",$entry));
164         $src = preg_replace("/ .*$/","",$rest);
165         $rest= preg_replace("/^[^ ]+ /","",$rest);
166         $dst = preg_replace("/^.* /","",$rest);
167         $prt = preg_replace("/ .*$/","",$rest);
168  
169         $tmp[$nr]['src'] = $src;
170         $tmp[$nr]['dst'] = $dst;
171         $tmp[$nr]['filter'] = $prt;
172       }
173       ksort($tmp);
174       foreach($tmp as $entry){
175         $this->postfixRecipientRestrictions[] = $entry;
176       }
177     }
179   }
181   function execute()
182   { 
183     $smarty   = get_smarty();
184     $delAr    = array( "TranslationDel_"=>"TranslationDel",
185                     "SenderRestrictDel_"=>"SenderRestrictDel",
186                     "RecipientRestrictDel_"=>"RecipientRestrictDel");
187  
188     $once     = true;
189     $s_action = "";
190     $s_entry  = "";
191   
192     /* Check posts for some intruductions */
193     foreach($_POST as $name => $value){
194       foreach($delAr as $preg => $type){
195         if((preg_match("/^".$preg."/",$name)) && ($once)){
196           $once = false;
197           $s_action = $type; 
198           $s_entry = preg_replace("/^".$preg."/","",$name);
199           $s_entry = preg_replace("/_[xy]$/","",$s_entry);
200         }
201       }
202   
204       if(preg_match("/^TranslationUp_/",$name) && $once){
205         $once = false;
206         $key = preg_replace("/^TranslationUp_/","",$name);
207         $key = preg_replace("/_[xy]$/","",$key);
208         $this->postfixTransportTable = $this->ArrayUp($key,$this->postfixTransportTable) ;
209       }
210       if(preg_match("/^TranslationDown_/",$name) && $once){
211         $once = false;
212         $key = preg_replace("/^TranslationDown_/","",$name);
213         $key = preg_replace("/_[xy]$/","",$key);
214         $this->postfixTransportTable = $this->ArrayDown($key,$this->postfixTransportTable) ;
215       }
216       if(preg_match("/^SenderRestrictUp_/",$name) && $once){
217         $once = false;
218         $key = preg_replace("/^SenderRestrictUp_/","",$name);
219         $key = preg_replace("/_[xy]$/","",$key);
220         $this->postfixSenderRestrictions = $this->ArrayUp($key,$this->postfixSenderRestrictions) ;
221       }
222       if(preg_match("/^SenderRestrictDown_/",$name) && $once){
223         $once = false;
224         $key = preg_replace("/^SenderRestrictDown_/","",$name);
225         $key = preg_replace("/_[xy]$/","",$key);
226         $this->postfixSenderRestrictions = $this->ArrayDown($key,$this->postfixSenderRestrictions) ;
227       }
228       if(preg_match("/^RecipientRestrictUp_/",$name) && $once){
229         $once = false;
230         $key = preg_replace("/^RecipientRestrictUp_/","",$name);
231         $key = preg_replace("/_[xy]$/","",$key);
232         $this->postfixRecipientRestrictions = $this->ArrayUp($key,$this->postfixRecipientRestrictions) ;
233       }
234       if(preg_match("/^RecipientRestrictDown_/",$name) && $once){
235         $once = false;
236         $key = preg_replace("/^RecipientRestrictDown_/","",$name);
237         $key = preg_replace("/_[xy]$/","",$key);
238         $this->postfixRecipientRestrictions = $this->ArrayDown($key,$this->postfixRecipientRestrictions) ;
239       }
240     }
243     /* Add delete my network entry */
244     if((isset($_POST['AddpostfixMyNetworks'])) && (!empty($_POST['NewString_postfixMyNetworks']))){
245       $str = $_POST['NewString_postfixMyNetworks'];
246       $this->postfixMyNetworks[base64_encode($str)] = $str;
247     }
249     if((isset($_POST['DelpostfixMyNetworks'])) && isset($_POST['Select_postfixMyNetworks']) &&(count($_POST['Select_postfixMyNetworks']))){
250       foreach($_POST['Select_postfixMyNetworks'] as $str ){
251         unset($this->postfixMyNetworks[$str]);
252       }
253     }
256     /* Add delete my domain entry */
257     if((isset($_POST['AddpostfixMyDestinations'])) && (!empty($_POST['NewString_postfixMyDestinations']))){
258       $str = $_POST['NewString_postfixMyDestinations'];
259       $this->postfixMyDestinations[base64_encode($str)] = $str;
260     }
262     if((isset($_POST['DelpostfixMyDestinations'])) && isset($_POST['Select_postfixMyDestinations']) &&(count($_POST['Select_postfixMyDestinations']))){
263       foreach($_POST['Select_postfixMyDestinations'] as $str ){
264         unset($this->postfixMyDestinations[$str]);
265       }
266     }
269     /* Add sender restriction */
270     if(($s_action == "SenderRestrictDel") && (isset($this->postfixSenderRestrictions[$s_entry]))){
271       unset($this->postfixSenderRestrictions[$s_entry]);
272     }
274     if(isset($_POST['AddpostfixSenderRestrictions'])){
275       $src      = $_POST['Source_postfixSenderRestrictions'];
276       $dst      = $_POST['Destination_postfixSenderRestrictions'];
277       $Filter   = $_POST['SenderRestrictionFilter'];
278       $tmp['src']     = $src;
279       $tmp['dst']     = $dst;
280       $tmp['filter']  = $Filter;
281       $this->postfixSenderRestrictions[] = $tmp;
282     }
285     /* Add sender restriction */
286     if(($s_action == "RecipientRestrictDel") && (isset($this->postfixRecipientRestrictions[$s_entry]))){
287       unset($this->postfixRecipientRestrictions[$s_entry]);
288     }
290     if(isset($_POST['AddpostfixRecipientRestrictions'])){
291       $src      = $_POST['Source_postfixRecipientRestrictions'];
292       $dst      = $_POST['Destination_postfixRecipientRestrictions'];
293       $Filter   = $_POST['RecipientRestrictionFilter'];
294       $tmp['src']     = $src;
295       $tmp['dst']     = $dst;
296       $tmp['filter']  = $Filter;
297       $this->postfixRecipientRestrictions[] = $tmp;
298     }
301     /* Handle transports */
302     if(($s_action == "TranslationDel") && (isset($this->postfixTransportTable[$s_entry]))){
303       unset($this->postfixTransportTable[$s_entry]);
304     }
305     
306     if(isset($_POST['AddpostfixTransportTable'])){
307       $src = trim($_POST['Source_postfixTransportTable']);  
308       $dst = trim($_POST['Destination_postfixTransportTable']);    
309       $prt = trim($_POST['TransportProtocol']);
311       if((!empty($src)) && (!empty($dst))){
312         if(preg_match("/:/",$dst)){
313           $tmp = split("\:",$dst);
314           $port = trim($tmp[1]);
315           $ip   = trim($tmp[0]);
316     
317           if((is_ip($ip)) && (is_numeric($port))){
318             $dst = "[".$ip."]:".$port;
319           }
320         }
321         if(is_ip($dst)){
322           $dst = "[".$dst."]";
323         }
324         $tmp2 ['src'] = $src;
325         $tmp2 ['dst'] = $dst;
326         $tmp2 ['prt'] = $prt;
328         $this->postfixTransportTable[] = $tmp2;  
329       } 
330     }
333     /* Set attributes */
334     foreach($this->attributes as $attr){
335       $smarty->assign($attr,$this->$attr);
336     }
339     /* Create divList for translation tables */
340     $divTranslation = new divSelectBox("TransportProtocols");
341     $divTranslation->SetHeight(90);
342     foreach($this->postfixTransportTable as $key => $entry){
343       $img = "";
345       if($key != 0){
346         $img.= "<input type='image' src='images/sort_up.png' name='TranslationUp_".$key."' class='center'>&nbsp;";      
347       }else{
348         $img.= "<img src='images/empty.png' style='width:10px;'>";
349       }
350       if(($key+1) < count($this->postfixTransportTable)){
351         $img.= "<input type='image' src='images/sort_down.png' name='TranslationDown_".$key."' class='center'>&nbsp;";      
352       }else{
353         $img.= "<img src='images/empty.png' style='width:10px;'>";
354       }
356       $img.= "<input type='image' src='images/edittrash.png' name='TranslationDel_".$key."' class='center'>&nbsp;";      
357       $field1 = array("string"=> $entry['src']);
358       $field2 = array("string"=> $entry['dst']);
359       $field3 = array("string"=> $entry['prt'],"attach"=>"style='width:120px;'");
360       $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
361       $divTranslation->AddEntry(array($field1,$field2,$field3,$field4,));
362     }
363     $smarty->assign("Div_postfixTransportTable" ,$divTranslation->DrawList());
366     /* Create divList for sender restrictions */
367     $DivSenderRestrict = new divSelectBox("postfixSenderRestrictions");
368     $DivSenderRestrict->SetHeight(90);
369     foreach($this->postfixSenderRestrictions as $key => $entry){
370       $img ="";
372       if($key != 0){
373         $img.= "<input type='image' src='images/sort_up.png' name='SenderRestrictUp_".$key."' class='center'>&nbsp;";      
374       }else{
375         $img.= "<img src='images/empty.png' style='width:10px;'>";
376       }
377       if(($key+1) < count($this->postfixSenderRestrictions)){
378         $img.= "<input type='image' src='images/sort_down.png' name='SenderRestrictDown_".$key."' class='center'>&nbsp;";      
379       }else{
380         $img.= "<img src='images/empty.png' style='width:10px;'>";
381       }
383       $img.= "<input type='image' src='images/edittrash.png' name='SenderRestrictDel_".$key."' class='center'>&nbsp;";     
384  
385       $field1 = array("string"=> $entry['src']);
386       $field2 = array("string"=> $entry['dst']);
387       $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
388       $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
389       $DivSenderRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
390     }
391     $smarty->assign("Div_postfixSenderRestrictions" ,$DivSenderRestrict->DrawList());
394     /* Create divList for translation tables */
395     $DivRecipientRestrict = new divSelectBox("postfixRecipientRestrictions");
396     $DivRecipientRestrict->SetHeight(90);
398     foreach($this->postfixRecipientRestrictions as $key => $entry){
399       $img = "";
400       if($key != 0){
401         $img.= "<input type='image' src='images/sort_up.png' name='RecipientRestrictUp_".$key."' class='center'>&nbsp;";      
402       }else{
403         $img.= "<img src='images/empty.png' style='width:10px;'>";
404       }
405       if(($key+1) < count($this->postfixRecipientRestrictions)){
406         $img.= "<input type='image' src='images/sort_down.png' name='RecipientRestrictDown_".$key."' class='center'>&nbsp;";      
407       }else{
408         $img.= "<img src='images/empty.png' style='width:10px;'>";
409       }
410       $img.= "<input type='image' src='images/edittrash.png' name='RecipientRestrictDel_".$key."' class='center'>&nbsp;";      
411       $field1 = array("string"=> $entry['src']);
412       $field2 = array("string"=> $entry['dst']);
413       $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
414       $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
415       $DivRecipientRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
416     }
417     $smarty->assign("Div_postfixRecipientRestrictions" ,$DivRecipientRestrict->DrawList());
419     
420     /* set new status */
421     if(isset($_POST['ExecAction'])){
422       if(isset($this->Actions[$_POST['action']])){
423         $this->setStatus($_POST['action']);
424       }
425     }
428     $smarty->assign("is_new",                       $this->dn);
429     $smarty->assign("TransportProtocols",           $this->TransportProtocols);
430     $smarty->assign("Actions",                      $this->Actions);
431     $smarty->assign("RestrictionFilters",           $this->RestrictionFilters);
432     $smarty->assign("postfixTransportTable" ,       $this->getTransports());
433     $smarty->assign("postfixSenderRestrictions" ,   $this->getSenderRestrictions());
434     $smarty->assign("postfixRecipientRestrictions" ,$this->getRecipientRestrictions());
436     return($smarty->fetch(get_template_path("goMailServer.tpl",TRUE,dirname(__FILE__))));
437   }
439  
440   /* return transports formated for select box */ 
441   function getTransports()
442   {
443     $ret = array();
444     foreach($this->postfixTransportTable as $key => $vals){
445       $ret[$key] = $vals['src']." -> ".$vals['prt'].":".$vals['dst'];
446     }
447     return($ret);
448   }
451   /* return sender restriction formated for select box */ 
452   function getSenderRestrictions()
453   {
454     $ret = array();
455     foreach($this->postfixSenderRestrictions as $key => $vals){
456       $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
457     }
458     return($ret);
459   }
462   /* return recipient restriction formated for select box */ 
463   function getRecipientRestrictions()
464   {
465     $ret = array();
466     foreach($this->postfixRecipientRestrictions as $key => $vals){
467       $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
468     }
469     return($ret);
470   }
473   /* Return list entry */
474   function getListEntry()
475   {
476     $flag = $this->StatusFlag;
477     $fields['Status']     = $this->$flag;
478     $fields['Message']    = _("Postfix")." ["._("configured for")." ".$this->postfixMyhostname."] ";
479     $fields['AllowStart'] = true;
480     $fields['AllowStop']  = true;
481     $fields['AllowRestart'] = true;
482     $fields['AllowRemove']= true;
483     $fields['AllowEdit']  = true;
484     return($fields);
485   }
488   function remove_from_parent()
489   {
490     plugin::remove_from_parent();
491     /* Check if this is a new entry ... add/modify */
492     $ldap = $this->config->get_ldap_link();
493     $ldap->cat($this->dn,array("objectClass"));
494     if($ldap->count()){
495       $ldap->cd($this->dn);
496       $ldap->modify($this->attrs);
497     }else{
498       $ldap->cd($this->dn);
499       $ldap->add($this->attrs);
500     }
501     show_ldap_error($ldap->get_error());
502   }
505   function save()
506   {
507     plugin::save();
509     /* Fix transport table*/
510     $i = 0 ; 
511     $this->attrs['postfixTransportTable'] = array();
512     foreach($this->postfixTransportTable as $key => $entry){
513       $this->attrs['postfixTransportTable'][] = $i.": ".$entry['src']." ".$entry['prt'].":".$entry['dst'];
514       $i ++;
515     }
518     /* Fix sender restrictions */
519     $i = 0;
520     $this->attrs['postfixSenderRestrictions'] =array();
521     foreach($this->postfixSenderRestrictions as $key => $entry){
522       $this->attrs['postfixSenderRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
523       $i ++;  
524     }
525   
526   
527     /* Fix recipient restrictions */
528     $i = 0;
529     $this->attrs['postfixRecipientRestrictions'] =array();
530     foreach($this->postfixRecipientRestrictions as $key => $entry){
531       $this->attrs['postfixRecipientRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
532       $i ++;  
533     }
536     /* Fix mydomains */
537     $this->attrs['postfixMyDestinations']  = array();
538     foreach($this->postfixMyDestinations as $entry){
539       $this->attrs['postfixMyDestinations'][] =$entry;
540     }
543     /* Fix mydomains */
544     if(count($this->postfixMyNetworks)){
545       $this->attrs['postfixMyNetworks']  = "";
546       foreach($this->postfixMyNetworks as $entry){
547         $this->attrs['postfixMyNetworks'] .=$entry.",";
548       }
549     }else{
550       $this->attrs['postfixMyNetworks']  = array();
551     }
553     $this->attrs['postfixMyNetworks'] = preg_replace("/,$/","",$this->attrs['postfixMyNetworks']);
555     $this->attrs['postfixMyhostname'] = preg_replace("/\..*$/","",$this->postfixMyhostname);
556     $this->attrs['postfixMyDomain']   = preg_replace("/^[^\.]+\./","",$this->postfixMyhostname);
557  
558     /* Check if this is a new entry ... add/modify */
559     $ldap = $this->config->get_ldap_link();
560     $ldap->cat($this->dn,array("objectClass"));
561     if($ldap->count()){
562       $ldap->cd($this->dn);
563       $ldap->modify($this->attrs);
564     }else{
565       $ldap->cd($this->dn);
566       $ldap->add($this->attrs);
567     }
568     show_ldap_error($ldap->get_error());
569   }
572   /* Directly save new status flag */
573   function setStatus($value)
574   {
575     if($value == "none") return;
576     $ldap = $this->config->get_ldap_link();
577     $ldap->cd($this->dn);
578     $ldap->cat($this->dn,array("objectClass"));
580     if($ldap->count()){
582       $attrs =array();
583       $tmp = $ldap->fetch();
584       for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
585         $attrs['objectClass'][] = $tmp['objectClass'][$i];
586       }
587       if(!in_array("goMailServer",$attrs['objectClass'])){
588         $attrs['objectClass'][] = "goMailServer";
589       }
591       $flag = $this->StatusFlag;
592       $attrs[$flag] = $value;
593       $this->$flag = $value;
594       $ldap->modify($attrs);
595       show_ldap_error($ldap->get_error());
596     }
597   }
600   function check()
601   { 
602     $message =plugin::check();
603     
604     if(!is_numeric($this->postfixHeaderSizeLimit)){
605       $message[] = _("Please specify a numeric value for header size limit.");
606     }
608     if(!is_numeric($this->postfixMailboxSizeLimit)){
609       $message[] = _("Please specify a numeric value for mailbox size limit.");
610     }
612     if(!is_numeric($this->postfixMessageSizeLimit)){
613       $message[] = _("Please specify a numeric value for message size limit.");
614     }
616     return $message;
617   }
620   /* Combine new array */
621   function combineArrays($ar0,$ar1,$ar2)
622   {
623     $ret = array();
624     if(is_array($ar0))
625     foreach($ar0 as $ar => $a){
626         $ret[]=$a;
627     }
628     if(is_array($ar1))
629     foreach($ar1 as $ar => $a){
630         $ret[]=$a;
631     }
632     if(is_array($ar2))
633     foreach($ar2 as $ar => $a){
634         $ret[]=$a;
635     }
636     return($ret);
637   }
640   function getpos($atr,$attrs)
641   {
642     $i = 0;
643     foreach($attrs as $attr => $name)    {
644       $i++;
645       if($attr == $atr){
646         return($i);
647       }
648     }
650     return(-1);
651   }
654   /* TRansports the geiven Arraykey one position up*/
655   function ArrayUp($atr,$attrs)
656   {
657     $ret = $attrs;
658     $pos = $this->getpos($atr,$attrs) ;
659     $cn = count($attrs);
660     if(!(($pos == -1)||($pos == 1))){
661       $before = array_slice($attrs,0,($pos-2));
662       $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
663       $unten  = array_slice($attrs,$pos);
664       $ret = array();
665       $ret = $this->combineArrays($before,$mitte,$unten);
666     }
667     return($ret);
668   }
671   /* TRansports the geiven Arraykey one position up*/
672   function ArrayDown($atr,$attrs)
673   {
674     $ret = $attrs;
675     $pos = $this->getpos($atr,$attrs) ;
676     $cn = count($attrs);
677     if(!(($pos == -1)||($pos == $cn))){
678       $before = array_slice($attrs,0,($pos-1));
679       $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
680       $unten  = array_slice($attrs,($pos+1));
681       $ret = array();
682       $ret = $this->combineArrays($before,$mitte,$unten);
683     }
684     return($ret);
685   }
688   function save_object()
689   {
690     plugin::save_object();  
691   }
693 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
694 ?>