Code

b0d992cdda1bde5fbbca1749695ef0a8512080d4
[gosa.git] / gosa-plugins / mail / personal / mail / class_mailAccount.inc
1 <?php
2 /*! 
3   \brief   mail plugin
4   \author  Fabian Hicker  <Fabian.Hickert@GONICUS.de>
5   \version 2.6.2
6   \date    03.12.2007
8   This class provides the functionality to read and write all attributes
9   relevant for gosaMailAccounts from/to the LDAP. 
10   It does syntax checking and displays the formulars required.
11   Special handling like sieve or imap actions will be implemented 
12   by the mailMethods.
15 Functions :
17  - mailAccount (&$config, $dn= NULL)
18  - execute()
19  - save_object()
20  - get_vacation_templates()
21  - addForwarder($address)
22  - delForwarder($addresses)
23  - addAlternate($address)
24  - delAlternate($addresses)
25  - prepare_vacation_template($contents)
26  - display_forward_dialog()
27  - remove_from_parent()
28  - save()
29  - check()
30  - adapt_from_template($dn, $skip= array())
31  - getCopyDialog()
32  - saveCopyDialog()
33  - PrepareForCopyPaste($source)
34  - get_multi_edit_values()
35  - multiple_check()
36  - set_multi_edit_values($values)
37  - init_multiple_support($attrs,$all)
38  - get_multi_init_values()
39  - multiple_execute()
40  - multiple_save_object()
41  - make_name($attrs)
42  - plInfo()
45  */
47 class mailAccount extends plugin
48 {
49   /* Definitions */
50   var $plHeadline     = "Mail";
51   var $plDescription  = "This does something";
52   var $view_logged    = FALSE;
53   var $is_account     = FALSE;
54   var $initially_was_account = FALSE;
56   /* GOsa mail attributes */
57   var $mail                               = "";
58   var $gosaVacationStart                  = 0;
59   var $gosaVacationStop                   = 0;
60   var $gosaMailAlternateAddress           = array();
61   var $gosaMailForwardingAddress          = array();
62   var $gosaMailDeliveryMode               = "[L        ]";
63   var $gosaMailServer                     = "";
64   var $gosaMailQuota                      = "";
65   var $gosaMailMaxSize                    = "";
66   var $gosaVacationMessage                = "";
67   var $gosaSpamSortLevel                  = "";
68   var $gosaSpamMailbox                    = "";
70   /* The methods defaults */
71   var $mailMethod      = NULL;
72   var $MailDomain      = "";
73   var $sieveManagementUsed = FALSE;
74   var $vacationTemplates = array();
75   var $sieve_management = NULL;
76   var $forward_dialog = FALSE;
77   var $initial_uid    = "";
78   var $mailDomainPart = "";
79   var $mailDomainParts = array();
80   var $MailBoxes = array("INBOX");
82   /* Used LDAP attributes && classes */
83   var $attributes= array(
84       "mail", "gosaMailServer","gosaMailQuota", "gosaMailMaxSize","gosaMailForwardingAddress",
85       "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress",
86       "gosaVacationStart","gosaVacationStop", "gosaVacationMessage", "gosaMailAlternateAddress", 
87       "gosaMailForwardingAddress");
88   var $objectclasses= array("gosaMailAccount");
90   var $multiple_support = TRUE;
92   /*! \brief  Initialize the mailAccount 
93    */
94   function __construct (&$config, $dn= NULL)
95   {
96     plugin::plugin($config,$dn); 
98     /* Intialize the used mailMethod
99      */
100     $tmp = new mailMethod($config,$this);
101     $this->mailMethod       = $tmp->get_method();
102     $this->mailMethod->fixAttributesOnLoad();
103     $this->mailDomainParts  = $this->mailMethod->getMailDomains();
104     $this->SpamLevels = $this->mailMethod->getSpamLevels();
106     /* Remember account status 
107      */
108     $this->initially_was_account = $this->is_account;
110     /* Initialize vacation settings 
111      */   
112     if(empty($this->gosaVacationStart)){
113       $this->gosaVacationStart = time();
114       $this->gosaVacationStop = time();
115     }
117     /* Read vacation templates 
118      */
119     $this->vacationTemplates = $this->get_vacation_templates();
121     /* Initialize configured values 
122      */ 
123     if($this->is_account){
125       if($this->mailMethod->connect() && $this->mailMethod->account_exists()){
127         /* Read quota */
128         $this->gosaMailQuota = $this->mailMethod->getQuota($this->gosaMailQuota);
129         if($this->mailMethod->is_error()){
130           msg_dialog::display(_("Mail error"), sprintf(_("Cannot read quota settings! Error was: %s."), 
131                 $this->mailMethod->get_error()), ERROR_DIALOG);
132         }
133         
134         /* Read mailboxes */
135         $this->MailBoxes = $this->mailMethod->getMailboxList($this->MailBoxes);
136         if($this->mailMethod->is_error()){
137           msg_dialog::display(_("Mail error"), sprintf(_("Cannot get list of mailboxes! Error was: %s."), 
138                 $this->mailMethod->get_error()), ERROR_DIALOG);
139         }
140           
141       }elseif(!$this->mailMethod->is_connected()){
142         msg_dialog::display(_("Mail error"), sprintf(_("Cannot connect mail method! Error was: %s."), 
143               $this->mailMethod->get_error()), ERROR_DIALOG);
144       }elseif(!$this->mailMethod->account_exists()){
145         msg_dialog::display(_("Mail error"), sprintf(_("Mailbox '%s' doesn't exists on mail server: %s."), 
146               $this->mailMethod->get_account_id(),$this->gosaMailServer), ERROR_DIALOG);
147       }
149       /* If the doamin part is selectable, we have to split the mail address
150        */
151       if($this->mailMethod->domainSelectionEnabled()){
152         $this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
153         $this->mail = preg_replace("/@.*$/","\\1",$this->mail);
154         if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
155           $this->mailDomainParts[] = $this->mailDomainPart;
156         }
157       }
159       /* Load attributes containing arrays */
160       foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
161         $this->$val= array();
162         if (isset($this->attrs["$val"]["count"])){
163           for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
164             array_push($this->$val, $this->attrs["$val"][$i]);
165           }
166         }
167       }
168     }
170     /* Intialize sieveManagement if necessary */
171     if($this->mailMethod->allowSieveManagement()){
172       $this->mailboxList = &$this->MailBoxes;
173       $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$this->mailMethod->getUAttrib());
174     }
176     /* Get global filter config used in add local forward
177      */
178     if (!session::is_set("mailfilter")){
179       $ui= get_userinfo();
180       $base= get_base_from_people($ui->dn);
181       $mailfilter= array( "depselect"       => $base,
182           "muser"            => "",
183           "regex"           => "*");
184       session::set("mailfilter", $mailfilter);
185     }
187     /* Disconnect mailMethod. Connect on demand later. 
188      */
189     $this->mailMethod->disconnect();
190   }
193   function execute()
194   {
195     /* Call parent execute */
196     $display = plugin::execute();
198     /* Log view */
199     if($this->is_account && !$this->view_logged){
200       $this->view_logged = TRUE;
201       new log("view","users/".get_class($this),$this->dn);
202     }
205     /****************
206       Account status
207      ****************/
209     if(isset($_POST['modify_state'])){
210       if($this->is_account && $this->acl_is_removeable() && $this->mailMethod->accountRemoveAble()){
211         $this->is_account= FALSE;
212       }elseif(!$this->is_account && $this->acl_is_createable() && $this->mailMethod->accountCreateable()){
213         $this->is_account= TRUE;
214       }
215     }
216     if(!$this->multiple_support_active){
217       if (!$this->is_account && $this->parent === NULL){
218         $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\">&nbsp;<b>".
219           msgPool::noValidExtension(_("Mail"))."</b>";
220         $display.= back_to_main();
221         return ($display);
222       }
223       if ($this->parent !== NULL){
224         if ($this->is_account){ 
225           $reason = "";
226           if(!$this->mailMethod->accountRemoveable($reason)){
227             $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
228           }else{
229             $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),msgPool::featuresEnabled(_("Mail")));
230           }
231         } else {
232           $reason = "";
233           if(!$this->mailMethod->accountCreateable($reason)){
234             $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
235           }else{
236             $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),msgPool::featuresDisabled(_("Mail")));
237           }
238           return ($display);
239         }
240       }
241     }
243     /****************
244       Sieve Management Dialog
245      ****************/
246     if($this->mailMethod->allowSieveManagement()){
247       if(isset($_POST['sieveManagement'])
248           && preg_match("/C/",$this->gosaMailDeliveryMode)
249           && $this->acl_is_writeable("sieveManagement") 
250           && $this->mailMethod->allowSieveManagement()) {
251         $this->dialog = $this->sieve_management;
252       }
253       if(isset($_POST['sieve_cancel'])){
254         $this->dialog = FALSE;
255       }
256       if(isset($_POST['sieve_finish'])){
257         $this->sieve_management = $this->dialog;
258         $this->dialog = FALSE;
259       }
260       if(is_object($this->dialog)){
261         $this->dialog->save_object();
262         return($this->dialog->execute());
263       }
264     }
266     /****************
267       Forward addresses 
268      ****************/
269     if (isset($_POST['add_local_forwarder'])){
270       $this->forward_dialog= TRUE;
271       $this->dialog= TRUE;
272     }
273     if (isset($_POST['add_locals_cancel'])){
274       $this->forward_dialog= FALSE;
275       $this->dialog= FALSE;
276     }
277     if (isset($_POST['add_locals_finish'])){
278       if (isset($_POST['local_list'])){
279         if($this->acl_is_writeable("gosaMailForwardingAddress")){
280           foreach ($_POST['local_list'] as $val){
281             if (!in_array ($val, $this->gosaMailAlternateAddress) &&
282                 $val != $this->mail){
283               $this->addForwarder($val);
284               $this->is_modified= TRUE;
285             }
286           }
287         }
288         $this->forward_dialog= FALSE;
289         $this->dialog= FALSE;
290       } else {
291         msg_dialog::display(_("Error"), _("Please select an entry!"), ERROR_DIALOG);
292       }
293     }
294     if (isset($_POST['add_forwarder'])){
295       if ($_POST['forward_address'] != ""){
296         $address= $_POST['forward_address'];
297         $valid= FALSE;
298         if (!tests::is_email($address)){
299           if (!tests::is_email($address, TRUE)){
300             if ($this->is_template){
301               $valid= TRUE;
302             } else {
303               msg_dialog::display(_("Error"), msgPool::invalid(_("Mail address"),
304                     "","","your-address@your-domain.com"),ERROR_DIALOG);
305             }
306           }
307         } elseif ($address == $this->mail
308             || in_array($address, $this->gosaMailAlternateAddress)) {
309           msg_dialog::display(_("Error"),_("Cannot add primary address to the list of forwarders!") , ERROR_DIALOG);
310         } else {
311           $valid= TRUE;
312         }
313         if ($valid){
314           if($this->acl_is_writeable("gosaMailForwardingAddress")){
315             $this->addForwarder ($address);
316             $this->is_modified= TRUE;
317           }
318         }
319       }
320     }
321     if (isset($_POST['delete_forwarder'])){
322       $this->delForwarder ($_POST['forwarder_list']);
323     }
324     if ($this->forward_dialog){
325       return($this->display_forward_dialog());
326     }
329     /****************
330       Alternate addresses 
331      ****************/
333     if (isset($_POST['add_alternate'])){
334       $valid= FALSE;
335       if (!tests::is_email($_POST['alternate_address'])){
336         if ($this->is_template){
337           if (!(tests::is_email($_POST['alternate_address'], TRUE))){
338             msg_dialog::display(_("Error"),msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG);
339           } else {
340             $valid= TRUE;
341           }
342         } else {
343           msg_dialog::display(_("Error"),msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG);
344         }
345       } else {
346         $valid= TRUE;
347       }
348       if ($valid && ($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
349         $ui= get_userinfo();
350         if ($user != $ui->username){
351           msg_dialog::display(_("Error"), msgPool::duplicated(_("Mail address"))."&nbsp;".
352               sprintf(_("Address is already in use by user '%s'."), $user), ERROR_DIALOG);
353         }
354       }
355     }
356     if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
357       $this->delAlternate ($_POST['alternates_list']);
358     }
360     /****************
361       SMARTY- Assign smarty variables 
362      ****************/
363     $smarty = get_smarty();
364     $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
365     $tmp  = $this->plInfo();
366     foreach($tmp['plProvidedAcls'] as $name => $transl){
367       $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
368     }
369     foreach($this->attributes as $attr){
370       $smarty->assign($attr,$this->$attr);
371     }
372     $smarty->assign("quotaEnabled", $this->mailMethod->quotaEnabled());
373     if($this->mailMethod->is_connected()){
374       $smarty->assign("quotaUsage",   $this->mailMethod->getQuotaUsage());
375     }else{
376       $smarty->assign("quotaUsage",   _("Unknown"));
377     }
378     $smarty->assign("gosaMailQuota",$this->gosaMailQuota);
379     $smarty->assign("domainSelectionEnabled", $this->mailMethod->domainSelectionEnabled());
380     $smarty->assign("MailDomains", $this->mailDomainParts);
381     $smarty->assign("MailDomain" , $this->mailDomainPart);
382     $smarty->assign("MailServers", $this->mailMethod->getMailServers());
383     $smarty->assign("allowSieveManagement", $this->mailMethod->allowSieveManagement());
384     $smarty->assign("own_script",  $this->sieveManagementUsed);
386     print_a($this->multi_boxes);
388     /* _Multiple users vars_ */
389     foreach($this->attributes as $attr){
390       $u_attr = "use_".$attr;
391       $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
392     }
393     foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
394       $u_attr = "use_".$attr;
395       $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
396     }
399     /****************
400       SMARTY- Assign flags 
401      ****************/
403     $types = array(
404         "V"=>"use_vacation",
405         "S"=>"use_spam_filter",
406         "R"=>"use_mailsize_limit",
407         "I"=>"drop_own_mails",
408         "C"=>"own_script");
409     foreach($types as $option => $varname){
410       if (preg_match("/".$option."/", $this->gosaMailDeliveryMode)) {
411         $smarty->assign($varname, "checked");
412       } else {
413         $smarty->assign($varname, "");
414       }
415     }
416     if (!preg_match("/L/", $this->gosaMailDeliveryMode)) {
417       $smarty->assign("only_local", "checked");
418     } else {
419       $smarty->assign("only_local", "");
420     }
423     /****************
424       Smarty- Vacation settings 
425      ****************/
426     $smarty->assign("rangeEnabled", FALSE);
427     $smarty->assign("template", "");
428     if (count($this->vacationTemplates)){
429       $smarty->assign("show_templates", "true");
430       $smarty->assign("vacationtemplates", $this->vacationTemplates);
431       if (isset($_POST['vacation_template'])){
432         $smarty->assign("template", $_POST['vacation_template']);
433       }
434     } else {
435       $smarty->assign("show_templates", "false");
436     }
438     /* Vacation range assigments
439      */
440     if($this->mailMethod->vacationRangeEnabled()){
441       $smarty->assign("rangeEnabled", TRUE);
442       if($this->gosaVacationStop ==0){
443         $date= getdate(time());
444         $date["mday"]++;
445       }else{
446         $date= getdate($this->gosaVacationStop);
447       }
448       $smarty->assign("end_day", $date["mday"]);
449       $smarty->assign("end_month", $date["mon"]-1);
450       $smarty->assign("end_year", $date["year"]);
452       if($this->gosaVacationStart == 0){
453         $date= getdate(time());
454       }else{
455         $date= getdate($this->gosaVacationStart);
456       }
457       $smarty->assign("start_day", $date["mday"]);
458       $smarty->assign("start_month", $date["mon"]-1);
459       $smarty->assign("start_year", $date["year"]);
460       $days= array();
461       for($d= 1; $d<32; $d++){
462         $days[$d]= $d;
463       }
464       $years= array();
465       for($y= $date['year']-10; $y<$date['year']+10; $y++){
466         $years[]= $y;
467       }
468       $months= msgPool::months();
469       $smarty->assign("months", $months);
470       $smarty->assign("years", $years);
471       $smarty->assign("days", $days);
473     }
475     /* fill filter settings 
476      */
477     $smarty->assign("spamlevel", $this->SpamLevels);
478     $smarty->assign("spambox"  , $this->MailBoxes);
480     $smarty->assign("multiple_support",$this->multiple_support_active);  
481     return($display.$smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
482   }
486   /* Save data to object */
487   function save_object()
488   {
489     if (isset($_POST['mailTab'])){
491       /* Save ldap attributes */
492       plugin::save_object();
494       /* Get posted mail domain part, if necessary  
495        */
496       if($this->mailMethod->domainSelectionEnabled() && isset($_POST['MailDomain'])){
497         if(in_array(get_post('MailDomain'), $this->mailDomainParts)){
498           $this->mailDomainPart = get_post('MailDomain');
499         }
500       }
502       /* Import vacation message? 
503        */
504       if (isset($_POST["import_vacation"]) && isset($this->vacationTemplates[$_POST["vacation_template"]])){
505         if($this->multiple_support_active){
506           $contents = ltrim(preg_replace("/^DESC:.*$/m","",file_get_contents($_POST["vacation_template"])));
507         }else{
508           $contents = $this->prepare_vacation_template(file_get_contents($_POST["vacation_template"]));
509         }
510         $this->gosaVacationMessage= htmlspecialchars($contents);
511       }
513       /* Handle flags 
514        */
515       if(isset($_POST['own_script'])){
516         if(!preg_match("/C/",$this->gosaMailDeliveryMode)){
517           $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode);
518           $this->gosaMailDeliveryMode = "[".$str."C]";
519         }
520       }else{
522         /* Assemble mail delivery mode
523            The mode field in ldap consists of values between braces, this must
524            be called when 'mail' is set, because checkboxes may not be set when
525            we're in some other dialog.
527            Example for gosaMailDeliveryMode [LR        ]
528            L -  Local delivery
529            R -  Reject when exceeding mailsize limit
530            S -  Use spam filter
531            V -  Use vacation message
532            C -  Use custm sieve script
533            I -  Only insider delivery */
535         $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
538         /* Handle delivery flags */
539         if($this->acl_is_writeable("gosaMailDeliveryModeL")){
540           if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){
541             $tmp.="L";
542           }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){
543             $tmp = preg_replace("/L/","",$tmp);
544           }
545         }
546         $opts = array(
547             "R"   => "use_mailsize_limit",
548             "S"   => "use_spam_filter",
549             "V"   => "use_vacation",
550             "C"   => "own_script",
551             "I"   => "drop_own_mails");
553         foreach($opts as $flag => $post){
554           if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
555             if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
556               $tmp.= $flag;
557             }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
558               $tmp = preg_replace("/".$flag."/","",$tmp);
559             }
560           }
561         }
563         $tmp= "[$tmp]";
564         if ($this->gosaMailDeliveryMode != $tmp){
565           $this->is_modified= TRUE;
566         }
567         $this->gosaMailDeliveryMode= $tmp;
568         if($this->mailMethod->vacationRangeEnabled()){
569           if($this->acl_is_writeable("gosaVacationMessage") && preg_match("/V/",$this->gosaMailDeliveryMode)){
570             if(isset($_POST['gosaVacationStart'])){
571               $this->gosaVacationStart = $_POST['gosaVacationStart'];
572             }
573             if(isset($_POST['gosaVacationStop'])){
574               $this->gosaVacationStop = $_POST['gosaVacationStop'];
575             }
576           }
577         }
578       }
579     }
580   }
583   /*! \brief  Parse vacation templates and build up an array
584     containing 'filename' => 'description'. 
585     Used to fill vacation dropdown box.
586     @return Array   All useable vacation templates.
587    */ 
588   function get_vacation_templates()
589   {
590     $vct = array();
591     if ($this->config->get_cfg_value("vacationTemplateDirectory") != ""){
592       $dir= $this->config->get_cfg_value("vacationTemplateDirectory");
593       if (is_dir($dir) && is_readable($dir)){
594         $dh = opendir($dir);
595         while($file = readdir($dh)){
596           $description= "";
597           if (is_file($dir."/".$file)){
598             $fh = fopen($dir."/".$file, "r");
599             $line= fgets($fh, 256);
600             if (!preg_match('/^DESC:/', $line)){
601               msg_dialog::display(_("Configuration error"), sprintf(_("No DESC tag in vacation template '%s'!"), $file), ERROR_DIALOG);
602             }else{
603               $description= trim(preg_replace('/^DESC:\s*/', '', $line));
604             }
605             fclose ($fh);
606           }
607           if ($description != ""){
608             $vct["$dir/$file"]= $description;
609           }
610         }
611         closedir($dh);
612       }
613     }
614     return($vct); 
615   }
618   /*! \brief  Adds the given mail address to the list of mail forwarders 
619    */ 
620   function addForwarder($address)
621   {
622     if(empty($address)) return;
623     if($this->acl_is_writeable("gosaMailForwardingAddress")){
624       $this->gosaMailForwardingAddress[]= $address;
625       $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
626       sort ($this->gosaMailForwardingAddress);
627       reset ($this->gosaMailForwardingAddress);
628       $this->is_modified= TRUE;
629     }else{
630       msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
631     }
632   }
635   /*! \brief  Removes the given mail address from the list of mail forwarders 
636    */ 
637   function delForwarder($addresses)
638   {
639     if($this->acl_is_writeable("gosaMailForwardingAddress")){
640       $this->gosaMailForwardingAddress= array_remove_entries ($addresses, $this->gosaMailForwardingAddress);
641       $this->is_modified= TRUE;
642     }else{
643       msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
644     }
645   }
648   /*! \brief  Add given mail address to the list of alternate adresses ,
649     .          check if this mal address is used, skip adding in this case 
650    */ 
651   function addAlternate($address)
652   {
653     if(empty($address)) return;
654     if($this->acl_is_writeable("gosaMailAlternateAddress")){
655       $ldap= $this->config->get_ldap_link();
656       $address= strtolower($address);
658       /* Is this address already assigned in LDAP? */
659       $ldap->cd ($this->config->current['BASE']);
660       $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)".
661           "(alias=$address)(gosaMailAlternateAddress=$address)))", array("uid"));
662       if ($ldap->count() > 0){
663         $attrs= $ldap->fetch ();
664         return ($attrs["uid"][0]);
665       }
666       if (!in_array($address, $this->gosaMailAlternateAddress)){
667         $this->gosaMailAlternateAddress[]= $address;
668         $this->is_modified= TRUE;
669       }
670       sort ($this->gosaMailAlternateAddress);
671       reset ($this->gosaMailAlternateAddress);
672       return ("");
673     }else{
674       msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
675     }
676   }
679   /*! \brief  Removes the given mail address from the alternate addresses list 
680    */ 
681   function delAlternate($addresses)
682   {
683     if($this->acl_is_writeable("gosaMailAlternateAddress")){
684       $this->gosaMailAlternateAddress= array_remove_entries ($addresses,$this->gosaMailAlternateAddress);
685       $this->is_modified= TRUE;
686     }else{
687       msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
688     }
689   }
692   /*! \brief  Prepare importet vacation string. \
693     .         Replace placeholder like %givenName a.s.o.
694     @param  string  Vacation string
695     @return string  Completed vacation string
696    */
697   private function prepare_vacation_template($contents)
698   {
699     /* Replace attributes */
700     $attrs = array();
701     $obj   = NULL;
702     if(isset($this->parent->by_object['user'])){
703       $attrs  = $this->parent->by_object['user']->attributes;
704       $obj    = $this->parent->by_object['user'];
705     }else{
706       $obj    = new user($this->config,$this->dn);
707       $attrs  = $obj->attributes;
708     }
709     if($obj){
710       foreach ($attrs as $val){
711         if(preg_match("/dateOfBirth/",$val)){
712           if($obj->use_dob){
713             $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
714           }
715         }else {
716           $contents= preg_replace("/%$val/",
717               $obj->$val, $contents);
718         }
720         /* Replace vacation start and end time */
721         if(preg_match("/%start/",$contents)){
722           $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
723         }
724         if(preg_match("/%end/",$contents)){
725           $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
726         }
727       }
728     }
729     $contents = ltrim(preg_replace("/^DESC:.*$/m","",$contents),"\n ");
730     return($contents);
731   }
734   /*! \brief  Displays a dialog that allows mail address selection.
735    */ 
736   function display_forward_dialog()
737   {
738     restore_error_handler();
740     $smarty = get_smarty();
741     $ldap= $this->config->get_ldap_link();
743     /* Save data */
744     $mailfilter= session::get("mailfilter");
745     foreach( array("depselect", "muser", "regex") as $type){
746       if (isset($_POST[$type])){
747         $mailfilter[$type]= $_POST[$type];
748       }
749     }
750     if (isset($_GET['search'])){
751       $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
752       if ($s == "**"){
753         $s= "*";
754       }
755       $mailfilter['regex']= $s;
756     }
757     session::set("mailfilter", $mailfilter);
759     /* Get actual list */
760     $mailusers= array ();
761     if ($mailfilter['regex'] != '*' && $mailfilter['regex'] != ""){
762       $regex= $mailfilter['regex'];
763       $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
764     } else {
765       $filter= "";
766     }
767     if ($mailfilter['muser'] != ""){
768       $user= $mailfilter['muser'];
769       $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
770     }
772     /* Add already present people to the filter */
773     $exclude= "";
774     foreach ($this->gosaMailForwardingAddress as $mail){
775       $exclude.= "(mail=$mail)";
776     }
777     if ($exclude != ""){
778       $filter.= "(!(|$exclude))";
779     }
780     $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $mailfilter['depselect'],
781         array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
782     $ldap->cd($mailfilter['depselect']);
783     $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
784     while ($attrs= $ldap->fetch()){
785       if(preg_match('/%/', $attrs['mail'][0])){
786         continue;
787       }
788       $name= $this->make_name($attrs);
789       $mailusers[$attrs['mail'][0]]= $name."&lt;".
790         $attrs['mail'][0]."&gt;";
791     }
792     natcasesort ($mailusers);
793     reset ($mailusers);
795     /* Show dialog */
796     $smarty->assign("search_image", get_template_path('images/lists/search.png'));
797     $smarty->assign("usearch_image", get_template_path('images/lists/search-user.png'));
798     $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
799     $smarty->assign("infoimage", get_template_path('images/info.png'));
800     $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
801     $smarty->assign("mailusers", $mailusers);
802     if (isset($_POST['depselect'])){
803       $smarty->assign("depselect", $_POST['depselect']);
804     }
805     $smarty->assign("deplist", $this->config->idepartments);
806     $smarty->assign("apply", apply_filter());
807     $smarty->assign("alphabet", generate_alphabet());
808     $smarty->assign("hint", print_sizelimit_warning());
809     foreach( array("depselect", "muser", "regex") as $type){
810       $smarty->assign("$type", $mailfilter[$type]);
811     }
812     $smarty->assign("hint", print_sizelimit_warning());
813     $display= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE, dirname(__FILE__)));
814     return ($display);
815   }
818   /*! \brief  Removes the mailAccount extension from ldap 
819    */  
820   function remove_from_parent()
821   {
822     /* Cancel if there's nothing to do here */
823     if (!$this->initially_was_account){
824       return;
825     }
827     /* If domain part was selectable, contruct mail address */
828     if($this->mailMethod->domainSelectionEnabled()){
829       $this->mail = $this->mail."@".$this->mailDomainPart;
830     }
832     /* Remove GOsa attributes */
833     plugin::remove_from_parent();
835     /* Zero arrays */
836     $this->attrs['gosaMailAlternateAddress'] = array();
837     $this->attrs['gosaMailForwardingAddress']= array();
840     $this->mailMethod->fixAttributesOnRemove();
841     $this->cleanup();
843     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
844     $ldap= $this->config->get_ldap_link();
845     $ldap->cd($this->dn);
846     $ldap->modify ($this->attrs);
848     /* Add "view" to logging class */
849     new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
850     if (!$ldap->success()){
851       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
852     }
853     
854     /* Let the mailMethod remove this mailbox, e.g. from imap and
855        update shared folder membership, ACL may need to be updated. 
856      */
857     if (!$this->is_template){
859       if(!$this->mailMethod->connect()){
860         msg_dialog::display(_("Mail error"), sprintf(_("Cannot connect mail method! Error was: %s."), 
861               $this->mailMethod->get_error()), ERROR_DIALOG);
862       }else{
863         if(!$this->mailMethod->deleteMailbox()){
864           msg_dialog::display(_("Mail error"), sprintf(_("Cannot remove mailbox! Error was: %s."), 
865                 $this->mailMethod->get_error()), ERROR_DIALOG);
866         }
867         if(!$this->mailMethod->updateSharedFolder()){
868           msg_dialog::display(_("Mail error"), sprintf(_("Cannot update shared folder permissions! Error was: %s."), 
869                 $this->mailMethod->get_error()), ERROR_DIALOG);
870         }
871       }
872     }
873     $this->mailMethod->disconnect();
875     /* Optionally execute a command after we're done */
876     $this->handle_post_events("remove",array("uid" => $this->uid));
877   }
880   /*! \brief  Save the mailAccount settings to the ldap database.
881    */
882   function save()
883   {
884     $ldap= $this->config->get_ldap_link();
886     /* If domain part was selectable, contruct mail address */
887     if($this->mailMethod->domainSelectionEnabled()){
888       $this->mail = $this->mail."@".$this->mailDomainPart;
889     }
890     
891     /* Enforce lowercase mail address and trim whitespaces
892      */
893     $this->mail = trim(strtolower($this->mail));
895     /* Call parents save to prepare $this->attrs */
896     plugin::save();
898     /* Save arrays */
899     $this->attrs['gosaMailAlternateAddress'] = $this->gosaMailAlternateAddress;
900     $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
902     if(!$this->mailMethod->vacationRangeEnabled()){
903       $this->attrs['gosaVacationStart'] = $this->attrs['gosaVacationStop'] = array();
904     }elseif (!preg_match('/V/', $this->gosaMailDeliveryMode)){
905       unset($this->attrs['gosaVacationStart']);
906       unset($this->attrs['gosaVacationStop']);
907     }
909     /* Map method attributes */ 
910     $this->mailMethod->fixAttributesOnStore();
911     
912     /* Save data to LDAP */
913     $ldap->cd($this->dn);
914     $this->cleanup();
915     $ldap->modify ($this->attrs);
917     if (!$ldap->success()){
918       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
919     }
921     /* Log last action */
922     if($this->initially_was_account){
923       new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
924     }else{
925       new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
926     }
928     /* Only do IMAP actions if we are not a template */
929     if (!$this->is_template){
930       $this->mailMethod->connect();
931       if(!$this->mailMethod->is_connected()){
932         msg_dialog::display(_("Mail error"), sprintf(_("Cannot connect mail method! Error was: %s."), 
933               $this->mailMethod->get_error()), ERROR_DIALOG);
934       }else{
935         if(!$this->mailMethod->updateMailbox()){
936           msg_dialog::display(_("Mail error"), sprintf(_("Cannot update mailbox! Error was: %s."), 
937                 $this->mailMethod->get_error()), ERROR_DIALOG);
938         }
939         if(!$this->mailMethod->setQuota($this->gosaMailQuota)){
940           msg_dialog::display(_("Mail error"), sprintf(_("Cannot write quota settings! Error was: %s."), 
941                 $this->mailMethod->get_error()), ERROR_DIALOG);
942         }
944         if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){
947           /* Do not write sieve settings if this account is new and 
948              doesn't seem to exist.
949            */
950           if(!$this->initially_was_account && !$this->mailMethod->account_exists()){
951             @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,
952                 "Skipping sieve settings, the account doesn't seem to be created already.</b>","");
953           }else{
954             if(!$this->mailMethod->saveSieveSettings()){
955               msg_dialog::display(_("Mail error"), $this->mailMethod->get_error(), ERROR_DIALOG);
956             }
957           }
958         }else{
959       
960          echo "Check sieve management here";
962           @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, 
963               "User uses an own sieve script, skipping sieve update.".$str."</b>","");
964         }
966         if(!$this->mailMethod->updateSharedFolder()){
967           msg_dialog::display(_("Mail error"), sprintf(_("Cannot update shared folder permissions! Error was: %s."), 
968                 $this->mailMethod->get_error()), ERROR_DIALOG);
969         }
970       }
971     }
972     $this->mailMethod->disconnect();
974     /* Optionally execute a command after we're done */
975     if ($this->initially_was_account == $this->is_account){
976       if ($this->is_modified){
977         $this->handle_post_events("modify", array("uid" => $this->uid));
978       }
979     } else {
980       $this->handle_post_events("add", array("uid" => $this->uid));
981     }
982   }
985   /*! \brief  Check given values 
986    */
987   function check()
988   {
989     if(!$this->is_account){
990       return(array());
991     }
993     $ldap= $this->config->get_ldap_link();
995     /* Call common method to give check the hook */
996     $message= plugin::check();
998     if(empty($this->gosaMailServer)){
999       $message[]= msgPool::noserver(_("Mail"));
1000     }
1002     /* Mail address checks */
1003     $mail = $this->mail;
1004     if($this->mailMethod->domainSelectionEnabled()){
1005       $mail.= "@".$this->mailDomainPart;
1006     }
1008     if (empty($mail)){
1009       $message[]= msgPool::required(_("Primary address"));
1010     }
1011     if ($this->is_template){
1012       if (!tests::is_email($mail, TRUE)){
1013         $message[]= msgPool::invalid(_("Mail address"),"","","%givenName.%sn@your-domain.com");
1014       }
1015     } else {
1016       if (!tests::is_email($mail)){
1017         $message[]= msgPool::invalid(_("Mail address"),"","","your-address@your-domain.com");
1018       }
1019     }
1021     /* Check if this mail address is already in use */
1022     $ldap->cd($this->config->current['BASE']);
1023     $filter = "(&(!(objectClass=gosaUserTemplate))(!(uid=".$this->uid."))".
1024       "(objectClass=gosaMailAccount)".
1025       "(|(mail=".$mail.")(alias=".$mail.")(gosaMailAlternateAddress=".$mail.")))";
1026     $ldap->search($filter,array("uid"));
1027     if ($ldap->count() != 0){
1028       $message[]= msgPool::duplicated(_("Mail address"));
1029     }
1032     /* Check quota */
1033     if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
1034       if (!is_numeric($this->gosaMailQuota)) {
1035         $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
1036       } else {
1037         $this->gosaMailQuota= (int) $this->gosaMailQuota;
1038       }
1039     }
1041     /* Check rejectsize for integer */
1042     if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
1043       if (!is_numeric($this->gosaMailMaxSize)){
1044         $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
1045       } else {
1046         $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
1047       }
1048     }
1050     /* Need gosaMailMaxSize if use_mailsize_limit is checked */
1051     if (is_integer(strpos($this->gosaMailDeliveryMode, "R")) && $this->gosaMailMaxSize == ""){
1052       $message[]= msgPool::required(_("Mail reject size"));
1053     }
1055     if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
1056       $message[]= msgPool::required(_("Spam folder"));
1057     }
1059     if ($this->mailMethod->vacationRangeEnabled() 
1060         && preg_match('/V/', $this->gosaMailDeliveryMode) 
1061         && $this->gosaVacationStart > $this->gosaVacationStop){
1062       $message[]= msgPool::invalid(_("Vacation interval"));
1063     }
1064     return($message);
1065   }
1068   /*! \brief  Adapt from template, using 'dn' 
1069    */
1070   function adapt_from_template($dn, $skip= array())
1071   {
1072     plugin::adapt_from_template($dn, $skip);
1074     foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
1076       if (in_array($val, $skip)){
1077         continue;
1078       }
1080       $this->$val= array();
1081       if (isset($this->attrs["$val"]["count"])){
1082         for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
1083           $value= $this->attrs["$val"][$i];
1084           foreach (array("sn", "givenName", "uid") as $repl){
1085             if (preg_match("/%$repl/i", $value)){
1086               $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
1087             }
1088           }
1089           array_push($this->$val, strtolower(rewrite($value)));
1090         }
1091       }
1092     }
1093     $this->mail= strtolower(rewrite($this->mail));
1094   }
1097   /*! \brief  Creates the mail part for the copy & paste dialog 
1098    */ 
1099   function getCopyDialog()
1100   {
1101     if(!$this->is_account) return("");
1102     $smarty = get_smarty();
1103     $smarty->assign("mail",$this->mail);
1104     $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
1105     $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
1106     $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
1108     $ret = array();
1109     $ret['status'] = "";
1110     $ret['string'] = $str;
1111     return($ret);
1112   }
1114     
1115   /*! \brief  save_object for copy&paste vars 
1116    */  
1117   function saveCopyDialog()
1118   {
1119     if(!$this->is_account) return;
1121     /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
1122     $this->execute();
1123     if(isset($_POST['mail'])){
1124       $this->mail = $_POST['mail'];
1125     }
1126   }
1128   
1129   /*! \brief  Prepare this account to be copied 
1130    */
1131   function PrepareForCopyPaste($source)
1132   {
1133     plugin::PrepareForCopyPaste($source);
1135     /* Reset alternate mail addresses */
1136     $this->gosaMailAlternateAddress = array();
1137   }
1140   /*! \brief  Prepare this class the be useable when editing multiple users at once 
1141    */
1142   function get_multi_edit_values()
1143   {
1144     $ret = plugin::get_multi_edit_values();
1145     if(in_array("gosaMailQuota",$this->multi_boxes)){
1146       $ret['gosaMailQuota'] = $this->gosaMailQuota;
1147     }
1148     $flag_add = $flag_remove = array();
1149     $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1150     $opts = array(
1151         "R"   => "use_mailsize_limit",
1152         "S"   => "use_spam_filter",
1153         "L"   => "only_local",
1154         "V"   => "use_vacation",
1155         "C"   => "own_script",
1156         "I"   => "drop_own_mails");
1157     foreach($opts as $flag => $post){
1158       if(in_array($post, $this->multi_boxes)){
1159         if(preg_match("/".$flag."/",$tmp)){
1160           $flag_add[] = $flag;
1161         }else{
1162           $flag_remove[] = $flag;
1163         }
1164       }
1165     }
1166     $ret['flag_add'] = $flag_add;
1167     $ret['flag_remove'] = $flag_remove;
1169     echo "1";
1170     if($this->mailMethod->vacationRangeEnabled()){
1171       echo "2";
1172       if(in_array("V",$flag_add)){
1173         $ret['gosaVacationStart'] =  $this->gosaVacationStart = $_POST['gosaVacationStart'];
1174         $ret['gosaVacationStop'] =  $this->gosaVacationStop = $_POST['gosaVacationStop'];
1175       }
1176     }
1177     return($ret);
1178   }
1181   /*! \brief  Check given input for multiple user edit 
1182    */
1183   function multiple_check()
1184   {
1185     $message = plugin::multiple_check();
1187     if(empty($this->gosaMailServer) && in_array("gosaMailServer",$this->multi_boxes)){
1188       $message[]= msgPool::noserver(_("Mail"));
1189     }
1191     /* Check quota */
1192     if ($this->gosaMailQuota != ''  && in_array("gosaMailQuota",$this->multi_boxes)){
1193       if (!is_numeric($this->gosaMailQuota)) {
1194         $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
1195       } else {
1196         $this->gosaMailQuota= (int) $this->gosaMailQuota;
1197       }
1198     }
1200     /* Check rejectsize for integer */
1201     if ($this->gosaMailMaxSize != '' && in_array("gosaMailMaxSize",$this->multi_boxes)){
1202       if (!is_numeric($this->gosaMailMaxSize)){
1203         $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
1204       } else {
1205         $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
1206       }
1207     }
1209     if(empty($this->gosaSpamMailbox) && in_array("gosaSpamMailbox",$this->multi_boxes)){
1210       $message[]= msgPool::required(_("Spam folder"));
1211     }
1213     if (  in_array("use_vacation",$this->multi_boxes) &&
1214         preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
1215       $message[]= msgPool::invalid(_("Vacation interval"));
1216     }
1217     return($message);
1218   }
1220   
1221   /*! \brief  ...
1222    */
1223   function set_multi_edit_values($values)
1224   {
1225     plugin::set_multi_edit_values($values);
1226     $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1227     if(isset($values['flag_add'])){
1228       foreach($values['flag_add'] as $flag){
1229         if(!preg_match("/".$flag."/",$tmp)){
1230           $tmp .= $flag;
1231         }
1232       }
1233     }
1234     if(isset($values['flag_remove'])){
1235       foreach($values['flag_remove'] as $flag){
1236         if(preg_match("/".$flag."/",$tmp)){
1237           $tmp = preg_replace("/".$flag."/","",$tmp);
1238         }
1239       }
1240     }
1241     $this->gosaMailDeliveryMode = "[".$tmp."]";
1243     /* Set vacation message and replace placeholder like %givenName
1244      */
1245     if(isset($values['gosaVacationMessage'])){
1246       $this->gosaVacationMessage = $this->prepare_vacation_template($values['gosaVacationMessage']);
1247     }
1248   }
1251   /*! \brief  Initialize plugin to be used as multiple edit class. 
1252    */
1253   function init_multiple_support($attrs,$all)
1254   {
1255     plugin::init_multiple_support($attrs,$all);
1256     if(isset($this->multi_attrs['gosaMailQuota'])){
1257       $this->gosaMailQuota = $this->multi_attrs['gosaMailQuota'];
1258     }
1259   }
1261  
1262   /*! \brief
1263    */
1264   function get_multi_init_values()
1265   {
1266     $attrs = plugin::get_multi_init_values();
1267     $attrs['gosaMailQuota'] = $this->gosaMailQuota;
1268     return($attrs);
1269   }
1272   /*! \brief  Display multiple edit dialog 
1273    */
1274   function multiple_execute()
1275   {
1276     return($this->execute());
1277   }
1279   
1280   /*! \brief  Save posts from multiple edit dialog 
1281    */
1282   function multiple_save_object()
1283   {
1284     plugin::multiple_save_object();
1286     $this->save_object();
1287     foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
1288       if(isset($_POST["use_".$attr])){
1289         $this->multi_boxes[] = $attr;
1290       }
1291     }
1292   }
1295   /*! \brief  Creates the user names for the add_local_forward dialog
1296    */
1297   function make_name($attrs)
1298   {
1299     $name= "";
1300     if (isset($attrs['sn'][0])){
1301       $name= $attrs['sn'][0];
1302     }
1303     if (isset($attrs['givenName'][0])){
1304       if ($name != ""){
1305         $name.= ", ".$attrs['givenName'][0];
1306       } else {
1307         $name.= $attrs['givenName'][0];
1308       }
1309     }
1310     if ($name != ""){
1311       $name.= " ";
1312     }
1314     return ($name);
1315   }
1318   /*! \brief  ACL settings 
1319    */
1320   static function plInfo()
1321   {
1322     return (array(
1323           "plShortName"     => _("Mail"),
1324           "plDescription"   => _("Mail settings"),
1325           "plSelfModify"    => TRUE,
1326           "plDepends"       => array("user"),                     // This plugin depends on
1327           "plPriority"      => 4,                                 // Position in tabs
1328           "plSection"     => array("personal" => _("My account")),
1329           "plCategory"    => array("users"),
1330           "plOptions"       => array(),
1332           "plProvidedAcls"  => array(
1333             "mail"                      =>  _("Mail address"),
1334             "gosaMailServer"            =>  _("Mail server"),
1335             "gosaMailQuota"             =>  _("Quota size"),
1337             "gosaMailDeliveryModeV"     =>  _("Add vacation information"),  // This is flag of gosaMailDeliveryMode
1338             "gosaVacationMessage"       =>  _("Vacation message"),
1340             "gosaMailDeliveryModeS"     =>  _("Use spam filter"),           // This is flag of gosaMailDeliveryMode
1341             "gosaSpamSortLevel"         =>  _("Spam level"),
1342             "gosaSpamMailbox"           =>  _("Spam mail box"),
1344             "sieveManagement"           =>  _("Sieve management"),
1346             "gosaMailDeliveryModeR"     =>  _("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
1347             "gosaMailMaxSize"           =>  _("Mail max size"),
1349             "gosaMailForwardingAddress" =>  _("Forwarding address"),
1350             "gosaMailDeliveryModeL"     =>  _("Local delivery"),            // This is flag of gosaMailDeliveryMode
1351             "gosaMailDeliveryModeI"     =>  _("No delivery to own mailbox "),     // This is flag of gosaMailDeliveryMode
1352             "gosaMailAlternateAddress"  =>  _("Mail alternative addresses"),
1354             "gosaMailForwardingAddress" =>  _("Forwarding address"),
1355             "gosaMailDeliveryModeC"     =>  _("Use custom sieve script"))   // This is flag of gosaMailDeliveryMode
1356               ));
1357   }
1362 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1363 ?>