diff --git a/auth.php b/auth.php index c43863f..c1fbf7c 100644 --- a/auth.php +++ b/auth.php @@ -53,7 +53,7 @@ class auth_plugin_outage extends auth_plugin_base /** * Login page hook. */ - function loginpage_hook() { + public function loginpage_hook() { \auth_outage\outagelib::initialize(); } } diff --git a/classes/models/outage.php b/classes/models/outage.php index a610c5e..c023c6f 100644 --- a/classes/models/outage.php +++ b/classes/models/outage.php @@ -86,8 +86,8 @@ class outage { outagelib::data2object($data, $this); // FIXME types are wrong. Is this behaving as expected? - foreach (['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warningduration'] - as $f) { + $fields = ['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warningduration']; + foreach ($fields as $f) { $this->$f = ($this->$f === null) ? null : (int)$this->$f; } diff --git a/classes/outagedb.php b/classes/outagedb.php index 3990d9b..946f156 100644 --- a/classes/outagedb.php +++ b/classes/outagedb.php @@ -164,8 +164,7 @@ final class outagedb { FROM {auth_outage} WHERE (starttime - warningduration <= :now1 AND stoptime >= :now2) ORDER BY starttime ASC, stoptime DESC, title ASC - LIMIT 1 - ', + LIMIT 1', ['now1' => $now, 'now2' => $now] ); diff --git a/classes/outagelib.php b/classes/outagelib.php index 0e1492a..83b34dc 100644 --- a/classes/outagelib.php +++ b/classes/outagelib.php @@ -64,7 +64,9 @@ class outagelib { } self::$initialized = true; - if (($active = outagedb::getactive()) == null) return; + if (($active = outagedb::getactive()) == null) { + return; + } $CFG->additionalhtmltopofbody .= self::get_renderer()->renderbar($active); }