FreeSTAR-Status-Engine/index.php

112 lines
3.9 KiB
PHP
Raw Normal View History

2017-11-23 18:09:36 -05:00
<?php
require_once("libs/parsedown/Parsedown.php");
2017-11-23 18:09:36 -05:00
if (!file_exists("config.php"))
{
2020-05-23 11:03:08 -04:00
require_once("template.php");
require_once("install.php");
} elseif(isset($_GET['do'])) { // we can add other actions with $_GET['do'] later.
// Fix for translation via _(). We need config.php first...
require_once("config.php");
require_once("template.php");
2020-06-16 14:20:51 -04:00
switch ($_GET['do']) {
case 'subscriptions':
require_once("subscriptions.php");
break;
case 'email_subscription':
case 'manage':
2020-06-16 14:20:51 -04:00
case 'unsubscribe';
require_once("email_subscriptions.php");
break;
default:
2020-06-16 14:20:51 -04:00
// TODO : How to handle url invalid/unknown [do] commands
header('Location: index.php');
break;
2018-06-07 07:56:05 -04:00
}
} else {
2017-11-23 18:09:36 -05:00
require_once("config.php");
require_once("template.php");
require_once("classes/constellation.php");
2020-08-16 15:16:45 -04:00
require_once("classes/db-class.php");
2020-08-16 15:31:33 -04:00
$db = new SSDB();
2020-08-16 15:34:59 -04:00
define("NAME", $db->getSetting($mysqli,"name"));
define("TITLE", $db->getSetting($mysqli,"title"));
define("WEB_URL", $db->getSetting($mysqli,"url"));
define("MAILER_NAME", $db->getSetting($mysqli,"mailer"));
define("MAILER_ADDRESS", $db->getSetting($mysqli,"mailer_email"));
2017-11-23 18:09:36 -05:00
$offset = 0;
if (isset($_GET['ajax']))
{
$constellation->render_incidents(false,$_GET['offset'],5);
exit();
}else if (isset($_GET['offset']))
{
$offset = $_GET['offset'];
}
2018-06-07 07:21:35 -04:00
if (isset($_GET['subscriber_logout'])){
setcookie('tg_user', '');
setcookie('referer', '', time() - 3600);
$_SESSION['subscriber_valid'] = false;
unset($_SESSION['subscriber_userid']);
unset($_SESSION['subscriber_typeid']);
unset($_SESSION['subscriber_id']);
2018-06-07 07:21:35 -04:00
header('Location: index.php');
}
2020-08-16 14:55:01 -04:00
$versionfile = fopen("versionfile", "r") or die("Unable to open version file!");
$appversion = fread($versionfile,filesize("versionfile"));
fclose($versionfile);
2020-08-16 17:29:33 -04:00
if($db->getSetting($mysqli,"dbConfigVersion") != trim($appversion)){
2020-08-16 15:29:42 -04:00
die("Database needs to be updated. Please update the database and try again. App Version: '".$appversion."' DB Settings Version: '".$db->getSetting($mysqli,"dbConfigVersion")."'.");
}
2020-08-16 17:03:58 -04:00
$useedf = fopen("updateseed", "r") or die("Unable to open updateseed file!");
2020-08-16 17:31:57 -04:00
$useed = fread($useedf,filesize("updateseed"));
2020-08-16 17:03:58 -04:00
fclose($useedf);
2020-08-16 17:29:33 -04:00
if(trim($useed) == "stable"){
2020-08-16 17:33:22 -04:00
$remoteversion = file_get_contents("https://skyfallenhosted.ml/serverstatus/versionauthority/stable/version");
$remotedl = file_get_contents("https://skyfallenhosted.ml/serverstatus/versionauthority/stable/dl");
2020-08-16 17:03:58 -04:00
}
2020-08-16 17:29:33 -04:00
if(trim($useed) == "beta"){
2020-08-16 17:33:22 -04:00
$remoteversion = file_get_contents("https://skyfallenhosted.ml/serverstatus/versionauthority/beta/version");
$remotedl = file_get_contents("https://skyfallenhosted.ml/serverstatus/versionauthority/beta/dl");
2020-08-16 17:03:58 -04:00
}
2020-08-16 17:35:41 -04:00
if($db->getSetting($mysqli,"notifyUpdates") == "yes"){
2020-08-16 17:29:33 -04:00
if(trim($remoteversion) != trim($appversion)){
2020-08-16 17:41:42 -04:00
die("Your installation is not upp to date! Download the new update from: '".$remotedl."' Your version is:'".$appversion."' Remote Authority Version is:'".$remoteversion."' Your Update Seed is:'".$useed."' Remote Package Authority is Skyfallen. <br>If you cannot access Remote Authority, please check status.theskyfallen.com and skyfallenhosted.ml manually.");
2020-08-16 17:03:58 -04:00
}
}
Template::render_header("Status");
2017-11-23 18:09:36 -05:00
?>
<div class="text-center">
<h2><?php echo _("Current status");?></h2>
2017-11-23 18:09:36 -05:00
</div>
<div id="current">
2020-06-16 14:20:51 -04:00
<?php $constellation->render_status();?>
2017-11-23 18:09:36 -05:00
</div>
<?php if ($mysqli->query("SELECT count(*) FROM status")->num_rows)
2020-06-16 14:20:51 -04:00
{
2017-11-23 18:09:36 -05:00
?>
<div id="timeline">
<div class="item">
<div class="timeline">
<div class="line text-muted"></div>
<?php
$constellation->render_incidents(true,$offset);
$constellation->render_incidents(false,$offset);
?>
</div>
</div>
</div>
2020-06-16 14:20:51 -04:00
<?php }
2017-11-23 18:09:36 -05:00
Template::render_footer();
2020-06-16 14:20:51 -04:00
}