adding application controll

This commit is contained in:
jakani24
2024-05-10 11:24:44 +02:00
parent 7f0cb49f0a
commit ea13c6dc6a
34 changed files with 930 additions and 244 deletions

View File

@@ -24,6 +24,7 @@ $setting_communication_unsafe_tls = "not configured yet";
$setting_server_server_url="not configured yet";
$setting_rtp_folder_scan_status=0;
$setting_rtp_process_scan_status=0;
$setting_ac_status=0;
include "../../../config.php";
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD,$DB_DATABASE);
if ($conn->connect_error) {
@@ -138,6 +139,9 @@ load_settings();
<li class="nav-item">
<a class="nav-link" href="client_settings.php?show=task" id="task_tab">Task Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="client_settings.php?show=disalowed_start" id="task_tab">Task Settings</a>
</li>
</ul>
<div id="general" style="display:none">
@@ -466,6 +470,55 @@ load_settings();
</tbody>
</table>
</div>
<div id="disalowed_start" style="display:none">
<h4>Application control</h4>
<h7>AC: on/off</h7>
<div class="form-check form-switch">
<?php if($setting_ac_status=="true")
echo ("<input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"flexSwitchCheckDefault\" onclick=\"update_switch('flexSwitchCheckDefault','setting_ac_status')\" checked>");
else
echo ("<input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"flexSwitchCheckDefault\" onclick=\"update_switch('flexSwitchCheckDefault','setting_ac_status')\">");
?>
<label class="form-check-label" for="flexSwitchCheckDefault">Activate Application control (for this to work you must activate rpt process scan too!)</label>
</div>
<br>
<h7>Frolders from where no app is allowed to start:</h7>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Path</th>
<th scope="col">Add / Delete</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">000</th>
<td><input type="text" id="rtp_included" class="form-control" name="name"></td>
<td><button type="button" class="btn btn-primary" onclick="add_item('disalowed_start','disalowed_start','path');">Add</button></td>
</tr>
<?php
//load all the entrys from a db table
$sql = "SELECT path,id FROM disalowed_start ORDER BY id";
$stmt = $conn->prepare($sql);
// Execute the statement
$stmt->execute();
// Get the result
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()){
//print out the items
echo("<tr>");
echo("<th scope=\"row\">".$row["id"]."</th>");
echo("<td><input type=\"text\" id=\"disalowed_start".$row["id"]."\" class=\"form-control\" name=\"name\" value=\"".$row["path"]."\" oninput=\"update_textfield('disalowed_start".$row["id"]."','disalowed_start','".$row["id"]."');\"></td>");
echo("<td><button type=\"button\" class=\"btn btn-danger\" onclick=\"delete_item('disalowed_start',".$row["id"].");\">Delete</button></td>");
echo("</tr>");
}
$stmt -> close();
?>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -60,6 +60,12 @@ function safe_settings(){
$stmt->execute();
$stmt->close();
}
if($_GET["update"]=="setting_ac_status"){
$stmt = $conn->prepare("INSERT INTO settings (name,value) VALUES (?,?) ON DUPLICATE KEY UPDATE value = ?;");
$stmt->bind_param("sss",$name,$value,$value);
$stmt->execute();
$stmt->close();
}
if($_GET["update"]=="setting_rtp_folder_scan_status"){
$stmt = $conn->prepare("INSERT INTO settings (name,value) VALUES (?,?) ON DUPLICATE KEY UPDATE value = ?;");
$stmt->bind_param("sss",$name,$value,$value);
@@ -92,6 +98,13 @@ function safe_settings(){
$stmt->execute();
$stmt->close();
}
if($_GET["update"]=="disalowed_start"){
$id=htmlspecialchars($_GET["id"]);
$stmt = $conn->prepare("UPDATE disalowed_start set path= ? WHERE id=?");
$stmt->bind_param("si",$value,$id);
$stmt->execute();
$stmt->close();
}
if($_GET["update"]=="user_tasks"){
$id=htmlspecialchars($_GET["id"]);
$stmt = $conn->prepare("UPDATE user_tasks set task = ? WHERE id=?");
@@ -116,6 +129,7 @@ function load_settings(){
global $setting_rtp_folder_scan_status;
global $setting_rtp_process_scan_status;
global $setting_communication_unsafe_tls;
global $setting_ac_status;
include "../../../config.php";
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
if ($conn->connect_error) {
@@ -196,6 +210,18 @@ function load_settings(){
if($row!==null){
$setting_communication_unsafe_tls=$row["value"];
}
//get setting: setting_ac_status
$sql = "SELECT * FROM settings WHERE name = 'setting_ac_status'";
$stmt = $conn->prepare($sql);
// Execute the statement
$stmt->execute();
// Get the result
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row!==null){
$setting_ac_status=$row["value"];
}
$stmt -> close();
$conn -> close();
}