adding application controll
This commit is contained in:
@@ -63,6 +63,21 @@ if(isset($_GET["rtp_excluded"])){
|
||||
}
|
||||
$stmt -> close();
|
||||
|
||||
}
|
||||
if(isset($_GET["dissalowed_start"])){
|
||||
echo(load_secret()."\n");
|
||||
//load all the entrys from a db table
|
||||
$sql = "SELECT path,id FROM dissalowed_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()){
|
||||
echo("\"".$row["path"]."\"\n");
|
||||
}
|
||||
$stmt -> close();
|
||||
|
||||
}
|
||||
if(isset($_GET["sched"])){
|
||||
echo(load_secret()."\n");
|
||||
|
||||
@@ -184,6 +184,23 @@
|
||||
Error creating table rtp_excluded: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create dissalowed_start table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS disalowed_start (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
path VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table disalowed_start created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table disalowed_start: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create api table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS api (
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user