diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index 1cb7a819072fc2dcf4de7c175e055f889d6c2544..d3ba4ac8ce4502978f720f4417d7e2eb00000f99 100644 (file)
$this->o_sock->setEncryptionKey($this->s_encryption_key);
$this->is_connected = TRUE;
}else{
- $this->s_error = $this->o_sock->get_error();
- $this->b_error = TRUE;
+ $this->set_error($this->o_sock->get_error());
$this->disconnect();
}
return($this->is_connected);
}
+ /*! \brief Sets an error message, which can be returned with get_error().
+ @param string The Error message,
+ */
+ private function reset_error()
+ {
+ $this->b_error = FALSE;
+ $this->s_error = "";
+ }
+
+
/*! \brief Checks if an error occured.
@return boolean returns TRUE or FALSE, whether there is an error or not.
*/
*/
public function get_error()
{
- return($this->s_error);
+ $str = $this->s_error;
+ $str = preg_replace("/ /"," ",$str);
+ return($str);
}
*/
public function get_queued_entries($from=-1,$to=-1,$sort="timestamp DESC")
{
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
$ret = array();
$xml_msg = "<xml>
trigger_error("Requires an array as parameter.");
return;
}
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
$ret = array();
trigger_error("Requires an array as parameter.");
return;
}
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
$ret = array();
return;
}
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
+
$xml_msg = "<xml>
<header>gosa_query_jobdb</header>
<target>GOSA</target>
trigger_error("Requires an integer as parameter.");
return;
}
+ $this->reset_error();
- $this->b_error = FALSE;
- $this->s_error = "";
$ret = array();
$xml_msg = "<xml>
<header>gosa_query_jobdb</header>
trigger_error("Requires an array as parameter.");
return;
}
- $this->b_error = FALSE;
- $this->s_error = "";
+
+ $this->reset_error();
$ret = array();
$xml_msg .= "</clause>
</where>
</xml>";
- $this->b_error = FALSE;
- $this->s_error = "";
if($this->connect()){
$this->o_sock->write($xml_msg);
*/
public function remove_entry($id)
{
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
$xml_msg = "<xml>
<header>gosa_delete_jobdb_entry</header>
*/
public function update_entries($ids,$entry)
{
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
if(!is_array($ids)){
trigger_error("Requires an array as first parameter.");
return;
}
+ public function send_data($header, $to, $data= array(), $answer_expected = FALSE)
+ {
+ $xml_message= "";
+
+ /* Prepare data */
+ foreach ($data as $key => $value){
+ $xml_message.= "<$key>$value</$key>";
+ }
+
+ /* Multiple targets? */
+ if (!is_array($to)){
+ $to_targets= array($to);
+ } else {
+ $to_targets= $to;
+ }
+
+ /* Build target strings */
+ $target ="";
+ foreach($to_targets as $to){
+ $target.= "<target>$to</target>";
+ }
+
+ return $this->_send("<xml><header>$header</header><source>GOSA</source>$target".$xml_message."</xml>",$answer_expected);
+ }
+
+
/*! \brief Returns an array containing all queued entries.
@return Array All queued entries as an array.
*/
public function _send($data, $answer_expected= FALSE)
{
- $this->b_error = FALSE;
- $this->s_error = "";
+ $this->reset_error();
$ret = array();
if($this->connect()){