system.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. class Pref_System extends Handler_Protected {
  3. function before($method) {
  4. if (parent::before($method)) {
  5. if ($_SESSION["access_level"] < 10) {
  6. print __("Your access level is insufficient to open this tab.");
  7. return false;
  8. }
  9. return true;
  10. }
  11. return false;
  12. }
  13. function csrf_ignore($method) {
  14. $csrf_ignored = array("index");
  15. return array_search($method, $csrf_ignored) !== false;
  16. }
  17. function index() {
  18. print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
  19. print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Error Log')."\">";
  20. $result = $this->dbh->query("SELECT errno, errstr, filename, lineno,
  21. created_at, login FROM ttrss_error_log
  22. LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)
  23. ORDER BY ttrss_error_log.id DESC
  24. LIMIT 100");
  25. print "<button dojoType=\"dijit.form.Button\"
  26. onclick=\"updateSystemList()\">".__('Refresh')."</button> ";
  27. print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
  28. print "<tr class=\"title\">
  29. <td width='5%'>".__("Error")."</td>
  30. <td>".__("Filename")."</td>
  31. <td>".__("Message")."</td>
  32. <td width='5%'>".__("User")."</td>
  33. <td width='5%'>".__("Date")."</td>
  34. </tr>";
  35. while ($line = $this->dbh->fetch_assoc($result)) {
  36. print "<tr class=\"errrow\">";
  37. foreach ($line as $k => $v) {
  38. $line[$k] = htmlspecialchars($v);
  39. }
  40. print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
  41. print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
  42. print "<td class='errstr'>" . $line["errstr"] . "</td>";
  43. print "<td class='login'>" . $line["login"] . "</td>";
  44. print "<td class='timestamp'>" .
  45. make_local_datetime(
  46. $line["created_at"], false) . "</td>";
  47. print "</tr>";
  48. }
  49. print "</table>";
  50. print "</div>";
  51. global $pluginhost;
  52. $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB,
  53. "hook_prefs_tab", "prefSystem");
  54. print "</div>"; #container
  55. }
  56. }
  57. ?>