";
@@ -59,65 +133,8 @@ class Pref_System extends Handler_Protected {
print '
';
- print "
";
+ $this->log_viewer($page, $severity);
- print "
- ".__("Error")." |
- ".__("Filename")." |
- ".__("Message")." |
- ".__("User")." |
- ".__("Date")." |
-
";
-
- $errno_values = [];
-
- switch ($severity) {
- case E_USER_ERROR:
- $errno_values = [ E_ERROR, E_USER_ERROR, E_PARSE ];
- break;
- case E_USER_WARNING:
- $errno_values = [ E_ERROR, E_USER_ERROR, E_PARSE, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED ];
- break;
- }
-
- if (count($errno_values) > 0) {
- $errno_qmarks = arr_qmarks($errno_values);
- $errno_filter_qpart = "errno IN ($errno_qmarks)";
- } else {
- $errno_filter_qpart = "true";
- }
-
- $sth = $this->pdo->prepare("SELECT
- errno, errstr, filename, lineno, created_at, login, context
- FROM
- ttrss_error_log LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)
- WHERE
- $errno_filter_qpart
- ORDER BY
- ttrss_error_log.id DESC
- LIMIT 100");
-
- $sth->execute($errno_values);
-
- while ($line = $sth->fetch()) {
- print "";
-
- foreach ($line as $k => $v) {
- $line[$k] = htmlspecialchars($v);
- }
-
- print "" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ") | ";
- print "" . $line["filename"] . ":" . $line["lineno"] . " | ";
- print "" . $line["errstr"] . " " . nl2br($line["context"]) . " | ";
- print "" . $line["login"] . " | ";
-
- print "" .
- TimeHelper::make_local_datetime($line["created_at"], false) . " | ";
-
- print "
";
- }
-
- print "
";
} else {
print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging.");
}
diff --git a/classes/sanitizer.php b/classes/sanitizer.php
index 64b2edd36..9ca4200a5 100644
--- a/classes/sanitizer.php
+++ b/classes/sanitizer.php
@@ -54,7 +54,9 @@ class Sanitizer {
}
public static function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) {
- if (!$owner) $owner = $_SESSION["uid"];
+
+ if (!$owner && isset($_SESSION["uid"]))
+ $owner = $_SESSION["uid"];
$res = trim($str); if (!$res) return '';
diff --git a/include/errorhandler.php b/include/errorhandler.php
index 16afcabcf..3643db98a 100644
--- a/include/errorhandler.php
+++ b/include/errorhandler.php
@@ -11,11 +11,11 @@ function format_backtrace($trace) {
if (is_array($e["args"])) {
foreach ($e["args"] as $a) {
if (is_object($a)) {
- array_push($fmt_args, "[" . get_class($a) . "]");
+ array_push($fmt_args, "{" . get_class($a) . "}");
} else if (is_array($a)) {
- array_push($fmt_args, "[" . truncate_string(json_encode($a), 128, "...")) . "]";
+ array_push($fmt_args, "[" . truncate_string(json_encode($a), 256, "...")) . "]";
} else {
- array_push($fmt_args, $a);
+ array_push($fmt_args, truncate_string($a, 256, "..."));
}
}
}
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index 0780fb708..57dff2333 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -50,21 +50,37 @@ const Helpers = {
return false;
},
- updateEventLog: function() {
- xhrPost("backend.php", { op: "pref-system", severity: dijit.byId("severity").attr('value') }, (transport) => {
- dijit.byId('systemConfigTab').attr('content', transport.responseText);
- Notify.close();
- });
- },
- clearEventLog: function() {
- if (confirm(__("Clear event log?"))) {
-
- Notify.progress("Loading, please wait...");
-
- xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => {
- this.updateEventLog();
+ EventLog: {
+ log_page: 0,
+ refresh: function() {
+ this.log_page = 0;
+ this.update();
+ },
+ update: function() {
+ xhrPost("backend.php", { op: "pref-system", severity: dijit.byId("severity").attr('value'), page: Helpers.EventLog.log_page }, (transport) => {
+ dijit.byId('systemConfigTab').attr('content', transport.responseText);
+ Notify.close();
});
- }
+ },
+ nextPage: function() {
+ this.log_page += 1;
+ this.update();
+ },
+ prevPage: function() {
+ if (this.log_page > 0) this.log_page -= 1;
+
+ this.update();
+ },
+ clear: function() {
+ if (confirm(__("Clear event log?"))) {
+
+ Notify.progress("Loading, please wait...");
+
+ xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => {
+ Helpers.EventLog.refresh();
+ });
+ }
+ },
},
editProfiles: function() {