"Eins ist toll", "zwei" => "Zwei ist noch besser"); /* Kolab attributes */ var $kolabInvitationPolicy= array(); var $kolabFreeBusyFuture= 60; var $unrestrictedMailSize= 0; var $calFBURL= ""; var $kolabDelegate= array(); /* attribute list for save action */ var $attributes= array( "kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL"); var $objectclasses= array("kolab"); /* Helper */ var $imapping= array(); function kolabAccount ($config, $dn= NULL) { plugin::plugin ($config, $dn); /* Pull arrays */ foreach(array("kolabDelegate", "kolabInvitationPolicy") as $attr){ if (isset($this->attrs["$attr"]["count"])){ for ($i= 0; $i<$this->attrs["$attr"]["count"]; $i++){ array_push($this->$attr, $this->attrs["$attr"][$i]); } } } /* If this one is empty, preset with ACT_MANUAL for anonymous users */ if (count ($this->kolabInvitationPolicy) == 0){ $this->kolabInvitationPolicy= array("ACT_MANUAL"); } } function execute() { /* Call parent execute */ // plugin::execute(); /* Show tab dialog headers */ $display= ""; /* Show main page */ $smarty= get_smarty(); /* Load attributes */ foreach($this->attributes as $val){ $smarty->assign("$val", $this->$val); $smarty->assign($val."ACL", chkacl($this->acl, "$val")); } /* Check for invitation action */ $nr= 0; while (isset($_POST["policy$nr"])){ if (isset($_POST["add$nr"])){ $this->kolabInvitationPolicy[]= ": ACT_MANUAL"; } if (isset($_POST["remove$nr"])){ $new= array(); foreach ($this->kolabInvitationPolicy as $entry){ if (!preg_match("/^".$this->imapping[$nr].":/", $entry)){ $new[]= $entry; } } $this->kolabInvitationPolicy= $new; } $nr++; } /* Unify addresses */ $new= array(); foreach($this->kolabInvitationPolicy as $value){ if (preg_match('/^:/', $value)){ continue; } $address= preg_replace('/^([^:]+:).*$/', '\1', $value); $new[$address]= $value; } $this->kolabInvitationPolicy= array(); foreach($new as $value){ $this->kolabInvitationPolicy[]= $value; } /* Add delegation */ if (isset($_POST['add_delegation'])){ if ($_POST['delegate_address'] != ""){ /* Valid email address specified? */ $address= $_POST['delegate_address']; $valid= FALSE; if (!is_email($address)){ if (!is_email($address, TRUE)){ print_red (_("You're trying to add an invalid email address to the list of delegations.")); } } else { $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->config->current['BASE']); $ldap->search('(mail='.$address.')',array("mail")); if ($ldap->count() == 0){ print_red (_("The mail address you're trying to add is no primary mail address of an existing user.")); } else { $valid= TRUE; } } if ($valid){ /* Add it */ if (chkacl ($this->acl, "kolabDelegate") == ""){ $this->addDelegate ($address); $this->is_modified= TRUE; } } } } /* Delete forward email addresses */ if (isset($_POST['delete_delegation'])){ if (count($_POST['delegate_list']) && chkacl ($this->acl, "kolabDelegate") == ""){ $this->delDelegate ($_POST['delegate_list']); } } /* Assemble policies */ $policies= array( 'ACT_ALWAYS_ACCEPT' => _("Always accept"), 'ACT_ALWAYS_REJECT' => _("Always reject"), 'ACT_REJECT_IF_CONFLICTS' => _("Reject if conflicts"), 'ACT_MANUAL_IF_CONFLICTS' => _("Manual if conflicts"), 'ACT_MANUAL' => _("Manual")); $smarty->assign('policies', $policies); /* Adjust checkbox */ if ($this->unrestrictedMailSize){ $smarty->assign('unrestrictedMailSizeState', "checked"); } else { $smarty->assign('unrestrictedMailSizeState', ""); } /* Transfer account states for this union */ if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){ $smarty->assign('is_account', 'true'); } else { $smarty->assign('is_account', ''); } /* Transfer delegation list */ if (!count($this->kolabDelegate)){ /* Smarty will produce and tidy don't like that, so tell smarty to create no option (array();)*/ $smarty->assign("kolabDelegate", array()); } else { $smarty->assign("kolabDelegate", $this->kolabDelegate); } $smarty->assign("kolabDelegateACL", chkacl($this->acl, $this->kolabDelegate)); /* Create InvitationPolicy table */ $invitation= ""; $this->imapping= array(); $nr= 0; $acl= chkacl($this->acl, "kolabInvitationPolicy"); foreach ($this->kolabInvitationPolicy as $entry){ $invitation.= "