|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class Pref_System extends Handler_Protected { |
|
4
|
|
|
|
|
5
|
|
|
public function before($method) { |
|
6
|
|
|
if (parent::before($method)) { |
|
7
|
|
|
if ($_SESSION["access_level"] < 10) { |
|
8
|
|
|
print __("Your access level is insufficient to open this tab."); |
|
9
|
|
|
return false; |
|
10
|
|
|
} |
|
11
|
|
|
return true; |
|
12
|
|
|
} |
|
13
|
|
|
return false; |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function csrf_ignore($method) { |
|
17
|
|
|
$csrf_ignored = array("index"); |
|
18
|
|
|
|
|
19
|
|
|
return array_search($method, $csrf_ignored) !== false; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function clearLog() { |
|
23
|
|
|
$this->pdo->query("DELETE FROM ttrss_error_log"); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function index() { |
|
27
|
|
|
|
|
28
|
|
|
print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; |
|
29
|
|
|
print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
30
|
|
|
title=\"<i class='material-icons'>report</i> ".__('Event Log')."\">"; |
|
31
|
|
|
|
|
32
|
|
|
if (LOG_DESTINATION == "sql") { |
|
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
$res = $this->pdo->query("SELECT errno, errstr, filename, lineno, |
|
35
|
|
|
created_at, login, context FROM ttrss_error_log |
|
36
|
|
|
LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id) |
|
37
|
|
|
ORDER BY ttrss_error_log.id DESC |
|
38
|
|
|
LIMIT 100"); |
|
39
|
|
|
|
|
40
|
|
|
print "<button dojoType=\"dijit.form.Button\" |
|
41
|
|
|
onclick=\"Helpers.updateEventLog()\">".__('Refresh')."</button> "; |
|
42
|
|
|
|
|
43
|
|
|
print " <button dojoType=\"dijit.form.Button\" |
|
44
|
|
|
class=\"alt-danger\" onclick=\"Helpers.clearEventLog()\">".__('Clear')."</button> "; |
|
45
|
|
|
|
|
46
|
|
|
print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">"; |
|
47
|
|
|
|
|
48
|
|
|
print "<tr class=\"title\"> |
|
49
|
|
|
<td width='5%'>".__("Error")."</td> |
|
50
|
|
|
<td>".__("Filename")."</td> |
|
51
|
|
|
<td>".__("Message")."</td> |
|
52
|
|
|
<td width='5%'>".__("User")."</td> |
|
53
|
|
|
<td width='5%'>".__("Date")."</td> |
|
54
|
|
|
</tr>"; |
|
55
|
|
|
|
|
56
|
|
|
while ($line = $res->fetch()) { |
|
57
|
|
|
print "<tr>"; |
|
58
|
|
|
|
|
59
|
|
|
foreach ($line as $k => $v) { |
|
60
|
|
|
$line[$k] = htmlspecialchars($v); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
print "<td class='errno'>".Logger::$errornames[$line["errno"]]." (".$line["errno"].")</td>"; |
|
64
|
|
|
print "<td class='filename'>".$line["filename"].":".$line["lineno"]."</td>"; |
|
65
|
|
|
print "<td class='errstr'>".$line["errstr"]."<hr/>".nl2br($line["context"])."</td>"; |
|
66
|
|
|
print "<td class='login'>".$line["login"]."</td>"; |
|
67
|
|
|
|
|
68
|
|
|
print "<td class='timestamp'>". |
|
69
|
|
|
make_local_datetime( |
|
70
|
|
|
$line["created_at"], false)."</td>"; |
|
71
|
|
|
|
|
72
|
|
|
print "</tr>"; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
print "</table>"; |
|
76
|
|
|
} else { |
|
77
|
|
|
|
|
78
|
|
|
print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging."); |
|
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
print "</div>"; |
|
83
|
|
|
|
|
84
|
|
|
print "<div dojoType=\"dijit.layout.AccordionPane\" |
|
85
|
|
|
title=\"<i class='material-icons'>info</i> ".__('PHP Information')."\">"; |
|
86
|
|
|
|
|
87
|
|
|
ob_start(); |
|
88
|
|
|
phpinfo(); |
|
89
|
|
|
$info = ob_get_contents(); |
|
90
|
|
|
ob_end_clean(); |
|
91
|
|
|
|
|
92
|
|
|
print "<div class='phpinfo'>"; |
|
93
|
|
|
print preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $info); |
|
94
|
|
|
print "</div>"; |
|
95
|
|
|
|
|
96
|
|
|
print "</div>"; |
|
97
|
|
|
|
|
98
|
|
|
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, |
|
99
|
|
|
"hook_prefs_tab", "prefSystem"); |
|
100
|
|
|
|
|
101
|
|
|
print "</div>"; #container |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
} |
|
105
|
|
|
|