Commit 2bd2bc0a authored by Hugo Leisink's avatar Hugo Leisink

Release 1.1

parent 45558406
monitor (1.1) stable; urgency=low
* Support for failed login logging.
* Hostname selection in CMS per user.
* Improved XML output filter. Add JSON output filter.
* Reports use median instead of average.
* Database changes:
ALTER TABLE `webservers` CHANGE `ssl` `tls` TINYINT(1) NOT NULL;
ALTER TABLE `host_statistics` ADD `failed_logins` INT UNSIGNED NOT NULL AFTER `exploit_attempts`;
* Small bugfixes.
-- Hugo Leisink <hugo@leisink.net> Sun, 10 May 2015 09:47:41 +0200
monitor (1.0) stable; urgency=low
* Added script for sending daily reports.
......
......@@ -7,7 +7,7 @@
if ($this->model->update_hostnames($_POST["hostname"]) == false) {
$this->output->add_tag("result", "Error while updating hostname.");
} else {
$this->output->add_tag("result", "Hostnames have been updated.", array("url" => "admin"));
$this->output->add_tag("result", "Hostnames have been updated.");
}
} else {
/* Show hostname form
......
......@@ -17,7 +17,7 @@
$this->output->open_tag("webservers");
foreach ($webservers as $webserver) {
$webserver["ssl"] = show_boolean($webserver["ssl"]);
$webserver["tls"] = show_boolean($webserver["tls"]);
$webserver["active"] = show_boolean($webserver["active"]);
$this->output->record($webserver, "webserver");
}
......@@ -33,9 +33,11 @@
return;
}
$this->output->add_javascript("admin/webserver.js");
$this->output->open_tag("edit");
$webserver["ssl"] = show_boolean($webserver["ssl"]);
$webserver["tls"] = show_boolean($webserver["tls"]);
$webserver["active"] = show_boolean($webserver["active"]);
if (is_array($webserver["users"]) == false) {
$webserver["users"] = array();
......@@ -101,7 +103,7 @@
} else if ($this->page->pathinfo[2] === "new") {
/* New webserver
*/
$webserver = array("active" => true);
$webserver = array("active" => true, "port" => "80");
$this->show_webserver_form($webserver);
} else if (valid_input($this->page->pathinfo[2], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
/* Edit webserver
......
<?php
class dashboard_controller extends controller {
public function execute() {
if (isset($_SESSION["latest_hiawatha_version"]) == false) {
$hiawatha_website = new HTTPS("www.hiawatha-webserver.org");
if (($result = $hiawatha_website->GET("/latest")) !== false) {
$_SESSION["latest_hiawatha_version"] = $result["body"];
}
}
/* Webserver
*/
if (($webservers = $this->model->get_webservers()) === false) {
......@@ -10,9 +17,9 @@
$webservers_offline = false;
foreach ($webservers as $webserver) {
$webserver["address"] = ($webserver["ssl"] == 0 ? "http" : "https") . "://".$webserver["ip_address"];
if ((($webserver["ssl"] == 0) && ($webserver["port"] != 80)) ||
(($webserver["ssl"] == 1) && ($webserver["port"] != 443))) {
$webserver["address"] = ($webserver["tls"] == 0 ? "http" : "https") . "://".$webserver["ip_address"];
if ((($webserver["tls"] == 0) && ($webserver["port"] != 80)) ||
(($webserver["tls"] == 1) && ($webserver["port"] != 443))) {
$webserver["address"] .= ":".$webserver["port"];
}
$webserver["address"] .= "/";
......@@ -26,9 +33,16 @@
}
}
$webserver["ssl"] = show_boolean($webserver["ssl"]);
$webserver["tls"] = show_boolean($webserver["tls"]);
$webserver["active"] = show_boolean($webserver["active"]);
if ($webserver["version"] != "") {
$parts = explode(",", $webserver["version"], 2);
list(, $version) = explode("v", $parts[0], 2);
$comparison = version_compare($version, $_SESSION["latest_hiawatha_version"], ">=");
$webserver["uptodate"] = show_boolean($comparison);
}
$this->output->record($webserver, "webserver");
}
......@@ -41,10 +55,11 @@
$timestamp = date("Y-m-d 00:00:00");
$alerts = array(
array("Top exploit attempts", "get_top_exploit_attempts", 0),
array("Top bad requests", "get_top_bad_requests", 0),
array("Top failed logins", "get_top_failed_logins", 0),
array("Top events", "get_top_events", 0),
array("Top exploit attempts", "get_top_exploit_attempts", 0),
array("Top CGI errors", "get_top_cgi_errors", 0),
array("Top bad requests", "get_top_bad_requests", 0),
array("Top bans", "get_top_bans", 3),
array("Top Not Founds", "get_top_not_founds", 5),
array("Top Internal Errors", "get_top_internal_errors", 1),
......
......@@ -7,6 +7,7 @@
$this->user->log_action("switched back to self");
$_SESSION["user_id"] = $_SESSION["user_switch"];
unset($_SESSION["user_switch"]);
unset($_SESSION["filter"]);
}
}
}
......
......@@ -2,6 +2,7 @@
class security_statistics_controller extends graph_controller {
protected $graphs = array(
"exploit_attempts" => "Exploit attempts",
"failed_logins" => "Failed logins",
"bans" => "Clients banned");
}
?>
......@@ -7,6 +7,24 @@
/* Database functions
*/
function get_version($db, $webserver_id) {
static $cache = array();
if (isset($cache[$webserver_id]) == false) {
$query = "select version from webservers where id=%d";
if (($result = $db->execute($query, $webserver_id)) == false) {
return false;
}
list($version) = explode(",", $result[0]["version"], 2);
list(, $version) = explode("v", $version);
$cache[$webserver_id] = $version;
}
return $cache[$webserver_id];
}
function get_foreign_key($db, $table, $key, $value) {
static $cache = array();
......@@ -131,7 +149,7 @@
if (isset($http)) {
unset($http);
}
if (is_true($webserver["ssl"]) == false) {
if (is_true($webserver["tls"]) == false) {
$http = new HTTP_monitor($webserver["ip_address"], $webserver["port"]);;
} else {
$http = new HTTPS_monitor($webserver["ip_address"], $webserver["port"]);;
......@@ -185,7 +203,10 @@
continue;
}
if ($result["headers"]["Content-Type"] == "application/x-gzip") {
$result["body"] = gzdecode($result["body"]);
if (($result["body"] = gzdecode($result["body"])) === false) {
printf("Invalid gzipped data received from %s.\n", $webserver["name"]);
continue;
}
}
$loglines = explode("\n", chop($result["body"]));
......@@ -299,8 +320,21 @@
/* Host statistic
*/
case "host":
list(, $timestamp_begin, $timestamp_end, $hostname, $requests, $bytes_sent, $bans, $exploit_attempts,
$result_forbidden, $result_not_found, $result_internal_error) = $field;
if (($webserver_version = get_version($db, $webserver_id)) == false) {
$lower_than_9_13 = true;
} else {
list($webserver_version) = explode("-", $webserver_version);
$lower_than_9_13 = version_compare($webserver_version, "9.13", "<");
}
if ($lower_than_9_13) {
list(, $timestamp_begin, $timestamp_end, $hostname, $requests, $bytes_sent, $bans, $exploit_attempts,
$result_forbidden, $result_not_found, $result_internal_error) = $field;
$failed_logins = 0;
} else {
list(, $timestamp_begin, $timestamp_end, $hostname, $requests, $bytes_sent, $bans, $exploit_attempts,
$failed_logins, $result_forbidden, $result_not_found, $result_internal_error) = $field;
}
if (($hostname_id = get_hostname_id($db, $hostname)) == false) {
print "Error getting hostname id\n";
......@@ -333,6 +367,7 @@
"bytes_sent" => (int)$bytes_sent,
"bans" => (int)$bans,
"exploit_attempts" => (int)$exploit_attempts,
"failed_logins" => (int)$failed_logins,
"result_forbidden" => (int)$result_forbidden,
"result_not_found" => (int)$result_not_found,
"result_internal_error" => (int)$result_internal_error));
......@@ -346,6 +381,7 @@
"bytes_sent" => (int)($current["bytes_sent"] + $bytes_sent),
"bans" => (int)($current["bans"] + $bans),
"exploit_attempts" => (int)($current["exploit_attempts"] + $exploit_attempts),
"failed_logins" => (int)($current["failed_logins"] + $failed_logins),
"result_forbidden" => (int)($current["result_forbidden"] + $result_forbidden),
"result_not_found" => (int)($current["result_not_found"] + $result_not_found),
"result_internal_error" => (int)($current["result_internal_error"] + $result_internal_error));
......
-- MySQL dump 10.13 Distrib 5.5.38, for debian-linux-gnu (x86_64)
-- MySQL dump 10.13 Distrib 5.5.43, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: hiawatha_monitor
-- ------------------------------------------------------
-- Server version 5.5.38-0ubuntu0.14.04.1
-- Server version 5.5.43-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
......@@ -87,13 +87,14 @@ CREATE TABLE `host_statistics` (
`timestamp_end` datetime NOT NULL,
`webserver_id` int(10) unsigned NOT NULL,
`hostname_id` int(10) unsigned NOT NULL,
`requests` int(11) NOT NULL,
`bytes_sent` bigint(20) NOT NULL,
`bans` int(11) NOT NULL,
`exploit_attempts` int(11) NOT NULL,
`result_forbidden` int(11) NOT NULL,
`result_not_found` int(11) NOT NULL,
`result_internal_error` int(11) NOT NULL,
`requests` int(11) unsigned NOT NULL,
`bytes_sent` bigint(20) unsigned NOT NULL,
`bans` int(11) unsigned NOT NULL,
`exploit_attempts` int(11) unsigned NOT NULL,
`failed_logins` int(11) unsigned NOT NULL,
`result_forbidden` int(11) unsigned NOT NULL,
`result_not_found` int(11) unsigned NOT NULL,
`result_internal_error` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `webserver_id` (`webserver_id`),
KEY `hostname_id` (`hostname_id`),
......@@ -226,7 +227,7 @@ CREATE TABLE `roles` (
LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'Administrator',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),(2,'Webmaster',1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1);
INSERT INTO `roles` VALUES (1,'Administrator',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),(2,'Webmaster',1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1);
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;
......@@ -385,9 +386,9 @@ CREATE TABLE `webservers` (
`name` tinytext NOT NULL,
`ip_address` varchar(40) NOT NULL,
`port` smallint(5) unsigned NOT NULL,
`ssl` tinyint(1) NOT NULL,
`tls` tinyint(1) NOT NULL,
`active` tinyint(1) NOT NULL,
`errors` int(11) NOT NULL,
`errors` int(11) unsigned NOT NULL,
`version` tinytext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
......@@ -403,4 +404,4 @@ CREATE TABLE `webservers` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-10-07 10:00:37
-- Dump completed on 2015-05-10 15:22:36
#!/usr/bin/php
<?php
define("HISTORY_DAYS", 15);
define("ALERT_MEDIUM", 100);
define("ALERT_HIGH", 200);
define("HISTORY_DAYS", 15);
define("ALERT_MEDIUM", 150);
define("ALERT_HIGH", 300);
define("USE_MEDIAN", true);
define("SKIP_NORMAL", false);
chdir(dirname($argv[0]));
require("../libraries/configuration.php");
......@@ -47,6 +49,29 @@
$settings = new settings($db);
/* Calculate median
*/
function get_median($data, $key) {
$values = array();
foreach ($data as $item) {
array_push($values, $item[$key]);
}
sort($values);
$count = count($values);
if ($count & 1 == 1) {
$center = ($count + 1) / 2;
$median = $values[$center];
} else {
$center = $count / 2;
$median = ($values[$center] + $values[$center + 1]) / 2;
}
return $median;
}
/* Get information about webserver
*/
function get_information($db, $table, $columns, $user_id, $webserver_id, $hostnames) {
......@@ -73,21 +98,30 @@
}
}
foreach ($result as $i => $stat) {
$result[$i]["previous"] = round($stat["previous"] / (HISTORY_DAYS - 1));
$result[$i]["alert"] = "none";
if ($result[$i]["previous"] != 0) {
$percentage = round($stat["today"] / $result[$i]["previous"] * 100) - 100;
if ($percentage >= ALERT_HIGH) {
$result[$i]["alert"] = "high";
} else if ($percentage >= ALERT_MEDIUM) {
$result[$i]["alert"] = "medium";
}
$result[$i]["percentage"] = $percentage." %";
foreach ($result as $idx => $stat) {
if (USE_MEDIAN) {
$result[$idx]["previous"] = get_median($stats, $idx);
} else {
$result[$idx]["previous"] = round($stat["previous"] / (HISTORY_DAYS - 1));
}
if ($result[$idx]["previous"] != 0) {
$percentage = round($stat["today"] / $result[$idx]["previous"] * 100) - 100;
$result[$idx]["percentage"] = $percentage." %";
} else if ($result["today"] == 0) {
$result[$i]["percentage"] = "0 %";
$percentage = $stat["today"] * 100;
$result[$idx]["percentage"] = $percentage." %";
} else {
$percentage = 0;
$result[$idx]["percentage"] = "&#8734;";
}
if ($percentage >= ALERT_HIGH) {
$result[$idx]["alert"] = "high";
} else if ($percentage >= ALERT_MEDIUM) {
$result[$idx]["alert"] = "medium";
} else {
$result[$i]["percentage"] = "&#8734;";
$result[$idx]["alert"] = "none";
}
}
......@@ -117,17 +151,18 @@
"table" => "host_statistics",
"hostnames" => true,
"details" => array(
"bans" => "Bans",
"exploit_attempts" => "Exploit attempts")),
"exploit_attempts" => "Exploit attempts",
"failed_logins" => "Failed logins",
"bans" => "Bans")),
"CGI statistics" => array(
"table" => "cgi_statistics",
"hostnames" => true,
"details" => array(
"cgi_errors" => "CGI errors",
"time_0_1" => "0 - 1 second",
"time_1_3" => "1 - 3 seconds",
"time_3_10" => "3 - 10 seconds",
"time_10_x" => "More than 10 seconds",
"cgi_errors" => "CGI errors")),
"time_10_x" => "More than 10 seconds")),
"Server statistics" => array(
"table" => "server_statistics",
"hostnames" => false,
......@@ -138,10 +173,12 @@
$report = array(
"content" => "<h2>".$webserver["name"]."</h2>\n",
"alerts" => array());
$type = USE_MEDIAN ? "Median" : "Average";
foreach ($stats as $label => $stat) {
$report["content"] .= "<h3>".$label."</h3>\n";
$report["content"] .= "<table class=\"stats\">\n";
$report["content"] .= "<tr><th>Type</th><th>Value</th><th>= &#916;% of</th><th>Average</th></tr>\n";
$header = "<h3>".$label."</h3>\n".
"<table class=\"stats\">\n".
"<tr><th>Type</th><th>Value</th><th>= &#916;% of</th><th>".$type."</th></tr>\n";
$header_set = false;
$columns = array_keys($stat["details"]);
if (($information = get_information($db, $stat["table"], $columns, $user["id"], $webserver["id"], $stat["hostnames"])) == false) {
......@@ -149,6 +186,17 @@
}
foreach ($information as $column => $value) {
if ($value["percentage"] < ALERT_MEDIUM) {
if (SKIP_NORMAL) {
continue;
}
}
if ($header_set == false) {
$report["content"] .= $header;
$header_set = true;
}
$today = graph_model::readable_number($value["today"]);
$previous = graph_model::readable_number($value["previous"]);
$report["content"] .= "<tr><td>".$stat["details"][$column].":</td>".
......@@ -183,8 +231,16 @@
/* Select users which want to receive daily reports
*/
$query = "select * from users where daily_report=%d";
if (($users = $db->execute($query, YES)) == false) {
if (count($argv) > 1) {
$args = array_slice($argv, 1);
$filter = array_fill(0, count($args), "%s");
$query = "select * from users where username in (".implode(", ", $filter).")";
} else {
$query = "select * from users where daily_report=%d";
$args = array(YES);
}
if (($users = $db->execute($query, $args)) == false) {
return;
}
......
......@@ -9,7 +9,7 @@
/* For internal usage. Only change if you know what you're doing!
*/
define("BANSHEE_VERSION", "3.0");
define("MONITOR_VERSION", "1.0");
define("MONITOR_VERSION", "1.1");
define("ADMIN_ROLE_ID", 1);
define("YES", 1);
define("NO", 0);
......
......@@ -13,8 +13,7 @@
protected $from = null;
protected $reply_to = null;
protected $subject = null;
protected $text_message = null;
protected $html_message = null;
protected $message = null;
protected $attachments = array();
protected $images = array();
protected $sender_address = null;
......@@ -28,8 +27,8 @@
* ERROR: -
*/
public function __construct($subject, $from_address = null, $from_name = null) {
$parts = explode("\n", $subject);
$this->subject = trim(array_shift($parts));
$subject = explode("\n", $subject);
$this->subject = trim(array_shift($subject));
if ($this->valid_address($from_address)) {
$this->from = $this->make_address($from_address, $from_name);
......@@ -44,13 +43,6 @@
* ERROR: -
*/
public static function valid_address($email) {
$forbidden = array("mailinator.com");
list(, $domain) = explode("@", $email, 2);
if (in_array($domain, $forbidden)) {
return false;
}
return preg_match("/^[0-9A-Za-z]([-_.~]?[0-9A-Za-z])*@[0-9A-Za-z]([-.]?[0-9A-Za-z])*\\.[A-Za-z]{2,4}$/", $email) === 1;
}
......@@ -165,21 +157,7 @@
$message = "<html>\n".rtrim($message)."\n</html>";
}
/* Determine message mimetype
*/
if ((substr($message, 0, 6) == "<html>") && (substr(rtrim($message), -7) == "</html>")) {
$this->html_message = $message;
if ($this->text_message === null) {
$message = str_replace("\n", "", $message);
$message = str_replace("<br>", "<br>\n", $message);
$message = str_replace("</p>", "</p>\n\n", $message);
$message = str_replace("<div", "\n<div", $message);
$message = preg_replace('/<head>.*<\/head>/', "", $message);
$this->text_message = strip_tags($message);
}
} else {
$this->text_message = $message;
}
$this->message = $message;
}
/* Add e-mail attachment
......@@ -203,10 +181,6 @@
}
if ($content_type == null) {
/* Determine content mimetype
*/
#$finfo = new finfo(FILEINFO_MIME);
#$content_type = $finfo->buffer($content);
$content_type = "application/octet-stream";
}
......@@ -235,7 +209,7 @@
}
$content_type = mime_content_type($filename);
$content_id = md5($image["content"]);
$content_id = sha1($image["content"]);
/* Add attachment
*/
......@@ -291,6 +265,21 @@
*/
private function message_block($boundary, $content_type, $message) {
$message = $this->populate_message_fields($message);
if ($content_type == "text/plain") {
$message = str_replace("\n", "", $message);
$message = str_replace("</th><th>", "</th> | <th>", $message);
$message = str_replace("</td><td>", "</td> | <td>", $message);
$message = str_replace("</tr>", "</tr>\n", $message);
$message = str_replace("</table>", "</table>\n", $message);
$message = str_replace("<br>", "<br>\n", $message);
$message = str_replace("</p>", "</p>\n\n", $message);
$message = str_replace("<div", "\n<div", $message);
$message = preg_replace('/<head>.*<\/head>/', "", $message);
$message = preg_replace('/<a href="(.*)"/', '[$1] <a href=""', $message);
$message = strip_tags($message);
}
$format =
"--%s\n".
"Content-Type: %s\n".
......@@ -314,13 +303,13 @@
*/
if ($image_count > 0) {
$message .= "--".$boundary."\n";
$boundary = substr(md5($boundary), 0, 20);
$boundary = substr(sha1($boundary), 0, 20);
$message .= "Content-Type: multipart/related; boundary=".$boundary."\n\n";
}
/* Add HTML message
*/
$message .= $this->message_block($boundary, "text/html", $this->html_message);
$message .= $this->message_block($boundary, "text/html", $this->message);
/* Add inline images
*/
......@@ -362,29 +351,32 @@
return false;
}
if (count($this->text_message) === null) {
if (count($this->message) === null) {
$this->message("");
}
$attachment_count = count($this->attachments);
$email_boundary = substr(md5(time()), 0, 20);
$email_boundary = substr(sha1(time()), 0, 20);
$message_contains_html = (substr($this->message, 0, 6) == "<html>") &&
(substr(rtrim($this->message), -7) == "</html>");
/* E-mail content
*/
if ($attachment_count == 0) {
/* No attachments
*/
if ($this->html_message === null) {
if ($message_contains_html == false) {
/* One message
*/
$headers = array("Content-Type: text/plain");
$message = $this->populate_message_fields($this->text_message);
$message = $this->populate_message_fields($this->message);
} else {
/* Multiple messages
*/
$headers = array("Content-Type: multipart/alternative; boundary=".$email_boundary);
$message = "This is a multi-part message in MIME format.\n";
$message .= $this->message_block($email_boundary, "text/plain", $this->text_message);
$message .= $this->message_block($email_boundary, "text/plain", $this->message);
$message .= $this->html_message($email_boundary);
}
} else {
......@@ -393,17 +385,17 @@
$headers = array("Content-Type: multipart/mixed; boundary=".$email_boundary);
$message = "This is a multi-part message in MIME format.\n";
if ($this->html_message === null) {
if ($message_contains_html == false) {
/* One message
*/
$message .= $this->message_block($email_boundary, "text/plain", $this->text_message);
$message .= $this->message_block($email_boundary, "text/plain", $this->message);
} else {
/* Multiple messages
*/
$message_boundary = substr(md5($email_boundary), 0, 20);
$message_boundary = substr(sha1($email_boundary), 0, 20);
$message .= "--".$email_boundary."\n".
"Content-Type: multipart/alternative; boundary=".$message_boundary."\n\n";
$message .= $this->message_block($message_boundary, "text/plain", $this->text_message);
$message .= $this->message_block($message_boundary, "text/plain", $this->message);
$message .= $this->html_message($message_boundary);
$message .= "--".$message_boundary."--\n\n";
}
......@@ -427,7 +419,7 @@
}
}
if (($this->html_message !== null) || ($attachment_count > 0)) {
if ($message_contains_html || ($attachment_count > 0)) {
$message .= "--".$email_boundary."--\n";
}
......
......@@ -60,7 +60,7 @@
$query = "select w.* from webservers w, webserver_user a ".
"where w.id=a.webserver_id and a.user_id=%d and w.active=%d ".
"order by name";
if (($webservers = $this->db->execute($query, $this->user->id, YES)) != false) {
if (($webservers = $this->db->execute($query, $this->user->id, YES)) !== false) {
$this->output->open_tag("webservers");
array_unshift($webservers, array("id" => 0, "name" => "All"));
foreach ($webservers as $webserver) {
......@@ -85,7 +85,7 @@
"order by hostname";
$args = array(YES, $table, $_SESSION["filter"]["webserver"]);
}
if (($hostnames = $this->db->execute($query, $args)) != false) {
if (($hostnames = $this->db->execute($query, $args)) !== false) {
$this->output->open_tag("hostnames");
array_unshift($hostnames, array("id" => 0, "hostname" => "All"));
......@@ -111,6 +111,7 @@
}
}
$this->output->close_tag();
return true;
......
......@@ -161,7 +161,7 @@
array_push($args, $filter_webserver);
}
$query .= "group by ".($this->hostnames ? "hostname_id" : "w.name")." order by count desc";
$query .= "group by ".$this->select."w.name order by count desc";
return $this->db->execute($query, $args);
}
......
......@@ -100,14 +100,14 @@
/* Send request via proxy
*
* INPUT: string host, int port[, bool ssl]
* INPUT: string host, int port[, bool tls]
* OUTPUT: -
* ERROR: -
*/
public function via_proxy($host, $port, $ssl = false) {
public function via_proxy($host, $port, $tls = false) {
$this->connect_host = $host;
$this->connect_port = $port;
$this->protocol = $ssl ? "tls://" : "";
$this->protocol = $tls ? "tls://" : "";
$this->via_proxy = true;
}
......
......@@ -26,6 +26,7 @@
private $content_type = "text/html; charset=utf-8";
private $layout = LAYOUT_SITE;
private $disabled = false;
private $add_layout_data = true;
/* Constructor
*
......@@ -38,10 +39,15 @@
$this->settings = $settings;
$this->page = $page;
if (isset($_GET["output"])) {
$this->mode = $_GET["output"];
} else if ($this->page->ajax_request) {
if ($this->page->ajax_request) {
$this->mode