147802851934d2613dc958147301fb05976c17ea
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 }
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 }
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->isModifyableMail() && $this->is_account)){
152 if($this->mailMethod->domainSelectionEnabled()){
153 $this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
154 $this->mail = preg_replace("/@.*$/","\\1",$this->mail);
155 if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
156 $this->mailDomainParts[] = $this->mailDomainPart;
157 }
158 }
159 }
161 /* Load attributes containing arrays */
162 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
163 $this->$val= array();
164 if (isset($this->attrs["$val"]["count"])){
165 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
166 array_push($this->$val, $this->attrs["$val"][$i]);
167 }
168 }
169 }
170 }
172 /* Intialize sieveManagement if necessary */
173 if($this->mailMethod->allowSieveManagement()){
174 $this->mailboxList = &$this->MailBoxes;
175 $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$this->mailMethod->getUAttrib());
176 }
178 /* Get global filter config used in add local forward
179 */
180 if (!session::is_set("mailfilter")){
181 $ui= get_userinfo();
182 $base= get_base_from_people($ui->dn);
183 $mailfilter= array( "depselect" => $base,
184 "muser" => "",
185 "regex" => "*");
186 session::set("mailfilter", $mailfilter);
187 }
189 /* Disconnect mailMethod. Connect on demand later.
190 */
191 $this->mailMethod->disconnect();
192 }
195 function execute()
196 {
197 /* Call parent execute */
198 $display = plugin::execute();
200 /* Log view */
201 if($this->is_account && !$this->view_logged){
202 $this->view_logged = TRUE;
203 new log("view","users/".get_class($this),$this->dn);
204 }
207 /****************
208 Account status
209 ****************/
211 if(isset($_POST['modify_state'])){
212 if($this->is_account && $this->acl_is_removeable() && $this->mailMethod->accountRemoveAble()){
213 $this->is_account= FALSE;
214 }elseif(!$this->is_account && $this->acl_is_createable() && $this->mailMethod->accountCreateable()){
215 $this->is_account= TRUE;
216 }
217 }
218 if(!$this->multiple_support_active){
219 if (!$this->is_account && $this->parent === NULL){
220 $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
221 msgPool::noValidExtension(_("Mail"))."</b>";
222 $display.= back_to_main();
223 return ($display);
224 }
225 if ($this->parent !== NULL){
226 if ($this->is_account){
227 $reason = "";
228 if(!$this->mailMethod->accountRemoveable($reason)){
229 $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
230 }else{
231 $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),msgPool::featuresEnabled(_("Mail")));
232 }
233 } else {
234 $reason = "";
235 if(!$this->mailMethod->accountCreateable($reason)){
236 $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
237 }else{
238 $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),msgPool::featuresDisabled(_("Mail")));
239 }
240 return ($display);
241 }
242 }
243 }
245 /****************
246 Sieve Management Dialog
247 ****************/
248 if($this->mailMethod->allowSieveManagement()){
249 if(isset($_POST['sieveManagement'])
250 && preg_match("/C/",$this->gosaMailDeliveryMode)
251 && $this->acl_is_writeable("sieveManagement")
252 && $this->mailMethod->allowSieveManagement()) {
253 $this->dialog = $this->sieve_management;
254 }
255 if(isset($_POST['sieve_cancel'])){
256 $this->dialog = FALSE;
257 }
258 if(isset($_POST['sieve_finish'])){
259 $this->sieve_management = $this->dialog;
260 $this->dialog = FALSE;
261 }
262 if(is_object($this->dialog)){
263 $this->dialog->save_object();
264 return($this->dialog->execute());
265 }
266 }
268 /****************
269 Forward addresses
270 ****************/
271 if (isset($_POST['add_local_forwarder'])){
272 $this->forward_dialog= TRUE;
273 $this->dialog= TRUE;
274 }
275 if (isset($_POST['add_locals_cancel'])){
276 $this->forward_dialog= FALSE;
277 $this->dialog= FALSE;
278 }
279 if (isset($_POST['add_locals_finish'])){
280 if (isset($_POST['local_list'])){
281 if($this->acl_is_writeable("gosaMailForwardingAddress")){
282 foreach ($_POST['local_list'] as $val){
283 if (!in_array ($val, $this->gosaMailAlternateAddress) &&
284 $val != $this->mail){
285 $this->addForwarder($val);
286 $this->is_modified= TRUE;
287 }
288 }
289 }
290 $this->forward_dialog= FALSE;
291 $this->dialog= FALSE;
292 } else {
293 msg_dialog::display(_("Error"), _("Please select an entry!"), ERROR_DIALOG);
294 }
295 }
296 if (isset($_POST['add_forwarder'])){
297 if ($_POST['forward_address'] != ""){
298 $address= $_POST['forward_address'];
299 $valid= FALSE;
300 if (!tests::is_email($address)){
301 if (!tests::is_email($address, TRUE)){
302 if ($this->is_template){
303 $valid= TRUE;
304 } else {
305 msg_dialog::display(_("Error"), msgPool::invalid(_("Mail address"),
306 "","","your-address@your-domain.com"),ERROR_DIALOG);
307 }
308 }
309 } elseif ($address == $this->mail
310 || in_array($address, $this->gosaMailAlternateAddress)) {
311 msg_dialog::display(_("Error"),_("Cannot add primary address to the list of forwarders!") , ERROR_DIALOG);
312 } else {
313 $valid= TRUE;
314 }
315 if ($valid){
316 if($this->acl_is_writeable("gosaMailForwardingAddress")){
317 $this->addForwarder ($address);
318 $this->is_modified= TRUE;
319 }
320 }
321 }
322 }
323 if (isset($_POST['delete_forwarder'])){
324 $this->delForwarder ($_POST['forwarder_list']);
325 }
326 if ($this->forward_dialog){
327 return($this->display_forward_dialog());
328 }
331 /****************
332 Alternate addresses
333 ****************/
335 if (isset($_POST['add_alternate'])){
336 $valid= FALSE;
337 if (!tests::is_email($_POST['alternate_address'])){
338 if ($this->is_template){
339 if (!(tests::is_email($_POST['alternate_address'], TRUE))){
340 msg_dialog::display(_("Error"),msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG);
341 } else {
342 $valid= TRUE;
343 }
344 } else {
345 msg_dialog::display(_("Error"),msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG);
346 }
347 } else {
348 $valid= TRUE;
349 }
350 if ($valid && ($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
351 $ui= get_userinfo();
352 if ($user != $ui->username){
353 msg_dialog::display(_("Error"), msgPool::duplicated(_("Mail address"))." ".
354 sprintf(_("Address is already in use by user '%s'."), $user), ERROR_DIALOG);
355 }
356 }
357 }
358 if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
359 $this->delAlternate ($_POST['alternates_list']);
360 }
362 /****************
363 SMARTY- Assign smarty variables
364 ****************/
365 $smarty = get_smarty();
366 $smarty->assign("initially_was_account", $this->initially_was_account);
367 $smarty->assign("isModifyableMail", $this->mailMethod->isModifyableMail());
368 $smarty->assign("mailEqualsCN", $this->mailMethod->mailEqualsCN());
370 $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
371 $tmp = $this->plInfo();
372 foreach($tmp['plProvidedAcls'] as $name => $transl){
373 $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
374 }
375 foreach($this->attributes as $attr){
376 $smarty->assign($attr,$this->$attr);
377 }
378 $smarty->assign("quotaEnabled", $this->mailMethod->quotaEnabled());
379 if($this->mailMethod->is_connected()){
380 $smarty->assign("quotaUsage", $this->mailMethod->getQuotaUsage());
381 }else{
382 $smarty->assign("quotaUsage", _("Unknown"));
383 }
384 $smarty->assign("gosaMailQuota",$this->gosaMailQuota);
385 $smarty->assign("domainSelectionEnabled", $this->mailMethod->domainSelectionEnabled());
386 $smarty->assign("MailDomains", $this->mailDomainParts);
387 $smarty->assign("MailDomain" , $this->mailDomainPart);
388 $smarty->assign("MailServers", $this->mailMethod->getMailServers());
389 $smarty->assign("allowSieveManagement", $this->mailMethod->allowSieveManagement());
390 $smarty->assign("own_script", $this->sieveManagementUsed);
392 print_a($this->multi_boxes);
394 /* _Multiple users vars_ */
395 foreach($this->attributes as $attr){
396 $u_attr = "use_".$attr;
397 $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
398 }
399 foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
400 $u_attr = "use_".$attr;
401 $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
402 }
405 /****************
406 SMARTY- Assign flags
407 ****************/
409 $types = array(
410 "V"=>"use_vacation",
411 "S"=>"use_spam_filter",
412 "R"=>"use_mailsize_limit",
413 "I"=>"drop_own_mails",
414 "C"=>"own_script");
415 foreach($types as $option => $varname){
416 if (preg_match("/".$option."/", $this->gosaMailDeliveryMode)) {
417 $smarty->assign($varname, "checked");
418 } else {
419 $smarty->assign($varname, "");
420 }
421 }
422 if (!preg_match("/L/", $this->gosaMailDeliveryMode)) {
423 $smarty->assign("only_local", "checked");
424 } else {
425 $smarty->assign("only_local", "");
426 }
429 /****************
430 Smarty- Vacation settings
431 ****************/
432 $smarty->assign("rangeEnabled", FALSE);
433 $smarty->assign("template", "");
434 if (count($this->vacationTemplates)){
435 $smarty->assign("show_templates", "true");
436 $smarty->assign("vacationtemplates", $this->vacationTemplates);
437 if (isset($_POST['vacation_template'])){
438 $smarty->assign("template", $_POST['vacation_template']);
439 }
440 } else {
441 $smarty->assign("show_templates", "false");
442 }
444 /* Vacation range assigments
445 */
446 if($this->mailMethod->vacationRangeEnabled()){
447 $smarty->assign("rangeEnabled", TRUE);
448 if($this->gosaVacationStop ==0){
449 $date= getdate(time());
450 $date["mday"]++;
451 }else{
452 $date= getdate($this->gosaVacationStop);
453 }
454 $smarty->assign("end_day", $date["mday"]);
455 $smarty->assign("end_month", $date["mon"]-1);
456 $smarty->assign("end_year", $date["year"]);
458 if($this->gosaVacationStart == 0){
459 $date= getdate(time());
460 }else{
461 $date= getdate($this->gosaVacationStart);
462 }
463 $smarty->assign("start_day", $date["mday"]);
464 $smarty->assign("start_month", $date["mon"]-1);
465 $smarty->assign("start_year", $date["year"]);
466 $days= array();
467 for($d= 1; $d<32; $d++){
468 $days[$d]= $d;
469 }
470 $years= array();
471 for($y= $date['year']-10; $y<$date['year']+10; $y++){
472 $years[]= $y;
473 }
474 $months= msgPool::months();
475 $smarty->assign("months", $months);
476 $smarty->assign("years", $years);
477 $smarty->assign("days", $days);
479 }
481 /* fill filter settings
482 */
483 $smarty->assign("spamlevel", $this->SpamLevels);
484 $smarty->assign("spambox" , $this->MailBoxes);
486 $smarty->assign("multiple_support",$this->multiple_support_active);
487 return($display.$smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
488 }
492 /* Save data to object */
493 function save_object()
494 {
495 if (isset($_POST['mailTab'])){
497 /* Save ldap attributes */
498 $mail = $this->mail;
499 plugin::save_object();
501 if(!$this->mailMethod->isModifyableMail() && $this->initially_was_account){
502 $this->mail = $mail;
503 }else{
505 /* Get posted mail domain part, if necessary
506 */
507 if($this->mailMethod->domainSelectionEnabled() && isset($_POST['MailDomain'])){
508 if(in_array(get_post('MailDomain'), $this->mailDomainParts)){
509 $this->mailDomainPart = get_post('MailDomain');
510 }
511 }
512 }
514 /* Import vacation message?
515 */
516 if (isset($_POST["import_vacation"]) && isset($this->vacationTemplates[$_POST["vacation_template"]])){
517 if($this->multiple_support_active){
518 $contents = ltrim(preg_replace("/^DESC:.*$/m","",file_get_contents($_POST["vacation_template"])));
519 }else{
520 $contents = $this->prepare_vacation_template(file_get_contents($_POST["vacation_template"]));
521 }
522 $this->gosaVacationMessage= htmlspecialchars($contents);
523 }
525 /* Handle flags
526 */
527 if(isset($_POST['own_script'])){
528 if(!preg_match("/C/",$this->gosaMailDeliveryMode)){
529 $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode);
530 $this->gosaMailDeliveryMode = "[".$str."C]";
531 }
532 }else{
534 /* Assemble mail delivery mode
535 The mode field in ldap consists of values between braces, this must
536 be called when 'mail' is set, because checkboxes may not be set when
537 we're in some other dialog.
539 Example for gosaMailDeliveryMode [LR ]
540 L - Local delivery
541 R - Reject when exceeding mailsize limit
542 S - Use spam filter
543 V - Use vacation message
544 C - Use custm sieve script
545 I - Only insider delivery */
547 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
550 /* Handle delivery flags */
551 if($this->acl_is_writeable("gosaMailDeliveryModeL")){
552 if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){
553 $tmp.="L";
554 }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){
555 $tmp = preg_replace("/L/","",$tmp);
556 }
557 }
558 $opts = array(
559 "R" => "use_mailsize_limit",
560 "S" => "use_spam_filter",
561 "V" => "use_vacation",
562 "C" => "own_script",
563 "I" => "drop_own_mails");
565 foreach($opts as $flag => $post){
566 if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
567 if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
568 $tmp.= $flag;
569 }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
570 $tmp = preg_replace("/".$flag."/","",$tmp);
571 }
572 }
573 }
575 $tmp= "[$tmp]";
576 if ($this->gosaMailDeliveryMode != $tmp){
577 $this->is_modified= TRUE;
578 }
579 $this->gosaMailDeliveryMode= $tmp;
580 if($this->mailMethod->vacationRangeEnabled()){
581 if($this->acl_is_writeable("gosaVacationMessage") && preg_match("/V/",$this->gosaMailDeliveryMode)){
582 if(isset($_POST['gosaVacationStart'])){
583 $this->gosaVacationStart = $_POST['gosaVacationStart'];
584 }
585 if(isset($_POST['gosaVacationStop'])){
586 $this->gosaVacationStop = $_POST['gosaVacationStop'];
587 }
588 }
589 }
590 }
591 }
592 }
595 /*! \brief Parse vacation templates and build up an array
596 containing 'filename' => 'description'.
597 Used to fill vacation dropdown box.
598 @return Array All useable vacation templates.
599 */
600 function get_vacation_templates()
601 {
602 $vct = array();
603 if ($this->config->get_cfg_value("vacationTemplateDirectory") != ""){
604 $dir= $this->config->get_cfg_value("vacationTemplateDirectory");
605 if (is_dir($dir) && is_readable($dir)){
606 $dh = opendir($dir);
607 while($file = readdir($dh)){
608 $description= "";
609 if (is_file($dir."/".$file)){
610 $fh = fopen($dir."/".$file, "r");
611 $line= fgets($fh, 256);
612 if (!preg_match('/^DESC:/', $line)){
613 msg_dialog::display(_("Configuration error"), sprintf(_("No DESC tag in vacation template '%s'!"), $file), ERROR_DIALOG);
614 }else{
615 $description= trim(preg_replace('/^DESC:\s*/', '', $line));
616 }
617 fclose ($fh);
618 }
619 if ($description != ""){
620 $vct["$dir/$file"]= $description;
621 }
622 }
623 closedir($dh);
624 }
625 }
626 return($vct);
627 }
630 /*! \brief Adds the given mail address to the list of mail forwarders
631 */
632 function addForwarder($address)
633 {
634 if(empty($address)) return;
635 if($this->acl_is_writeable("gosaMailForwardingAddress")){
636 $this->gosaMailForwardingAddress[]= $address;
637 $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
638 sort ($this->gosaMailForwardingAddress);
639 reset ($this->gosaMailForwardingAddress);
640 $this->is_modified= TRUE;
641 }else{
642 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
643 }
644 }
647 /*! \brief Removes the given mail address from the list of mail forwarders
648 */
649 function delForwarder($addresses)
650 {
651 if($this->acl_is_writeable("gosaMailForwardingAddress")){
652 $this->gosaMailForwardingAddress= array_remove_entries ($addresses, $this->gosaMailForwardingAddress);
653 $this->is_modified= TRUE;
654 }else{
655 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
656 }
657 }
660 /*! \brief Add given mail address to the list of alternate adresses ,
661 . check if this mal address is used, skip adding in this case
662 */
663 function addAlternate($address)
664 {
665 if(empty($address)) return;
666 if($this->acl_is_writeable("gosaMailAlternateAddress")){
667 $ldap= $this->config->get_ldap_link();
668 $address= strtolower($address);
670 /* Is this address already assigned in LDAP? */
671 $ldap->cd ($this->config->current['BASE']);
672 $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)".
673 "(alias=$address)(gosaMailAlternateAddress=$address)))", array("uid"));
674 if ($ldap->count() > 0){
675 $attrs= $ldap->fetch ();
676 return ($attrs["uid"][0]);
677 }
678 if (!in_array($address, $this->gosaMailAlternateAddress)){
679 $this->gosaMailAlternateAddress[]= $address;
680 $this->is_modified= TRUE;
681 }
682 sort ($this->gosaMailAlternateAddress);
683 reset ($this->gosaMailAlternateAddress);
684 return ("");
685 }else{
686 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
687 }
688 }
691 /*! \brief Removes the given mail address from the alternate addresses list
692 */
693 function delAlternate($addresses)
694 {
695 if($this->acl_is_writeable("gosaMailAlternateAddress")){
696 $this->gosaMailAlternateAddress= array_remove_entries ($addresses,$this->gosaMailAlternateAddress);
697 $this->is_modified= TRUE;
698 }else{
699 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
700 }
701 }
704 /*! \brief Prepare importet vacation string. \
705 . Replace placeholder like %givenName a.s.o.
706 @param string Vacation string
707 @return string Completed vacation string
708 */
709 private function prepare_vacation_template($contents)
710 {
711 /* Replace attributes */
712 $attrs = array();
713 $obj = NULL;
714 if(isset($this->parent->by_object['user'])){
715 $attrs = $this->parent->by_object['user']->attributes;
716 $obj = $this->parent->by_object['user'];
717 }else{
718 $obj = new user($this->config,$this->dn);
719 $attrs = $obj->attributes;
720 }
721 if($obj){
722 foreach ($attrs as $val){
723 if(preg_match("/dateOfBirth/",$val)){
724 if($obj->use_dob){
725 $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
726 }
727 }else {
728 $contents= preg_replace("/%$val/",
729 $obj->$val, $contents);
730 }
732 /* Replace vacation start and end time */
733 if(preg_match("/%start/",$contents)){
734 $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
735 }
736 if(preg_match("/%end/",$contents)){
737 $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
738 }
739 }
740 }
741 $contents = ltrim(preg_replace("/^DESC:.*$/m","",$contents),"\n ");
742 return($contents);
743 }
746 /*! \brief Displays a dialog that allows mail address selection.
747 */
748 function display_forward_dialog()
749 {
750 restore_error_handler();
752 $smarty = get_smarty();
753 $ldap= $this->config->get_ldap_link();
755 /* Save data */
756 $mailfilter= session::get("mailfilter");
757 foreach( array("depselect", "muser", "regex") as $type){
758 if (isset($_POST[$type])){
759 $mailfilter[$type]= $_POST[$type];
760 }
761 }
762 if (isset($_GET['search'])){
763 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
764 if ($s == "**"){
765 $s= "*";
766 }
767 $mailfilter['regex']= $s;
768 }
769 session::set("mailfilter", $mailfilter);
771 /* Get actual list */
772 $mailusers= array ();
773 if ($mailfilter['regex'] != '*' && $mailfilter['regex'] != ""){
774 $regex= $mailfilter['regex'];
775 $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
776 } else {
777 $filter= "";
778 }
779 if ($mailfilter['muser'] != ""){
780 $user= $mailfilter['muser'];
781 $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
782 }
784 /* Add already present people to the filter */
785 $exclude= "";
786 foreach ($this->gosaMailForwardingAddress as $mail){
787 $exclude.= "(mail=$mail)";
788 }
789 if ($exclude != ""){
790 $filter.= "(!(|$exclude))";
791 }
792 $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $mailfilter['depselect'],
793 array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
794 $ldap->cd($mailfilter['depselect']);
795 $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
796 while ($attrs= $ldap->fetch()){
797 if(preg_match('/%/', $attrs['mail'][0])){
798 continue;
799 }
800 $name= $this->make_name($attrs);
801 $mailusers[$attrs['mail'][0]]= $name."<".
802 $attrs['mail'][0].">";
803 }
804 natcasesort ($mailusers);
805 reset ($mailusers);
807 /* Show dialog */
808 $smarty->assign("search_image", get_template_path('images/lists/search.png'));
809 $smarty->assign("usearch_image", get_template_path('images/lists/search-user.png'));
810 $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
811 $smarty->assign("infoimage", get_template_path('images/info.png'));
812 $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
813 $smarty->assign("mailusers", $mailusers);
814 if (isset($_POST['depselect'])){
815 $smarty->assign("depselect", $_POST['depselect']);
816 }
817 $smarty->assign("deplist", $this->config->idepartments);
818 $smarty->assign("apply", apply_filter());
819 $smarty->assign("alphabet", generate_alphabet());
820 $smarty->assign("hint", print_sizelimit_warning());
821 foreach( array("depselect", "muser", "regex") as $type){
822 $smarty->assign("$type", $mailfilter[$type]);
823 }
824 $smarty->assign("hint", print_sizelimit_warning());
825 $display= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE, dirname(__FILE__)));
826 return ($display);
827 }
830 /*! \brief Removes the mailAccount extension from ldap
831 */
832 function remove_from_parent()
833 {
834 /* Cancel if there's nothing to do here */
835 if (!$this->initially_was_account){
836 return;
837 }
839 /* If domain part was selectable, contruct mail address */
840 if($this->mailMethod->domainSelectionEnabled()){
841 $this->mail = $this->mail."@".$this->mailDomainPart;
842 }
844 /* Remove GOsa attributes */
845 plugin::remove_from_parent();
847 /* Zero arrays */
848 $this->attrs['gosaMailAlternateAddress'] = array();
849 $this->attrs['gosaMailForwardingAddress']= array();
852 $this->mailMethod->fixAttributesOnRemove();
853 $this->cleanup();
855 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
856 $ldap= $this->config->get_ldap_link();
857 $ldap->cd($this->dn);
858 $ldap->modify ($this->attrs);
860 /* Add "view" to logging class */
861 new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
862 if (!$ldap->success()){
863 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
864 }
866 /* Let the mailMethod remove this mailbox, e.g. from imap and
867 update shared folder membership, ACL may need to be updated.
868 */
869 if (!$this->is_template){
871 if(!$this->mailMethod->connect()){
872 msg_dialog::display(_("Mail error"), sprintf(_("Cannot connect mail method! Error was: %s."),
873 $this->mailMethod->get_error()), ERROR_DIALOG);
874 }else{
875 if(!$this->mailMethod->deleteMailbox()){
876 msg_dialog::display(_("Mail error"), sprintf(_("Cannot remove mailbox! Error was: %s."),
877 $this->mailMethod->get_error()), ERROR_DIALOG);
878 }
879 if(!$this->mailMethod->updateSharedFolder()){
880 msg_dialog::display(_("Mail error"), sprintf(_("Cannot update shared folder permissions! Error was: %s."),
881 $this->mailMethod->get_error()), ERROR_DIALOG);
882 }
883 }
884 }
885 $this->mailMethod->disconnect();
887 /* Optionally execute a command after we're done */
888 $this->handle_post_events("remove",array("uid" => $this->uid));
889 }
892 /*! \brief Save the mailAccount settings to the ldap database.
893 */
894 function save()
895 {
896 $ldap= $this->config->get_ldap_link();
898 /* If domain part was selectable, contruct mail address */
899 if(!(!$this->mailMethod->isModifyableMail() && $this->initially_was_account)){
901 if($this->mailMethod->domainSelectionEnabled()){
902 $this->mail = $this->mail."@".$this->mailDomainPart;
903 }
905 /* Enforce lowercase mail address and trim whitespaces
906 */
907 $this->mail = trim(strtolower($this->mail));
908 }
911 /* Call parents save to prepare $this->attrs */
912 plugin::save();
914 /* Save arrays */
915 $this->attrs['gosaMailAlternateAddress'] = $this->gosaMailAlternateAddress;
916 $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
918 if(!$this->mailMethod->vacationRangeEnabled()){
919 $this->attrs['gosaVacationStart'] = $this->attrs['gosaVacationStop'] = array();
920 }elseif (!preg_match('/V/', $this->gosaMailDeliveryMode)){
921 unset($this->attrs['gosaVacationStart']);
922 unset($this->attrs['gosaVacationStop']);
923 }
925 /* Map method attributes */
926 $this->mailMethod->fixAttributesOnStore();
928 /* Save data to LDAP */
929 $ldap->cd($this->dn);
930 $this->cleanup();
931 $ldap->modify ($this->attrs);
935 if (!$ldap->success()){
936 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
937 }
939 /* Log last action */
940 if($this->initially_was_account){
941 new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
942 }else{
943 new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
944 }
946 /* Only do IMAP actions if we are not a template */
947 if (!$this->is_template){
948 $this->mailMethod->connect();
949 if(!$this->mailMethod->is_connected()){
950 msg_dialog::display(_("Mail error"), sprintf(_("Cannot connect mail method! Error was: %s."),
951 $this->mailMethod->get_error()), ERROR_DIALOG);
952 }else{
953 if(!$this->mailMethod->updateMailbox()){
954 msg_dialog::display(_("Mail error"), sprintf(_("Cannot update mailbox! Error was: %s."),
955 $this->mailMethod->get_error()), ERROR_DIALOG);
956 }
957 if(!$this->mailMethod->setQuota($this->gosaMailQuota)){
958 msg_dialog::display(_("Mail error"), sprintf(_("Cannot write quota settings! Error was: %s."),
959 $this->mailMethod->get_error()), ERROR_DIALOG);
960 }
962 if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){
965 /* Do not write sieve settings if this account is new and
966 doesn't seem to exist.
967 */
968 if(!$this->initially_was_account && !$this->mailMethod->account_exists()){
969 @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,
970 "Skipping sieve settings, the account doesn't seem to be created already.</b>","");
971 }else{
972 if(!$this->mailMethod->saveSieveSettings()){
973 msg_dialog::display(_("Mail error"), $this->mailMethod->get_error(), ERROR_DIALOG);
974 }
975 }
976 }else{
978 echo "Check sieve management here";
980 @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,
981 "User uses an own sieve script, skipping sieve update.".$str."</b>","");
982 }
984 if(!$this->mailMethod->updateSharedFolder()){
985 msg_dialog::display(_("Mail error"), sprintf(_("Cannot update shared folder permissions! Error was: %s."),
986 $this->mailMethod->get_error()), ERROR_DIALOG);
987 }
988 }
989 }
990 $this->mailMethod->disconnect();
992 /* Optionally execute a command after we're done */
993 if ($this->initially_was_account == $this->is_account){
994 if ($this->is_modified){
995 $this->handle_post_events("modify", array("uid" => $this->uid));
996 }
997 } else {
998 $this->handle_post_events("add", array("uid" => $this->uid));
999 }
1000 }
1003 /*! \brief Check given values
1004 */
1005 function check()
1006 {
1007 if(!$this->is_account){
1008 return(array());
1009 }
1011 $ldap= $this->config->get_ldap_link();
1013 /* Call common method to give check the hook */
1014 $message= plugin::check();
1016 if(empty($this->gosaMailServer)){
1017 $message[]= msgPool::noserver(_("Mail"));
1018 }
1020 /* Mail address checks */
1021 $mail = $this->mail;
1022 if(!(!$this->mailMethod->isModifyableMail() && $this->initially_was_account)){
1024 if($this->mailMethod->domainSelectionEnabled()){
1025 $mail.= "@".$this->mailDomainPart;
1026 }
1028 if (empty($mail)){
1029 $message[]= msgPool::required(_("Primary address"));
1030 }
1031 if ($this->is_template){
1032 if (!tests::is_email($mail, TRUE)){
1033 $message[]= msgPool::invalid(_("Mail address"),"","","%givenName.%sn@your-domain.com");
1034 }
1035 } else {
1036 if (!tests::is_email($mail)){
1037 $message[]= msgPool::invalid(_("Mail address"),"","","your-address@your-domain.com");
1038 }
1039 }
1041 /* Check if this mail address is already in use */
1042 $ldap->cd($this->config->current['BASE']);
1043 $filter = "(&(!(objectClass=gosaUserTemplate))(!(uid=".$this->uid."))".
1044 "(objectClass=gosaMailAccount)".
1045 "(|(mail=".$mail.")(alias=".$mail.")(gosaMailAlternateAddress=".$mail.")))";
1046 $ldap->search($filter,array("uid"));
1047 if ($ldap->count() != 0){
1048 $message[]= msgPool::duplicated(_("Mail address"));
1049 }
1050 }
1053 /* Check quota */
1054 if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
1055 if (!is_numeric($this->gosaMailQuota)) {
1056 $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
1057 } else {
1058 $this->gosaMailQuota= (int) $this->gosaMailQuota;
1059 }
1060 }
1062 /* Check rejectsize for integer */
1063 if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
1064 if (!is_numeric($this->gosaMailMaxSize)){
1065 $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
1066 } else {
1067 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
1068 }
1069 }
1071 /* Need gosaMailMaxSize if use_mailsize_limit is checked */
1072 if (is_integer(strpos($this->gosaMailDeliveryMode, "R")) && $this->gosaMailMaxSize == ""){
1073 $message[]= msgPool::required(_("Mail reject size"));
1074 }
1076 if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
1077 $message[]= msgPool::required(_("Spam folder"));
1078 }
1080 if ($this->mailMethod->vacationRangeEnabled()
1081 && preg_match('/V/', $this->gosaMailDeliveryMode)
1082 && $this->gosaVacationStart > $this->gosaVacationStop){
1083 $message[]= msgPool::invalid(_("Vacation interval"));
1084 }
1085 return($message);
1086 }
1089 /*! \brief Adapt from template, using 'dn'
1090 */
1091 function adapt_from_template($dn, $skip= array())
1092 {
1093 plugin::adapt_from_template($dn, $skip);
1095 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
1097 if (in_array($val, $skip)){
1098 continue;
1099 }
1101 $this->$val= array();
1102 if (isset($this->attrs["$val"]["count"])){
1103 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
1104 $value= $this->attrs["$val"][$i];
1105 foreach (array("sn", "givenName", "uid") as $repl){
1106 if (preg_match("/%$repl/i", $value)){
1107 $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
1108 }
1109 }
1110 array_push($this->$val, strtolower(rewrite($value)));
1111 }
1112 }
1113 }
1114 $this->mail= strtolower(rewrite($this->mail));
1115 }
1118 /*! \brief Creates the mail part for the copy & paste dialog
1119 */
1120 function getCopyDialog()
1121 {
1122 if(!$this->is_account) return("");
1123 $smarty = get_smarty();
1124 $smarty->assign("mail",$this->mail);
1125 $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
1126 $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
1127 $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
1129 $ret = array();
1130 $ret['status'] = "";
1131 $ret['string'] = $str;
1132 return($ret);
1133 }
1136 /*! \brief save_object for copy&paste vars
1137 */
1138 function saveCopyDialog()
1139 {
1140 if(!$this->is_account) return;
1142 /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
1143 $this->execute();
1144 if(isset($_POST['mail'])){
1145 $this->mail = $_POST['mail'];
1146 }
1147 }
1150 /*! \brief Prepare this account to be copied
1151 */
1152 function PrepareForCopyPaste($source)
1153 {
1154 plugin::PrepareForCopyPaste($source);
1156 /* Reset alternate mail addresses */
1157 $this->gosaMailAlternateAddress = array();
1158 }
1161 /*! \brief Prepare this class the be useable when editing multiple users at once
1162 */
1163 function get_multi_edit_values()
1164 {
1165 $ret = plugin::get_multi_edit_values();
1166 if(in_array("gosaMailQuota",$this->multi_boxes)){
1167 $ret['gosaMailQuota'] = $this->gosaMailQuota;
1168 }
1169 $flag_add = $flag_remove = array();
1170 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1171 $opts = array(
1172 "R" => "use_mailsize_limit",
1173 "S" => "use_spam_filter",
1174 "L" => "only_local",
1175 "V" => "use_vacation",
1176 "C" => "own_script",
1177 "I" => "drop_own_mails");
1178 foreach($opts as $flag => $post){
1179 if(in_array($post, $this->multi_boxes)){
1180 if(preg_match("/".$flag."/",$tmp)){
1181 $flag_add[] = $flag;
1182 }else{
1183 $flag_remove[] = $flag;
1184 }
1185 }
1186 }
1187 $ret['flag_add'] = $flag_add;
1188 $ret['flag_remove'] = $flag_remove;
1190 echo "1";
1191 if($this->mailMethod->vacationRangeEnabled()){
1192 echo "2";
1193 if(in_array("V",$flag_add)){
1194 $ret['gosaVacationStart'] = $this->gosaVacationStart = $_POST['gosaVacationStart'];
1195 $ret['gosaVacationStop'] = $this->gosaVacationStop = $_POST['gosaVacationStop'];
1196 }
1197 }
1198 return($ret);
1199 }
1202 /*! \brief Check given input for multiple user edit
1203 */
1204 function multiple_check()
1205 {
1206 $message = plugin::multiple_check();
1208 if(empty($this->gosaMailServer) && in_array("gosaMailServer",$this->multi_boxes)){
1209 $message[]= msgPool::noserver(_("Mail"));
1210 }
1212 /* Check quota */
1213 if ($this->gosaMailQuota != '' && in_array("gosaMailQuota",$this->multi_boxes)){
1214 if (!is_numeric($this->gosaMailQuota)) {
1215 $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
1216 } else {
1217 $this->gosaMailQuota= (int) $this->gosaMailQuota;
1218 }
1219 }
1221 /* Check rejectsize for integer */
1222 if ($this->gosaMailMaxSize != '' && in_array("gosaMailMaxSize",$this->multi_boxes)){
1223 if (!is_numeric($this->gosaMailMaxSize)){
1224 $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
1225 } else {
1226 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
1227 }
1228 }
1230 if(empty($this->gosaSpamMailbox) && in_array("gosaSpamMailbox",$this->multi_boxes)){
1231 $message[]= msgPool::required(_("Spam folder"));
1232 }
1234 if ( in_array("use_vacation",$this->multi_boxes) &&
1235 preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
1236 $message[]= msgPool::invalid(_("Vacation interval"));
1237 }
1238 return($message);
1239 }
1242 /*! \brief ...
1243 */
1244 function set_multi_edit_values($values)
1245 {
1246 plugin::set_multi_edit_values($values);
1247 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1248 if(isset($values['flag_add'])){
1249 foreach($values['flag_add'] as $flag){
1250 if(!preg_match("/".$flag."/",$tmp)){
1251 $tmp .= $flag;
1252 }
1253 }
1254 }
1255 if(isset($values['flag_remove'])){
1256 foreach($values['flag_remove'] as $flag){
1257 if(preg_match("/".$flag."/",$tmp)){
1258 $tmp = preg_replace("/".$flag."/","",$tmp);
1259 }
1260 }
1261 }
1262 $this->gosaMailDeliveryMode = "[".$tmp."]";
1264 /* Set vacation message and replace placeholder like %givenName
1265 */
1266 if(isset($values['gosaVacationMessage'])){
1267 $this->gosaVacationMessage = $this->prepare_vacation_template($values['gosaVacationMessage']);
1268 }
1269 }
1272 /*! \brief Initialize plugin to be used as multiple edit class.
1273 */
1274 function init_multiple_support($attrs,$all)
1275 {
1276 plugin::init_multiple_support($attrs,$all);
1277 if(isset($this->multi_attrs['gosaMailQuota'])){
1278 $this->gosaMailQuota = $this->multi_attrs['gosaMailQuota'];
1279 }
1280 }
1283 /*! \brief
1284 */
1285 function get_multi_init_values()
1286 {
1287 $attrs = plugin::get_multi_init_values();
1288 $attrs['gosaMailQuota'] = $this->gosaMailQuota;
1289 return($attrs);
1290 }
1293 /*! \brief Display multiple edit dialog
1294 */
1295 function multiple_execute()
1296 {
1297 return($this->execute());
1298 }
1301 /*! \brief Save posts from multiple edit dialog
1302 */
1303 function multiple_save_object()
1304 {
1305 plugin::multiple_save_object();
1307 $this->save_object();
1308 foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
1309 if(isset($_POST["use_".$attr])){
1310 $this->multi_boxes[] = $attr;
1311 }
1312 }
1313 }
1316 /*! \brief Creates the user names for the add_local_forward dialog
1317 */
1318 function make_name($attrs)
1319 {
1320 $name= "";
1321 if (isset($attrs['sn'][0])){
1322 $name= $attrs['sn'][0];
1323 }
1324 if (isset($attrs['givenName'][0])){
1325 if ($name != ""){
1326 $name.= ", ".$attrs['givenName'][0];
1327 } else {
1328 $name.= $attrs['givenName'][0];
1329 }
1330 }
1331 if ($name != ""){
1332 $name.= " ";
1333 }
1335 return ($name);
1336 }
1339 /*! \brief ACL settings
1340 */
1341 static function plInfo()
1342 {
1343 return (array(
1344 "plShortName" => _("Mail"),
1345 "plDescription" => _("Mail settings"),
1346 "plSelfModify" => TRUE,
1347 "plDepends" => array("user"), // This plugin depends on
1348 "plPriority" => 4, // Position in tabs
1349 "plSection" => array("personal" => _("My account")),
1350 "plCategory" => array("users"),
1351 "plOptions" => array(),
1353 "plProvidedAcls" => array(
1354 "mail" => _("Mail address"),
1355 "gosaMailServer" => _("Mail server"),
1356 "gosaMailQuota" => _("Quota size"),
1358 "gosaMailDeliveryModeV" => _("Add vacation information"), // This is flag of gosaMailDeliveryMode
1359 "gosaVacationMessage" => _("Vacation message"),
1361 "gosaMailDeliveryModeS" => _("Use spam filter"), // This is flag of gosaMailDeliveryMode
1362 "gosaSpamSortLevel" => _("Spam level"),
1363 "gosaSpamMailbox" => _("Spam mail box"),
1365 "sieveManagement" => _("Sieve management"),
1367 "gosaMailDeliveryModeR" => _("Reject due to mailsize"), // This is flag of gosaMailDeliveryMode
1368 "gosaMailMaxSize" => _("Mail max size"),
1370 "gosaMailForwardingAddress" => _("Forwarding address"),
1371 "gosaMailDeliveryModeL" => _("Local delivery"), // This is flag of gosaMailDeliveryMode
1372 "gosaMailDeliveryModeI" => _("No delivery to own mailbox "), // This is flag of gosaMailDeliveryMode
1373 "gosaMailAlternateAddress" => _("Mail alternative addresses"),
1375 "gosaMailForwardingAddress" => _("Forwarding address"),
1376 "gosaMailDeliveryModeC" => _("Use custom sieve script")) // This is flag of gosaMailDeliveryMode
1377 ));
1378 }
1381 }
1383 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1384 ?>