mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2026-06-04 07:04:41 -04:00
files reformatted
for better readability
This commit is contained in:
+61
-67
@@ -1,93 +1,89 @@
|
||||
<?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);
|
||||
?>
|
||||
|
||||
<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="">
|
||||
<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="">
|
||||
<div class="card">
|
||||
<?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
|
||||
} ?>
|
||||
<div id="status-container" class="">
|
||||
<?php
|
||||
if (isset($_POST['services']) && !is_array($_POST['services']))
|
||||
{
|
||||
$post_services = array($_POST['services']);
|
||||
}else{
|
||||
$post_services = array();
|
||||
}
|
||||
<?php
|
||||
if (isset($_POST['services']) && !is_array($_POST['services'])) {
|
||||
$post_services = array($_POST['services']);
|
||||
} else {
|
||||
$post_services = array();
|
||||
}
|
||||
|
||||
foreach($services as $service){
|
||||
?>
|
||||
<div class="input-group mb-3">
|
||||
<?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
|
||||
}
|
||||
?>
|
||||
foreach ($services as $service) {
|
||||
?>
|
||||
<div class="input-group mb-3">
|
||||
<?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>
|
||||
<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>
|
||||
<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']):''); ?>" 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" 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="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>
|
||||
<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");?>:
|
||||
<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']):''); ?>">
|
||||
<small><?php echo _("Posted by"); ?>: <?php echo $user->get_username(); ?></small>
|
||||
<span class="float-end" id="end_time_wrapper"><?php echo _("Ending"); ?>:
|
||||
<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']) : ''); ?>">
|
||||
<input id="end_time_js" name="end_time_js" type="hidden" class="pull-right">
|
||||
</span>
|
||||
</div>
|
||||
@@ -95,26 +91,24 @@ Template::render_header(_("Dashboard"), true);
|
||||
<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 class="btn btn-outline-secondary" type="submit"><?php echo _("Submit");?></button>
|
||||
<button class="btn btn-outline-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>
|
||||
</form>
|
||||
<?php
|
||||
$constellation->render_incidents(true, $offset, 5, true);
|
||||
$constellation->render_incidents(false, $offset, 5, true);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+36
-51
@@ -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);
|
||||
|
||||
+27
-27
@@ -1,32 +1,32 @@
|
||||
<?php
|
||||
Template::render_header(_("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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
<?php
|
||||
Template::render_footer();
|
||||
Template::render_footer();
|
||||
|
||||
+61
-68
@@ -1,72 +1,65 @@
|
||||
<?php
|
||||
Template::render_header(_("Lost password"));
|
||||
?>
|
||||
<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 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();
|
||||
|
||||
+23
-30
@@ -1,54 +1,47 @@
|
||||
<?php
|
||||
if (isset($_GET['new']))
|
||||
{
|
||||
<?php
|
||||
if (isset($_GET['new'])) {
|
||||
User::add();
|
||||
}
|
||||
|
||||
Template::render_header(_("New user"), 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 pull-right"><?php echo _("Submit"); ?></button>
|
||||
</form>
|
||||
+120
-117
@@ -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,96 @@ 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"), 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">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<?php Template::render_toggle("Notify Updates", "nu_toggle", $notifyUpdates_status); ?>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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>
|
||||
|
||||
<?php Template::render_toggle("Enable Email Subscription","email_subscription_toggle",$emailSubscription_status); ?>
|
||||
<?php Template::render_toggle("Enable Telegram Subscription","telegram_subscription_toggle",$telegramSubscription_status); ?>
|
||||
<?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="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">Telegram BOT API Token</span>
|
||||
</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; ?>">
|
||||
<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>
|
||||
|
||||
<?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>
|
||||
</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; ?>">
|
||||
<?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>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Host</span>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">PHPMailer SMTP Port</span>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">PHPMailer Username</span>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">PHPMailer Password</span>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<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>
|
||||
|
||||
<?php Template::render_toggle("Use Google reChaptcha for subscriber signup","google_rechaptcha_toggle",$google_rechaptcha_status); ?>
|
||||
<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; ?>">
|
||||
<?php Template::render_toggle("Use Google reChaptcha for subscriber signup", "google_rechaptcha_toggle", $google_rechaptcha_status); ?>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">Google reChaptcha Sitekey</span>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<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; ?>">
|
||||
<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 class="input-group-prepend">
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
|
||||
</form>
|
||||
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
|
||||
</form>
|
||||
+33
-44
@@ -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>
|
||||
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&new=group';
|
||||
|
||||
$form_url = WEB_URL . '/admin/?do=new-service-group&new=group';
|
||||
} else {
|
||||
Template::render_header(_("Edit service group"), true); ?>
|
||||
<div class="text-center">
|
||||
<h2><?php echo _("Edit service group");?></h2>
|
||||
<h2><?php echo _("Edit service group"); ?></h2>
|
||||
</div>
|
||||
<?php
|
||||
$form_url = WEB_URL .'/admin/?do=edit-service-group&edit&id='.$group_id;
|
||||
|
||||
<?php
|
||||
$form_url = WEB_URL . '/admin/?do=edit-service-group&edit&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&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 pull-right"><?php echo _("Submit"); ?></button>
|
||||
</form>
|
||||
+32
-40
@@ -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>
|
||||
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&new=service';
|
||||
$form_url = WEB_URL . '/admin/?do=new-service&new=service';
|
||||
} else {
|
||||
Template::render_header(_("New 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&edit&id='.$service_id;
|
||||
<?php
|
||||
$form_url = WEB_URL . '/admin/?do=edit-service&edit&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&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 pull-right"><?php echo _("Submit"); ?></button>
|
||||
</form>
|
||||
+78
-75
@@ -1,10 +1,8 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
@@ -15,97 +13,93 @@ Template::render_header(_("Settings"), true);
|
||||
<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>
|
||||
</form>
|
||||
<?php }?>
|
||||
<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>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<div class="table-responsive">
|
||||
<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><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>';
|
||||
}
|
||||
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>
|
||||
</form>
|
||||
<?php }?>
|
||||
<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>
|
||||
</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>
|
||||
<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())
|
||||
{
|
||||
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>";
|
||||
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>';
|
||||
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>
|
||||
@@ -113,29 +107,38 @@ if (isset($message)){
|
||||
|
||||
|
||||
<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 }?>
|
||||
<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>
|
||||
<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())
|
||||
{
|
||||
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>" . $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>
|
||||
</section>
|
||||
</section>
|
||||
+19
-27
@@ -1,44 +1,37 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
@@ -46,19 +39,18 @@ Template::render_header(_("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();
|
||||
|
||||
Reference in New Issue
Block a user