Maintenance Mode is disabled on this site"; } return $desc; } public function getName() { return "MaintenanceMode"; } public function getUUID() { return "6dmaa392-7b14-44fb-aa33-51cba620d92e"; } public function getPluginVersion() { return "2.0"; } public function getStart() { global $global, $config; if ($this->shouldEnterInMaintenencaMode()) { header('HTTP/1.0 403 Forbidden'); $obj = $this->getDataObject(); if (isContentTypeJson()) { header("Content-Type: application/json"); $resp = new stdClass(); $resp->error = true; $resp->msg = $obj->text; $resp->MaintenanceMode = true; echo (json_encode($resp)); } else if (isContentTypeXML()) { header("Content-Type: application/xml"); echo ' true ' . $obj->text . ' true '; } else { include $global['systemRootPath'] . 'plugin/MaintenanceMode/index.php'; } exit; } } public function shouldEnterInMaintenencaMode() { global $global, $config; $obj = $this->getDataObject(); if (!empty($obj->stopFeed)) { if (preg_match('/feed/i', $_SERVER["SCRIPT_FILENAME"])) { return true; } } $forbidden = array( $global['systemRootPath'] . 'view' . DIRECTORY_SEPARATOR . 'index.php', $global['systemRootPath'] . 'view' . DIRECTORY_SEPARATOR . 'channels.php', $global['systemRootPath'] . 'view' . DIRECTORY_SEPARATOR . 'channel.php', $global['systemRootPath'] . 'view' . DIRECTORY_SEPARATOR . 'trending.php' ); $SCRIPT_FILENAME = str_replace('/', DIRECTORY_SEPARATOR, $_SERVER["SCRIPT_FILENAME"]); //var_dump($SCRIPT_FILENAME, $forbidden);exit; if (empty($global['disableAdvancedConfigurations']) && !User::isAdmin() && in_array($SCRIPT_FILENAME, $forbidden)) { return true; } return false; } public function getEmptyDataObject() { global $global; $obj = new stdClass(); $obj->text = 'Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always contact us, otherwise we’ll be back online shortly!'; $obj->facebookLink = ''; $obj->twitterLink = ''; $obj->googleLink = ''; $obj->discordLink = ''; $obj->stopFeed = true; $obj->endIn = date("Y-m-d H:i:s", strtotime("+1 week")); $obj->hideClock = false; $obj->backgroundImageURL = $global['webSiteRootURL'] . "plugin/MaintenanceMode/images/bg01.jpg"; return $obj; } public function getFooterCode() { global $global, $config; if (!isEmbed()) { $obj = $this->getDataObject(); include $global['systemRootPath'] . 'plugin/MaintenanceMode/footer.php'; } } }