X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fsieve%2Fclass_sieveManagement.inc;h=be2ef4ed93186acec0ffbf64bfe82fc5a4de5d48;hb=4ef5a0ec2c799536446dd29d5d828488cc14608f;hp=ea355b2e3937a2c08108555cc388d385942807ab;hpb=003d76f426422c935a4fb0914247eea28bdf0ab3;p=gosa.git diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index ea355b2e3..be2ef4ed9 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -36,7 +36,24 @@ class sieveManagement extends plugin var $current_handler = NULL; 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 + * Where to the element -> add_new_id + * Whould we add above or below this id -> add_above_below + * What kind of element should we add -> add_element_type + */ + var $add_new_element = FALSE; + var $add_new_id = -1; + var $add_above_below = "below"; + var $add_element_type = "sieve_comment"; + /* If this variable is TRUE, this indicates that we have the + * import dialog opened. + */ + var $Import_Script = FALSE; /* Initialize the class and load all sieve scripts * try to parse them and display errors @@ -46,25 +63,20 @@ class sieveManagement extends plugin $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(!$this->sieve_handle = $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)){ - foreach($sieve->response as $key => $name){ + if($this->sieve_handle->sieve_listscripts()){ + if (is_array($this->sieve_handle->response)){ + foreach($this->sieve_handle->response as $key => $name){ $data = array(); $data['NAME'] = $name; @@ -81,27 +93,65 @@ class sieveManagement extends plugin /* Get script contents */ foreach($this->scripts as $key => $script){ - $p = new My_Parser; - $sieve->sieve_getscript($script['NAME']); + $p = new My_Parser($this); + $this->sieve_handle->sieve_getscript($script['NAME']); $script = ""; - foreach($sieve->response as $line){ + foreach($this->sieve_handle->response as $line){ $script.=$line; } + $this->scripts[$key]['IS_NEW'] = FALSE;; $this->scripts[$key]['SCRIPT'] = $script; + $this->scripts[$key]['ORIG_SCRIPT'] = $script; $this->scripts[$key]['MSG'] = ""; $ret = $p->parse($script); if(!$ret){ - $this->scripts[$key]['MSG'] = "".$p->status_text.""; - $this->scripts[$key]['STATUS'] = _("Parse failed")."".$p->status_text.""; + $this->scripts[$key]['STATUS'] = FALSE; + $this->scripts[$key]['MODE'] = "Source"; + $this->scripts[$key]['MSG'] = _("Parse failed")."".$p->status_text.""; }else{ - $this->scripts[$key]['STATUS'] = _("Parse successful"); + $this->scripts[$key]['STATUS'] = TRUE; + $this->scripts[$key]['MODE'] = "Structured"; + $this->scripts[$key]['MSG'] = _("Parse successful"); } $this->scripts[$key]['PARSER'] = $p; $this->scripts[$key]['EDITED'] = FALSE; } - $this->sieve_handle = $sieve; + $this->sieve_handle = $this->sieve_handle; + } + + + /* Return a sieve class hanlde, + * false if login fails + */ + function get_sieve() + { + + /* Connect to sieve class and try to get all available sieve scripts */ + 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); + } } @@ -109,8 +159,109 @@ class sieveManagement extends plugin */ function execute() { + /*************** + * Create a new Script + ***************/ + + /* Force opening the add script dialog */ + if(isset($_POST['create_new_script'])){ + $this->create_script = TRUE; + } + + /* Close add script dialog, without adding a new one */ + if(isset($_POST['create_script_cancel'])){ + $this->create_script = FALSE; + } + + /* Display create script dialog + * handle posts, display warnings if specified + * name is not useable. + * Create a new script with given name + */ + if($this->create_script){ + + /* Set initial name or used posted name if available */ + $name = ""; + if(isset($_POST['NewScriptName'])){ + $name = trim($_POST['NewScriptName']); + } + + /* Check given name */ + $err = ""; + + /* Is given name in lower case characters ? */ + if(isset($_POST['create_script_save'])){ + if(!strlen($name)){ + $err = _("You should specify a name for your new script."); + } + /* Is given name in lower case characters ? */ + if($name != strtolower($name)){ + $err = _("Only lower case names are allowed here."); + } + + /* Only chars are allowed here */ + if(preg_match("/[^a-z]/i",$name)){ + $err = _("Only a-z are allowed in script names."); + } + + $tmp = $this->get_used_script_names(); + if(in_array_ics($name,$tmp)){ + $err =_("The specified name is already in use."); + } + } + + /* Create script if everything is ok */ + if($this->create_script && isset($_POST['create_script_save']) && $err == "" ){ + + /* Close dialog */ + $this->create_script = FALSE; + + /* Script contents to use */ + $script = "/*New script */". + "stop;"; + + /* Create a new parser and initialize default values */ + $p = new My_Parser($this); + $ret = $p->parse($script); + $sc['SCRIPT'] = $script; + $sc['ORIG_SCRIPT'] = $script; + $sc['IS_NEW'] = TRUE; + $sc['MSG'] = ""; + if(!$ret){ + $sc['STATUS'] = FALSE; + $sc['MODE'] = "Source"; + $sc['MSG'] = _("Parse failed")."".$p->status_text.""; + }else{ + $sc['STATUS'] = TRUE; + $sc['MODE'] = "Structured"; + $sc['MSG'] = _("Parse successful"); + } + $sc['PARSER'] = $p; + $sc['EDITED'] = TRUE; + $sc['ACTIVE'] = FALSE; + $sc['NAME'] = $name; + + /* Add script */ + $this->scripts[$name] = $sc; + }else{ + + /* Display dialog to enter new script name */ + $smarty = get_smarty(); + $smarty->assign("NewScriptName",$name); + $smarty->assign("Error",$err); + return($smarty->fetch(get_template_path("templates/create_script.tpl",TRUE,dirname(__FILE__)))); + } + } + + + /************* + * Handle several posts + *************/ + $once = TRUE; foreach($_POST as $name => $value){ + + /* Edit script requested */ if(preg_match("/^editscript_/",$name) && $once && !$this->current_handler){ $script = preg_replace("/^editscript_/","",$name); $script = preg_replace("/_(x|y)/","",$script); @@ -118,108 +269,353 @@ class sieveManagement extends plugin $this->current_script = $script; $this->current_handler = $this->scripts[$script]['PARSER']; + $this->scripts[$script]['SCRIPT_BACKUP'] = $this->scripts[$script]['SCRIPT']; } - if(preg_match("/^delscript_/",$name) && $once && !$this->current_handler){ + + /* remove script requested */ + if($this->parent->acl_is_writeable("sieveManagement") && preg_match("/^delscript_/",$name) && $once && !$this->current_handler){ $script = preg_replace("/^delscript_/","",$name); $script = preg_replace("/_(x|y)/","",$script); $once = FALSE; - $this->script_to_delete = $script; } - if(preg_match("/^active_script_/",$name) && $once && !$this->current_handler){ + + /* Activate script */ + if($this->parent->acl_is_writeable("sieveManagement") && preg_match("/^active_script_/",$name) && $once && !$this->current_handler){ $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; - } - if(!$this->sieve_handle->sieve_setactivescript($this->scripts[$script]['NAME'])){ - print_red(sprintf(_("Can't activate sieve script on server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); - }else{ + /* We can only activate existing scripts */ + if(!$this->scripts[$script]['IS_NEW']){ - foreach($this->scripts as $key => $data){ + /* Get sieve */ + if(!$this->sieve_handle = $this->get_sieve()){ + print_red( + sprintf( + _("Can't log into SIEVE server. Server says '%s'."), + to_string($this->Sieve_Error))); + } - if($key == $script){ - $this->scripts[$key]['ACTIVE'] = TRUE; - }else{ - $this->scripts[$key]['ACTIVE'] = FALSE; + /* Try to activate the given script and update + * class script array. + */ + if(!$this->sieve_handle->sieve_setactivescript($this->scripts[$script]['NAME'])){ + print_red(sprintf(_("Can't activate sieve script on server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); + }else{ + foreach($this->scripts as $key => $data){ + if($key == $script){ + $this->scripts[$key]['ACTIVE'] = TRUE; + }else{ + $this->scripts[$key]['ACTIVE'] = FALSE; + } } } } } } + + /************* + * Remove script handling + *************/ + + /* Remove aborted */ if(isset($_POST['delete_cancel'])){ $this->script_to_delete = -1; } - if(isset($_POST['delete_script_confirm'])){ + /* Remove confirmed */ + if($this->parent->acl_is_writeable("sieveManagement") && isset($_POST['delete_script_confirm'])){ - /* 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; - } + $script = $this->scripts[$this->script_to_delete]; - if(!$this->sieve_handle->sieve_deletescript($this->scripts[$this->script_to_delete]['NAME'])){ - print_red(sprintf(_("Can't remove sieve script from server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); - }else{ + /* Just remove from array if it is a new script */ + if($script['IS_NEW']){ unset($this->scripts[$this->script_to_delete]); + }else{ + + /* Get sieve */ + if(!$this->sieve_handle = $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'])){ + print_red(sprintf(_("Can't remove sieve script from server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); + }else{ + unset($this->scripts[$this->script_to_delete]); + } } $this->script_to_delete = -1; } + /* Display confirm dialog */ if($this->script_to_delete != -1){ $smarty = get_smarty(); $smarty->assign("Warning", sprintf(_("You are going to remove the sieve script '%s' from your mail server."), $this->scripts[$this->script_to_delete]['NAME'])); - return($smarty->fetch(get_template_path("templates/remove_script.tpl",TRUE,dirname(__FILE__)))); } + + /************** + * Save script changes + **************/ + /* Abort saving */ if(isset($_POST['cancel_sieve_changes'])){ + $tmp = $this->scripts[$this->current_script]['SCRIPT_BACKUP']; + $this->scripts[$this->current_script]['SCRIPT'] = $tmp; + $this->scripts[$this->current_script]['PARSER']->parse($tmp); $this->current_handler = NULL; } /* Save currently edited sieve script. */ - if(isset($_POST['save_sieve_changes'])){ - $this->scripts[$this->current_script]['PARSER'] = $this->current_handler; - $this->scripts[$this->current_script]['EDITED'] = TRUE; - $this->current_handler = NULL; + if($this->parent->acl_is_writeable("sieveManagement") && isset($_POST['save_sieve_changes'])){ + $chk = $this->current_handler->check(); + if(!count($chk)){ + + $sc = $this->scripts[$this->current_script]['SCRIPT']; + $p = new My_Parser($this); + if($p -> parse($sc)){ + + if($this->scripts[$this->current_script]['MODE'] == "Source-Only"){ + $this->scripts[$this->current_script]['MODE'] = "Source"; + } + + $this->scripts[$this->current_script]['PARSER'] = $p; + $this->scripts[$this->current_script]['EDITED'] = TRUE; + $this->scripts[$this->current_script]['STATUS'] = TRUE; + $this->scripts[$this->current_script]['MSG'] = _("Edited"); + $this->current_handler = NULL; + }else{ + print_red($p->status_text);; + } + }else{ + print_red(_("Please fix all errors before saving.")); + } } - /* Create output for currently opened sieve script */ + + /************* + * Display edit dialog + *************/ + + /* Display edit dialog, depending on Mode display different uis + */ if($this->current_handler){ - $ret = $this->current_handler->execute(); - $ret .= "
\n"; @@ -270,41 +671,289 @@ class sieveManagement extends plugin return($display);; } + + /* Add a new element to the currently opened script editor. + * The insert position is specified by + */ + function add_new_element_to_current_script($type,$id,$position) + { + /* Test given data */ + if(!in_array_ics($position,array("above","below"))){ + trigger_error("Can't add new element with \$position=".$position.". Only 'above','below' are allowed here."); + return(FALSE); + } + if(!is_numeric($id)){ + trigger_error("Can't add new element, given id is not numeric."); + return(FALSE); + } + $tmp = get_declared_classes(); + if(!in_array($type,$tmp)){ + trigger_error("Can't add new element, given \$class=".$class." does not exists."); + return(FALSE); + } + if(!is_object($this->current_handler) || get_class($this->current_handler) != "My_Parser"){ + trigger_error("Can't add new element, there is no valid script editor opened."); + return(FALSE); + } + + /* Create elements we should add + * -Some element require also surrounding block elements + */ + $parent = $this->current_handler->tree_; + if($this->add_element_type == "sieve_if"){ + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }elseif($this->add_element_type == "sieve_else"){ + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }elseif($this->add_element_type == "sieve_elsif"){ + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }else{ + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + } + + /* Get index of the element identified by object_id == $id; + */ + $index = -1; + $data = $this->current_handler->tree_->pap; + foreach($data as $key => $obj){ + if($obj->object_id == $id && $index==-1){ + $index = $key; + } + } + + /* Tell to user that we couldn't find the given object + * so we can't add an element. + */ + if($index == -1 ){ + trigger_error("Can't add new element, specified \$id=".$id." could not be found in object tree."); + return(FALSE); + } + + /* We have found the specified object_id + * and want to detect the next free position + * to insert the new element. + */ + if($position == "above"){ + $direction ="up"; + $next_free = $this->current_handler->tree_->_get_next_free_move_slot($index,$direction,TRUE); + }else{ + $direction = "down"; + $next_free = $this->current_handler->tree_->_get_next_free_move_slot($index,$direction,TRUE); + } + /* This is extremly necessary, cause some objects + * updates the tree objects ... Somehow i should change this ... + */ + $data = $this->current_handler->tree_->pap; + $start = $end = array(); + + if($position == "above"){ + $start = array_slice($data,0,$next_free); + $end = array_slice($data,$next_free); + }else{ + $start = array_slice($data,0,$next_free+1); + $end = array_slice($data,$next_free+1); + } + + $new = array(); + foreach($start as $obj){ + $new[] = $obj; + } + foreach($ele as $el){ + $new[] = $el; + } + foreach($end as $obj){ + $new[] = $obj; + } + $data= $new; + $this->current_handler->tree_->pap = $data; + return(TRUE); + } + + + function save_object() { if($this->current_handler){ + + if(isset($_GET['Add_Object_Top_ID'])){ + $this->add_new_element = TRUE; + $this->add_new_id = $_GET['Add_Object_Top_ID']; + $this->add_above_below = "above"; + } + + if(isset($_GET['Add_Object_Bottom_ID'])){ + $this->add_new_element = TRUE; + $this->add_new_id = $_GET['Add_Object_Bottom_ID']; + $this->add_above_below = "below"; + } + + if(isset($_GET['Remove_Object_ID'])){ + $found_id = -1; + foreach($this->current_handler->tree_->pap as $key => $element){ + if($element->object_id == $_GET['Remove_Object_ID']){ + $found_id = $key; + } + } + if($found_id != -1 ){ + $this->current_handler->tree_->remove_object($found_id); + } + } + + if(isset($_GET['Move_Up_Object_ID'])){ + $found_id = -1; + foreach($this->current_handler->tree_->pap as $key => $element){ + if($element->object_id == $_GET['Move_Up_Object_ID']){ + $found_id = $key; + } + } + if($found_id != -1 ){ + $this->current_handler->tree_->move_up_down($found_id,"up"); + } + } + + if(isset($_GET['Move_Down_Object_ID'])){ + $found_id = -1; + foreach($this->current_handler->tree_->pap as $key => $element){ + if($element->object_id == $_GET['Move_Down_Object_ID']){ + $found_id = $key; + } + } + if($found_id != -1 ){ + $this->current_handler->tree_->move_up_down($found_id,"down"); + } + } + + + /* Check if there is an add object requested + */ + $data = $this->current_handler->tree_->pap; + $once = TRUE; + foreach($_POST as $name => $value){ + foreach($data as $key => $obj){ + if(isset($obj->object_id) && preg_match("/^Add_Object_Top_".$obj->object_id."_/",$name) && $once){ + $once = FALSE; + $this->add_new_element = TRUE; + $this->add_new_id = $obj->object_id; + $this->add_above_below = "above"; + } + if(isset($obj->object_id) && preg_match("/^Add_Object_Bottom_".$obj->object_id."_/",$name) && $once){ + $once = FALSE; + $this->add_new_element = TRUE; + $this->add_new_id = $obj->object_id; + $this->add_above_below = "below"; + } + + if(isset($obj->object_id) && preg_match("/^Remove_Object_".$obj->object_id."_/",$name) && $once){ + $once = FALSE; + $this->current_handler->tree_->remove_object($key); + } + if(isset($obj->object_id) && preg_match("/^Move_Up_Object_".$obj->object_id."_/",$name) && $once){ + $this->current_handler->tree_->move_up_down($key,"up"); + $once = FALSE; + } + if(isset($obj->object_id) && preg_match("/^Move_Down_Object_".$obj->object_id."_/",$name) && $once){ + $this->current_handler->tree_->move_up_down($key,"down"); + $once = FALSE; + } + } + } + + /* Skip Mode changes and Parse tests + * if we are currently in a subdialog + */ + $this->current_handler->save_object(); + $Mode = $this->scripts[$this->current_script]['MODE']; + $skip_mode_change = false; + if(in_array($Mode,array("Source-Only","Source"))){ + if(isset($_POST['script_contents'])){ + $sc = stripslashes($_POST['script_contents']); + $this->scripts[$this->current_script]['SCRIPT'] = $sc; + $p = new My_Parser($this); + if($p -> parse($sc)){ + $this->Script_Error = ""; + } else { + $this->Script_Error = $p->status_text; + $skip_mode_change = TRUE; + } + } + } + if(in_array($Mode,array("Structured"))){ + $sc = $this->current_handler->get_sieve_script(); + $this->scripts[$this->current_script]['SCRIPT'] = $sc; + $p = new My_Parser($this); + if($p -> parse($sc)){ + $this->Script_Error = ""; + } else { + $this->Script_Error = $p->status_text; + $skip_mode_change = TRUE; + } + } + if(!$skip_mode_change){ + if($this->scripts[$this->current_script]['MODE'] != "Source-Only"){ + $old_mode = $this->scripts[$this->current_script]['MODE']; + if(isset($_POST['View_Source'])){ + $this->scripts[$this->current_script]['MODE'] = "Source"; + } + if(isset($_POST['View_Structured'])){ + $this->scripts[$this->current_script]['MODE'] = "Structured"; + } + $new_mode = $this->scripts[$this->current_script]['MODE']; + + if($old_mode != $new_mode){ + + $sc = $this->scripts[$this->current_script]['SCRIPT']; + $p = new My_Parser($this); + + if($p -> parse($sc)){ + $this->current_handler->parse($sc); + $this->Script_Error = ""; + } else { + $this->Script_Error = $p->status_text; + } + } + } + } } } - - function save() + + function get_used_script_names() { - /* Connect to sieve class and try to get all available sieve scripts */ - $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer]; + $ret = array(); + foreach($this->scripts as $script){ + $ret[] = $script['NAME']; + } + return($ret); + } - $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; + + function save() + { + /* Get sieve */ + if(!$this->sieve_handle = $this->get_sieve()){ + print_red( + sprintf( + _("Can't log into SIEVE server. Server says '%s'."), + to_string($this->Sieve_Error))); } $everything_went_fine = TRUE; foreach($this->scripts as $key => $script){ if($script['EDITED']){ - $data = $script['PARSER']->get_sieve_script(); - if(!$this->sieve_handle->sieve_sendscript($script['NAME'], $data)){ + $data = $this->scripts[$key]['SCRIPT']; + if(!$this->sieve_handle->sieve_sendscript($script['NAME'], addcslashes ($data,"\\"))){ gosa_log("Failed to save sieve script named '".$script['NAME']."': ".to_string($this->sieve_handle->error_raw)); $everything_went_fine = FALSE; print_red(to_string($this->sieve_handle->error_raw)); - $this->scripts[$key]['STATUS'] = "". + $this->scripts[$key]['MSG'] = "". _("Failed to save sieve script").": ". to_string($this->sieve_handle->error_raw). "";