1 <?php
3 class mailgroup extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary= "Manage mail groups/shared folders";
7 var $cli_description= "Some longer text\nfor help";
8 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 var $method= "mailMethod";
11 /* plugin specific values */
12 var $mail= "";
13 var $uid= "";
14 var $cn= "";
15 var $gosaMailAlternateAddress= array();
16 var $gosaMailForwardingAddress= array();
17 var $gosaMailDeliveryMode= "[L ]";
18 var $gosaMailServer= "";
19 var $gosaMailQuota= "";
20 var $gosaMailMaxSize= "";
21 var $gosaVacationMessage= "";
22 var $gosaSpamSortLevel= "";
23 var $gosaSpamMailbox= "";
25 var $quotaUsage= 0;
26 var $forward_dialog= FALSE;
27 var $members= array();
28 var $mailusers= array();
29 var $perms= array();
30 var $imapacl= array('anyone' => 'p', '%members%' => 'lrsp', '' => 'p');
32 /* Helper */
33 var $indexed_acl= array();
34 var $indexed_user= array();
36 /* attribute list for save action */
37 var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
38 "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox",
39 "gosaVacationMessage");
40 var $objectclasses= array("gosaMailAccount");
43 /* constructor, if 'dn' is set, the node loads the given
44 'dn' from LDAP */
45 function mailgroup ($config, $dn= NULL, $ui= NULL)
46 {
47 /* Configuration is fine, allways */
48 $this->config= $config;
50 /* Load bases attributes */
51 plugin::plugin($config, $dn);
53 /* Set mailMethod to the one defined in gosa.conf */
54 if (isset($this->config->current['MAILMETHOD'])){
55 $method= $this->config->current['MAILMETHOD'];
56 if (class_exists("mailMethod$method")){
57 $this->method= "mailMethod$method";
58 } else {
59 print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $method));
60 }
61 }
63 /* Convert cn to uid in case of existing entries */
64 if (isset($this->attrs['cn'][0])){
65 $this->uid= $this->attrs['cn'][0];
66 }
68 if ($dn != NULL){
70 /* Load attributes containing arrays */
71 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
72 if (isset($this->attrs["$val"]["count"])){
73 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
74 array_push($this->$val, $this->attrs["$val"][$i]);
75 }
76 }
77 }
79 /* Only do IMAP actions if gosaMailServer attribute is set */
80 if (isset ($this->attrs["gosaMailServer"][0])){
81 $method= new $this->method($this->config);
82 if ($method->connect($this->attrs["gosaMailServer"][0])){
83 $quota= $method->getQuota($this->uid);
85 /* Maybe the entry is not saved in new style, get
86 permissions from IMAP and convert them to acl attributes */
87 if (!isset($this->attrs['acl'])){
88 $this->imapacl= $method->getSharedFolderPermissions($this->uid);
90 /* Need to filter what a member acl could be... */
91 $vote= array();
92 $peak= 0;
93 $leader= "";
94 foreach ($this->imapacl as $user => $acl){
96 if ($user != "anyone" ){
97 if (!isset($vote[$acl])){
98 $vote[$acl]= 1;
99 } else {
100 $vote[$acl]++;
101 }
102 if ($vote[$acl] > $peak){
103 $leader= $acl;
104 $peek= $vote[$acl];
105 }
106 }
108 }
110 /* Highest count wins as %members%, remove all members
111 with the same acl */
112 $this->imapacl['%members%']= $leader;
113 foreach ($this->imapacl as $user => $acl){
114 if ($this->acl == $leader && in_array($user, $this->attrs['memberUid'])){
115 unset($this->imapacl[$user]);
116 }
117 }
119 }
121 /* Update quota values */
122 $this->quotaUsage= $quota['quotaUsage'];
123 $this->gosaMailQuota= $quota['gosaMailQuota'];
124 $method->disconnect();
125 }
127 }
129 }
131 /* Get global filter config */
132 if (!is_global("gmailfilter")){
133 $ui= get_userinfo();
134 $base= get_base_from_people($ui->dn);
135 $gmailfilter= array( "depselect" => $base,
136 "muser" => "",
137 "regex" => "*");
138 register_global("gmailfilter", $gmailfilter);
139 }
141 /* Load permissions */
142 if (isset($this->attrs['acl'])){
143 for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
144 list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
145 $this->imapacl[$user]= $permission;
146 if ($user != "anyone" && $user != "%members%"){
147 unset($this->imapacl['']);
148 }
149 }
150 }
152 /* Fill translations */
153 $this->perms["lrs"]= _("read");
154 $this->perms["lrsp"]= _("post");
155 $this->perms["p"]= _("external post");
156 $this->perms["lrsip"]= _("append");
157 $this->perms["lrswipcd"]= _("write");
158 }
161 function execute()
162 {
163 /* Call parent execute */
164 plugin::execute();
165 /* Load templating engine */
166 $smarty= get_smarty();
167 if ($_SESSION['js']==FALSE){
168 $smarty->assign("javascript", "false");
169 } else {
170 $smarty->assign("javascript", "true");
171 }
173 /* Do we need to flip is_account state? */
174 if (isset($_POST['modify_state'])){
175 $this->is_account= !$this->is_account;
176 }
178 /* Do we represent a valid account? */
179 if (!$this->is_account && $this->parent == NULL){
180 $display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
181 _("This 'dn' has no valid mail extensions.")."</b>";
182 return ($display);
183 }
185 /* Show tab dialog headers */
186 $display= "";
187 if ($this->parent != NULL){
188 if ($this->is_account){
189 $display= $this->show_header(_("Remove mail account"),
190 _("This account has mail features enabled. You can disable them by clicking below."));
191 } else {
192 $display= $this->show_header(_("Create mail account"),
193 _("This account has mail features disabled. You can enable them by clicking below."));
194 return ($display);
195 }
196 }
198 /* Add ACL? */
199 foreach ($this->indexed_user as $nr => $user){
200 if (isset($_POST["add_$nr"])){
201 $this->imapacl[""]= "l";
202 }
203 if (isset($_POST["del_$nr"])){
204 unset ($this->imapacl[$user]);
205 }
206 }
208 /* Trigger forward add dialog? */
209 if (isset($_POST['add_local_forwarder'])){
210 $this->forward_dialog= TRUE;
211 $this->dialog= TRUE;
212 }
214 /* Cancel forward add dialog? */
215 if (isset($_POST['add_locals_cancel'])){
216 $this->forward_dialog= FALSE;
217 $this->dialog= FALSE;
218 }
220 /* Finished adding of locals? */
221 if (isset($_POST['add_locals_finish'])){
222 if (count ($_POST['local_list']) &&
223 chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
225 /* Walk through list of forwarders, ignore own addresses */
226 foreach ($_POST['local_list'] as $val){
227 if (!in_array ($val, $this->gosaMailAlternateAddress) &&
228 $val != $this->mail){
230 $this->addForwarder($val);
231 }
232 }
233 }
234 $this->forward_dialog= FALSE;
235 $this->dialog= FALSE;
236 }
238 /* Add forward email addresses */
239 if (isset($_POST['add_forwarder'])){
240 if ($_POST['forward_address'] != ""){
242 /* Valid email address specified? */
243 $address= $_POST['forward_address'];
244 if (!is_email($address)){
246 print_red (_("You're trying to add an invalid email address ".
247 "to the list of forwarders."));
249 } elseif ($address == $this->mail
250 || in_array($address, $this->gosaMailAlternateAddress)) {
252 print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
254 } else {
256 /* Add it */
257 if (chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
258 $this->addForwarder ($address);
259 }
261 }
262 }
263 }
265 /* Delete forward email addresses */
266 if (isset($_POST['delete_forwarder'])){
267 if (count($_POST['forwarder_list'])
268 && chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
270 $this->delForwarder ($_POST['forwarder_list']);
271 }
272 }
274 /* Add alternate email addresses */
275 if (isset($_POST['add_alternate'])){
276 if ($_POST['alternate_address'] != "" &&
277 chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
279 if (!is_email($_POST['alternate_address'])){
280 print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
282 } elseif (($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
283 $ui= get_userinfo();
284 if ($user != $ui->username){
285 print_red (_("The address you're trying to add is already used by user")." '$user'.");
286 }
287 }
288 }
289 }
291 /* Delete alternate email addresses */
292 if (isset($_POST['delete_alternate']) && isset ($_POST['alternates_list'])){
293 if (count($_POST['alternates_list']) &&
294 chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
296 $this->delAlternate ($_POST['alternates_list']);
297 }
298 }
300 /* Show forward add dialog */
301 if ($this->forward_dialog){
302 $ldap= $this->config->get_ldap_link();
304 /* Save data */
305 $gmailfilter= get_global("gmailfilter");
306 foreach( array("depselect", "muser", "regex") as $type){
307 if (isset($_POST[$type])){
308 $gmailfilter[$type]= $_POST[$type];
309 }
310 }
311 if (isset($_GET['search'])){
312 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
313 if ($s == "**"){
314 $s= "*";
315 }
316 $gmailfilter['regex']= $s;
317 }
318 register_global("gmailfilter", $gmailfilter);
320 /* Get actual list */
321 $mailusers= array ();
322 if ($gmailfilter['regex'] != '*' && $gmailfilter['regex'] != ""){
323 $regex= $gmailfilter['regex'];
324 $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
325 } else {
326 $filter= "";
327 }
328 if ($gmailfilter['muser'] != ""){
329 $user= $gmailfilter['muser'];
330 $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
331 }
333 /* Add already present people to the filter */
334 $exclude= "";
335 foreach ($this->gosaMailForwardingAddress as $mail){
336 $exclude.= "(mail=$mail)";
337 }
338 if ($exclude != ""){
339 $filter.= "(!(|$exclude))";
340 }
342 $acl= array($this->config->current['BASE'] => ":all");
343 $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $gmailfilter['depselect'], array("sn", "mail", "givenName"), TRUE);
344 $ldap->cd($gmailfilter['depselect']);
345 $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
346 error_reporting (0);
347 while ($attrs= $ldap->fetch()){
348 if(preg_match('/%/', $attrs['mail'][0])){
349 continue;
350 }
351 $name= $this->make_name($attrs);
352 $mailusers[$attrs['mail'][0]]= $name."<".
353 $attrs['mail'][0].">";
354 }
355 error_reporting (E_ALL);
356 natcasesort ($mailusers);
357 reset ($mailusers);
359 /* Show dialog */
360 $smarty->assign("search_image", get_template_path('images/search.png'));
361 $smarty->assign("tree_image", get_template_path('images/tree.png'));
362 $smarty->assign("infoimage", get_template_path('images/info.png'));
363 $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
364 $smarty->assign("mailusers", $mailusers);
365 $smarty->assign("deplist", $this->config->idepartments);
366 $smarty->assign("apply", apply_filter());
367 $smarty->assign("alphabet", generate_alphabet());
368 $smarty->assign("hint", print_sizelimit_warning());
369 foreach( array("depselect", "muser", "regex") as $type){
370 $smarty->assign("$type", $gmailfilter[$type]);
371 }
372 $smarty->assign("hint", print_sizelimit_warning());
373 $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE));
374 return ($display);
375 }
377 /* Assemble normal permissions */
378 $smarty->assign("permissionsACL", chkacl($this->acl, "permissions"));
379 if (isset($this->imapacl['anyone'])){
380 $smarty->assign("default_permissions", $this->imapacl['anyone']);
381 }
382 if (isset($this->imapacl['%members%'])){
383 $smarty->assign("member_permissions", $this->imapacl['%members%']);
384 }
386 /* Assemble extra attributes */
387 $perm= chkacl($this->acl, "permissions");
388 $tmp= "";
389 $nr= 0;
390 $count= count($this->imapacl);
391 $this->indexed_user= array();
392 $this->indexed_acl= array();
393 foreach($this->imapacl as $user => $acl){
394 if ($user != "anyone" && $user != "%members%"){
395 $tmp.= "<tr><td><input name=\"user_$nr\" size=20 maxlength=60 ".
396 "value=\"$user\" $perm></td><td><select size=\"1\" name=\"perm_$nr\" $perm>";
397 foreach ($this->perms as $key => $value){
398 if ($acl == $key){
399 $tmp.= "<option value=$key selected>$value</option>";
400 } else {
401 $tmp.= "<option value=$key>$value</option>";
402 }
403 }
404 $tmp.= "</select> ";
405 if ($nr == $count - 1){
406 $tmp.= "<input type=submit value=\""._("Add")."\" ".
407 "name=\"add_$nr\" $perm>";
408 }
409 if ($count > 3){
410 $tmp.= "<input type=submit value=\""._("Remove")."\" ".
411 "name=\"del_$nr\" $perm></td></tr>";
412 }
413 }
414 $this->indexed_user[$nr]= $user;
415 $this->indexed_acl[$nr++]= $acl;
416 }
417 $smarty->assign("plusattributes", $tmp);
419 /* Show main page */
420 $mailserver= array();
421 foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
422 $mailserver[]= $key;
423 }
424 $smarty->assign("mailServers", $mailserver);
425 foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
426 "gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
427 $smarty->assign("$val", $this->$val);
428 $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
429 }
430 if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
431 $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
432 $smarty->assign("quotadefined", "true");
433 } else {
434 $smarty->assign("quotadefined", "false");
435 }
437 $display.= $smarty->fetch (get_template_path('mail.tpl', TRUE));
438 return ($display);
439 }
442 /* remove object from parent */
443 function remove_from_parent()
444 {
445 /* include global link_info */
446 $ldap= $this->config->get_ldap_link();
448 /* Remove and write to LDAP */
449 plugin::remove_from_parent();
451 /* Zero arrays */
452 $this->attrs['gosaMailAlternateAddress']= array();
453 $this->attrs['gosaMailForwardingAddress']= array();
454 $this->attrs['gosaSharedFolderTarget']= array();
456 /* Keep uid */
457 unset ($this->attrs['uid']);
458 $ldap->cd($this->dn);
459 $ldap->modify($this->attrs);
460 show_ldap_error($ldap->get_error());
462 /* Connect to IMAP server for account deletion */
463 if ($this->is_account){
464 $method= new $this->method($this->config);
465 if ($method->connect($this->attrs["gosaMailServer"][0])){
466 /* Remove account from IMAP server */
467 $method->deleteMailbox($this->uid);
468 $method->disconnect();
469 }
470 }
472 /* Optionally execute a command after we're done */
473 $this->handle_post_events("remove");
474 }
477 /* Save data to object */
478 function save_object()
479 {
480 /* Assemble mail delivery mode
481 The mode field in ldap consists of values between braces, this must
482 be called when 'mail' is set, because checkboxes may not be set when
483 we're in some other dialog.
485 Example for gosaMailDeliveryMode [LR ]
486 L: Local delivery
487 R: Reject when exceeding mailsize limit
488 S: Use spam filter
489 V: Use vacation message
490 C: Use custom sieve script
491 I: Only insider delivery */
492 if (isset($_POST['mailedit'])){
494 /* Save ldap attributes */
495 plugin::save_object();
497 $tmp= "";
498 if (!isset($_POST["drop_own_mails"])){
499 $tmp.= "L";
500 }
501 if (isset($_POST["use_mailsize_limit"])){
502 $tmp.= "R";
503 }
504 if (isset($_POST["use_spam_filter"])){
505 $tmp.= "S";
506 }
507 if (isset($_POST["use_vacation"])){
508 $tmp.= "V";
509 }
510 if (isset($_POST["own_script"])){
511 $tmp.= "C";
512 }
513 if (isset($_POST["only_local"])){
514 $tmp.= "I";
515 }
516 $tmp= "[$tmp]";
518 if (chkacl ($this->acl, "gosaMailDeliveryMode") == ""){
519 $this->gosaMailDeliveryMode= $tmp;
520 }
522 /* Collect data and re-assign it to the imapacl array */
523 if (chkacl($this->acl, "permissions") == ""){
524 $this->imapacl= array();
525 $this->imapacl['%members%']= $_POST['member_permissions'];
526 $this->imapacl['anyone']= $_POST['default_permissions'];
527 foreach ($this->indexed_user as $nr => $user){
528 if (!isset($_POST["user_$nr"])){
529 continue;
530 }
531 if ($_POST["user_$nr"] != $user ||
532 $_POST["perm_$nr"] != $this->indexed_acl[$nr]){
533 $this->is_modified= TRUE;
534 }
535 $this->imapacl[$_POST["user_$nr"]]= $_POST["perm_$nr"];
536 }
537 }
538 }
540 }
543 /* Save data to LDAP, depending on is_account we save or delete */
544 function save()
545 {
546 $ldap= $this->config->get_ldap_link();
548 /* Call parents save to prepare $this->attrs */
549 plugin::save();
551 /* Save arrays */
552 $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
553 $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
555 /* Save shared folder target */
556 $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid;
558 /* Save acl's */
559 $this->attrs['acl']= array();
560 foreach ($this->imapacl as $user => $acl){
561 if ($user == ""){
562 continue;
563 }
564 $this->attrs['acl'][]= "$user $acl";
565 }
567 /* Save data to LDAP */
568 $ldap->cd($this->dn);
569 $ldap->modify($this->attrs);
570 show_ldap_error($ldap->get_error());
572 /* Only do IMAP actions if we are not a template */
573 if (!$this->is_template){
574 $method= new $this->method($this->config);
575 if ($method->connect($this->gosaMailServer)){
576 $method->updateMailbox($this->uid);
577 $method->setQuota($this->uid, $this->gosaMailQuota);
579 /* Exchange '%member%' pseudo entry */
580 $memberacl= $this->imapacl['%members%'];
581 unset ($this->imapacl['%members%']);
582 foreach ($this->members as $user){
583 if (!isset($this->imapacl[$user])){
584 $this->imapacl[$user]= $memberacl;
585 }
586 }
588 $method->setSharedFolderPermissions($this->uid, $this->imapacl);
589 $method->disconnect();
590 }
591 }
593 /* Optionally execute a command after we're done */
594 if ($this->initially_was_account == $this->is_account){
595 if ($this->is_modified){
596 $this->handle_post_events("mofify");
597 }
598 } else {
599 $this->handle_post_events("add");
600 }
601 }
603 /* Check formular input */
604 function check()
605 {
606 $ldap= $this->config->get_ldap_link();
608 $message= array();
610 /* must: mail */
611 if ($this->mail == ""){
612 $message[]= _("The required field 'Primary address' is not set.");
613 }
614 if (!is_email($this->mail)){
615 $message[]= _("Please enter a valid email addres in 'Primary address' field.");
616 }
617 $ldap->cd($this->config->current['BASE']);
618 $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
619 $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
620 if ($ldap->count() != 0){
621 $message[]= _("The primary address you've entered is already in use.");
622 }
624 /* Check quota */
625 if ($this->gosaMailQuota != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
626 if (!is_numeric($this->gosaMailQuota)) {
627 $message[]= _("Value in 'Quota size' is not valid.");
628 } else {
629 $this->gosaMailQuota= (int) $this->gosaMailQuota;
630 }
631 }
633 /* Check rejectsize for integer */
634 if ($this->gosaMailMaxSize != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
635 if (!is_numeric($this->gosaMailMaxSize)){
636 $message[]= _("Please specify a vaild mail size for mails to be rejected.");
637 } else {
638 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
639 }
640 }
642 /* Need gosaMailMaxSize if use_mailsize_limit is checked */
643 if (is_integer(strpos($this->gosaMailDeliveryMode, "reject")) && $this->gosaMailMaxSize == ""){
644 $message[]= _("You need to set the maximum mail size in order to reject anything.");
645 }
647 if(ord($this->imapacl['anyone'][0])==194){
648 $message[] = _("Please choose valid permission settings. Default permission can't be emtpy.");
649 }
651 if(empty($this->gosaMailServer)){
652 $message[] = _("Please select a valid mail server.");
653 }
655 return ($message);
656 }
658 /* Adapt from template, using 'dn' */
659 function adapt_from_template($dn)
660 {
661 plugin::adapt_from_template($dn);
663 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
664 $this->$val= array();
665 if (isset($this->attrs["$val"]["count"])){
666 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
667 $value= $this->attrs["$val"][$i];
668 foreach (array("sn", "givenName", "uid") as $repl){
669 if (preg_match("/%$repl/i", $value)){
670 $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
671 }
672 }
673 array_push($this->$val, $value);
674 }
675 }
676 }
677 }
679 /* Add entry to forwarder list */
680 function addForwarder($address)
681 {
682 $this->gosaMailForwardingAddress[]= $address;
683 $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
685 sort ($this->gosaMailForwardingAddress);
686 reset ($this->gosaMailForwardingAddress);
687 $this->is_modified= TRUE;
688 }
690 /* Remove list of addresses from forwarder list */
691 function delForwarder($addresses)
692 {
693 $this->gosaMailForwardingAddress= array_remove_entries ($addresses,
694 $this->gosaMailForwardingAddress);
695 $this->is_modified= TRUE;
696 }
700 function addAlternate($address)
701 {
702 $ldap= $this->config->get_ldap_link();
704 $address= strtolower($address);
706 /* Is this address already assigned in LDAP? */
707 $ldap->cd ($this->config->current['BASE']);
708 $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)".
709 "(gosaMailAlternateAddress=$address)))");
711 if ($ldap->count() > 0){
712 $attrs= $ldap->fetch ();
713 return ($attrs["uid"][0]);
714 }
716 /* Add to list of alternates */
717 if (!in_array($address, $this->gosaMailAlternateAddress)){
718 $this->gosaMailAlternateAddress[]= $address;
719 }
721 sort ($this->gosaMailAlternateAddress);
722 reset ($this->gosaMailAlternateAddress);
723 $this->is_modified= TRUE;
725 return ("");
726 }
729 function delAlternate($addresses)
730 {
731 $this->gosaMailAlternateAddress= array_remove_entries ($addresses,
732 $this->gosaMailAlternateAddress);
733 $this->is_modified= TRUE;
734 }
737 function make_name($attrs)
738 {
739 $name= "";
740 if (isset($attrs['sn'][0])){
741 $name= $attrs['sn'][0];
742 }
743 if (isset($attrs['givenName'][0])){
744 if ($name != ""){
745 $name.= ", ".$attrs['givenName'][0];
746 } else {
747 $name.= $attrs['givenName'][0];
748 }
749 }
750 if ($name != ""){
751 $name.= " ";
752 }
754 return ($name);
755 }
757 }
759 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
760 ?>