Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ControllerPaymentIcicipg extends Controller {
- private $error = array();
- public function index() {
- $this->language->load('payment/icicipg');
- $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('icicipg', $this->request->post);
- $this->session->data['success'] = $this->language->get('text_success');
- $this->redirect($this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'));
- }
- $data['heading_title'] = $this->language->get('heading_title');
- $data['text_enabled'] = $this->language->get('text_enabled');
- $data['text_disabled'] = $this->language->get('text_disabled');
- $data['text_all_zones'] = $this->language->get('text_all_zones');
- $data['text_yes'] = $this->language->get('text_yes');
- $data['text_no'] = $this->language->get('text_no');
- $data['text_edit'] = $this->language->get('text_edit');
- $data['entry_MID'] = $this->language->get('entry_MID');
- $data['entry_total'] = $this->language->get('entry_total');
- $data['entry_success_status'] = $this->language->get('entry_success_status');
- $data['entry_pending_status'] = $this->language->get('entry_pending_status');
- $data['entry_failed_status'] = $this->language->get('entry_failed_status');
- $data['entry_RedirectURL'] = $this->language->get('entry_RedirectURL');
- $data['entry_keyfile'] = $this->language->get('entry_keyfile');
- $data['entry_geo_zone'] = $this->language->get('entry_geo_zone');
- $data['entry_status'] = $this->language->get('entry_status');
- $data['entry_sort_order'] = $this->language->get('entry_sort_order');
- //$data['entry_order_prefix'] = $this->language->get('entry_order_prefix');
- $data['entry_tts'] = $this->language->get('entry_tts');
- $data['help_tts'] = $this->language->get('help_tts');
- $data['help_total'] = $this->language->get('help_total');
- $data['help_RedirectURL'] = $this->language->get('help_RedirectURL');
- $data['button_save'] = $this->language->get('button_save');
- $data['button_cancel'] = $this->language->get('button_cancel');
- if (isset($this->error['warning'])) {
- $data['error_warning'] = $this->error['warning'];
- } else {
- $data['error_warning'] = '';
- }
- if (isset($this->error['MID'])) {
- $data['error_MID'] = $this->error['MID'];
- } else {
- $data['error_MID'] = '';
- }
- if (isset($this->error['RedirectURL'])) {
- $data['error_RedirectURL'] = $this->error['RedirectURL'];
- } else {
- $data['error_RedirectURL'] = '';
- }
- if (isset($this->error['keyfile'])) {
- $data['error_keyfile'] = $this->error['keyfile'];
- } else {
- $data['error_keyfile'] = '';
- }
- /*if (isset($this->error['order_prefix'])) {
- $data['error_order_prefix'] = $this->error['order_prefix'];
- } else {
- $data['error_order_prefix'] = '';
- }*/
- if (isset($this->error['tts'])) {
- $data['error_tts'] = $this->error['tts'];
- } else {
- $data['error_tts'] = '';
- }
- $data['breadcrumbs'] = array();
- $data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_home'),
- 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
- 'separator' => false
- );
- $data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_payment'),
- 'href' => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'),
- 'separator' => ' :: '
- );
- $data['breadcrumbs'][] = array(
- 'text' => $this->language->get('heading_title'),
- 'href' => $this->url->link('payment/icicipg', 'token=' . $this->session->data['token'], 'SSL'),
- 'separator' => ' :: '
- );
- $data['action'] = $this->url->link('payment/icicipg', 'token=' . $this->session->data['token'], 'SSL');
- $data['cancel'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');
- if (isset($this->request->post['icicipg_MID'])) {
- $data['icicipg_MID'] = $this->request->post['icicipg_MID'];
- } else {
- $data['icicipg_MID'] = $this->config->get('icicipg_MID');
- }
- /*if (isset($this->request->post['cc_RedirectURL'])) {
- $data['cc_RedirectURL'] = $this->request->post['cc_RedirectURL'];
- } else {
- $data['cc_RedirectURL'] = $this->config->get('cc_RedirectURL');
- }*/
- $data['icicipg_RedirectURL'] = HTTP_CATALOG . 'index.php?route=payment/icicipg/callback';
- /*if (isset($this->request->post['icicipg_Wkey'])) {
- $data['icicipg_Wkey'] = $this->request->post['icicipg_Wkey'];
- } else {
- $data['icicipg_Wkey'] = $this->config->get('icicipg_Wkey');
- }*/
- if (isset($this->request->post['icicipg_total'])) {
- $data['icicipg_total'] = $this->request->post['icicipg_total'];
- } else {
- $data['icicipg_total'] = $this->config->get('icicipg_total');
- }
- if (isset($this->request->post['icicipg_success_status_id'])) {
- $data['icicipg_success_status_id'] = $this->request->post['icicipg_success_status_id'];
- } else {
- $data['icicipg_success_status_id'] = $this->config->get('icicipg_success_status_id');
- }
- if (isset($this->request->post['icicipg_failed_status_id'])) {
- $data['icicipg_failed_status_id'] = $this->request->post['icicipg_failed_status_id'];
- } else {
- $data['icicipg_failed_status_id'] = $this->config->get('icicipg_failed_status_id');
- }
- $this->load->model('localisation/order_status');
- $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
- if (isset($this->request->post['icicipg_geo_zone_id'])) {
- $data['icicipg_geo_zone_id'] = $this->request->post['icicipg_geo_zone_id'];
- } else {
- $data['icicipg_geo_zone_id'] = $this->config->get('icicipg_geo_zone_id');
- }
- $this->load->model('localisation/geo_zone');
- $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
- if (isset($this->request->post['icicipg_status'])) {
- $data['icicipg_status'] = $this->request->post['icicipg_status'];
- } else {
- $data['icicipg_status'] = $this->config->get('icicipg_status');
- }
- if (isset($this->request->post['icicipg_sort_order'])) {
- $data['icicipg_sort_order'] = $this->request->post['icicipg_sort_order'];
- } else {
- $data['icicipg_sort_order'] = $this->config->get('icicipg_sort_order');
- }
- /*if (isset($this->request->post['icicipg_order_prefix'])) {
- $data['icicipg_order_prefix'] = $this->request->post['icicipg_order_prefix'];
- } else {
- $data['icicipg_order_prefix'] = $this->config->get('icicipg_order_prefix');
- }*/
- if (isset($this->request->post['icicipg_tts'])) {
- $data['icicipg_tts'] = $this->request->post['icicipg_tts'];
- } else {
- $data['icicipg_tts'] = $this->config->get('icicipg_tts');
- }
- $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->render());
- $this->response->setOutput($this->load->view('payment/icicipg.tpl', $data));
- }
- private function validate() {
- if (!$this->user->hasPermission('modify', 'payment/icicipg')) {
- $this->error['warning'] = $this->language->get('error_permission');
- }
- if (!$this->request->post['icicipg_MID']) {
- $this->error['MID'] = $this->language->get('error_MID');
- }
- if (!$this->request->post['icicipg_RedirectURL']) {
- $this->error['RedirectURL'] = $this->language->get('error_RedirectURL');
- }
- /*if (!$this->request->post['icicipg_order_prefix'] || strlen($this->request->post['icicipg_order_prefix'])!=2 ) {
- $this->error['order_prefix'] = $this->language->get('error_order_prefix');
- }*/
- if (!$this->request->post['icicipg_tts']) {
- $this->error['tts'] = $this->language->get('error_tts');
- }
- if ((isset( $this->request->files['upload'] )) && (is_uploaded_file($this->request->files['upload']['tmp_name']))) {
- //$file = $this->request->files['upload']['tmp_name'];
- if($this->request->files['upload']['name']==$this->request->post['icicipg_MID'] . '.key'){
- move_uploaded_file($this->request->files['upload']['tmp_name'], substr(DIR_SYSTEM,0,strlen(DIR_SYSTEM)-7) . 'Sfa/' . $this->request->post['icicipg_MID'] . '.key');
- } else {
- $this->error['keyfile'] = $this->language->get('error_keyfile2');
- }
- //$file = substr(DIR_SYSTEM,0,strlen(DIR_SYSTEM)-7) . 'Sfa/' . $this->request->post['icicipg_MID'] . '.key';
- } else {
- if (!file_exists(substr(DIR_SYSTEM,0,strlen(DIR_SYSTEM)-7) . 'Sfa/' . $this->request->post['icicipg_MID'] . '.key')) {
- $this->error['keyfile'] = $this->language->get('error_keyfile');
- }
- }
- /*
- $this->error['keyfile'] = $this->language->get('error_keyfile');
- }*/
- if (!$this->error) {
- return true;
- } else {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement