1 <?php
2 /*! \brief mail plugin
3 \author Cajus Pollmeier <pollmeier@gonicus.de>
4 \version 2.00
5 \date 24.07.2003
7 This class provides the functionality to read and write all attributes
8 relevant for gosaMailAccounts from/to the LDAP. It does syntax checking
9 and displays the formulars required.
10 */
12 class mailAccount extends plugin
13 {
14 /* Definitions */
15 var $plHeadline = "Mail";
16 var $plDescription = "This does something";
17 var $method = "mailMethod";
19 var $gosaVacationStart = 0;
20 var $gosaVacationStop = 0;
21 var $view_logged = FALSE;
23 /* plugin specific values */
24 var $mail = "";
25 var $gosaMailAlternateAddress = array();
26 var $gosaMailForwardingAddress = array();
27 var $gosaMailDeliveryMode = "[L ]";
28 var $gosaMailServer = "";
29 var $gosaMailQuota = "";
30 var $gosaMailMaxSize = "";
31 var $gosaVacationMessage = "";
32 var $gosaSpamSortLevel = "";
33 var $gosaSpamMailbox = "";
35 var $quotaUsage = 0;
36 var $forward_dialog = FALSE;
37 var $folder_prefix = "";
38 var $mailboxList = array("INBOX");
39 var $default_permissions = "none";
40 var $member_permissions = "post";
41 var $members = array();
42 var $admins = array();
43 var $vacations = array();
44 var $perms = array( "lrs" => "read",
45 "lrsp" => "post",
46 "lrsip" => "append",
47 "lrswipcd" => "write",
48 "lrswipcda" => "all" );
50 /* attribute list for save action */
51 var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize","gosaMailForwardingAddress",
52 "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress","gosaVacationStart","gosaVacationStop",
53 "gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress");
54 var $objectclasses= array("gosaMailAccount");
55 var $uid = "";
57 var $sieve_management = NULL;
58 var $multiple_support = TRUE;
60 /* constructor, if 'dn' is set, the node loads the given
61 'dn' from LDAP */
62 function mailAccount (&$config, $dn= NULL)
63 {
64 global $class_mapping;
66 $this->gosaVacationStart = time();
67 $this->gosaVacationStop = time();
69 /* Load bases attributes */
70 plugin::plugin($config, $dn);
72 /* Set uid */
73 if(isset($this->attrs['uid'])){
74 $this->uid = $this->attrs['uid'][0];
75 }
77 if(is_array($this->gosaMailServer) && isset($this->gosaMailServer[0])){
78 $this->gosaMailServer = $this->gosaMailServer[0];
79 }
81 /* Save initial account state */
82 $this->initially_was_account= $this->is_account;
84 /* Set mailMethod to the one defined in gosa.conf */
85 if (isset($this->config->current['MAILMETHOD'])){
86 $method= $this->config->current['MAILMETHOD'];
88 $cls = get_correct_class_name("mailMethod$method");
89 if ($cls && class_exists($cls)){
90 $this->method= $cls;
91 } else {
92 msg_dialog::display(_("Configuration error"), sprintf(_("Mail method '%s' is unknown!"), $method), ERROR_DIALOG);
93 }
94 }
97 /* Create the account prefix user. user/
98 Preset folder prefix. Will change it later to respect
99 altnamespace. */
100 if (isset($this->config->current['CYRUSUNIXSTYLE']) && $this->config->current['CYRUSUNIXSTYLE'] == "true"){
101 $this->folder_prefix= "user/";
102 }elseif (isset($this->config->data['MAIN']['CYRUSUNIXSTYLE']) && $this->config->data['MAIN']['CYRUSUNIXSTYLE'] == "true"){
103 $this->folder_prefix= "user/";
104 } else {
105 $this->folder_prefix= "user.";
106 }
108 /* This is not a new account, parse additional attributes */
109 if (($dn !== NULL) && ($dn != "new") && $this->is_account){
111 /* Load attributes containing arrays */
112 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
113 $this->$val= array();
114 if (isset($this->attrs["$val"]["count"])){
115 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
116 array_push($this->$val, $this->attrs["$val"][$i]);
117 }
118 }
119 }
122 /* Only do IMAP actions if gosaMailServer attribute is set */
123 if (isset ($this->attrs["gosaMailServer"][0])){
125 $method = new $this->method($this->config);
126 $id = $method->uattrib;
128 /* Adapt attributes if needed */
129 $method->fixAttributesOnLoad($this);
131 /* FixAttributesOnLoad possibly creates an array out of gosaMailServer.
132 If the mail tab wasn't opened once before saving, the account can't be saved */
133 if(is_array($this->gosaMailServer)){
134 $this->gosaMailServer = $this->gosaMailServer[0];
135 }
137 if ($method->connect($this->attrs["gosaMailServer"][0])){
139 /* Update quota values */
140 $quota= $method->getQuota($this->folder_prefix.$this->$id);
142 if($quota){
143 if ($quota['gosaMailQuota'] == 2147483647){
144 $this->quotaUsage = "";
145 $this->gosaMailQuota = "";
146 } else {
147 $this->quotaUsage = $quota['quotaUsage'];
148 $this->gosaMailQuota = $quota['gosaMailQuota'];
149 }
150 }else{
151 $this->quotaUsage = "";
152 $this->gosaMailQuota = "";
153 }
155 /* Get mailboxes / folder like INBOX ..*/
156 $this->mailboxList= $method->getMailboxList($this->folder_prefix.$this->$id,$this->$id);
158 $method->disconnect();
159 }else{
160 /* Could not connect to ldap.
161 */
162 if (isset($this->attrs['gosaMailQuota'][0])){
163 $this->gosaMailQuota = $this->attrs['gosaMailQuota'][0];
164 }
165 }
166 }
167 }
169 /* Fill vacation array */
170 $this->vacation= array();
171 if (isset($this->config->current['VACATIONDIR'])){
172 $dir= $this->config->current['VACATIONDIR'];
173 if (is_dir($dir) && is_readable($dir)){
175 /* Look for files and build the vacation array */
176 $dh= opendir($dir);
177 while ($file = readdir($dh)){
178 $description= $this->parse_vacation("$dir/$file");
179 if ($description != ""){
180 $this->vacation["$dir/$file"]= $description;
181 }
182 }
183 closedir($dh);
184 }
185 }
187 /* Create sieve management class */
188 $method = new $this->method($this->config);
189 $id = $method->uattrib;
190 $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$id);
192 /* Get global filter config */
193 if (!session::is_set("mailfilter")){
194 $ui= get_userinfo();
195 $base= get_base_from_people($ui->dn);
196 $mailfilter= array( "depselect" => $base,
197 "muser" => "",
198 "regex" => "*");
199 session::set("mailfilter", $mailfilter);
200 }
201 }
204 function parse_vacation($file)
205 {
206 $desc= "";
208 if (is_file($file)){
209 $fh = fopen($file, "r");
210 $line= fgets($fh, 256);
212 if (!preg_match('/^DESC:/', $line)){
213 msg_dialog::display(_("Configuration error"), sprintf(_("No DESC tag in vacation template '%s'!"), $file), ERROR_DIALOG);
214 return $desc;
215 }
216 fclose ($fh);
218 $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
219 }
221 return $desc;
222 }
225 function execute()
226 {
227 /* Call parent execute */
228 plugin::execute();
230 /* Log view */
231 if($this->is_account && !$this->view_logged){
232 $this->view_logged = TRUE;
233 new log("view","users/".get_class($this),$this->dn);
234 }
236 /* Initialise vars */
238 /* Load templating engine */
239 $smarty= get_smarty();
240 $display= "";
242 /* Get available mailserver */
243 $mailserver= array();
244 foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
245 $mailserver[]= $key;
246 }
248 /*
249 * Sieve Management
250 */
251 if(isset($_POST['sieveManagement'])
252 && preg_match("/C/",$this->gosaMailDeliveryMode)
253 && $this->acl_is_writeable("sieveManagement")) {
255 $this->dialog = $this->sieve_management;
256 }
258 /* Cancel sieve edit */
259 if(isset($_POST['sieve_cancel'])){
260 $this->dialog = FALSE;
261 }
263 /* Save sieve changes */
264 if(isset($_POST['sieve_finish'])){
265 $this->sieve_management = $this->dialog;
266 $this->dialog = FALSE;
267 }
269 if(is_object($this->dialog)){
270 $this->dialog->save_object();
271 return($this->dialog->execute());
272 }
275 /* Handle account state */
276 /* Do we need to flip is_account state? */
277 if(isset($_POST['modify_state'])){
278 if($this->is_account && $this->acl_is_removeable()){
279 $this->is_account= FALSE;
280 }elseif(!$this->is_account && $this->acl_is_createable()){
281 $this->is_account= TRUE;
282 }
283 }
285 /* Do we represent a valid account? */
286 if(!$this->multiple_support_active){
287 if (!$this->is_account && $this->parent === NULL){
288 $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
289 msgPool::noValidExtension(_("Mail"))."</b>";
291 $display.= back_to_main();
292 return ($display);
293 }
295 /* Show tab dialog headers */
296 if ($this->parent !== NULL){
297 if ($this->is_account){
298 if($this->accountDelegationsConfigured()){
299 $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),
300 _("Mail settings cannot be removed while there are delegations configured!"),TRUE,TRUE);
301 }else{
302 $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Mail")),
303 msgPool::featuresEnabled(_("Mail")));
304 }
305 } else {
306 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Mail")),
307 msgPool::featuresDisabled(_("Mail")));
308 return ($display);
309 }
310 }
311 }
313 /* Forwarder subdialog */
315 /* Trigger forward add dialog? */
316 if (isset($_POST['add_local_forwarder'])){
317 $this->forward_dialog= TRUE;
318 $this->dialog= TRUE;
319 }
321 /* Cancel forward add dialog? */
322 if (isset($_POST['add_locals_cancel'])){
323 $this->forward_dialog= FALSE;
324 $this->dialog= FALSE;
325 }
327 /* Finished adding of locals? */
328 if (isset($_POST['add_locals_finish'])){
330 if (isset($_POST['local_list'])){
332 /* Check if we are able to write gosaMailForwardingAddress */
333 if($this->acl_is_writeable("gosaMailForwardingAddress")){
335 /* Walk through list of forwarders, ignore own addresses */
336 foreach ($_POST['local_list'] as $val){
337 if (!in_array ($val, $this->gosaMailAlternateAddress) &&
338 $val != $this->mail){
340 $this->addForwarder($val);
341 $this->is_modified= TRUE;
342 }
343 }
344 }
345 $this->forward_dialog= FALSE;
346 $this->dialog= FALSE;
347 } else {
348 msg_dialog::display(_("Error"), _("Please select an entry!"), ERROR_DIALOG);
349 }
350 }
352 /* Add forward email addresses */
353 if (isset($_POST['add_forwarder'])){
354 if ($_POST['forward_address'] != ""){
356 /* Valid email address specified? */
357 $address= $_POST['forward_address'];
358 $valid= FALSE;
359 if (!tests::is_email($address)){
360 if (!tests::is_email($address, TRUE)){
361 if ($this->is_template){
362 $valid= TRUE;
363 } else {
364 msg_dialog::display(_("Error"),
365 msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),
366 ERROR_DIALOG);
367 }
368 }
369 } elseif ($address == $this->mail
370 || in_array($address, $this->gosaMailAlternateAddress)) {
371 msg_dialog::display(_("Error"),_("Cannot add primary address to the list of forwarders!") , ERROR_DIALOG);
372 } else {
373 $valid= TRUE;
374 }
376 if ($valid){
378 /* Add it, if we are able to write gosaMailForwardingAddress */
379 if($this->acl_is_writeable("gosaMailForwardingAddress")){
380 $this->addForwarder ($address);
381 $this->is_modified= TRUE;
382 }
383 }
384 }
385 }
387 /* Delete forward email addresses */
388 if (isset($_POST['delete_forwarder'])){
389 $this->delForwarder ($_POST['forwarder_list']);
390 }
393 /* Add alternate email addresses */
394 if (isset($_POST['add_alternate'])){
396 $valid= FALSE;
397 if (!tests::is_email($_POST['alternate_address'])){
398 if ($this->is_template){
399 if (!(tests::is_email($_POST['alternate_address'], TRUE))){
400 msg_dialog::display(_("Error"),
401 msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),
402 ERROR_DIALOG);
404 } else {
405 $valid= TRUE;
406 }
407 } else {
408 msg_dialog::display(_("Error"),
409 msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"),
410 ERROR_DIALOG);
411 }
413 } else {
414 $valid= TRUE;
415 }
417 if ($valid && ($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
418 $ui= get_userinfo();
419 if ($user != $ui->username){
420 msg_dialog::display(_("Error"), msgPool::duplicated(_("Mail address"))." ".
421 sprintf(_("Address is already in use by user '%s'."), $user), ERROR_DIALOG);
422 }
423 }
424 }
426 /* Delete alternate email addresses */
427 if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
428 $this->delAlternate ($_POST['alternates_list']);
429 }
432 /* Vacation message */
434 /* Import vacation message? */
435 if (isset($_POST["import_vacation"]) && isset($this->vacation[$_POST["vacation_template"]])){
438 /* Save message */
439 if($this->multiple_support_active){
440 $contents = file_get_contents($_POST["vacation_template"]);
441 }else{
442 $contents = $this->prepare_vacation_template(file_get_contents($_POST["vacation_template"]));
443 }
444 $this->gosaVacationMessage= htmlspecialchars($contents);
445 }
448 /* Display forward dialog if requested above */
450 /* Show forward add dialog */
451 if ($this->forward_dialog){
452 $ldap= $this->config->get_ldap_link();
454 /* Save data */
455 $mailfilter= session::get("mailfilter");
456 foreach( array("depselect", "muser", "regex") as $type){
457 if (isset($_POST[$type])){
458 $mailfilter[$type]= $_POST[$type];
459 }
460 }
461 if (isset($_GET['search'])){
462 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
463 if ($s == "**"){
464 $s= "*";
465 }
466 $mailfilter['regex']= $s;
467 }
468 session::set("mailfilter", $mailfilter);
470 /* Get actual list */
471 $mailusers= array ();
472 if ($mailfilter['regex'] != '*' && $mailfilter['regex'] != ""){
473 $regex= $mailfilter['regex'];
474 $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
475 } else {
476 $filter= "";
477 }
478 if ($mailfilter['muser'] != ""){
479 $user= $mailfilter['muser'];
480 $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
481 }
483 /* Add already present people to the filter */
484 $exclude= "";
485 foreach ($this->gosaMailForwardingAddress as $mail){
486 $exclude.= "(mail=$mail)";
487 }
488 if ($exclude != ""){
489 $filter.= "(!(|$exclude))";
490 }
492 $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $mailfilter['depselect'],
493 array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
494 $ldap->cd($mailfilter['depselect']);
495 $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
496 error_reporting (0);
497 while ($attrs= $ldap->fetch()){
498 if(preg_match('/%/', $attrs['mail'][0])){
499 continue;
500 }
501 $name= $this->make_name($attrs);
502 $mailusers[$attrs['mail'][0]]= $name."<".
503 $attrs['mail'][0].">";
504 }
505 error_reporting (E_ALL | E_STRICT);
506 natcasesort ($mailusers);
507 reset ($mailusers);
509 /* Show dialog */
510 $smarty->assign("search_image", get_template_path('images/search.png'));
511 $smarty->assign("usearch_image", get_template_path('images/search_user.png'));
512 $smarty->assign("tree_image", get_template_path('images/tree.png'));
513 $smarty->assign("infoimage", get_template_path('images/info.png'));
514 $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
515 $smarty->assign("mailusers", $mailusers);
516 if (isset($_POST['depselect'])){
517 $smarty->assign("depselect", $_POST['depselect']);
518 }
519 $smarty->assign("deplist", $this->config->idepartments);
520 $smarty->assign("apply", apply_filter());
521 $smarty->assign("alphabet", generate_alphabet());
522 $smarty->assign("hint", print_sizelimit_warning());
523 foreach( array("depselect", "muser", "regex") as $type){
524 $smarty->assign("$type", $mailfilter[$type]);
525 }
526 $smarty->assign("hint", print_sizelimit_warning());
528 $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE, dirname(__FILE__)));
529 return ($display);
530 }
532 /* Display mail account tab */
534 $smarty->assign("mailServers", $mailserver);
535 $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
537 $tmp = $this->plInfo();
538 foreach($tmp['plProvidedAcls'] as $name => $transl){
539 $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
540 }
542 foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
543 "gosaMailAlternateAddress", "gosaMailForwardingAddress",
544 "gosaVacationMessage", "gosaMailDeliveryMode", "gosaVacationStart",
545 "gosaVacationStop", "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){
546 $smarty->assign("$val", $this->$val);
547 }
549 if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
550 $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
551 $smarty->assign("quotadefined", "true");
552 } else {
553 $smarty->assign("quotadefined", "false");
554 }
556 /* Disable mail field if needed */
557 $method= new $this->method($this->config);
558 if ($method->uattrib == "mail" && $this->initially_was_account){
559 $smarty->assign("mailACL", preg_replace("/w/","",$this->getacl("mail",$SkipWrite)));
560 }
562 /* Disable/Enable range select, but do not disable them twice
563 * if they are already diabled by "use own sieve script"
564 */
565 if (preg_match('/V/', $this->gosaMailDeliveryMode) || preg_match("/C/",$this->gosaMailDeliveryMode)){
566 $smarty->assign('rangeEnabled', "");
567 } else {
568 $smarty->assign('rangeEnabled', "disabled");
569 }
571 if (!preg_match("/L/", $this->gosaMailDeliveryMode)) {
572 $smarty->assign("only_local", "checked");
573 } else {
574 $smarty->assign("only_local", "");
575 }
577 $types = array(
578 "V"=>"use_vacation",
579 "S"=>"use_spam_filter",
580 "R"=>"use_mailsize_limit",
581 "I"=>"drop_own_mails",
582 "C"=>"own_script");
584 /* Fill checkboxes */
585 foreach($types as $option => $varname){
586 if (preg_match("/".$option."/", $this->gosaMailDeliveryMode)) {
587 $smarty->assign($varname, "checked");
588 } else {
589 $smarty->assign($varname, "");
590 }
591 }
593 /* Display mail account tab */
594 if($this->gosaVacationStart ==0){
595 $date= getdate(time());
596 }else{
597 $date= getdate($this->gosaVacationStart);
598 }
599 $days= array();
600 for($d= 1; $d<32; $d++){
601 $days[$d]= $d;
602 }
603 $years= array();
604 for($y= $date['year']-10; $y<$date['year']+10; $y++){
605 $years[]= $y;
606 }
607 $months= msgPool::months();
608 $smarty->assign("start_day", $date["mday"]);
609 $smarty->assign("days", $days);
610 $smarty->assign("months", $months);
611 $smarty->assign("start_month", $date["mon"]-1);
612 $smarty->assign("years", $years);
613 $smarty->assign("start_year", $date["year"]);
615 if($this->gosaVacationStop ==0){
616 $date= getdate(time());
617 $date["mday"]++;
618 }else{
619 $date= getdate($this->gosaVacationStop);
620 }
621 $smarty->assign("end_day", $date["mday"]);
622 $smarty->assign("end_month", $date["mon"]-1);
623 $smarty->assign("end_year", $date["year"]);
627 /* Have vacation templates? */
628 $smarty->assign("template", "");
629 if (count($this->vacation)){
630 $smarty->assign("show_templates", "true");
631 $smarty->assign("vacationtemplates", $this->vacation);
632 if (isset($_POST['vacation_template'])){
633 $smarty->assign("template", $_POST['vacation_template']);
634 }
635 } else {
636 $smarty->assign("show_templates", "false");
637 }
639 /* Fill spam selector */
640 $spamlevel= array();
641 for ($i= 0; $i<21; $i++){
642 $spamlevel[]= $i;
643 }
644 $smarty->assign("spamlevel", $spamlevel);
645 $smarty->assign("spambox", $this->mailboxList);
647 foreach($this->attributes as $attr){
648 $u_attr = "use_".$attr;
649 $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
650 }
652 foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
653 $u_attr = "use_".$attr;
654 $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
655 }
657 $smarty->assign("multiple_support",$this->multiple_support_active);
658 $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
659 return ($display);
660 }
663 /* remove object from parent */
664 function remove_from_parent()
665 {
666 /* Cancel if there's nothing to do here */
667 if (!$this->initially_was_account){
668 return;
669 }
671 /* include global link_info */
672 $ldap= $this->config->get_ldap_link();
674 /* Remove and write to LDAP */
675 plugin::remove_from_parent();
677 /* Zero arrays */
678 $this->attrs['gosaMailAlternateAddress']= array();
679 $this->attrs['gosaMailForwardingAddress']= array();
681 /* Adapt attributes if needed */
682 $method= new $this->method($this->config);
683 $method->fixAttributesOnRemove($this);
685 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
686 $ldap->cd($this->dn);
687 $this->cleanup();
689 $ldap->modify ($this->attrs);
691 /* Add "view" to logging class */
692 new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
694 if (!$ldap->success()){
695 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
696 }
698 /* Connect to IMAP server for account deletion */
699 if ($this->gosaMailServer != ""){
700 $method= new $this->method($this->config);
701 $id= $method->uattrib;
702 if ($method->connect($this->gosaMailServer)){
704 /* Remove account from IMAP server */
705 $method->deleteMailbox($this->folder_prefix.$this->$id);
706 $method->disconnect();
707 }
708 }
710 /* Update shared folder membership, ACL may need to be updated */
711 $this->updateSharedFolder();
713 /* Optionally execute a command after we're done */
714 $this->handle_post_events("remove",array("uid" => $this->uid));
715 }
718 /* check if we have some delegations configured, those delegations must be removed first */
719 function accountDelegationsConfigured()
720 {
721 /* We are in administrational edit mode.
722 Check tab configurations directly */
723 if(isset($this->attrs)){
724 $checkArray = array("kolabInvitationPolicy","unrestrictedMailSize", "calFBURL","kolabDelegate","kolabFreeBusyFuture");
725 foreach($checkArray as $index){
726 if(isset($this->attrs[$index])){
727 return(true);
728 }
729 }
730 }
731 return(false);
732 }
735 /* Save data to object */
736 function save_object()
737 {
738 if (isset($_POST['mailTab'])){
740 /* Save ldap attributes */
741 plugin::save_object();
744 if(isset($_POST['own_script'])){
746 if(!preg_match("/C/",$this->gosaMailDeliveryMode)){
747 $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode);
748 $this->gosaMailDeliveryMode = "[".$str."C]";
749 }
751 }else{
753 /* Assemble mail delivery mode
754 The mode field in ldap consists of values between braces, this must
755 be called when 'mail' is set, because checkboxes may not be set when
756 we're in some other dialog.
758 Example for gosaMailDeliveryMode [LR ]
759 L: Local delivery
760 R: Reject when exceeding mailsize limit
761 S: Use spam filter
762 V: Use vacation message
763 C: Use custm sieve script
764 I: Only insider delivery */
766 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
769 /* Handle delivery flags */
770 if($this->acl_is_writeable("gosaMailDeliveryModeL")){
771 if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){
772 $tmp.="L";
773 }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){
774 $tmp = preg_replace("/L/","",$tmp);
775 }
776 }
778 $opts = array(
779 "R" => "use_mailsize_limit",
780 "S" => "use_spam_filter",
781 "V" => "use_vacation",
782 "C" => "own_script",
783 "I" => "drop_own_mails");
785 foreach($opts as $flag => $post){
786 if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
787 if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
788 $tmp.= $flag;
789 }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
790 $tmp = preg_replace("/".$flag."/","",$tmp);
791 }
792 }
793 }
795 $tmp= "[$tmp]";
796 if ($this->gosaMailDeliveryMode != $tmp){
797 $this->is_modified= TRUE;
798 }
799 $this->gosaMailDeliveryMode= $tmp;
802 if($this->acl_is_writeable("gosaVacationMessage") && preg_match("/V/",$this->gosaMailDeliveryMode)){
803 if(isset($_POST['gosaVacationStart'])){
804 $this->gosaVacationStart = $_POST['gosaVacationStart'];
805 }
806 if(isset($_POST['gosaVacationStop'])){
807 $this->gosaVacationStop = $_POST['gosaVacationStop'];
808 }
809 }
810 }
811 }
812 }
815 /* Save data to LDAP, depending on is_account we save or delete */
816 function save()
817 {
818 $ldap= $this->config->get_ldap_link();
820 /* Call parents save to prepare $this->attrs */
821 plugin::save();
823 /* Save arrays */
824 $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
825 $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
827 /* Adapt attributes if needed */
828 $method= new $this->method($this->config);
829 $id= $method->uattrib;
831 $method->fixAttributesOnStore($this);
833 /* Remove Mailquota if = "" or "0" */
834 if((isset($this->attrs['gosaMailQuota']))&&(!$this->attrs['gosaMailQuota'])) {
835 $this->attrs['gosaMailQuota']=0;
836 }
838 if(empty($this->attrs['gosaSpamMailbox'])){
839 unset($this->attrs['gosaSpamMailbox']);
840 }
842 $this->attrs['mail'] = strtolower($this->attrs['mail']);
844 /* Remove attributes - if not needed */
845 if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
846 unset($this->attrs['gosaVacationStart']);
847 unset($this->attrs['gosaVacationStop']);
848 }
851 /* Remove attributes - if not needed */
852 if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
853 unset($this->attrs['gosaVacationStart']);
854 unset($this->attrs['gosaVacationStop']);
855 }
857 /* Save data to LDAP */
858 $ldap->cd($this->dn);
859 $this->cleanup();
860 $ldap->modify ($this->attrs);
862 if (!$ldap->success()){
863 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
864 }
866 /* Log last action */
867 if($this->initially_was_account){
868 new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
869 }else{
870 new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
871 }
873 /* Only do IMAP actions if we are not a template */
874 if (!$this->is_template){
876 if ($method->connect($this->gosaMailServer)){
877 $method->updateMailbox($this->folder_prefix.$this->$id);
879 $method->setQuota($this->folder_prefix.$this->$id, $this->gosaMailQuota);
880 $method->disconnect();
882 /* Ensure that this is an existing account */
883 if(1==1 || $this->initially_was_account){
885 /* Write sieve information only if not in C mode */
886 if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){
887 $method->configureFilter($this->$id,
888 $this->gosaMailDeliveryMode,
889 $this->mail,
890 $this->gosaMailAlternateAddress,
891 $this->gosaMailMaxSize,
892 $this->gosaSpamMailbox,
893 $this->gosaSpamSortLevel,
894 $this->gosaVacationMessage);
895 $this->is_modified = TRUE;
896 }else{
897 $this->sieve_management->save();
898 }
899 }
900 }
901 }
903 /* Optionally execute a command after we're done */
904 if ($this->initially_was_account == $this->is_account){
905 if ($this->is_modified){
906 $this->handle_post_events("modify", array("uid" => $this->uid));
907 }
908 } else {
909 $this->handle_post_events("add", array("uid" => $this->uid));
910 }
912 $this->updateSharedFolder();
913 }
916 /* Check formular input */
917 function check()
918 {
919 if(!$this->is_account) return(array());
921 $ldap= $this->config->get_ldap_link();
923 /* Call common method to give check the hook */
924 $message= plugin::check();
926 if(empty($this->gosaMailServer)){
927 $message[]= msgPool::noserver(_("Mail"));
928 }
930 /* must: mail */
931 if ($this->mail == ""){
932 $message[]= msgPool::required(_("Primary address"));
933 }
934 if ($this->is_template){
935 if (!tests::is_email($this->mail, TRUE)){
936 $message[]= msgPool::invalid(_("Mail address"),"","","%givenName.%sn@your-domain.com");
937 }
938 } else {
939 if (!tests::is_email($this->mail)){
940 $message[]= msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com");
941 }
942 }
943 $ldap->cd($this->config->current['BASE']);
944 $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
945 if ($ldap->count() != 0){
946 $message[]= msgPool::duplicated(_("Mail address"));
947 }
949 /* Check quota */
950 if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
951 if (!is_numeric($this->gosaMailQuota)) {
952 $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
953 } else {
954 $this->gosaMailQuota= (int) $this->gosaMailQuota;
955 }
956 }
958 /* Check rejectsize for integer */
959 if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
960 if (!is_numeric($this->gosaMailMaxSize)){
961 $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
962 } else {
963 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
964 }
965 }
967 /* Need gosaMailMaxSize if use_mailsize_limit is checked */
968 if (is_integer(strpos($this->gosaMailDeliveryMode, "R")) && $this->gosaMailMaxSize == ""){
969 $message[]= msgPool::required(_("Mail reject size"));
970 }
972 if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
973 $message[]= msgPool::required(_("Spam folder"));
974 }
976 if (preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart >= $this->gosaVacationStop){
977 $message[]= msgPool::invalid(_("Vacation interval"));
978 }
980 return ($message);
981 }
984 /* Adapt from template, using 'dn' */
985 function adapt_from_template($dn, $skip= array())
986 {
987 plugin::adapt_from_template($dn, $skip);
989 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
991 if (in_array($val, $skip)){
992 continue;
993 }
995 $this->$val= array();
996 if (isset($this->attrs["$val"]["count"])){
997 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
998 $value= $this->attrs["$val"][$i];
999 foreach (array("sn", "givenName", "uid") as $repl){
1000 if (preg_match("/%$repl/i", $value)){
1001 $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
1002 }
1003 }
1004 array_push($this->$val, strtolower(rewrite($value)));
1005 }
1006 }
1007 }
1008 $this->mail= strtolower(rewrite($this->mail));
1009 }
1012 /* Add entry to forwarder list */
1013 function addForwarder($address)
1014 {
1015 if($this->acl_is_writeable("gosaMailForwardingAddress")){
1016 $this->gosaMailForwardingAddress[]= $address;
1017 $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
1018 sort ($this->gosaMailForwardingAddress);
1019 reset ($this->gosaMailForwardingAddress);
1020 $this->is_modified= TRUE;
1021 }else{
1022 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
1023 }
1024 }
1027 /* Remove list of addresses from forwarder list */
1028 function delForwarder($addresses)
1029 {
1030 if($this->acl_is_writeable("gosaMailForwardingAddress")){
1031 $this->gosaMailForwardingAddress= array_remove_entries ($addresses, $this->gosaMailForwardingAddress);
1032 $this->is_modified= TRUE;
1033 }else{
1034 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
1035 }
1036 }
1039 /* Add given mail address to the list of alternate adresses ,
1040 check if this mal address is used, skip adding in this case */
1041 function addAlternate($address)
1042 {
1043 if($this->acl_is_writeable("gosaMailAlternateAddress")){
1044 $ldap= $this->config->get_ldap_link();
1045 $address= strtolower($address);
1047 /* Is this address already assigned in LDAP? */
1048 $ldap->cd ($this->config->current['BASE']);
1049 $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
1050 $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
1052 if ($ldap->count() > 0){
1053 $attrs= $ldap->fetch ();
1054 return ($attrs["uid"][0]);
1055 }
1057 /* Add to list of alternates */
1058 if (!in_array($address, $this->gosaMailAlternateAddress)){
1059 $this->gosaMailAlternateAddress[]= $address;
1060 $this->is_modified= TRUE;
1061 }
1063 sort ($this->gosaMailAlternateAddress);
1064 reset ($this->gosaMailAlternateAddress);
1065 return ("");
1066 }else{
1067 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
1068 }
1069 }
1072 function delAlternate($addresses)
1073 {
1074 if($this->acl_is_writeable("gosaMailAlternateAddress")){
1075 $this->gosaMailAlternateAddress= array_remove_entries ($addresses,$this->gosaMailAlternateAddress);
1076 $this->is_modified= TRUE;
1077 }else{
1078 msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
1079 }
1080 }
1082 function make_name($attrs)
1083 {
1084 $name= "";
1085 if (isset($attrs['sn'][0])){
1086 $name= $attrs['sn'][0];
1087 }
1088 if (isset($attrs['givenName'][0])){
1089 if ($name != ""){
1090 $name.= ", ".$attrs['givenName'][0];
1091 } else {
1092 $name.= $attrs['givenName'][0];
1093 }
1094 }
1095 if ($name != ""){
1096 $name.= " ";
1097 }
1099 return ($name);
1100 }
1103 /* Create the mail part for the copy & paste dialog */
1104 function getCopyDialog()
1105 {
1106 if(!$this->is_account) return("");
1107 $smarty = get_smarty();
1108 $smarty->assign("mail",$this->mail);
1109 $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
1110 $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
1111 $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
1113 $ret = array();
1114 $ret['status'] = "";
1115 $ret['string'] = $str;
1116 return($ret);
1117 }
1119 function saveCopyDialog()
1120 {
1121 if(!$this->is_account) return;
1123 /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
1124 $this->execute();
1126 if(isset($_POST['mail'])){
1127 $this->mail = $_POST['mail'];
1128 }
1130 }
1132 function allow_remove()
1133 {
1134 if (isset($this->config->current['MAILMETHOD'])){
1135 $method= $this->config->current['MAILMETHOD'];
1136 if(preg_match("/olab/i",$method)){
1137 $ldap = $this->config->get_ldap_link();
1138 $ldap->cd($this->config->current['BASE']);
1139 $ldap->cat($this->dn);
1140 if($ldap->count()){
1141 $attrs = $ldap->fetch();
1142 if(isset($attrs['kolabDeleteFlag'])){
1143 return(_("Waiting for kolab to remove mail properties..."));
1144 }elseif(in_array("gosaMailAccount",$attrs['objectClass'])){
1145 return(_("Please remove the mail settings first to allow kolab to call its remove methods!"));
1146 }
1147 }
1148 }
1149 }
1150 }
1153 function PrepareForCopyPaste($source)
1154 {
1155 plugin::PrepareForCopyPaste($source);
1157 /* Reset alternate mail addresses */
1158 $this->gosaMailAlternateAddress = array();
1159 }
1162 static function plInfo()
1163 {
1164 return (array(
1165 "plShortName" => _("Mail"),
1166 "plDescription" => _("Mail settings"),
1167 "plSelfModify" => TRUE,
1168 "plDepends" => array("user"), // This plugin depends on
1169 "plPriority" => 4, // Position in tabs
1170 "plSection" => array("personal" => _("My account")),
1171 "plCategory" => array("users"),
1172 "plOptions" => array(),
1174 "plProvidedAcls" => array(
1175 "mail" => _("Mail address"),
1176 "gosaMailServer" => _("Mail server"),
1177 "gosaMailQuota" => _("Quota size"),
1179 "gosaMailDeliveryModeV" => _("Add vacation information"), // This is flag of gosaMailDeliveryMode
1180 "gosaVacationMessage" => _("Vacation message"),
1182 "gosaMailDeliveryModeS" => _("Use spam filter"), // This is flag of gosaMailDeliveryMode
1183 "gosaSpamSortLevel" => _("Spam level"),
1184 "gosaSpamMailbox" => _("Spam mail box"),
1186 "sieveManagement" => _("Sieve management"),
1188 "gosaMailDeliveryModeR" => _("Reject due to mailsize"), // This is flag of gosaMailDeliveryMode
1189 "gosaMailMaxSize" => _("Mail max size"),
1191 "gosaMailForwardingAddress" => _("Forwarding address"),
1192 "gosaMailDeliveryModeL" => _("Local delivery"), // This is flag of gosaMailDeliveryMode
1193 "gosaMailDeliveryModeI" => _("No delivery to own mailbox "), // This is flag of gosaMailDeliveryMode
1194 "gosaMailAlternateAddress" => _("Mail alternative addresses"),
1196 "gosaMailForwardingAddress" => _("Forwarding address"),
1197 "gosaMailDeliveryModeC" => _("Use custom sieve script")) // This is flag of gosaMailDeliveryMode
1198 ));
1199 }
1202 /*! \brief Prepare importet vacation string. \
1203 Replace placeholder like %givenName a.s.o.
1204 @param string Vacation string
1205 @return string Completed vacation string
1206 */
1207 private function prepare_vacation_template($contents)
1208 {
1209 /* Replace attributes */
1210 $attrs = array();
1211 $obj = NULL;
1212 if(isset($this->parent->by_object['user'])){
1213 $attrs = $this->parent->by_object['user']->attributes;
1214 $obj = $this->parent->by_object['user'];
1215 }else{
1216 $obj = new user($this->config,$this->dn);
1217 $attrs = $obj->attributes;
1218 }
1220 if($obj){
1221 foreach ($attrs as $val){
1222 if(preg_match("/dateOfBirth/",$val)){
1223 if($obj->use_dob){
1224 $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
1225 }
1226 }else {
1227 $contents= preg_replace("/%$val/",
1228 $obj->$val, $contents);
1229 }
1231 /* Replace vacation start and end time */
1232 if(preg_match("/%start/",$contents)){
1233 $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
1234 }
1235 if(preg_match("/%end/",$contents)){
1236 $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
1237 }
1238 }
1239 }
1240 return($contents);
1241 }
1245 /* Upated shared folder ACLs
1246 */
1247 function updateSharedFolder()
1248 {
1249 $ldap = $this->config->get_ldap_link();
1250 $ldap->cd($this->config->current['BASE']);
1251 $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaMailAccount)(memberUid=".$this->uid."))",array('dn','cn'));
1252 if(class_exists("grouptabs")){
1253 while($attrs = $ldap->fetch()){
1254 $tmp = new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $attrs['dn']);
1255 if(isset($tmp->by_object['mailgroup'])){
1256 $tmp->by_object['mailgroup']->members= $tmp->by_object['group']->memberUid;
1257 if(!$this->is_account){
1258 $tmp->by_object['mailgroup']->removeUserAcl($this->uid);
1259 $tmp->by_object['mailgroup']->removeUserAcl($this->mail);
1260 }
1261 $tmp->by_object['mailgroup']->save();
1262 }
1263 }
1264 }
1265 }
1267 /* Initialize plugin with given atribute arrays
1268 */
1269 function init_multiple_support($attrs,$all)
1270 {
1271 plugin::init_multiple_support($attrs,$all);
1273 if(isset($this->multi_attrs['gosaMailQuota'])){
1274 $this->gosaMailQuota = $this->multi_attrs['gosaMailQuota'];
1275 }
1276 }
1278 function get_multi_init_values()
1279 {
1280 $attrs = plugin::get_multi_init_values();
1281 $attrs['gosaMailQuota'] = $this->gosaMailQuota;
1282 return($attrs);
1283 }
1285 function multiple_execute()
1286 {
1287 return($this->execute());
1288 }
1290 function multiple_save_object()
1291 {
1292 plugin::multiple_save_object();
1294 $this->save_object();
1295 foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
1296 if(isset($_POST["use_".$attr])){
1297 $this->multi_boxes[] = $attr;
1298 }
1299 }
1300 }
1302 function get_multi_edit_values()
1303 {
1304 $ret = plugin::get_multi_edit_values();
1306 if(in_array("gosaMailQuota",$this->multi_boxes)){
1307 $ret['gosaMailQuota'] = $this->gosaMailQuota;
1308 }
1310 $flag_add = $flag_remove = array();
1311 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1312 $opts = array(
1313 "R" => "use_mailsize_limit",
1314 "S" => "use_spam_filter",
1315 "L" => "only_local",
1316 "V" => "use_vacation",
1317 "C" => "own_script",
1318 "I" => "drop_own_mails");
1320 foreach($opts as $flag => $post){
1321 if(in_array($post, $this->multi_boxes)){
1322 if(preg_match("/".$flag."/",$tmp)){
1323 $flag_add[] = $flag;
1324 }else{
1325 $flag_remove[] = $flag;
1326 }
1327 }
1328 }
1330 $ret['flag_add'] = $flag_add;
1331 $ret['flag_remove'] = $flag_remove;
1332 return($ret);
1333 }
1336 function multiple_check()
1337 {
1338 $message = plugin::multiple_check();
1340 if(empty($this->gosaMailServer) && in_array("gosaMailServer",$this->multi_boxes)){
1341 $message[]= msgPool::noserver(_("Mail"));
1342 }
1344 /* Check quota */
1345 if ($this->gosaMailQuota != '' && in_array("gosaMailQuota",$this->multi_boxes)){
1346 if (!is_numeric($this->gosaMailQuota)) {
1347 $message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
1348 } else {
1349 $this->gosaMailQuota= (int) $this->gosaMailQuota;
1350 }
1351 }
1353 /* Check rejectsize for integer */
1354 if ($this->gosaMailMaxSize != '' && in_array("gosaMailMaxSize",$this->multi_boxes)){
1355 if (!is_numeric($this->gosaMailMaxSize)){
1356 $message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
1357 } else {
1358 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
1359 }
1360 }
1362 if(empty($this->gosaSpamMailbox) && in_array("gosaSpamMailbox",$this->multi_boxes)){
1363 $message[]= msgPool::required(_("Spam folder"));
1364 }
1366 if ( in_array("use_vacation",$this->multi_boxes) &&
1367 preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
1368 $message[]= msgPool::invalid(_("Vacation interval"));
1369 }
1370 return($message);
1371 }
1374 function set_multi_edit_values($values)
1375 {
1376 plugin::set_multi_edit_values($values);
1377 $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
1378 if(isset($values['flag_add'])){
1379 foreach($values['flag_add'] as $flag){
1380 if(!preg_match("/".$flag."/",$tmp)){
1381 $tmp .= $flag;
1382 }
1383 }
1384 }
1385 if(isset($values['flag_remove'])){
1386 foreach($values['flag_remove'] as $flag){
1387 if(preg_match("/".$flag."/",$tmp)){
1388 $tmp = preg_replace("/".$flag."/","",$tmp);
1389 }
1390 }
1391 }
1392 $this->gosaMailDeliveryMode = "[".$tmp."]";
1394 /* Set vacation message and replace placeholder like %givenName
1395 */
1396 if(isset($values['gosaVacationMessage'])){
1397 $this->gosaVacationMessage = $this->prepare_vacation_template($values['gosaVacationMessage']);
1398 }
1399 }
1400 }
1402 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1403 ?>