summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90a4ca9)
raw | patch | inline | side by side (parent: 90a4ca9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Mar 2007 08:52:23 +0000 (08:52 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Mar 2007 08:52:23 +0000 (08:52 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5794 594d385d-05f5-0310-b6e9-bd551577e9d8
include/sieve/class_sieveManagement.inc | patch | blob | history |
index dca53556f94dfa001ca95b5163e617976b77ab15..81b6b34525b76c3328130ab3c8549fa5b204b550 100644 (file)
var $script_to_delete =-1;
var $sieve_handle = NULL;
var $Script_Error = "";
+ var $Sieve_Error = "";
var $create_script = FALSE;
/* To add new elements we need to know
var $add_element_type = "sieve_comment";
+ 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 */
+ $sieve= new sieve(
+ $cfg["sieve_server"],
+ $cfg["sieve_port"],
+ $this->parent->uid,
+ $cfg["password"],
+ $cfg["admin"]);
+
+ /* Try to login */
+ if (!$sieve->sieve_login()){
+ $this->Sieve_Error = $sieve->error_raw;
+ return(FALSE);
+ }
+ return($sieve);
+ }
+
/* Initialize the class and load all sieve scripts
* try to parse them and display errors
*/
$this->parent = $parent;
plugin::plugin($config,$dn);
-
- /* Connect to sieve class and try to get all available sieve scripts */
- $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer];
-
- /* Log into the mail server */
- $sieve= new sieve($cfg["sieve_server"], $cfg["sieve_port"], $this->parent->uid,
- $cfg["password"], $cfg["admin"]);
-
- /* Try to login */
- if (!$sieve->sieve_login()){
- print_red(sprintf(_("Can't log into SIEVE server. Server says '%s'."),
- to_string($sieve->error_raw)));
+ /* Get sieve */
+ if(!$sieve = $this->get_sieve()){
+ print_red(
+ sprintf(
+ _("Can't log into SIEVE server. Server says '%s'."),
+ to_string($this->Sieve_Error)));
return;
}
+
/* Get all sieve scripts names */
if($sieve->sieve_listscripts()){
if (is_array($sieve->response)){
$script = preg_replace("/^active_script_/","",$name);
$script = preg_replace("/_(x|y)/","",$script);
$once = FALSE;
-
- /* Connect to sieve class and try to get all available sieve scripts */
- $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer];
- $this->sieve_handle=
- new sieve( $cfg["sieve_server"],
- $cfg["sieve_port"],
- $this->parent->mail,
- $cfg["password"],
- $cfg["admin"]);
-
- if (!$this->sieve_handle->sieve_login()){
- print_red(sprintf(_("Can't log into SIEVE server. Server says '%s'."),to_string($this->sieve_handle->error_raw)));
- return;
+
+ /* Get sieve */
+ if(!$sieve = $this->get_sieve()){
+ print_red(
+ sprintf(
+ _("Can't log into SIEVE server. Server says '%s'."),
+ to_string($this->Sieve_Error)));
}
/* Try to activate the given script and update
unset($this->scripts[$this->script_to_delete]);
}else{
- /* Connect to sieve class and try to get all available sieve scripts */
- $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer];
- $this->sieve_handle=
- new sieve( $cfg["sieve_server"],
- $cfg["sieve_port"],
- $this->parent->mail,
- $cfg["password"],
- $cfg["admin"]);
- if (!$this->sieve_handle->sieve_login()){
- print_red(sprintf(_("Can't log into SIEVE server. Server says '%s'."),to_string($this->sieve_handle->error_raw)));
- return;
+ /* Get sieve */
+ if(!$sieve = $this->get_sieve()){
+ print_red(
+ sprintf(
+ _("Can't log into SIEVE server. Server says '%s'."),
+ to_string($this->Sieve_Error)));
}
if(!$this->sieve_handle->sieve_deletescript($this->scripts[$this->script_to_delete]['NAME'])){