aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-10-26 08:44:44 +0300
committerValentin Popov <info@valentineus.link>2017-10-26 08:44:44 +0300
commit18a5d23d07628ba63d4256e02fb71a8fd7bad7bb (patch)
treec9728c459eb6b0aaede918eb322bab629d458107
parentf43b3f2fd38ac7b80cd1762ffac4bd1d8f3a6f77 (diff)
downloadlocal_webhooks-18a5d23d07628ba63d4256e02fb71a8fd7bad7bb.tar.xz
local_webhooks-18a5d23d07628ba63d4256e02fb71a8fd7bad7bb.zip
Correction of transmitted parameters
-rw-r--r--classes/events.php4
-rw-r--r--classes/forms.php2
-rw-r--r--editservice.php4
3 files changed, 4 insertions, 6 deletions
diff --git a/classes/events.php b/classes/events.php
index 7fbe343..613ac9d 100644
--- a/classes/events.php
+++ b/classes/events.php
@@ -74,7 +74,9 @@ class events {
*/
private static function handler_callback($data, $callback) {
if ($callback->enable) {
- $events = unserialize(gzuncompress(base64_decode($callback->events)));
+ if (!empty($callback->events)) {
+ $events = unserialize(gzuncompress(base64_decode($callback->events)));
+ }
if (boolval($events[$data["eventname"]])) {
/* Adding to the data token */
diff --git a/classes/forms.php b/classes/forms.php
index e0267ce..6fb9972 100644
--- a/classes/forms.php
+++ b/classes/forms.php
@@ -81,7 +81,7 @@ class service_edit_form extends moodleform {
$mform->addRule("url", null, "required");
/* Enabling the service */
- $mform->addElement("checkbox", "enable",
+ $mform->addElement("advcheckbox", "enable",
new lang_string("enable", "moodle"));
$mform->setType("enable", PARAM_BOOL);
$mform->setDefault("enable", 1);
diff --git a/editservice.php b/editservice.php
index 7ed7468..e9f2918 100644
--- a/editservice.php
+++ b/editservice.php
@@ -59,10 +59,6 @@ if ($idediting = boolval($idservice)) {
/* Processing of received data */
if ($data = $mform->get_data()) {
- if (empty($data->enable)) {
- $data->enable = 0;
- }
-
/* Packing of data */
if (!empty($data->events)) {
$data->events = base64_encode(gzcompress(serialize($data->events), 9));