PageRenderTime 73ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/system/application/controllers/log.php

http://github.com/prashants/webzash
PHP | 52 lines | 41 code | 6 blank | 5 comment | 6 complexity | a2fc601a80f9b62a3bbc3f8845d90fc6 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. class Log extends Controller {
  3. function index()
  4. {
  5. $this->load->helper('text');
  6. $this->template->set('page_title', 'Logs');
  7. $this->template->set('nav_links', array('log/clear' => 'Clear Log'));
  8. $this->template->load('template', 'log/index');
  9. /* Check access */
  10. if ( ! check_access('view log'))
  11. {
  12. $this->messages->add('Permission denied.', 'error');
  13. redirect('');
  14. return;
  15. }
  16. return;
  17. }
  18. function clear()
  19. {
  20. /* Check access */
  21. if ( ! check_access('clear log'))
  22. {
  23. $this->messages->add('Permission denied.', 'error');
  24. redirect('log');
  25. return;
  26. }
  27. /* Check for account lock */
  28. if ($this->config->item('account_locked') == 1)
  29. {
  30. $this->messages->add('Account is locked.', 'error');
  31. redirect('log');
  32. return;
  33. }
  34. if ($this->db->truncate('logs'))
  35. {
  36. $this->messages->add('Log cleared.', 'success');
  37. redirect('log');
  38. } else {
  39. $this->messages->add('Error clearing Log.', 'error');
  40. redirect('log');
  41. }
  42. return;
  43. }
  44. }
  45. /* End of file log.php */
  46. /* Location: ./system/application/controllers/log.php */