Merge branch 'remastering' of https://gitea.steelants.cz/SH/PHP_SMART_HOME_V3 into remastering

This commit is contained in:
GamerClassN7 2020-10-31 14:34:07 +01:00
commit 1e9395f9e7
4 changed files with 51 additions and 40 deletions

View File

@ -4,9 +4,11 @@ error_reporting(E_ALL);
ini_set( 'display_errors','1');
//setup
parse_str($_SERVER['QUERY_STRING'], $params);
$urlSes = str_replace((!empty ($params['url']) ? $params['url'] : ""), "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI']));
session_set_cookie_params(
1209600,
str_replace('login', "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])),
$urlSes,
str_replace("/var/www/", "", $_SERVER['DOCUMENT_ROOT']),
true,
true

View File

@ -3,14 +3,26 @@ if (!empty ($_POST)){
if (
isset ($_POST['name']) &&
$_POST['name'] != '' &&
isset($_POST['actualStatus'])
!isset ($_POST['remove'])
) {
if ($_POST['actualStatus']) {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php");
} else {
if ($_POST['status'] == "true") {
if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php")) {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php");
}
} else {
if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php")) {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php");
}
}
header('Location: ./plugins');
die();
}
if (
isset ($_POST['name']) &&
$_POST['name'] != '' &&
isset ($_POST['remove'])
) {
//
}
}

View File

@ -1,6 +1,6 @@
<div class="col-12 col-md-6 col-xl-4 square-wrap">
<div class="rectangle-2">
<div class="square-content double <?php echo ($PLUGINSTATUS == 0 ? 'is-inactive' : ''); ?>" id="plugin-<?php echo $PLUGINID; ?>">
<div class="square-content double <?php echo ($PLUGINSTATUS == false ? 'is-inactive' : ''); ?>">
<div class="row">
<div class="col-1">
<h5 class="fa">
@ -10,10 +10,18 @@
</div>
<div class="row">
<div class="col">
<a class="button is-primary m-1" onClick="restartAutomation(<?php echo $PLUGINID; ?>);"><?php $LANGMNG->echo('b_restart')?></a>
<form method="post" action="">
<input type="hidden" name="name" value="<?php echo $PLUGINNAME; ?>"/>
<input type="hidden" name="status" value="<?php echo ($PLUGINSTATUS == false ? "true" : "false"); ?>"/>
<a class="button is-primary m-1" onclick="$(this).closest('form').submit();"><?php echo ($PLUGINSTATUS == false ? $LANGMNG->get('b_approve') : $LANGMNG->get('b_disable')); ?></a>
</form>
</div>
<div class="col">
<a class="button is-primary m-1" onClick="toggleAutomation(<?php echo $PLUGINID; ?>);"><?php $LANGMNG->echo('b_disable')?></a>
<form method="post" action="">
<input type="hidden" name="name" value="<?php echo $PLUGINNAME; ?>"/>
<input type="hidden" name="remove" value="1"/>
<a class="button is-primary m-1" onclick="$(this).closest('form').submit();"><?php $LANGMNG->echo('b_remove'); ?></a>
</form>
</div>
</div>
</div>

View File

@ -37,17 +37,6 @@
$partial->render();
?>
<div class="content">
<form method="post" action="">
<input type="hidden" name="name" value="<?php echo $plugin['name']; ?>"/>
<input type="hidden" name="actualStatus" value="<?php echo $plugin['status']; ?>"/>
<a onclick="$(this).closest('form').submit();">
<div class="panel box content <?php echo ($plugin['status'] ? '' : 'disabled '); ?>p-4">
<h5><?php echo $plugin['name']; ?></h5>
</div>
</a>
</form>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>