first commit
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
class ControllerInformationContact extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index() {
|
||||
$this->load->language('information/contact');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
|
||||
$mail = new Mail($this->config->get('config_mail_engine'));
|
||||
$mail->parameter = $this->config->get('config_mail_parameter');
|
||||
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
|
||||
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
|
||||
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
|
||||
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
|
||||
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
|
||||
|
||||
$mail->setTo($this->config->get('config_email'));
|
||||
$mail->setFrom($this->request->post['email']);
|
||||
$mail->setReplyTo($this->request->post['email']);
|
||||
$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
|
||||
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name'] . ' (' . $this->request->post['email'] . ')'), ENT_QUOTES, 'UTF-8'));
|
||||
$mail->setText($this->request->post['enquiry']);
|
||||
$mail->send();
|
||||
|
||||
$this->response->redirect($this->url->link('information/contact/success'));
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('information/contact')
|
||||
);
|
||||
|
||||
if (isset($this->error['name'])) {
|
||||
$data['error_name'] = $this->error['name'];
|
||||
} else {
|
||||
$data['error_name'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['email'])) {
|
||||
$data['error_email'] = $this->error['email'];
|
||||
} else {
|
||||
$data['error_email'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['enquiry'])) {
|
||||
$data['error_enquiry'] = $this->error['enquiry'];
|
||||
} else {
|
||||
$data['error_enquiry'] = '';
|
||||
}
|
||||
|
||||
$data['text_location'] = $this->language->get('text_location');
|
||||
$data['text_location_lead'] = $this->language->get('text_location_lead');
|
||||
$data['text_store'] = $this->language->get('text_store');
|
||||
$data['text_contact'] = $this->language->get('text_contact');
|
||||
$data['text_contact_lead'] = $this->language->get('text_contact_lead');
|
||||
$data['text_address'] = $this->language->get('text_address');
|
||||
$data['text_telephone'] = $this->language->get('text_telephone');
|
||||
$data['text_fax'] = $this->language->get('text_fax');
|
||||
$data['text_open'] = $this->language->get('text_open');
|
||||
$data['text_comment'] = $this->language->get('text_comment');
|
||||
$data['text_message_hint'] = $this->language->get('text_message_hint');
|
||||
|
||||
$data['entry_name'] = $this->language->get('entry_name');
|
||||
$data['entry_email'] = $this->language->get('entry_email');
|
||||
$data['entry_enquiry'] = $this->language->get('entry_enquiry');
|
||||
|
||||
$data['button_submit'] = $this->language->get('button_submit');
|
||||
$data['button_map'] = $this->language->get('button_map');
|
||||
|
||||
$data['action'] = $this->url->link('information/contact', '', true);
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
if ($this->config->get('config_image')) {
|
||||
$data['image'] = $this->model_tool_image->resize($this->config->get('config_image'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_height'));
|
||||
} else {
|
||||
$data['image'] = false;
|
||||
}
|
||||
|
||||
$data['store'] = $this->config->get('config_name');
|
||||
$data['address'] = nl2br($this->config->get('config_address'));
|
||||
$data['geocode'] = $this->config->get('config_geocode');
|
||||
$data['geocode_hl'] = $this->config->get('config_language');
|
||||
$data['telephone'] = $this->config->get('config_telephone');
|
||||
$data['fax'] = $this->config->get('config_fax');
|
||||
$data['open'] = nl2br($this->config->get('config_open'));
|
||||
$data['comment'] = $this->config->get('config_comment');
|
||||
|
||||
$data['locations'] = array();
|
||||
|
||||
$this->load->model('localisation/location');
|
||||
|
||||
foreach((array)$this->config->get('config_location') as $location_id) {
|
||||
$location_info = $this->model_localisation_location->getLocation($location_id);
|
||||
|
||||
if ($location_info) {
|
||||
if ($location_info['image']) {
|
||||
$image = $this->model_tool_image->resize($location_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_height'));
|
||||
} else {
|
||||
$image = false;
|
||||
}
|
||||
|
||||
$data['locations'][] = array(
|
||||
'location_id' => $location_info['location_id'],
|
||||
'name' => $location_info['name'],
|
||||
'address' => nl2br($location_info['address']),
|
||||
'geocode' => $location_info['geocode'],
|
||||
'telephone' => $location_info['telephone'],
|
||||
'fax' => $location_info['fax'],
|
||||
'image' => $image,
|
||||
'open' => nl2br($location_info['open']),
|
||||
'comment' => $location_info['comment']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->post['name'])) {
|
||||
$data['name'] = $this->request->post['name'];
|
||||
} else {
|
||||
$data['name'] = $this->customer->getFirstName();
|
||||
}
|
||||
|
||||
if (isset($this->request->post['email'])) {
|
||||
$data['email'] = $this->request->post['email'];
|
||||
} else {
|
||||
$data['email'] = $this->customer->getEmail();
|
||||
}
|
||||
|
||||
if (isset($this->request->post['enquiry'])) {
|
||||
$data['enquiry'] = $this->request->post['enquiry'];
|
||||
} else {
|
||||
$data['enquiry'] = '';
|
||||
}
|
||||
|
||||
// Captcha
|
||||
if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
|
||||
$data['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'), $this->error);
|
||||
} else {
|
||||
$data['captcha'] = '';
|
||||
}
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('information/contact', $data));
|
||||
}
|
||||
|
||||
protected function validate() {
|
||||
if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
|
||||
$this->error['name'] = $this->language->get('error_name');
|
||||
}
|
||||
|
||||
if (!filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$this->error['email'] = $this->language->get('error_email');
|
||||
}
|
||||
|
||||
if ((utf8_strlen($this->request->post['enquiry']) < 10) || (utf8_strlen($this->request->post['enquiry']) > 3000)) {
|
||||
$this->error['enquiry'] = $this->language->get('error_enquiry');
|
||||
}
|
||||
|
||||
// Captcha
|
||||
if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
|
||||
$captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate');
|
||||
|
||||
if ($captcha) {
|
||||
$this->error['captcha'] = $captcha;
|
||||
}
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function success() {
|
||||
$this->load->language('information/contact');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
$data['button_continue'] = $this->language->get('button_continue');
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('information/contact')
|
||||
);
|
||||
|
||||
$data['text_message'] = $this->language->get('text_message');
|
||||
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('common/success', $data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerInformationInformation extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('information/information');
|
||||
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
if (isset($this->request->get['information_id'])) {
|
||||
$information_id = (int)$this->request->get['information_id'];
|
||||
} else {
|
||||
$information_id = 0;
|
||||
}
|
||||
|
||||
$information_info = $this->model_catalog_information->getInformation($information_id);
|
||||
|
||||
if ($information_info) {
|
||||
|
||||
if ($information_info['meta_title']) {
|
||||
$this->document->setTitle($information_info['meta_title']);
|
||||
} else {
|
||||
$this->document->setTitle($information_info['title']);
|
||||
}
|
||||
|
||||
if ($information_info['noindex'] <= 0 && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
|
||||
if ($information_info['meta_h1']) {
|
||||
$data['heading_title'] = $information_info['meta_h1'];
|
||||
} else {
|
||||
$data['heading_title'] = $information_info['title'];
|
||||
}
|
||||
|
||||
$this->document->setDescription($information_info['meta_description']);
|
||||
$this->document->setKeywords($information_info['meta_keyword']);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $information_info['title'],
|
||||
'href' => $this->url->link('information/information', 'information_id=' . $information_id)
|
||||
);
|
||||
|
||||
$data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('information/information', $data));
|
||||
} else {
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_error'),
|
||||
'href' => $this->url->link('information/information', 'information_id=' . $information_id)
|
||||
);
|
||||
|
||||
$this->document->setTitle($this->language->get('text_error'));
|
||||
|
||||
$data['heading_title'] = $this->language->get('text_error');
|
||||
|
||||
$data['text_error'] = $this->language->get('text_error');
|
||||
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
|
||||
$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('error/not_found', $data));
|
||||
}
|
||||
}
|
||||
|
||||
public function agree() {
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
if (isset($this->request->get['information_id'])) {
|
||||
$information_id = (int)$this->request->get['information_id'];
|
||||
} else {
|
||||
$information_id = 0;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
$information_info = $this->model_catalog_information->getInformation($information_id);
|
||||
|
||||
if ($information_info) {
|
||||
$output .= html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8') . "\n";
|
||||
}
|
||||
|
||||
$this->response->addHeader('X-Robots-Tag: noindex');
|
||||
|
||||
$this->response->setOutput($output);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
class ControllerInformationSitemap extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('information/sitemap');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('information/sitemap')
|
||||
);
|
||||
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$data['categories'] = array();
|
||||
|
||||
$categories_1 = $this->model_catalog_category->getCategories(0);
|
||||
|
||||
foreach ($categories_1 as $category_1) {
|
||||
$level_2_data = array();
|
||||
|
||||
$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
|
||||
|
||||
foreach ($categories_2 as $category_2) {
|
||||
$level_3_data = array();
|
||||
|
||||
$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
|
||||
|
||||
foreach ($categories_3 as $category_3) {
|
||||
$level_3_data[] = array(
|
||||
'name' => $category_3['name'],
|
||||
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$level_2_data[] = array(
|
||||
'name' => $category_2['name'],
|
||||
'children' => $level_3_data,
|
||||
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$data['categories'][] = array(
|
||||
'name' => $category_1['name'],
|
||||
'children' => $level_2_data,
|
||||
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$data['special'] = $this->url->link('product/special');
|
||||
$data['account'] = $this->url->link('account/account', '', true);
|
||||
$data['edit'] = $this->url->link('account/edit', '', true);
|
||||
$data['password'] = $this->url->link('account/password', '', true);
|
||||
$data['address'] = $this->url->link('account/address', '', true);
|
||||
$data['history'] = $this->url->link('account/order', '', true);
|
||||
$data['download'] = $this->url->link('account/download', '', true);
|
||||
$data['cart'] = $this->url->link('checkout/cart');
|
||||
$data['checkout'] = $this->url->link('checkout/checkout', '', true);
|
||||
$data['search'] = $this->url->link('product/search');
|
||||
$data['contact'] = $this->url->link('information/contact');
|
||||
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$data['informations'] = array();
|
||||
|
||||
foreach ($this->model_catalog_information->getInformations() as $result) {
|
||||
$data['informations'][] = array(
|
||||
'title' => $result['title'],
|
||||
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('information/sitemap', $data));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user