]> git.wh0rd.org - tt-rss.git/blame - classes/pref/system.php
make pluginhost a singleton
[tt-rss.git] / classes / pref / system.php
CommitLineData
2cbdc95b
AD
1<?php
2
3class Pref_System extends Handler_Protected {
4
2cbdc95b
AD
5 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 function csrf_ignore($method) {
17 $csrf_ignored = array("index");
18
19 return array_search($method, $csrf_ignored) !== false;
20 }
21
22 function index() {
23
24 print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
25 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Error Log')."\">";
26
d9c85e0f 27 $result = $this->dbh->query("SELECT errno, errstr, filename, lineno,
2cbdc95b
AD
28 created_at, login FROM ttrss_error_log
29 LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)
30 ORDER BY ttrss_error_log.id DESC
31 LIMIT 100");
32
01568557
AD
33 print "<button dojoType=\"dijit.form.Button\"
34 onclick=\"updateSystemList()\">".__('Refresh')."</button> ";
35
2cbdc95b
AD
36 print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
37
38 print "<tr class=\"title\">
39 <td width='5%'>".__("Error")."</td>
40 <td>".__("Filename")."</td>
41 <td>".__("Message")."</td>
42 <td width='5%'>".__("User")."</td>
43 <td width='5%'>".__("Date")."</td>
44 </tr>";
45
d9c85e0f 46 while ($line = $this->dbh->fetch_assoc($result)) {
2cbdc95b
AD
47 print "<tr class=\"errrow\">";
48
49 foreach ($line as $k => $v) {
50 $line[$k] = htmlspecialchars($v);
51 }
52
53 print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
54 print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
55 print "<td class='errstr'>" . $line["errstr"] . "</td>";
56 print "<td class='login'>" . $line["login"] . "</td>";
57
58 print "<td class='timestamp'>" .
6322ac79 59 make_local_datetime(
2cbdc95b
AD
60 $line["created_at"], false) . "</td>";
61
62 print "</tr>";
63 }
64
65 print "</table>";
66
67 print "</div>";
68
1ffe3391 69 PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB,
2cbdc95b
AD
70 "hook_prefs_tab", "prefSystem");
71
72 print "</div>"; #container
73 }
74
75}
76?>