diff --git a/.gitignore b/.gitignore index 7ac59805..abc62ecc 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ __MACOSX/ .buildpath .settings/ /.vscode +/.vs diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 85e11b3c..a879d74f 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -1087,7 +1087,7 @@ namespace { * Send Webhook * * @return bool|string - * @var array $replacements an array of the replacements + * @var array $replacements should be an array of key value as strings where key is the placeholder name to replace in json template with the value * */ @@ -1096,8 +1096,13 @@ namespace { $error = ""; $success = 1; + $jsonMessage = $this->json; + $replacements['#message'] = $this->stripTagsFromMessage($replacements['#message']); - $jsonMessage = strtr($this->json, $replacements); + + foreach($replacements as $key => $val) { + $jsonMessage = str_replace($key, $val, $jsonMessage); + } $curl = curl_init($this->url); curl_setopt($curl, CURLOPT_POST, 1); diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index 5285ea70..b86931b2 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -470,7 +470,7 @@ class ConfigController extends AbstractController $webhook = psm_build_webhook(); $webhook->setUrl($user->webhook_url); $webhook->setJson($user->webhook_json); - $message = (psm_get_lang('config', 'test_message')); + $message = ['#message' => (psm_get_lang('config', 'test_message'))]; $result = $webhook->sendWebhook($message); if ($result==1) { $this->addMessage(psm_get_lang('config', 'webhook_sent'), 'success'); diff --git a/src/psm/Util/Server/Updater/StatusNotifier.php b/src/psm/Util/Server/Updater/StatusNotifier.php index 6951efea..e21b1acb 100644 --- a/src/psm/Util/Server/Updater/StatusNotifier.php +++ b/src/psm/Util/Server/Updater/StatusNotifier.php @@ -424,10 +424,12 @@ class StatusNotifier psm_parse_msg($this->status_new, 'email_subject', $this->server); $mail->Priority = 1; + $publicUrl = PSM_BASE_URL.'/public.php'; + $body = key_exists('message', $combi) ? $combi['message'] : psm_parse_msg($this->status_new, 'email_body', $this->server); - if ((bool)psm_get_conf('email_add_url')) $body .= PHP_EOL.PHP_EOL.''.PSM_BASE_URL.''; + if ((bool)psm_get_conf('email_add_url')) $body .= PHP_EOL.PHP_EOL.''.$publicUrl.''; $mail->Body = $body; $mail->AltBody = str_replace('
', "\n", $body); @@ -609,6 +611,7 @@ class StatusNotifier } $webhook = psm_build_webhook(); + $subject = key_exists('subject', $combi) ? $combi['subject'] : psm_parse_msg($this->status_new, 'email_subject', $this->server); $message = key_exists('message', $combi) ? $combi['message'] : @@ -638,7 +641,8 @@ class StatusNotifier '#server_label' => $this->server['label'], '#server_error' => $this->server['error'], '#server_last_offline_duration' => $this->status_new ? $this->server['last_offline_duration'] : '', - '#status' => $this->status_new ? 'online' : 'offline' + '#status' => $this->status_new ? 'online' : 'offline', + '#subject' => $subject ]); } } diff --git a/src/templates/default/main/body.tpl.html b/src/templates/default/main/body.tpl.html index 31b96f98..516e3f47 100644 --- a/src/templates/default/main/body.tpl.html +++ b/src/templates/default/main/body.tpl.html @@ -16,7 +16,7 @@ - + @@ -24,8 +24,9 @@ + diff --git a/src/templates/default/static/css/custom.css b/src/templates/default/static/css/custom.css new file mode 100644 index 00000000..12da06f6 --- /dev/null +++ b/src/templates/default/static/css/custom.css @@ -0,0 +1,4 @@ +/*# Used to override main styles for custom layout adjustments and colors. */ +.container-fluid { + max-width: 100%; +} \ No newline at end of file