index 4145f5525dd6e45a2e3ff96cc222b105d795b362..086bbd58339b0cecab4826bc1297cfdc3077b1ee 100644 (file)
var $proftpd_ftp = "TRUE";
var $apache_http = "TRUE";
var $kolabHost = array();
- var $is_in_there = false;
- var $exactName = false;
-
var $orig_cn = "";
var $attributes = array("postfix_mydomain", "postfix_mydestination", "proftpd_ftp", "k",
"cyrus_quotawarn");
var $objectclasses = array("top", "kolab");
- function servkolab($config, $dn = NULL)
+ function servkolab($config, $dn = NULL, $parent= NULL)
{
/* Setting the hostname and tell this Plugin that we are the kolab extension*/
$this->hostname = preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
$this->dn = "k=kolab,".$config->current['BASE'];
/* Load variables, if given*/
- plugin::plugin($config, $this->dn);
+ plugin::plugin($config, $this->dn, $parent);
/* Copy needed attributes */
foreach($this->attributes as $val) {
$this->kolabHost= $this->attrs['kolabHost'];
unset($this->kolabHost['count']);
}
- $this->is_in_there = false;
$this->is_account = false;
$this->initially_was_account = false;
foreach($this->kolabHost as $host){
- if(preg_match("/".$this->hostname.".*/i",$host)){
+ if($this->hostname == $host){
$this->is_account = true;
- $this->is_in_there = true;
$this->initially_was_account = true;
}
}
-
- /* Mhh */
- if(in_array($this->hostname, $this->kolabHost)) {
- $this->exactName=true;
- } else {
- $this->exactName=false;
- }
-
- /* Parse mynetworks */
- if(isset($this->attrs['postfix-mynetworks'])){
- if(is_array($this->attrs['postfix-mynetworks'])){
- unset($this->attrs['postfix-mynetworks']['count']);
- $tmp="";
- foreach($this->attrs['postfix-mynetworks'] as $tm){
- $tmp.=$tm.";";
- }
- $this->postfix_mynetworks = $tmp;
- }
- }else{
- $this->postfix_mynetworks="";
- }
}
$tmp[] = $host;
}
}
+ $this->kolabHost = $tmp;
}
- $this->kolabHost = $tmp;
}
-
+
/* Add ourselves to the list of kolabHost's if needed */
- if (!in_array($this->cn,$this->kolabHost)){
+ if (!in_array_ics($this->cn,$this->kolabHost)){
$this->kolabHost[]= $this->cn;
}
- /* Create mynetworks array by splitting the string with ; */
- $tmp = split(";",$this->postfix_mynetworks);
- $this->postfix_mynetworks = array();
- foreach($tmp as $tm){
- trim($tm);
- if(!empty($tm)){
- $this->postfix_mynetworks[]=$tm;
- }
- }
- $this->attrs['postfix_mynetworks']=$this->postfix_mynetworks;
-
/* Call parents save to prepare $this->attrs */
plugin::save();
/* Add kolab hosts */
$this->attrs['kolabHost']= $this->kolabHost;
- if(($this->is_in_there)&&(!$this->exactName)){
- unset($this->attrs['kolabHost']);
- }
-
/* Perform LDAP action */
$ldap->cd($this->dn);
$this->cleanup();;
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account) {
if ($this->is_modified) {
- $this->handle_post_events("mofify");
+ $this->handle_post_events("modify");
}
} else {
$this->handle_post_events("add");