Merge pull request #145 from Tealk/update-bootstrap

Merge Tealk's nice major design updates and small code tweaks
This commit is contained in:
Yigit Kerem Oktay 2021-04-21 14:13:30 +03:00 committed by GitHub
commit eb50012e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
96 changed files with 61065 additions and 3113 deletions

21
404.php
View File

@ -1,17 +1,16 @@
<?php
<?php
require_once("template.php");
if (!file_exists("config.php"))
{
if (!file_exists("config.php")) {
require_once("install.php");
}else{
require_once("config.php");
} else {
require_once("config.php");
Template::render_header("Page not found");
Template::render_header("Page not found", "notfound");
?>
<div class="text-center">
<h1><?php echo _("Page Not Found");?></h1>
<p><?php echo _("Sorry, but the page you were trying to view does not exist.");?></p>
<h1><?php echo _("Page Not Found"); ?></h1>
<p><?php echo _("Sorry, but the page you were trying to view does not exist."); ?></p>
</div>
<?php
Template::render_footer();
}
<?php
Template::render_footer();
}

View File

@ -1,110 +1,114 @@
<?php
$offset = 0;
if (isset($_GET['ajax']))
{
$constellation->render_incidents(false,$_GET['offset'],5);
if (isset($_GET['ajax'])) {
$constellation->render_incidents(false, $_GET['offset'], 5);
exit();
}else if (isset($_GET['offset']))
{
} else if (isset($_GET['offset'])) {
$offset = $_GET['offset'];
}
if (isset($_GET['new']) && $_GET['new']=="incident")
{
if (isset($_GET['new']) && $_GET['new'] == "incident") {
Incident::add();
}
if (isset($_GET['delete']))
{
if (isset($_GET['delete'])) {
Incident::delete($_GET['delete']);
}
if (isset($_GET['tasks'])) {
Queue::process_queue();
Queue::process_queue();
}
Template::render_header(_("Dashboard"), true);
Template::render_header(_("Dashboard"), "dashboard", true);
?>
<div class="text-center">
<h1><?php echo _("Dashboard");?></h1>
<h3><?php echo _("Welcome");?> <?php echo $user->get_name();?></h3>
</div>
<div class="text-center">
<h1><?php echo _("Dashboard"); ?></h1>
<h3><?php echo _("Welcome"); ?> <?php echo $user->get_name(); ?></h3>
</div>
<div id="current">
<?php
$services = $constellation->render_status(true);
?>
</div>
<div id="timeline">
<div class="item">
<div class="timeline">
<div class="line text-muted"></div>
<h3><?php echo _("New incident");?></h3>
<form id="new-incident" action="<?php echo WEB_URL;?>/admin/?new=incident" method="POST" class="clearfix">
<div class="panel">
<?php if (isset($message))
{?>
<p class="alert alert-danger"><?php echo $message?></p>
<div id="current">
<?php
$services = $constellation->render_status(true);
?>
</div>
<div id="timeline">
<div class="item">
<div class="timeline">
<div class="line text-muted"></div>
<h3><?php echo _("New incident"); ?></h3>
<form id="new-incident" action="<?php echo WEB_URL; ?>/admin/?new=incident" method="POST">
<div class="servicelist">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php
} ?>
<div id="status-container" class="clearfix">
<?php
if (isset($_POST['services']) && !is_array($_POST['services']))
{
$post_services = array($_POST['services']);
}else{
$post_services = array();
}
<div id="status-container">
<?php
if (isset($_POST['services']) && !is_array($_POST['services'])) {
$post_services = array($_POST['services']);
} else {
$post_services = array();
}
foreach($services as $service){
?>
<div class="item clearfix">
<div class="service"><?php if ($service->get_status()!=-1){?><input type="checkbox" name="services[]" value="<?php echo $service->get_id(); ?>" <?php echo (in_array($service->get_id(), $post_services))?"checked":'';?> id="service-<?php echo $service->get_id(); ?>"><?php } ?><label for="service-<?php echo $service->get_id(); ?>"><?php echo $service->get_name(); ?></label></div>
<div class="status <?php if ($service->get_status()!=-1){echo $classes[$service->get_status()];}?>"><?php if ($service->get_status()!=-1){echo $statuses[$service->get_status()];}?></div>
</div>
<?php
}
?>
foreach ($services as $service) {
?>
<div class="input-group mb-2">
<?php if ($service->get_status() != -1) { ?>
<div class="input-group-text service">
<input type="checkbox" name="services[]" value="<?php echo $service->get_id(); ?>" <?php echo (in_array($service->get_id(), $post_services)) ? "checked" : ''; ?> id="service-<?php echo $service->get_id(); ?>">
</div>
<label id="name" class="input-group-text form-control" for="service-<?php echo $service->get_id(); ?>"><?php echo $service->get_name(); ?></label>
<label id="status" class="input-group-text btn-<?php if ($service->get_status() != -1) {
echo $classes[$service->get_status()];
} ?>" for="service-<?php echo $service->get_id(); ?>"><?php echo $statuses[$service->get_status()]; ?></label>
<?php } ?>
</div>
<?php
}
?>
</div>
</div>
<div class="panel new panel-primary">
<div class="panel-heading icon">
<i class="glyphicon glyphicon-info-sign"></i>
</div>
<div class="panel-heading clearfix">
<input type="text" name="title" id="title" placeholder="<?php echo _("Title");?>" value="<?php echo (isset($_POST['title'])?htmlspecialchars($_POST['title']):''); ?>" required> <span id="time"><input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time'])?htmlspecialchars($_POST['time']):''); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time");?>">
<input id="time_input_js" name="time_js" type="hidden" class="pull-right">
</span>
</div>
<div class="panel-body">
<textarea name="text" placeholder="<?php echo _("Here goes your text...");?>" required><?php echo (isset($_POST['text'])?htmlspecialchars($_POST['text']):''); ?></textarea>
</div>
<div class="panel-footer clearfix">
<small><?php echo _("Posted by");?>: <?php echo $user->get_username();?> <span class="pull-right" id="end_time_wrapper"><?php echo _("Ending");?>:&nbsp;<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" class="pull-right" placeholder="<?php echo _("End time");?>" value="<?php echo (isset($_POST['end_time'])?htmlspecialchars($_POST['end_time']):''); ?>"></span></small>
<input id="end_time_js" name="end_time_js" type="hidden" class="pull-right">
</div>
<article class="card new border-primary mb-3">
<div class="card-colore icon bg-primary"><i class="fa fa-info"></i></div>
<div class="card-colore card-header bg-primary border-primary">
<input type="text" name="title" id="title" placeholder="<?php echo _("Title"); ?>" value="<?php echo (isset($_POST['title']) ? htmlspecialchars($_POST['title']) : ''); ?>" required>
<span id="time" class="float-end">
<input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time']) ? htmlspecialchars($_POST['time']) : ''); ?>" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time"); ?>">
<input id="time_input_js" name="time_js" type="hidden">
</span>
</div>
<select class="form-control pull-left" id="type" name="type">
<div class="card-body text-primary">
<p class="card-text"><textarea name="text" placeholder="<?php echo _("Here goes your text..."); ?>" required><?php echo (isset($_POST['text']) ? htmlspecialchars($_POST['text']) : ''); ?></textarea></p>
</div>
<div class="card-footer bg-transparent border-primary">
<small><?php echo _("Posted by"); ?>: <?php echo $user->get_username(); ?></small>
<span class="float-end" id="end_time_wrapper"><?php echo _("Ending"); ?>:&nbsp;
<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" placeholder="<?php echo _("End time"); ?>" value="<?php echo (isset($_POST['end_time']) ? htmlspecialchars($_POST['end_time']) : ''); ?>">
<input id="end_time_js" name="end_time_js" type="hidden">
</span>
</div>
</article>
<div class="input-group">
<select class="form-select" id="type" name="type">
<?php
if (isset($_POST['type']))
{
if (isset($_POST['type'])) {
$selected_status = $_POST['type'];
}else
{
} else {
$selected_status = 2;
}
foreach ($statuses as $key => $value) {
echo '<option value="'.$key.'"'.(($key==$selected_status)?' selected':'').'>'.$value.'</option>';
echo '<option value="' . $key . '"' . (($key == $selected_status) ? ' selected' : '') . '>' . $value . '</option>';
}
?>
</select>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>
<?php
$constellation->render_incidents(true,$offset,5,true);
$constellation->render_incidents(false,$offset,5,true);
?>
</div>
<button class="card-colore btn btn-secondary" type="submit"><?php echo _("Submit"); ?></button>
</div>
</form>
<?php
$constellation->render_incidents(true, $offset, 5, true);
$constellation->render_incidents(false, $offset, 5, true);
?>
</div>
</div>
</div>

View File

@ -1,10 +1,8 @@
<?php
if (!file_exists("../config.php"))
{
if (!file_exists("../config.php")) {
header("Location: ../");
}
else{
} else {
require_once("../config.php");
require_once("../classes/constellation.php");
require_once("../classes/mailer.php");
@ -14,11 +12,11 @@ else{
require_once("../classes/queue.php");
require_once("../classes/db-class.php");
$db = new SSDB();
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"));
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"));
define("GOOGLE_RECAPTCHA", $db->getBooleanSetting($mysqli, "google_recaptcha"));
define("GOOGLE_RECAPTCHA_SECRET", $db->getSetting($mysqli, "google_recaptcha_secret"));
@ -39,58 +37,45 @@ else{
// Process the subscriber notification queue
// If CRON_SERVER_IP is not set, call notification once incident has been saved
if ( empty(CRON_SERVER_IP) )
{
if ( isset($_GET['sent']) && $_GET['sent'] == true )
{
if (empty(CRON_SERVER_IP)) {
if (isset($_GET['sent']) && $_GET['sent'] == true) {
Queue::process_queue();
}
}
else if ( isset($_GET['task']) && $_GET['task'] == 'cron' )
{
} else if (isset($_GET['task']) && $_GET['task'] == 'cron') {
// Else, base it on call to /admin?task=cron being called from IP defined by CRON_SERVER_IP
if (! empty(CRON_SERVER_IP) && $_SERVER['REMOTE_ADDR'] == CRON_SERVER_IP )
{
Queue::process_queue();
syslog(1, "CRON server processed");
}
else {
syslog(1, "CRON called from unauthorised server");
if (!empty(CRON_SERVER_IP) && $_SERVER['REMOTE_ADDR'] == CRON_SERVER_IP) {
Queue::process_queue();
syslog(1, "CRON server processed");
} else {
syslog(1, "CRON called from unauthorised server");
}
}
if(isset($_COOKIE['user'])&&!isset($_SESSION['user']))
{
if (isset($_COOKIE['user']) && !isset($_SESSION['user'])) {
User::restore_session();
}
if (!isset($_SESSION['user']))
{
if (isset($_GET['do']) && $_GET['do']=="lost-password")
{
if (!isset($_SESSION['user'])) {
if (isset($_GET['do']) && $_GET['do'] == "lost-password") {
require_once("lost-password.php");
}else if (isset($_GET['do']) && $_GET['do']=="change-email"){
} else if (isset($_GET['do']) && $_GET['do'] == "change-email") {
$user_pwd = new User($_GET['id']);
$user_pwd->change_email();
require_once("login-form.php");
}
else{
} else {
User::login();
require_once("login-form.php");
}
}
else
{
} else {
$user = new User($_SESSION['user']);
if (!$user->is_active())
{
if (!$user->is_active()) {
User::logout();
}
if (!isset($_GET['do'])){
if (!isset($_GET['do'])) {
$do = "";
}else{
} else {
$do = $_GET['do'];
}
@ -98,17 +83,17 @@ else{
case 'change-email':
$user = new User($_GET['id']);
$user->change_email();
case 'user':
require_once("user.php");
break;
case 'user':
require_once("user.php");
break;
case 'settings':
require_once("settings.php");
break;
case 'settings':
require_once("settings.php");
break;
case 'new-user':
require_once("new-user.php");
break;
case 'new-user':
require_once("new-user.php");
break;
case 'new-service':
case 'edit-service':
@ -128,9 +113,9 @@ else{
User::logout();
break;
default:
require_once("dashboard.php");
break;
default:
require_once("dashboard.php");
break;
}
Template::render_footer(true);

View File

@ -1,32 +1,42 @@
<?php
Template::render_header(_("Login"));
Template::render_header(_("Login"), "login");
?>
<div class="text-center">
<h1><?php echo _("Login");?></h1>
</div>
<div id="login-form" class="center">
<?php if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php }else{?>
<p class="alert alert-info"><?php echo _("Please login to continue.");?></p>
<?php }?>
<form action="<?php echo WEB_URL;?>/admin/" method="post">
<div class="form-group">
<label for="email"><?php echo _("Email");?></label>
<input placeholder="<?php echo _("Email");?>" class="form-control" name="email" id="email" type="email" tabindex="1" value="<?php echo htmlspecialchars((isset($_POST['email'])?$_POST['email']:''),ENT_QUOTES);?>" required>
<div class="text-center">
<h1><?php echo _("Login"); ?></h1>
</div>
<div class="wrapper">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php } else { ?>
<p class="alert alert-info"><?php echo _("Please login to continue."); ?></p>
<?php } ?>
<form action="<?php echo WEB_URL; ?>/admin/" method="post">
<div class="card">
<div class="card-header">
<h1><?php echo _("Login"); ?></h1>
</div>
<div class="card-body">
<div class="input-group mb-3">
<span class="input-group-text"><i class="fas fa-at"></i></span>
<input type="email" id="email" name="email" class="form-control" placeholder="<?php echo _("Email"); ?>" value="<?php echo htmlspecialchars((isset($_POST['email']) ? $_POST['email'] : ''), ENT_QUOTES); ?>" required>
</div>
<div class="input-group mb-3">
<span class="input-group-text"><i class="fas fa-key"></i></span>
<input type="password" id="pass" name="pass" class="form-control" placeholder="<?php echo _("Password"); ?>" required>
</div>
<a href="<?php echo WEB_URL; ?>/admin/?do=lost-password" class="float-end" tabindex="5"><?php echo _("Forgotten password?"); ?></a>
<div class="input-group mb-3">
<div class="input-group-text nrbr">
<input type="checkbox" name="remember" id="remember">
</div>
<div class="form-group" style="margin-bottom: 8px">
<label for="pass"><?php echo _("Password");?></label>
<input placeholder="<?php echo _("Password");?>" class="form-control" name="pass" id="pass" type="password" tabindex="2" required>
<div style="padding-top: 8px; position: relative;">
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password" class="pull-right noselect" tabindex="5"><?php echo _("Forgotten password?");?></a>
<input name="remember" id="remember" type="checkbox" tabindex="3"> <label class="lbl-login noselect" style="color: black;" for="remember"><?php echo _("Remember me");?></label>
</div>
</div>
<div class="form-group clearfix">
<button type="submit" class="btn btn-success pull-right" tabindex="4"><?php echo _("Login");?></button>
</div>
</form>
<label class="input-group-append input-group-text nlbr nobg" for="remember"><?php echo _("Remember me"); ?></label>
</div>
<div class="form-group">
<input type="submit" value="<?php echo _("Login"); ?>" class="btn btn-success float-end">
</div>
</div>
</div>
</form>
</div>
<?php
Template::render_footer();
Template::render_footer();

View File

@ -1,72 +1,65 @@
<?php
Template::render_header(_("Lost password"));
Template::render_header(_("Lost password"), "lostpw");
?>
<div class="text-center">
<h1><?php echo _("Lost password");?></h1>
</div>
<div id="login-form" class="center">
<?php
if (isset($_POST['id']))
{
$user = new User($_POST['id']);
$user->change_password($_POST['token']);
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
<?php
}
else{?>
<p class="alert alert-success"><?php echo _("Password changed successfully!");?></p>
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
<?php
}
}
else if (isset($_POST['email']))
{
User::password_link();
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password"><?php echo _("Go back to start");?></a>
<?php
}
else{?>
<p class="alert alert-success"><?php echo _("Email with password reset link has been sent!");?></p>
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
<?php
}
}
else{
<div class="text-center">
<h1><?php echo _("Lost password"); ?></h1>
</div>
<div id="login-form" class="center">
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php }?>
<form action="<?php echo WEB_URL;?>/admin/?do=lost-password" method="post">
<?php if (!isset($_GET['id'])||!isset($_GET['token'])){?>
<label for="email"><?php echo _("Email");?>:</label>
<div class="input-group pull-right">
<input class="form-control" name="email" id="email" placeholder="<?php echo _("Email");?>" type="email" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-success pull-right"><?php echo _("Submit request");?></button>
</span>
</div>
<?php }
else{
$user = new User($_GET['id']);
?>
<p class="alert alert-info"><?php printf(_("Reset password for %s (%s)"),$user->get_name(), $user->get_username());?></p>
<input type="hidden" name="id" value="<?php echo $_GET['id'];?>" >
<input type="hidden" name="token" value="<?php echo $_GET['token'];?>" >
<label for="new_password"><?php echo _("New password");?></label>
<input id="new_password" placeholder="<?php echo _("New password");?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password");?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password");?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password");?></button>
<?php
}
?>
</form>
<?php }?>
</div>
<?php
Template::render_footer();
<?php
if (isset($_POST['id'])) {
$user = new User($_POST['id']);
$user->change_password($_POST['token']);
if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<a href="<?php echo WEB_URL; ?>/admin/?do=lost-password<?php echo "&id=" . $_POST['id'] . "&token=" . $_POST['token']; ?>"><?php echo _("Go back"); ?> </a>
<?php
} else { ?>
<p class="alert alert-success"><?php echo _("Password changed successfully!"); ?></p>
<a href="<?php echo WEB_URL; ?>/admin/"><?php echo _("Go back to login page"); ?></a>
<?php
}
} else if (isset($_POST['email'])) {
User::password_link();
if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<a href="<?php echo WEB_URL; ?>/admin/?do=lost-password"><?php echo _("Go back to start"); ?></a>
<?php
} else { ?>
<p class="alert alert-success"><?php echo _("Email with password reset link has been sent!"); ?></p>
<a href="<?php echo WEB_URL; ?>/admin/"><?php echo _("Go back to login page"); ?></a>
<?php
}
} else {
if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php } ?>
<form action="<?php echo WEB_URL; ?>/admin/?do=lost-password" method="post">
<?php if (!isset($_GET['id']) || !isset($_GET['token'])) { ?>
<label for="email"><?php echo _("Email"); ?>:</label>
<div class="input-group float-end">
<input class="form-control" name="email" id="email" placeholder="<?php echo _("Email"); ?>" type="email" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-success float-end"><?php echo _("Submit request"); ?></button>
</span>
</div>
<?php } else {
$user = new User($_GET['id']);
?>
<p class="alert alert-info"><?php printf(_("Reset password for %s (%s)"), $user->get_name(), $user->get_username()); ?></p>
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
<input type="hidden" name="token" value="<?php echo $_GET['token']; ?>">
<label for="new_password"><?php echo _("New password"); ?></label>
<input id="new_password" placeholder="<?php echo _("New password"); ?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password"); ?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password"); ?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary float-end margin-top"><?php echo _("Change password"); ?></button>
<?php
}
?>
</form>
<?php } ?>
</div>
<?php
Template::render_footer();

View File

@ -1,54 +1,47 @@
<?php
if (isset($_GET['new']))
{
<?php
if (isset($_GET['new'])) {
User::add();
}
Template::render_header(_("New user"), true); ?>
Template::render_header(_("New user"), "newuser", true); ?>
<div class="text-center">
<h2>Add new user</h2>
<h2>Add new user</h2>
</div>
<form action="<?php echo WEB_URL;?>/admin/?do=new-user&new=user" method="POST" class="form-horizontal">
<?php if (isset($message))
{?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php
} ?>
<form action="<?php echo WEB_URL; ?>/admin/?do=new-user&new=user" method="POST" class="form-horizontal">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php
} ?>
<div class="form-group">
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name']))?htmlspecialchars($_POST['name'],ENT_QUOTES):'');?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname']))?htmlspecialchars($_POST['surname'],ENT_QUOTES):'');?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="name"><?php echo _("Name"); ?>: </label><input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name'])) ? htmlspecialchars($_POST['name'], ENT_QUOTES) : ''); ?>" id="name" placeholder="<?php echo _("Name"); ?>" class="form-control" required></div>
<div class="col-sm-6"><label for="surname"><?php echo _("Surname"); ?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname'])) ? htmlspecialchars($_POST['surname'], ENT_QUOTES) : ''); ?>" id="surname" placeholder="<?php echo _("Surname"); ?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username']))?htmlspecialchars($_POST['username'],ENT_QUOTES):'');?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email']))?htmlspecialchars($_POST['email'],ENT_QUOTES):'');?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="username"><?php echo _("Username"); ?>:</label><input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username'])) ? htmlspecialchars($_POST['username'], ENT_QUOTES) : ''); ?>" id="username" placeholder="<?php echo _("Username"); ?>" class="form-control" required></div>
<div class="col-sm-6"><label for="email"><?php echo _("Email"); ?>:</label><input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email'])) ? htmlspecialchars($_POST['email'], ENT_QUOTES) : ''); ?>" id="email" placeholder="<?php echo _("Email"); ?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password']))?htmlspecialchars($_POST['password'],ENT_QUOTES):'');?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="password"><?php echo _("Password"); ?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password'])) ? htmlspecialchars($_POST['password'], ENT_QUOTES) : ''); ?>" id="password" placeholder="<?php echo _("Password"); ?>" class="form-control" required></div>
<div class="col-sm-6">
<label for="permission"><?php echo _("Permission");?>: </label>
<label for="permission"><?php echo _("Permission"); ?>: </label>
<select name="permission" id="permission" class="form-control">
<?php
if (!empty($_POST['permission']))
{
<?php
if (!empty($_POST['permission'])) {
$permission = $_POST['permission'];
}
else
{
} else {
$permission = 2;
}
foreach ($permissions as $key => $value) {
if ($permission == $key)
{
echo '<option value="'.$key.'" selected>'.$value.'</option>';
if ($permission == $key) {
echo '<option value="' . $key . '" selected>' . $value . '</option>';
} else {
echo '<option value="' . $key . '">' . $value . '</option>';
}
else{
echo '<option value="'.$key.'">'.$value.'</option>';
}
}
?>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
</form>

View File

@ -1,15 +1,14 @@
<?php
function getToggle($variable){
function getToggle($variable)
{
$res = ((isset($variable) && ($variable == "on")) ? "yes" : "no");
return $res;
}
if (!file_exists("../config.php"))
{
if (!file_exists("../config.php")) {
header("Location: ../");
}
else{
} else {
require_once("../config.php");
require_once("../classes/constellation.php");
require_once("../classes/mailer.php");
@ -19,58 +18,58 @@ else{
require_once("../classes/queue.php");
require_once("../classes/db-class.php");
}
$db = new SSDB();
$notifyUpdates_status = $db->getBooleanSetting($mysqli, "notifyUpdates");
$emailSubscription_status = $db->getBooleanSetting($mysqli, "subscribe_email");
$telegramSubscription_status = $db->getBooleanSetting($mysqli, "subscribe_telegram");
$tg_bot_api_token = $db->getSetting($mysqli, "tg_bot_api_token");
$tg_bot_username = $db->getSetting($mysqli, "tg_bot_username");
$php_mailer_status = $db->getBooleanSetting($mysqli, "php_mailer");
$php_mailer_smtp_status = $db->getBooleanSetting($mysqli, "php_mailer_smtp");
$php_mailer_secure_status = $db->getBooleanSetting($mysqli, "php_mailer_secure");
$php_mailer_path = $db->getSetting($mysqli, "php_mailer_path");
$php_mailer_host = $db->getSetting($mysqli, "php_mailer_host");
$php_mailer_port = $db->getSetting($mysqli, "php_mailer_port");
$php_mailer_user = $db->getSetting($mysqli, "php_mailer_user");
$php_mailer_pass = $db->getSetting($mysqli, "php_mailer_pass");
$cron_server_ip = $db->getSetting($mysqli, "cron_server_ip");
$google_rechaptcha_status = $db->getBooleanSetting($mysqli, "google_recaptcha");
$google_recaptcha_sitekey = $db->getSetting($mysqli, "google_recaptcha_sitekey");
$google_recaptcha_secret = $db->getSetting($mysqli, "google_recaptcha_secret");
$db = new SSDB();
$notifyUpdates_status = $db->getBooleanSetting($mysqli, "notifyUpdates");
$emailSubscription_status = $db->getBooleanSetting($mysqli, "subscribe_email");
$telegramSubscription_status = $db->getBooleanSetting($mysqli, "subscribe_telegram");
$tg_bot_api_token = $db->getSetting($mysqli, "tg_bot_api_token");
$tg_bot_username = $db->getSetting($mysqli, "tg_bot_username");
$php_mailer_status = $db->getBooleanSetting($mysqli, "php_mailer");
$php_mailer_smtp_status = $db->getBooleanSetting($mysqli, "php_mailer_smtp");
$php_mailer_secure_status = $db->getBooleanSetting($mysqli, "php_mailer_secure");
$php_mailer_path = $db->getSetting($mysqli, "php_mailer_path");
$php_mailer_host = $db->getSetting($mysqli, "php_mailer_host");
$php_mailer_port = $db->getSetting($mysqli, "php_mailer_port");
$php_mailer_user = $db->getSetting($mysqli, "php_mailer_user");
$php_mailer_pass = $db->getSetting($mysqli, "php_mailer_pass");
$cron_server_ip = $db->getSetting($mysqli, "cron_server_ip");
$google_rechaptcha_status = $db->getBooleanSetting($mysqli, "google_recaptcha");
$google_recaptcha_sitekey = $db->getSetting($mysqli, "google_recaptcha_sitekey");
$google_recaptcha_secret = $db->getSetting($mysqli, "google_recaptcha_secret");
$db->getSetting($mysqli, "");
$set_post = false;
if(!empty($_POST)){
$db->updateSetting($mysqli, "notifyUpdates", getToggle($_POST["nu_toggle"]));
$db->updateSetting($mysqli, "name",htmlspecialchars($_POST["sitename"], ENT_QUOTES));
$db->updateSetting($mysqli, "subscribe_email", getToggle($_POST["email_subscription_toggle"]));
$db->updateSetting($mysqli, "subscribe_telegram", getToggle($_POST["telegram_subscription_toggle"]));
$db->updateSetting($mysqli, "tg_bot_api_token", htmlspecialchars($_POST["tg_bot_api_token"], ENT_QUOTES));
$db->updateSetting($mysqli, "tg_bot_username", htmlspecialchars($_POST["tg_bot_username"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer", getToggle($_POST["php_mailer_toggle"]));
$db->updateSetting($mysqli, "php_mailer_smtp", getToggle($_POST["php_mailer_smtp_toggle"]));
$db->updateSetting($mysqli, "php_mailer_secure", getToggle($_POST["php_mailer_secure_toggle"]));
$db->updateSetting($mysqli, "php_mailer_path", htmlspecialchars($_POST["php_mailer_path"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_host", htmlspecialchars($_POST["php_mailer_host"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_port", htmlspecialchars($_POST["php_mailer_port"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_user", htmlspecialchars($_POST["php_mailer_user"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_pass", htmlspecialchars($_POST["php_mailer_pass"], ENT_QUOTES));
$db->updateSetting($mysqli, "cron_server_ip", htmlspecialchars($_POST["cron_server_ip"], ENT_QUOTES));
$db->updateSetting($mysqli, "google_recaptcha", getToggle($_POST["google_rechaptcha_toggle"]));
$db->updateSetting($mysqli, "google_recaptcha_sitekey", htmlspecialchars($_POST["google_recaptcha_sitekey"], ENT_QUOTES));
$db->updateSetting($mysqli, "google_recaptcha_secret", htmlspecialchars($_POST["google_recaptcha_secret"], ENT_QUOTES));
$db->getSetting($mysqli, "");
$set_post = false;
if (!empty($_POST)) {
$db->updateSetting($mysqli, "notifyUpdates", getToggle($_POST["nu_toggle"]));
$db->updateSetting($mysqli, "name", htmlspecialchars($_POST["sitename"], ENT_QUOTES));
$db->updateSetting($mysqli, "subscribe_email", getToggle($_POST["email_subscription_toggle"]));
$db->updateSetting($mysqli, "subscribe_telegram", getToggle($_POST["telegram_subscription_toggle"]));
$db->updateSetting($mysqli, "tg_bot_api_token", htmlspecialchars($_POST["tg_bot_api_token"], ENT_QUOTES));
$db->updateSetting($mysqli, "tg_bot_username", htmlspecialchars($_POST["tg_bot_username"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer", getToggle($_POST["php_mailer_toggle"]));
$db->updateSetting($mysqli, "php_mailer_smtp", getToggle($_POST["php_mailer_smtp_toggle"]));
$db->updateSetting($mysqli, "php_mailer_secure", getToggle($_POST["php_mailer_secure_toggle"]));
$db->updateSetting($mysqli, "php_mailer_path", htmlspecialchars($_POST["php_mailer_path"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_host", htmlspecialchars($_POST["php_mailer_host"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_port", htmlspecialchars($_POST["php_mailer_port"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_user", htmlspecialchars($_POST["php_mailer_user"], ENT_QUOTES));
$db->updateSetting($mysqli, "php_mailer_pass", htmlspecialchars($_POST["php_mailer_pass"], ENT_QUOTES));
$db->updateSetting($mysqli, "cron_server_ip", htmlspecialchars($_POST["cron_server_ip"], ENT_QUOTES));
$db->updateSetting($mysqli, "google_recaptcha", getToggle($_POST["google_rechaptcha_toggle"]));
$db->updateSetting($mysqli, "google_recaptcha_sitekey", htmlspecialchars($_POST["google_recaptcha_sitekey"], ENT_QUOTES));
$db->updateSetting($mysqli, "google_recaptcha_secret", htmlspecialchars($_POST["google_recaptcha_secret"], ENT_QUOTES));
$set_post = true;
/*if($nu_toggle == "yes"){
$set_post = true;
/*if($nu_toggle == "yes"){
$notifyUpdates_status = true;
} else {
$notifyUpdates_status = false;
}*/
// TODO - Reload page to prevent showing old values! or update variables being displayed
header("Location: " .$uri = $_SERVER['REQUEST_URI']);
// TODO - The code below will not happen ...
// TODO - Reload page to prevent showing old values! or update variables being displayed
header("Location: " . $uri = $_SERVER['REQUEST_URI']);
// TODO - The code below will not happen ...
/*define("NAME", $db->getSetting($mysqli,"name"));
/*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"));
@ -92,92 +91,119 @@ else{
define("PHP_MAILER_PASS", $db->getSetting($mysqli,"php_mailer_pass"));
define("CRON_SERVER_IP", $db->getSetting($mysqli,"cron_server_ip"));
*/
}
Template::render_header(_("Options"), true);
}
Template::render_header(_("Options"), "options", true);
?>
<div class="text-center">
<h2><?php if($set_post){ echo "Settings Saved"; } else { echo "Server Status Options"; } ?></h2>
<h2><?php if ($set_post) {
echo "Settings Saved";
} else {
echo "Server Status Options";
} ?></h2>
</div>
<form method="post">
<?php Template::render_toggle("Notify Updates","nu_toggle",$notifyUpdates_status); ?>
<div class="input-group mb-3">
<form id="options" method="post">
<div class="card">
<div class="card-header">
<?php Template::render_toggle("Notify Updates", "nu_toggle", $notifyUpdates_status); ?>
</div>
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Site Name</span>
<span class="input-group-text" id="basic-addon1">Site Name</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="basic-addon1" name="sitename" value="<?php echo NAME; ?>">
</div>
</div>
</div>
<?php Template::render_toggle("Enable Email Subscription","email_subscription_toggle",$emailSubscription_status); ?>
<?php Template::render_toggle("Enable Telegram Subscription","telegram_subscription_toggle",$telegramSubscription_status); ?>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Telegram BOT API Token</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="telegram_bot_api_token" aria-describedby="basic-addon1" name="tg_bot_api_token" value="<?php echo $tg_bot_api_token; ?>">
<div class="card mt-3">
<div class="card-header">
<?php Template::render_toggle("Enable Email Subscription", "email_subscription_toggle", $emailSubscription_status); ?>
</div>
<div class="input-group mb-3">
<div class="card-body">
<?php Template::render_toggle("Use PHPMailer for notifications", "php_mailer_toggle", $php_mailer_status); ?>
<?php Template::render_toggle("Use SMTP with PHPMailer", "php_mailer_smtp_toggle", $php_mailer_smtp_status); ?>
<?php Template::render_toggle("Use Secure SMTP with PHPMailer", "php_mailer_secure_toggle", $php_mailer_secure_status); ?>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Telegram BOT Username</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="telegram_bot_username" aria-describedby="basic-addon1" name="tg_bot_username" value="<?php echo $tg_bot_username; ?>">
</div>
<?php Template::render_toggle("Use PHPMailer for notifications","php_mailer_toggle",$php_mailer_status); ?>
<?php Template::render_toggle("Use SMTP with PHPMailer","php_mailer_smtp_toggle",$php_mailer_smtp_status); ?>
<?php Template::render_toggle("Use Secure SMTP with PHPMailer","php_mailer_secure_toggle",$php_mailer_secure_status); ?>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">PHPMailer Path</span>
<span class="input-group-text" id="basic-addon1">PHPMailer Path</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="phpmailer_path" aria-describedby="basic-addon1" name="php_mailer_path" value="<?php echo $php_mailer_path; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Host</span>
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Host</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="php_mailer_host" aria-describedby="basic-addon1" name="php_mailer_host" value="<?php echo $php_mailer_host; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Port</span>
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Port</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="php_mailer_port" aria-describedby="basic-addon1" name="php_mailer_port" value="<?php echo $php_mailer_port; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">PHPMailer Username</span>
<span class="input-group-text" id="basic-addon1">PHPMailer Username</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="php_mailer_username" aria-describedby="basic-addon1" name="php_mailer_user" value="<?php echo $php_mailer_user; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">PHPMailer Password</span>
<span class="input-group-text" id="basic-addon1">PHPMailer Password</span>
</div>
<input type="password" class="form-control" placeholder="" aria-label="php_mailer_password" aria-describedby="basic-addon1" name="php_mailer_pass" value="<?php echo $php_mailer_pass; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Cron Server IP</span>
<span class="input-group-text" id="basic-addon1">Cron Server IP</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="cron_server_ip" aria-describedby="basic-addon1" name="cron_server_ip" value="<?php echo $cron_server_ip; ?>">
</div>
</div>
</div>
<?php Template::render_toggle("Use Google reChaptcha for subscriber signup","google_rechaptcha_toggle",$google_rechaptcha_status); ?>
<div class="input-group mb-3">
<div class="card mt-3">
<div class="card-header">
<?php Template::render_toggle("Enable Telegram Subscription", "telegram_subscription_toggle", $telegramSubscription_status); ?>
</div>
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Google reChaptcha Sitekey</span>
<span class="input-group-text" id="basic-addon1">Telegram BOT API Token</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="telegram_bot_api_token" aria-describedby="basic-addon1" name="tg_bot_api_token" value="<?php echo $tg_bot_api_token; ?>">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Telegram BOT Username</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="telegram_bot_username" aria-describedby="basic-addon1" name="tg_bot_username" value="<?php echo $tg_bot_username; ?>">
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-header">
<?php Template::render_toggle("Use Google reChaptcha for subscriber signup", "google_rechaptcha_toggle", $google_rechaptcha_status); ?>
</div>
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Google reChaptcha Sitekey</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="google_sitekey" aria-describedby="basic-addon1" name="google_recaptcha_sitekey" value="<?php echo $google_recaptcha_sitekey; ?>">
</div>
<div class="input-group mb-3">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Google reChaptcha Secret</span>
<span class="input-group-text" id="basic-addon1">Google reChaptcha Secret</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="google_secret" aria-describedby="basic-addon1" name="google_recaptcha_secret" value="<?php echo $google_recaptcha_secret; ?>">
</div>
</div>
</div>
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
</form>
<div class="card mt-3 mb-3" style="border: none;">
<button class="btn btn-primary float-end" type="submit">Save Settings</button>
</div>
</form>

View File

@ -1,16 +1,13 @@
<?php
if (isset($_GET['new']))
{
if (isset($_GET['new'])) {
ServiceGroup::add();
}
if (isset($_GET['edit']))
{
if (isset($_GET['edit'])) {
ServiceGroup::edit();
}
if (isset($_GET['delete']))
{
if (isset($_GET['delete'])) {
ServiceGroup::delete();
}
@ -19,7 +16,7 @@ $group_value = isset($_POST['group']) ? $_POST['group'] : '';
$description_value = isset($_POST['description']) ? $_POST['description'] : '';
$visibility_id_value = isset($_POST['visibility_id']) ? $_POST['visibility_id'] : '';
if ( isset($_GET['id']) && !isset($_POST['id']) ) {
if (isset($_GET['id']) && !isset($_POST['id'])) {
$group_id = (int) $_GET['id'];
$boolEdit = true;
$stmt = $mysqli->prepare("SELECT * FROM services_groups WHERE id LIKE ?");
@ -27,7 +24,7 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
$stmt->execute();
$query = $stmt->get_result();
$data = $query->fetch_assoc();
$group_value = $data['name'];
$group_value = $data['name'];
$description_value = $data['description'];
$visibility_id_value = $data['visibility'];
}
@ -35,55 +32,47 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
if (!$boolEdit) {
Template::render_header(_("New service group"), true); ?>
<div class="text-center">
<h2><?php echo _("Add new service group");?></h2>
</div>
<?php
$form_url = WEB_URL .'/admin/?do=new-service-group&amp;new=group';
} else {
Template::render_header(_("Edit service group"), true); ?>
Template::render_header(_("New service group"), "servicegroup", true); ?>
<div class="text-center">
<h2><?php echo _("Edit service group");?></h2>
<h2><?php echo _("Add new service group"); ?></h2>
</div>
<?php
$form_url = WEB_URL .'/admin/?do=edit-service-group&amp;edit&amp;id='.$group_id;
<?php
$form_url = WEB_URL . '/admin/?do=new-service-group&amp;new=group';
} else {
Template::render_header(_("Edit service group"), "servicegroup", true); ?>
<div class="text-center">
<h2><?php echo _("Edit service group"); ?></h2>
</div>
<?php
$form_url = WEB_URL . '/admin/?do=edit-service-group&amp;edit&amp;id=' . $group_id;
}
?>
<form action="<?php echo $form_url;?>" method="POST" class="form-horizontal">
<?php if (isset($message))
{?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php
} ?>
<form action="<?php echo $form_url; ?>" method="POST" class="form-horizontal">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php
} ?>
<div class="form-group">
<div class="col-sm-6"><label for="group"><?php echo _("Service Group Name");?>: </label><input type="text" maxlength="50" name="group" value="<?php echo ((isset($_POST['group']))?htmlspecialchars($_POST['group'],ENT_QUOTES):$group_value);?>" id="group" placeholder="<?php echo _("service group name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="description"><?php echo _("Description");?>: </label><input type="text" maxlength="100" name="description" value="<?php echo ((isset($_POST['description']))?htmlspecialchars($description_value,ENT_QUOTES):$description_value);?>" id="description" placeholder="<?php echo _("Description");?>" class="form-control"></div>
<div class="col-sm-6"><label for="group"><?php echo _("Service Group Name"); ?>: </label><input type="text" maxlength="50" name="group" value="<?php echo ((isset($_POST['group'])) ? htmlspecialchars($_POST['group'], ENT_QUOTES) : $group_value); ?>" id="group" placeholder="<?php echo _("service group name"); ?>" class="form-control" required></div>
<div class="col-sm-6"><label for="description"><?php echo _("Description"); ?>: </label><input type="text" maxlength="100" name="description" value="<?php echo ((isset($_POST['description'])) ? htmlspecialchars($description_value, ENT_QUOTES) : $description_value); ?>" id="description" placeholder="<?php echo _("Description"); ?>" class="form-control"></div>
</div>
<div class="form-group">
<div class="col-sm-6">
<label for="visibility_id"><?php echo _("Visibility");?>: </label>
<label for="visibility_id"><?php echo _("Visibility"); ?>: </label>
<select name="visibility_id" id="visibility_id" class="form-control">
<?php
if (!empty($visibility_id_value))
{
if (!empty($visibility_id_value)) {
$visibility_id = $visibility_id_value;
}
else
{
} else {
$visibility_id = null;
}
//$visibilitys = Service::get_groups();
foreach ($visibility as $key => $value) {
if ($visibility_id == $key)
{
echo '<option value="'.$key.'" selected>'.$value.'</option>';
}
else{
echo '<option value="'.$key.'">'.$value.'</option>';
if ($visibility_id == $key) {
echo '<option value="' . $key . '" selected>' . $value . '</option>';
} else {
echo '<option value="' . $key . '">' . $value . '</option>';
}
}
?>
@ -91,9 +80,9 @@ $form_url = WEB_URL .'/admin/?do=new-service-group&amp;new=group';
</div>
</div>
<?php
if ( $boolEdit ) {
echo '<input type="hidden" id="id" name="id" value="'.$group_id.'">';
}
?>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>
if ($boolEdit) {
echo '<input type="hidden" id="id" name="id" value="' . $group_id . '">';
}
?>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
</form>

View File

@ -1,11 +1,9 @@
<?php
if (isset($_GET['new']))
{
if (isset($_GET['new'])) {
Service::add();
}
if (isset($_GET['edit']))
{
if (isset($_GET['edit'])) {
Service::edit();
}
@ -19,7 +17,7 @@ $service_value = isset($_POST['service']) ? $_POST['service'] : '';
$description_value = isset($_POST['description']) ? $_POST['description'] : '';
$group_id_value = isset($_POST['group_id']) ? $_POST['group_id'] : '';
if ( isset($_GET['id']) && !isset($_POST['id']) ) {
if (isset($_GET['id']) && !isset($_POST['id'])) {
$service_id = (int) $_GET['id'];
$boolEdit = true;
$stmt = $mysqli->prepare("SELECT * FROM services WHERE id LIKE ?");
@ -28,7 +26,7 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
$query = $stmt->get_result();
$data = $query->fetch_assoc();
//print_r($data);
$service_value = $data['name'];
$service_value = $data['name'];
$description_value = $data['description'];
$group_id_value = $data['group_id'];
}
@ -36,52 +34,46 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
if (!$boolEdit) {
Template::render_header(_("New service"), true); ?>
<div class="text-center">
<h2><?php echo _("Add new service");?></h2>
</div>
<?php
$form_url = WEB_URL . '/admin/?do=new-service&amp;new=service';
} else {
Template::render_header(_("New service"), true); ?>
Template::render_header(_("New service"), "service", true); ?>
<div class="text-center">
<h2><?php echo _("Add new service");?></h2>
<h2><?php echo _("Add new service"); ?></h2>
</div>
<?php
$form_url = WEB_URL . '/admin/?do=edit-service&amp;edit&amp;id='.$service_id;
<?php
$form_url = WEB_URL . '/admin/?do=new-service&amp;new=service';
} else {
Template::render_header(_("New service"), "service", true); ?>
<div class="text-center">
<h2><?php echo _("Add new service"); ?></h2>
</div>
<?php
$form_url = WEB_URL . '/admin/?do=edit-service&amp;edit&amp;id=' . $service_id;
}
?>
<form action="<?php echo $form_url;?>" method="POST" class="form-horizontal">
<?php if (isset($message))
{?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php
} ?>
<form action="<?php echo $form_url; ?>" method="POST" class="form-horizontal">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php
} ?>
<div class="form-group">
<div class="col-sm-6"><label for="service"><?php echo _("Service");?>: </label><input type="text" maxlength="50" name="service" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service'],ENT_QUOTES):$service_value);?>" id="service" placeholder="<?php echo _("service");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="description"><?php echo _("Description");?>: </label><input type="text" maxlength="200" name="description" value="<?php echo ((isset($_POST['description']))?htmlspecialchars($_POST['description'],ENT_QUOTES):$description_value);?>" id="description" placeholder="<?php echo _("Description");?>" class="form-control"></div>
<div class="col-sm-6"><label for="service"><?php echo _("Service"); ?>: </label><input type="text" maxlength="50" name="service" value="<?php echo ((isset($_POST['service'])) ? htmlspecialchars($_POST['service'], ENT_QUOTES) : $service_value); ?>" id="service" placeholder="<?php echo _("service"); ?>" class="form-control" required></div>
<div class="col-sm-6"><label for="description"><?php echo _("Description"); ?>: </label><input type="text" maxlength="200" name="description" value="<?php echo ((isset($_POST['description'])) ? htmlspecialchars($_POST['description'], ENT_QUOTES) : $description_value); ?>" id="description" placeholder="<?php echo _("Description"); ?>" class="form-control"></div>
</div>
<div class="form-group">
<div class="col-sm-6">
<label for="group_id"><?php echo _("Service Group");?>: </label>
<label for="group_id"><?php echo _("Service Group"); ?>: </label>
<select name="group_id" id="group_id" class="form-control">
<?php
if (!empty($group_id_value))
{
if (!empty($group_id_value)) {
$group_id = $group_id_value;
}
else
{
} else {
$group_id = null;
}
$groups = ServiceGroup::get_groups();
foreach ($groups as $key => $value) {
if ($group_id == $key)
{
echo '<option value="'.$key.'" selected>'.$value.'</option>';
}
else{
echo '<option value="'.$key.'">'.$value.'</option>';
if ($group_id == $key) {
echo '<option value="' . $key . '" selected>' . $value . '</option>';
} else {
echo '<option value="' . $key . '">' . $value . '</option>';
}
}
?>
@ -89,9 +81,9 @@ $form_url = WEB_URL . '/admin/?do=new-service&amp;new=service';
</div>
</div>
<?php
if ( $boolEdit ) {
echo '<input type="hidden" id="id" name="id" value="'.$service_id.'">';
}
?>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>
if ($boolEdit) {
echo '<input type="hidden" id="id" name="id" value="' . $service_id . '">';
}
?>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
</form>

View File

@ -1,141 +1,157 @@
<?php
if (isset($_GET['delete']) && isset($_GET['type']))
{
if ( $_GET['type'] == 'service') {
if (isset($_GET['delete']) && isset($_GET['type'])) {
if ($_GET['type'] == 'service') {
Service::delete();
}
elseif ( $_GET['type'] == 'groups') {
} elseif ($_GET['type'] == 'groups') {
ServiceGroup::delete();
}
}
Template::render_header(_("Settings"), true);
Template::render_header(_("Settings"), "settings", true);
?>
<div class="text-center">
<h2>Settings</h2>
</div>
<?php
if (isset($message)){
?>
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php }?>
if (isset($message)) {
?>
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php } ?>
<section>
<h3 class="pull-left"><?php echo _("Services");?></h3>
<?php if ($user->get_rank() <= 1){?>
<form action="?do=settings&new=service" method="post">
<div class="input-group pull-right new-service">
<a href="<?php echo WEB_URL;?>/admin/?do=new-service" class="btn btn-success pull-right"><?php echo _("Add new service");?></a>
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() <= 1) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service" class="btn btn-success" role="button"><?php echo _("Add new service"); ?></a>
<?php } ?>
</div>
</form>
<?php }?>
<div class="table-responsive">
<div class="float-start">
<h3><?php echo _("Services"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
<div>
<table class="table">
<thead><tr>
<!--<th scope="col"><?php echo _("ID");?></th>-->
<th scope="col"><?php echo _("Name");?></th>
<th scope="col"><?php echo _("Description");?></th>
<th scope="col"><?php echo _("Group");?></th>
<?php if ($user->get_rank()<=1)
{?>
<th scope="col"><?php echo _("Delete");?></th>
<thead>
<tr>
<!--<th scope="col"><?php echo _("ID"); ?></th>-->
<th scope="col"><?php echo _("Name"); ?></th>
<th scope="col"><?php echo _("Description"); ?></th>
<th scope="col"><?php echo _("Group"); ?></th>
<?php if ($user->get_rank() <= 1) { ?>
<th scope="col"><?php echo _("Delete"); ?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT services.*, services_groups.name AS group_name FROM `services` LEFT JOIN services_groups ON services.group_id = services_groups.id ORDER BY services.name ASC");
while($result = $query->fetch_assoc())
{
while ($result = $query->fetch_assoc()) {
echo "<tr>";
//echo "<td>".$result['id']."</td>";
echo '<td><a href="'.WEB_URL.'/admin?do=edit-service&id='.$result['id'].'">'.$result['name'].'</a></th>';
echo "<td>".$result['description']."</td>";
echo "<td>".$result['group_name']."</td>";
echo '<td><a href="' . WEB_URL . '/admin?do=edit-service&id=' . $result['id'] . '">' . $result['name'] . '</a></th>';
echo "<td>" . $result['description'] . "</td>";
echo "<td>" . $result['group_name'] . "</td>";
if ($user->get_rank()<=1)
{
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&type=service&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
if ($user->get_rank() <= 1) {
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=service&delete=' . $result['id'] . '" class="link-danger"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
}?>
} ?>
</tbody>
</table>
</div>
</section>
<section>
<h3 class="pull-left"><?php echo _("Services Groups");?></h3>
<?php if ($user->get_rank() <= 1){?>
<form action="?do=settings&new=service-group" method="post">
<div class="input-group pull-right new-service">
<a href="<?php echo WEB_URL;?>/admin/?do=new-service-group" class="btn btn-success pull-right"><?php echo _("Add new service group");?></a>
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() <= 1) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service-group" class="btn btn-success" role="button"><?php echo _("Add new service group"); ?></a>
<?php } ?>
</div>
</form>
<?php }?>
<div class="table-responsive">
<table class="table">
<thead><tr>
<!--<th scope="col"><?php echo _("ID");?></th>-->
<th scope="col"><?php echo _("Group Name");?></th>
<th scope="col"><?php echo _("In use by");?></th>
<th scope="col"><?php echo _("Description");?></th>
<th scope="col"><?php echo _("Visibility");?></th>
<?php if ($user->get_rank()<=1)
{?>
<th scope="col"><?php echo _("Delete");?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT sg.* , (SELECT COUNT(*) FROM services WHERE services.group_id = sg.id) AS counter FROM services_groups AS sg ORDER BY sg.id ASC");
while($result = $query->fetch_assoc())
{
echo "<tr>";
//echo "<td>".$result['id']."</td>";
echo '<td><a href="'.WEB_URL.'/admin?do=edit-service-group&id='.$result['id'].'">'.$result['name'].'</a></th>';
echo '<td> <span class="badge badge-danger ml-2">'.$result['counter'].'</span>';
echo "<td>".$result['description']."</td>";
echo "<td>".$visibility[$result['visibility']]."</td>";
if ($user->get_rank()<=1)
{
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&type=groups&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
}?>
</tbody>
</table>
<div class="float-start">
<h3><?php echo _("Services Groups"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
</section>
<div>
<div>
<table class="table">
<thead>
<tr>
<!--<th scope="col"><?php echo _("ID"); ?></th>-->
<th scope="col"><?php echo _("Group Name"); ?></th>
<th scope="col"><?php echo _("In use by"); ?></th>
<th scope="col"><?php echo _("Description"); ?></th>
<th scope="col"><?php echo _("Visibility"); ?></th>
<?php if ($user->get_rank() <= 1) { ?>
<th scope="col" class="text-center"><?php echo _("Delete"); ?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT sg.* , (SELECT COUNT(*) FROM services WHERE services.group_id = sg.id) AS counter FROM services_groups AS sg ORDER BY sg.id ASC");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
//echo "<td>".$result['id']."</td>";
echo '<td><a href="' . WEB_URL . '/admin?do=edit-service-group&id=' . $result['id'] . '">' . $result['name'] . '</a></th>';
echo '<td> <span class="badge badge-danger ml-2">' . $result['counter'] . '</span>';
echo "<td>" . $result['description'] . "</td>";
echo "<td>" . $visibility[$result['visibility']] . "</td>";
if ($user->get_rank() <= 1) {
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=groups&delete=' . $result['id'] . '" class=" link-danger"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
} ?>
</tbody>
</table>
</div>
</section>
<section>
<h3 class="pull-left"><?php echo _("Users");?></h3>
<?php if ($user->get_rank() == 0){?> <a href="<?php echo WEB_URL;?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
<div class="table-responsive">
<table class="table">
<thead><tr><th scope="col"><?php echo _("ID");?></th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead>
<tbody>
<?php
$query = $mysqli->query("SELECT * FROM users");
while($result = $query->fetch_assoc())
{
echo "<tr>";
echo "<td>".$result['id']."</td>";
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
echo "<td>".$result['name']."</td>";
echo "<td>".$result['surname']."</td>";
echo "<td><a href=\"mailto:".$result['email']."\">".$result['email']."</a></td>";
echo "<td>".$permissions[$result['permission']]."</td><td>";
echo "<i class='fa fa-".($result['active']?"check success":"times danger")."'></i>";
echo "</td>";
echo "</tr>";
}?>
</tbody>
</table>
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() == 0) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-user" class="btn btn-success" role="button"><?php echo _("Add new user"); ?></a>
<?php } ?>
</div>
<div class="float-start">
<h3><?php echo _("Users"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
</section>
<div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col"><?php echo _("ID"); ?></th>
<th scope="col"><?php echo _("Username"); ?></th>
<th scope="col"><?php echo _("Name"); ?></th>
<th scope="col"><?php echo _("Surname"); ?></th>
<th scope="col"><?php echo _("Email"); ?></th>
<th scope="col"><?php echo _("Role"); ?></th>
<th scope="col" class="text-center">Active</th>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT * FROM users");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $result['id'] . "</td>";
echo "<td><a href='" . WEB_URL . "/admin/?do=user&id=" . $result['id'] . "'>" . $result['username'] . "</a></td>";
echo "<td>" . $result['name'] . "</td>";
echo "<td>" . $result['surname'] . "</td>";
echo "<td><a href=\"mailto:" . $result['email'] . "\">" . $result['email'] . "</a></td>";
echo "<td>" . $permissions[$result['permission']] . "</td>";
echo "<td class=\"text-center\"><i class='fa fa-" . ($result['active'] ? "check success" : "times danger") . "'></i></td>";
echo "</tr>";
} ?>
</tbody>
</table>
</div>
</section>

View File

@ -1,64 +1,56 @@
<?php
$id = $_SESSION['user'];
if (isset($_GET['id']))
{
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
try {
$displayed_user = new User($id);
} catch (Exception $e) {
header("Location: ".WEB_URL."/admin/?do=user");
header("Location: " . WEB_URL . "/admin/?do=user");
}
if (isset($_POST['password']))
{
if (isset($_POST['password'])) {
$displayed_user->change_password();
}
if (isset($_POST['username']))
{
if (isset($_POST['username'])) {
$displayed_user->change_username();
}
if (isset($_POST['name']))
{
if (isset($_POST['name'])) {
$displayed_user->change_name();
}
if (isset($_POST['email']))
{
if (isset($_POST['email'])) {
$success = $displayed_user->email_link();
}
if (isset($_POST['permission']))
{
if (isset($_POST['permission'])) {
$displayed_user->change_permission();
}
if (isset($_GET['what']) && $_GET['what']=='toggle')
{
if (isset($_GET['what']) && $_GET['what'] == 'toggle') {
$displayed_user->toggle();
}
Template::render_header(_("User"), true);
Template::render_header(_("User"), "user", true);
?>
<div class="text-center">
<h1><?php
if ($_SESSION['user'] == $_GET['id'])
{
echo _("User settings");
}else{
echo _("User");
} ?></h1>
<h1><?php
if ($_SESSION['user'] == $_GET['id']) {
echo _("User settings");
} else {
echo _("User");
} ?></h1>
</div>
<?php if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php }
if (isset($success)){?>
<p class="alert alert-success"><?php echo $success?></p>
if (isset($success)) { ?>
<p class="alert alert-success"><?php echo $success ?></p>
<?php }
$displayed_user->render_user_settings();
$displayed_user->render_user_settings();

View File

@ -1,19 +1,17 @@
<?php
if (!file_exists("../config.php"))
{
header("Location: ../");
}
else{
if (!file_exists("../config.php")) {
header("Location: ../");
} else {
require_once("../config.php");
require_once("../classes/constellation.php");
$limit = (isset($_GET['limit'])?$_GET['limit']:5);
$offset = (isset($_GET['offset'])?$_GET['offset']:0);
$timestamp = (isset($_GET['timestamp']))?$_GET['timestamp']:time();
$limit = (isset($_GET['limit']) ? $_GET['limit'] : 5);
$offset = (isset($_GET['offset']) ? $_GET['offset'] : 0);
$timestamp = (isset($_GET['timestamp'])) ? $_GET['timestamp'] : time();
$result = $constellation->get_incidents((isset($_GET['future'])?$_GET['future']:false), $offset, $limit, $timestamp);
$result = $constellation->get_incidents((isset($_GET['future']) ? $_GET['future'] : false), $offset, $limit, $timestamp);
header('Cache-Control: no-cache');
header('Content-type: application/json');
echo json_encode($result);
}
}

View File

@ -1,42 +1,36 @@
<?php
if (!file_exists("../config.php"))
{
if (!file_exists("../config.php")) {
header("Location: ../");
}
else{
} else {
require_once("../config.php");
require_once("../classes/constellation.php");
header('Cache-Control: no-cache');
header('Content-type: application/json');
if (!isset($_GET['id']))
{
$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();
if (!isset($_GET['id'])) {
$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();
if (!count($result))
{
die(json_encode(["error" => _("Service does not exist!")]));
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 = $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)
{
if ($tmp->num_rows) {
$service = new Service($_GET['id'], $result['name'], $tmp->fetch_assoc()['type']);
}
else{
} else {
$service = new Service($_GET['id'], $result['name']);
}
echo json_encode($service);
}
}
}

View File

@ -6,8 +6,8 @@ require_once(__DIR__ . "/service-group.php");
require_once(__DIR__ . "/user.php");
require_once(__DIR__ . "/token.php");
/**
* Facade class
*/
* Facade class
*/
class Constellation
{
@ -18,48 +18,41 @@ class Constellation
* @param int $limit - limits the number of incidents rendered
* @param Boolean $admin - specifies whether to render admin controls
*/
public function render_incidents($future=false, $offset=0, $limit = 5, $admin = 0){
if ($offset<0)
{
public function render_incidents($future = false, $offset = 0, $limit = 5, $admin = 0)
{
if ($offset < 0) {
$offset = 0;
}
$limit = (isset($_GET['limit'])?$_GET['limit']:5);
$offset = (isset($_GET['offset'])?$_GET['offset']:0);
$timestamp = (isset($_GET['timestamp']))?$_GET['timestamp']:time();
$limit = (isset($_GET['limit']) ? $_GET['limit'] : 5);
$offset = (isset($_GET['offset']) ? $_GET['offset'] : 0);
$timestamp = (isset($_GET['timestamp'])) ? $_GET['timestamp'] : time();
$incidents = $this->get_incidents($future, $offset, $limit, $timestamp);
$ajax = isset($_GET['ajax']);
if ($future && count($incidents["incidents"]) && !$ajax)
{
echo "<h3>"._("Planned maintenance")."</h3>";
}
else if (count($incidents["incidents"]) &&!$ajax)
{
if ($offset)
{
echo '<noscript><div class="centered"><a href="'.WEB_URL.'/?offset='.($offset-$limit).'&timestamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
if ($future && count($incidents["incidents"]) && !$ajax) {
echo "<h3>" . _("Planned maintenance") . "</h3>";
} else if (count($incidents["incidents"]) && !$ajax) {
if ($offset) {
echo '<noscript><div class="centered"><a href="' . WEB_URL . '/?offset=' . ($offset - $limit) . '&timestamp=' . $timestamp . '" class="btn btn-default">' . _("Back") . '</a></div></noscript>';
}
echo "<h3>"._("Past incidents")."</h3>";
}
else if (!$future &&!$ajax)
{
echo "<h3>"._("No incidents")."</h3>";
echo "<h3>" . _("Past incidents") . "</h3>";
} else if (!$future && !$ajax) {
echo "<h3>" . _("No incidents") . "</h3>";
}
$show = !$future && $incidents["more"];
$offset += $limit;
if (count($incidents["incidents"])){
if (count($incidents["incidents"])) {
foreach ($incidents['incidents'] as $incident) {
$incident->render($admin);
}
if ($show)
{
echo '<div class="centered"><a href="'.WEB_URL.'/?offset='.($offset).'&timestamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
if ($show) {
echo '<div class="centered"><a href="' . WEB_URL . '/?offset=' . ($offset) . '&timestamp=' . $timestamp . '" id="loadmore" class="btn btn-default">' . _("Load more") . '</a></div>';
}
}
}
@ -69,54 +62,42 @@ class Constellation
* @param boolean $admin
* @return array of services
*/
public function render_status($admin = false, $heading = true){
public function render_status($admin = false, $heading = true)
{
global $mysqli;
//$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 ");
$array = array();
if ($query->num_rows){
if ($query->num_rows) {
$timestamp = time();
while($result = $query->fetch_assoc())
{
while ($result = $query->fetch_assoc()) {
$id = $result['id'];
$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)
{
if ($tmp->num_rows) {
$array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name'], $tmp->fetch_assoc()['type']);
}
else{
} else {
$array[] = new Service($result['id'], $result['name'], $result['description'], $result['group_name']);
}
}
if ($heading)
{
if ($heading) {
echo Service::current_status($array);
}
}
else{
} else {
$array[] = new Service(0, _("No services"), -1);
}
if (!$admin)
{
?>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<?php
if (!$admin) {
//echo '<div id="status-container" class="clearfix">';
//$arrCompletedGroups = array();
foreach($array as $service){
foreach ($array as $service) {
//print_r($service);
//if ( !empty($service->group_name) && !in_array($service->group_name, $arrCompletedGroups)) {
//print $service->name;
//print $service->name;
// $arrCompletedGroups[] = $service['group_name'];
// $service->render(true);
//} else {
@ -125,35 +106,33 @@ class Constellation
}
echo '</ul>';
//echo '</div>';
}
else{
} else {
return $array;
}
}
function get_incidents($future = false, $offset = 0, $limit = 5, $timestamp = 0){
function get_incidents($future = false, $offset = 0, $limit = 5, $timestamp = 0)
{
global $mysqli;
if ($timestamp == 0)
{
if ($timestamp == 0) {
$timestamp = time();
}
$operator = ($future)?">=":"<=";
$operator = ($future) ? ">=" : "<=";
$limit++;
$sql = $mysqli->prepare("SELECT users.id, status.type, status.title, status.text, status.time, status.end_time, users.username, status.id as status_id FROM status INNER JOIN users ON user_id=users.id WHERE `time` $operator ? AND `end_time` $operator ? OR (`time`<=? AND `end_time` $operator ? ) ORDER BY `time` DESC LIMIT ? OFFSET ?");
$sql->bind_param("iiiiii",$timestamp, $timestamp, $timestamp, $timestamp, $limit, $offset);
$sql->bind_param("iiiiii", $timestamp, $timestamp, $timestamp, $timestamp, $limit, $offset);
$sql->execute();
$query = $sql->get_result();
$array = [];
$limit--;
$more = false;
if ($query->num_rows>$limit){
if ($query->num_rows > $limit) {
$more = true;
}
if ($query->num_rows){
while(($result = $query->fetch_assoc()) && $limit-- > 0)
{
if ($query->num_rows) {
while (($result = $query->fetch_assoc()) && $limit-- > 0) {
// Add service id and service names to an array in the Incident class
$stmt_service = $mysqli->prepare("SELECT services.id,services.name FROM services
INNER JOIN services_status ON services.id = services_status.service_id
@ -161,7 +140,7 @@ class Constellation
$stmt_service->bind_param("i", $result['status_id']);
$stmt_service->execute();
$query_service = $stmt_service->get_result();
while($result_service = $query_service->fetch_assoc()) {
while ($result_service = $query_service->fetch_assoc()) {
$result['service_id'][] = $result_service['id'];
$result['service_name'][] = $result_service['name'];
}
@ -198,15 +177,14 @@ class Constellation
function render_alert($alert_type, $header, $message, $show_link = false, $url = null, $link_text = null)
{
echo '<div><h1></h1>
<div class="alert '.$alert_type.'" role="alert">
<h4 class="alert-heading">'.$header.'</h4>
<div class="alert ' . $alert_type . '" role="alert">
<h4 class="alert-heading">' . $header . '</h4>
<hr>
<p class="mb-0">'.$message.'</p>
<p class="mb-0">' . $message . '</p>
</div></div>';
if ( $show_link ) {
echo '<div class="clearfix"><a href="'.$url.'" class="btn btn-success" role="button">'.$link_text.'</a></div>';
if ($show_link) {
echo '<div class="clearfix"><a href="' . $url . '" class="btn btn-success" role="button">' . $link_text . '</a></div>';
}
}
}

View File

@ -3,53 +3,57 @@
class SSDB
{
function execute($conn,$sql){
function execute($conn, $sql)
{
if ($conn->query($sql) === TRUE) {
return true;
return true;
} else {
return $conn->error;
return $conn->error;
}
}
function getSetting($conn,$setting){
$sql = "SELECT value FROM settings WHERE setting='".$setting."'";
function getSetting($conn, $setting)
{
$sql = "SELECT value FROM settings WHERE setting='" . $setting . "'";
$result = $conn->query($sql);
if ($result->num_rows == 1) {
while($row = $result->fetch_assoc()) {
while ($row = $result->fetch_assoc()) {
return $row["value"];
}
} else {
return "null";
}
}
function setSetting($conn,$settingname,$settingvalue){
$sql = "INSERT INTO settings (setting,value) VALUES ('".$settingname."','".$settingvalue."');";
if ($conn->query($sql) === TRUE) {
return true;
} else {
return $conn->error;
}
}
function deleteSetting($conn,$settingname){
$sql = "DELETE FROM settings WHERE setting=\"".$settingname."\";";
function setSetting($conn, $settingname, $settingvalue)
{
$sql = "INSERT INTO settings (setting,value) VALUES ('" . $settingname . "','" . $settingvalue . "');";
if ($conn->query($sql) === TRUE) {
return true;
} else {
return $conn->error;
}
return true;
} else {
return $conn->error;
}
}
function updateSetting($conn, $settingname, $settingvalue){
function deleteSetting($conn, $settingname)
{
$sql = "DELETE FROM settings WHERE setting=\"" . $settingname . "\";";
if ($conn->query($sql) === TRUE) {
return true;
} else {
return $conn->error;
}
}
function updateSetting($conn, $settingname, $settingvalue)
{
$this->deleteSetting($conn, $settingname);
$this->setSetting($conn, $settingname, $settingvalue);
return true;
}
function getBooleanSetting($conn, $setting) {
if (trim($this->getSetting($conn, $setting)) == "yes"){
return true;
}
return false;
function getBooleanSetting($conn, $setting)
{
if (trim($this->getSetting($conn, $setting)) == "yes") {
return true;
}
return false;
}
}

View File

@ -2,8 +2,8 @@
require_once(__DIR__ . "/notification.php");
/**
* Class for creating and rendering an incident
*/
* Class for creating and rendering an incident
*/
class Incident implements JsonSerializable
{
private $id;
@ -24,14 +24,14 @@ class Incident implements JsonSerializable
*/
function __construct($data)
{
//TODO: Maybe get data from id?
//TODO: Maybe get data from id?
$this->id = $data['status_id'];
$this->timestamp = $data['time'];
$this->end_timestamp = $data['end_time'];
$this->date = new DateTime("@".$data['time']);
$this->date = new DateTime("@" . $data['time']);
$this->date = $this->date->format('Y-m-d H:i:sP');
if ($data['end_time']>0){
$this->end_date = new DateTime("@".$data['end_time']);
if ($data['end_time'] > 0) {
$this->end_date = new DateTime("@" . $data['end_time']);
$this->end_date = $this->end_date->format('Y-m-d H:i:sP');
}
$this->type = $data['type'];
@ -46,17 +46,16 @@ class Incident implements JsonSerializable
* Deletes incident by ID.
* @param int ID
*/
public static function delete($id){
public static function delete($id)
{
global $mysqli, $message, $user;
if ($user->get_rank() > 1)
{
if ($user->get_rank() > 1) {
$stmt = $mysqli->prepare("SELECT count(*) as count FROM status WHERE id= ? AND user_id = ?");
$stmt->bind_param("ii", $id, $_SESSION['user']);
$stmt->execute();
$query = $stmt->get_result();
if (!$query->fetch_assoc()['count'])
{
if (!$query->fetch_assoc()['count']) {
$message = _("You don't have permission to do that!");
return;
}
@ -71,7 +70,7 @@ class Incident implements JsonSerializable
$stmt->bind_param("i", $id);
$stmt->execute();
$query = $stmt->get_result();
header("Location: ".WEB_URL."/admin");
header("Location: " . WEB_URL . "/admin");
}
/**
@ -84,77 +83,66 @@ class Incident implements JsonSerializable
{
global $mysqli, $message;
//Sould be a better way to get this array...
$statuses = array(_("Major outage"), _("Minor outage"), _("Planned maintenance"), _("Operational") );
$statuses = array(_("Major outage"), _("Minor outage"), _("Planned maintenance"), _("Operational"));
$user_id = $_SESSION['user'];
$type = $_POST['type'];
$title = strip_tags($_POST['title']);
$text = strip_tags($_POST['text'], '<br>');
if (strlen($title)==0)
{
if (strlen($title) == 0) {
$message = _("Please enter title");
return;
}else if(strlen($title)>50){
} else if (strlen($title) > 50) {
$message = _("Title too long! Character limit is 50");
return;
}
if (strlen($title)==0)
{
if (strlen($title) == 0) {
$message = _("Please enter text");
return;
}
if ($type == 2 && (!strlen(trim($_POST['time'])) || !strlen(trim($_POST['end_time']))))
{
if ($type == 2 && (!strlen(trim($_POST['time'])) || !strlen(trim($_POST['end_time'])))) {
$message = _("Please set start and end time! Use ISO 8601 format.");
return;
}
if (empty($_POST['services'])){
if (empty($_POST['services'])) {
$message = _("Please select at least one service");
}
else
{
if (!is_array($_POST['services']))
{
} else {
if (!is_array($_POST['services'])) {
$services = array($_POST['services']);
}
else
{
} else {
$services = $_POST['services'];
}
if (!empty($_POST['time']) && $type == 2){
$input_time = (!empty($_POST['time_js'])?$_POST['time_js']: $_POST['time']);
$input_end_time = (!empty($_POST['end_time_js'])?$_POST['end_time_js']: $_POST['end_time']);
if (!empty($_POST['time']) && $type == 2) {
$input_time = (!empty($_POST['time_js']) ? $_POST['time_js'] : $_POST['time']);
$input_end_time = (!empty($_POST['end_time_js']) ? $_POST['end_time_js'] : $_POST['end_time']);
$time = strtotime($input_time);
$end_time = strtotime($input_end_time);
if (!$time)
{
if (!$time) {
$message = _("Start date format is not recognized. Please use ISO 8601 format.");
return;
}
if (!$end_time)
{
if (!$end_time) {
$message = _("End date format is not recognized. Please use ISO 8601 format.");
return;
}
if ($time >= $end_time)
{
if ($time >= $end_time) {
$message = _("End time is either the same or earlier than start time!");
return;
}
}else{
} else {
$time = time();
$end_time = '';
}
$stmt = $mysqli->prepare("INSERT INTO status VALUES (NULL,?, ?, ?, ?, ?, ?)");
$stmt->bind_param("issiii", $type, $title, $text, $time ,$end_time ,$user_id);
$stmt->bind_param("issiii", $type, $title, $text, $time, $end_time, $user_id);
$stmt->execute();
$query = $stmt->get_result();
$status_id = $mysqli->insert_id;
@ -178,7 +166,7 @@ class Incident implements JsonSerializable
$notify->notify_subscribers();
header("Location: ".WEB_URL."/admin?sent=true");
header("Location: " . WEB_URL . "/admin?sent=true");
}
}
@ -187,43 +175,46 @@ class Incident implements JsonSerializable
* @param Boolean $admin - decides whether admin controls should be rendered
* @return void
*/
public function render($admin=0){
public function render($admin = 0)
{
global $icons;
global $classes, $user;
$admin = $admin && (($user->get_rank()<=1) || ($user->get_username() == $this->username));
$admin = $admin && (($user->get_rank() <= 1) || ($user->get_username() == $this->username));
$Parsedown = new Parsedown();
?>
<article class="panel panel-<?php echo $classes[$this->type];?>">
<div class="panel-heading icon">
<i class="<?php echo $icons[$this->type];?>"></i>
?>
<article class="card border-<?php echo $classes[$this->type]; ?> mb-3">
<div class="card-colore icon bg-<?php echo $classes[$this->type]; ?>"><i class="<?php echo $icons[$this->type]; ?>"></i></div>
<div class="card-header bg-<?php echo $classes[$this->type]; ?> border-<?php echo $classes[$this->type]; ?>">
<?php echo $this->title; ?>
<div class="float-end">
<?php if ($admin) {
echo '<a href="' . WEB_URL . '/admin/?delete=' . $this->id . '" class="delete"><i class="fa fa-trash"></i></a>';
} ?>
</div>
<div class="panel-heading clearfix">
<h2 class="panel-title"><?php echo $this->title; ?></h2>
<?php if ($admin){
echo '<a href="'.WEB_URL.'/admin/?delete='.$this->id.'" class="pull-right delete"><i class="fa fa-trash"></i></a>';
}?>
<time class="pull-right timeago" datetime="<?php echo $this->date; ?>"><?php echo $this->date; ?></time>
</div>
<div class="panel-body">
<?php echo $Parsedown->setBreaksEnabled(true)->text($this->text); ?>
</div>
<div class="panel-footer clearfix">
<small>
<?php echo _("Impacted service(s): ");
foreach ( $this->service_name as $value ) {
echo '<span class="label label-default">'.$value . '</span>&nbsp;';
}
if (isset($this->end_date)){?>
<span class="pull-right"><?php echo strtotime($this->end_date)>time()?_("Ending"):_("Ended");?>:&nbsp;<time class="pull-right timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<?php } ?>
</small>
</div>
</article>
<?php
<time class="float-end timeago" datetime="<?php echo $this->date; ?>"><?php echo $this->date; ?></time>
</div>
<div class="card-body">
<?php echo $Parsedown->setBreaksEnabled(true)->text($this->text); ?>
</div>
<div class="card-footer bg-transparent border-<?php echo $classes[$this->type]; ?>">
<p class="card-title">
<?php echo _("Impacted service(s): "); ?>
<?php if (isset($this->end_date)) { ?>
<span class="float-end"><?php echo strtotime($this->end_date) > time() ? _("Ending") : _("Ended"); ?>:&nbsp;<time class="timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<?php } ?>
</p>
<p class="card-badge">
<?php foreach ($this->service_name as $value) {
echo '<span class="badge bg-secondary">' . $value . '</span>&nbsp;';
} ?>
</p>
</div>
</article>
<?php
}
public function jsonSerialize() {
public function jsonSerialize()
{
return [
"id" => $this->id,
"date" => $this->timestamp,

View File

@ -1,10 +1,11 @@
<?php
/**
* This class is used to negotiate language displayed to user.
* Reads browser preferences and chooses the best language from list
*/
* This class is used to negotiate language displayed to user.
* Reads browser preferences and chooses the best language from list
*/
class LocaleNegotiator
{
{
private $accepted_langs = [];
private $default_language;
private $all_locales = array(
@ -220,15 +221,15 @@ class LocaleNegotiator
'zh_SG' => '中文',
'zh_TW' => '中文',
'zu_ZA' => 'Isizulu',
);
);
/**
* This method scans for languages and creates a list of language and its name (localized ofc.)
* @param String $default_language language displayed to user in case no suitable lang is found
*/
* This method scans for languages and creates a list of language and its name (localized ofc.)
* @param String $default_language language displayed to user in case no suitable lang is found
*/
function __construct($default_language)
{
$tmp = glob(__DIR__ . '/../locale/*' , GLOB_ONLYDIR);
$tmp = glob(__DIR__ . '/../locale/*', GLOB_ONLYDIR);
$this->default_language = $default_language;
//Works only if the server supports the locale
//This basically means $accepted_langs[<lang_code>] = "<lang name>";
@ -239,41 +240,42 @@ class LocaleNegotiator
}
/**
* Returns list of accepted langs so it can be reused for rendering language list for switching...
*/
public function get_accepted_langs(){
* Returns list of accepted langs so it can be reused for rendering language list for switching...
*/
public function get_accepted_langs()
{
return $this->accepted_langs;
}
/**
* This method does the actual negotiation. It has override parameter in case user wants to switch
* languages.
* @param String $override adds language to list of preffered languages with highest priority
* @return String language code that matched best with browser preferences
*/
public function negotiate($override = null){
* This method does the actual negotiation. It has override parameter in case user wants to switch
* languages.
* @param String $override adds language to list of preffered languages with highest priority
* @return String language code that matched best with browser preferences
*/
public function negotiate($override = null)
{
$langs = [];
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$http_accept_language = str_replace("-", "_", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $http_accept_language, $lang_parse);
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $http_accept_language, $lang_parse);
if (count($lang_parse[1])) {
$langs = array_combine($lang_parse[1], $lang_parse[4]);
foreach ($langs as $lang => $val) {
//If browser didn't send quality of language, it is 1 by default
if ($val === '') $langs[$lang] = 1;
}
if (count($lang_parse[1])) {
$langs = array_combine($lang_parse[1], $lang_parse[4]);
if (isset($override))
{
//More important than the best lang of browser
$langs[$override] = 2;
}
foreach ($langs as $lang => $val) {
//If browser didn't send quality of language, it is 1 by default
if ($val === '') $langs[$lang] = 1;
}
arsort($langs, SORT_NUMERIC);
}
if (isset($override)) {
//More important than the best lang of browser
$langs[$override] = 2;
}
arsort($langs, SORT_NUMERIC);
}
}
//So we have lang code as value
@ -285,18 +287,18 @@ class LocaleNegotiator
global $lang;
foreach ($langs as $lang) {
if (strlen($lang)>2){
if (in_array($lang, $accepted_langs)){
if (strlen($lang) > 2) {
if (in_array($lang, $accepted_langs)) {
$best_match = $lang;
break;
}
}else{
$possible = array_filter($accepted_langs, function($key) {
} else {
$possible = array_filter($accepted_langs, function ($key) {
global $lang;
return strpos($key, $lang) === 0;
return strpos($key, $lang) === 0;
});
if (count($possible)){
if (count($possible)) {
foreach ($possible as $value) {
$best_match = $value;
}
@ -305,11 +307,10 @@ class LocaleNegotiator
}
}
if ($best_match === false){
if ($best_match === false) {
$best_match = $this->default_language;
}
return $best_match;
}
}

View File

@ -15,10 +15,11 @@ if (file_exists("libs/php_idn/idna.php")) {
require_once("../libs/php_idn/idna.php");
}
class Mailer {
public function __construct(){
class Mailer
{
public function __construct()
{
}
/**
@ -28,7 +29,8 @@ class Mailer {
* @param boolean $html Set to true if we are sending HTML Mailer
* @return boolean True if success
*/
public function send_mail($to, $subject, $message, $html = true) {
public function send_mail($to, $subject, $message, $html = true)
{
// TODO -Handle $to as an array in order to send to muliple recipients without having
// to call the entire send_mail function over and over..
@ -36,19 +38,19 @@ class Mailer {
// Convert IDN/punycode domain to ascii
// TODO Handle IDN in left hand side of email address
if ( $this->is_utf8($to) ) {
if ($this->is_utf8($to)) {
$elements = explode('@', $to);
$domainpart = EncodePunycodeIDN(array_pop($elements)); // Convert domain part to ascii
$to = $elements[0] . '@' . $domainpart; // Reassemble tge full email address
}
// Send using PHP mailer if it is enabled
if ( PHP_MAILER ) {
require_once(PHP_MAILER_PATH .'/Exception.php'); /* Exception class. */
require_once(PHP_MAILER_PATH .'/PHPMailer.php'); /* The main PHPMailer class. */
if (PHP_MAILER) {
require_once(PHP_MAILER_PATH . '/Exception.php'); /* Exception class. */
require_once(PHP_MAILER_PATH . '/PHPMailer.php'); /* The main PHPMailer class. */
if ( PHP_MAILER_SMTP ) {
require_once(PHP_MAILER_PATH .'/SMTP.php'); /* SMTP class, needed if you want to use SMTP. */
if (PHP_MAILER_SMTP) {
require_once(PHP_MAILER_PATH . '/SMTP.php'); /* SMTP class, needed if you want to use SMTP. */
}
$phpmail = new PHPMailer(false);
@ -58,7 +60,7 @@ class Mailer {
//$phpmail->Debugoutput = error_log;
// Define SMTP parameters if enabled
if ( PHP_MAILER_SMTP ) {
if (PHP_MAILER_SMTP) {
$phpmail->isSMTP();
$phpmail->Host = PHP_MAILER_HOST;
@ -67,7 +69,7 @@ class Mailer {
//$phpmail->SMTPDebug = 2; // Enable for debugging
// Handle authentication for SMTP if enabled
if ( !empty(PHP_MAILER_USER) ) {
if (!empty(PHP_MAILER_USER)) {
$phpmail->SMTPAuth = true;
$phpmail->Username = PHP_MAILER_USER;
$phpmail->Password = PHP_MAILER_PASS;
@ -77,7 +79,7 @@ class Mailer {
$phpmail->addAddress($to);
$phpmail->Subject = $subject;
// Send HMTL mail
if ( $html ) {
if ($html) {
$phpmail->msgHtml($message);
$phpmail->AltBody = $this->convert_html_to_plain_txt($message, false);
} else {
@ -85,24 +87,22 @@ class Mailer {
}
$phpmail->isHtml($html); // use htmlmail if enabled
if ( ! $phpmail->send() ) {
if (!$phpmail->send()) {
// TODO Log error message $phpmail->ErrorInfo;
return false;
}
return true;
} else {
// Use standard PHP mail() function
$headers = "Content-Type: $content_type; \"charset=utf-8\" ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$headers .= "Reply-To: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$headers = "Content-Type: $content_type; \"charset=utf-8\" " . PHP_EOL;
$headers .= "MIME-Version: 1.0 " . PHP_EOL;
$headers .= "From: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
$headers .= "Reply-To: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
mail($to, $subject, $message, $headers);
// TODO log error message if mail fails
return true;
}
}
/**
* Tries to verify the domain using dns request against an MX record of the domain part
@ -112,11 +112,12 @@ class Mailer {
* @param String $email Email address to check
* @return boolean True if MX record exits, false if otherwise
*/
public function verify_domain($email){
public function verify_domain($email)
{
// TODO - Handle idn/punycode domain names without being dependent on PHP native libs.
$domain = explode('@', $email);
$domain = EncodePunycodeIDN(array_pop($domain).'.'); // Add dot at end of domain to avoid local domain lookups
syslog(1,$domain);
$domain = EncodePunycodeIDN(array_pop($domain) . '.'); // Add dot at end of domain to avoid local domain lookups
syslog(1, $domain);
return checkdnsrr($domain, 'MX');
}
@ -145,20 +146,22 @@ class Mailer {
* @param boolean $remove_links Set to true if links should be removed from email
* @return String pain text version
*/
public function convert_html_to_plain_txt($content, $remove_links=false){
public function convert_html_to_plain_txt($content, $remove_links = false)
{
// TODO does not handle unsubscribe/manage subscription text very well.
// Replace HTML line breaks with text line breaks
$plain_text = str_ireplace(array("<br>","<br />"), "\n\r", $content);
$plain_text = str_ireplace(array("<br>", "<br />"), "\n\r", $content);
// Remove the content between the tags that wouldn't normally get removed with the strip_tags function
$plain_text = preg_replace(array('@<head[^>]*?>.*?</head>@siu',
$plain_text = preg_replace(array(
'@<head[^>]*?>.*?</head>@siu',
'@<style[^>]*?>.*?</style>@siu',
'@<script[^>]*?.*?</script>@siu',
'@<noscript[^>]*?.*?</noscript>@siu',
), "", $plain_text); // Remove everything from between the tags that doesn't get removed with strip_tags function
// If the user has chosen to preserve the addresses from links
if(!$remove_links){
if (!$remove_links) {
$plain_text = strip_tags(preg_replace('/<a href="(.*)">/', ' $1 ', $plain_text));
}
@ -166,9 +169,8 @@ class Mailer {
$plain_text = str_replace("&nbsp;", "", $plain_text);
// Replace multiple line breaks with a single line break
$plain_text = preg_replace("/(\s){3,}/","\r\n\r\n",trim($plain_text));
$plain_text = preg_replace("/(\s){3,}/", "\r\n\r\n", trim($plain_text));
return $plain_text;
}
}

View File

@ -25,7 +25,7 @@ class Notification
public function populate_impacted_services($status_id)
{
global $mysqli;
if (! empty($status_id)) {
if (!empty($status_id)) {
// Fetch services names for use in email
$stmt = $mysqli->prepare("SELECT services.id, services.name FROM services INNER JOIN services_status on services.id = services_status.service_id WHERE services_status.status_id = ?");
$stmt->bind_param("i", $status_id);
@ -66,7 +66,7 @@ class Notification
$queue->user_id = $_SESSION['user'];
$arr_data = array();
if ( SUBSCRIBE_EMAIL ) {
if (SUBSCRIBE_EMAIL) {
$arr_data = $this->prepare_email(); // Make up the base message and subject for email
$queue->type_id = $queue->all_type_id['notify_email'];
$queue->template_data1 = $arr_data['subject'];
@ -75,7 +75,7 @@ class Notification
//syslog(1, "queue email: ". $task_id_email);
$arr_email = array();
}
if ( SUBSCRIBE_TELEGRAM ) {
if (SUBSCRIBE_TELEGRAM) {
$arr_data = $this->prepare_telegram();
$queue->type_id = $queue->all_type_id['notify_telegram'];
$queue->template_data1 = null;
@ -103,16 +103,14 @@ class Notification
if ($typeID == 2 && SUBSCRIBE_EMAIL) {
$arr_email[] = $subscriber['subscriberIDFK'];
}
}
}
if ( SUBSCRIBE_TELEGRAM) {
if (SUBSCRIBE_TELEGRAM) {
$queue->task_id = $task_id_telegram;
$queue->add_notification($arr_telegram); // Add array of Telegram users to the notification queue list
}
if ( SUBSCRIBE_EMAIL ) {
if (SUBSCRIBE_EMAIL) {
$queue->task_id = $task_id_email;
$queue->add_notification($arr_email); // Add array of Email users to the notification queue list
}
@ -132,13 +130,12 @@ class Notification
$msg = sprintf($msg, $firstname);
$tg_message = array('text' => $msg, 'chat_id' => $userID, 'parse_mode' => 'HTML');
$json = @file_get_contents("https://api.telegram.org/bot" . TG_BOT_API_TOKEN . "/sendMessage?" . http_build_query($tg_message) );
$json = @file_get_contents("https://api.telegram.org/bot" . TG_BOT_API_TOKEN . "/sendMessage?" . http_build_query($tg_message));
$response = json_decode($json, true);
if (!is_array($response) || ! array_key_exists("ok", $response) || $response['ok'] != 1 ) {
if (!is_array($response) || !array_key_exists("ok", $response) || $response['ok'] != 1) {
return false;
}
return true;
}
@ -154,13 +151,14 @@ class Notification
{
// TODO Error handling
$mailer = new Mailer();
if ( ! $mailer->send_mail($subscriber, $subject, $msg, true) ) {
return false;
if (!$mailer->send_mail($subscriber, $subject, $msg, true)) {
return false;
}
return true;
}
public function prepare_email(){
public function prepare_email()
{
$Parsedown = new Parsedown();
$str_mail = file_get_contents("../libs/templates/email_status_update.html");
@ -189,7 +187,8 @@ class Notification
return $val;
}
public function prepare_telegram(){
public function prepare_telegram()
{
$msg = _("Hi #s!\nThere is a status update for service(s): %s\nThe new status is: %s\nTitle: %s\n\n%s\n\n<a href='%s'>View online</a>");
$val['body'] = sprintf($msg, $this->servicenames, $this->status, $this->title, $this->text, WEB_URL);
return $val;

View File

@ -5,157 +5,167 @@
*/
class Queue
{
public $task_id;
public $type_id;
public $status;
public $template_data1; // i.e. Subject for email
public $template_data2; // i.e. HTML email body
public $create_time;
public $completed_time;
public $num_errors;
public $user_id;
public $all_type_id = array('notify_telegram' => 1,
'notify_email' => 2);
public $task_id;
public $type_id;
public $status;
public $template_data1; // i.e. Subject for email
public $template_data2; // i.e. HTML email body
public $create_time;
public $completed_time;
public $num_errors;
public $user_id;
public $all_type_id = array(
'notify_telegram' => 1,
'notify_email' => 2
);
public $all_status = array('populating' => 1,
'ready' => 2,
'processing' => 3,
'completed' => 4,
'failed' => 5);
public $all_status = array(
'populating' => 1,
'ready' => 2,
'processing' => 3,
'completed' => 4,
'failed' => 5
);
public function add_task() {
global $mysqli;
$stmt = $mysqli->prepare("INSERT INTO queue_task (type_id, status, template_data1, template_data2, created_time, user_id) VALUES (?,?,?,?,?,?)");
if ( false===$stmt ) {
//die('prepare() failed: ' . htmlspecialchars($mysqli->error));
echo $mysqli->errno();
}
#if ( false === $stmt ) { syslog(1, "Error :". $mysqli->error); }
$now = time();
$res = $stmt->bind_param("iissii", $this->type_id, $this->status, $this->template_data1, $this->template_data2, $now, $this->user_id);
if ( false === $res ) {
echo "error";
die();
}
$stmt->execute();
$query = $stmt->get_result();
print $query;
$this->task_id = $mysqli->insert_id;
return $this->task_id;
public function add_task()
{
global $mysqli;
$stmt = $mysqli->prepare("INSERT INTO queue_task (type_id, status, template_data1, template_data2, created_time, user_id) VALUES (?,?,?,?,?,?)");
if (false === $stmt) {
//die('prepare() failed: ' . htmlspecialchars($mysqli->error));
echo $mysqli->errno();
}
/**
* Remove task from the queue
* @return void
*/
public function delete_task($task_id){
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM queue_task WHERE id = ?");
$stmt->bind_param("i", $task_id);
$stmt->execute();
#if ( false === $stmt ) { syslog(1, "Error :". $mysqli->error); }
$now = time();
$res = $stmt->bind_param("iissii", $this->type_id, $this->status, $this->template_data1, $this->template_data2, $now, $this->user_id);
if (false === $res) {
echo "error";
die();
}
$stmt->execute();
$query = $stmt->get_result();
print $query;
$this->task_id = $mysqli->insert_id;
return $this->task_id;
}
/**
* Update status for given task
* @param int $new_status The new current status of the task. Must be selected from the $all_status array.
* @return void
*/
public function set_task_status($new_status) {
global $mysqli;
$stmt = $mysqli->prepare("UPDATE queue_task SET status = ? WHERE id = ?");
$stmt->bind_param("ii", $new_status, $this->task_id);
$stmt->execute();
$this->status = $new_status;
/**
* Remove task from the queue
* @return void
*/
public function delete_task($task_id)
{
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM queue_task WHERE id = ?");
$stmt->bind_param("i", $task_id);
$stmt->execute();
}
/**
* Update status for given task
* @param int $new_status The new current status of the task. Must be selected from the $all_status array.
* @return void
*/
public function set_task_status($new_status)
{
global $mysqli;
$stmt = $mysqli->prepare("UPDATE queue_task SET status = ? WHERE id = ?");
$stmt->bind_param("ii", $new_status, $this->task_id);
$stmt->execute();
$this->status = $new_status;
}
/**
* Add notification queue data for given task
* @param array $arr_data Array filled with subscriber_id
* @return void
*/
public function add_notification($arr_data)
{
global $mysqli;
//Default status = 1, retres = 0, task_id = $this->task_id
// Build query manually since mysqli doesn't cater well for multi insert..
$count = count($arr_data); // Let's find number of elements
$counter = 0;
$query = '';
$seperator = ',';
$sub_query = '(%d, %d, %d ,%d)%s';
foreach ($arr_data as $value) {
$counter++;
if ($counter == $count) {
$seperator = '';
} // Make sure last character for SQL query is correct
$query .= sprintf($sub_query, $this->task_id, 1, $value, 0, $seperator);
}
$sql = "INSERT INTO queue_notify (task_id, status, subscriber_id, retries) VALUES " . $query;
/**
* Add notification queue data for given task
* @param array $arr_data Array filled with subscriber_id
* @return void
*/
public function add_notification($arr_data) {
global $mysqli;
$mysqli->query($sql);
//Default status = 1, retres = 0, task_id = $this->task_id
$this->set_task_status($this->all_status['ready']); // Make task available for release
}
// Build query manually since mysqli doesn't cater well for multi insert..
$count = count($arr_data); // Let's find number of elements
$counter = 0;
$query = '';
$seperator = ',';
$sub_query = '(%d, %d, %d ,%d)%s';
public function update_notification_retries($task_id, $subscriber_id)
{
global $mysqli;
$stmt = $mysqli->prepare("UPDATE queue_notify SET retries = retries+1 WHERE task_id = ? AND subscriber_id = ?");
$stmt->bind_param("ii", $task_id, $subscriber_id);
$stmt->execute();
}
foreach ($arr_data as $value) {
$counter++;
if ($counter == $count) { $seperator = ''; } // Make sure last character for SQL query is correct
$query .= sprintf($sub_query, $this->task_id, 1, $value, 0, $seperator);
}
$sql = "INSERT INTO queue_notify (task_id, status, subscriber_id, retries) VALUES ". $query;
public function delete_notification($task_id, $subscriber_id)
{
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM queue_notify WHERE task_id = ? AND subscriber_id = ?");
$stmt->bind_param("ii", $task_id, $subscriber_id);
$stmt->execute();
}
$mysqli->query($sql);
// TODO: Fix max attempts for notifications
public function process_queue()
{
global $mysqli;
$stmt = $mysqli->query("SELECT qn.id, qn.task_id, qn.status, qn.subscriber_id, qn.retries, sub.firstname, sub.userID, sub.token FROM queue_notify AS qn INNER JOIN subscribers AS sub ON qn.subscriber_id = sub.subscriberID WHERE qn.status NOT LIKE 2 AND sub.active=1");
while ($result = $stmt->fetch_assoc()) {
$this->set_task_status($this->all_status['ready']); // Make task available for release
}
$i = 2;
$stmt2 = $mysqli->prepare("SELECT * FROM queue_task WHERE id = ? AND status = ?");
$stmt2->bind_param("ii", $result['task_id'], $i);
$stmt2->execute();
$tmp = $stmt2->get_result();
$result2 = $tmp->fetch_assoc();
$typeID = $result2['type_id'];
public function update_notification_retries($task_id, $subscriber_id) {
global $mysqli;
$stmt = $mysqli->prepare("UPDATE queue_notify SET retries = retries+1 WHERE task_id = ? AND subscriber_id = ?");
$stmt->bind_param("ii", $task_id, $subscriber_id);
$stmt->execute();
}
public function delete_notification($task_id, $subscriber_id) {
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM queue_notify WHERE task_id = ? AND subscriber_id = ?");
$stmt->bind_param("ii", $task_id, $subscriber_id);
$stmt->execute();
}
// TODO: Fix max attempts for notifications
public function process_queue(){
global $mysqli;
$stmt = $mysqli->query("SELECT qn.id, qn.task_id, qn.status, qn.subscriber_id, qn.retries, sub.firstname, sub.userID, sub.token FROM queue_notify AS qn INNER JOIN subscribers AS sub ON qn.subscriber_id = sub.subscriberID WHERE qn.status NOT LIKE 2 AND sub.active=1");
while ( $result = $stmt->fetch_assoc() ) {
$i = 2;
$stmt2 = $mysqli->prepare("SELECT * FROM queue_task WHERE id = ? AND status = ?");
$stmt2->bind_param("ii", $result['task_id'], $i);
$stmt2->execute();
$tmp = $stmt2->get_result();
$result2 = $tmp->fetch_assoc();
$typeID = $result2['type_id'];
// Handle telegram
if ($typeID == 1) {
$msg = str_replace("#s", $result['firstname'], $result2['template_data2']);
if ( ! Notification::submit_queue_telegram($result['userID'], $result['firstname'], $msg) ) {
Queue::update_notification_retries($result['task_id'], $result['subscriber_id']); // Sent
} else {
Queue::delete_notification($result['task_id'], $result['subscriber_id']); // Failed
}
}
// Handle email
if ($typeID == 2) {
$msg = str_replace("%token%", $result['token'], $result2['template_data2']);
if ( ! Notification::submit_queue_email($result['userID'], $result2['template_data1'], $msg) ) {
Queue::update_notification_retries($result['task_id'], $result['subscriber_id']); // Sent
} else {
Queue::delete_notification($result['task_id'], $result['subscriber_id']); // Failed
}
}
}
// Check if queue log is empty and if so delete the queue_task
$stmt = $mysqli->query("SELECT id, (SELECT COUNT(*) FROM queue_notify AS qn WHERE qn.task_id = queue_task.id) AS count FROM queue_task");
while ( $result = $stmt->fetch_assoc() ) {
if ( $result['count'] == 0 ) {
Queue::delete_task($result['id']);
// Handle telegram
if ($typeID == 1) {
$msg = str_replace("#s", $result['firstname'], $result2['template_data2']);
if (!Notification::submit_queue_telegram($result['userID'], $result['firstname'], $msg)) {
Queue::update_notification_retries($result['task_id'], $result['subscriber_id']); // Sent
} else {
Queue::delete_notification($result['task_id'], $result['subscriber_id']); // Failed
}
}
// Handle email
if ($typeID == 2) {
$msg = str_replace("%token%", $result['token'], $result2['template_data2']);
if (!Notification::submit_queue_email($result['userID'], $result2['template_data1'], $msg)) {
Queue::update_notification_retries($result['task_id'], $result['subscriber_id']); // Sent
} else {
Queue::delete_notification($result['task_id'], $result['subscriber_id']); // Failed
}
}
}
// Check if queue log is empty and if so delete the queue_task
$stmt = $mysqli->query("SELECT id, (SELECT COUNT(*) FROM queue_notify AS qn WHERE qn.task_id = queue_task.id) AS count FROM queue_task");
while ($result = $stmt->fetch_assoc()) {
if ($result['count'] == 0) {
Queue::delete_task($result['id']);
}
}
}
}

View File

@ -1,7 +1,8 @@
<?php
/**
* Class for managing services
*/
* Class for managing services
*/
class ServiceGroup
{
private $id;
@ -63,17 +64,15 @@ class ServiceGroup
public static function add()
{
global $user, $message;
if (strlen($_POST['group'])>50)
{
if (strlen($_POST['group']) > 50) {
$message = _("Service group name is too long! Character limit is 50");
return;
}else if (strlen(trim($_POST['group']))==0){
} else if (strlen(trim($_POST['group'])) == 0) {
$message = _("Please enter name!");
return;
}
if ($user->get_rank()<=1)
{
if ($user->get_rank() <= 1) {
global $mysqli;
$name = $_POST["group"];
$description = $_POST["description"];
@ -82,9 +81,8 @@ class ServiceGroup
$stmt->bind_param("ssi", $name, $description, $visibility_id);
$stmt->execute();
$stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}else
{
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -92,17 +90,15 @@ class ServiceGroup
public static function edit()
{
global $user, $message;
if (strlen($_POST['group'])>50)
{
if (strlen($_POST['group']) > 50) {
$message = _("Service group name is too long! Character limit is 50");
return;
}else if (strlen(trim($_POST['group']))==0){
} else if (strlen(trim($_POST['group'])) == 0) {
$message = _("Please enter name!");
return;
}
if ($user->get_rank()<=1)
{
if ($user->get_rank() <= 1) {
global $mysqli;
$name = $_POST["group"];
$description = $_POST["description"];
@ -112,9 +108,8 @@ class ServiceGroup
$stmt->bind_param("ssii", $name, $description, $visibility_id, $group_id);
$stmt->execute();
$stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}else
{
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -125,8 +120,7 @@ class ServiceGroup
public static function delete()
{
global $user, $message;
if ($user->get_rank()<=1)
{
if ($user->get_rank() <= 1) {
global $mysqli;
$id = $_GET['delete'];
@ -140,10 +134,8 @@ class ServiceGroup
$stmt->execute();
$query = $stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}
else
{
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -153,7 +145,8 @@ class ServiceGroup
* Get list of services groups.
* @return array $groups
*/
public function get_groups() {
public function get_groups()
{
global $mysqli;
$stmt = $mysqli->query("SELECT id, name FROM services_groups ORDER by name ASC");

View File

@ -1,7 +1,8 @@
<?php
/**
* Class for managing services
*/
* Class for managing services
*/
class Service implements JsonSerializable
{
private $id;
@ -17,7 +18,7 @@ class Service implements JsonSerializable
* @param String $descriotion service description for tooltip
* @param int $status current service status
*/
function __construct($id, $name, $description=null, $group_name='', $status=3)
function __construct($id, $name, $description = null, $group_name = '', $status = 3)
{
//TODO: Maybe get data from ID?
$this->id = $id;
@ -72,17 +73,15 @@ class Service implements JsonSerializable
public static function add()
{
global $user, $message;
if (strlen($_POST['service'])>50)
{
if (strlen($_POST['service']) > 50) {
$message = _("Service name is too long! Character limit is 50");
return;
}else if (strlen(trim($_POST['service']))==0){
} else if (strlen(trim($_POST['service'])) == 0) {
$message = _("Please enter name!");
return;
}
if ($user->get_rank()<=1)
{
if ($user->get_rank() <= 1) {
global $mysqli;
$name = htmlspecialchars($_POST['service']);
$description = htmlspecialchars($_POST['description']);
@ -91,48 +90,44 @@ class Service implements JsonSerializable
$stmt->bind_param("ssi", $name, $description, $group_id);
$stmt->execute();
$stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}else
{
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
/**
* Processes submitted form and adds service unless problem is encountered,
* calling this is possible only for admin or higher rank. Also checks requirements
* for char limits.
* @return void
*/
public static function edit()
{
global $user, $message;
if (strlen($_POST['service'])>50)
{
$message = _("Service name is too long! Character limit is 50");
return;
}else if (strlen(trim($_POST['service']))==0){
$message = _("Please enter name!");
return;
}
if ($user->get_rank()<=1)
{
global $mysqli;
$service_id = $_POST["id"];
$name = htmlspecialchars($_POST['service']);
$description = htmlspecialchars($_POST["description"]);
$group_id = $_POST["group_id"];
$stmt = $mysqli->prepare("UPDATE services SET name=?, description=?, group_id=? WHERE id = ?");
$stmt->bind_param("ssii", $name, $description, $group_id, $service_id);
$stmt->execute();
$stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}else
{
$message = _("You don't have the permission to do that!");
}
* Processes submitted form and adds service unless problem is encountered,
* calling this is possible only for admin or higher rank. Also checks requirements
* for char limits.
* @return void
*/
public static function edit()
{
global $user, $message;
if (strlen($_POST['service']) > 50) {
$message = _("Service name is too long! Character limit is 50");
return;
} else if (strlen(trim($_POST['service'])) == 0) {
$message = _("Please enter name!");
return;
}
if ($user->get_rank() <= 1) {
global $mysqli;
$service_id = $_POST["id"];
$name = htmlspecialchars($_POST['service']);
$description = htmlspecialchars($_POST["description"]);
$group_id = $_POST["group_id"];
$stmt = $mysqli->prepare("UPDATE services SET name=?, description=?, group_id=? WHERE id = ?");
$stmt->bind_param("ssii", $name, $description, $group_id, $service_id);
$stmt->execute();
$stmt->get_result();
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
/**
* Deletes this service - first checks if user has permission to do that.
* @return void
@ -140,8 +135,7 @@ class Service implements JsonSerializable
public static function delete()
{
global $user, $message;
if ($user->get_rank()<=1)
{
if ($user->get_rank() <= 1) {
global $mysqli;
$id = $_GET['delete'];
@ -151,8 +145,7 @@ class Service implements JsonSerializable
$query = $stmt->get_result();
while ($res = $query->fetch_assoc()) {
if ($res['count']==1)
{
if ($res['count'] == 1) {
Incident::delete($res['status']);
}
}
@ -167,10 +160,8 @@ class Service implements JsonSerializable
$stmt->execute();
$query = $stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=settings");
}
else
{
header("Location: " . WEB_URL . "/admin/?do=settings");
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -180,25 +171,24 @@ class Service implements JsonSerializable
* @param Service[] $array array of services
* @return void
*/
public static function current_status($array){
public static function current_status($array)
{
global $all, $some, $classes;
$statuses = array(0,0,0,0);
$statuses = array(0, 0, 0, 0);
$worst = 5;
foreach ($array as $service) {
if ($service->status<$worst)
{
if ($service->status < $worst) {
$worst = $service->get_status();
}
$statuses[$service->get_status()]++;
}
echo '<div id="status-big" class="status '.$classes[$worst].'">';
echo '<div id="status-big" class="alert-' . $classes[$worst] . '">';
if ($statuses[$worst] == count($array))
{
if ($statuses[$worst] == count($array)) {
echo $all[$worst];
}else{
} else {
echo $some[$worst];
}
echo '</div>';
@ -209,7 +199,8 @@ class Service implements JsonSerializable
* @param $boolGroup set to true if the groups name is to be rendered
* @return void
*/
public function render(){
public function render()
{
global $statuses;
global $classes;
static $arrCompletedGroups = array();
@ -218,47 +209,50 @@ class Service implements JsonSerializable
// 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) ) {
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">';
if (!empty($this->group_name) && !in_array($this->group_name, $arrCompletedGroups)) {
echo '<ul class="list-group components mt-3">';
//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>&nbsp;' . $this->group_name .'<div class="status '. $classes[$this->status] .'">'. _($statuses[$this->status]).'</div></li>';
echo '<li class="list-group-item list-group-item-' . $classes[$this->status] . ' group-name"><span><i class="fas fa-folder-open"></i></span>&nbsp;' . $this->group_name . '<div class="status text-' . $classes[$this->status] . ' float-end">' . _($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)) {
if (empty($this->group_name)) {
echo '<ul class="list-group components">';
// echo '<ul class="platforms list-group mb-2">';
// 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 '<div>';
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 (!empty($this->description)) {
echo '<a class="desc-tool-tip" data-toggle="tooltip" data-placement="top" title="' . $this->description . '"> <span><i class="fas fa-question"></i></span></a>';
}
if ($this->status!=-1){?><div class="status pull-right <?php echo $classes[$this->status];?>"><?php echo _($statuses[$this->status]);?></div>
<?php
if ($this->status != -1) { ?><div class="float-end text-<?php echo $classes[$this->status]; ?>"><?php echo _($statuses[$this->status]); ?></div>
<?php
}
echo '</li>';
if ( isset($boolFinish) && $boolFinish) {
if (isset($boolFinish) && $boolFinish) {
echo '</ul>';
}
echo '</div>';
}
public function jsonSerialize() {
public function jsonSerialize()
{
global $statuses;
return [
"id" => $this->id,
@ -268,5 +262,4 @@ class Service implements JsonSerializable
"status_string" => $statuses[$this->status]
];
}
}

View File

@ -4,7 +4,7 @@
* Subscriber class
*
*/
Class Subscriber
class Subscriber
{
public $id = null;
public $firstname = null;
@ -15,7 +15,8 @@ Class Subscriber
public $typeID = null; // Holds subscription type ID
function __construct() {
function __construct()
{
$this->firstname = null;
$this->lastname = null;
$this->userID = "";
@ -44,7 +45,6 @@ Class Subscriber
return $row['token'];
}
return false;
}
public function get_subscriber_by_token($token)
{
@ -66,7 +66,7 @@ Class Subscriber
{
global $mysqli;
$stmt = $mysqli->prepare("SELECT subscriberID FROM subscribers WHERE userID LIKE ? AND typeID = ? LIMIT 1");
$stmt->bind_param("si", $this->userID, $this->typeID );
$stmt->bind_param("si", $this->userID, $this->typeID);
$stmt->execute();
$result = $stmt->get_result();
@ -77,7 +77,7 @@ Class Subscriber
return $row['subscriberID'];
} else {
// User is not registered in DB, so add if $create = true
if ( $create ) {
if ($create) {
$subscriber_id = $this->add($this->typeID, $this->userID, $this->active, $this->firstname, $this->lastname);
return $subscriber_id;
}
@ -111,7 +111,7 @@ Class Subscriber
$expireTime = strtotime("+2 hours");
$updateTime = strtotime("now");
$token = $this->generate_token();
$stmt = $mysqli->prepare("INSERT INTO subscribers (typeID, userID, firstname, lastname, token, active, expires, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("issssiii", $typeID, $userID, $firstname, $lastname, $token, $active, $expireTime, $updateTime);
$stmt->execute();
@ -135,7 +135,6 @@ Class Subscriber
$stmt->bind_param("ii", $updateTime, $subscriberID);
$stmt->execute();
return true;
}
public function activate($subscriberID)
@ -164,7 +163,6 @@ Class Subscriber
$stmt->execute();
//$query = $stmt->get_result();
return true;
}
public function check_userid_exist()
@ -177,7 +175,7 @@ Class Subscriber
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$this->id = $row['subscriberID'];
$this->populate();
@ -192,7 +190,7 @@ Class Subscriber
$stmt = $mysqli->prepare("SELECT subscriberID, token, userID, active, expires FROM subscribers WHERE token LIKE ? LIMIT 1");
$stmt->bind_param("s", $token );
$stmt->bind_param("s", $token);
$stmt->execute();
$result = $stmt->get_result();
@ -205,14 +203,14 @@ Class Subscriber
// If account is not already active, check if we are within timeframe of exipre +2h
// and active if so, otherwise,delete account and return falsev
if ( $row['active'] <> 1 ) {
if ($row['active'] <> 1) {
// Calculate time range for when subscription need to be validated
$time_end = $row['expires'];
$time_start = $time_end - (3600*2); // TODO - make this interval configurable via a config option
$time_start = $time_end - (3600 * 2); // TODO - make this interval configurable via a config option
$time_now = time();
if ( ($time_now > $time_start) && ($time_now < $time_end) ) {
if (($time_now > $time_start) && ($time_now < $time_end)) {
// Timefram is within range, active user..
$stmt2 = $mysqli->prepare("UPDATE subscribers SET active=1, expires=null WHERE subscriberID = ?");
$stmt2->bind_param("i", $row['subscriberID']);
@ -223,7 +221,6 @@ Class Subscriber
$this->userID = $row['userID'];
$this->token = $row['token'];
return true;
} else {
// Timeframe outside of given scope -> delete account
$stmt2 = $mysqli->prepare("DELETE FROM subscribers WHERE subscriberID = ?");
@ -251,7 +248,7 @@ Class Subscriber
{
global $mysqli;
if ( function_exists('openssl_random_pseudo_bytes') ) {
if (function_exists('openssl_random_pseudo_bytes')) {
$token = openssl_random_pseudo_bytes(32); //Generate a random string.
$token = bin2hex($token); //Convert the binary data into hexadecimal representation.
} else {
@ -265,7 +262,7 @@ Class Subscriber
$stmt->bind_param("s", $token);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0 ) {
if ($result->num_rows > 0) {
// token already exists, call self again
$token = $this->generate_token();
}
@ -285,18 +282,18 @@ Class Subscriber
$key = '';
// build range and shuffle range using ASCII table
for ($i=0; $i<=255; $i++) {
for ($i = 0; $i <= 255; $i++) {
$range[] = chr($i);
}
// shuffle our range 3 times
for ($i=0; $i<=3; $i++) {
for ($i = 0; $i <= 3; $i++) {
shuffle($range);
}
// loop for random number generation
for ($i = 0; $i < mt_rand($min_length, $max_length); $i++) {
$key .= $range[mt_rand(0, count($range)-1)];
$key .= $range[mt_rand(0, count($range) - 1)];
}
$return = bin2hex($key);
@ -325,5 +322,4 @@ Class Subscriber
unset($_SESSION['subscriber_id']);
unset($_SESSION['subscriber_token']);
}
}

View File

@ -4,30 +4,30 @@
* Subscriptions class
*
*/
Class Subscriptions
class Subscriptions
{
public function add($userID, $service)
{
global $mysqli;
$stmt = $mysqli->prepare("INSERT INTO services_subscriber (subscriberIDFK, serviceIDFK) VALUES (?, ?)");
$stmt->bind_param("ii", $userID, $service);
$stmt->execute();
//$query = $stmt->get_result();
return true;
}
public function remove($userID, $service)
{
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ? AND serviceIDFK = ?");
$stmt->bind_param("ii", $userID, $service);
$stmt->execute();
//$query = $stmt->get_result();
return true;
}
function render_subscribed_services($typeID, $subscriberID, $userID, $token)
{
global $mysqli;
@ -41,54 +41,54 @@ Class Subscriptions
$query = $stmt->get_result();
$strNotifyType = _('E-mail Notification subscription');
if ( $typeID == 1 ) { $strNotifyType = _('Telegram Notification subscription'); }
if ($typeID == 1) {
$strNotifyType = _('Telegram Notification subscription');
}
?>
?>
<div class="row">
<div class="col-xs-12 col-lg-offset-2 col-lg-8">
<div class="text-center">
<h3><?php echo $strNotifyType; ?></h3>
<p><?php echo _("Manage notification subscription for"); echo "&nbsp". $userID; ?></p>
<a onclick="if (confirm('<?php echo _("Are you sure you want to cancel you subscription?");?>')){return true;}else{event.stopPropagation(); event.preventDefault();};" class="confirmation" href="index.php?do=unsubscribe&amp;type=<?php echo $typeID;?>&amp;token=<?php echo $token;?>"><button class="btn btn-danger"><?php echo _("Cancel Subscription");?></button></a>
<div class="col-xs-12 col-lg-offset-2 col-lg-8">
<div class="text-center">
<h3><?php echo $strNotifyType; ?></h3>
<p><?php echo _("Manage notification subscription for");
echo "&nbsp" . $userID; ?></p>
<a onclick="if (confirm('<?php echo _("Are you sure you want to cancel you subscription?"); ?>')){return true;}else{event.stopPropagation(); event.preventDefault();};" class="confirmation" href="index.php?do=unsubscribe&amp;type=<?php echo $typeID; ?>&amp;token=<?php echo $token; ?>"><button class="btn btn-danger"><?php echo _("Cancel Subscription"); ?></button></a>
</div>
</div>
</div>
</div>
<?php
<?php
echo '<h1>' . _("Your subscriptions") . "</h1>";
echo '<div class="list-group">';
$subs = array(); // Will be used to hold IDs of services already selected
if ($query->num_rows){
while($result = $query->fetch_assoc())
{
echo '<a href="'.WEB_URL.'/subscriptions.php?remove=' . $result['id'] .'" class="list-group-item"><span class="glyphicon glyphicon-remove text-danger"></span>&nbsp;' . $result['name'] . '</a>';
if ($query->num_rows) {
while ($result = $query->fetch_assoc()) {
echo '<a href="' . WEB_URL . '/subscriptions.php?remove=' . $result['id'] . '" class="list-group-item"><span class="glyphicon glyphicon-remove text-danger"></span>&nbsp;' . $result['name'] . '</a>';
$subs[] = $result['id'];
}
} else {
echo '<div class="container"><summary>'._("You do not currently subscribe to any services. Please add services from the list below.").'</summary></div>';
echo '<div class="container"><summary>' . _("You do not currently subscribe to any services. Please add services from the list below.") . '</summary></div>';
}
echo "</div>";
echo '<h1>' . _("Add new subscription") . '</h1>';
// Prepare to query for unselect services. If none are selected, query for all
$subsExp = null;
if (count($subs) > 0 ) {
$subsExp = 'NOT IN ('. implode(",", $subs) .')';
if (count($subs) > 0) {
$subsExp = 'NOT IN (' . implode(",", $subs) . ')';
}
$query = $mysqli->query("SELECT services.id, services.name from services WHERE services.id $subsExp");
echo '<div class="list-group">';
if ($query->num_rows){
while($result = $query->fetch_assoc()){
echo '<a href="'.WEB_URL.'/subscriptions.php?add=' . $result['id'] . '" class="list-group-item list-group-item-action"><span class="glyphicon glyphicon-plus text-success"></span>&nbsp;' . $result['name'] . '</a>';
if ($query->num_rows) {
while ($result = $query->fetch_assoc()) {
echo '<a href="' . WEB_URL . '/subscriptions.php?add=' . $result['id'] . '" class="list-group-item list-group-item-action"><span class="fas fa-plus text-success"></span>&nbsp;' . $result['name'] . '</a>';
}
} else {
echo '<div class="container"><summary>'._("No further services available for subscriptions.").'</summary></div>';
echo '<div class="container"><summary>' . _("No further services available for subscriptions.") . '</summary></div>';
}
echo '</div>';
}
}
}

View File

@ -1,82 +1,85 @@
<?php
Class Telegram
class Telegram
{
/**
* Get telegram user data
*
* Gets telegram user data from cookie and save it to array
*
* @return void
*
* @author Telegram
*
*
* @since 0.1
*/
function getTelegramUserData() {
if (isset($_COOKIE['tg_user'])) {
$auth_data_json = urldecode($_COOKIE['tg_user']);
$auth_data = json_decode($auth_data_json, true);
return $auth_data;
}
return false;
/**
* Get telegram user data
*
* Gets telegram user data from cookie and save it to array
*
* @return void
*
* @author Telegram
*
*
* @since 0.1
*/
function getTelegramUserData()
{
if (isset($_COOKIE['tg_user'])) {
$auth_data_json = urldecode($_COOKIE['tg_user']);
$auth_data = json_decode($auth_data_json, true);
return $auth_data;
}
/**
* Check if data is from telegram
*
* This checks if the data provides is from telegram. It includes a Fix for firefox
*
* @param mixed $auth_data The Authentication Data
*
* @return $auth_data
*
*/
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
// $data_check_arr[] = $key . '=' . $value;
$data_check_arr[] = $key . '=' . str_replace('https:/t', 'https://t', $value);
}
sort($data_check_arr);
$data_check_string = implode("\n", $data_check_arr);
$secret_key = hash('sha256', TG_BOT_API_TOKEN, true);
$hash = hash_hmac('sha256', $data_check_string, $secret_key);
if (strcmp($hash, $check_hash) !== 0) {
throw new Exception('Data is NOT from Telegram');
}
if ((time() - $auth_data['auth_date']) > 86400) {
throw new Exception('Data is outdated');
}
return $auth_data;
return false;
}
/**
* Check if data is from telegram
*
* This checks if the data provides is from telegram. It includes a Fix for firefox
*
* @param mixed $auth_data The Authentication Data
*
* @return $auth_data
*
*/
function checkTelegramAuthorization($auth_data)
{
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
// $data_check_arr[] = $key . '=' . $value;
$data_check_arr[] = $key . '=' . str_replace('https:/t', 'https://t', $value);
}
/**
* Save telegram userdata
*
* Save the telegram user data in a cookie
* @return void
*/
function saveTelegramUserData($auth_data) {
$auth_data_json = json_encode($auth_data);
setcookie('tg_user', $auth_data_json);
sort($data_check_arr);
$data_check_string = implode("\n", $data_check_arr);
$secret_key = hash('sha256', TG_BOT_API_TOKEN, true);
$hash = hash_hmac('sha256', $data_check_string, $secret_key);
if (strcmp($hash, $check_hash) !== 0) {
throw new Exception('Data is NOT from Telegram');
}
function get_telegram_subscriberid($user)
{
global $mysqli;
$stmt = $mysqli->prepare("SELECT subscriberID FROM subscribers WHERE typeID=1 AND userID LIKE ? LIMIT 1");
$stmt->bind_param("s", $user);
$stmt->execute();
$result = $stmt->get_result();
if ( $result->num_rows) {
$row = $result->fetch_assoc();
$subscriberID = $row['subscriberID'];
return $subscriberID;
}
return null; // Return null on false
if ((time() - $auth_data['auth_date']) > 86400) {
throw new Exception('Data is outdated');
}
}
return $auth_data;
}
/**
* Save telegram userdata
*
* Save the telegram user data in a cookie
* @return void
*/
function saveTelegramUserData($auth_data)
{
$auth_data_json = json_encode($auth_data);
setcookie('tg_user', $auth_data_json);
}
function get_telegram_subscriberid($user)
{
global $mysqli;
$stmt = $mysqli->prepare("SELECT subscriberID FROM subscribers WHERE typeID=1 AND userID LIKE ? LIMIT 1");
$stmt->bind_param("s", $user);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows) {
$row = $result->fetch_assoc();
$subscriberID = $row['subscriberID'];
return $subscriberID;
}
return null; // Return null on false
}
}

View File

@ -1,7 +1,8 @@
<?php
/**
* Class for creating and deleting tokens
*/
* Class for creating and deleting tokens
*/
class Token
{
/**
@ -15,7 +16,7 @@ class Token
{
global $mysqli;
$salt = uniqid(mt_rand(), true);
$token = hash('sha256', $id.$salt);
$token = hash('sha256', $id . $salt);
$stmt = $mysqli->prepare("INSERT INTO tokens VALUES(?, ?, ?, ?)");
$stmt->bind_param("siis", $token, $id, $expire, $data);
$stmt->execute();
@ -67,8 +68,8 @@ class Token
global $mysqli;
$time = time();
$stmt = $mysqli->prepare("DELETE FROM tokens WHERE token = ? OR expire<?");
$stmt->bind_param("sd", $token,$time);
$stmt->bind_param("sd", $token, $time);
$stmt->execute();
$stmt->get_result();
}
}
}

View File

@ -1,7 +1,8 @@
<?php
/**
* Class that encapsulates everything that can be done with a user
*/
* Class that encapsulates everything that can be done with a user
*/
class User
{
private $id;
@ -24,8 +25,7 @@ class User
$stmt->execute();
$query = $stmt->get_result();
if (!$query->num_rows)
{
if (!$query->num_rows) {
throw new Exception("User doesn't exist.");
return;
}
@ -48,7 +48,7 @@ class User
{
return $this->username;
}
/**
* Returns whether this user is active
* @return Boolean user active status
@ -57,7 +57,7 @@ class User
{
return $this->active;
}
/**
* Returns rank of this user
* @return int rank
@ -66,7 +66,7 @@ class User
{
return $this->rank;
}
/**
* Returns full name of this user
* @return String name in "Name Surname" format
@ -86,14 +86,13 @@ class User
global $mysqli, $message, $user;
$id = $_GET['id'];
if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
{
if ($this->id != $_SESSION['user'] && $user->get_rank() <= 1 && ($user->get_rank() < $this->rank)) {
$stmt = $mysqli->prepare("UPDATE users SET active = !active WHERE id=?");
$stmt->bind_param("i", $this->id);
$stmt->execute();
$stmt->close();
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
}else{
header("Location: " . WEB_URL . "/admin/?do=user&id=" . $id);
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -108,94 +107,87 @@ class User
public static function add()
{
global $user, $message, $mysqli;
if (INSTALL_OVERRIDE || $user->get_rank()==0)
{
if (strlen(trim($_POST['name']))==0) {
if (INSTALL_OVERRIDE || $user->get_rank() == 0) {
if (strlen(trim($_POST['name'])) == 0) {
$messages[] = _("Name");
}
if(strlen(trim($_POST['surname']))==0) {
if (strlen(trim($_POST['surname'])) == 0) {
$messages[] = _("Surname");
}
if(strlen(trim($_POST['email']))==0) {
if (strlen(trim($_POST['email'])) == 0) {
$messages[] = _("Email");
}
if(strlen(trim($_POST['password']))==0) {
if (strlen(trim($_POST['password'])) == 0) {
$messages[] = _("Password");
}
if(!isset($_POST['permission']))
{
if (!isset($_POST['permission'])) {
$messages[] = _("Rank");
}
if (isset($messages)){
$message = "Please enter ".implode(", ", $messages);
if (isset($messages)) {
$message = "Please enter " . implode(", ", $messages);
return;
}
$name = $_POST['name'];
$surname = $_POST['surname'];
$username = $_POST['username'];
$email = $_POST['email'];
$pass = $_POST['password'];
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
{
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$message = "Invalid email!";
return;
}
$variables = array();
if (strlen($name)>50){
if (strlen($name) > 50) {
$variables[] = 'name: 50';
}
if (strlen($surname)>50){
if (strlen($surname) > 50) {
$variables[] = 'surname: 50';
}
if (strlen($username)>50){
if (strlen($username) > 50) {
$variables[] = 'username: 50';
}
if (strlen($email)>60){
if (strlen($email) > 60) {
$variables[] = 'email: 60';
}
if (!empty($variables))
{
if (!empty($variables)) {
$message = _("Please mind the following character limits: ");
$message .= implode(", ", $variables);
return;
}
$salt = uniqid(mt_rand(), true);
$hash = hash('sha256', $pass.$salt);
$hash = hash('sha256', $pass . $salt);
$permission = $_POST['permission'];
$stmt = $mysqli->prepare("INSERT INTO users values (NULL, ?, ?, ?, ?, ?, ?, ?, 1)");
$stmt->bind_param("ssssssi", $email, $username, $name, $surname, $hash, $salt, $permission);
$stmt->execute();
if ($stmt->affected_rows==0)
{
if ($stmt->affected_rows == 0) {
$message = _("Username or email already used");
return;
}
$to = $email;
$subject = _('User account created').' - '.NAME;
$msg = sprintf(_("Hi %s!<br>"."Your account has been created. You can login with your email address at <a href=\"%s\">%s</a> with password %s - please change it as soon as possible."), $name." ".$surname,WEB_URL."/admin", WEB_URL."/admin", $pass);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$headers .= "Reply-To: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$subject = _('User account created') . ' - ' . NAME;
$msg = sprintf(_("Hi %s!<br>" . "Your account has been created. You can login with your email address at <a href=\"%s\">%s</a> with password %s - please change it as soon as possible."), $name . " " . $surname, WEB_URL . "/admin", WEB_URL . "/admin", $pass);
$headers = "Content-Type: text/html; charset=utf-8 " . PHP_EOL;
$headers .= "MIME-Version: 1.0 " . PHP_EOL;
$headers .= "From: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
$headers .= "Reply-To: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
mail($to, $subject, $msg, $headers);
if (!INSTALL_OVERRIDE)
{
header("Location: ".WEB_URL."/admin/?do=settings");
if (!INSTALL_OVERRIDE) {
header("Location: " . WEB_URL . "/admin/?do=settings");
}
}
else {
} else {
$message = _("You don't have the permission to do that!");
}
}
@ -210,13 +202,11 @@ class User
public static function login()
{
global $message, $mysqli;
if (!isset($_POST['email']) && !isset($_POST['email']))
{
if (!isset($_POST['email']) && !isset($_POST['email'])) {
return;
}
if ((!isset($_POST['email']) || !isset($_POST['email'])))
{
if ((!isset($_POST['email']) || !isset($_POST['email']))) {
$message = _("Please fill in your email and password!");
return;
}
@ -228,37 +218,33 @@ class User
$stmt->execute();
$query = $stmt->get_result();
if ($query->num_rows<1)
{
if ($query->num_rows < 1) {
$message = _("Wrong email or password");
return;
}
$result = $query->fetch_assoc();
$salt = $result["salt"];
$id = $result["id"];
$active = $result["active"];
if (!$active)
{
if (!$active) {
$message = _("Your account has been disabled. Please contact administrator.");
return;
}
$hash = hash('sha256', $pass.$salt);
$hash = hash('sha256', $pass . $salt);
$stmt = $mysqli->prepare("SELECT count(*) as count FROM users WHERE id=? AND password_hash=?");
$stmt->bind_param("is", $id, $hash);
$stmt->execute();
$query = $stmt->get_result();
if (!$query->fetch_assoc()['count'])
{
if (!$query->fetch_assoc()['count']) {
$message = _("Wrong email or password");
return;
}
if (isset($_POST['remember'])&&$_POST['remember'])
{
if (isset($_POST['remember']) && $_POST['remember']) {
$year = strtotime('+356 days', time());
$token = Token::add($id, 'remember', $year);
setcookie('token', $token, $year, "/");
@ -266,7 +252,7 @@ class User
}
$_SESSION['user'] = $id;
header("Location: ".WEB_URL."/admin");
header("Location: " . WEB_URL . "/admin");
}
/**
@ -281,24 +267,21 @@ class User
$id = $_COOKIE['user'];
$token = $_COOKIE['token'];
if (Token::validate($token, $id, "remember"))
{
if (Token::validate($token, $id, "remember")) {
$year = strtotime('+356 days', time());
unset($_COOKIE['token']);
$_SESSION['user'] = $id;
$new_token = Token::add($id, 'remember', $year);
setcookie('token', $new_token, $year, "/");
setcookie('user', $id, $year, "/");
}
else
{
} else {
unset($_COOKIE['user']);
unset($_COOKIE['token']);
setcookie('user', null, -1, '/');
setcookie('token', null, -1, '/');
$message = _("Invalid token detected, please login again!");
}
Token::delete($token);
}
/**
@ -308,142 +291,135 @@ class User
public function render_user_settings()
{
global $permissions, $user;
?>
?>
<div class="row user">
<div class="col-md-2 col-md-offset-2"><img src="https://www.gravatar.com/avatar/<?php echo md5( strtolower( trim( $this->email ) ) );?>?s=160"
alt="<?php echo _("Profile picture");?>"></div>
<div class="col-md-2 col-md-offset-2"><img src="https://www.gravatar.com/avatar/<?php echo md5(strtolower(trim($this->email))); ?>?s=160" alt="<?php echo _("Profile picture"); ?>"></div>
<div class="col-md-6">
<?php if($this->id==$_SESSION['user']||$user->get_rank()<1){
?>
<form action="<?php echo WEB_URL;?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<div class="input-group">
<div class="col-md-12">
<div class="row">
<label class="form-name" for="name"><?php echo _("Name"); ?></label>
<label class="form-name" for="surname"><?php echo _("Surname"); ?></label>
</div>
<div class="row">
<input type="text" name="name" placeholder="<?php echo _("Name"); ?>"
title="<?php echo _("Name"); ?>" class="form-control form-name"
value=<?php echo htmlspecialchars($this->name, ENT_QUOTES);?>>
<input type="text" name="surname" placeholder="<?php echo _("Surname"); ?>"
title="<?php echo _("Surname"); ?>" class="form-control form-name"
value=<?php echo htmlspecialchars($this->surname, ENT_QUOTES);?>>
<?php if ($this->id == $_SESSION['user'] || $user->get_rank() < 1) {
?>
<form action="<?php echo WEB_URL; ?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<div class="input-group">
<div class="col-md-12">
<div class="row">
<label class="form-name" for="name"><?php echo _("Name"); ?></label>
<label class="form-name" for="surname"><?php echo _("Surname"); ?></label>
</div>
<div class="row">
<input type="text" name="name" placeholder="<?php echo _("Name"); ?>" title="<?php echo _("Name"); ?>" class="form-control form-name" value=<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>>
<input type="text" name="surname" placeholder="<?php echo _("Surname"); ?>" title="<?php echo _("Surname"); ?>" class="form-control form-name" value=<?php echo htmlspecialchars($this->surname, ENT_QUOTES); ?>>
</div>
</div>
</div>
</div>
<div class="input-group">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change name");?></button>
</div>
</form>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change name"); ?></button>
</form>
<?php
}else{
} else {
?>
<h3><?php echo $this->name." ".$this->surname;?></h3>
<h3><?php echo $this->name . " " . $this->surname; ?></h3>
<?php
}?>
} ?>
</div>
</div>
<form action="<?php echo WEB_URL;?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<form action="<?php echo WEB_URL; ?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Username");?></strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Username"); ?></strong></div>
<div class="col-md-6">
<?php
if ($this->id==$_SESSION['user'] || $user->get_rank()<1){?>
<div class="input-group">
<input type="text" class="form-control" name="username" required value="<?php echo htmlspecialchars($this->username, ENT_QUOTES);?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change username");?></button>
</span>
</div>
<?php
}else{?><?php echo $this->username." ";
if ($user->get_rank()>=1){
echo "<i class='fa fa-".($this->active?"check success":"times danger")."'></i>";
}
}
?>
if ($this->id == $_SESSION['user'] || $user->get_rank() < 1) { ?>
<div class="input-group">
<input type="text" class="form-control" name="username" required value="<?php echo htmlspecialchars($this->username, ENT_QUOTES); ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change username"); ?></button>
</span>
</div>
<?php
} else { ?><?php echo $this->username . " ";
if ($user->get_rank() >= 1) {
echo "<i class='fa fa-" . ($this->active ? "check success" : "times danger") . "'></i>";
}
}
?>
</div>
</div>
</form>
<form action="<?php echo WEB_URL;?>/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
<form action="<?php echo WEB_URL; ?>/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Role");?></strong></div>
<div class="col-md-6"><?php if ($user->get_rank() == 0 && $this->id != $_SESSION['user']){?>
<div class="input-group"><select class="form-control" name="permission">
<?php foreach ($permissions as $key => $value) {
echo "<option value='$key' ".($key==$this->rank?"selected":"").">$value</option>";
} ?>
</select><span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change role");?></button>
</span>
</div><?php }else{ echo $permissions[$this->rank];}?></div>
</div>
</form>
<?php if($this->id==$_SESSION['user']||$user->get_rank()<1)
{?>
<form action="<?php echo WEB_URL;?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong>Email</strong></div>
<div class="col-md-6">
<div class="input-group">
<input type="email" class="form-control" name="email" value="<?php echo $this->email; ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change email");?></button>
</span>
</div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Role"); ?></strong></div>
<div class="col-md-6"><?php if ($user->get_rank() == 0 && $this->id != $_SESSION['user']) { ?>
<div class="input-group"><select class="form-control" name="permission">
<?php foreach ($permissions as $key => $value) {
echo "<option value='$key' " . ($key == $this->rank ? "selected" : "") . ">$value</option>";
} ?>
</select><span class="input-group-btn">
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change role"); ?></button>
</span>
</div><?php } else {
echo $permissions[$this->rank];
} ?>
</div>
</div>
</form>
<?php }else
{
<?php if ($this->id == $_SESSION['user'] || $user->get_rank() < 1) { ?>
<form action="<?php echo WEB_URL; ?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong>Email</strong></div>
<div class="col-md-6">
<div class="input-group">
<input type="email" class="form-control" name="email" value="<?php echo $this->email; ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change email"); ?></button>
</span>
</div>
</div>
</div>
</form>
<?php } else {
?>
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Email");?></strong></div>
<div class="col-md-6">
<a href="mailto:<?php echo $this->email; ?>"><?php echo $this->email; ?></a>
</div>
</div>
<?php
}
if($this->id==$_SESSION['user']){
?>
<form action="<?php echo WEB_URL;?>/admin/?do=user" method="POST">
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Password");?></strong></div>
<div class="row user">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Email"); ?></strong></div>
<div class="col-md-6">
<label for="password"><?php echo _("Old password");?></label>
<input id="password" placeholder="<?php echo _("Old password");?>" type="password" class="form-control" name="old_password">
<label for="new_password"><?php echo _("New password");?></label>
<input id="new_password" placeholder="<?php echo _("New password");?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password");?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password");?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password");?></button>
<a href="mailto:<?php echo $this->email; ?>"><?php echo $this->email; ?></a>
</div>
</div>
</form>
<?php
}
if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
{?>
<div class="row">
<div class="col-md-2 col-md-offset-2"></div>
<div class="col-md-6">
<?php
if ($this->active){
echo '<a href="'.WEB_URL.'/admin/?do=user&id='.$this->id.'&what=toggle" class="btn btn-danger">'._("Deactivate user")."</a>";
}else{
echo '<a href="'.WEB_URL.'/admin/?do=user&id='.$this->id.'&what=toggle" class="btn btn-success">'._("Activate user")."</a>";
}
?>
}
if ($this->id == $_SESSION['user']) {
?>
<form action="<?php echo WEB_URL; ?>/admin/?do=user" method="POST">
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Password"); ?></strong></div>
<div class="col-md-6">
<label for="password"><?php echo _("Old password"); ?></label>
<input id="password" placeholder="<?php echo _("Old password"); ?>" type="password" class="form-control" name="old_password">
<label for="new_password"><?php echo _("New password"); ?></label>
<input id="new_password" placeholder="<?php echo _("New password"); ?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password"); ?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password"); ?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary float-end margin-top"><?php echo _("Change password"); ?></button>
</div>
</div>
</form>
<?php
}
if ($this->id != $_SESSION['user'] && $user->get_rank() <= 1 && ($user->get_rank() < $this->rank)) { ?>
<div class="row">
<div class="col-md-2 col-md-offset-2"></div>
<div class="col-md-6">
<?php
if ($this->active) {
echo '<a href="' . WEB_URL . '/admin/?do=user&id=' . $this->id . '&what=toggle" class="btn btn-danger">' . _("Deactivate user") . "</a>";
} else {
echo '<a href="' . WEB_URL . '/admin/?do=user&id=' . $this->id . '&what=toggle" class="btn btn-success">' . _("Activate user") . "</a>";
}
?>
</div>
</div>
</div>
<?php }
<?php }
}
/**
@ -456,24 +432,22 @@ class User
$id = $this->id;
$stmt = $mysqli->prepare("SELECT count(*) FROM users WHERE username LIKE ?");
$stmt->bind_param("s",$_POST["username"]);
$stmt->bind_param("s", $_POST["username"]);
$stmt->execute();
if ($stmt->num_rows > 0)
{
if ($stmt->num_rows > 0) {
$message = _("This username is already taken.");
return;
}
$stmt->close();
if ($_SESSION['user'] != $id && $user->get_rank()>0)
{
if ($_SESSION['user'] != $id && $user->get_rank() > 0) {
$message = _("Cannot change username of other users!");
}else{
} else {
$stmt = $mysqli->prepare("UPDATE users SET username = ? WHERE id=?");
$stmt->bind_param("si",$_POST["username"],$id);
$stmt->bind_param("si", $_POST["username"], $id);
$stmt->execute();
$stmt->close();
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
header("Location: " . WEB_URL . "/admin/?do=user&id=" . $id);
}
}
@ -484,30 +458,28 @@ class User
public function change_name()
{
global $mysqli, $message, $user;
if (strlen(trim($_POST['name']))==0) {
if (strlen(trim($_POST['name'])) == 0) {
$messages[] = _("Name");
}
if(strlen(trim($_POST['surname']))==0) {
if (strlen(trim($_POST['surname'])) == 0) {
$messages[] = _("Surname");
}
if (!empty($messages))
{
$message = "Please enter ".implode(", ", $messages);
if (!empty($messages)) {
$message = "Please enter " . implode(", ", $messages);
return;
}
$id = $this->id;
if ($_SESSION['user'] != $id && $user->get_rank()>0)
{
if ($_SESSION['user'] != $id && $user->get_rank() > 0) {
$message = _("Cannot change names of other users!");
}else{
} else {
$stmt = $mysqli->prepare("UPDATE users SET `name` = ?, `surname` = ? WHERE id=?");
$stmt->bind_param("ssi",$_POST["name"],$_POST["surname"],$id);
$stmt->bind_param("ssi", $_POST["name"], $_POST["surname"], $id);
$stmt->execute();
$stmt->close();
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
header("Location: " . WEB_URL . "/admin/?do=user&id=" . $id);
}
}
@ -521,18 +493,15 @@ class User
{
global $mysqli, $message;
$id = $this->id;
if ($_POST['password']!=$_POST['password_repeat'])
{
if ($_POST['password'] != $_POST['password_repeat']) {
$message = _("Passwords do not match!");
return;
}
if (!$token)
{
if ($_SESSION['user']!=$id)
{
if (!$token) {
if ($_SESSION['user'] != $id) {
$message = _("Cannot change password of other users!");
}else{
} else {
$stmt = $mysqli->prepare("SELECT password_salt as salt FROM users WHERE id=?");
$stmt->bind_param("i", $id);
$stmt->execute();
@ -541,35 +510,32 @@ class User
$salt = $result['salt'];
$pass = $_POST['old_password'];
$hash = hash('sha256', $pass.$salt);
$hash = hash('sha256', $pass . $salt);
$stmt = $mysqli->prepare("SELECT count(*) as count FROM users WHERE id=? AND password_hash = ?");
$stmt->bind_param("is", $id, $hash);
$stmt->execute();
if ($stmt->get_result()->fetch_assoc()['count'])
{
if ($stmt->get_result()->fetch_assoc()['count']) {
$pass = $_POST['password'];
$hash = hash('sha256', $pass.$salt);
$hash = hash('sha256', $pass . $salt);
$stmt = $mysqli->prepare("UPDATE users SET password_hash = ? WHERE id=?");
$stmt->bind_param("si", $hash, $id);
$stmt->execute();
$stmt->close();
$stmt = $mysqli->prepare("DELETE FROM tokens WHERE user = ? AND data = 'remember'");
$stmt->bind_param("d", $id);
$stmt->execute();
$stmt->bind_param("d", $id);
$stmt->execute();
$stmt->get_result();
User::logout();
}
else{
} else {
$message = _("Wrong password!");
}
}
}else{
if (Token::validate($token, $id, "passwd"))
{
} else {
if (Token::validate($token, $id, "passwd")) {
$stmt = $mysqli->prepare("SELECT password_salt as salt FROM users WHERE id=?");
$stmt->bind_param("i", $id);
$stmt->execute();
@ -578,20 +544,18 @@ class User
$salt = $result['salt'];
$pass = $_POST['password'];
$hash = hash('sha256', $pass.$salt);
$hash = hash('sha256', $pass . $salt);
$stmt = $mysqli->prepare("UPDATE users SET password_hash = ? WHERE id=?");
$stmt->bind_param("si", $hash,$id);
$stmt->bind_param("si", $hash, $id);
$stmt->execute();
$stmt->close();
$stmt = $mysqli->prepare("DELETE FROM tokens WHERE user = ? AND data = 'remember'");
$stmt->bind_param("d", $id);
$stmt->execute();
$stmt->get_result();
}
else
{
$stmt->bind_param("d", $id);
$stmt->execute();
$stmt->get_result();
} else {
$message = _("Invalid token detected, please retry your request from start!");
}
Token::delete($token);
@ -612,41 +576,41 @@ class User
$stmt->execute();
$query = $stmt->get_result();
$id = $query->fetch_assoc()['id'];
$id = $query->fetch_assoc()['id'];
$time = strtotime('+1 day', time());
$token = Token::add($id, 'passwd', $time);
$link = WEB_URL."/admin/?do=lost-password&id=$id&token=$token";
$link = WEB_URL . "/admin/?do=lost-password&id=$id&token=$token";
$to = $email;
$user = new User($id);
$subject = _('Reset password') . ' - '.NAME;
$msg = sprintf(_( "Hi %s!<br>Below you will find link to change your password. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">RESET PASSWORD</a><br><br>If the link doesn't work, copy &amp; paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$headers .= "Reply-To: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$subject = _('Reset password') . ' - ' . NAME;
$msg = sprintf(_("Hi %s!<br>Below you will find link to change your password. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">RESET PASSWORD</a><br><br>If the link doesn't work, copy &amp; paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 " . PHP_EOL;
$headers .= "MIME-Version: 1.0 " . PHP_EOL;
$headers .= "From: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
$headers .= "Reply-To: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
mail($to, $subject, $msg, $headers);
}
}
/**
* Sends email with link for email change confirmation (security reasons), link is token protected and valid only once.
* @return void
*/
public function email_link(){
public function email_link()
{
global $user, $mysqli;
$email = $_POST['email'];
$id = $this->id;
if ($user->get_rank()<1 && $id!=$_SESSION['user'])
{
if ($user->get_rank() < 1 && $id != $_SESSION['user']) {
$stmt = $mysqli->prepare("UPDATE users SET email = ? WHERE id=?");
$stmt->bind_param("sd", $email, $id);
$stmt->execute();
$stmt->get_result();
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
header("Location: " . WEB_URL . "/admin/?do=user&id=" . $id);
return;
}
@ -654,14 +618,14 @@ class User
$token = Token::add($id, 'email;$email', $time);
$link = WEB_URL."/admin/?do=change-email&id=$id&token=$token";
$link = WEB_URL . "/admin/?do=change-email&id=$id&token=$token";
$to = $email;
$subject = _('Email change').' - '.NAME;
$msg = sprintf(_( "Hi %s!<br>Below you will find link to change your email. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">CHANGE EMAIL</a><br><br>If the link doesn't work, copy &amp; paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$headers .= "Reply-To: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
$subject = _('Email change') . ' - ' . NAME;
$msg = sprintf(_("Hi %s!<br>Below you will find link to change your email. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">CHANGE EMAIL</a><br><br>If the link doesn't work, copy &amp; paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 " . PHP_EOL;
$headers .= "MIME-Version: 1.0 " . PHP_EOL;
$headers .= "From: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
$headers .= "Reply-To: " . MAILER_NAME . ' <' . MAILER_ADDRESS . '>' . PHP_EOL;
mail($to, $subject, $msg, $headers);
return _('Confirmation email sent!');
@ -677,8 +641,7 @@ class User
$token = $_GET['token'];
$id = $_GET['id'];
if (Token::validate($token, $id, "email;%"))
{
if (Token::validate($token, $id, "email;%")) {
$data = explode(";", Token::get_data($token, $id));
$email = $data[1];
@ -688,25 +651,22 @@ class User
$stmt->execute();
$stmt->get_result();
Token::delete($token);
header("Location: ".WEB_URL."/admin/");
}
else
{
header("Location: " . WEB_URL . "/admin/");
} else {
$message = _("Invalid token detected, please retry your request from start!");
}
Token::delete($token);
}
/**
* Logs current user out.
* @return void
*/
public static function logout(){
public static function logout()
{
session_unset();
if (isset($_COOKIE['token']))
{
if (isset($_COOKIE['token'])) {
$token = $_COOKIE['token'];
Token::delete($token);
unset($_COOKIE['user']);
@ -714,26 +674,25 @@ class User
setcookie('user', null, -1, '/');
setcookie('token', null, -1, '/');
}
header("Location: ".WEB_URL."/admin");
header("Location: " . WEB_URL . "/admin");
}
/**
* Changes permissions of current user - only super admin can do this, so it checks permission first.
* @return void
*/
public function change_permission(){
public function change_permission()
{
global $mysqli, $message, $user;
if ($user->get_rank()==0)
{
if ($user->get_rank() == 0) {
$permission = $_POST['permission'];
$id = $_GET['id'];
$stmt = $mysqli->prepare("UPDATE users SET permission=? WHERE id=?");
$stmt->bind_param("si", $permission, $id);
$stmt->execute();
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
}
else{
$stmt->execute();
header("Location: " . WEB_URL . "/admin/?do=user&id=" . $id);
} else {
$message = _("You don't have permission to do that!");
}
}
}
}

View File

@ -31,6 +31,7 @@ define("POLICY_MAIL", "##policy_mail##"); //contact email in policy
define("POLICY_PHONE", "##policy_phone##");
define("WHO_WE_ARE","##who_we_are##");
define("POLICY_URL","##policy_url##");
define("IMPRINT_URL","##imprint_url##");
define("INSTALL_OVERRIDE", false);
define("DEFAULT_LANGUAGE", "en_GB");
define("CUSTOM_LOGO_URL",""); // This will use the default logo if left empty

View File

@ -20,4 +20,3 @@ fwrite($f, fread($f2, filesize("IISWebConfig")));
fclose($f);
fclose($f2);
}
?>

File diff suppressed because one or more lines are too long

View File

@ -1,96 +0,0 @@
/* jQuery Growl
* Copyright 2015 Kevin Sylvestre
* 1.3.5
*/
.ontop, #growls-default, #growls-tl, #growls-tr, #growls-bl, #growls-br, #growls-tc, #growls-bc, #growls-cc, #growls-cl, #growls-cr {
z-index: 50000;
position: fixed; }
#growls-default {
top: 10px;
right: 10px; }
#growls-tl {
top: 10px;
left: 10px; }
#growls-tr {
top: 10px;
right: 10px; }
#growls-bl {
bottom: 10px;
left: 10px; }
#growls-br {
bottom: 10px;
right: 10px; }
#growls-tc {
top: 10px;
right: 10px;
left: 10px; }
#growls-bc {
bottom: 10px;
right: 10px;
left: 10px; }
#growls-cc {
top: 50%;
left: 50%;
margin-left: -125px; }
#growls-cl {
top: 50%;
left: 10px; }
#growls-cr {
top: 50%;
right: 10px; }
#growls-tc .growl, #growls-bc .growl {
margin-left: auto;
margin-right: auto; }
.growl {
opacity: 0.8;
filter: alpha(opacity=80);
position: relative;
border-radius: 4px;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out; }
.growl.growl-incoming {
opacity: 0;
filter: alpha(opacity=0); }
.growl.growl-outgoing {
opacity: 0;
filter: alpha(opacity=0); }
.growl.growl-small {
width: 200px;
padding: 5px;
margin: 5px; }
.growl.growl-medium {
width: 250px;
padding: 10px;
margin: 10px; }
.growl.growl-large {
width: 300px;
padding: 15px;
margin: 15px; }
.growl.growl-default {
color: #FFF;
background: #7f8c8d; }
.growl.growl-error {
color: #FFF;
background: #C0392B; }
.growl.growl-notice {
color: #FFF;
background: #2ECC71; }
.growl.growl-warning {
color: #FFF;
background: #F39C12; }
.growl .growl-close {
cursor: pointer;
float: right;
font-size: 14px;
line-height: 18px;
font-weight: normal;
font-family: helvetica, verdana, sans-serif; }
.growl .growl-title {
font-size: 18px;
line-height: 24px; }
.growl .growl-message {
font-size: 14px;
line-height: 18px; }

File diff suppressed because one or more lines are too long

1
css/main.css.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["main.sass"],"names":[],"mappings":"AAAA,KAMA,qBANW,CAAA,UACE,CAAA,QAQX,CAAA,eACA,CAAA,WACA,CAAA,gBACA,CAAA,mDAEA,eACE,CAAA,IAEJ,WACE,CAAA,cACA,CAAA,EAEF,SACE,CAAA,QACA,CAAA,oBACA,CAAA,gBAEA,oBACE,CAAA,aACA,CAAA,UAEJ,iBACE,CAAA,QAEF,WACE,CAAA,gBACA,CAAA,cACA,CAAA,iBACA,CAAA,gBAEA,iBACE,CAAA,oBACA,CAAA,UACA,CAAA,WACA,CAAA,sBAEA,SACE,CAAA,OACA,CAAA,QACA,CAAA,wBAEF,iBACE,CAAA,cACA,CAAA,KACA,CAAA,MACA,CAAA,OACA,CAAA,QACA,CAAA,qBACA,CACA,cACA,CAAA,+BAEA,iBACE,CAAA,UACA,CAAA,WACA,CAAA,UACA,CAAA,QACA,CAAA,UACA,CAAA,qBACA,CACA,cACA,CAAA,8BAEF,kBACE,CAAA,qCAEA,iBACE,CAAA,8BAGN,wBACE,CAAA,4BAEF,0BACE,CAAA,qCAEF,0BACE,CAAA,OAEN,qBACI,CAAA,+BACA,CAAA,eAEJ,gBACE,CAAA,8BACA,CAAA,kBACA,CAAA,iBACA,CAAA,gBACA,CAAA,iBACA,CAAA,iCAIE,mBACE,CAAA,qFAEF,eAEE,CAAA,uEAKF,kBACE,CAAA,YACA,CAAA,iBACA,CAAA,eACA,CAAA,mEAEF,iBACE,CAAA,kBACA,CAAA,cACA,CAAA,yEAEA,eACE,CAAA,iBACA,CAAA,+EAEF,iBACE,CAAA,SACA,CAAA,aACA,CAAA,kBACA,CAAA,OACA,CAAA,UACA,CAAA,gBACA,CAAA,+FAEA,QACE,CAAA,SACA,CAAA,UACA,CAAA,iBACA,CAAA,UACA,CAAA,WACA,CAAA,iBACA,CAAA,kBACA,CAAA,6FAEJ,iBACE,CAAA,yBACA,CAAA,UACA,CAAA,+EAEF,yBACE,CAAA,+FAEA,iBACE,CAAA,OACA,CAAA,UACA,CAAA,UACA,CAAA,cACA,CAAA,iBACA,CAAA,4BACA,CAAA,+BACA,CAAA,6BACA,CAAA,mHAEF,iBACE,CAAA,UACA,CAAA,UACA,CAAA,WACA,CAAA,iBACA,CAAA,iBACA,CAAA,uHAEA,cACE,CAAA,gBACA,CAAA,6GAIF,QACE,CAAA,iIAEF,cACE,CAAA,iIAEF,eACE,CAAA,sBAEV,gBACE,CAAA,iCAYA,WACE,CAAA,aACA,CAAA,gBACA,CAAA,6DAEF,SACI,CAAA,uEAIF,UACE,CAAA,8IAEF,YAEE,CAAA,4CAIF,sBACE,CAAA,WACA,CAAA,6BACA,CAAA,+CAEF,UACE,CAAA,sBACA,CAAA,WACA,CAAA,eACA,CAAA,gBACA,CAAA,8CAEF,eACE,CAAA,eACA,CAAA,UACA,CAAA,gBACA,CAAA,wGAEA,UACE,CAAA,+BAEN,gBACE,CAAA,uDAEF,4BACE,CAAA,8BAIF,gBACE,CAAA,0CAYF,WACE,CAAA,kBAKN,+BACE,CAAA,eACA,CAAA,gBACA,CAAA,mBACA,CAAA,eACA,CAAA,iCAEA,eACE,CAAA,mCAEA,UACE,CAAA,UACA,CAAA,eACA,CAAA,aACA,CAAA,yCAEA,wBACE,CAAA,2CAEN,aACE,CAAA,+CAEA,eACE,CAAA,cACA,CAAA,gBACA,CAAA,qBACA,CAAA,sBAEN,qBAtSU,CAAA,2BAySR,UAxSU,CAAA,uCA2SV,WACE,CAAA,uCAEF,mCA7SY,CAAA,qDAgTV,qBAlTM,CAAA,UACE,CAAA,4BAqTV,qBAtTQ,CAAA,UACE,CAAA,mCACE,CAAA,6BAyTZ,UA1TU","file":"main.css"}

319
css/main.sass Normal file
View File

@ -0,0 +1,319 @@
$bg_light: #fff
$text_light: #111
$bg_dark: #111
$text_dark: #fff
$border_dark: rgba(255,255,255,.125)
body
background-color: $bg_light
color: $text_light
margin: 0
margin-top: 80px
height: 100%
line-height: 24px
.h1, .h2, .h3, h1, h2, h3
margin-top: 18px
img
height: auto
max-width: 100%
a
padding: 0
margin: 0
text-decoration: none
&:hover, &:focus
text-decoration: none
color: #f5f4f4
.centered
text-align: center
#switch
height: auto
line-height: 34px
font-size: 25px
margin-bottom: 5px
.switch
position: relative
display: inline-block
width: 60px
height: 34px
input
opacity: 0
width: 0
height: 0
.slider
position: absolute
cursor: pointer
top: 0
left: 0
right: 0
bottom: 0
background-color: #ccc
-webkit-transition: 0.4s
transition: 0.4s
&:before
position: absolute
content: ""
height: 26px
width: 26px
left: 4px
bottom: 4px
background-color: white
-webkit-transition: 0.4s
transition: 0.4s
&.round
border-radius: 34px
&:before
border-radius: 50%
input
&:checked + .slider
background-color: #2196f3
&:focus + .slider
box-shadow: 0 0 1px #2196f3
&:checked + .slider:before
transform: translateX(26px)
header
background-color: gray
border-radius: 0px 0px 30px 30px
main.container
max-width: 1024px
min-height: calc(100vh - 157px)
padding-right: 15px
padding-left: 15px
margin-left: auto
margin-right: auto
&#install
.settings
padding-bottom: 25px
.settings,
form .card:not(:first-child)
margin-top: 30px
&#status,
&#dashboard
#status-big
margin-bottom: 20px
padding: 15px
border-radius: 5px
font-size: 1.3em
.timeline
position: relative
padding: 0 0px 10px
margin-top: 4px
h3
margin-top: 40px
padding-left: 70px
.line
position: absolute
width: 2px
display: block
background: #c2c2c2
top: 0px
bottom: 0px
margin-left: 31px
&::before
top: -4px
left: -4px
content: ""
position: absolute
width: 10px
height: 10px
border-radius: 50%
background: #c2c2c2
.servicelist
position: relative
margin: 10px 0px 21px 70px
clear: both
.card
margin: 10px 0px 21px 70px
&::before
position: absolute
top: 8px
left: -24px
content: ""
border: inherit
border-width: 12px
border-top-color: transparent
border-bottom-color: transparent
border-left-color: transparent
.card-colore.icon
position: absolute
left: -59px
width: 40px
height: 40px
border-radius: 50%
text-align: center
i
font-size: 20px
line-height: 40px
.card-footer
p
margin: 0
.card-title
font-size: .9em
.card-badge
font-size: .75em
&#status
font-size: 1.05em
&#notfound
&#privacy
&#subscripe
&#subsmail
&#dashboard
#status
width: 230px
display: block
text-align: right
.card-header.bg-primary input#title
width: 70%
.card-header:not(.border-primary)
input#title
width: 100%
#time,
#end_time_wrapper
display: none
article.card
input
background: transparent
border: none
border-bottom: 1px white outset
textarea
width: 100%
background: transparent
border: none
resize: vertical
min-height: 100px
.delete
margin-left: 5px
font-size: 1.2em
color: white
line-height: 25px
&:hover, &:focus
color: #eee
#type
margin-left: 70px
#status-container.error input
box-shadow: 0px 0 2px 1px rgba(255, 0, 0, 1)
&#login
.wrapper
padding-top: 20px
&#lostpw
&#newuser
&#servicegroup
&#service
&#settings
.input-group-text
width: 230px
#user
footer#footerwrap
border-radius: 30px 30px 0px 0px
min-height: 60px
padding-top: 15px
padding-bottom: 10px
background: gray
.dropdown-menu
background: gray
a
color: white
width: 100%
padding: 2px 5px
display: block
&:hover
background-color: #2f8ad8
.input-group.dropup.mb-3
display: block
img
max-height: 20px
max-width: 25px
margin-right: 5px
vertical-align: middle
body[data-theme="dark"]
background-color: $bg_dark
main
color: $text_dark
.fa-moon::before
content: "\f185"
.list-group-item
border-color: $border_dark
&.sub-component
background-color: $bg_dark
color: $text_dark
.card
background-color: $bg_dark
color: $text_dark
border-color: $border_dark
.table
color: $text_dark

View File

@ -1,140 +1,137 @@
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400);
@import url(https://fonts.googleapis.com/css?family=Fira+Sans:400,700);
body {
background: #ffffff;
margin: 0;
height: 100%;
line-height: 24px;
font-family: 'Open Sans', sans-serif;
body {
background: #ffffff;
margin: 0;
height: 100%;
line-height: 24px;
font-family: "Open Sans", sans-serif;
}
#status-container
{
border-radius: 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
#status-container {
border-radius: 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}
#status-container .item:last-child
{
border: none;
#status-container .item:last-child {
border: none;
}
#status-container .item{
border-bottom: 1px solid #e0e0e0;
#status-container .item {
border-bottom: 1px solid #e0e0e0;
}
#status-big
{
float: none;
width: 100%;
text-align: center;
font-family: 'Fira Sans', sans-serif;
font-size: 1.5em
#status-big {
float: none;
width: 100%;
text-align: center;
font-family: "Fira Sans", sans-serif;
font-size: 1.5em;
}
#wrapper{
padding-left: 20%;
padding-right: 20%;
#wrapper {
padding-left: 20%;
padding-right: 20%;
}
.service{
float: left;
box-sizing: border-box;
width:60%;
min-width: 200px;
padding: 15px 35px;
font-weight: bold;
font-size: 1em;
font-family: 'Fira Sans', sans-serif;
.service {
float: left;
box-sizing: border-box;
width: 60%;
min-width: 200px;
padding: 15px 35px;
font-weight: bold;
font-size: 1em;
font-family: "Fira Sans", sans-serif;
}
.status{
float: left;
box-sizing: border-box;
width:40%;
min-width: 150px;
padding: 15px 35px;
text-align: right;
font-size: 0.8em;
font-family: 'Fira Sans', sans-serif;
.status {
float: left;
box-sizing: border-box;
width: 40%;
min-width: 150px;
padding: 15px 35px;
text-align: right;
font-size: 0.8em;
font-family: "Fira Sans", sans-serif;
}
#status-container .status.success{
color:#2fcc66!important;
font-weight: bolder;
#status-container .status.success {
color: #2fcc66 !important;
font-weight: bolder;
}
#status-container .status.warning{
color:#edaa16!important;
font-weight: bolder;
#status-container .status.warning {
color: #edaa16 !important;
font-weight: bolder;
}
#status-container .status.danger{
color:#e74c3c!important;
font-weight: bolder;
#status-container .status.danger {
color: #e74c3c !important;
font-weight: bolder;
}
#status-container .status.primary{
color:#3A72BD!important;
font-weight: bolder;
#status-container .status.primary {
color: #3a72bd !important;
font-weight: bolder;
}
.panel-success{
border-color:#2fcc66;
.panel-success {
border-color: #2fcc66;
}
#footerwrap{
display: none
#footerwrap {
display: none;
}
.btn
{
display: none
.btn {
display: none;
}
h3{
text-align: center;
h3 {
text-align: center;
}
.panel-heading.icon{
width: 50px;
float: left;
border: none;
.panel-heading.icon {
width: 50px;
float: left;
border: none;
}
h2.panel-title{
float: left;
h2.panel-title {
float: left;
}
.panel,.panel-heading,.panel-footer{
border-width: 3px
.panel,
.panel-heading,
.panel-footer {
border-width: 3px;
}
body .panel-danger,
.panel-danger > .panel-body,
.panel-danger > .panel-heading,
.panel-danger > .panel-footer{
border-color: #a94442
.panel-danger > .panel-footer {
border-color: #a94442;
}
body .panel-success,
.panel-success > .panel-body,
.panel-success > .panel-heading,
.panel-success > .panel-footer{
border-color: #2fcc66
.panel-success > .panel-footer {
border-color: #2fcc66;
}
body .panel-warning,
.panel-warning > .panel-body,
.panel-warning > .panel-heading,
.panel-warning > .panel-footer{
border-color: #edaa16
.panel-warning > .panel-footer {
border-color: #edaa16;
}
body .panel-primary,
.panel-primary > .panel-body,
.panel-primary > .panel-heading,
.panel-primary > .panel-footer{
border-color: #337ab7
}
.panel-primary > .panel-footer {
border-color: #337ab7;
}

View File

@ -8,11 +8,11 @@ require_once("classes/mailer.php");
//require_once("libs/php_idn/idna.php");
require_once("classes/db-class.php");
$db = new SSDB();
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"));
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"));
define("GOOGLE_RECAPTCHA", $db->getBooleanSetting($mysqli, "google_recaptcha"));
//define("", $db->getSettings($mysqli, ""));
define("GOOGLE_RECAPTCHA_SECRET", $db->getSetting($mysqli, "google_recaptcha_secret"));
@ -37,20 +37,20 @@ $subscription = new Subscriptions();
$boolRegistered = false;
if ( isset($_GET['new']) ) {
if (isset($_GET['new'])) {
// Form validation for subscribers signing up
$message = "";
Template :: render_header(_("Email Subscription"));
Template::render_header(_("Email Subscription"), "subsmail");
if (isset($_POST['emailaddress'])) {
if (0 == strlen(trim($_POST['emailaddress']))){
if (0 == strlen(trim($_POST['emailaddress']))) {
$messages[] = _("Email address");
}
// Perform DNS domain validation on
if ( ! $mailer->verify_domain($_POST['emailaddress']) ) {
if (!$mailer->verify_domain($_POST['emailaddress'])) {
$messages[] = _("Domain does not apper to be a valid email domain. (Check MX record)");
}
@ -63,7 +63,7 @@ if ( isset($_GET['new']) ) {
'response' => $_POST["g-recaptcha-response"]
);
$options = array(
'http' => array (
'http' => array(
'header' => 'Content-Type: application/x-www-form-urlencoded\r\n',
'method' => 'POST',
'content' => http_build_query($data)
@ -73,19 +73,17 @@ if ( isset($_GET['new']) ) {
$verify = file_get_contents($url, false, $context);
$captcha_success = json_decode($verify);
if ( $captcha_success->success==false ) {
if ($captcha_success->success == false) {
$messages[] = _("reChaptcha validation failed");
}
}
if ( isset($messages) ) {
if (isset($messages)) {
$message = _("Please check<br>");
$message .= implode("<br> ", $messages);
}
}
if(isset($_POST['emailaddress']) && empty($message))
{
if (isset($_POST['emailaddress']) && empty($message)) {
// Check if email is already registered
$boolUserExist = false;
@ -93,23 +91,21 @@ if ( isset($_GET['new']) ) {
$subscriber->typeID = 2; // Email
$boolUserExist = $subscriber->check_userid_exist();
$url = WEB_URL."/index.php?do=manage&token=".$subscriber->token;
$url = WEB_URL . "/index.php?do=manage&token=" . $subscriber->token;
if ( ! $boolUserExist ) {
if (!$boolUserExist) {
// Create a new subscriber as it does not exist
$subscriber->add($subscriber->typeID, $_POST['emailaddress']);
$url = WEB_URL."/index.php?do=manage&token=".$subscriber->token; // Needed again after adding subscriber since token did not exist before add
$msg = sprintf(_("Thank you for registering to receive status updates via email.</br></br> Click on the following link to confirm and manage your subcription: <a href=\"%s\">%s</a>. New subscriptions must be confirmed within 2 hours"), $url, NAME .' - ' . _("Validate subscription"));
$url = WEB_URL . "/index.php?do=manage&token=" . $subscriber->token; // Needed again after adding subscriber since token did not exist before add
$msg = sprintf(_("Thank you for registering to receive status updates via email.</br></br> Click on the following link to confirm and manage your subcription: <a href=\"%s\">%s</a>. New subscriptions must be confirmed within 2 hours"), $url, NAME . ' - ' . _("Validate subscription"));
} else {
if ( ! $subscriber->active ) {
if (!$subscriber->active) {
// Subscriber is registered, but has not been activated yet...
$msg = sprintf(_("Thank you for registering to receive status updates via email.</br></br> Click on the following link to confirm and manage your subcription: <a href=\"%s\">%s</a>. New subscriptions must be confirmed within 2 hours"), $url, NAME .' - ' . _("Validate subscription"));
$msg = sprintf(_("Thank you for registering to receive status updates via email.</br></br> Click on the following link to confirm and manage your subcription: <a href=\"%s\">%s</a>. New subscriptions must be confirmed within 2 hours"), $url, NAME . ' - ' . _("Validate subscription"));
$subscriber->activate($subscriber->id);
} else {
// subscriber is registered and active
$msg = sprintf(_("Click on the following link to update your existing subscription: <a href=\"%s\">%s</a>"), $url, NAME .' - ' . _("Manage subscription"));
$msg = sprintf(_("Click on the following link to update your existing subscription: <a href=\"%s\">%s</a>"), $url, NAME . ' - ' . _("Manage subscription"));
$subscriber->update($subscriber->id);
}
}
@ -119,90 +115,87 @@ if ( isset($_GET['new']) ) {
$constellation->render_success($header, $message, true, WEB_URL, _('Go back'));
// Send email about new registration
$subject = _('Email subscription registered').' - '.NAME;
$subject = _('Email subscription registered') . ' - ' . NAME;
$mailer->send_mail($_POST['emailaddress'], $subject, $msg);
$boolRegistered = true;
}
// Add a new email subscriber - display form
if ( isset($_GET['new']) && (! $boolRegistered) ) {
if (isset($_GET['new']) && (!$boolRegistered)) {
if (!empty($message)) {
echo '<p class="alert alert-danger">'.$message.'</p>';
echo '<p class="alert alert-danger">' . $message . '</p>';
}
$strPostedEmail = (isset($_POST['emailaddress'])) ? $_POST['emailaddress'] : "";
?>
?>
<form method="post" action="index.php?do=email_subscription&new=1" class="clearfix" enctype="multipart/form-data" >
<h3><?php echo _('Subscribe to get email notifications on status updates');?></h3>
<div class="form-group clearfix">
<label for="labelEmailAddress"><?php echo _('Email address');?></label>
<input type="email" class="form-control" name="emailaddress" id="emailaddress" aria-describedby="emailHelp" placeholder="<?php echo _('Enter email address');?>" value="<?php echo $strPostedEmail;?>" required>
</div>
<?php if (GOOGLE_RECAPTCHA) {?>
<div class="col-md-12">
<div class="form-group">
<div class="captcha_wrapper">
<div class="g-recaptcha" data-sitekey="<?php echo GOOGLE_RECAPTCHA_SITEKEY;?>"></div>
</div>
<form method="post" action="index.php?do=email_subscription&new=1" class="clearfix" enctype="multipart/form-data">
<h3><?php echo _('Subscribe to get email notifications on status updates'); ?></h3>
<div class="form-group clearfix">
<label for="labelEmailAddress"><?php echo _('Email address'); ?></label>
<input type="email" class="form-control" name="emailaddress" id="emailaddress" aria-describedby="emailHelp" placeholder="<?php echo _('Enter email address'); ?>" value="<?php echo $strPostedEmail; ?>" required>
</div>
</div>
<?php } ?>
<summary>
<?php
$msg = sprintf(_('By subscribing to recieve notifications you are agreeing to our <a href="%s">Privacy Policy</a>'), POLICY_URL);
echo $msg;
?>
</summary>
<div class="form-group form-check">
</div>
<a href="<?php echo WEB_URL;?>" id="cancel" name="cancel" class="btn btn-default"><?php echo _('Close');?></a>
<button type="submit" class="btn btn-primary"><?php echo _('Subscribe');?></button>
</form>
<?php
<?php if (GOOGLE_RECAPTCHA) { ?>
<div class="col-md-12">
<div class="form-group">
<div class="captcha_wrapper">
<div class="g-recaptcha" data-sitekey="<?php echo GOOGLE_RECAPTCHA_SITEKEY; ?>"></div>
</div>
</div>
</div>
<?php } ?>
<summary>
<?php
$msg = sprintf(_('By subscribing to recieve notifications you are agreeing to our <a href="%s">Privacy Policy</a>'), POLICY_URL);
echo $msg;
?>
</summary>
<div class="form-group form-check">
</div>
<a href="<?php echo WEB_URL; ?>" id="cancel" name="cancel" class="btn btn-default"><?php echo _('Close'); ?></a>
<button type="submit" class="btn btn-primary"><?php echo _('Subscribe'); ?></button>
</form>
<?php
}
/* Handle management and activation of email subscriptions */
/* Handle management and activation of email subscriptions */
} else if (isset($_GET['do']) && $_GET['do'] == 'manage') {
// check if userid/token combo is valid, active or expired
$subscriber->typeID = 2; //EMAIL
if ( $subscriber->is_active_subscriber($_GET['token']) ) {
if ($subscriber->is_active_subscriber($_GET['token'])) {
// forward user to subscriber list....
$subscriber->set_logged_in();
header('Location: subscriptions.php');
exit;
} else {
Template :: render_header(_("Email Subscription"));
Template::render_header(_("Email Subscription"), "subsmail");
$header = _("We cannot find a valid subscriber account matching those details");
$message = _("If you have recently subscribed, please make sure you activate the account within two hours of doing so. You are welcome to try and re-subscribe.");
$constellation->render_warning($header, $message, true, WEB_URL, _('Go back'));
}
} else if (isset($_GET['do']) && $_GET['do'] == 'unsubscribe') {
// Handle unsubscriptions
// TODO This function is universal and should probably live elsewhere??
if (isset($_GET['token'])) {
$subscriber->typeID = (int) $_GET['type'];
if ( $subscriber->get_subscriber_by_token($_GET['token'])) {
if ($subscriber->get_subscriber_by_token($_GET['token'])) {
$subscriber->delete($subscriber->id);
$subscriber->set_logged_off();
Template :: render_header(_("Email Subscription"));
Template::render_header(_("Email Subscription"), "subsmail");
$header = _("You have been unsubscribed from our system");
$message = _("We are sorry to see you go. If you want to subscribe again at a later date please feel free to re-subscribe.");
$constellation->render_success($header, $message, true, WEB_URL, _('Go back'));
$constellation->render_success($header, $message, true, WEB_URL, _('Go back'));
} else {
// TODO Log token for troubleshooting ?
// Cannot find subscriber - show alert
Template :: render_header(_("Email Subscription"));
Template::render_header(_("Email Subscription"), "subsmail");
$header = _("We are unable to find any valid subscriber detail matching your submitted data!");
$message = _("If you believe this to be an error, please contact the system admininistrator.");
$constellation->render_warning($header, $message, true, WEB_URL, _('Go back'));
@ -216,4 +209,4 @@ if ( isset($_GET['new']) ) {
$constellation->render_warning($header, $message, true, WEB_URL, _('Go back'));
}
}
Template :: render_footer();
Template::render_footer();

147
index.php
View File

@ -1,74 +1,70 @@
<?php
require_once("libs/parsedown/Parsedown.php");
if (!file_exists("config.php"))
{
if (!file_exists("config.php")) {
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");
} 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");
switch ($_GET['do']) {
case 'subscriptions':
require_once("subscriptions.php");
break;
switch ($_GET['do']) {
case 'subscriptions':
require_once("subscriptions.php");
break;
case 'email_subscription':
case 'manage':
case 'unsubscribe';
require_once("email_subscriptions.php");
break;
case 'email_subscription':
case 'manage':
case 'unsubscribe';
require_once("email_subscriptions.php");
break;
default:
// TODO : How to handle url invalid/unknown [do] commands
header('Location: index.php');
break;
}
default:
// TODO : How to handle url invalid/unknown [do] commands
header('Location: index.php');
break;
}
} else {
require_once("config.php");
require_once("template.php");
require_once("classes/constellation.php");
require_once("classes/db-class.php");
$db = new SSDB();
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"));
require_once("config.php");
require_once("template.php");
require_once("classes/constellation.php");
require_once("classes/db-class.php");
$db = new SSDB();
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"));
define("SUBSCRIBE_EMAIL", $db->getBooleanSetting($mysqli,"subscribe_email"));
define("SUBSCRIBE_TELEGRAM", $db->getBooleanSetting($mysqli,"subscribe_telegram"));
define("TG_BOT_USERNAME", $db->getSetting($mysqli,"tg_bot_username"));
define("TG_BOT_API_TOKEN", $db->getSetting($mysqli,"tg_bot_api_token"));
define("GOOGLE_RECAPTCHA", $db->getBooleanSetting($mysqli,"google_recaptcha"));
define("GOOGLE_RECAPTCHA_SITEKEY", $db->getSetting($mysqli,"google_recaptcha_sitekey"));
define("GOOGLE_RECAPTCHA_SECRET", $db->getSetting($mysqli,"google_recaptcha_secret"));
$offset = 0;
define("SUBSCRIBE_EMAIL", $db->getBooleanSetting($mysqli, "subscribe_email"));
define("SUBSCRIBE_TELEGRAM", $db->getBooleanSetting($mysqli, "subscribe_telegram"));
define("TG_BOT_USERNAME", $db->getSetting($mysqli, "tg_bot_username"));
define("TG_BOT_API_TOKEN", $db->getSetting($mysqli, "tg_bot_api_token"));
define("GOOGLE_RECAPTCHA", $db->getBooleanSetting($mysqli, "google_recaptcha"));
define("GOOGLE_RECAPTCHA_SITEKEY", $db->getSetting($mysqli, "google_recaptcha_sitekey"));
define("GOOGLE_RECAPTCHA_SECRET", $db->getSetting($mysqli, "google_recaptcha_secret"));
$offset = 0;
if (isset($_GET['ajax']))
{
$constellation->render_incidents(false,$_GET['offset'],5);
exit();
}else if (isset($_GET['offset']))
{
$offset = $_GET['offset'];
}
if (isset($_GET['ajax'])) {
$constellation->render_incidents(false, $_GET['offset'], 5);
exit();
} else if (isset($_GET['offset'])) {
$offset = $_GET['offset'];
}
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']);
header('Location: index.php');
}
/*
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']);
header('Location: index.php');
}
/*
$versionfile = fopen("versionfile", "r") or die("Unable to open version file!");
$appversion = fread($versionfile,filesize("versionfile"));
fclose($versionfile);
@ -92,30 +88,29 @@ if($db->getSetting($mysqli,"notifyUpdates") == "yes"){
}
}
*/
Template::render_header("Status");
Template::render_header("Status", "status");
?>
<div class="text-center">
<h2><?php echo _("Current status");?></h2>
</div>
<div id="current">
<?php $constellation->render_status();?>
</div>
<div class="text-center">
<h2><?php echo _("Current status"); ?></h2>
</div>
<div id="current">
<?php $constellation->render_status(); ?>
</div>
<?php if ($mysqli->query("SELECT count(*) FROM status")->num_rows)
{
<?php if ($mysqli->query("SELECT count(*) FROM status")->num_rows) {
?>
<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 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>
<?php }
Template::render_footer();
Template::render_footer();
}

View File

@ -4,93 +4,87 @@ define("WEB_URL", "."); //Website name
define("NAME", _('Status page')); //Website name
define("MINIMUM_PHP_VERSION", "5.4.0");
define("POLICY_URL", "policy.php"); //Default policy URL
define("CUSTOM_LOGO_URL","");
define("COPYRIGHT_TEXT","");
define("CUSTOM_LOGO_URL", "");
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;
}
if (isset($_GET["isDev"])) {
if ($_GET["isDev"] == "devMode") {
$isDeveleoperEnvironement = true;
}
}
$negotiator = new LocaleNegotiator("en_GB");
$message = "";
$db = new SSDB();
if (!isset($_SESSION['locale'])||isset($_GET['lang']))
{
$override = ((isset($_GET['lang']))?$_GET['lang']:null);
if (!isset($_SESSION['locale']) || isset($_GET['lang'])) {
$override = ((isset($_GET['lang'])) ? $_GET['lang'] : null);
$best_match = $negotiator->negotiate($override);
$_SESSION['locale'] = $best_match;
setlocale(LC_ALL, $_SESSION['locale'].".UTF-8");
setlocale(LC_ALL, $_SESSION['locale'] . ".UTF-8");
bindtextdomain("server-status", __DIR__ . "/locale/");
bind_textdomain_codeset($_SESSION['locale'], "utf-8");
textdomain("server-status");
}
if (isset($_POST['server']))
{
$mysqli = new mysqli($_POST['server'],$_POST['dbuser'],$_POST['dbpassword'],$_POST['database']);
if (isset($_POST['server'])) {
$mysqli = new mysqli($_POST['server'], $_POST['dbuser'], $_POST['dbpassword'], $_POST['database']);
if ($mysqli->connect_errno) {
$message .= sprintf(_("Connection failed: %s\n"), $mysqli->connect_error);
}
if (isset($_POST['url']) && filter_var($_POST['url'], FILTER_VALIDATE_URL) === false)
{
if (isset($_POST['url']) && filter_var($_POST['url'], FILTER_VALIDATE_URL) === false) {
$message .= _("Please set valid url!");
}
//Ostatní má checky existence ve funkci pro pridani
if (0 == strlen(trim($_POST['servername']))){
if (0 == strlen(trim($_POST['servername']))) {
$messages[] = _("Server name");
}
if (0 == strlen(trim($_POST['url']))){
if (0 == strlen(trim($_POST['url']))) {
$messages[] = _("Url");
}
if (0 == strlen(trim($_POST['mailer']))){
if (0 == strlen(trim($_POST['mailer']))) {
$messages[] = _("Mailer name");
}
if (0 == strlen(trim($_POST['title']))){
if (0 == strlen(trim($_POST['title']))) {
$messages[] = _("Title");
}
if (0 == strlen(trim($_POST['mailer_email']))){
if (0 == strlen(trim($_POST['mailer_email']))) {
$messages[] = _("Mailer email");
}
if (0 == strlen(trim($_POST['server']))){
if (0 == strlen(trim($_POST['server']))) {
$messages[] = _("Database server");
}
if (0 == strlen(trim($_POST['database']))){
if (0 == strlen(trim($_POST['database']))) {
$messages[] = _("Database name");
}
if (0 == strlen(trim($_POST['dbuser']))){
if (0 == strlen(trim($_POST['dbuser']))) {
$messages[] = _("Database user");
}
if (0 == strlen(trim($_POST['dbpassword'])))
{
if (0 == strlen(trim($_POST['dbpassword']))) {
$messages[] = _("Database password");
}
if (isset($messages))
{
if (isset($messages)) {
$message .= _("Please enter");
$message .= implode(", ", $messages);
}
}
if(isset($_POST['server']) && empty($message))
{
if (isset($_POST['server']) && empty($message)) {
define("MAILER_NAME", $_POST['mailer']);
define("MAILER_ADDRESS", $_POST['mailer_email']);
define("INSTALL_OVERRIDE", true);
@ -102,39 +96,35 @@ if(isset($_POST['server']) && empty($message))
foreach ($array as $value) {
$val = trim($value);
if (empty($val))
{
if (empty($val)) {
continue;
}
$q_res = $mysqli->query($value);
if ($q_res === false)
{
if ($q_res === false) {
$message = sprintf(_("Error while creating database. Please check permission for your account or MYSQL version.<br>Error: %s"), $mysqli->error);
break;
}
}
if (empty($message))
{
if (empty($message)) {
require_once("classes/constellation.php");
User::add();
}
if (empty($message))
{
if (empty($message)) {
//Create config
$config = file_get_contents("config.php.template");
//$config = str_replace("##name##", htmlspecialchars($_POST['servername'], ENT_QUOTES), $config);
$db->setSetting($mysqli,"name",htmlspecialchars($_POST['servername'], ENT_QUOTES));
$db->setSetting($mysqli, "name", htmlspecialchars($_POST['servername'], ENT_QUOTES));
//$config = str_replace("##title##", htmlspecialchars($_POST['title'], ENT_QUOTES), $config);
$db->setSetting($mysqli,"title",htmlspecialchars($_POST['title'], ENT_QUOTES));
$db->setSetting($mysqli, "title", htmlspecialchars($_POST['title'], ENT_QUOTES));
//$config = str_replace("##url##", $_POST['url'], $config);
$db->setSetting($mysqli,"url",$_POST['url']);
$db->setSetting($mysqli, "url", $_POST['url']);
//$config = str_replace("##mailer##", htmlspecialchars($_POST['mailer'], ENT_QUOTES), $config);
$db->setSetting($mysqli,"mailer",htmlspecialchars($_POST['mailer'], ENT_QUOTES));
$db->setSetting($mysqli, "mailer", htmlspecialchars($_POST['mailer'], ENT_QUOTES));
//$config = str_replace("##mailer_email##", htmlspecialchars($_POST['mailer_email'], ENT_QUOTES), $config);
$db->setSetting($mysqli,"mailer_email",htmlspecialchars($_POST['mailer_email'], ENT_QUOTES));
$db->setSetting($mysqli, "mailer_email", htmlspecialchars($_POST['mailer_email'], ENT_QUOTES));
$config = str_replace("##server##", htmlspecialchars($_POST['server'], ENT_QUOTES), $config);
$config = str_replace("##database##", htmlspecialchars($_POST['database'], ENT_QUOTES), $config);
$config = str_replace("##user##", htmlspecialchars($_POST['dbuser'], ENT_QUOTES), $config);
@ -143,172 +133,257 @@ if(isset($_POST['server']) && empty($message))
$config = str_replace("##policy_name##", htmlspecialchars($_POST['policy_name'], ENT_QUOTES), $config);
$config = str_replace("##address##", htmlspecialchars($_POST['address'], ENT_QUOTES), $config);
$config = str_replace("##policy_mail##", htmlspecialchars($_POST['policy_mail'], ENT_QUOTES), $config);
$config = str_replace("##policy_phone##", htmlspecialchars($_POST['policy_phone'], ENT_QUOTES),$config);
$config = str_replace("##policy_phone##", htmlspecialchars($_POST['policy_phone'], ENT_QUOTES), $config);
$config = str_replace("##who_we_are##", htmlspecialchars($_POST['who_we_are'], ENT_QUOTES), $config);
$policy_url_conf = ( ! empty($_POST['policy_url']) ) ? htmlspecialchars($_POST['policy_url'], ENT_QUOTES) : $_POST['url']."/policy.php";
$policy_url_conf = (!empty($_POST['policy_url'])) ? htmlspecialchars($_POST['policy_url'], ENT_QUOTES) : $_POST['url'] . "/policy.php";
$config = str_replace("##policy_url##", $policy_url_conf, $config);
file_put_contents("config.php", $config);
include_once "create-server-config.php";
$db->setSetting($mysqli,"dbConfigVersion","Version2Beta7");
$db->setSetting($mysqli,"notifyUpdates","yes");
$db->setSetting($mysqli,"subscribe_email","no");
$db->setSetting($mysqli,"subscribe_telegram","no");
$db->setSetting($mysqli,"tg_bot_api_token","");
$db->setSetting($mysqli,"tg_bot_username","");
$db->setSetting($mysqli,"php_mailer","no");
$db->setSetting($mysqli,"php_mailer_host","");
$db->setSetting($mysqli,"php_mailer_smtp","no");
$db->setSetting($mysqli,"php_mailer_path","");
$db->setSetting($mysqli,"php_mailer_port","");
$db->setSetting($mysqli,"php_mailer_secure","no");
$db->setSetting($mysqli,"php_mailer_user","");
$db->setSetting($mysqli,"php_mailer_pass","");
$db->setSetting($mysqli,"google_recaptcha","no");
$db->setSetting($mysqli,"google_recaptcha_secret","");
$db->setSetting($mysqli,"google_recaptcha_sitekey","");
$db->setSetting($mysqli,"cron_server_ip","");
if(!$isDeveleoperEnvironement) {
unlink("create-server-config.php");
unlink("config.php.template");
unlink("install.sql");
unlink(__FILE__);
}
header("Location: ".WEB_URL);
$db->setSetting($mysqli, "dbConfigVersion", "Version2Beta7");
$db->setSetting($mysqli, "notifyUpdates", "yes");
$db->setSetting($mysqli, "subscribe_email", "no");
$db->setSetting($mysqli, "subscribe_telegram", "no");
$db->setSetting($mysqli, "tg_bot_api_token", "");
$db->setSetting($mysqli, "tg_bot_username", "");
$db->setSetting($mysqli, "php_mailer", "no");
$db->setSetting($mysqli, "php_mailer_host", "");
$db->setSetting($mysqli, "php_mailer_smtp", "no");
$db->setSetting($mysqli, "php_mailer_path", "");
$db->setSetting($mysqli, "php_mailer_port", "");
$db->setSetting($mysqli, "php_mailer_secure", "no");
$db->setSetting($mysqli, "php_mailer_user", "");
$db->setSetting($mysqli, "php_mailer_pass", "");
$db->setSetting($mysqli, "google_recaptcha", "no");
$db->setSetting($mysqli, "google_recaptcha_secret", "");
$db->setSetting($mysqli, "google_recaptcha_sitekey", "");
$db->setSetting($mysqli, "cron_server_ip", "");
if (!$isDeveleoperEnvironement) {
unlink("create-server-config.php");
unlink("config.php.template");
unlink("install.sql");
unlink(__FILE__);
}
header("Location: " . WEB_URL);
}
}
Template::render_header(_("Install"));
?>
<h1 class="text-center"><?php echo _("Prerequisite");?></h1>
<summary><?php echo _("If any of the following prerequisites are shown as failed (red X), please correct the issue and reload the page before proceeding with the installation.");?></summary>
<?php
Template::render_header(_("Install"), "install");
$php_version_req = sprintf(_("Minimum PHP version %s"), MINIMUM_PHP_VERSION);
$preq_fail = array("times", "danger");
$preq_ok = array("check", "success");
$php_version_req = sprintf(_("Minimum PHP version %s"), MINIMUM_PHP_VERSION);
$preq_fail = array("remove", "danger");
$preq_ok = array("ok", "success");
$preq_phpver = $preq_fail;
$preq_mysqlnd = $preq_fail;
$preq_writedir = $preq_fail;
$preq_phpver = $preq_fail;
$preq_mysqlnd = $preq_fail;
$preq_writedir = $preq_fail;
// Check if PHP version if > MINIMUM_PHP_VERSION
if (strnatcmp(phpversion(), MINIMUM_PHP_VERSION) >= 0) { $preq_phpver = $preq_ok; }
// Test for mysqlnd precense. The mysqlnd driver provides some extra functions that is not available
// if the plain mysql package is installed, and mysqli_get_client_stats is one of them. This is documented
// on the PHP site at http://www.php.net/manual/en/mysqlnd.stats.php
// This test is also discussed at https://stackoverflow.com/questions/1475701/how-to-know-if-mysqlnd-is-the-active-driver
if ( function_exists('mysqli_get_client_stats') ) { $preq_mysqlnd = $preq_ok; }
// Check if we have access to write to location
if ( is_writable(__DIR__) ) { $preq_writedir = $preq_ok; }
?>
<section class="prereq-section clearfix">
<div class="container-fluid">
<div class="row ">
<div class="col-md-6 text-right"><label for="php version"><?php echo $php_version_req;?></div>
<div class="col-md-6"><a href="#" class="btn btn-<?php echo $preq_phpver[1];?>"><span class="glyphicon glyphicon-<?php echo $preq_phpver[0]; ?>"></span></a></div>
</div>
<div class="row ">
<div class="col-md-6 text-right"><label for="mysqlnd Library installed"><?php echo _('PHP mysqlnd library installed');?></div>
<div class="col-md-6"><a href="#" class="btn btn-<?php echo $preq_mysqlnd[1];?>"><span class="glyphicon glyphicon-<?php echo $preq_mysqlnd[0]; ?>"></span></a></div>
</div>
<div class="row">
<div class="col-md-6 text-right"><label for="write_access"><?php echo _('Write access to web directory');?></div>
<div class="col-md-6"><a href="#" class="btn btn-<?php echo $preq_writedir[1];?>"><span class="glyphicon glyphicon-<?php echo $preq_writedir[0]; ?>"></span></a></div>
</div>
</div>
</section>
<h1 class="text-center"><?php echo _("Installation");?></h1>
<?php
if (!empty($message))
{
?>
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php
// Check if PHP version if > MINIMUM_PHP_VERSION
if (strnatcmp(phpversion(), MINIMUM_PHP_VERSION) >= 0) {
$preq_phpver = $preq_ok;
}
// Test for mysqlnd precense. The mysqlnd driver provides some extra functions that is not available
// if the plain mysql package is installed, and mysqli_get_client_stats is one of them. This is documented
// on the PHP site at http://www.php.net/manual/en/mysqlnd.stats.php
// This test is also discussed at https://stackoverflow.com/questions/1475701/how-to-know-if-mysqlnd-is-the-active-driver
if (function_exists('mysqli_get_client_stats')) {
$preq_mysqlnd = $preq_ok;
}
// Check if we have access to write to location
if (is_writable(__DIR__)) {
$preq_writedir = $preq_ok;
}
?>
<summary><?php echo _("We will ask you some basic questions about your website. Most of the settings can be later edited in the config.php file.");?></summary>
<form method="post" action="." class="clearfix install">
<section class="install-section clearfix">
<h2><?php echo _("Website details");?></h2>
<summary><?php echo _("We need a name for your status page (shown behind page title after the dash) and a url of your server status installation (i.e. <a href='#'>https://example.com/status</a> - without the trailing slash), so we can mail users link for forgotten password etc...");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="servername"><?php echo _("Name");?>: </label><input type="text" name="servername" value="<?php echo ((isset($_POST['servername']))?htmlspecialchars($_POST['servername'], ENT_QUOTES):'');?>" id="servername" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="url"><?php echo _("Url");?>: </label><input type="url" name="url" value="<?php echo ((isset($_POST['url']))?htmlspecialchars($_POST['url'], ENT_QUOTES):'');?>" id="url" placeholder="<?php echo _("Url");?>" class="form-control" required></div>
<div>
<div class="card">
<div class="card-header text-center">
<?php echo _("Prerequisite"); ?>
</div>
<summary><?php echo _("A title that you want to be shown on the top of the page.");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="title"><?php echo _("Title");?>: </label><input type="text" name="title" value="<?php echo ((isset($_POST['title']))?htmlspecialchars($_POST['title'], ENT_QUOTES):'Server Status');?>" id="title" placeholder="<?php echo _("Title");?>" class="form-control" required></div>
<div class="col-sm-6"></div>
</div>
<summary><?php echo _("Also an email address for mailer would be nice :)");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="mailer"><?php echo _("Name");?>: </label><input type="text" name="mailer" value="<?php echo ((isset($_POST['mailer']))?htmlspecialchars($_POST['mailer'], ENT_QUOTES):'');?>" id="mailer" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="mailer_email"><?php echo _("Email");?>: </label><input type="email" name="mailer_email" value="<?php echo ((isset($_POST['mailer_email']))?htmlspecialchars($_POST['mailer_email'], ENT_QUOTES):'');?>" id="mailer_email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
</div>
</section>
<section class="install-section clearfix">
<h2><?php echo _("Database connection");?></h2>
<summary><?php echo _("We need database connection to be able to create tables. Please check that your account has the permission needed to do that.");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="server"><?php echo _("Server");?>: </label><input type="text" name="server" value="<?php echo ((isset($_POST['server']))?htmlspecialchars($_POST['server'], ENT_QUOTES):'');?>" id="server" placeholder="<?php echo _("Server");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="database"><?php echo _("Database");?>: </label><input type="text" name="database" value="<?php echo ((isset($_POST['database']))?htmlspecialchars($_POST['database'], ENT_QUOTES):'');?>" id="database" placeholder="<?php echo _("Database");?>" class="form-control" required></div>
</div>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="dbuser"><?php echo _("User");?>: </label><input type="text" name="dbuser" value="<?php echo ((isset($_POST['dbuser']))?htmlspecialchars($_POST['dbuser'], ENT_QUOTES):'');?>" id="dbuser" placeholder="<?php echo _("User");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="dbpassword"><?php echo _("Password");?>: </label><input type="password" name="dbpassword" value="<?php echo ((isset($_POST['dbpassword']))?htmlspecialchars($_POST['dbpassword'], ENT_QUOTES):'');?>" id="dbpassword" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
</div>
</section>
<section class="install-section clearfix">
<h2><?php echo _("Privacy Policy");?></h2>
<summary><?php echo _("Since you are collecting personal information, the GDPR needs you to have a privacy policy. Enter the details below.");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="policy_name"><?php echo _("Name");?>: </label><input type="text" name="policy_name" value="<?php echo ((isset($_POST['policy_name']))?htmlspecialchars($_POST['policy_name'], ENT_QUOTES):'');?>" id="policy_name" placeholder="<?php echo _("Company name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="address"><?php echo _("Address");?>: </label><input type="text" name="address" value="<?php echo ((isset($_POST['address']))?htmlspecialchars($_POST['address'], ENT_QUOTES):'');?>" id="address" placeholder="<?php echo _("Full address");?>" class="form-control" required></div>
</div>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="policy_mail"><?php echo _("E-Mail");?>: </label><input type="text" name="policy_mail" value="<?php echo ((isset($_POST['policy_mail']))?htmlspecialchars($_POST['policy_mail'], ENT_QUOTES):'');?>" id="policy_mail" placeholder="<?php echo _("E-Mail");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="policy_phone"><?php echo _("Phone");?>: </label><input type="text" name="policy_phone" value="<?php echo ((isset($_POST['policy_phone']))?htmlspecialchars($_POST['policy_phone'], ENT_QUOTES):'');?>" id="policy_phone" placeholder="<?php echo _("Phone number");?>" class="form-control"></div>
</div>
<div class="form-group clearfix">
<div class=""><label for="who_we_are"><?php echo _("Who we are");?>: </label><textarea class="form-control" id="who_we_are" rows="3" name="who_we_are" placeholder="<?php echo _("Some info about yourself");?>" value="<?php echo ((isset($_POST['who_we_are']))?htmlspecialchars($_POST['who_we_are'], ENT_QUOTES):'');?>"></textarea></div>
</div>
<div class="form-group clearfix">
<div class="col-sm-12"><label for="url"><?php echo _("External Policy Url");?>: </label>
<summary><?php echo _("If you alredy have an existing Policy published, please provide the full Url to override the local policy definition. Leave blank to use the local definition");?></summary>
<input type="policy_url" name="policy_url" value="<?php echo ((isset($_POST['policy_url']))?htmlspecialchars($_POST['policy_url'], ENT_QUOTES):'');?>" id="policy_url" placeholder="<?php echo _("External Policy Url");?>" class="form-control">
<div class="card-body">
<span class="card-title"><?php echo _("If any of the following prerequisites are shown as failed (red X), please correct the issue and reload the page before proceeding with the installation."); ?></span>
<p class="card-text">
<div class="container">
<div class="row">
<div class="col text-center"><?php echo $php_version_req; ?></div>
<div class="col text-center"><a class="btn btn-<?php echo $preq_phpver[1]; ?>"><i class="fas fa-<?php echo $preq_phpver[0]; ?>"></i></a></div>
</div>
<div class="row mt-1">
<div class="col text-center"><?php echo _('PHP mysqlnd library installed'); ?></div>
<div class="col text-center"><a class="btn btn-<?php echo $preq_mysqlnd[1]; ?>"><i class="fas fa-<?php echo $preq_mysqlnd[0]; ?>"></i></a></div>
</div>
<div class="row mt-1">
<div class="col text-center"><?php echo _('Write access to web directory'); ?></div>
<div class="col text-center"><a class="btn btn-<?php echo $preq_writedir[1]; ?>"><i class="fas fa-<?php echo $preq_writedir[0]; ?>"></i></a></div>
</div>
</div>
</p>
</div>
</section>
<section class="install-section clearfix">
<h2><?php echo _("User");?></h2>
<summary><?php echo _("And finally, we need info to create a new user. You don't have to provide it, but then... No status page admin...");?></summary>
<div class="form-group">
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name']))?htmlspecialchars($_POST['name'], ENT_QUOTES):'');?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname']))?htmlspecialchars($_POST['surname'], ENT_QUOTES):'');?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username']))?htmlspecialchars($_POST['username'], ENT_QUOTES):'');?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email']))?htmlspecialchars($_POST['email'], ENT_QUOTES):'');?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required><input type="hidden" name="permission" value="0"></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password']))?htmlspecialchars($_POST['password'], ENT_QUOTES):'');?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
<div class="col-sm-6">
</div>
<div class="settings">
<h1 class="text-center"><?php echo _("Installation"); ?></h1>
<?php
if (!empty($message)) {
?>
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php
}
?>
<span><?php echo _("We will ask you some basic questions about your website. Most of the settings can be later edited in the config.php file."); ?></span>
<form method="post" action=".">
<div class="card">
<div class="card-header text-center">
<?php echo _("Website details"); ?>
</div>
<div class="card-body">
<span class="card-title"><?php echo _("We need a name for your status page (shown behind page title after the dash) and a url of your server status installation (i.e. <a href='#'>https://example.com/status</a> - without the trailing slash), so we can mail users link for forgotten password etc..."); ?></span>
<p class="card-text">
<div class="row">
<div class="col form-floating">
<input type="text" name="servername" value="<?php echo ((isset($_POST['servername'])) ? htmlspecialchars($_POST['servername'], ENT_QUOTES) : ''); ?>" id="servername" placeholder="<?php echo _("Servername"); ?>" class="form-control" required>
<label for="servername"><?php echo _("Servername"); ?>: </label>
</div>
<div class="col form-floating">
<input type="url" name="url" value="<?php echo ((isset($_POST['url'])) ? htmlspecialchars($_POST['url'], ENT_QUOTES) : ''); ?>" id="url" placeholder="<?php echo _("Url"); ?>" class="form-control" required>
<label for="url"><?php echo _("Url"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<input type="text" name="mailer" value="<?php echo ((isset($_POST['mailer'])) ? htmlspecialchars($_POST['mailer'], ENT_QUOTES) : ''); ?>" id="mailer" placeholder="<?php echo _("Mail-Name"); ?>" class="form-control" required>
<label for="mailer"><?php echo _("Mail-Name"); ?>: </label>
</div>
<div class="col form-floating">
<input type="email" name="mailer_email" value="<?php echo ((isset($_POST['mailer_email'])) ? htmlspecialchars($_POST['mailer_email'], ENT_QUOTES) : ''); ?>" id="mailer_email" placeholder="<?php echo _("Email"); ?>" class="form-control" required>
<label for="mailer_email"><?php echo _("Email"); ?>: </label>
</div>
</div>
</p>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<?php echo _("Database connection"); ?>
</div>
<div class="card-body">
<span class="card-title"><?php echo _("We need database connection to be able to create tables. Please check that your account has the permission needed to do that."); ?></span>
<p class="card-text">
<div class="row">
<div class="col form-floating">
<input type="text" name="server" value="<?php echo ((isset($_POST['server'])) ? htmlspecialchars($_POST['server'], ENT_QUOTES) : ''); ?>" id="server" placeholder="<?php echo _("Server"); ?>" class="form-control" required>
<label for="server"><?php echo _("Server"); ?>: </label>
</div>
<div class="col form-floating">
<input type="text" name="database" value="<?php echo ((isset($_POST['database'])) ? htmlspecialchars($_POST['database'], ENT_QUOTES) : ''); ?>" id="database" placeholder="<?php echo _("Database"); ?>" class="form-control" required>
<label for="database"><?php echo _("Database"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<input type="text" name="dbuser" value="<?php echo ((isset($_POST['dbuser'])) ? htmlspecialchars($_POST['dbuser'], ENT_QUOTES) : ''); ?>" id="dbuser" placeholder="<?php echo _("User"); ?>" class="form-control" required>
<label for="dbuser"><?php echo _("User"); ?>: </label>
</div>
<div class="col form-floating">
<input type="password" name="dbpassword" value="<?php echo ((isset($_POST['dbpassword'])) ? htmlspecialchars($_POST['dbpassword'], ENT_QUOTES) : ''); ?>" id="dbpassword" placeholder="<?php echo _("Password"); ?>" class="form-control" required>
<label for="dbpassword"><?php echo _("Password"); ?>: </label>
</div>
</div>
</p>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<?php echo _("Privacy Policy"); ?>
</div>
<div class="card-body">
<span class="card-title"><?php echo _("Since you are collecting personal information, the GDPR needs you to have a privacy policy. Enter the details below."); ?></span>
<p class="card-text">
<div class="row">
<div class="col form-floating">
<input type="text" name="policy_name" value="<?php echo ((isset($_POST['policy_name'])) ? htmlspecialchars($_POST['policy_name'], ENT_QUOTES) : ''); ?>" id="policy_name" placeholder="<?php echo _("Company name"); ?>" class="form-control" required>
<label for="policy_name"><?php echo _("Name"); ?>: </label>
</div>
<div class="col form-floating">
<input type="text" name="address" value="<?php echo ((isset($_POST['address'])) ? htmlspecialchars($_POST['address'], ENT_QUOTES) : ''); ?>" id="address" placeholder="<?php echo _("Full address"); ?>" class="form-control" required>
<label for="address"><?php echo _("Address"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<input type="text" name="policy_mail" value="<?php echo ((isset($_POST['policy_mail'])) ? htmlspecialchars($_POST['policy_mail'], ENT_QUOTES) : ''); ?>" id="policy_mail" placeholder="<?php echo _("E-Mail"); ?>" class="form-control" required>
<label for="policy_mail"><?php echo _("E-Mail"); ?>: </label>
</div>
<div class="col form-floating">
<input type="text" name="policy_phone" value="<?php echo ((isset($_POST['policy_phone'])) ? htmlspecialchars($_POST['policy_phone'], ENT_QUOTES) : ''); ?>" id="policy_phone" placeholder="<?php echo _("Phone number"); ?>" class="form-control">
<label for="policy_phone"><?php echo _("Phone"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<textarea class="form-control" id="who_we_are" rows="3" name="who_we_are" placeholder="<?php echo _("Some info about yourself"); ?>" value="<?php echo ((isset($_POST['who_we_are'])) ? htmlspecialchars($_POST['who_we_are'], ENT_QUOTES) : ''); ?>"></textarea>
<label for="who_we_are"><?php echo _("Who we are"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<span><?php echo _("If you alredy have an existing Policy published, please provide the full Url to override the local policy definition. Leave blank to use the local definition"); ?></span>
<div class="col form-floating">
<input type="policy_url" name="policy_url" value="<?php echo ((isset($_POST['policy_url'])) ? htmlspecialchars($_POST['policy_url'], ENT_QUOTES) : ''); ?>" id="policy_url" placeholder="<?php echo _("External Policy Url"); ?>" class="form-control">
<label for="url"><?php echo _("External Policy Url"); ?>: </label>
</div>
</div>
</p>
</div>
</div>
<div class="card">
<div class="card-header text-center">
<?php echo _("User"); ?>
</div>
<div class="card-body">
<span class="card-title"><?php echo _("And finally, we need info to create a new user. You don't have to provide it, but then... No status page admin..."); ?></span>
<p class="card-text">
<div class="row">
<div class="col form-floating">
<input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name'])) ? htmlspecialchars($_POST['name'], ENT_QUOTES) : ''); ?>" id="name" placeholder="<?php echo _("Name"); ?>" class="form-control" required>
<label for="name"><?php echo _("Name"); ?>: </label>
</div>
<div class="col form-floating">
<input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname'])) ? htmlspecialchars($_POST['surname'], ENT_QUOTES) : ''); ?>" id="surname" placeholder="<?php echo _("Surname"); ?>" class="form-control" required>
<label for="surname"><?php echo _("Surname"); ?>: </label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username'])) ? htmlspecialchars($_POST['username'], ENT_QUOTES) : ''); ?>" id="username" placeholder="<?php echo _("Username"); ?>" class="form-control" required>
<label for="username"><?php echo _("Username"); ?>:</label>
</div>
<div class="col form-floating">
<input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email'])) ? htmlspecialchars($_POST['email'], ENT_QUOTES) : ''); ?>" id="email" placeholder="<?php echo _("Email"); ?>" class="form-control" required><input type="hidden" name="permission" value="0">
<label for="email"><?php echo _("Email"); ?>:</label>
</div>
</div>
<div class="row mt-3">
<div class="col form-floating">
<input type="password" name="password" value="<?php echo ((isset($_POST['password'])) ? htmlspecialchars($_POST['password'], ENT_QUOTES) : ''); ?>" id="password" placeholder="<?php echo _("Password"); ?>" class="form-control" required>
<label for="password"><?php echo _("Password"); ?>:</label>
</div>
</div>
</p>
</div>
</div>
<div class="card" style="border: none;">
<input type="hidden" value="0" name="permission">
<button type="submit" class="btn btn-success pull-right"><?php echo _("Run install!");?></button>
<button type="submit" class="btn btn-success float-end"><?php echo _("Run install!"); ?></button>
</div>
</div>
</section>
</form>
</form>
</div>
</div>
<?php
Template::render_footer();

View File

@ -1,16 +1,16 @@
CREATE TABLE `settings` (
`setting` varchar(255) NOT NULL UNIQUE,
`value` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `services` (
`id` int(11) NOT NULL,
`name` varchar(50) COLLATE utf8_czech_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `services_status` (
`id` int(11) NOT NULL,
`service_id` int(11) NOT NULL,
`status_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `status` (
`id` int(11) NOT NULL,
`type` int(11) NOT NULL,
@ -19,13 +19,13 @@ CREATE TABLE `status` (
`time` int(11) NOT NULL,
`end_time` int(11) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `tokens` (
`token` varchar(64) COLLATE utf8_czech_ci NOT NULL,
`user` int(11) NOT NULL,
`expire` int(11) NOT NULL,
`data` varchar(80) COLLATE utf8_czech_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`email` varchar(60) COLLATE utf8_czech_ci NOT NULL,
@ -36,18 +36,18 @@ CREATE TABLE `users` (
`password_salt` char(64) COLLATE utf8_czech_ci NOT NULL,
`permission` int(11) NOT NULL DEFAULT '0',
`active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE `subscribers` (
`subscriberID` int(11) NOT NULL,
`telegramID` int(50) NOT NULL,
`firstname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lastname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE `services_subscriber` (
`comboID` int(11) NOT NULL,
`subscriberIDFK` int(11) NOT NULL,
`serviceIDFK` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE queue_notify (
id int(11) NOT NULL AUTO_INCREMENT,
task_id int(11) NOT NULL,
@ -55,16 +55,14 @@ CREATE TABLE queue_notify (
subscriber_id int(11) NOT NULL,
retries tinyint(1) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
CREATE TABLE services_groups (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(50) NOT NULL,
description varchar(50) DEFAULT NULL,
visibility tinyint(4) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE queue_task (
id int(11) NOT NULL AUTO_INCREMENT,
type_id int(11) NOT NULL,
@ -76,67 +74,79 @@ CREATE TABLE queue_task (
num_errors int(11) DEFAULT NULL,
user_id int(11) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_czech_ci;
ALTER TABLE `services`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
ALTER TABLE `services_status`
ADD PRIMARY KEY (`id`),
ADD PRIMARY KEY (`id`),
ADD KEY `service_id` (`service_id`),
ADD KEY `status_id` (`status_id`);
ALTER TABLE `status`
ADD PRIMARY KEY (`id`),
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
ALTER TABLE `tokens`
ADD PRIMARY KEY (`token`),
ADD PRIMARY KEY (`token`),
ADD KEY `user` (`user`);
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `username` (`username`);
ALTER TABLE `services`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `services_status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `services_subscriber`
ADD PRIMARY KEY (`comboID`),
ADD UNIQUE KEY `unique_subscription` (`subscriberIDFK`,`serviceIDFK`),
ADD PRIMARY KEY (`comboID`),
ADD UNIQUE KEY `unique_subscription` (`subscriberIDFK`, `serviceIDFK`),
ADD KEY `serviceIDFK` (`serviceIDFK`);
ALTER TABLE `subscribers`
ADD PRIMARY KEY (`subscriberID`),
ADD PRIMARY KEY (`subscriberID`),
ADD UNIQUE KEY `telegramID` (`telegramID`);
ALTER TABLE `services_subscriber`
MODIFY `comboID` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `comboID` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `subscribers`
MODIFY `subscriberID` int(11) NOT NULL AUTO_INCREMENT;
MODIFY `subscriberID` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `services_status`
ADD CONSTRAINT `service_id` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`),
ADD CONSTRAINT `service_id` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`),
ADD CONSTRAINT `status_id` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`);
ALTER TABLE `status`
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
ALTER TABLE `tokens`
ADD CONSTRAINT `user` FOREIGN KEY (`user`) REFERENCES `users` (`id`);
ADD CONSTRAINT `user` FOREIGN KEY (`user`) REFERENCES `users` (`id`);
ALTER TABLE `services_subscriber`
ADD CONSTRAINT `services_subscriber_ibfk_1` FOREIGN KEY (`subscriberIDFK`) REFERENCES `subscribers` (`subscriberID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `services_subscriber_ibfk_1` FOREIGN KEY (`subscriberIDFK`) REFERENCES `subscribers` (`subscriberID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `services_subscriber_ibfk_2` FOREIGN KEY (`serviceIDFK`) REFERENCES `services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
ALTER TABLE `subscribers` CHANGE COLUMN lastname lastname varchar(255) DEFAULT NULL; # was varchar(255) NOT NULL
ALTER TABLE `subscribers` CHANGE COLUMN firstname firstname varchar(255) DEFAULT NULL; # was varchar(255) NOT NULL
ALTER TABLE `subscribers` CHANGE COLUMN lastname lastname varchar(255) DEFAULT NULL;
# was varchar(255) NOT NULL
ALTER TABLE `subscribers` CHANGE COLUMN firstname firstname varchar(255) DEFAULT NULL;
# was varchar(255) NOT NULL
ALTER TABLE `subscribers` CHANGE COLUMN telegramID userID varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE `subscribers` ADD COLUMN typeID tinyint(1) NOT NULL AFTER subscriberID;
ALTER TABLE `subscribers` ADD COLUMN token varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER lastname;
ALTER TABLE `subscribers` ADD COLUMN expires int(11) DEFAULT NULL;
ALTER TABLE `subscribers` ADD COLUMN active tinyint(1) DEFAULT NULL;
ALTER TABLE `subscribers` ADD COLUMN create_time int(11) DEFAULT NULL;
ALTER TABLE `subscribers` ADD COLUMN update_time int(11) DEFAULT NULL;
ALTER TABLE `subscribers` DROP INDEX telegramID; # was UNIQUE (telegramID)
ALTER TABLE `subscribers` ADD UNIQUE userID (userID);
COMMIT;
ALTER TABLE services ADD COLUMN description varchar(200) COLLATE utf8_czech_ci NOT NULL;
ALTER TABLE services ADD COLUMN group_id int(11) DEFAULT NULL;
ALTER TABLE `subscribers`
ADD COLUMN typeID tinyint(1) NOT NULL
AFTER subscriberID;
ALTER TABLE `subscribers`
ADD COLUMN token varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL
AFTER lastname;
ALTER TABLE `subscribers`
ADD COLUMN expires int(11) DEFAULT NULL;
ALTER TABLE `subscribers`
ADD COLUMN active tinyint(1) DEFAULT NULL;
ALTER TABLE `subscribers`
ADD COLUMN create_time int(11) DEFAULT NULL;
ALTER TABLE `subscribers`
ADD COLUMN update_time int(11) DEFAULT NULL;
ALTER TABLE `subscribers` DROP INDEX telegramID;
# was UNIQUE (telegramID)
ALTER TABLE `subscribers`
ADD UNIQUE userID (userID);
COMMIT;
ALTER TABLE services
ADD COLUMN description varchar(200) COLLATE utf8_czech_ci NOT NULL;
ALTER TABLE services
ADD COLUMN group_id int(11) DEFAULT NULL;
COMMIT;

View File

@ -1,60 +1,65 @@
(function(){
$("#time_input").flatpickr({enableTime:true, minDate: "today",time_24hr:true, onChange: function(date, dateStr, instance) {
$("#time_input_js").val(date[0].toISOString());
}});
$("#end_time").flatpickr({enableTime:true, minDate: "today",time_24hr:true, onChange: function(date, dateStr, instance) {
$("#end_time_js").val(date[0].toISOString()); // iso date str
}});
(function () {
$("#time_input").flatpickr({
enableTime: true,
minDate: "today",
time_24hr: true,
onChange: function (date, dateStr, instance) {
$("#time_input_js").val(date[0].toISOString());
},
});
$("#end_time").flatpickr({
enableTime: true,
minDate: "today",
time_24hr: true,
onChange: function (date, dateStr, instance) {
$("#end_time_js").val(date[0].toISOString()); // iso date str
},
});
var colore = ["danger", "warning", "primary", "success"];
var icons = ["fa fa-times", "fa fa-exclamation", "fa fa-info", "fa fa-check"];
var classes = ["panel panel-danger", "panel panel-warning", "panel panel-primary", "panel panel-success"];
var icons = ["fa fa-times", "fa fa-exclamation", "fa fa-info", "fa fa-check"];
$("body").on("change", "#new-incident select", function () {
var val = parseInt($(this).val()); //this should make exploitation harder
$("body").on("change","#new-incident select", function(){
var val = parseInt($(this).val()); //this should make exploitation harder
$("#new-incident .card.new .card-colore i").get(0).className = icons[val];
$("#new-incident .card.new .icon").get(0).className = "card-colore icon bg-" + colore[val];
$("#new-incident .card.new").get(0).className = "card border-" + colore[val] + " new";
$("#new-incident .card.new .card-header").get(0).className = "card-colore card-header bg-" + colore[val] + " border-" + colore[val];
$("#new-incident .card-colore.btn").get(0).className = "card-colore btn btn-" + colore[val];
$("#time_input").val("");
$("#end_time").val("");
});
$("#new-incident .panel.new .panel-heading i").get(0).className = icons[val];
$("#new-incident .panel.new").get(0).className = classes[val] + " new";
$("#time_input").val("");
$("#end_time").val("");
});
$("#new-incident select").trigger("change");
$("#new-incident select").trigger("change");
$("body").on("submit", "#new-incident", function () {
var time = Date.parse($("#time_input").val());
var end_time = Date.parse($("#end_time").val());
var type = $("#type").val() || 0;
$("body").on("submit","#new-incident",function(){
var time = Date.parse($("#time_input").val());
var end_time = Date.parse($("#end_time").val());
var type = $("#type").val() || 0;
if (parseInt(type) === 2 && (isNaN(time) || isNaN(end_time))) {
if (isNaN(end_time)) {
$("#time_input").addClass("error");
$.growl.error({ message: "Start time is invalid!" });
}
if (parseInt(type) === 2 &&(isNaN(time) || isNaN(end_time)))
{
if (isNaN(end_time))
{
$("#time_input").addClass("error");
$.growl.error({ message: "Start time is invalid!" });
}
if (isNaN(end_time))
{
$("#end_time").addClass("error");
$.growl.error({ message: "End time is invalid!" });
}
return false;
}
else if (parseInt(type) === 2 && time >= end_time)
{
$.growl.error({ message: "End time is either the same or earlier than start time!" });
$("#time").addClass("error");
$("#end_time").addClass("error");
return false;
}
if (isNaN(end_time)) {
$("#end_time").addClass("error");
$.growl.error({ message: "End time is invalid!" });
}
return false;
} else if (parseInt(type) === 2 && time >= end_time) {
$.growl.error({ message: "End time is either the same or earlier than start time!" });
$("#time").addClass("error");
$("#end_time").addClass("error");
return false;
}
if($("#status-container :checkbox:checked").length === 0)
{
$.growl.error({ message: "Please check at least one service!" });
$("#status-container").addClass("error");
return false;
}
});
if ($("#status-container :checkbox:checked").length === 0) {
$.growl.error({ message: "Please check at least one service!" });
$("#status-container").addClass("error");
return false;
}
});
})();

View File

@ -1,32 +1,62 @@
function timeago()
{
$("time.timeago").timeago();
$("time.timeago").each(function(){
var date = new Date($(this).attr("datetime"));
$(this).attr("title",date.toLocaleString());
});
function timeago() {
$("time.timeago").timeago();
$("time.timeago").each(function () {
var date = new Date($(this).attr("datetime"));
$(this).attr("title", date.toLocaleString());
});
}
(function(){
jQuery.timeago.settings.allowFuture = true;
(function () {
jQuery.timeago.settings.allowFuture = true;
timeago();
$("body").on("click", ".navbar-toggle", function(){
$($(this).data("target")).toggleClass("collapse");
});
var incidents = $('.timeline');
$("body").on("click", "#loadmore", function(e){
e.preventDefault();
var url = $("#loadmore").attr("href") + "&ajax=true";
$("#loadmore").remove();
$.get(url,
function(data){
incidents.append(data);
timeago();
});
});
})();
timeago();
$("body").on("click", ".navbar-toggle", function () {
$($(this).data("target")).toggleClass("collapse");
});
var incidents = $(".timeline");
$("body").on("click", "#loadmore", function (e) {
e.preventDefault();
var url = $("#loadmore").attr("href") + "&ajax=true";
$("#loadmore").remove();
$.get(url, function (data) {
incidents.append(data);
timeago();
});
});
})();
var darkSwitch = document.getElementById("darkSwitch");
window.addEventListener("load", function () {
if (darkSwitch) {
initTheme();
darkSwitch.addEventListener("change", function () {
resetTheme();
});
}
});
function initTheme() {
var darkThemeSelected = localStorage.getItem("darkSwitch") !== null && localStorage.getItem("darkSwitch") === "dark";
darkSwitch.checked = darkThemeSelected;
darkThemeSelected ? document.body.setAttribute("data-theme", "dark") : document.body.removeAttribute("data-theme");
}
function resetTheme() {
if (darkSwitch.checked) {
document.body.setAttribute("data-theme", "dark");
localStorage.setItem("darkSwitch", "dark");
} else {
document.body.removeAttribute("data-theme");
localStorage.removeItem("darkSwitch");
}
}
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.body.setAttribute("data-theme", "dark");
}
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
const newColorScheme = e.matches ? document.body.setAttribute("data-theme", "dark") : document.body.removeAttribute("data-theme");
});

File diff suppressed because one or more lines are too long

View File

@ -1,48 +1,53 @@
<?php
require_once("template.php");
require_once("config.php");
Template::render_header("Privacy Policy");
require_once("config.php");
require_once("template.php");
require_once("classes/constellation.php");
require_once("classes/db-class.php");
$db = new SSDB();
define("WEB_URL", $db->getSetting($mysqli, "url"));
echo "<h1>" . _("Privacy Policy") . "</h1>";
echo "<h2>" . _("Who we are") . "</h2>";
echo WHO_WE_ARE;
echo "<h2>" . _("Contact") . "</h2>";
echo POLICY_NAME . "<br>";
echo ADDRESS . "<br>";
echo POLICY_MAIL . "<br>";
if(defined('POLICY_PHONE') && POLICY_PHONE != ""){
echo POLICY_PHONE . "<br>";
}
Template::render_header("Privacy Policy", "privacy");
echo '<h2>' . _("What personal data we collect and why") . '</h2>';
echo '<h3>' . _("General") . "</h3>";
echo _("If you access our websites, the following information will be saved: IP-address, Date, Time, Browser queries,
echo "<h1>" . _("Privacy Policy") . "</h1>";
echo "<h2>" . _("Who we are") . "</h2>";
echo WHO_WE_ARE;
echo "<h2>" . _("Contact") . "</h2>";
echo POLICY_NAME . "<br>";
echo ADDRESS . "<br>";
echo POLICY_MAIL . "<br>";
if (defined('POLICY_PHONE') && POLICY_PHONE != "") {
echo POLICY_PHONE . "<br>";
}
echo '<h2>' . _("What personal data we collect and why") . '</h2>';
echo '<h3>' . _("General") . "</h3>";
echo _("If you access our websites, the following information will be saved: IP-address, Date, Time, Browser queries,
General information about your browser, operating system and all search queries on the sites.
This user data will be used for anonym user statistics to recognize trends and improve our content.
") . "<br>";
echo '<h3>' . _("Telegram") . "</h3>";
echo _("If you use the Telegram Login Widget (The blue \"Login with Telegram\" button), we recive the following data from the service \"Telegram\" (<a href=\"https://telegram.org\">telegram.org</a>):");
echo '<ul>
echo '<h3>' . _("Telegram") . "</h3>";
echo _("If you use the Telegram Login Widget (The blue \"Login with Telegram\" button), we recive the following data from the service \"Telegram\" (<a href=\"https://telegram.org\">telegram.org</a>):");
echo '<ul>
<li>' . _("Your Telegram-User-ID") . "</li>
<li>" . _("Your Telegram username") . '</li>
<li>' . _("The name you provided when registering with Telegram.") . '</li>
<li>' . _("Your telegram profile picture") . '</li>
</ul>';
echo _("Although we are receiving this data, we only save your telegram ID, your telegram username and the first and last name you provided telegram when registred for their service.");
echo _("We are saving this data, to provide a subscription service which alerts you about status update via our telegram bot. With this data we know who we need to send the alert to. Also we know your name, so we can say hi to you.");
echo _("Because of this, we also save who has subscribed which service.");
echo "<h2>" . _("How we protect your data") . "</h2>";
echo _("In collaboration with our hosting provider we try our best to protect our
echo _("Although we are receiving this data, we only save your telegram ID, your telegram username and the first and last name you provided telegram when registred for their service.");
echo _("We are saving this data, to provide a subscription service which alerts you about status update via our telegram bot. With this data we know who we need to send the alert to. Also we know your name, so we can say hi to you.");
echo _("Because of this, we also save who has subscribed which service.");
echo "<h2>" . _("How we protect your data") . "</h2>";
echo _("In collaboration with our hosting provider we try our best to protect our
databases against access from third parties, losses, misuse or forgery.
") . "<br><br>";
echo "<h2>" . _("Third party that receive your personal data") . "</h2>";
echo "Our hosting provider can access the date we store on their server. We have a data processing agreement with them.";
echo "<h3>" . _("Cookies") . "</h3>";
echo _("This site uses cookies small text files that are placed on your machine to help the site provide a better user experience.
echo "<h2>" . _("Third party that receive your personal data") . "</h2>";
echo "Our hosting provider can access the date we store on their server. We have a data processing agreement with them.";
echo "<h3>" . _("Cookies") . "</h3>";
echo _("This site uses cookies small text files that are placed on your machine to help the site provide a better user experience.
In general, cookies are used to retain user preferences, store information for things like shopping carts,
and provide anonymised tracking data to third party applications like Google Analytics.
As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others.
The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser
or taking a look at the About Cookies website which offers guidance for all modern browsers");
Template::render_footer();
Template::render_footer();

View File

@ -6,11 +6,11 @@ require_once("classes/subscriptions.php");
require_once("classes/telegram.php");
require_once("classes/db-class.php");
$db = new SSDB();
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"));
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"));
define("SUBSCRIBE_EMAIL", $db->getBooleanSetting($mysqli, "subscribe_email"));
define("SUBSCRIBE_TELEGRAM", $db->getBooleanSetting($mysqli, "subscribe_telegram"));
define("GOOGLE_RECAPTCHA", $db->getSetting($mysqli, "google_recaptcha"));
@ -22,36 +22,35 @@ define("TG_BOT_USERNAME", $db->getSetting($mysqli, "tg_bot_username"));
$subscription = new Subscriptions();
$telegram = new Telegram();
Template::render_header("Subscriptions");
Template::render_header("Subscriptions", "subscripe");
if ( SUBSCRIBE_TELEGRAM && $_SESSION['subscriber_typeid'] == 2 ) {
if (SUBSCRIBE_TELEGRAM && $_SESSION['subscriber_typeid'] == 2) {
$tg_user = $telegram->getTelegramUserData(); // TODO: Do we need this any longer?
}
if( $_SESSION['subscriber_valid'] ){
if ($_SESSION['subscriber_valid']) {
$typeID = $_SESSION['subscriber_typeid'];
$subscriberID = $_SESSION['subscriber_id'];
$userID = $_SESSION['subscriber_userid'];
$token = $_SESSION['subscriber_token'];
if(isset($_GET['add'])){
if (isset($_GET['add'])) {
$subscription->add($subscriberID, $_GET['add']);
}
if(isset($_GET['remove'])){
if (isset($_GET['remove'])) {
$subscription->remove($subscriberID, $_GET['remove']);
}
$subscription->render_subscribed_services($typeID, $subscriberID, $userID, $token);
} else {
$header = _("Your session has expired or you tried something we don't suppprt");
$message = _('If your session expired, retry your link or in case of Telegram use the login button in the top menu.');
$constellation->render_warning($header, $message);
header('Location: index.php');
header('Location: index.php');
}
Template::render_footer();

View File

@ -1,15 +1,14 @@
<?php
require_once ("config.php");
require_once ("classes/telegram.php");
require_once ("classes/subscriber.php");
require_once ("classes/db-class.php");
require_once("config.php");
require_once("classes/telegram.php");
require_once("classes/subscriber.php");
require_once("classes/db-class.php");
$db = new SSDB();
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"));
define("SUBSCRIBE_TELEGRAM", $db->getBooleanSetting($mysqli, "subscribe_telegram"));
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"));
define("SUBSCRIBE_TELEGRAM", $db->getBooleanSetting($mysqli, "subscribe_telegram"));
define("TG_BOT_API_TOKEN", $db->getSetting($mysqli, "tg_bot_api_token"));
define("TG_BOT_USERNAME", $db->getSetting($mysqli, "tg_bot_username"));

View File

@ -1,245 +1,244 @@
<?php
$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" );
$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");
$some = array(_("Some systems are experiencing major outages"), _("Some systems are experiencing minor outages"), _("Some systems are under maintenance"));
$all = array(_("Our systems are experiencing major outages."), _("Our systems are experiencing minor outages"), _("Our systems are under maintenance"), _("All systems operational"));
$permissions = array(_("Super admin"), _("Admin"), _("Editor"));
$visibility = array(_("Collapsed"), _("Expanded"), _("Expand on events"));
/**
* Class that encapsulates methods to render header and footer
*/
class Template{
* Class that encapsulates methods to render header and footer
*/
class Template
{
/**
* Renders header
* @param String $page_name name of the page to be displayed as title
* @param Boolean $admin decides whether to show admin menu
*/
public static function render_header($page_name, $admin = false){
if (!$admin)
{
// Create subscriber menu sections for later inclusion
// Check if we are on admin menu, if so do not display
$arr_url = explode("/", $_SERVER['PHP_SELF']);
$str_url = strtolower($arr_url[count($arr_url)-2]);
if ( 'admin' == $str_url ) {
$strSubsMenu = '';
} else {
if (SUBSCRIBE_EMAIL || SUBSCRIBE_TELEGRAM ) {
// Subscriber menu is to be shown...
$strSubsMenu = '<ul class="nav navbar-nav mr-auto">';
// If subscriber is not logged on, display subscriber menus
if ( (!isset($_SESSION['subscriber_valid'])) || false == $_SESSION['subscriber_valid'] ) {
$strSubsMenu .= '<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" href="#"><span class="glyphicon glyphicon-th"></span>&nbsp;'. _('Subscribe').'</a>
* Renders header
* @param String $page_name name of the page to be displayed as title
* @param Boolean $admin decides whether to show admin menu
*/
public static function render_header($page_name, $page_id, $admin = false)
{
if (!$admin) {
// Create subscriber menu sections for later inclusion
// Check if we are on admin menu, if so do not display
$arr_url = explode("/", $_SERVER['PHP_SELF']);
$str_url = strtolower($arr_url[count($arr_url) - 2]);
if ('admin' == $str_url) {
$strSubsMenu = '';
} else {
if ($SUBSCRIBE_EMAIL || $SUBSCRIBE_TELEGRAM) {
// Subscriber menu is to be shown...
$strSubsMenu = '<ul class="nav navbar-nav mr-auto">';
// If subscriber is not logged on, display subscriber menus
if ((!isset($_SESSION['subscriber_valid'])) || false == $_SESSION['subscriber_valid']) {
$strSubsMenu .= '<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" href="#"><span class="glyphicon glyphicon-th"></span>&nbsp;' . _('Subscribe') . '</a>
<ul class="dropdown-menu ">';
if ( SUBSCRIBE_EMAIL ) {
$strSubsMenu .= '<li><a href="?do=email_subscription&amp;new=1"><span class="glyphicon glyphicon-envelope"></span>&nbsp;'._('Subscribe via email').'</a></li>';
}
if ( SUBSCRIBE_TELEGRAM ) {
$strSubsMenu .= '<li><a href="#"><script async src="https://telegram.org/js/telegram-widget.js?4" data-telegram-login="'.TG_BOT_USERNAME.'" data-size="small" data-userpic="false" data-auth-url="'.WEB_URL.'/telegram_check.php" data-request-access="write"></script></a></li>';
}
$strSubsMenu .= '</ul>';
}
}
// If subscriber is logged on, display unsub and logoff menu points
if ( (isset($_SESSION['subscriber_valid'])) && $_SESSION['subscriber_valid'] ) {
$strSubsMenu .= '<li><a href="?do=subscriptions">'._('Subscriptions').'</a></li>';
$strSubsMenu .= '<li><a href="'.WEB_URL.'/index.php?subscriber_logout=1">'._('Logout').'</a></li>';
}
$strSubsMenu .= '</ul>';
}
?>
<!doctype html>
<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"));
if ($SUBSCRIBE_EMAIL) {
$strSubsMenu .= '<li><a href="?do=email_subscription&amp;new=1"><span class="glyphicon glyphicon-envelope"></span>&nbsp;' . _('Subscribe via email') . '</a></li>';
}
if ($SUBSCRIBE_TELEGRAM) {
$strSubsMenu .= '<li><a href="#"><script async src="https://telegram.org/js/telegram-widget.js?4" data-telegram-login="' . $TG_BOT_USERNAME . '" data-size="small" data-userpic="false" data-auth-url="' . WEB_URL . '/telegram_check.php" data-request-access="write"></script></a></li>';
}
$strSubsMenu .= '</ul>';
}
}
// If subscriber is logged on, display unsub and logoff menu points
if ((isset($_SESSION['subscriber_valid'])) && $_SESSION['subscriber_valid']) {
$strSubsMenu .= '<li><a href="?do=subscriptions">' . _('Subscriptions') . '</a></li>';
$strSubsMenu .= '<li><a href="' . WEB_URL . '/index.php?subscriber_logout=1">' . _('Logout') . '</a></li>';
}
$strSubsMenu .= '</ul>';
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $page_name . " - " . NAME ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Current service status for <?php echo NAME; ?> can be found here as well as incident history.">
<link rel="shortcut icon" href="<?php echo WEB_URL; ?>/favicon.ico" type="image/png">
<link rel="stylesheet" href="<?php echo WEB_URL; ?>/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo WEB_URL; ?>/css/main.css" media="screen">
<link rel="stylesheet" href="<?php echo WEB_URL; ?>/css/print.css" media="print">
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL; ?>/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL; ?>/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL; ?>/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_URL; ?>/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_URL; ?>/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_URL; ?>/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_URL; ?>/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_URL; ?>/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_URL; ?>/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo WEB_URL; ?>/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo WEB_URL; ?>/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo WEB_URL; ?>/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo WEB_URL; ?>/favicon/favicon-16x16.png">
<link rel="manifest" href="<?php echo WEB_URL; ?>/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="https://use.fontawesome.com/releases/v5.15.2/css/all.css" rel="stylesheet">
<?php
if (!$admin) {
$headpath = $_SERVER['DOCUMENT_ROOT'] . "/head.txt";
$headfile = fopen("$headpath", "r") or die("Unable to open head.txt!");
$head_additionalcode = fread($headfile, filesize($headpath));
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">
<meta name="description" content="Current service status for <?php echo NAME;?> can be found here as well as incident history.">
<link rel="shortcut icon" href="<?php echo WEB_URL;?>/favicon.ico" type="image/png">
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css" media="screen">
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/print.css" media="print">
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_URL;?>/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_URL;?>/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_URL;?>/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_URL;?>/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_URL;?>/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_URL;?>/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo WEB_URL;?>/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo WEB_URL;?>/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo WEB_URL;?>/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo WEB_URL;?>/favicon/favicon-16x16.png">
<link rel="manifest" href="<?php echo WEB_URL;?>/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?php echo _("Toggle navigation");?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo WEB_URL;?>"><a class="navbar-brand" href="<?php echo WEB_URL;?>/admin"><img src="<?php if(strlen(CUSTOM_LOGO_URL)>1){ echo CUSTOM_LOGO_URL; } else { echo WEB_URL."/img/logo_white.png"; } ?>" alt="logo" class="menu-logo" style="height:50px;"></a>
</div>
<div class="navbar-left hidden-xs">
<ul class="nav navbar-nav">
<li><a href="<?php echo WEB_URL;?>/"><h1><?php echo _((defined('TITLE')?TITLE:"Service Status"));?></h1></a></li>
</ul>
</div>
<div class="navbar-collapse collapse navbar-right navbar-admin">
<?php echo $strSubsMenu; ?>
</div><!--/.nav-collapse -->
</div>
</div>
<div id="wrapper" class="center">
<?php
}else{
} else {
global $user;
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $page_name." - ".NAME ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<?php echo WEB_URL;?>/favicon.ico" type="image/png">
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css">
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_URL;?>/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_URL;?>/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_URL;?>/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_URL;?>/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_URL;?>/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_URL;?>/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo WEB_URL;?>/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo WEB_URL;?>/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo WEB_URL;?>/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo WEB_URL;?>/favicon/favicon-16x16.png">
<link rel="manifest" href="<?php echo WEB_URL;?>/favicon/manifest.json">
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
<link href="<?php echo WEB_URL;?>/css/jquery.growl.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
</head>
<body class="admin">
<div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?php echo _("Toggle navigation");?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo WEB_URL;?>/admin"><img src="<?php if(strlen(CUSTOM_LOGO_URL)>1){ echo CUSTOM_LOGO_URL; } else { echo WEB_URL."/img/logo_white.png"; } ?>" alt="logo" class="menu-logo" width="50" height="50"></a>
</div>
<div class="navbar-collapse collapse navbar-right navbar-admin">
<ul class="nav navbar-nav">
<li><a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Dashboard");?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=user"><?php printf(_("User (%s)"), $user->get_username());?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=settings"><?php echo _("Services & Users");?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=options"><?php echo _("Options");?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=logout"><?php echo _("Logout");?></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div id="wrapper" class="center admin">
?>
<link rel="stylesheet" href="<?php echo WEB_URL; ?>/vendor/flatpickr/flatpickr.min.css">
<?php
}
}
/**
* 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){
?>
<div>
<h3><?php echo $toggletext; ?></h3>
<label class="switch">
<input type="checkbox" name="<?php echo $input_name; ?>" <?php if($checked){ echo "checked"; } ?> >
<span class="slider round"></span>
</label>
</div>
<?php
}
/**
* Renders footer
* @param Boolean $admin decides whether to load admin scripts
*/
public static function render_footer($admin = false)
{
global $negotiator;
$lang_names = $negotiator->get_accepted_langs();
?>
</div>
<div id="footerwrap">
<div class="container">
<div class="row centered">
<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>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only"><?php echo _("Toggle Dropdown");?></span>
}
?>
</head>
<body>
<header class="fixed-top">
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="<?php echo WEB_URL; ?>/"><img src="<?php if (strlen(CUSTOM_LOGO_URL) > 1) {
echo CUSTOM_LOGO_URL;
} else {
echo WEB_URL . "/img/logo_white.png";
} ?>" alt="logo" class="menu-logo" width="50" height="50"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="dropdown-menu">
<?php
foreach ($lang_names as $key => $value) {
echo '<a href="?lang='.$key.'"><img src="'.WEB_URL.'/locale/'.$key.'/flag.png" alt="'.$value.'">'.$value.'</a>';
}
?>
<hr role="separator" class="divider">
<a href="https://poeditor.com/join/project/37SpmJtyOm"><?php echo _("Help with translation!");?></a>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<?php
if (!$admin) {
?>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/"><?php echo _("Admin"); ?></a>
</li>
<li class="d-flex">
<input type="checkbox" class="custom-control-input" id="darkSwitch" hidden>
<label class="nav-link" for="darkSwitch"><i class="fas fa-moon"></i></label>
</li>
<li class="nav-item">
<?php echo $strSubsMenu; ?>
</li>
<?php
} else {
global $user;
?>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/"><?php echo _("Dashboard"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/?do=user"><?php printf(_("User (%s)"), $user->get_username()); ?></a>
</li>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/?do=settings"><?php echo _("Services & Users"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/?do=options"><?php echo _("Options"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link link-light" href="<?php echo WEB_URL; ?>/admin/?do=logout"><?php echo _("Logout"); ?></a>
</li>
<li class="d-flex">
<input type="checkbox" class="custom-control-input" id="darkSwitch" hidden>
<label class="nav-link" for="darkSwitch"><i class="fas fa-moon"></i></label>
</li>
<?php
}
?>
</ul>
</div>
</div>
</nav>
</div>
</header>
<main id="<?php echo $page_id; ?>" class="container <?php if ($admin) { ?>admin<?php } ?>">
<?php if ($admin) {
global $user;
}
}
/**
* 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)
{
?>
<div id="switch">
<label class="switch">
<input type="checkbox" name="<?php echo $input_name; ?>" <?php if ($checked) {
echo "checked";
} ?>>
<span class="slider round"></span>
</label>
<?php echo $toggletext; ?>
</div>
<?php
}
/**
* Renders footer
* @param Boolean $admin decides whether to load admin scripts
*/
public static function render_footer($admin = false)
{
global $negotiator;
$lang_names = $negotiator->get_accepted_langs();
?>
</main>
<footer id="footerwrap" class="sticky-bottom">
<div class="container">
<div class="row centered">
<div class="col-md-4 text-left"><a class="link-light" href="https://github.com/server-status-project/server-status/graphs/contributors" target=”_blank” rel=”noopener noreferrer”>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="input-group dropup mb-3">
<button type="button" class="btn btn-primary" disabled><?php echo '<img src="' . $WEB_URL . '/locale/' . $_SESSION['locale'] . '/flag.png" alt="' . $lang_names[$_SESSION['locale']] . '">' . $lang_names[$_SESSION['locale']]; ?></button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
<span class="visually-hidden"><?php echo _("Toggle Dropdown"); ?></span>
</button>
<ul class="dropdown-menu">
<?php
foreach ($lang_names as $key => $value) {
echo '<a href="?lang=' . $key . '"><img src="' . $WEB_URL . '/locale/' . $key . '/flag.png" alt="' . $value . '">' . $value . '</a>';
}
?>
<li>
<hr class="dropdown-divider">
</li>
<li><a href="https://poeditor.com/join/project/37SpmJtyOm" target=”_blank” rel=”noopener noreferrer”><?php echo _("Help with translation!"); ?></a></li>
</ul>
</div>
</div>
<div class="col-md-4 text-right"><a class="link-light" href="<?php echo IMPRINT_URL; ?>"><?php echo _("Imprint"); ?></a><a class="link-light" href="<?php echo POLICY_URL; ?>"><?php echo _("Privacy Policy"); ?></a></div>
</div>
<div class="col-md-4 text-right"><a href="<?php echo POLICY_URL; ?>"><?php echo _("Imprint & Privacy Policy");?></a><!-- <a href="https://github.com/Pryx/server-status/" target="_blank"><i class="fab fa-github" aria-hidden="true"></i></a> --></div>
</div><!--/row -->
</div><!--/container -->
</div>
<script src="<?php echo WEB_URL;?>/js/vendor/jquery-3.5.1.min.js"></script>
<script src="<?php echo WEB_URL;?>/js/vendor/jquery.timeago.js"></script>
<script src="<?php echo WEB_URL;?>/locale/<?php echo $_SESSION['locale'];?>/jquery.timeago.js"></script>
<?php if ($admin){?>
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script src="<?php echo WEB_URL;?>/js/admin.js"></script>
<script src="<?php echo WEB_URL;?>/js/vendor/jquery.growl.js"></script>
<?php }?>
<script src="<?php echo WEB_URL;?>/js/vendor/bootstrap.min.js"></script>
<script src="<?php echo WEB_URL;?>/js/main.js"></script>
<?php if ( GOOGLE_RECAPTCHA ) { ?><script src='https://www.google.com/recaptcha/api.js'></script><?php }?>
</body>
</html>
<!--/row -->
</div>
<!--/container -->
</footer>
<script src="<?php echo WEB_URL; ?>/vendor/jquerry/jquery-3.6.0.min.js"></script>
<script src="<?php echo WEB_URL; ?>/vendor/jquerry/jquery.timeago.js"></script>
<script src="<?php echo WEB_URL; ?>/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="<?php echo WEB_URL; ?>/js/main.js"></script>
<?php if ($admin) { ?>
<script src="<?php echo WEB_URL; ?>/vendor/flatpickr/flatpickr.min.js"></script>
<script src="<?php echo WEB_URL; ?>/js/admin.js"></script>
<?php } ?>
<?php if ($GOOGLE_RECAPTCHA) { ?><script src='https://www.google.com/recaptcha/api.js'></script><?php } ?>
</body>
</html>
<?php
}
}
}
}

4997
vendor/bootstrap/css/bootstrap-grid.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,428 @@
/*!
* Bootstrap Reboot v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
[tabindex="-1"]:focus:not(:focus-visible) {
outline: 0 !important;
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,425 @@
/*!
* Bootstrap Reboot v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
[tabindex="-1"]:focus:not(:focus-visible) {
outline: 0 !important;
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10724
vendor/bootstrap/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10700
vendor/bootstrap/css/bootstrap.rtl.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6650
vendor/bootstrap/js/bootstrap.bundle.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4904
vendor/bootstrap/js/bootstrap.esm.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4951
vendor/bootstrap/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
vendor/bootstrap/js/bootstrap.js.map vendored Normal file

File diff suppressed because one or more lines are too long

7
vendor/bootstrap/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13
vendor/flatpickr/flatpickr.min.css vendored Normal file

File diff suppressed because one or more lines are too long

2
vendor/flatpickr/flatpickr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
vendor/jquerry/jquery-3.6.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long