[Web] Add quick actions handler for quarantine, add trigger

master
andryyy 2019-02-06 09:29:00 +01:00
parent e140979aac
commit 030d5068f3
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 76 additions and 0 deletions

View File

@ -10,6 +10,14 @@ if (isset($_POST["verify_tfa_login"])) {
} }
} }
if (isset($_POST["quick_release"])) {
quarantine('quick_release', $_POST["quick_release"]);
}
if (isset($_POST["quick_delete"])) {
quarantine('quick_delete', $_POST["quick_delete"]);
}
if (isset($_POST["login_user"]) && isset($_POST["pass_user"])) { if (isset($_POST["login_user"]) && isset($_POST["pass_user"])) {
$login_user = strtolower(trim($_POST["login_user"])); $login_user = strtolower(trim($_POST["login_user"]));
$as = check_login($login_user, $_POST["pass_user"]); $as = check_login($login_user, $_POST["pass_user"]);

View File

@ -0,0 +1,68 @@
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
if (preg_match("/^([a-f0-9]{64})$/", $_POST['quick_release']) || preg_match("/^([a-f0-9]{64})$/", $_POST['quick_delete'])) {
?>
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?= $lang['header']['quarantine']; ?></div>
<div class="panel-body">
<legend><?=(isset($_POST['quick_release'])) ? $lang['quarantine']['release'] : $lang['quarantine']['remove'];?></legend>
<p><?=$lang['quarantine']['qhandler_success'];?></p>
</div>
</div>
</div>
</div> <!-- /row -->
</div> <!-- /container -->
<?php
}
elseif (in_array($_GET['action'], array('release', 'delete'))) {
if (preg_match("/^([a-f0-9]{64})$/", $_GET['hash'])) {
if ($_GET['action'] == "release"):
?>
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?= $lang['header']['quarantine']; ?></div>
<div class="panel-body">
<legend><?=$lang['quarantine']['release'];?></legend>
<form method="post" autofill="off">
<div class="form-group">
<button type="submit" class="btn btn-success" name="quick_release" value="<?=$_GET['hash'];?>"><?= $lang['tfa']['confirm']; ?></button>
</div>
</form>
</div>
</div>
</div>
</div> <!-- /row -->
</div> <!-- /container -->
<?php
elseif ($_GET['action'] == "delete"):
?>
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?= $lang['header']['quarantine']; ?></div>
<div class="panel-body">
<legend><?=$lang['quarantine']['remove'];?></legend>
<form method="post" autofill="off">
<div class="form-group">
<button type="submit" class="btn btn-success" name="quick_delete" value="<?=$_GET['hash'];?>"><?= $lang['tfa']['confirm']; ?></button>
</div>
</form>
</div>
</div>
</div>
</div> <!-- /row -->
</div> <!-- /container -->
<?php
endif;
}
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
?>