PageRenderTime 26ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/phpini/edit_errors.cgi

http://github.com/webmin/webmin
Perl | 74 lines | 55 code | 10 blank | 9 comment | 8 complexity | 6c85408fa943623d342d1440bccb8219 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-3.0, CC-BY-SA-3.0
  1. #!/usr/local/bin/perl
  2. # Show options related to error reporting and logging
  3. require './phpini-lib.pl';
  4. &ReadParse();
  5. &can_php_config($in{'file'}) || &error($text{'list_ecannot'});
  6. $conf = &get_config($in{'file'});
  7. &ui_print_header("<tt>$in{'file'}</tt>", $text{'errors_title'}, "");
  8. print &ui_form_start("save_errors.cgi", "post");
  9. print &ui_hidden("file", $in{'file'}),"\n";
  10. print &ui_table_start($text{'errors_header'}, "width=100%", 4);
  11. # Show and log errors
  12. print &ui_table_row($text{'errors_display'},
  13. &onoff_radio("display_errors"));
  14. print &ui_table_row($text{'errors_log'},
  15. &onoff_radio("log_errors"));
  16. # Ignore repeated
  17. print &ui_table_row($text{'errors_ignore'},
  18. &onoff_radio("ignore_repeated_errors"));
  19. print &ui_table_row($text{'errors_source'},
  20. &onoff_radio("ignore_repeated_source"));
  21. # Error types to show
  22. $errs = &find_value("error_reporting", $conf);
  23. if ($errs =~ /^[A-Z_\|]*$/) {
  24. # An | of error bits
  25. @errs = split(/\|/, $errs);
  26. $i = 0;
  27. $etable = "<table>\n";
  28. foreach $et ("E_ALL", "E_ERROR", "E_WARNING", "E_PARSE", "E_NOTICE",
  29. "E_CORE_ERROR", "E_CORE_WARNING", "E_COMPILE_ERROR",
  30. "E_COMPILE_WARNING", "E_USER_ERROR", "E_USER_WARNING",
  31. "E_USER_NOTICE") {
  32. $etable .= "<tr>\n" if ($i%4 == 0);
  33. $etable .= "<td>".
  34. &ui_checkbox("error_bits", $et,
  35. $text{'errors_'.$et}, &indexof($et, @errs) >= 0).
  36. "</td>\n";
  37. $etable .= "</tr>\n" if ($i++%4 == 3);
  38. }
  39. $etable .= "</table>\n";
  40. print &ui_table_row($text{'errors_bits'}, $etable, 3);
  41. }
  42. else {
  43. # Custom expression
  44. print &ui_table_row($text{'errors_reporting'},
  45. &ui_opt_textbox("error_reporting", $errs, 60, $text{'default'}), 3);
  46. }
  47. # Max error length
  48. $ml = &find_value("log_errors_max_len", $conf);
  49. print &ui_table_row($text{'errors_maxlen'},
  50. &ui_opt_textbox("log_errors_max_len", $ml || undef, 5,
  51. $text{'errors_unlimited'}));
  52. # Where to log errors
  53. $el = &find_value("error_log", $conf);
  54. print &ui_table_row($text{'errors_file'},
  55. &ui_radio("error_log_def", $el eq "syslog" ? 1 : $el ? 2 : 0,
  56. [ [ 0, $text{'errors_none'} ],
  57. [ 1, $text{'errors_syslog'} ],
  58. [ 2, &text('errors_other',
  59. &ui_textbox("error_log", $el eq "syslog" ? "" : $el, 40))
  60. ] ]), 3);
  61. print &ui_table_end();
  62. print &ui_form_end([ [ "save", $text{'save'} ] ]);
  63. &ui_print_footer("list_ini.cgi?file=".&urlize($in{'file'}),
  64. $text{'list_return'});