From d3c4309321ac5bd5398a07cdf4dc4138187edf88 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 2 Nov 2010 06:50:57 +0000 Subject: [PATCH] Code alignment git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20163 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/groupware/class_Groupware.inc | 519 +++++++++--------- .../personal/groupware/class_GroupwareDao.inc | 138 ++--- 2 files changed, 332 insertions(+), 325 deletions(-) diff --git a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc index 3d2206dc8..e12df2ad8 100644 --- a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc +++ b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc @@ -45,20 +45,20 @@ class Groupware extends plugin "mailBoxSendSizelimitEnabled", "mailBoxSendSizelimitValue", "mailBoxHardSizelimitEnabled", "mailBoxHardSizelimitValue", "mailBoxAutomaticRemovalEnabled", "mailBoxAutomaticRemovalValue", "localDeliveryOnly", "dropOwnMails", "mailFolder", "mailLimitReceiveValue", "mailLimitSendValue", - "mailLimitReceiveEnabled", "mailLimitSendEnabled"); + "mailLimitReceiveEnabled", "mailLimitSendEnabled"); var $enabledFeatures = array(); var $flagAttributes = array("vacationEnabled","mailBoxWarnLimitEnabled","mailBoxSendSizelimitEnabled", "mailBoxHardSizelimitEnabled","mailBoxAutomaticRemovalEnabled","localDeliveryOnly","dropOwnMails", - "mailLimitReceiveEnabled", "mailLimitSendEnabled"); + "mailLimitReceiveEnabled", "mailLimitSendEnabled"); var $mailAddressSelectDialog = NULL; var $filterManager = NULL; var $filterRules = array(); var $vacationTemplates = array(); - + //the dropdown var $mailLocations = array(); @@ -81,17 +81,18 @@ class Groupware extends plugin var $mailBoxAutomaticRemovalValue = 100; var $localDeliveryOnly = FALSE; var $dropOwnMails = FALSE; - var $mailLimitReceiveEnabled = FALSE; - var $mailLimitReceiveValue = 0; - var $mailLimitSendEnabled = FALSE; - var $mailLimitSendValue = 0; - - + var $mailLimitReceiveEnabled = FALSE; + var $mailLimitReceiveValue = 0; + var $mailLimitSendEnabled = FALSE; + var $mailLimitSendValue = 0; + + var $groupwareDao = null; // Used in the folder editor as the starting folder, usually user/username var $folderPrefix = ""; + /*! \brief */ function __construct ($config, $dn= NULL) @@ -132,20 +133,24 @@ class Groupware extends plugin return($res); } + /*! \brief Checks if feature is availavle on the server (a call to getCapabilities achieves this.) */ public function isFeatureEnabled($featureName) { return(isset($this->enabledFeatures[$featureName]) && $this->enabledFeatures[$featureName]); } - /*! \brief Checking if the feature has been changed since loading it from server (initial state) + + + /*! \brief Checking if the feature has been changed since loading it from server (initial state) */ public function hasFeaturebeenChanged($featureName) { - //TODO: must be implemented. + //TODO: must be implemented. return true; } + /*! \brief Try initialize the groupware account. * This method fetches all required information to manage the * account using the GOsa gui. @@ -180,7 +185,7 @@ class Groupware extends plugin 'acctSetQuota','acctGetQuota'), "mailBoxSendSizelimit" => array( 'acctSetQuota','acctGetQuota'), - //This is the same as qotaSize - should stay turned off + //This is the same as qotaSize - should stay turned off "mailBoxHardSizelimit" => array( "_off", 'acctSetQuota','acctGetQuota'), "mailBoxAutomaticRemoval" => array( @@ -189,26 +194,26 @@ class Groupware extends plugin 'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'), "dropOwnMails" => array( "_off", 'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'), - "mailFolder" => array( - 'folderList','folderDel','folderAdd'), - "mailLimit" => array( - 'acctGetMailLimit', 'acctSetMailLimit') - ); + "mailFolder" => array( + 'folderList','folderDel','folderAdd'), + "mailLimit" => array( + 'acctGetMailLimit', 'acctSetMailLimit') + ); // Check if all required methods can be called! - foreach($featureReq as $name => $requires){ - $active = TRUE; - foreach($requires as $methodName){ - $active &= $this->groupwareDao->gwFeatureAvailable($methodName); - } - $this->enabledFeatures[$name] = $active; - } + foreach($featureReq as $name => $requires){ + $active = TRUE; + foreach($requires as $methodName){ + $active &= $this->groupwareDao->gwFeatureAvailable($methodName); + } + $this->enabledFeatures[$name] = $active; + } // If this is a new user, then do not try to check account status // the account cannot exists. - if ($this->isFeatureEnabled("mailLocations")){ - $this->mailLocations = $this->groupwareDao->get('mailLocations', array()); - } + if ($this->isFeatureEnabled("mailLocations")){ + $this->mailLocations = $this->groupwareDao->get('mailLocations', array()); + } if($this->dn == "new"){ $this->initially_was_account = $this->is_account = FALSE; $this->accountInitialized = TRUE; @@ -235,6 +240,7 @@ class Groupware extends plugin $this->vacationStop= date('d.m.Y', $this->vacationStop); } + /*! \brief Generates the HTML user interface for the groupware plugin * and take of several ui actions like adding or removing * forward addresses, filters and the account itself. @@ -294,7 +300,7 @@ class Groupware extends plugin $this->dialog = TRUE; return($this->filterManager->execute()); } - + /**************** Folder editor ****************/ @@ -364,10 +370,10 @@ class Groupware extends plugin // Display dialog to select a local fowarder if (isset($_POST['addLocalForwardingAddress'])){ $this->mailAddressSelectDialog= new mailAddressSelect($this->config, get_userinfo()); - + $this->dialog= TRUE; } - + // Close dialogs, action was canceled if (isset($_POST['mailAddressSelect_cancel'])){ $this->mailAddressSelectDialog= FALSE; @@ -480,8 +486,8 @@ class Groupware extends plugin $smarty = get_smarty(); foreach($this->attributes as $attr){ - print - $smarty->assign($attr, $this->$attr); + print + $smarty->assign($attr, $this->$attr); } $plInfo = $this->plInfo(); @@ -491,13 +497,13 @@ class Groupware extends plugin foreach($this->enabledFeatures as $feature => $state){ $smarty->assign($feature."_isActive", $state); } - + $smarty->assign("currentSelectedFolder", $this->currentSelectedFolder); $folderEntries = array(); if(isset($this->mailFolder[$this->currentSelectedFolder])) { $folderEntries = $this->mailFolder[$this->currentSelectedFolder]; } - $smarty->assign("folderEntries", $folderEntries); + $smarty->assign("folderEntries", $folderEntries); $smarty->assign("mailLocations", $this->mailLocations); if (count($this->vacationTemplates)){ @@ -556,10 +562,10 @@ class Groupware extends plugin } } } - - if($this->acl_is_writeable('vacationMessage')){ - $this->vacationEnabled = isset($_POST['vacationEnabled']); - } + + if($this->acl_is_writeable('vacationMessage')){ + $this->vacationEnabled = isset($_POST['vacationEnabled']); + } // Get posted flag changes $flagAttrs = array("localDeliveryOnly","dropOwnMails"); foreach($flagAttrs as $attr){ @@ -568,6 +574,7 @@ class Groupware extends plugin } } + /*! \brief Parse vacation templates and build up an array * containing 'filename' => 'description'. * Used to fill vacation dropdown box. @@ -609,19 +616,19 @@ class Groupware extends plugin { if(empty($address)) return; if($this->acl_is_writeable("forwardingAddresses")){ - //Check if the address is a valid address on the Groupwareserver - - $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $address); - if(empty($isMailAvailabel)){ - msg_dialog::display(_("Permission error"), _("This email address is not available as forwarding recipient in your groupware."), ERROR_DIALOG); - } - else{ - $this->forwardingAddresses[]= $address; - $this->forwardingAddresses= array_unique ($this->forwardingAddresses); - sort ($this->forwardingAddresses); - reset ($this->forwardingAddresses); - $this->is_modified= TRUE; - } + //Check if the address is a valid address on the Groupwareserver + + $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $address); + if(empty($isMailAvailabel)){ + msg_dialog::display(_("Permission error"), _("This email address is not available as forwarding recipient in your groupware."), ERROR_DIALOG); + } + else{ + $this->forwardingAddresses[]= $address; + $this->forwardingAddresses= array_unique ($this->forwardingAddresses); + sort ($this->forwardingAddresses); + reset ($this->forwardingAddresses); + $this->is_modified= TRUE; + } }else{ msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG); } @@ -632,7 +639,7 @@ class Groupware extends plugin */ function delForwarder($addresses) { - + if($this->acl_is_writeable("forwardingAddresses")){ $this->forwardingAddresses= array_remove_entries ($addresses, $this->forwardingAddresses); $this->is_modified= TRUE; @@ -766,7 +773,7 @@ class Groupware extends plugin */ function save() { - // Get rpc handle to create or update the account + // Get rpc handle to create or update the account if(!$this->initially_was_account){ $this->rpcExec('gwAcctAdd', $this->uid, $this->mailAddress); if($this->rpcError){ @@ -774,96 +781,96 @@ class Groupware extends plugin return; } } - if($this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){ - $this->saveFoldersAndAcls($this->uid, $this->mailFolder); - } + if($this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){ + $this->saveFoldersAndAcls($this->uid, $this->mailFolder); + } // Save the primary Email Address. - if($this->isFeatureEnabled("primaryMail")&& $this->hasFeaturebeenChanged("primaryMail")){ - if(!empty($this->mailAddress )){ - $this->groupwareDao->save("primaryMail", $this->uid, $this->mailAddress); - } - } + if($this->isFeatureEnabled("primaryMail")&& $this->hasFeaturebeenChanged("primaryMail")){ + if(!empty($this->mailAddress )){ + $this->groupwareDao->save("primaryMail", $this->uid, $this->mailAddress); + } + } // Save alternateAddresses - if($this->isFeatureEnabled("alternateAddresses")&& $this->hasFeaturebeenChanged("alternateAddresses")){ - if(!empty($this->alternateAddresses) - && isset($this->alternateAddresses) - && is_array($this->alternateAddresses)){ - $this->groupwareDao->save("alternateAddresses", $this->uid, array($this->alternateAddresses)); - - } - } - // Save forwardingAddresses - if($this->isFeatureEnabled("forwardingAddresses") && $this->hasFeaturebeenChanged("forwardingAddresses")){ - if(empty($this->forwardingAddresses)){ - $this->groupwareDao->save("forwardingAddresses", $this->uid, array(array())); - } - if(is_array($this->forwardingAddresses) && isset($this->forwardingAddresses[0])){ - - // Only the first Address will be set as forward Address. - $fw = array(); - $fw[$this->forwardingAddresses[0]] = true; - $this->groupwareDao->save("forwardingAddresses", $this->uid, array($fw)); - } - } - //Save quota - it consists of four values... - if( ($this->isFeatureEnabled("mailBoxWarnLimit") || - $this->isFeatureEnabled("mailBoxSendSizelimit") || - $this->isFeatureEnabled("quotaSize") || - $this->isFeatureEnabled("mailBoxAutomaticRemoval")) - && ($this->hasFeaturebeenChanged("mailBoxWarnLimit") || - $this->hasFeaturebeenChanged("mailBoxSendSizelimit") || - $this->hasFeaturebeenChanged("quotaSize") || - $this->hasFeaturebeenChanged("mailBoxAutomaticRemoval") )){ - $quota = array( "warn_limit" => $this->mailBoxWarnLimitValue, - "send_limit" => $this->mailBoxSendSizelimitValue, - "hard_limit" => $this->quotaSize, - "hold" => $this->quotaSize); - - $this->groupwareDao->save("quotaSize", $this->uid, $quota); - } - - // Todo: checks for feature "mailLocations" - if($this->isFeatureEnabled("mailLocations") && $this->hasFeaturebeenChanged("mailLocations")){ - //$this->groupwareDao->save("mailLocations", $this->uid, $this->mailLocations); - } - - //checks for feature "mailFilter" - if($this->isFeatureEnabled("mailFilter") && $this->hasFeaturebeenChanged("mailFilter")){} - - //checks for feature "mailBoxAutomaticRemoval" - if($this->isFeatureEnabled("mailBoxAutomaticRemoval") && $this->hasFeaturebeenChanged("mailBoxAutomaticRemoval")){} - - //checks for feature "localDeliveryOnly" - if($this->isFeatureEnabled("localDeliveryOnly") && $this->hasFeaturebeenChanged("localDeliveryOnly")){} - - //checks for feature "dropOwnMails" - if($this->isFeatureEnabled("dropOwnMails") && $this->hasFeaturebeenChanged("dropOwnMails")){} - - - //checks for feature "mailLimit" - if($this->isFeatureEnabled("mailLimit") && $this->hasFeaturebeenChanged("mailLimit")){ - if(!$this->mailLimitReceiveEnabled){ - $this->mailLimitReceiveValue = 0; - } - if(!$this->mailLimitSendEnabled){ - $this->mailLimitSendValue = 0; - } - $this->groupwareDao->save("mailLimit", $this->uid, array( $this->mailLimitSendValue, $this->mailLimitReceiveValue)); - } - if($this->isFeatureEnabled("vacationMessage")&& $this->hasFeaturebeenChanged("vacationMessage")){ - if($this->vacationEnabled){ - //setting an message means that the OOOReply is switched off. - $this->groupwareDao->save("vacationMessage", $this->uid, $this->vacationMessage); - } - else{ - //setting no message means that the OOOReply is switched off. - $this->groupwareDao->save("vacationMessage", $this->uid, null); - } - } - //checks for feature "quotaUsage" - //not to be saved + if($this->isFeatureEnabled("alternateAddresses")&& $this->hasFeaturebeenChanged("alternateAddresses")){ + if(!empty($this->alternateAddresses) + && isset($this->alternateAddresses) + && is_array($this->alternateAddresses)){ + $this->groupwareDao->save("alternateAddresses", $this->uid, array($this->alternateAddresses)); + + } + } + // Save forwardingAddresses + if($this->isFeatureEnabled("forwardingAddresses") && $this->hasFeaturebeenChanged("forwardingAddresses")){ + if(empty($this->forwardingAddresses)){ + $this->groupwareDao->save("forwardingAddresses", $this->uid, array(array())); + } + if(is_array($this->forwardingAddresses) && isset($this->forwardingAddresses[0])){ + + // Only the first Address will be set as forward Address. + $fw = array(); + $fw[$this->forwardingAddresses[0]] = true; + $this->groupwareDao->save("forwardingAddresses", $this->uid, array($fw)); + } + } + //Save quota - it consists of four values... + if( ($this->isFeatureEnabled("mailBoxWarnLimit") || + $this->isFeatureEnabled("mailBoxSendSizelimit") || + $this->isFeatureEnabled("quotaSize") || + $this->isFeatureEnabled("mailBoxAutomaticRemoval")) + && ($this->hasFeaturebeenChanged("mailBoxWarnLimit") || + $this->hasFeaturebeenChanged("mailBoxSendSizelimit") || + $this->hasFeaturebeenChanged("quotaSize") || + $this->hasFeaturebeenChanged("mailBoxAutomaticRemoval") )){ + $quota = array( "warn_limit" => $this->mailBoxWarnLimitValue, + "send_limit" => $this->mailBoxSendSizelimitValue, + "hard_limit" => $this->quotaSize, + "hold" => $this->quotaSize); + + $this->groupwareDao->save("quotaSize", $this->uid, $quota); + } + + // Todo: checks for feature "mailLocations" + if($this->isFeatureEnabled("mailLocations") && $this->hasFeaturebeenChanged("mailLocations")){ + //$this->groupwareDao->save("mailLocations", $this->uid, $this->mailLocations); + } + + //checks for feature "mailFilter" + if($this->isFeatureEnabled("mailFilter") && $this->hasFeaturebeenChanged("mailFilter")){} + + //checks for feature "mailBoxAutomaticRemoval" + if($this->isFeatureEnabled("mailBoxAutomaticRemoval") && $this->hasFeaturebeenChanged("mailBoxAutomaticRemoval")){} + + //checks for feature "localDeliveryOnly" + if($this->isFeatureEnabled("localDeliveryOnly") && $this->hasFeaturebeenChanged("localDeliveryOnly")){} + + //checks for feature "dropOwnMails" + if($this->isFeatureEnabled("dropOwnMails") && $this->hasFeaturebeenChanged("dropOwnMails")){} + + + //checks for feature "mailLimit" + if($this->isFeatureEnabled("mailLimit") && $this->hasFeaturebeenChanged("mailLimit")){ + if(!$this->mailLimitReceiveEnabled){ + $this->mailLimitReceiveValue = 0; + } + if(!$this->mailLimitSendEnabled){ + $this->mailLimitSendValue = 0; + } + $this->groupwareDao->save("mailLimit", $this->uid, array( $this->mailLimitSendValue, $this->mailLimitReceiveValue)); + } + if($this->isFeatureEnabled("vacationMessage")&& $this->hasFeaturebeenChanged("vacationMessage")){ + if($this->vacationEnabled){ + //setting an message means that the OOOReply is switched off. + $this->groupwareDao->save("vacationMessage", $this->uid, $this->vacationMessage); + } + else{ + //setting no message means that the OOOReply is switched off. + $this->groupwareDao->save("vacationMessage", $this->uid, null); + } + } + //checks for feature "quotaUsage" + //not to be saved } @@ -871,94 +878,94 @@ class Groupware extends plugin */ function check() { - //checke features only if they are enabled. + //checke features only if they are enabled. $messages = plugin::check(); - - //checks for feature "primaryMail" - if ($this->isFeatureEnabled("mailBoxWarnLimit")){ - if(!tests::is_email ($this->mailAddress)){ - $messages[] = msgPool::invalid(_("Mail address"),$this->mailAddress , "", "user@exdom.intranet.gonicus.de knibbel"); - } - } - //checks for feature "quotaUsage" - if ($this->isFeatureEnabled("quotaUsage")){} - - //checks for feature "mailLocations" - if ($this->isFeatureEnabled("mailLocations")){} - - //checks for feature "mailFilter" - if ($this->isFeatureEnabled("mailFilter")){} - - //checks for feature "alternateAddresses" - if ($this->isFeatureEnabled("alternateAddresses")){} - - //checks for feature "forwardingAddresses" - if ($this->isFeatureEnabled("forwardingAddresses")){ - if(isset($this->forwardingAddresses) && is_array($this->forwardingAddresses)){ - foreach($this->forwardingAddresses as $fAddress){ - if(!tests::is_email ($fAddress)){ - $messages[] = msgPool::invalid(_("Forwarding address"),$fAddress, "", - "user@exdom.intranet.gonicus.de"); - } - //Check if the address is a valid address on the Groupwareserver - $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $fAddress); - if(empty($isMailAvailabel)){ - $messages[] = _("This email address is not available as forwarding recipient in your groupware."); - } - if($fAddress == $this->mailAddress){ - $messages[] = _("The primary address cannot be used as forwarding address!"); - } - } - } - } - - //checks for feature "vacationMessage" - if ($this->isFeatureEnabled("vacationMessage")){} - //checks for feature "mailLimit" - integer - if ($this->isFeatureEnabled("mailLimit")){ - if (!is_numeric($this->mailLimitReceiveValue)){ - $messages[] = msgPool::invalid(_("Value for mailbox size receive limit"),$this->mailLimitReceiveValue , "", "1024 = 1MB"); - } - if (!is_numeric($this->mailLimitSendValue)){ - $messages[] = msgPool::invalid(_("Value for mailbox size send limit"),$this->mailLimitSendValue , "", "1024 = 1MB"); - } - } - - //checks for feature "mailBoxWarnLimit" - if ($this->isFeatureEnabled("quotaSize")){ - //Todo: wrong test - if (!is_numeric($this->quotaSize)){ - $messages[] = msgPool::invalid(_("Value for Quota size"),$this->quotaSize , "", "1024 = 1GB"); - } - } - - //checks for feature "mailBoxSendSizelimit" - if ($this->isFeatureEnabled("mailBoxSendSizelimit")){ - //Todo: wrong test - if (!is_numeric($this->mailBoxSendSizelimitValue)){ - $messages[] = msgPool::invalid(_("Value refuse incoming mails limit"),$this->mailBoxSendSizelimitValue , "", "1024 = 1GB"); - } - } - //checks for feature "mailBoxHardSizelimit" - if ($this->isFeatureEnabled("mailBoxWarnLimit")){ - //Todo: wrong test - if (!is_numeric($this->mailBoxWarnLimitValue)){ - $messages[] = msgPool::invalid(_("Value warn about full mailbox"),$this->mailBoxWarnLimitValue , "", "1024 = 1GB"); - } - } - - //checks for feature "mailBoxAutomaticRemoval" - if ($this->isFeatureEnabled("mailBoxAutomaticRemoval")){} - - //checks for feature "localDeliveryOnly" - if ($this->isFeatureEnabled("localDeliveryOnly")){} - - //checks for feature "dropOwnMails" - if ($this->isFeatureEnabled("dropOwnMails")){} - - //checks for feature "mailFolder" - if ($this->isFeatureEnabled("mailFolder")){} - + + //checks for feature "primaryMail" + if ($this->isFeatureEnabled("mailBoxWarnLimit")){ + if(!tests::is_email ($this->mailAddress)){ + $messages[] = msgPool::invalid(_("Mail address"),$this->mailAddress , "", "user@exdom.intranet.gonicus.de knibbel"); + } + } + //checks for feature "quotaUsage" + if ($this->isFeatureEnabled("quotaUsage")){} + + //checks for feature "mailLocations" + if ($this->isFeatureEnabled("mailLocations")){} + + //checks for feature "mailFilter" + if ($this->isFeatureEnabled("mailFilter")){} + + //checks for feature "alternateAddresses" + if ($this->isFeatureEnabled("alternateAddresses")){} + + //checks for feature "forwardingAddresses" + if ($this->isFeatureEnabled("forwardingAddresses")){ + if(isset($this->forwardingAddresses) && is_array($this->forwardingAddresses)){ + foreach($this->forwardingAddresses as $fAddress){ + if(!tests::is_email ($fAddress)){ + $messages[] = msgPool::invalid(_("Forwarding address"),$fAddress, "", + "user@exdom.intranet.gonicus.de"); + } + //Check if the address is a valid address on the Groupwareserver + $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $fAddress); + if(empty($isMailAvailabel)){ + $messages[] = _("This email address is not available as forwarding recipient in your groupware."); + } + if($fAddress == $this->mailAddress){ + $messages[] = _("The primary address cannot be used as forwarding address!"); + } + } + } + } + + //checks for feature "vacationMessage" + if ($this->isFeatureEnabled("vacationMessage")){} + //checks for feature "mailLimit" - integer + if ($this->isFeatureEnabled("mailLimit")){ + if (!is_numeric($this->mailLimitReceiveValue)){ + $messages[] = msgPool::invalid(_("Value for mailbox size receive limit"),$this->mailLimitReceiveValue , "", "1024 = 1MB"); + } + if (!is_numeric($this->mailLimitSendValue)){ + $messages[] = msgPool::invalid(_("Value for mailbox size send limit"),$this->mailLimitSendValue , "", "1024 = 1MB"); + } + } + + //checks for feature "mailBoxWarnLimit" + if ($this->isFeatureEnabled("quotaSize")){ + //Todo: wrong test + if (!is_numeric($this->quotaSize)){ + $messages[] = msgPool::invalid(_("Value for Quota size"),$this->quotaSize , "", "1024 = 1GB"); + } + } + + //checks for feature "mailBoxSendSizelimit" + if ($this->isFeatureEnabled("mailBoxSendSizelimit")){ + //Todo: wrong test + if (!is_numeric($this->mailBoxSendSizelimitValue)){ + $messages[] = msgPool::invalid(_("Value refuse incoming mails limit"),$this->mailBoxSendSizelimitValue , "", "1024 = 1GB"); + } + } + //checks for feature "mailBoxHardSizelimit" + if ($this->isFeatureEnabled("mailBoxWarnLimit")){ + //Todo: wrong test + if (!is_numeric($this->mailBoxWarnLimitValue)){ + $messages[] = msgPool::invalid(_("Value warn about full mailbox"),$this->mailBoxWarnLimitValue , "", "1024 = 1GB"); + } + } + + //checks for feature "mailBoxAutomaticRemoval" + if ($this->isFeatureEnabled("mailBoxAutomaticRemoval")){} + + //checks for feature "localDeliveryOnly" + if ($this->isFeatureEnabled("localDeliveryOnly")){} + + //checks for feature "dropOwnMails" + if ($this->isFeatureEnabled("dropOwnMails")){} + + //checks for feature "mailFolder" + if ($this->isFeatureEnabled("mailFolder")){} + return($messages); } @@ -993,8 +1000,8 @@ class Groupware extends plugin "mailBoxAutomaticRemoval" => _("Automatic mail removal"), "localDeliveryOnly" => _("Local delivery only"), "dropOwnMails" => _("Drop own mails"), - "mailLimitSend" => _("mail Limit send"), - "mailLimitReceive" => _("mail Limit receive") + "mailLimitSend" => _("mail Limit send"), + "mailLimitReceive" => _("mail Limit receive") ) )); } @@ -1027,11 +1034,11 @@ class Groupware extends plugin "mailBoxAutomaticRemovalValue" => "mailBoxAutomaticRemovalValue", "localDeliveryOnly" => "localDeliveryOnly", "dropOwnMails" => "dropOwnMails", - "mailLimitReceiveValue" => "mailLimitReceiveValue", - "mailLimitSendValue" => "mailLimitSendValue", - "mailLimitReceiveEnabled" => "mailLimitReceiveEnabled", - "mailLimitSendEnabled" => "mailLimitSendEnabled" - ); + "mailLimitReceiveValue" => "mailLimitReceiveValue", + "mailLimitSendValue" => "mailLimitSendValue", + "mailLimitReceiveEnabled" => "mailLimitReceiveEnabled", + "mailLimitSendEnabled" => "mailLimitSendEnabled" + ); // Map values from source array to class members foreach($map as $target => $source){ @@ -1040,31 +1047,31 @@ class Groupware extends plugin } } } - - - /*! \brief This is a feature with many datasets inside which should be - * cut in slices and saved separately. + + + /*! \brief This is a feature with many datasets inside which should be + * cut in slices and saved separately. */ - // - function saveFoldersAndAcls($id, $mailFolder) + // + function saveFoldersAndAcls($id, $mailFolder) { - // In the tests with the exchange server groupware setting acls is very - // slow. So this function has got to be checked for modifications. - foreach($mailFolder as $key => $val) - { - if(!empty($val["status"])){ - switch($val["status"]){ - case "add": - $this->groupwareDao->save("mailFolder", $id, $key); - break; - case "del": - $this->groupwareDao->delete("mailFolder", $id, $key); - break; - } - } - $this->save("private_folderACLS", $id, $val["acls"]); - } - } + // In the tests with the exchange server groupware setting acls is very + // slow. So this function has got to be checked for modifications. + foreach($mailFolder as $key => $val) + { + if(!empty($val["status"])){ + switch($val["status"]){ + case "add": + $this->groupwareDao->save("mailFolder", $id, $key); + break; + case "del": + $this->groupwareDao->delete("mailFolder", $id, $key); + break; + } + } + $this->save("private_folderACLS", $id, $val["acls"]); + } + } } diff --git a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc index 210370fcf..487325b2d 100644 --- a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc +++ b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc @@ -1,6 +1,6 @@ array("get"=>"gwAcctGetProperties", "save"=>"gwAcctSetProperties", "delete"=>"gwAcctDelProperties"), - //mailFolder is a composite feature - - "mailFolder" => array( "get"=>"gwFolderList", - "save"=>"gwFolderAdd", + //mailFolder is a composite feature - + "mailFolder" => array( "get"=>"gwFolderList", + "save"=>"gwFolderAdd", "delete"=>"gwFolderDel"), - "private_folderACLS" => array("get"=>"gwFolderGetMembers", + "private_folderACLS" => array("get"=>"gwFolderGetMembers", "save"=>"gwFolderSetMembers", "delete"=>"gwFolderDelMember"), - "mailLimit" => array("get"=>"gwAcctGetMailLimit", + "mailLimit" => array("get"=>"gwAcctGetMailLimit", "save"=>"gwAcctSetMailLimit") ); @@ -95,7 +95,7 @@ class GroupwareDao{ }else{ $valueArray = array($function, $uid, $valueArray); } - + $result = call_user_func_array(array($this->groupwarePluginRef, 'rpcExec'), $valueArray); return $result; } @@ -125,7 +125,7 @@ class GroupwareDao{ */ public function del($feature, $valueArray) { - + echo "deletion of values is not implemented yet"; /* $function = GroupwareDao::$gwFeatures[$feature]["delete"]; @@ -166,7 +166,7 @@ class GroupwareDao{ } if($this->groupwarePluginRef->isFeatureEnabled("forwardingAddresses")){ - $FWaddresses = $this->get("forwardingAddresses", array($uid)); + $FWaddresses = $this->get("forwardingAddresses", array($uid)); if($FWaddresses) { $resultArr["forwardingAddresses"] = array(key($FWaddresses)); } @@ -178,54 +178,54 @@ class GroupwareDao{ $resultArr["mailLocation"] = $this->groupwarePluginRef->rpcExec('gwAcctGetLocation',$uid); } - //getThefolderList from the user - if($this->groupwarePluginRef->isFeatureEnabled("mailFolder")){ - - //Folder Id from the User ... - //user/$id/ - $resultArr["mailFolder"] = $this->get("mailFolder", array("user/".$uid."/")); - - foreach($resultArr["mailFolder"] as $val){ - $s = strpos($val, "user/"); - if($s == 0){ - - $resultArr["mailFolder"][$val]["name"] = substr($val, strpos($val, "/", 5)); - - $curAcl = $this->get("private_folderACLS", array("user/wiwu/Posteingang")); - if(is_array($curAcl)){ - foreach($curAcl as $aclkey => $aclval){ - - if (empty($aclkey)){ - $resultArr["mailFolder"][$val]["acls"][] = array( - "name" => $aclkey, - "acl" => aclval, - "type"=>"user"); - } - else{ - $resultArr["mailFolder"][$val]["acls"][] = array( - "name" => $aclkey, - "acl" => GROUPWARE_RIGHTS_NONE, - "type"=>"user"); - } - } - } - } - else{ - // this case should never happen - unsetting the array anyway. - unset($resultArr["mailFolder"][$val]); - } - } - - /* - "RIGHTS_NONE", 0); - "RIGHTS_READ", LOOKUP | READ | STATUS); - "RIGHTS_POST", RIGHTS_READ | POST); - "RIGHTS_APPEND", RIGHTS_POST | INSERT); - "RIGHTS_WRITE", RIGHTS_APPEND | WRITE | CREATE | DELETE); - "" + //getThefolderList from the user + if($this->groupwarePluginRef->isFeatureEnabled("mailFolder")){ + + //Folder Id from the User ... + //user/$id/ + $resultArr["mailFolder"] = $this->get("mailFolder", array("user/".$uid."/")); + + foreach($resultArr["mailFolder"] as $val){ + $s = strpos($val, "user/"); + if($s == 0){ + + $resultArr["mailFolder"][$val]["name"] = substr($val, strpos($val, "/", 5)); + + $curAcl = $this->get("private_folderACLS", array("user/wiwu/Posteingang")); + if(is_array($curAcl)){ + foreach($curAcl as $aclkey => $aclval){ + + if (empty($aclkey)){ + $resultArr["mailFolder"][$val]["acls"][] = array( + "name" => $aclkey, + "acl" => aclval, + "type"=>"user"); + } + else{ + $resultArr["mailFolder"][$val]["acls"][] = array( + "name" => $aclkey, + "acl" => GROUPWARE_RIGHTS_NONE, + "type"=>"user"); + } + } + } + } + else{ + // this case should never happen - unsetting the array anyway. + unset($resultArr["mailFolder"][$val]); + } + } + + /* + "RIGHTS_NONE", 0); + "RIGHTS_READ", LOOKUP | READ | STATUS); + "RIGHTS_POST", RIGHTS_READ | POST); + "RIGHTS_APPEND", RIGHTS_POST | INSERT); + "RIGHTS_WRITE", RIGHTS_APPEND | WRITE | CREATE | DELETE); + "" */ - - //need a status for the array - setting them now for the example data. + + //need a status for the array - setting them now for the example data. foreach($resultArr["mailFolder"] as $id => $folder){ $resultArr["mailFolder"][$id]['status'] = ''; } @@ -239,10 +239,10 @@ class GroupwareDao{ $this->groupwarePluginRef->isFeatureEnabled("mailBoxWarnLimit") || $this->groupwarePluginRef->isFeatureEnabled("mailBoxSendSizelimit") || $this->groupwarePluginRef->isFeatureEnabled("mailBoxHardSizelimit")){ - + // example Array for Quota $quota = $this->get("quotaSize", array($uid)); - + $resultArr["quotaSize"] = $quota["usage"]; $resultArr["quotaSize"] = $quota["hold"]; if($quota["warn_limit"] > 0){ @@ -267,11 +267,11 @@ class GroupwareDao{ $resultArr["mailBoxHardSizelimitValue"] = 0; } } - //get the current MailLimits ... if this feature is enabled. - if($this->groupwarePluginRef->isFeatureEnabled("mailLimit")){ - $mailLimits = $this->get("mailLimit", array($uid)); - - if($mailLimits["receive"] > 0){ + //get the current MailLimits ... if this feature is enabled. + if($this->groupwarePluginRef->isFeatureEnabled("mailLimit")){ + $mailLimits = $this->get("mailLimit", array($uid)); + + if($mailLimits["receive"] > 0){ $resultArr["mailLimitReceiveEnabled"] = true; $resultArr["mailLimitReceiveValue"] = $mailLimits["receive"]; }else{ @@ -285,17 +285,17 @@ class GroupwareDao{ $resultArr["mailLimitSendEnabled"] = false; $resultArr["mailLimitSendValue"] = 0; } - } + } //this function seems to be broken on the server. //addding dummy if($this->groupwarePluginRef->isFeatureEnabled("vacationMessage")){ - $vacArray = $this->get("vacationMessage", array($uid)); - + $vacArray = $this->get("vacationMessage", array($uid)); + $resultArr["vacationMessage"] = $vacArray["message"]; - if(!empty($resultArr["vacationMessage"])){ - $resultArr["vacationEnabled"] = true; - } + if(!empty($resultArr["vacationMessage"])){ + $resultArr["vacationEnabled"] = true; + } //$resultArr["vacationMessage"] = "dummy Vacation message - (getOutOfOfficeReply currently throws errors )"; } return $resultArr; -- 2.30.2