diff --git a/upload/admin/controller/common/column_left.php b/upload/admin/controller/common/column_left.php index b85b00b6a5b..fcee1330251 100644 --- a/upload/admin/controller/common/column_left.php +++ b/upload/admin/controller/common/column_left.php @@ -749,6 +749,8 @@ public function index(): string { } return $this->load->view('common/column_left', $data); + } else { + return ''; } } } diff --git a/upload/admin/controller/common/forgotten.php b/upload/admin/controller/common/forgotten.php index 28df92bbd2b..215dd573722 100644 --- a/upload/admin/controller/common/forgotten.php +++ b/upload/admin/controller/common/forgotten.php @@ -22,6 +22,7 @@ public function index(): void { 'href' => $this->url->link('common/forgotten') ]; + $data['confirm'] = $this->url->link('common/forgotten|confirm'); $data['back'] = $this->url->link('common/login'); $data['header'] = $this->load->controller('common/header'); @@ -53,7 +54,7 @@ public function confirm(): void { $user_info = $this->model_user_user->getUserByEmail($this->request->post['email']); if (!$user_info) { - $json['error'] = $this->language->get('error_not_found'); + $json['error'] = $this->language->get('error_email'); } if (!$json) { @@ -115,7 +116,7 @@ public function reset(): void { $this->session->data['reset_token'] = substr(bin2hex(openssl_random_pseudo_bytes(26)), 0, 26); - $data['reset'] = $this->url->link('account/forgotten|password', 'email=' . urlencode($email) . '&code=' . $code . '&reset_token=' . $this->session->data['reset_token']); + $data['reset'] = $this->url->link('common/forgotten|password', 'email=' . urlencode($email) . '&code=' . $code . '&reset_token=' . $this->session->data['reset_token']); $data['back'] = $this->url->link('common/login'); $data['header'] = $this->load->controller('common/header'); @@ -124,7 +125,7 @@ public function reset(): void { $this->response->setOutput($this->load->view('common/forgotten_reset', $data)); } - public function password(): bool { + public function password(): void { $this->load->language('common/forgotten'); $json = []; diff --git a/upload/admin/controller/mail/subscription.php b/upload/admin/controller/mail/subscription.php index 0beb5e19f8a..35b5629e0eb 100644 --- a/upload/admin/controller/mail/subscription.php +++ b/upload/admin/controller/mail/subscription.php @@ -1,7 +1,35 @@ load->model('customer/customer'); $customer_info = $this->model_customer_customer->getCustomer($args[0]); @@ -77,4 +105,9 @@ public function approve(string &$route, array &$args, mixed &$output): void { $mail->send(); } } + + public function cancel(string &$route, array &$args, mixed &$output): void { + + + } } diff --git a/upload/admin/controller/sale/subscription.php b/upload/admin/controller/sale/subscription.php index 238d9ffd4ab..ffd285f23e8 100644 --- a/upload/admin/controller/sale/subscription.php +++ b/upload/admin/controller/sale/subscription.php @@ -440,11 +440,10 @@ public function info(): void { $data['description'] = ''; if (!empty($subscription_info)) { - + $trial_price = $this->currency->format($subscription_info['trial_price'], $this->config->get('config_currency')); $trial_cycle = $subscription_info['trial_cycle']; $trial_frequency = $this->language->get('text_' . $subscription_info['trial_frequency']); $trial_duration = $subscription_info['trial_duration']; - $trial_price = $this->currency->format($subscription_info['trial_price'], $this->config->get('config_currency')); if ($subscription_info['trial_status']) { $data['description'] .= sprintf($this->language->get('text_subscription_trial'), $trial_price, $trial_cycle, $trial_frequency, $trial_duration); @@ -460,8 +459,6 @@ public function info(): void { } else { $data['description'] .= sprintf($this->language->get('text_subscription_cancel'), $price, $cycle, $frequency); } - - } if (!empty($product_info)) { diff --git a/upload/admin/controller/tool/log.php b/upload/admin/controller/tool/log.php index c2caebd9fbf..0a71d11423a 100644 --- a/upload/admin/controller/tool/log.php +++ b/upload/admin/controller/tool/log.php @@ -18,19 +18,26 @@ public function index(): void { 'href' => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token']) ]; + //echo $this->session->data['error']; + + if (isset($this->session->data['error'])) { $data['error_warning'] = $this->session->data['error']; + + unset($this->session->data['error']); } else { $data['error_warning'] = ''; } - $data['download'] = $this->url->link('tool/log|download', 'user_token=' . $this->session->data['user_token']); + $data['log'] = []; - $data['log'] = ''; + $files = glob(DIR_LOGS . '*.log'); - $file = DIR_LOGS . $this->config->get('config_error_filename'); + foreach ($files as $file) { + $error = ''; + + $filename = basename($file); - if (is_file($file)) { $size = filesize($file); if ($size >= 3145728) { @@ -53,12 +60,18 @@ public function index(): void { $i++; } - $data['error_warning'] = sprintf($this->language->get('error_warning'), basename($file), round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i]); + $error = sprintf($this->language->get('error_size'), $filename, round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i]); } $handle = fopen($file, 'r+'); - $data['log'] = fread($handle, 3145728); + $data['logs'][] = [ + 'name' => $filename, + 'output' => fread($handle, 3145728), + 'download' => $this->url->link('tool/log|download', 'user_token=' . $this->session->data['user_token'] . '&filename=' . $filename), + 'clear' => $this->url->link('tool/log|clear', 'user_token=' . $this->session->data['user_token'] . '&filename=' . $filename), + 'error' => $error + ]; fclose($handle); } @@ -75,36 +88,59 @@ public function index(): void { public function download(): void { $this->load->language('tool/log'); - $file = DIR_LOGS . $this->config->get('config_error_filename'); + if (isset($this->request->get['filename'])) { + $filename = (string)basename($this->request->get['filename']); + } else { + $filename = ''; + } + + $file = DIR_LOGS . $filename; - if (is_file($file) && filesize($file) > 0) { - $this->response->addheader('Pragma: public'); - $this->response->addheader('Expires: 0'); - $this->response->addheader('Content-Description: File Transfer'); - $this->response->addheader('Content-Type: application/octet-stream'); - $this->response->addheader('Content-Disposition: attachment; filename="' . $this->config->get('config_name') . '_' . date('Y-m-d_H-i-s', time()) . '_error.log"'); - $this->response->addheader('Content-Transfer-Encoding: binary'); + if (!is_file($file)) { + $this->session->data['error'] = sprintf($this->language->get('error_file'), $filename); - $this->response->setOutput(file_get_contents($file, FILE_USE_INCLUDE_PATH, null)); - } else { - $this->session->data['error'] = sprintf($this->language->get('error_warning'), basename($file), '0B'); + $this->response->redirect($this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'])); + } + + if (!filesize($file)) { + $this->session->data['error'] = sprintf($this->language->get('error_empty'), $filename); + //echo sprintf($this->language->get('error_empty'), $filename); $this->response->redirect($this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'])); } + + $this->response->addheader('Pragma: public'); + $this->response->addheader('Expires: 0'); + $this->response->addheader('Content-Description: File Transfer'); + $this->response->addheader('Content-Type: application/octet-stream'); + $this->response->addheader('Content-Disposition: attachment; filename="' . $this->config->get('config_name') . '_' . date('Y-m-d_H-i-s', time()) . '_error.log"'); + $this->response->addheader('Content-Transfer-Encoding: binary'); + + //$this->response->setOutput(file_get_contents($file, FILE_USE_INCLUDE_PATH, null)); } public function clear(): void { $this->load->language('tool/log'); + if (isset($this->request->get['filename'])) { + $filename = (string)$this->request->get['filename']; + } else { + $filename = ''; + } + $json = []; if (!$this->user->hasPermission('modify', 'tool/log')) { $json['error'] = $this->language->get('error_permission'); } - if (!$json) { - $file = DIR_LOGS . $this->config->get('config_error_filename'); + $file = DIR_LOGS . $filename; + if (!is_file($file)) { + $json['error'] = sprintf($this->language->get('error_file'), $filename); + } + + if (!$json) { $handle = fopen($file, 'w+'); fclose($handle); diff --git a/upload/admin/language/en-gb/tool/log.php b/upload/admin/language/en-gb/tool/log.php index 366edf65b8d..5a8a477846c 100644 --- a/upload/admin/language/en-gb/tool/log.php +++ b/upload/admin/language/en-gb/tool/log.php @@ -7,5 +7,7 @@ $_['text_list'] = 'Errors List'; // Error -$_['error_warning'] = 'Warning: Your error log file %s is %s!'; -$_['error_permission'] = 'Warning: You do not have permission to clear error log!'; \ No newline at end of file +$_['error_permission'] = 'Warning: You do not have permission to clear error log!'; +$_['error_file'] = 'Warning: %s file could not be found!'; +$_['error_size'] = 'Warning: Error log file %s is %s!'; +$_['error_empty'] = 'Warning: Log file %s is empty!'; \ No newline at end of file diff --git a/upload/admin/view/template/common/forgotten_reset.twig b/upload/admin/view/template/common/forgotten_reset.twig index d55319d140f..7528ef34210 100644 --- a/upload/admin/view/template/common/forgotten_reset.twig +++ b/upload/admin/view/template/common/forgotten_reset.twig @@ -8,7 +8,7 @@
{{ heading_title }}
-
+

{{ text_password }}

@@ -19,7 +19,7 @@
- +
diff --git a/upload/admin/view/template/common/security.twig b/upload/admin/view/template/common/security.twig index 41f844b3afa..d779de39254 100644 --- a/upload/admin/view/template/common/security.twig +++ b/upload/admin/view/template/common/security.twig @@ -1,20 +1,16 @@