Skip to content
Snippets Groups Projects
Commit 00d6215e authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

ci webGui - messenger add php doc and make a bit "nicer"

parent 33c1eef5
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,11 @@ class messenger {
*/
protected $_aCfg = array();
protected $sMessage = '';
/**
* content of messagetext to send
* @var string
*/
protected $_sMessage = '';
/**
*
......@@ -43,13 +47,13 @@ class messenger {
private function _sendEmail(){
if (array_key_exists('email', $this->_aCfg) && array_key_exists('to', $this->_aCfg['email'])
) {
preg_match('/^(.*)\n/', $this->sMessage, $aTmp);
preg_match('/^(.*)\n/', $this->_sMessage, $aTmp);
$sSubject = $aTmp[0];
mail($this->_aCfg['email']['to'], $sSubject, $this->sMessage, "From: " . $this->_aCfg['email']['from'] . "\r\n" .
return mail($this->_aCfg['email']['to'], $sSubject, $this->_sMessage, "From: " . $this->_aCfg['email']['from'] . "\r\n" .
"Reply-To: " . $this->_aCfg['email']['from'] . "\r\n"
);
}
return false;
}
/**
......@@ -62,8 +66,9 @@ class messenger {
$shkr->setupIncoming($this->_aCfg['slack']['incomingurl']);
$sUser=(array_key_exists('user', $this->_aCfg['slack'])? $this->_aCfg['slack']['user']: false);
$sIcon=(array_key_exists('icon', $this->_aCfg['slack'])? $this->_aCfg['slack']['icon']: false);
$shkr->sendMessage($this->sMessage, $sUser, $sIcon);
return $shkr->sendMessage($this->_sMessage, $sUser, $sIcon);
}
return false;
}
......@@ -72,7 +77,7 @@ class messenger {
* @param string $sMessage
*/
public function sendMessage($sMessage) {
$this->sMessage=$sMessage;
$this->_sMessage=$sMessage;
// echo '<pre>'.print_r($this->_aCfg, 1).'</pre>'.$sMessage.'<br>';
$this->_sendEmail();
$this->_sendToSlack();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment