Ejemplo n.º 1
0
if (!isset($_SESSION['username'])) {
    gohome();
}
// are you in the correct group?
if ($_SESSION['role_id'] < 1) {
    errormsg('Your role does not have access to this resource');
} else {
    // row count
    $tablerows = 0;
    // get all hosts
    $query = "SELECT host_id,host_name,host_alias,host_state,host_key FROM hosts ORDER BY host_name";
    $stmt = $mysqli->prepare($query);
    $stmt->execute();
    $stmt->store_result();
    if ($stmt->num_rows > 0) {
        $table = new Jacopo\Bootstrap3Table\BootstrapTable();
        $table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true));
        $table->setHeader(array("Host Name", "Alias", "State", "Actions"));
        // output data of each row
        $stmt->bind_result($host_id, $host_name, $host_alias, $host_state, $host_key);
        while ($stmt->fetch()) {
            // check the state
            if ($host_state == "new") {
                $state = "<p class='text-info'>New <a href=" . SITE_URL . "/?api=" . $host_key . "&do=hostsetup>(install)</a></p>";
            }
            if ($host_state == "online") {
                $state = "<p class='text-success'>Online</p>";
            }
            if (strpos($host_state, "provision") !== false) {
                $state = "<p class='text-info'>Provisioning <a href=" . SITE_URL . "/?api=" . $host_key . "&do=hostsetup>(progress)</a></p>";
            }
Ejemplo n.º 2
0
// are you in the correct group?
if ($_SESSION['role_id'] < 2) {
    errormsg('Your role does not have access to this resource');
} else {
    if (isset($_POST['ruleset_id']) && get_ruleset_rule_array($_POST['ruleset_id'], $mysqli)) {
        if (delete_msrule($_POST['ruleset_id'], $mysqli)) {
            if (edit_configchanged("true", $mysqli)) {
                echo "\n\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\t\n\t\t\t\t\t" . quickalert("success", "The selected rule has been removed from the database.") . "\n\t\t\t\t\t\n\t\t\t\t<!-- End Content Division -->\n\t\t\t\t</div>\n\t\t\t\t";
            } else {
                errormsg("Failed to change config modify status to 'true'");
            }
        } else {
            errormsg("Failed to delete record from the database");
        }
    } elseif (!$_POST) {
        if (isset($_GET['id'])) {
            if (get_ruleset_rule_array($_GET['id'], $mysqli)) {
                $array = get_ruleset_rule_array($_GET['id'], $mysqli);
                $table = new Jacopo\Bootstrap3Table\BootstrapTable();
                $table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true));
                $table->setHeader(array("Sequence", "Rule", "Ruleset"));
                $table->addRows($array);
            }
        } else {
            errormsg("no rule found or requested");
        }
        echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=delete&object=msrule' method='post' name='delete_msrule'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Delete Ruleset Rule</legend>\n\t\t\t\t\n\t\t\t\t" . $table->getHtml() . "\n\t\t\t\t\n\t\t\t\t<input type='hidden' name='ruleset_id' value='" . $_GET['id'] . "'>\n\t\t\t\t\n\t\t</div>\n\t\t\n\t\t<div class='form-group'>\n\t\t\t<label class='col-md-4 control-label' for='singlebutton'></label>\n\t\t\t<div class='col-md-4'>\n\t\t\t\t<button id='singlebutton' name='singlebutton' class='btn danger large' type='submit'><span class='glyphicon glyphicon-remove-sign' id='logIcon'></span> Delete </button>\n\t\t\t</div>\n\t\t</div>\n\t\t";
    } else {
        errormsg('POST error. Possible missing input.');
    }
}
Ejemplo n.º 3
0
function get_message_table($count, $mailwatchdb)
{
    // create table
    $table = new Jacopo\Bootstrap3Table\BootstrapTable();
    $table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true));
    $table->setHeader(array("id", "timestamp", "from_address", "to_address", "subject", "sascore"));
    $query = "(SELECT id,timestamp,from_address,to_address,subject,sascore FROM maillog ORDER BY timestamp DESC LIMIT ?) ORDER BY timestamp ASC";
    if ($stmt = $mailwatchdb->prepare($query)) {
        $stmt->bind_param('i', $count);
        $stmt->execute();
        $stmt->store_result();
        if ($stmt->num_rows > 0) {
            $stmt->bind_result($id, $timestamp, $from_address, $to_address, $subject, $sascore);
            while ($row = $stmt->fetch()) {
                $table->addRows("<a href=" . SITE_URL . "/?do=list&object=message&id=" . $id . ">" . $id . "</a>", $timestamp, $from_address, $to_address, $subject, $sascore);
            }
            return $table->getHtml();
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Ejemplo n.º 4
0
     }
     // free result set
     $stmt->close();
     if ($tablerows > 0) {
         echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Rules in ruleset '" . get_ruleset_option_by_value($fullruleset, $mysqli) . "'</h2>\n\t\t\t<p>\n\t\t\t\t<a class='btn success' href=" . SITE_URL . "/?do=create&object=msrule&ruleset=" . $ruleset . "><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a> \n\t\t\t\t<a class='btn info' href=https://www.mailscanner.info/MailScanner.conf.index.html#" . rawurlencode($option) . " target=_blank><span class='glyphicon glyphicon-info-sign id='logIcon'></span> Info </a>\n\t\t\t<p>\n\t\t\t" . $table->getHtml() . "\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t";
     }
 } else {
     // row count
     $tablerows = 0;
     // get all rulesets
     $query = "SELECT `option`,SUBSTRING_INDEX(value, '.', 1) AS value FROM ms_config WHERE NOT host='confserialnumber' ORDER BY `option`";
     $stmt = $mysqli->prepare($query);
     $stmt->execute();
     $stmt->store_result();
     if ($stmt->num_rows > 0) {
         $table = new Jacopo\Bootstrap3Table\BootstrapTable();
         $table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true));
         $table->setHeader(array("Ruleset", "# of Rules", "Actions"));
         // output data of each row
         $stmt->bind_result($option, $value);
         while ($stmt->fetch()) {
             // get rulecount
             $rulecount = get_ruleset_count($value, $mysqli);
             // create table row for each result
             $table_row = array("<a href=" . SITE_URL . "/?do=list&object=msrule&ruleset=" . $value . ">" . $option . "</a>", $rulecount, "<a href=" . SITE_URL . "/?do=create&object=msrule&ruleset=" . $value . "><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a>  \n\t\t\t\t\t<a href=https://www.mailscanner.info/MailScanner.conf.index.html#" . rawurlencode($option) . " target=_blank><span class='glyphicon glyphicon-info-sign id='logIcon'></span> Info </a>");
             $table->addRows($table_row);
             $tablerows++;
         }
     } else {
         //no rulesets!
         echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Rulesets</h2>\n\t\t\t<div class='alert alert-error'><p>There are currently no rulesets in the database</p></div>\n\t\t\t<p><a class='btn success' href=" . SITE_URL . "/?do=create&object=msrule&ruleset=" . $ruleset . "><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a><p>\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t";
Ejemplo n.º 5
0
<?php

include_once dirname(__FILE__) . "/../app/includes/db_connect.php";
include_once dirname(__FILE__) . "/../app/includes/functions.php";
$table = new Jacopo\Bootstrap3Table\BootstrapTable();
$table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true));
$table->setHeader(array("Config Revision", "Clients", "Domains", "Rulesets", "Rules"));
// get currnet confserialnumber
if ($stmt_confserialnumber = $mysqli->prepare("SELECT value FROM ms_config WHERE `option`='confserialnumber' AND `host`='confserialnumber'")) {
    $stmt_confserialnumber->execute();
    $stmt_confserialnumber->store_result();
    if ($stmt_confserialnumber->num_rows == 1) {
        // get variables from result.
        $stmt_confserialnumber->bind_result($confserialnumber);
        $stmt_confserialnumber->fetch();
    }
}
// get all clients
$query_clients = "SELECT client_id FROM clients";
if ($result_clients = $mysqli->query($query_clients)) {
    $clients = $result_clients->num_rows;
} else {
    $clients = 0;
}
// get all domains
$query_address = "SELECT address_id FROM addresses";
if ($result_address = $mysqli->query($query_address)) {
    $addresses = $result_address->num_rows;
} else {
    $addresses = 0;
}