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

/opencart_v1.4/upload/admin/controller/tool/error_log.php

http://coderstalk.googlecode.com/
PHP | 71 lines | 50 code | 21 blank | 0 comment | 4 complexity | 77d3a71b49e676de46e2f4870c48892b MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, AGPL-3.0
  1. <?php
  2. class ControllerToolErrorLog extends Controller {
  3. private $error = array();
  4. public function index() {
  5. $this->load->language('tool/error_log');
  6. $this->document->title = $this->language->get('heading_title');
  7. $this->data['heading_title'] = $this->language->get('heading_title');
  8. $this->data['button_clear'] = $this->language->get('button_clear');
  9. $this->data['tab_general'] = $this->language->get('tab_general');
  10. if (isset($this->session->data['success'])) {
  11. $this->data['success'] = $this->session->data['success'];
  12. unset($this->session->data['success']);
  13. } else {
  14. $this->data['success'] = '';
  15. }
  16. $this->document->breadcrumbs = array();
  17. $this->document->breadcrumbs[] = array(
  18. 'href' => $this->url->https('common/home'),
  19. 'text' => $this->language->get('text_home'),
  20. 'separator' => FALSE
  21. );
  22. $this->document->breadcrumbs[] = array(
  23. 'href' => $this->url->https('tool/error_log'),
  24. 'text' => $this->language->get('heading_title'),
  25. 'separator' => ' :: '
  26. );
  27. $this->data['clear'] = $this->url->https('tool/error_log/clear');
  28. $file = DIR_LOGS . $this->config->get('config_error_filename');
  29. if (file_exists($file)) {
  30. $this->data['log'] = file_get_contents($file, FILE_USE_INCLUDE_PATH, NULL);
  31. } else {
  32. $this->data['log'] = '';
  33. }
  34. $this->template = 'tool/error_log.tpl';
  35. $this->children = array(
  36. 'common/header',
  37. 'common/footer'
  38. );
  39. $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
  40. }
  41. public function clear() {
  42. $this->load->language('tool/error_log');
  43. $file = DIR_LOGS . $this->config->get('config_error_filename');
  44. $handle = fopen($file, 'w+');
  45. fclose($handle);
  46. $this->session->data['success'] = $this->language->get('text_success');
  47. $this->redirect($this->url->https('tool/error_log'));
  48. }
  49. }
  50. ?>