2017-11-24 00:09:36 +01:00
<? php
2018-11-25 18:33:25 +01:00
require_once ( "libs/parsedown/Parsedown.php" );
2017-11-24 00:09:36 +01:00
if ( ! file_exists ( "config.php" ))
{
2020-05-23 17:03:08 +02:00
require_once ( "template.php" );
2018-01-18 22:57:12 +01:00
require_once ( "install.php" );
2018-11-25 18:33:25 +01:00
} 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 20:20:51 +02:00
2018-11-25 18:33:25 +01:00
switch ( $_GET [ 'do' ]) {
case 'subscriptions' :
require_once ( "subscriptions.php" );
break ;
case 'email_subscription' :
case 'manage' :
2020-06-16 20:20:51 +02:00
case 'unsubscribe' ;
2018-11-25 18:33:25 +01:00
require_once ( "email_subscriptions.php" );
break ;
default :
2020-06-16 20:20:51 +02:00
// TODO : How to handle url invalid/unknown [do] commands
2018-11-25 18:33:25 +01:00
header ( 'Location: index.php' );
break ;
2018-06-07 13:56:05 +02:00
}
2018-11-25 18:33:25 +01:00
} else {
2017-11-24 00:09:36 +01:00
2018-01-18 22:57:12 +01:00
require_once ( "config.php" );
2018-11-25 18:33:25 +01:00
require_once ( "template.php" );
2018-01-18 22:57:12 +01:00
require_once ( "classes/constellation.php" );
2020-08-16 22:16:45 +03:00
require_once ( "classes/db-class.php" );
2020-08-16 22:31:33 +03:00
$db = new SSDB ();
2020-08-16 22:34:59 +03: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-24 00:09:36 +01: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 13:21:35 +02:00
if ( isset ( $_GET [ 'subscriber_logout' ])){
setcookie ( 'tg_user' , '' );
2018-11-25 18:33:25 +01:00
setcookie ( 'referer' , '' , time () - 3600 );
$_SESSION [ 'subscriber_valid' ] = false ;
unset ( $_SESSION [ 'subscriber_userid' ]);
unset ( $_SESSION [ 'subscriber_typeid' ]);
unset ( $_SESSION [ 'subscriber_id' ]);
2018-06-07 13:21:35 +02:00
header ( 'Location: index.php' );
}
2020-08-16 21:55:01 +03:00
$versionfile = fopen ( "versionfile" , "r" ) or die ( "Unable to open version file!" );
$appversion = fread ( $versionfile , filesize ( "versionfile" ));
fclose ( $versionfile );
2020-08-16 22:29:42 +03:00
if ( $db -> getSetting ( $mysqli , "dbConfigVersion" ) != $appversion ){
die ( "Database needs to be updated. Please update the database and try again. App Version: '" . $appversion . "' DB Settings Version: '" . $db -> getSetting ( $mysqli , "dbConfigVersion" ) . "'." );
}
2018-01-07 20:39:10 +01:00
Template :: render_header ( "Status" );
2017-11-24 00:09:36 +01:00
?>
<div class="text-center">
2017-12-31 02:26:04 +01:00
<h2><?php echo _("Current status");?></h2>
2017-11-24 00:09:36 +01:00
</div>
<div id="current">
2020-06-16 20:20:51 +02:00
<?php $constellation->render_status();?>
2017-11-24 00:09:36 +01:00
</div>
<?php if ($mysqli->query("SELECT count(*) FROM status")->num_rows)
2020-06-16 20:20:51 +02:00
{
2017-11-24 00:09:36 +01: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 20:20:51 +02:00
<?php }
2017-11-24 00:09:36 +01:00
2018-01-07 20:39:10 +01:00
Template::render_footer();
2020-06-16 20:20:51 +02:00
}