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

Merge branch '5591-remove-warnings' into 'master'

fix shooker warnings

See merge request !40
parents 58f91bc3 e1cd9021
No related branches found
No related tags found
1 merge request!40fix shooker warnings
Pipeline #1086 passed
...@@ -42,14 +42,16 @@ class messenger { ...@@ -42,14 +42,16 @@ class messenger {
} }
/** /**
* send an email if _aCfg['email'] exists * send an email if _aCfg['email']['to'] exists
*/ */
private function _sendEmail(){ private function _sendEmail(){
if (array_key_exists('email', $this->_aCfg) && array_key_exists('to', $this->_aCfg['email']) if (isset($this->_aCfg['email']['to']) && $this->_aCfg['email']['to']) {
) {
preg_match('/^(.*)\n/', $this->_sMessage, $aTmp); preg_match('/^(.*)\n/', $this->_sMessage, $aTmp);
$sSubject = $aTmp[0]; $sSubject = $aTmp[0];
return 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" "Reply-To: " . $this->_aCfg['email']['from'] . "\r\n"
); );
} }
...@@ -57,15 +59,15 @@ class messenger { ...@@ -57,15 +59,15 @@ class messenger {
} }
/** /**
* send a message to slack if _aCfg['slack'] exists * send a message to slack if _aCfg['slack']['incomingurl'] exists
*/ */
private function _sendToSlack(){ private function _sendToSlack(){
if (array_key_exists('slack', $this->_aCfg)) { if (isset($this->_aCfg['slack']['incomingurl']) && $this->_aCfg['slack']['incomingurl']) {
require_once(__DIR__ . '/../../vendor/shooker/shooker.php'); require_once(__DIR__ . '/../../vendor/shooker/shooker.php');
$shkr = new Shooker(); $shkr = new Shooker();
$shkr->setupIncoming($this->_aCfg['slack']['incomingurl']); $shkr->setupIncoming($this->_aCfg['slack']['incomingurl']);
$sUser=(array_key_exists('user', $this->_aCfg['slack'])? $this->_aCfg['slack']['user']: false); $sUser=(isset($this->_aCfg['slack']['user'])? $this->_aCfg['slack']['user']: false);
$sIcon=(array_key_exists('icon', $this->_aCfg['slack'])? $this->_aCfg['slack']['icon']: false); $sIcon=(isset($this->_aCfg['slack']['icon'])? $this->_aCfg['slack']['icon']: false);
return $shkr->sendMessage($this->_sMessage, $sUser, $sIcon); return $shkr->sendMessage($this->_sMessage, $sUser, $sIcon);
} }
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment