// 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.'); } }
$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>"; } // create table row for each result $table_row = array($host_name, $host_alias, $state, "<a href=" . SITE_URL . "/?do=delete&object=host&id=" . $host_id . "><span class='glyphicon glyphicon-remove-sign id='logIcon'></span> Delete </a>"); $table->addRows($table_row); $tablerows++; } } else { //no hosts! echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t<h2>Hosts</h2>\n\t\t<div class='alert alert-error'><p>There are currently no hosts in the database.</p></div>\n\t\t<p><a class='btn success' href=" . SITE_URL . "/?do=create&object=host><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a><p>\n\t\t<!-- End Content Division -->\n\t\t</div>\n\t\t"; } // free result set $stmt->close(); if ($tablerows > 0) { echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t<h2>Hosts</h2>\n\t\t<p><a class='btn success' href=" . SITE_URL . "/?do=create&object=client><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a><p>\n\t\t" . $table->getHtml() . "\n\t\t<!-- End Content Division -->\n\t\t</div>\n\t\t"; } }
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; } }