From: hickert Date: Fri, 23 Mar 2007 08:32:06 +0000 (+0000) Subject: Added additional check, to avoid connecting to unavailable server X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6f6c86bb0f5432d6c254b5163a6e281c112526f8;p=gosa.git Added additional check, to avoid connecting to unavailable server git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5870 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index 5c963d584..d5701e3bb 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -127,24 +127,31 @@ class sieveManagement extends plugin */ function get_sieve() { + /* Connect to sieve class and try to get all available sieve scripts */ - $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer]; - $this->Sieve_Error = ""; - - /* Log into the mail server */ - $this->sieve_handle= new sieve( - $cfg["sieve_server"], - $cfg["sieve_port"], - $this->parent->uid, - $cfg["password"], - $cfg["admin"]); - - /* Try to login */ - if (!$this->sieve_handle->sieve_login()){ - $this->Sieve_Error = $this->sieve_handle->error_raw; + if(isset($this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer])){ + $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer]; + $this->Sieve_Error = ""; + + /* Log into the mail server */ + $this->sieve_handle= new sieve( + $cfg["sieve_server"], + $cfg["sieve_port"], + $this->parent->uid, + $cfg["password"], + $cfg["admin"]); + + /* Try to login */ + if (!$this->sieve_handle->sieve_login()){ + $this->Sieve_Error = $this->sieve_handle->error_raw; + return(FALSE); + } + return($this->sieve_handle); + }else{ + $this->Sieve_Error = sprintf(_("The specified mail server '%s' does not exist within the GOsa configuration."), + $this->parent->gosaMailServer); return(FALSE); } - return($this->sieve_handle); }