/upload/admin/controller/tool/error_log.php
PHP | 63 lines | 45 code | 18 blank | 0 comment | 4 complexity | da2a24775096f2cc746593598376a260 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-3.0
- <?php
- class ControllerToolErrorLog extends Controller {
- private $error = array();
-
- public function index() {
- $this->data += $this->language->load('tool/error_log');
-
- $this->document->setTitle($this->language->get('heading_title'));
-
- if (isset($this->session->data['success'])) {
- $this->data['success'] = $this->session->data['success'];
-
- unset($this->session->data['success']);
- } else {
- $this->data['success'] = '';
- }
-
- $this->data['breadcrumbs'] = array();
-
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_home'),
- 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL')
- );
-
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('heading_title'),
- 'href' => $this->url->link('tool/error_log', 'token=' . $this->session->data['token'], 'SSL')
- );
-
- $this->data['clear'] = $this->url->link('tool/error_log/clear', 'token=' . $this->session->data['token'], 'SSL');
-
- $file = DIR_LOGS . $this->config->get('config_error_filename');
-
- if (file_exists($file)) {
- $this->data['log'] = file_get_contents($file, FILE_USE_INCLUDE_PATH, null);
- } else {
- $this->data['log'] = '';
- }
-
- $this->template = 'tool/error_log.tpl';
- $this->children = array(
- 'common/header',
- 'common/footer'
- );
-
- $this->response->setOutput($this->render());
- }
-
- public function clear() {
- $this->data += $this->language->load('tool/error_log');
-
- $file = DIR_LOGS . $this->config->get('config_error_filename');
-
- $handle = fopen($file, 'w+');
-
- fclose($handle);
-
- $this->session->data['success'] = $this->language->get('text_success');
-
- $this->redirect($this->url->link('tool/error_log', 'token=' . $this->session->data['token'], 'SSL'));
- }
- }
- ?>