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();
166 /* Load templating engine */
167 $smarty= get_smarty();
168 if ($_SESSION['js']==FALSE){
169 $smarty->assign("javascript", "false");
170 } else {
171 $smarty->assign("javascript", "true");
172 }
174 /* Do we need to flip is_account state? */
175 if (isset($_POST['modify_state'])){
176 $this->is_account= !$this->is_account;
177 }
179 /* Do we represent a valid account? */
180 if (!$this->is_account && $this->parent == NULL){
181 $display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
182 _("This 'dn' has no valid mail extensions.")."</b>";
183 return ($display);
184 }
186 /* Show tab dialog headers */
187 $display= "";
188 if ($this->parent != NULL){
189 if ($this->is_account){
190 $display= $this->show_header(_("Remove mail account"),
191 _("This account has mail features enabled. You can disable them by clicking below."));
192 } else {
193 $display= $this->show_header(_("Create mail account"),
194 _("This account has mail features disabled. You can enable them by clicking below."));
195 return ($display);
196 }
197 }
199 /* Add ACL? */
200 foreach ($this->indexed_user as $nr => $user){
201 if (isset($_POST["add_$nr"])){
202 $this->imapacl[""]= "l";
203 }
204 if (isset($_POST["del_$nr"])){
205 unset ($this->imapacl[$user]);
206 }
207 }
209 /* Trigger forward add dialog? */
210 if (isset($_POST['add_local_forwarder'])){
211 $this->forward_dialog= TRUE;
212 $this->dialog= TRUE;
213 }
215 /* Cancel forward add dialog? */
216 if (isset($_POST['add_locals_cancel'])){
217 $this->forward_dialog= FALSE;
218 $this->dialog= FALSE;
219 }
221 /* Finished adding of locals? */
222 if (isset($_POST['add_locals_finish'])){
223 if (count ($_POST['local_list']) &&
224 chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
226 /* Walk through list of forwarders, ignore own addresses */
227 foreach ($_POST['local_list'] as $val){
228 if (!in_array ($val, $this->gosaMailAlternateAddress) &&
229 $val != $this->mail){
231 $this->addForwarder($val);
232 }
233 }
234 }
235 $this->forward_dialog= FALSE;
236 $this->dialog= FALSE;
237 }
239 /* Add forward email addresses */
240 if (isset($_POST['add_forwarder'])){
241 if ($_POST['forward_address'] != ""){
243 /* Valid email address specified? */
244 $address= $_POST['forward_address'];
245 if (!is_email($address)){
247 print_red (_("You're trying to add an invalid email address ".
248 "to the list of forwarders."));
250 } elseif ($address == $this->mail
251 || in_array($address, $this->gosaMailAlternateAddress)) {
253 print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
255 } else {
257 /* Add it */
258 if (chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
259 $this->addForwarder ($address);
260 }
262 }
263 }
264 }
266 /* Delete forward email addresses */
267 if (isset($_POST['delete_forwarder'])){
268 if (count($_POST['forwarder_list'])
269 && chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
271 $this->delForwarder ($_POST['forwarder_list']);
272 }
273 }
275 /* Add alternate email addresses */
276 if (isset($_POST['add_alternate'])){
277 if ($_POST['alternate_address'] != "" &&
278 chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
280 if (!is_email($_POST['alternate_address'])){
281 print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
283 } elseif (($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
284 $ui= get_userinfo();
285 if ($user != $ui->username){
286 print_red (_("The address you're trying to add is already used by user")." '$user'.");
287 }
288 }
289 }
290 }
292 /* Delete alternate email addresses */
293 if (isset($_POST['delete_alternate']) && isset ($_POST['alternates_list'])){
294 if (count($_POST['alternates_list']) &&
295 chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
297 $this->delAlternate ($_POST['alternates_list']);
298 }
299 }
301 /* Show forward add dialog */
302 if ($this->forward_dialog){
303 $ldap= $this->config->get_ldap_link();
305 /* Save data */
306 $gmailfilter= get_global("gmailfilter");
307 foreach( array("depselect", "muser", "regex") as $type){
308 if (isset($_POST[$type])){
309 $gmailfilter[$type]= $_POST[$type];
310 }
311 }
312 if (isset($_GET['search'])){
313 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
314 if ($s == "**"){
315 $s= "*";
316 }
317 $gmailfilter['regex']= $s;
318 }
319 register_global("gmailfilter", $gmailfilter);
321 /* Get actual list */
322 $mailusers= array ();
323 if ($gmailfilter['regex'] != '*' && $gmailfilter['regex'] != ""){
324 $regex= $gmailfilter['regex'];
325 $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
326 } else {
327 $filter= "";
328 }
329 if ($gmailfilter['muser'] != ""){
330 $user= $gmailfilter['muser'];
331 $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
332 }
334 /* Add already present people to the filter */
335 $exclude= "";
336 foreach ($this->gosaMailForwardingAddress as $mail){
337 $exclude.= "(mail=$mail)";
338 }
339 if ($exclude != ""){
340 $filter.= "(!(|$exclude))";
341 }
343 $acl= array($this->config->current['BASE'] => ":all");
344 $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $gmailfilter['depselect'], array("sn", "mail", "givenName"), TRUE);
345 $ldap->cd($gmailfilter['depselect']);
346 $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
347 error_reporting (0);
348 while ($attrs= $ldap->fetch()){
349 if(preg_match('/%/', $attrs['mail'][0])){
350 continue;
351 }
352 $name= $this->make_name($attrs);
353 $mailusers[$attrs['mail'][0]]= $name."<".
354 $attrs['mail'][0].">";
355 }
356 error_reporting (E_ALL);
357 natcasesort ($mailusers);
358 reset ($mailusers);
360 /* Show dialog */
361 $smarty->assign("search_image", get_template_path('images/search.png'));
362 $smarty->assign("usearch_image", get_template_path('images/search_user.png'));
363 $smarty->assign("tree_image", get_template_path('images/tree.png'));
364 $smarty->assign("infoimage", get_template_path('images/info.png'));
365 $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
366 $smarty->assign("mailusers", $mailusers);
367 $smarty->assign("deplist", $this->config->idepartments);
368 $smarty->assign("apply", apply_filter());
369 $smarty->assign("alphabet", generate_alphabet());
370 $smarty->assign("hint", print_sizelimit_warning());
371 foreach( array("depselect", "muser", "regex") as $type){
372 $smarty->assign("$type", $gmailfilter[$type]);
373 }
374 $smarty->assign("hint", print_sizelimit_warning());
375 $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE));
376 return ($display);
377 }
379 /* Assemble normal permissions */
380 $smarty->assign("permissionsACL", chkacl($this->acl, "permissions"));
381 if (isset($this->imapacl['anyone'])){
382 $smarty->assign("default_permissions", $this->imapacl['anyone']);
383 }
384 if (isset($this->imapacl['%members%'])){
385 $smarty->assign("member_permissions", $this->imapacl['%members%']);
386 }
388 /* Assemble extra attributes */
389 $perm= chkacl($this->acl, "permissions");
390 $tmp= "";
391 $nr= 0;
392 $count= count($this->imapacl);
393 $this->indexed_user= array();
394 $this->indexed_acl= array();
395 foreach($this->imapacl as $user => $acl){
396 if ($user != "anyone" && $user != "%members%"){
397 $tmp.= "<tr><td><input name=\"user_$nr\" size=20 maxlength=60 ".
398 "value=\"$user\" $perm></td><td><select size=\"1\" name=\"perm_$nr\" $perm>";
399 foreach ($this->perms as $key => $value){
400 if ($acl == $key){
401 $tmp.= "<option value=$key selected>$value</option>";
402 } else {
403 $tmp.= "<option value=$key>$value</option>";
404 }
405 }
406 $tmp.= "</select> ";
407 if ($nr == $count - 1){
408 $tmp.= "<input type=submit value=\""._("Add")."\" ".
409 "name=\"add_$nr\" $perm>";
410 }
411 if ($count > 3){
412 $tmp.= "<input type=submit value=\""._("Remove")."\" ".
413 "name=\"del_$nr\" $perm></td></tr>";
414 }
415 }
416 $this->indexed_user[$nr]= $user;
417 $this->indexed_acl[$nr++]= $acl;
418 }
419 $smarty->assign("plusattributes", $tmp);
421 /* Show main page */
422 $mailserver= array();
423 foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
424 $mailserver[]= $key;
425 }
426 $smarty->assign("mailServers", $mailserver);
427 foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
428 "gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
429 $smarty->assign("$val", $this->$val);
430 $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
431 }
432 if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
433 $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
434 $smarty->assign("quotadefined", "true");
435 } else {
436 $smarty->assign("quotadefined", "false");
437 }
439 $display.= $smarty->fetch (get_template_path('mail.tpl', TRUE));
440 return ($display);
441 }
444 /* remove object from parent */
445 function remove_from_parent()
446 {
447 /* include global link_info */
448 $ldap= $this->config->get_ldap_link();
450 /* Remove and write to LDAP */
451 plugin::remove_from_parent();
453 /* Zero arrays */
454 $this->attrs['gosaMailAlternateAddress']= array();
455 $this->attrs['gosaMailForwardingAddress']= array();
456 $this->attrs['gosaSharedFolderTarget']= array();
458 /* Keep uid */
459 unset ($this->attrs['uid']);
460 $ldap->cd($this->dn);
461 $ldap->modify($this->attrs);
462 show_ldap_error($ldap->get_error());
464 /* Connect to IMAP server for account deletion */
465 if ($this->is_account){
466 $method= new $this->method($this->config);
467 if ($method->connect($this->attrs["gosaMailServer"][0])){
468 /* Remove account from IMAP server */
469 $method->deleteMailbox($this->uid);
470 $method->disconnect();
471 }
472 }
474 /* Optionally execute a command after we're done */
475 $this->handle_post_events("remove");
476 }
479 /* Save data to object */
480 function save_object()
481 {
482 /* Assemble mail delivery mode
483 The mode field in ldap consists of values between braces, this must
484 be called when 'mail' is set, because checkboxes may not be set when
485 we're in some other dialog.
487 Example for gosaMailDeliveryMode [LR ]
488 L: Local delivery
489 R: Reject when exceeding mailsize limit
490 S: Use spam filter
491 V: Use vacation message
492 C: Use custom sieve script
493 I: Only insider delivery */
494 if (isset($_POST['mailedit'])){
496 /* Save ldap attributes */
497 plugin::save_object();
499 $tmp= "";
500 if (!isset($_POST["drop_own_mails"])){
501 $tmp.= "L";
502 }
503 if (isset($_POST["use_mailsize_limit"])){
504 $tmp.= "R";
505 }
506 if (isset($_POST["use_spam_filter"])){
507 $tmp.= "S";
508 }
509 if (isset($_POST["use_vacation"])){
510 $tmp.= "V";
511 }
512 if (isset($_POST["own_script"])){
513 $tmp.= "C";
514 }
515 if (isset($_POST["only_local"])){
516 $tmp.= "I";
517 }
518 $tmp= "[$tmp]";
520 if (chkacl ($this->acl, "gosaMailDeliveryMode") == ""){
521 $this->gosaMailDeliveryMode= $tmp;
522 }
524 /* Collect data and re-assign it to the imapacl array */
525 if (chkacl($this->acl, "permissions") == ""){
526 $this->imapacl= array();
527 $this->imapacl['%members%']= $_POST['member_permissions'];
528 $this->imapacl['anyone']= $_POST['default_permissions'];
529 foreach ($this->indexed_user as $nr => $user){
530 if (!isset($_POST["user_$nr"])){
531 continue;
532 }
533 if ($_POST["user_$nr"] != $user ||
534 $_POST["perm_$nr"] != $this->indexed_acl[$nr]){
535 $this->is_modified= TRUE;
536 }
537 $this->imapacl[$_POST["user_$nr"]]= $_POST["perm_$nr"];
538 }
539 }
540 }
542 }
545 /* Save data to LDAP, depending on is_account we save or delete */
546 function save()
547 {
548 $ldap= $this->config->get_ldap_link();
550 /* Call parents save to prepare $this->attrs */
551 plugin::save();
553 /* Save arrays */
554 $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
555 $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
557 /* Save shared folder target */
558 $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid;
560 /* Save acl's */
561 $this->attrs['acl']= array();
562 foreach ($this->imapacl as $user => $acl){
563 if ($user == ""){
564 continue;
565 }
566 $this->attrs['acl'][]= "$user $acl";
567 }
569 /* Save data to LDAP */
570 $ldap->cd($this->dn);
571 $ldap->modify($this->attrs);
572 show_ldap_error($ldap->get_error());
574 /* Only do IMAP actions if we are not a template */
575 if (!$this->is_template){
576 $method= new $this->method($this->config);
577 if ($method->connect($this->gosaMailServer)){
578 $method->updateMailbox($this->uid);
579 $method->setQuota($this->uid, $this->gosaMailQuota);
581 /* Exchange '%member%' pseudo entry */
582 $memberacl= $this->imapacl['%members%'];
583 unset ($this->imapacl['%members%']);
584 foreach ($this->members as $user){
585 if (!isset($this->imapacl[$user])){
586 $this->imapacl[$user]= $memberacl;
587 }
588 }
590 $method->setSharedFolderPermissions($this->uid, $this->imapacl);
591 $method->disconnect();
592 }
593 }
595 /* Optionally execute a command after we're done */
596 if ($this->initially_was_account == $this->is_account){
597 if ($this->is_modified){
598 $this->handle_post_events("mofify");
599 }
600 } else {
601 $this->handle_post_events("add");
602 }
603 }
605 /* Check formular input */
606 function check()
607 {
608 $ldap= $this->config->get_ldap_link();
610 $message= array();
612 /* must: mail */
613 if ($this->mail == ""){
614 $message[]= _("The required field 'Primary address' is not set.");
615 }
616 if (!is_email($this->mail)){
617 $message[]= _("Please enter a valid email addres in 'Primary address' field.");
618 }
619 $ldap->cd($this->config->current['BASE']);
620 $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
621 $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
622 if ($ldap->count() != 0){
623 $message[]= _("The primary address you've entered is already in use.");
624 }
626 /* Check quota */
627 if ($this->gosaMailQuota != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
628 if (!is_numeric($this->gosaMailQuota)) {
629 $message[]= _("Value in 'Quota size' is not valid.");
630 } else {
631 $this->gosaMailQuota= (int) $this->gosaMailQuota;
632 }
633 }
635 /* Check rejectsize for integer */
636 if ($this->gosaMailMaxSize != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
637 if (!is_numeric($this->gosaMailMaxSize)){
638 $message[]= _("Please specify a vaild mail size for mails to be rejected.");
639 } else {
640 $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
641 }
642 }
644 /* Need gosaMailMaxSize if use_mailsize_limit is checked */
645 if (is_integer(strpos($this->gosaMailDeliveryMode, "reject")) && $this->gosaMailMaxSize == ""){
646 $message[]= _("You need to set the maximum mail size in order to reject anything.");
647 }
649 if(ord($this->imapacl['anyone'][0])==194){
650 $message[] = _("Please choose valid permission settings. Default permission can't be emtpy.");
651 }
653 if(empty($this->gosaMailServer)){
654 $message[] = _("Please select a valid mail server.");
655 }
657 return ($message);
658 }
660 /* Adapt from template, using 'dn' */
661 function adapt_from_template($dn)
662 {
663 plugin::adapt_from_template($dn);
665 foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
666 $this->$val= array();
667 if (isset($this->attrs["$val"]["count"])){
668 for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
669 $value= $this->attrs["$val"][$i];
670 foreach (array("sn", "givenName", "uid") as $repl){
671 if (preg_match("/%$repl/i", $value)){
672 $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
673 }
674 }
675 array_push($this->$val, $value);
676 }
677 }
678 }
679 }
681 /* Add entry to forwarder list */
682 function addForwarder($address)
683 {
684 $this->gosaMailForwardingAddress[]= $address;
685 $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
687 sort ($this->gosaMailForwardingAddress);
688 reset ($this->gosaMailForwardingAddress);
689 $this->is_modified= TRUE;
690 }
692 /* Remove list of addresses from forwarder list */
693 function delForwarder($addresses)
694 {
695 $this->gosaMailForwardingAddress= array_remove_entries ($addresses,
696 $this->gosaMailForwardingAddress);
697 $this->is_modified= TRUE;
698 }
702 function addAlternate($address)
703 {
704 $ldap= $this->config->get_ldap_link();
706 $address= strtolower($address);
708 /* Is this address already assigned in LDAP? */
709 $ldap->cd ($this->config->current['BASE']);
710 $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)".
711 "(gosaMailAlternateAddress=$address)))");
713 if ($ldap->count() > 0){
714 $attrs= $ldap->fetch ();
715 return ($attrs["uid"][0]);
716 }
718 /* Add to list of alternates */
719 if (!in_array($address, $this->gosaMailAlternateAddress)){
720 $this->gosaMailAlternateAddress[]= $address;
721 }
723 sort ($this->gosaMailAlternateAddress);
724 reset ($this->gosaMailAlternateAddress);
725 $this->is_modified= TRUE;
727 return ("");
728 }
731 function delAlternate($addresses)
732 {
733 $this->gosaMailAlternateAddress= array_remove_entries ($addresses,
734 $this->gosaMailAlternateAddress);
735 $this->is_modified= TRUE;
736 }
739 function make_name($attrs)
740 {
741 $name= "";
742 if (isset($attrs['sn'][0])){
743 $name= $attrs['sn'][0];
744 }
745 if (isset($attrs['givenName'][0])){
746 if ($name != ""){
747 $name.= ", ".$attrs['givenName'][0];
748 } else {
749 $name.= $attrs['givenName'][0];
750 }
751 }
752 if ($name != ""){
753 $name.= " ";
754 }
756 return ($name);
757 }
759 }
761 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
762 ?>