X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fpersonal%2Fconnectivity%2Fclass_oxchangeAccount.inc;h=36db420f9e3004dedc631ea62fb78fed4638b019;hb=26dbc488fc745965586ec6ce8854c29fa69a38d3;hp=1fddc4935acb993eaf51c7c4f1988d5cd9bbfbb8;hpb=17bf7a27a85235db6b4c54fa72eb7c10ef9578d6;p=gosa.git
diff --git a/plugins/personal/connectivity/class_oxchangeAccount.inc b/plugins/personal/connectivity/class_oxchangeAccount.inc
index 1fddc4935..36db420f9 100644
--- a/plugins/personal/connectivity/class_oxchangeAccount.inc
+++ b/plugins/personal/connectivity/class_oxchangeAccount.inc
@@ -597,10 +597,31 @@ class oxchangeAccount extends plugin
function execute()
{
+ /* Call parent execute */
+ //plugin::execute();
- /* Show tab dialog headers */
- $display= "";
+ $display="";
+ /* Show tab dialog headers * /
+ $display="";
+ if ($this->parent != NULL){
+ if ($this->is_account){
+ $display="";
+ } else {
+ $obj= $this->parent->by_object['posixAccount'];
+ $obj2= $this->parent->by_object['mailAccount'];
+ if (! $obj->is_account){
+ $display= "
".print_r($this->attrs, true)."";*/ + /*First at all, we must check if this is new or is updated */ - foreach ($this->attrs['objectClass'] as $object){ - if($object=="OXUserObject") $needupdate=FALSE; + /*Also check is we have a template, if is a template, is a new user */ + if (isset($this->attrs['objectClass'])){ + foreach ($this->attrs['objectClass'] as $object){ + if($object=="OXUserObject") $needupdate=FALSE; + if($object=="gosaUserTemplate") $istemplate=TRUE; + } } + $uidarray=array(); + preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray); + $uid=$uidarray[2]; + if (trim($uid) == "") { + print_red(_("The Open-Xchange accountname is empty and thus invalid! Check to make sure that ". + "you are not using any strange characters in the loginname.")); + return; + } + + if ($istemplate) $needupdate=TRUE; + if($needupdate){ /* Trying to open a Postgresql Database Server */ if (function_exists("pg_connect")){ if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){ - $pgcon = pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); + $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]); if (! $pgcon){ - print_red(_("Couldn't Connect To Postgresql Database")); + print_red(_("Couldn't connect to postgresql database!")); return; } }else{ - print_red(_("Needed Parameters to openexchange connectivity plugin failed!")); + print_red(_("Needed parameters for openexchange connectivity plugin are missing!")); return; } }else{ - print_red(_("PHP4 module for Postgresql Database Failed!")); + print_red(_("PHP4 module for postgresql database is missing!")); return; } } - $uid=$this->attrs[$this->dnmode][0]; - plugin::save(); /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + $this->cleanup(); + $ldap->modify ($this->attrs); + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ $this->postcreate(); if($needupdate){ + $ldap->create_missing_trees("ou=addr,".$this->dn); + show_ldap_error($ldap->get_error(), sprintf(_("Creating of user/oxchange account with dn '%s' failed."),$this->dn)); /* Finally save data to postgresql server */ pg_set_client_encoding ("UNICODE"); $nv = "SELECT nextval ('serial_id')";