shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

pp_pro.php (6069B)


      1 <?php
      2 class ControllerExtensionPaymentPPPro extends Controller {
      3 	private $error = array();
      4 
      5 	public function index() {
      6 		$this->load->language('extension/payment/pp_pro');
      7 
      8 		$this->document->setTitle($this->language->get('heading_title'));
      9 
     10 		$this->load->model('setting/setting');
     11 
     12 		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
     13 			$this->model_setting_setting->editSetting('payment_pp_pro', $this->request->post);
     14 
     15 			$this->session->data['success'] = $this->language->get('text_success');
     16 
     17 			$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true));
     18 		}
     19 
     20 		if (isset($this->error['warning'])) {
     21 			$data['error_warning'] = $this->error['warning'];
     22 		} else {
     23 			$data['error_warning'] = '';
     24 		}
     25 
     26 		if (isset($this->error['username'])) {
     27 			$data['error_username'] = $this->error['username'];
     28 		} else {
     29 			$data['error_username'] = '';
     30 		}
     31 
     32 		if (isset($this->error['password'])) {
     33 			$data['error_password'] = $this->error['password'];
     34 		} else {
     35 			$data['error_password'] = '';
     36 		}
     37 
     38 		if (isset($this->error['signature'])) {
     39 			$data['error_signature'] = $this->error['signature'];
     40 		} else {
     41 			$data['error_signature'] = '';
     42 		}
     43 
     44 		$data['breadcrumbs'] = array();
     45 
     46 		$data['breadcrumbs'][] = array(
     47 			'text' => $this->language->get('text_home'),
     48 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
     49 		);
     50 
     51 		$data['breadcrumbs'][] = array(
     52 			'text' => $this->language->get('text_extension'),
     53 			'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true)
     54 		);
     55 
     56 		$data['breadcrumbs'][] = array(
     57 			'text' => $this->language->get('heading_title'),
     58 			'href' => $this->url->link('extension/payment/pp_pro', 'user_token=' . $this->session->data['user_token'], true)
     59 		);
     60 
     61 		$data['action'] = $this->url->link('extension/payment/pp_pro', 'user_token=' . $this->session->data['user_token'], true);
     62 
     63 		$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true);
     64 
     65 		if (isset($this->request->post['payment_pp_pro_username'])) {
     66 			$data['payment_pp_pro_username'] = $this->request->post['payment_pp_pro_username'];
     67 		} else {
     68 			$data['payment_pp_pro_username'] = $this->config->get('payment_pp_pro_username');
     69 		}
     70 
     71 		if (isset($this->request->post['payment_pp_pro_password'])) {
     72 			$data['payment_pp_pro_password'] = $this->request->post['payment_pp_pro_password'];
     73 		} else {
     74 			$data['payment_pp_pro_password'] = $this->config->get('payment_pp_pro_password');
     75 		}
     76 
     77 		if (isset($this->request->post['payment_pp_pro_signature'])) {
     78 			$data['payment_pp_pro_signature'] = $this->request->post['payment_pp_pro_signature'];
     79 		} else {
     80 			$data['payment_pp_pro_signature'] = $this->config->get('payment_pp_pro_signature');
     81 		}
     82 
     83 		if (isset($this->request->post['payment_pp_pro_test'])) {
     84 			$data['payment_pp_pro_test'] = $this->request->post['payment_pp_pro_test'];
     85 		} else {
     86 			$data['payment_pp_pro_test'] = $this->config->get('payment_pp_pro_test');
     87 		}
     88 
     89 		if (isset($this->request->post['payment_pp_pro_transaction'])) {
     90 			$data['payment_pp_pro_transaction'] = $this->request->post['payment_pp_pro_transaction'];
     91 		} else {
     92 			$data['payment_pp_pro_transaction'] = $this->config->get('payment_pp_pro_transaction');
     93 		}
     94 
     95 		if (isset($this->request->post['payment_pp_pro_total'])) {
     96 			$data['payment_pp_pro_total'] = $this->request->post['payment_pp_pro_total'];
     97 		} else {
     98 			$data['payment_pp_pro_total'] = $this->config->get('payment_pp_pro_total');
     99 		}
    100 
    101 		if (isset($this->request->post['payment_pp_pro_order_status_id'])) {
    102 			$data['payment_pp_pro_order_status_id'] = $this->request->post['payment_pp_pro_order_status_id'];
    103 		} else {
    104 			$data['payment_pp_pro_order_status_id'] = $this->config->get('payment_pp_pro_order_status_id');
    105 		}
    106 
    107 		$this->load->model('localisation/order_status');
    108 
    109 		$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
    110 
    111 		if (isset($this->request->post['payment_pp_pro_geo_zone_id'])) {
    112 			$data['payment_pp_pro_geo_zone_id'] = $this->request->post['payment_pp_pro_geo_zone_id'];
    113 		} else {
    114 			$data['payment_pp_pro_geo_zone_id'] = $this->config->get('payment_pp_pro_geo_zone_id');
    115 		}
    116 
    117 		$this->load->model('localisation/geo_zone');
    118 
    119 		$data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
    120 
    121 		if (isset($this->request->post['payment_pp_pro_status'])) {
    122 			$data['payment_pp_pro_status'] = $this->request->post['payment_pp_pro_status'];
    123 		} else {
    124 			$data['payment_pp_pro_status'] = $this->config->get('payment_pp_pro_status');
    125 		}
    126 
    127 		if (isset($this->request->post['payment_pp_pro_sort_order'])) {
    128 			$data['payment_pp_pro_sort_order'] = $this->request->post['payment_pp_pro_sort_order'];
    129 		} else {
    130 			$data['payment_pp_pro_sort_order'] = $this->config->get('payment_pp_pro_sort_order');
    131 		}
    132 
    133 		$data['header'] = $this->load->controller('common/header');
    134 		$data['column_left'] = $this->load->controller('common/column_left');
    135 		$data['footer'] = $this->load->controller('common/footer');
    136 
    137 		$this->response->setOutput($this->load->view('extension/payment/pp_pro', $data));
    138 	}
    139 
    140 	protected function validate() {
    141 		if (!$this->user->hasPermission('modify', 'extension/payment/pp_pro')) {
    142 			$this->error['warning'] = $this->language->get('error_permission');
    143 		}
    144 
    145 		if (!$this->request->post['payment_pp_pro_username']) {
    146 			$this->error['username'] = $this->language->get('error_username');
    147 		}
    148 
    149 		if (!$this->request->post['payment_pp_pro_password']) {
    150 			$this->error['password'] = $this->language->get('error_password');
    151 		}
    152 
    153 		if (!$this->request->post['payment_pp_pro_signature']) {
    154 			$this->error['signature'] = $this->language->get('error_signature');
    155 		}
    156 
    157 		return !$this->error;
    158 	}
    159 }