<?php

/**
 * @copyright 2024 Double Bastion LLC <www.doublebastion.com>
 *
 * @author Double Bastion LLC
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

define('ACCESSCONST', TRUE);

session_start();

if ($_SESSION['loggedtorspanel'] == true) {

require('db-connect.php');

?>

<!doctype html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Set Detections Directory</title>
    <meta name="description" content="Set Detections Directory">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="shortcut icon" type="image/png" href="images/favicon.png" />
    <link rel="stylesheet" href="assets/css/normalize.min.css">
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/css/themify-icons/themify-icons.css">
    <link rel="stylesheet" href="assets/css/cs-skin-elastic.css">
    <link rel="stylesheet" href="assets/css/style.css">

    <script type="text/javascript" src="assets/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="assets/js/jquery.min.js"></script>
    <script type="text/javascript" src="assets/js/popper.min.js"></script>
    <script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="assets/js/jquery.matchHeight.min.js"></script>
    <script type="text/javascript" src="assets/js/main.js"></script>
    <script type="text/javascript" src="assets/js/moment.min.js"></script>

    <script type="text/javascript" src="assets/js/settingsmenu.js"></script>
    <script type="text/javascript" src="assets/js/set-detections-dir.js"></script>

</head>

<body>

<?php include 'panels.php'; ?>

        <!-- Content -->

        <div class="content">

                <div class="pagetitle">ClamAV Detections Directory</div>

                <div class="col-lg-8">
                    <div class="card newpasscard">
                        <div class="card-header">Change ClamAV Detections Directory</div>
                        <div class="card-body card-block">
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="explanationtext">If the 'detections' directory where ClamAV stores the periodic scan results has been changed and is no
 longer the default "/srv/scripts/detections", you can set the new path and/or directory below and save it to the panel database so as to allow the panel to read the periodic scan results
 and display them on the Dashboard.</br></br>(Please note that ClamAV virus detections are of two kinds: 1. Detections made by periodic scanning triggered by a cron job, which
 are stored in the '/srv/scripts/detections' directory and are listed on the first section of the Dashboard; 2. Real-time detections which are made when an infected email arrives, when an
 infected file is uploaded to Nextcloud, or during an on-demand file/directory scan. The real-time detections are recorded in logs and they are listed in the periodic emails sent to the
 administrator by 'System Health and Security Probe'.)</div>
                                        <div class="input-group-addon"><i class="fa fa-folder-open"></i></div>
                                          <?php
                                             $detectionsdir = "SELECT id, detdir FROM detectionsdir WHERE id = 1";
                                             $detectresult = $mysqli->query($detectionsdir);
                                             $clamavdet = $detectresult->fetch_array();
                                             $clamavreportdir = $clamavdet[1];
                                          ?>
                                        <input type="text" id="currentdetdir" name="currentdetdir" class="form-control" placeholder="Enter the new ClamAV Detections Directory" value="<?php print_r($clamavreportdir); ?>" / >
                                    </div>
                                </div>
                                <span id="savenewdettext"></span>
                                <input type="button" id="savenewdetdir" value="Save New Directory" />
                        </div>
                    </div>
                </div>

<?php include 'about.php'; ?>

        </div>

        <!-- /.content -->

        <div class="clearfix"></div>

<?php include 'footer.php'; ?>

    </div>
    <!-- /#right-panel -->

    <script type="text/javascript">
        $("#settingsdroparea").show();
        $("#detectionsfolder").css('color', '#03A9F3');
    </script>

</body>
</html>

<?php

} else {

      header("Location: panel-login.php");
}

?>