Compare commits
36 Commits
2.0.0-BETA
...
master
Author | SHA1 | Date |
---|---|---|
Vojtěch Sajdl | b2baa5051b | |
Sejin Kim | 9951c22d07 | |
Sejin Kim | 2d65d0f9df | |
Vojtěch Sajdl | c9bcbc241b | |
Vojtěch Sajdl | 184f803d6e | |
Steffen Mueller | 002bb13e10 | |
Yigit Kerem Oktay | 9d3d14f67c | |
Steffen Mueller | 58b375161d | |
Yigit Kerem Oktay | f33bf996c6 | |
Yigit Kerem Oktay | 3e706233a4 | |
Yigit Kerem Oktay | 1408d0ad91 | |
Yiğit Kerem Oktay | 8007097d2f | |
Yiğit Kerem Oktay | 85dfce55c8 | |
Yiğit Kerem Oktay | 75bdde26b3 | |
Yiğit Kerem Oktay | 3939fca1f7 | |
Yigit Kerem Oktay | 96f79ee725 | |
Yiğit Kerem Oktay | 8d571547f5 | |
Yigit Kerem Oktay | 46c0b55779 | |
Yiğit Kerem Oktay | 18b89e8c35 | |
Yiğit Kerem Oktay | e96df7015e | |
Thomas Nilsen | 505d802c2e | |
Yiğit Kerem Oktay | 3edfd9dbe2 | |
thnilsen | 887a197033 | |
Vojtěch Sajdl | 81132e9ccf | |
Sejin Kim | af62f9f49d | |
Yiğit Kerem Oktay | e2b331a039 | |
Yiğit Kerem Oktay | 671004579c | |
Yiğit Kerem Oktay | 38fcabdbb4 | |
Vojtěch Sajdl | f7ad9ac6b1 | |
Vojtěch Sajdl | 9963e1f834 | |
Richard Schwab | ff06a320b0 | |
Yiğit Kerem Oktay | 3c540496d4 | |
Yiğit Kerem Oktay | e09d02cf2e | |
Vojtěch Sajdl | 14015d4666 | |
Yiğit Kerem Oktay | b3a1bfeb0e | |
Yiğit Kerem Oktay | 1573b062b5 |
|
@ -0,0 +1,4 @@
|
|||
config.php
|
||||
.idea/
|
||||
.vscode/
|
||||
.code/
|
12
README.md
12
README.md
|
@ -1,19 +1,19 @@
|
|||
# Server Status Beta (Official)
|
||||
## This is the official beta fork of Server Status by the contributors.
|
||||
# Server Status (Official)
|
||||
## This is the official Server Status Project.
|
||||
![License](https://img.shields.io/github/license/Pryx/server-status.svg) ![Current release](https://img.shields.io/badge/version-2-blue)
|
||||
![Beta-Build](https://img.shields.io/badge/latest_beta-Developmet_Beta_7-black)
|
||||
![Beta-Stability](https://img.shields.io/badge/Beta_Stability-Fully_Stable_with_Visual_Imperfections-red)
|
||||
![Stability](https://img.shields.io/badge/master_stability-Stable-red)
|
||||
![Build](https://img.shields.io/badge/build-success-green)
|
||||
|
||||
<!--
|
||||
## What does **contributor beta** mean?
|
||||
It means the beta that is heavily unstable that is meant for contributors to make changes and use as a recovery point.
|
||||
### Other Beta Type
|
||||
### Other Beta Types
|
||||
#### Development Beta
|
||||
##### This beta has some bugs that are noticeable and is sometimes unstable. Best for new contributors
|
||||
#### Public Beta
|
||||
##### This beta has some bugs that are not really noticeable and mostly exist as bugs. Best for trying the new features before updating!
|
||||
Very simple server status page written in PHP that can run on **PHP 5.4+** - even on **shared webhosting** even without shell access. Because why waste your money on another server (or host on a server that you might want to do maintenance on), when you can use cheap webhosting? And as a cherry on top - it works even without javascript!
|
||||
-->
|
||||
Very simple server status page written in PHP that can run on **PHP 5.5+** - even on **shared webhosting** even without shell access. Because why waste your money on another server (or host on a server that you might want to do maintenance on), when you can use cheap webhosting? And as a cherry on top - it works even without javascript!
|
||||
|
||||
## How do I install this thing?
|
||||
Simply put the files on your server and access it from your browser. There will be a simple install dialog waiting for you.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Only the latest version of server-status is being supported. Older versions won't recieve security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you believe that you have have discovered a vulnerability you can report it by emailing the [lead maintainer](https://github.com/Pryx) at vojtech@sajdl.com.
|
||||
|
||||
Please include the keyword VULNERABILITY and the repository name in the subject of the email.
|
||||
|
||||
In the email, please describe your findings, the project versions you tested and were affected by the vulnerability and also include the full steps to reproduce it.
|
||||
We appreciate your efforts to make server-status more secure and will try to do everytihing in our power to get the issues resolved as fast as possible. We will
|
||||
keep you informed of the progress towards a fix.
|
|
@ -15,26 +15,25 @@ else{
|
|||
$array = $constellation->render_status(true, false);
|
||||
echo json_encode($array);
|
||||
}else{
|
||||
$query = $mysqli->prepare("SELECT name FROM services WHERE id=?");
|
||||
$query->bind_param("i", $_GET['id']);
|
||||
$query->execute();
|
||||
$result = $query->get_result()->fetch_assoc();
|
||||
// get id of service, check if service exists
|
||||
$queryId = $mysqli->prepare("SELECT id from services where id = ?;");
|
||||
$queryId->bind_param("i", $_GET['id']);
|
||||
$queryId->execute();
|
||||
$result = $queryId->get_result()->fetch_assoc();
|
||||
if (!count($result))
|
||||
{
|
||||
die(json_encode(["error" => _("Service does not exist!")]));
|
||||
}
|
||||
|
||||
$sql = $mysqli->prepare("SELECT type FROM services_status INNER JOIN status ON services_status.status_id = status.id WHERE service_id = ? AND `time` <= ? AND (`end_time` >= ? OR `end_time`=0) ORDER BY `time` DESC LIMIT 1");
|
||||
|
||||
$sql->bind_param("iii", $id, $timestamp, $timestamp);
|
||||
$sql->execute();
|
||||
$tmp = $sql->get_result();
|
||||
if ($tmp->num_rows)
|
||||
{
|
||||
$service = new Service($_GET['id'], $result['name'], $tmp->fetch_assoc()['type']);
|
||||
}
|
||||
else{
|
||||
$service = new Service($_GET['id'], $result['name']);
|
||||
// get name, description and status.type (status of service) by id
|
||||
$query = $mysqli->prepare("select services.id, name, description, status.type from services inner join status on status.id = services.id where services.id = ?;");
|
||||
$query->bind_param("i", $_GET['id']);
|
||||
$query->execute();
|
||||
$result = $query->get_result()->fetch_assoc();
|
||||
// if type is a number then return it, else just return the service name/desc
|
||||
if (is_numeric($result["type"])) {
|
||||
$service = new Service($_GET["id"], $result["name"], $result["description"], '', $result["type"]);
|
||||
} else {
|
||||
$service = new Service($_GET["id"], $result["name"], $result["description"]);
|
||||
}
|
||||
|
||||
echo json_encode($service);
|
||||
|
|
|
@ -72,7 +72,8 @@ class Constellation
|
|||
public function render_status($admin = false, $heading = true){
|
||||
global $mysqli;
|
||||
|
||||
$query = $mysqli->query("SELECT id, name FROM services");
|
||||
//$query = $mysqli->query("SELECT id, name, description FROM services");
|
||||
$query = $mysqli->query("SELECT services.id, services.name, services.description, services_groups.name as group_name FROM services LEFT JOIN services_groups ON services.group_id=services_groups.id ORDER BY services_groups.name ASC, services.name;");
|
||||
$array = array();
|
||||
if ($query->num_rows){
|
||||
$timestamp = time();
|
||||
|
@ -87,10 +88,10 @@ class Constellation
|
|||
$tmp = $sql->get_result();
|
||||
if ($tmp->num_rows)
|
||||
{
|
||||
$array[] = new Service($result['id'], $result['name'], $tmp->fetch_assoc()['type']);
|
||||
$array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name'], $tmp->fetch_assoc()['type']);
|
||||
}
|
||||
else{
|
||||
$array[] = new Service($result['id'], $result['name']);
|
||||
$array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name']);
|
||||
}
|
||||
}
|
||||
if ($heading)
|
||||
|
@ -103,11 +104,27 @@ class Constellation
|
|||
}
|
||||
if (!$admin)
|
||||
{
|
||||
echo '<div id="status-container" class="clearfix">';
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
//echo '<div id="status-container" class="clearfix">';
|
||||
//$arrCompletedGroups = array();
|
||||
foreach($array as $service){
|
||||
//print_r($service);
|
||||
//if ( !empty($service->group_name) && !in_array($service->group_name, $arrCompletedGroups)) {
|
||||
//print $service->name;
|
||||
// $arrCompletedGroups[] = $service['group_name'];
|
||||
// $service->render(true);
|
||||
//} else {
|
||||
$service->render();
|
||||
//}
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</ul>';
|
||||
//echo '</div>';
|
||||
}
|
||||
else{
|
||||
return $array;
|
||||
|
|
|
@ -6,19 +6,24 @@ class Service implements JsonSerializable
|
|||
{
|
||||
private $id;
|
||||
private $name;
|
||||
private $description;
|
||||
private $group_name;
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* Constructs service from its data.
|
||||
* @param int $id service ID
|
||||
* @param String $name service name
|
||||
* @param String $descriotion service description for tooltip
|
||||
* @param int $status current service status
|
||||
*/
|
||||
function __construct($id, $name, $status=3)
|
||||
function __construct($id, $name, $description=null, $group_name='', $status=3)
|
||||
{
|
||||
//TODO: Maybe get data from ID?
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->group_name = $group_name;
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
|
@ -49,6 +54,15 @@ class Service implements JsonSerializable
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of this service
|
||||
* @return String description
|
||||
*/
|
||||
public function get_description()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes submitted form and adds service unless problem is encountered,
|
||||
* calling this is possible only for admin or higher rank. Also checks requirements
|
||||
|
@ -192,17 +206,56 @@ class Service implements JsonSerializable
|
|||
|
||||
/**
|
||||
* Renders this service.
|
||||
* @param $boolGroup set to true if the groups name is to be rendered
|
||||
* @return void
|
||||
*/
|
||||
public function render(){
|
||||
global $statuses;
|
||||
global $classes;
|
||||
?>
|
||||
<div class="item clearfix">
|
||||
<div class="service"><?php echo $this->name; ?></div>
|
||||
<?php if ($this->status!=-1){?><div class="status <?php echo $classes[$this->status];?>"><?php echo _($statuses[$this->status]);?></div><?php }?>
|
||||
</div>
|
||||
<?php
|
||||
static $arrCompletedGroups = array();
|
||||
//static $boolClosed;
|
||||
static $boolOpened;
|
||||
|
||||
// Check if previous ul has been opened, and if a empty/new group is being
|
||||
// render_header, close the UL first.
|
||||
if ( $boolOpened ) {
|
||||
if ( empty($this->group_name) || !in_array($this->group_name, $arrCompletedGroups) ) {
|
||||
echo '</ul>';
|
||||
$boolOpened = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If no group exist or group is new, start a new UL
|
||||
if ( !empty($this->group_name) && !in_array($this->group_name, $arrCompletedGroups)) {
|
||||
echo '<ul class="list-group components">';
|
||||
//echo '<ul class="platforms list-group mb-2">';
|
||||
// Render the group status if it exists
|
||||
echo '<li class="list-group-item list-group-item-success group-name"><span><i class="glyphicon glyphicon-plus"></i></span> ' . $this->group_name .'<div class="status '. $classes[$this->status] .'">'. _($statuses[$this->status]).'</div></li>';
|
||||
//echo '<li class="cist-group-item d-flex flex-row justify-content-between platform list-group-item-action py-0 expanded" role="button">' . $this->group_name .'<div class="status '. $classes[$this->status] .'"'. _($statuses[$this->status]).'</div></li>';
|
||||
$arrCompletedGroups[] = $this->group_name;
|
||||
$boolOpened = true;
|
||||
}
|
||||
|
||||
if ( empty($this->group_name)) {
|
||||
echo '<ul class="list-group components">';
|
||||
|
||||
// echo '<ul class="platforms list-group mb-2">';
|
||||
$boolFinish = true;
|
||||
}
|
||||
|
||||
// Render the service status
|
||||
echo '<li class="list-group-item sub-component"><strong>' . $this->name .'</strong>';
|
||||
//echo '<li class="list-group-item d-flex flex-columns justify-content-between><span>+</span><h3 class="py-2 my-0 flex-fill expanded">' . $this->name . '</h3>';
|
||||
if(!empty($this->description)) {
|
||||
echo '<a class="desc-tool-tip" data-toggle="tooltip" data-placement="top" title="'.$this->description.'"> <span><i class="glyphicon glyphicon-question-sign"></i></span></a>';
|
||||
}
|
||||
if ($this->status!=-1){?><div class="status pull-right <?php echo $classes[$this->status];?>"><?php echo _($statuses[$this->status]);?></div>
|
||||
<?php
|
||||
}
|
||||
echo '</li>';
|
||||
if ( isset($boolFinish) && $boolFinish) {
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
|
@ -210,6 +263,7 @@ class Service implements JsonSerializable
|
|||
return [
|
||||
"id" => $this->id,
|
||||
"name" => $this->name,
|
||||
"description" => $this->description,
|
||||
"status" => $this->status,
|
||||
"status_string" => $statuses[$this->status]
|
||||
];
|
||||
|
|
20
css/main.css
20
css/main.css
|
@ -27,6 +27,10 @@ a:focus {
|
|||
color:#f5f4f4;
|
||||
}
|
||||
|
||||
a.desc-tool-tip, a.desc-tool-tip:hover, a.desc-tool-tip:visited {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.centered {
|
||||
text-align: center
|
||||
}
|
||||
|
@ -60,22 +64,15 @@ a:focus {
|
|||
background: gray;
|
||||
}
|
||||
.navbar-default {
|
||||
z-index: 200;
|
||||
background-color: gray;
|
||||
border-color: transparent;
|
||||
z-index: 200;
|
||||
background-color: gray;
|
||||
border-color: transparent;
|
||||
border-radius: 0px 0px 30px 30px;
|
||||
height: 77px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.admins_color h4 {
|
||||
color: #3a72bd;
|
||||
font-weight: bold;
|
||||
|
@ -136,7 +133,7 @@ body a h1{
|
|||
.status{
|
||||
float: right;
|
||||
box-sizing: border-box;
|
||||
padding: 15px 35px;
|
||||
padding: 0px 35px;
|
||||
text-align: right;
|
||||
font-size: 1.05em;
|
||||
font-family: 'Fira Sans', sans-serif;
|
||||
|
@ -686,4 +683,3 @@ input:checked + .slider:before {
|
|||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ if (isset($_GET['subscriber_logout'])){
|
|||
unset($_SESSION['subscriber_id']);
|
||||
header('Location: index.php');
|
||||
}
|
||||
/*
|
||||
$versionfile = fopen("versionfile", "r") or die("Unable to open version file!");
|
||||
$appversion = fread($versionfile,filesize("versionfile"));
|
||||
fclose($versionfile);
|
||||
|
@ -90,6 +91,7 @@ if($db->getSetting($mysqli,"notifyUpdates") == "yes"){
|
|||
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.");
|
||||
}
|
||||
}
|
||||
*/
|
||||
Template::render_header("Status");
|
||||
?>
|
||||
<div class="text-center">
|
||||
|
|
19
install.php
19
install.php
|
@ -9,6 +9,14 @@ define("COPYRIGHT_TEXT","");
|
|||
require_once("classes/locale-negotiator.php");
|
||||
require_once("classes/db-class.php");
|
||||
|
||||
$isDeveleoperEnvironement = false;
|
||||
if(isset($_GET["isDev"])){
|
||||
if($_GET["isDev"] == "devMode"){
|
||||
$isDeveleoperEnvironement = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$negotiator = new LocaleNegotiator("en_GB");
|
||||
$message = "";
|
||||
$db = new SSDB();
|
||||
|
@ -161,11 +169,12 @@ if(isset($_POST['server']) && empty($message))
|
|||
$db->setSetting($mysqli,"google_recaptcha_secret","");
|
||||
$db->setSetting($mysqli,"google_recaptcha_sitekey","");
|
||||
$db->setSetting($mysqli,"cron_server_ip","");
|
||||
unlink("create-server-config.php");
|
||||
unlink("config.php.template");
|
||||
unlink("install.sql");
|
||||
unlink(__FILE__);
|
||||
|
||||
if(!$isDeveleoperEnvironement) {
|
||||
unlink("create-server-config.php");
|
||||
unlink("config.php.template");
|
||||
unlink("install.sql");
|
||||
unlink(__FILE__);
|
||||
}
|
||||
header("Location: ".WEB_URL);
|
||||
}
|
||||
}
|
||||
|
|
13
template.php
13
template.php
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
//This should later be translatable, maybe find a better solution?
|
||||
//This is here for better generation of POT files :)
|
||||
$statuses = array(_("Major outage"), _("Minor outage"), _("Planned maintenance"), _("Operational") );
|
||||
$classes = array("danger", "warning", "primary", "success" );
|
||||
$icons = array("fa fa-times", "fa fa-exclamation", "fa fa-info", "fa fa-check" );
|
||||
|
@ -58,9 +56,13 @@ class Template{
|
|||
<html lang="en">
|
||||
<head>
|
||||
<?php
|
||||
if(!admin){
|
||||
$headfile = fopen("head.txt", "r") or die("Unable to open head.txt!");
|
||||
$head_additionalcode = fread($versionfile,filesize("head.txt"));
|
||||
fclose($headfile); ?>
|
||||
fclose($headfile);
|
||||
echo $head_additionalcode;
|
||||
}
|
||||
?>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $page_name." - ".NAME ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
@ -174,6 +176,9 @@ class Template{
|
|||
/**
|
||||
* Renders a toggle switch
|
||||
* Created by Yigit Kerem Oktay
|
||||
* @param String $toggletext will decide what the description text next to the toggle will be
|
||||
* @param String $input_name will decide what the HTML Name attribute of the toggle will be
|
||||
* @param Boolean $checked will decide if the toggle will initially be on or off
|
||||
*/
|
||||
public static function render_toggle($toggletext,$input_name,$checked){
|
||||
?>
|
||||
|
@ -199,7 +204,7 @@ class Template{
|
|||
<div id="footerwrap">
|
||||
<div class="container">
|
||||
<div class="row centered">
|
||||
<div class="col-md-4 text-left"><a href="https://github.com/Pryx/server-status/graphs/contributors" target="_blank">Copyright © <?php echo date("Y");?> Server Status Project Contributors </a><?php if(strlen(COPYRIGHT_TEXT)>1){ echo " and ".COPYRIGHT_TEXT; } ?></div>
|
||||
<div class="col-md-4 text-left"><a href="https://github.com/server-status-project/server-status/graphs/contributors" target="_blank">Copyright © <?php echo date("Y");?> Server Status Project Contributors </a><?php if(strlen(COPYRIGHT_TEXT)>1){ echo " and ".COPYRIGHT_TEXT; } ?></div>
|
||||
<div class="col-md-4 text-center">
|
||||
<div class="btn-group dropup">
|
||||
<button type="button" class="btn btn-primary"><?php echo '<img src="'.WEB_URL.'/locale/'.$_SESSION['locale'].'/flag.png" alt="'.$lang_names[$_SESSION['locale']].'">'.$lang_names[$_SESSION['locale']];?></button>
|
||||
|
|
Loading…
Reference in New Issue