diff options
Diffstat (limited to 'public/admin/controller/extension/module')
26 files changed, 2960 insertions, 0 deletions
diff --git a/public/admin/controller/extension/module/account.php b/public/admin/controller/extension/module/account.php new file mode 100644 index 0000000..c424934 --- /dev/null +++ b/public/admin/controller/extension/module/account.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleAccount extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/account'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_account', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/account', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/account', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_account_status'])) { + $data['module_account_status'] = $this->request->post['module_account_status']; + } else { + $data['module_account_status'] = $this->config->get('module_account_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/account', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/account')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/amazon_login.php b/public/admin/controller/extension/module/amazon_login.php new file mode 100644 index 0000000..0247dfb --- /dev/null +++ b/public/admin/controller/extension/module/amazon_login.php @@ -0,0 +1,114 @@ +<?php +class ControllerExtensionModuleAmazonLogin extends Controller { + private $version = '3.1'; + private $error = array(); + + public function index() { + + $this->load->language('extension/module/amazon_login'); + + $this->load->model('setting/setting'); + $this->load->model('design/layout'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_amazon_login', $this->request->post); + + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_login'); + $this->model_setting_event->addEvent('amazon_login', 'catalog/controller/account/logout/after', 'extension/module/amazon_login/logout'); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['heading_title'] = $this->language->get('heading_title') . ' ' . $this->version; + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/amazon_login', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/amazon_login', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + $data['user_token'] = $this->session->data['user_token']; + + if (isset($this->request->post['module_amazon_login_button_type'])) { + $data['module_amazon_login_button_type'] = $this->request->post['module_amazon_login_button_type']; + } elseif ($this->config->get('module_amazon_login_button_type')) { + $data['module_amazon_login_button_type'] = $this->config->get('module_amazon_login_button_type'); + } else { + $data['module_amazon_login_button_type'] = 'LwA'; + } + + if (isset($this->request->post['module_amazon_login_button_colour'])) { + $data['module_amazon_login_button_colour'] = $this->request->post['module_amazon_login_button_colour']; + } elseif ($this->config->get('module_amazon_login_button_colour')) { + $data['module_amazon_login_button_colour'] = $this->config->get('module_amazon_login_button_colour'); + } else { + $data['module_amazon_login_button_colour'] = 'gold'; + } + + if (isset($this->request->post['module_amazon_login_button_size'])) { + $data['module_amazon_login_button_size'] = $this->request->post['module_amazon_login_button_size']; + } elseif ($this->config->get('module_amazon_login_button_size')) { + $data['module_amazon_login_button_size'] = $this->config->get('module_amazon_login_button_size'); + } else { + $data['module_amazon_login_button_size'] = 'medium'; + } + + if (isset($this->request->post['module_amazon_login_status'])) { + $data['module_amazon_login_status'] = $this->request->post['module_amazon_login_status']; + } else { + $data['module_amazon_login_status'] = $this->config->get('module_amazon_login_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/amazon_login', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/amazon_login')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } + + public function install() { + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_login'); + $this->model_setting_event->addEvent('amazon_login', 'catalog/controller/account/logout/after', 'extension/module/amazon_login/logout'); + } + + public function uninstall() { + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_login'); + } + +} diff --git a/public/admin/controller/extension/module/amazon_pay.php b/public/admin/controller/extension/module/amazon_pay.php new file mode 100644 index 0000000..441eabf --- /dev/null +++ b/public/admin/controller/extension/module/amazon_pay.php @@ -0,0 +1,115 @@ +<?php +class ControllerExtensionModuleAmazonPay extends Controller { + private $version = '3.1'; + private $error = array(); + + public function index() { + $this->load->language('extension/module/amazon_pay'); + + $this->load->model('setting/setting'); + $this->load->model('design/layout'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_amazon_pay', $this->request->post); + + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_pay'); + $this->model_setting_event->addEvent('amazon_pay', 'catalog/controller/account/logout/after', 'extension/module/amazon_pay/logout'); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['heading_title'] = $this->language->get('heading_title') . ' ' . $this->version; + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true), + 'separator' => false + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true), + 'separator' => ' :: ' + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/amazon_pay', 'user_token=' . $this->session->data['user_token'], true), + 'separator' => ' :: ' + ); + + $data['action'] = $this->url->link('extension/module/amazon_pay', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + $data['user_token'] = $this->session->data['user_token']; + + if (isset($this->request->post['module_amazon_pay_button_type'])) { + $data['module_amazon_pay_button_type'] = $this->request->post['module_amazon_pay_button_type']; + } elseif ($this->config->get('module_amazon_pay_button_type')) { + $data['module_amazon_pay_button_type'] = $this->config->get('module_amazon_pay_button_type'); + } else { + $data['module_amazon_pay_button_type'] = 'PwA'; + } + + if (isset($this->request->post['module_amazon_pay_button_colour'])) { + $data['module_amazon_pay_button_colour'] = $this->request->post['module_amazon_pay_button_colour']; + } elseif ($this->config->get('module_amazon_pay_button_colour')) { + $data['module_amazon_pay_button_colour'] = $this->config->get('module_amazon_pay_button_colour'); + } else { + $data['module_amazon_pay_button_colour'] = 'gold'; + } + + if (isset($this->request->post['module_amazon_pay_button_size'])) { + $data['module_amazon_pay_button_size'] = $this->request->post['module_amazon_pay_button_size']; + } elseif ($this->config->get('module_amazon_pay_button_size')) { + $data['module_amazon_pay_button_size'] = $this->config->get('module_amazon_pay_button_size'); + } else { + $data['module_amazon_pay_button_size'] = 'medium'; + } + + if (isset($this->request->post['module_amazon_pay_status'])) { + $data['module_amazon_pay_status'] = $this->request->post['module_amazon_pay_status']; + } else { + $data['module_amazon_pay_status'] = $this->config->get('module_amazon_pay_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/amazon_pay', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/amazon_pay')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } + + public function install() { + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_pay'); + } + + public function uninstall() { + $this->load->model('setting/event'); + $this->model_setting_event->deleteEventByCode('amazon_pay'); + } + +} diff --git a/public/admin/controller/extension/module/banner.php b/public/admin/controller/extension/module/banner.php new file mode 100644 index 0000000..a2e47e9 --- /dev/null +++ b/public/admin/controller/extension/module/banner.php @@ -0,0 +1,154 @@ +<?php +class ControllerExtensionModuleBanner extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/banner'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('banner', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['banner_id'])) { + $data['banner_id'] = $this->request->post['banner_id']; + } elseif (!empty($module_info)) { + $data['banner_id'] = $module_info['banner_id']; + } else { + $data['banner_id'] = ''; + } + + $this->load->model('design/banner'); + + $data['banners'] = $this->model_design_banner->getBanners(); + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = ''; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = ''; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/banner', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/banner')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/bestseller.php b/public/admin/controller/extension/module/bestseller.php new file mode 100644 index 0000000..3b5db39 --- /dev/null +++ b/public/admin/controller/extension/module/bestseller.php @@ -0,0 +1,152 @@ +<?php +class ControllerExtensionModuleBestSeller extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/bestseller'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('bestseller', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->cache->delete('product'); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['limit'])) { + $data['limit'] = $this->request->post['limit']; + } elseif (!empty($module_info)) { + $data['limit'] = $module_info['limit']; + } else { + $data['limit'] = 5; + } + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = 200; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = 200; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/bestseller', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/bestseller')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/carousel.php b/public/admin/controller/extension/module/carousel.php new file mode 100644 index 0000000..0d0c244 --- /dev/null +++ b/public/admin/controller/extension/module/carousel.php @@ -0,0 +1,158 @@ +<?php +class ControllerExtensionModuleCarousel extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/carousel'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('carousel', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['banner_id'])) { + $data['banner_id'] = $this->request->post['banner_id']; + } elseif (!empty($module_info)) { + $data['banner_id'] = $module_info['banner_id']; + } else { + $data['banner_id'] = ''; + } + + $this->load->model('design/banner'); + + $data['banners'] = $this->model_design_banner->getBanners(); + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = 130; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = 100; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $this->load->model('design/banner'); + + $data['banners'] = $this->model_design_banner->getBanners(); + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/carousel', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/carousel')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/category.php b/public/admin/controller/extension/module/category.php new file mode 100644 index 0000000..1eb9fe0 --- /dev/null +++ b/public/admin/controller/extension/module/category.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleCategory extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/category'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_category', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/category', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/category', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_category_status'])) { + $data['module_category_status'] = $this->request->post['module_category_status']; + } else { + $data['module_category_status'] = $this->config->get('module_category_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/category', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/category')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/divido_calculator.php b/public/admin/controller/extension/module/divido_calculator.php new file mode 100644 index 0000000..9442142 --- /dev/null +++ b/public/admin/controller/extension/module/divido_calculator.php @@ -0,0 +1,64 @@ +<?php +class ControllerExtensionModuleDividoCalculator extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/divido_calculator'); + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_divido_calculator', $this->request->post); + $this->session->data['success'] = $this->language->get('text_success'); + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/divido_calculator', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/divido_calculator', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_divido_calculator_status'])) { + $data['module_divido_calculator_status'] = $this->request->post['module_divido_calculator_status']; + } else { + $data['module_divido_calculator_status'] = $this->config->get('module_divido_calculator_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/divido_calculator', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/divido_calculator')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/ebay_listing.php b/public/admin/controller/extension/module/ebay_listing.php new file mode 100644 index 0000000..2446110 --- /dev/null +++ b/public/admin/controller/extension/module/ebay_listing.php @@ -0,0 +1,208 @@ +<?php +class ControllerExtensionModuleEbayListing extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/ebay_listing'); + + $this->document->setTitle($this->language->get('heading_title')); + $this->document->addScript('view/javascript/openbay/js/faq.js'); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_ebay_listing', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->cache->delete('ebay'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true), + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true), + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/ebay_listing', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/ebay_listing', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['ebay_listing_username'])) { + $data['ebay_listing_username'] = $this->request->post['ebay_listing_username']; + } else { + $data['ebay_listing_username'] = $this->config->get('ebay_listing_username'); + } + + if (isset($this->request->post['ebay_listing_keywords'])) { + $data['ebay_listing_keywords'] = $this->request->post['ebay_listing_keywords']; + } else { + $data['ebay_listing_keywords'] = $this->config->get('ebay_listing_keywords'); + } + + if (isset($this->request->post['ebay_listing_description'])) { + $data['ebay_listing_description'] = $this->request->post['ebay_listing_description']; + } else { + $data['ebay_listing_description'] = $this->config->get('ebay_listing_description'); + } + + if (isset($this->request->post['ebay_listing_limit'])) { + $data['ebay_listing_limit'] = $this->request->post['ebay_listing_limit']; + } elseif ($this->config->has('ebay_listing_limit')) { + $data['ebay_listing_limit'] = $this->config->get('ebay_listing_limit'); + } else { + $data['ebay_listing_limit'] = 5; + } + + if (isset($this->request->post['ebay_listing_width'])) { + $data['ebay_listing_width'] = $this->request->post['width']; + } elseif ($this->config->has('ebay_listing_width')) { + $data['ebay_listing_width'] = $this->config->get('ebay_listing_width'); + } else { + $data['ebay_listing_width'] = 200; + } + + if (isset($this->request->post['ebay_listing_height'])) { + $data['ebay_listing_height'] = $this->request->post['ebay_listing_height']; + } elseif ($this->config->has('ebay_listing_height')) { + $data['ebay_listing_height'] = $this->config->get('ebay_listing_height'); + } else { + $data['ebay_listing_height'] = 200; + } + + if (isset($this->request->post['ebay_listing_sort'])) { + $data['ebay_listing_sort'] = $this->request->post['ebay_listing_sort']; + } elseif ($this->config->has('ebay_listing_sort')) { + $data['ebay_listing_sort'] = $this->config->get('ebay_listing_sort'); + } else { + $data['ebay_listing_sort'] = 'StartTimeNewest'; + } + + if (isset($this->request->post['ebay_listing_site'])) { + $data['ebay_listing_site'] = $this->request->post['ebay_listing_site']; + } else { + $data['ebay_listing_site'] = $this->config->get('ebay_listing_site'); + } + + $data['sites'] = array(); + + $data['sites'][] = array( + 'text' => 'USA', + 'value' => 0 + ); + + $data['sites'][] = array( + 'text' => 'UK', + 'value' => 3 + ); + $data['sites'][] = array( + 'text' => 'Australia', + 'value' => 15 + ); + + $data['sites'][] = array( + 'text' => 'Canada (English)', + 'value' => 2 + ); + + $data['sites'][] = array( + 'text' => 'France', + 'value' => 71 + ); + $data['sites'][] = array( + 'text' => 'Germany', + 'value' => 77 + ); + $data['sites'][] = array( + 'text' => 'Italy', + 'value' => 101 + ); + $data['sites'][] = array( + 'text' => 'Spain', + 'value' => 186 + ); + $data['sites'][] = array( + 'text' => 'Ireland', + 'value' => 205 + ); + + $data['sites'][] = array( + 'text' => 'Austria', + 'value' => 16 + ); + + $data['sites'][] = array( + 'text' => 'Netherlands', + 'value' => 146 + ); + + $data['sites'][] = array( + 'text' => 'Belgium (French)', + 'value' => 23 + ); + + $data['sites'][] = array( + 'text' => 'Belgium (Dutch)', + 'value' => 123 + ); + + if (isset($this->request->post['ebay_listing_status'])) { + $data['ebay_listing_status'] = $this->request->post['ebay_listing_status']; + } else { + $data['ebay_listing_status'] = $this->config->get('ebay_listing_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/ebay_listing', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/ebay_listing')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['ebay_listing_width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['ebay_listing_height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/featured.php b/public/admin/controller/extension/module/featured.php new file mode 100644 index 0000000..d72d54e --- /dev/null +++ b/public/admin/controller/extension/module/featured.php @@ -0,0 +1,175 @@ +<?php +class ControllerExtensionModuleFeatured extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/featured'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('featured', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + $data['user_token'] = $this->session->data['user_token']; + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + $this->load->model('catalog/product'); + + $data['products'] = array(); + + if (!empty($this->request->post['product'])) { + $products = $this->request->post['product']; + } elseif (!empty($module_info['product'])) { + $products = $module_info['product']; + } else { + $products = array(); + } + + foreach ($products as $product_id) { + $product_info = $this->model_catalog_product->getProduct($product_id); + + if ($product_info) { + $data['products'][] = array( + 'product_id' => $product_info['product_id'], + 'name' => $product_info['name'] + ); + } + } + + if (isset($this->request->post['limit'])) { + $data['limit'] = $this->request->post['limit']; + } elseif (!empty($module_info)) { + $data['limit'] = $module_info['limit']; + } else { + $data['limit'] = 5; + } + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = 200; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = 200; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/featured', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/featured')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/filter.php b/public/admin/controller/extension/module/filter.php new file mode 100644 index 0000000..0b0170a --- /dev/null +++ b/public/admin/controller/extension/module/filter.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModulefilter extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/filter'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_filter', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/filter', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/filter', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_filter_status'])) { + $data['module_filter_status'] = $this->request->post['module_filter_status']; + } else { + $data['module_filter_status'] = $this->config->get('module_filter_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/filter', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/filter')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/google_hangouts.php b/public/admin/controller/extension/module/google_hangouts.php new file mode 100644 index 0000000..8f6058f --- /dev/null +++ b/public/admin/controller/extension/module/google_hangouts.php @@ -0,0 +1,83 @@ +<?php +class ControllerExtensionModuleGoogleHangouts extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/google_hangouts'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_google_hangouts', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['code'])) { + $data['error_code'] = $this->error['code']; + } else { + $data['error_code'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/google_hangouts', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/google_hangouts', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_google_hangouts_code'])) { + $data['module_google_hangouts_code'] = $this->request->post['module_google_hangouts_code']; + } else { + $data['module_google_hangouts_code'] = $this->config->get('module_google_hangouts_code'); + } + + if (isset($this->request->post['module_google_hangouts_status'])) { + $data['module_google_hangouts_status'] = $this->request->post['module_google_hangouts_status']; + } else { + $data['module_google_hangouts_status'] = $this->config->get('module_google_hangouts_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/google_hangouts', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/google_hangouts')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['module_google_hangouts_code']) { + $this->error['code'] = $this->language->get('error_code'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/html.php b/public/admin/controller/extension/module/html.php new file mode 100644 index 0000000..f34cace --- /dev/null +++ b/public/admin/controller/extension/module/html.php @@ -0,0 +1,118 @@ +<?php +class ControllerExtensionModuleHTML extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/html'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('html', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['module_description'])) { + $data['module_description'] = $this->request->post['module_description']; + } elseif (!empty($module_info)) { + $data['module_description'] = $module_info['module_description']; + } else { + $data['module_description'] = array(); + } + + $this->load->model('localisation/language'); + + $data['languages'] = $this->model_localisation_language->getLanguages(); + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/html', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/html')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/information.php b/public/admin/controller/extension/module/information.php new file mode 100644 index 0000000..107aa3f --- /dev/null +++ b/public/admin/controller/extension/module/information.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleInformation extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/information'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_information', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/information', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/information', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_information_status'])) { + $data['module_information_status'] = $this->request->post['module_information_status']; + } else { + $data['module_information_status'] = $this->config->get('module_information_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/information', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/information')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/klarna_checkout_module.php b/public/admin/controller/extension/module/klarna_checkout_module.php new file mode 100644 index 0000000..9d0b200 --- /dev/null +++ b/public/admin/controller/extension/module/klarna_checkout_module.php @@ -0,0 +1,72 @@ +<?php +class ControllerExtensionModuleKlarnaCheckoutModule extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/klarna_checkout_module'); + + $this->load->model('extension/payment/klarna_checkout'); + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_klarna_checkout_module', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/klarna_checkout_module', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/klarna_checkout_module', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_klarna_checkout_status'])) { + $data['module_klarna_checkout_status'] = $this->request->post['module_klarna_checkout_status']; + } else { + $data['module_klarna_checkout_status'] = $this->config->get('module_klarna_checkout_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/klarna_checkout_module', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/klarna_checkout_module')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->error) { + return true; + } else { + return false; + } + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/latest.php b/public/admin/controller/extension/module/latest.php new file mode 100644 index 0000000..f01f34e --- /dev/null +++ b/public/admin/controller/extension/module/latest.php @@ -0,0 +1,152 @@ +<?php +class ControllerExtensionModuleLatest extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/latest'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('latest', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->cache->delete('product'); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['limit'])) { + $data['limit'] = $this->request->post['limit']; + } elseif (!empty($module_info)) { + $data['limit'] = $module_info['limit']; + } else { + $data['limit'] = 5; + } + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = 200; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = 200; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/latest', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/latest')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/laybuy_layout.php b/public/admin/controller/extension/module/laybuy_layout.php new file mode 100644 index 0000000..bb34b4e --- /dev/null +++ b/public/admin/controller/extension/module/laybuy_layout.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleLaybuyLayout extends Controller { + private $error = array(); + + public function index() { + $this->load->model('setting/setting'); + + $this->load->language('extension/module/laybuy_layout'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_laybuy_layout', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/laybuy_layout', 'user_token=' . $this->session->data['user_token'], true) + ); + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['action'] = $this->url->link('extension/module/laybuy_layout', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_laybuy_layout_status'])) { + $data['module_laybuy_layout_status'] = $this->request->post['module_laybuy_layout_status']; + } else { + $data['module_laybuy_layout_status'] = $this->config->get('module_laybuy_layout_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/laybuy_layout', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/laybuy_layout')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/pilibaba_button.php b/public/admin/controller/extension/module/pilibaba_button.php new file mode 100644 index 0000000..1948588 --- /dev/null +++ b/public/admin/controller/extension/module/pilibaba_button.php @@ -0,0 +1,65 @@ +<?php +class ControllerExtensionModulePilibabaButton extends Controller { + public function index() { + $this->load->language('extension/module/pilibaba_button'); + + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_pilibaba_button', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/pilibaba_button', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/pilibaba_button', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_pilibaba_button_status'])) { + $data['module_pilibaba_button_status'] = $this->request->post['module_pilibaba_button_status']; + } else { + $data['module_pilibaba_button_status'] = $this->config->get('module_pilibaba_button_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/pilibaba_button', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/pilibaba_button')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/pp_braintree_button.php b/public/admin/controller/extension/module/pp_braintree_button.php new file mode 100644 index 0000000..bce800a --- /dev/null +++ b/public/admin/controller/extension/module/pp_braintree_button.php @@ -0,0 +1,93 @@ +<?php +class ControllerExtensionModulePPBraintreeButton extends Controller { + public function index() { + $this->load->language('extension/module/pp_braintree_button'); + + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_pp_braintree_button', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/pp_braintree_button', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/pp_braintree_button', 'user_token=' . $this->session->data['user_token'], true); + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + $data['layouts'] = $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true); + + if (isset($this->request->post['module_pp_braintree_button_status'])) { + $data['module_pp_braintree_button_status'] = $this->request->post['module_pp_braintree_button_status']; + } else { + $data['module_pp_braintree_button_status'] = $this->config->get('module_pp_braintree_button_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/pp_braintree_button', $data)); + } + + public function install() { + $this->load->model('setting/setting'); + + $settings['module_pp_braintree_button_status'] = 1; + + $this->model_setting_setting->editSetting('module_pp_braintree_button', $settings); + } + + public function configure() { + $this->load->language('extension/extension/module'); + + if (!$this->user->hasPermission('modify', 'extension/extension/module')) { + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true)); + } else { + $this->load->model('setting/extension'); + $this->load->model('user/user_group'); + + $this->model_setting_extension->install('module', 'pp_braintree_button'); + + $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/pp_braintree_button'); + $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/pp_braintree_button'); + + $this->install(); + + $this->response->redirect($this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true)); + } + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/pp_braintree_button')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/pp_button.php b/public/admin/controller/extension/module/pp_button.php new file mode 100644 index 0000000..5ca281d --- /dev/null +++ b/public/admin/controller/extension/module/pp_button.php @@ -0,0 +1,94 @@ +<?php +class ControllerExtensionModulePPButton extends Controller { + public function index() { + $this->load->language('extension/module/pp_button'); + + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_pp_button', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/pp_button', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/pp_button', 'user_token=' . $this->session->data['user_token'], true); + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + $data['layouts'] = $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true); + + if (isset($this->request->post['module_pp_button_status'])) { + $data['module_pp_button_status'] = $this->request->post['module_pp_button_status']; + } else { + $data['module_pp_button_status'] = $this->config->get('module_pp_button_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/pp_button', $data)); + } + + public function install() { + $this->load->model('setting/setting'); + + $settings['module_pp_button_status'] = 1; + + $this->model_setting_setting->editSetting('module_pp_button', $settings); + } + + public function configure() { + $this->load->language('extension/extension/module'); + + if (!$this->user->hasPermission('modify', 'extension/extension/module')) { + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true)); + } else { + $this->load->model('setting/extension'); + $this->load->model('user/user_group'); + + $this->model_setting_extension->install('module', 'pp_button'); + + $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/pp_button'); + $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/pp_button'); + + $this->install(); + + $this->response->redirect($this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true)); + } + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/pp_button')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/pp_login.php b/public/admin/controller/extension/module/pp_login.php new file mode 100644 index 0000000..c174cd6 --- /dev/null +++ b/public/admin/controller/extension/module/pp_login.php @@ -0,0 +1,295 @@ +<?php +class ControllerExtensionModulePPLogin extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/pp_login'); + + $this->load->model('setting/setting'); + + $this->document->setTitle($this->language->get('heading_title')); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_pp_login', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['client_id'])) { + $data['error_client_id'] = $this->error['client_id']; + } else { + $data['error_client_id'] = ''; + } + + if (isset($this->error['secret'])) { + $data['error_secret'] = $this->error['secret']; + } else { + $data['error_secret'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/pp_login', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/pp_login', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_pp_login_client_id'])) { + $data['module_pp_login_client_id'] = $this->request->post['module_pp_login_client_id']; + } else { + $data['module_pp_login_client_id'] = $this->config->get('module_pp_login_client_id'); + } + + if (isset($this->request->post['module_pp_login_secret'])) { + $data['module_pp_login_secret'] = $this->request->post['module_pp_login_secret']; + } else { + $data['module_pp_login_secret'] = $this->config->get('module_pp_login_secret'); + } + + if (isset($this->request->post['module_pp_login_sandbox'])) { + $data['module_pp_login_sandbox'] = $this->request->post['module_pp_login_sandbox']; + } else { + $data['module_pp_login_sandbox'] = $this->config->get('module_pp_login_sandbox'); + } + + if (isset($this->request->post['module_pp_login_debug'])) { + $data['module_pp_login_debug'] = $this->request->post['module_pp_login_debug']; + } else { + $data['module_pp_login_debug'] = $this->config->get('module_pp_login_debug'); + } + + $this->load->model('customer/customer_group'); + + $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); + + if (isset($this->request->post['module_pp_login_customer_group_id'])) { + $data['module_pp_login_customer_group_id'] = $this->request->post['module_pp_login_customer_group_id']; + } else { + $data['module_pp_login_customer_group_id'] = $this->config->get('module_pp_login_customer_group_id'); + } + + if (isset($this->request->post['module_pp_login_button_colour'])) { + $data['module_pp_login_button_colour'] = $this->request->post['module_pp_login_button_colour']; + } elseif ($this->config->get('module_pp_login_button_colour')) { + $data['module_pp_login_button_colour'] = $this->config->get('module_pp_login_button_colour'); + } else { + $data['module_pp_login_button_colour'] = 'blue'; + } + + if (isset($this->request->post['module_pp_login_seamless'])) { + $data['module_pp_login_seamless'] = $this->request->post['module_pp_login_seamless']; + } else { + $data['module_pp_login_seamless'] = $this->config->get('module_pp_login_seamless'); + } + + $this->load->model('localisation/language'); + + $data['languages'] = $this->model_localisation_language->getLanguages(); + + $data['locales'] = array(); + + $data['locales'][] = array( + 'value' => 'en-gb', + 'text' => 'English (Great Britain)' + ); + + $data['locales'][] = array( + 'value' => 'zh-cn', + 'text' => 'Chinese (People\'s Republic of China)' + ); + + $data['locales'][] = array( + 'value' => 'zh-hk', + 'text' => 'Chinese (Hong Kong)', + ); + + $data['locales'][] = array( + 'value' => 'zh-tw', + 'text' => 'Chinese (Taiwan)' + ); + + $data['locales'][] = array( + 'value' => 'zh-xc', + 'text' => 'Chinese (US)' + ); + + $data['locales'][] = array( + 'value' => 'da-dk', + 'text' => 'Danish' + ); + + $data['locales'][] = array( + 'value' => 'nl-nl', + 'text' => 'Dutch' + ); + + $data['locales'][] = array( + 'value' => 'en-au', + 'text' => 'English (Australia)' + ); + + $data['locales'][] = array( + 'value' => 'en-us', + 'text' => 'English (US)', + ); + + $data['locales'][] = array( + 'value' => 'fr-fr', + 'text' => 'French' + ); + + $data['locales'][] = array( + 'value' => 'fr-ca', + 'text' => 'French (Canada)' + ); + + $data['locales'][] = array( + 'value' => 'fr-xc', + 'text' => 'French (international)' + ); + + $data['locales'][] = array( + 'value' => 'de-de', + 'text' => 'German' + ); + + $data['locales'][] = array( + 'value' => 'he-il', + 'text' => 'Hebrew (Israel)' + ); + + $data['locales'][] = array( + 'value' => 'id-id', + 'text' => 'Indonesian' + ); + + $data['locales'][] = array( + 'value' => 'it-il', + 'text' => 'Italian' + ); + + $data['locales'][] = array( + 'value' => 'ja-jp' , + 'text' => 'Japanese' + ); + + $data['locales'][] = array( + 'value' => 'no-no', + 'text' => 'Norwegian' + ); + + $data['locales'][] = array( + 'value' => 'pl-pl', + 'text' => 'Polish'); + + $data['locales'][] = array( + 'value' => 'pt-pt', + 'text' => 'Portuguese' + ); + + $data['locales'][] = array( + 'value' => 'pt-br', + 'text' => 'Portuguese (Brazil)' + ); + + $data['locales'][] = array( + 'value' => 'ru-ru', + 'text' => 'Russian' + ); + + $data['locales'][] = array( + 'value' => 'es-es', + 'text' => 'Spanish' + ); + + $data['locales'][] = array( + 'value' => 'es-xc', + 'text' => 'Spanish (Mexico)' + ); + + $data['locales'][] = array( + 'value' => 'sv-se', + 'text' => 'Swedish' + ); + + $data['locales'][] = array( + 'value' => 'th-th', + 'text' => 'Thai' + ); + + $data['locales'][] = array( + 'value' => 'tr-tr', + 'text' => 'Turkish' + ); + + if (isset($this->request->post['module_pp_login_locale'])) { + $data['module_pp_login_locale'] = $this->request->post['module_pp_login_locale']; + } else { + $data['module_pp_login_locale'] = $this->config->get('module_pp_login_locale'); + } + + $data['return_url'] = HTTPS_CATALOG . 'index.php?route=extension/module/pp_login/login'; + + if (isset($this->request->post['module_pp_login_status'])) { + $data['module_pp_login_status'] = $this->request->post['module_pp_login_status']; + } else { + $data['module_pp_login_status'] = $this->config->get('module_pp_login_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/pp_login', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/pp_login')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['module_pp_login_client_id']) { + $this->error['client_id'] = $this->language->get('error_client_id'); + } + + if (!$this->request->post['module_pp_login_secret']) { + $this->error['secret'] = $this->language->get('error_secret'); + } + + return !$this->error; + } + + public function install() { + $this->load->model('marketplace/event'); + + $this->model_setting_event->addEvent('pp_login', 'catalog/controller/account/logout/after', 'extension/module/pp_login/logout'); + } + + public function uninstall() { + $this->load->model('marketplace/event'); + + $this->model_setting_event->deleteEventByCode('pp_login'); + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/sagepay_direct_cards.php b/public/admin/controller/extension/module/sagepay_direct_cards.php new file mode 100644 index 0000000..ae5b188 --- /dev/null +++ b/public/admin/controller/extension/module/sagepay_direct_cards.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleSagepayDirectCards extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/sagepay_direct_cards'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_sagepay_direct_cards', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/sagepay_direct_cards', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/sagepay_direct_cards', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_sagepay_direct_cards_status'])) { + $data['module_sagepay_direct_cards_status'] = $this->request->post['module_sagepay_direct_cards_status']; + } else { + $data['module_sagepay_direct_cards_status'] = $this->config->get('module_sagepay_direct_cards_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/sagepay_direct_cards', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/sagepay_direct_cards')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/sagepay_server_cards.php b/public/admin/controller/extension/module/sagepay_server_cards.php new file mode 100644 index 0000000..1b8a480 --- /dev/null +++ b/public/admin/controller/extension/module/sagepay_server_cards.php @@ -0,0 +1,67 @@ +<?php +class ControllerExtensionModuleSagepayServerCards extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/sagepay_server_cards'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_sagepay_server_cards', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/sagepay_server_cards', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/sagepay_server_cards', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_sagepay_server_cards_status'])) { + $data['module_sagepay_server_cards_status'] = $this->request->post['module_sagepay_server_cards_status']; + } else { + $data['module_sagepay_server_cards_status'] = $this->config->get('module_sagepay_server_cards_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/sagepay_server_cards', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/sagepay_server_cards')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/slideshow.php b/public/admin/controller/extension/module/slideshow.php new file mode 100644 index 0000000..dc31c00 --- /dev/null +++ b/public/admin/controller/extension/module/slideshow.php @@ -0,0 +1,154 @@ +<?php +class ControllerExtensionModuleSlideshow extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/slideshow'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('slideshow', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['banner_id'])) { + $data['banner_id'] = $this->request->post['banner_id']; + } elseif (!empty($module_info)) { + $data['banner_id'] = $module_info['banner_id']; + } else { + $data['banner_id'] = ''; + } + + $this->load->model('design/banner'); + + $data['banners'] = $this->model_design_banner->getBanners(); + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = ''; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = ''; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/slideshow', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/slideshow')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/module/special.php b/public/admin/controller/extension/module/special.php new file mode 100644 index 0000000..ef86dd3 --- /dev/null +++ b/public/admin/controller/extension/module/special.php @@ -0,0 +1,152 @@ +<?php +class ControllerExtensionModuleSpecial extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/special'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/module'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + if (!isset($this->request->get['module_id'])) { + $this->model_setting_module->addModule('special', $this->request->post); + } else { + $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post); + } + + $this->cache->delete('product'); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['name'])) { + $data['error_name'] = $this->error['name']; + } else { + $data['error_name'] = ''; + } + + if (isset($this->error['width'])) { + $data['error_width'] = $this->error['width']; + } else { + $data['error_width'] = ''; + } + + if (isset($this->error['height'])) { + $data['error_height'] = $this->error['height']; + } else { + $data['error_height'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + if (!isset($this->request->get['module_id'])) { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'], true) + ); + } else { + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true) + ); + } + + if (!isset($this->request->get['module_id'])) { + $data['action'] = $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'], true); + } else { + $data['action'] = $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true); + } + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { + $module_info = $this->model_setting_module->getModule($this->request->get['module_id']); + } + + if (isset($this->request->post['name'])) { + $data['name'] = $this->request->post['name']; + } elseif (!empty($module_info)) { + $data['name'] = $module_info['name']; + } else { + $data['name'] = ''; + } + + if (isset($this->request->post['limit'])) { + $data['limit'] = $this->request->post['limit']; + } elseif (!empty($module_info)) { + $data['limit'] = $module_info['limit']; + } else { + $data['limit'] = 5; + } + + if (isset($this->request->post['width'])) { + $data['width'] = $this->request->post['width']; + } elseif (!empty($module_info)) { + $data['width'] = $module_info['width']; + } else { + $data['width'] = 200; + } + + if (isset($this->request->post['height'])) { + $data['height'] = $this->request->post['height']; + } elseif (!empty($module_info)) { + $data['height'] = $module_info['height']; + } else { + $data['height'] = 200; + } + + if (isset($this->request->post['status'])) { + $data['status'] = $this->request->post['status']; + } elseif (!empty($module_info)) { + $data['status'] = $module_info['status']; + } else { + $data['status'] = ''; + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/special', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/special')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) { + $this->error['name'] = $this->language->get('error_name'); + } + + if (!$this->request->post['width']) { + $this->error['width'] = $this->language->get('error_width'); + } + + if (!$this->request->post['height']) { + $this->error['height'] = $this->language->get('error_height'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/module/store.php b/public/admin/controller/extension/module/store.php new file mode 100644 index 0000000..cad1dd9 --- /dev/null +++ b/public/admin/controller/extension/module/store.php @@ -0,0 +1,73 @@ +<?php +class ControllerExtensionModuleStore extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/module/store'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('module_store', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/module/store', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/module/store', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); + + if (isset($this->request->post['module_store_admin'])) { + $data['module_store_admin'] = $this->request->post['module_store_admin']; + } else { + $data['module_store_admin'] = $this->config->get('module_store_admin'); + } + + if (isset($this->request->post['module_store_status'])) { + $data['module_store_status'] = $this->request->post['module_store_status']; + } else { + $data['module_store_status'] = $this->config->get('module_store_status'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/module/store', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/module/store')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file |