shop.balmet.com

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

setting.php (36604B)


      1 <?php
      2 class ControllerSettingSetting extends Controller {
      3 	private $error = array();
      4 
      5 	public function index() {
      6 		$this->load->language('setting/setting');
      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('config', $this->request->post);
     14 
     15 			if ($this->config->get('config_currency_auto')) {
     16 				$this->load->model('localisation/currency');
     17 
     18 				$this->model_localisation_currency->refresh();
     19 			}
     20 
     21 			$this->session->data['success'] = $this->language->get('text_success');
     22 
     23 			$this->response->redirect($this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true));
     24 		}
     25 		
     26 		if (isset($this->error['warning'])) {
     27 			$data['error_warning'] = $this->error['warning'];
     28 		} else {
     29 			$data['error_warning'] = '';
     30 		}
     31 
     32 		if (isset($this->error['name'])) {
     33 			$data['error_name'] = $this->error['name'];
     34 		} else {
     35 			$data['error_name'] = '';
     36 		}
     37 
     38 		if (isset($this->error['owner'])) {
     39 			$data['error_owner'] = $this->error['owner'];
     40 		} else {
     41 			$data['error_owner'] = '';
     42 		}
     43 
     44 		if (isset($this->error['address'])) {
     45 			$data['error_address'] = $this->error['address'];
     46 		} else {
     47 			$data['error_address'] = '';
     48 		}
     49 
     50 		if (isset($this->error['email'])) {
     51 			$data['error_email'] = $this->error['email'];
     52 		} else {
     53 			$data['error_email'] = '';
     54 		}
     55 
     56 		if (isset($this->error['telephone'])) {
     57 			$data['error_telephone'] = $this->error['telephone'];
     58 		} else {
     59 			$data['error_telephone'] = '';
     60 		}
     61 
     62 		if (isset($this->error['meta_title'])) {
     63 			$data['error_meta_title'] = $this->error['meta_title'];
     64 		} else {
     65 			$data['error_meta_title'] = '';
     66 		}
     67 
     68 		if (isset($this->error['country'])) {
     69 			$data['error_country'] = $this->error['country'];
     70 		} else {
     71 			$data['error_country'] = '';
     72 		}
     73 
     74 		if (isset($this->error['zone'])) {
     75 			$data['error_zone'] = $this->error['zone'];
     76 		} else {
     77 			$data['error_zone'] = '';
     78 		}
     79 
     80 		if (isset($this->error['customer_group_display'])) {
     81 			$data['error_customer_group_display'] = $this->error['customer_group_display'];
     82 		} else {
     83 			$data['error_customer_group_display'] = '';
     84 		}
     85 
     86 		if (isset($this->error['login_attempts'])) {
     87 			$data['error_login_attempts'] = $this->error['login_attempts'];
     88 		} else {
     89 			$data['error_login_attempts'] = '';
     90 		}
     91 
     92 		if (isset($this->error['voucher_min'])) {
     93 			$data['error_voucher_min'] = $this->error['voucher_min'];
     94 		} else {
     95 			$data['error_voucher_min'] = '';
     96 		}
     97 
     98 		if (isset($this->error['voucher_max'])) {
     99 			$data['error_voucher_max'] = $this->error['voucher_max'];
    100 		} else {
    101 			$data['error_voucher_max'] = '';
    102 		}
    103 
    104 		if (isset($this->error['processing_status'])) {
    105 			$data['error_processing_status'] = $this->error['processing_status'];
    106 		} else {
    107 			$data['error_processing_status'] = '';
    108 		}
    109 
    110 		if (isset($this->error['complete_status'])) {
    111 			$data['error_complete_status'] = $this->error['complete_status'];
    112 		} else {
    113 			$data['error_complete_status'] = '';
    114 		}
    115 
    116 		if (isset($this->error['log'])) {
    117 			$data['error_log'] = $this->error['log'];
    118 		} else {
    119 			$data['error_log'] = '';
    120 		}
    121 
    122 		if (isset($this->error['limit_admin'])) {
    123 			$data['error_limit_admin'] = $this->error['limit_admin'];
    124 		} else {
    125 			$data['error_limit_admin'] = '';
    126 		}
    127 
    128 		if (isset($this->error['encryption'])) {
    129 			$data['error_encryption'] = $this->error['encryption'];
    130 		} else {
    131 			$data['error_encryption'] = '';
    132 		}
    133 
    134 		$data['breadcrumbs'] = array();
    135 
    136 		$data['breadcrumbs'][] = array(
    137 			'text' => $this->language->get('text_home'),
    138 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
    139 		);
    140 
    141 		$data['breadcrumbs'][] = array(
    142 			'text' => $this->language->get('text_stores'),
    143 			'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true)
    144 		);
    145 
    146 		$data['breadcrumbs'][] = array(
    147 			'text' => $this->language->get('heading_title'),
    148 			'href' => $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'], true)
    149 		);
    150 
    151 		if (isset($this->session->data['success'])) {
    152 			$data['success'] = $this->session->data['success'];
    153 
    154 			unset($this->session->data['success']);
    155 		} else {
    156 			$data['success'] = '';
    157 		}
    158 
    159 		$data['action'] = $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'], true);
    160 
    161 		$data['cancel'] = $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true);
    162 
    163 		$data['user_token'] = $this->session->data['user_token'];
    164 
    165 		if (isset($this->request->post['config_meta_title'])) {
    166 			$data['config_meta_title'] = $this->request->post['config_meta_title'];
    167 		} else {
    168 			$data['config_meta_title'] = $this->config->get('config_meta_title');
    169 		}
    170 
    171 		if (isset($this->request->post['config_meta_description'])) {
    172 			$data['config_meta_description'] = $this->request->post['config_meta_description'];
    173 		} else {
    174 			$data['config_meta_description'] = $this->config->get('config_meta_description');
    175 		}
    176 
    177 		if (isset($this->request->post['config_meta_keyword'])) {
    178 			$data['config_meta_keyword'] = $this->request->post['config_meta_keyword'];
    179 		} else {
    180 			$data['config_meta_keyword'] = $this->config->get('config_meta_keyword');
    181 		}
    182 
    183 		if (isset($this->request->post['config_theme'])) {
    184 			$data['config_theme'] = $this->request->post['config_theme'];
    185 		} else {
    186 			$data['config_theme'] = $this->config->get('config_theme');
    187 		}
    188 
    189 		if ($this->request->server['HTTPS']) {
    190 			$data['store_url'] = HTTPS_CATALOG;
    191 		} else {
    192 			$data['store_url'] = HTTP_CATALOG;
    193 		}
    194 
    195 		$data['themes'] = array();
    196 
    197 		$this->load->model('setting/extension');
    198 
    199 		$extensions = $this->model_setting_extension->getInstalled('theme');
    200 
    201 		foreach ($extensions as $code) {
    202 			$this->load->language('extension/theme/' . $code, 'extension');
    203 			
    204 			$data['themes'][] = array(
    205 				'text'  => $this->language->get('extension')->get('heading_title'),
    206 				'value' => $code
    207 			);
    208 		}
    209 			
    210 		if (isset($this->request->post['config_layout_id'])) {
    211 			$data['config_layout_id'] = $this->request->post['config_layout_id'];
    212 		} else {
    213 			$data['config_layout_id'] = $this->config->get('config_layout_id');
    214 		}
    215 
    216 		$this->load->model('design/layout');
    217 
    218 		$data['layouts'] = $this->model_design_layout->getLayouts();
    219 
    220 		if (isset($this->request->post['config_name'])) {
    221 			$data['config_name'] = $this->request->post['config_name'];
    222 		} else {
    223 			$data['config_name'] = $this->config->get('config_name');
    224 		}
    225 
    226 		if (isset($this->request->post['config_owner'])) {
    227 			$data['config_owner'] = $this->request->post['config_owner'];
    228 		} else {
    229 			$data['config_owner'] = $this->config->get('config_owner');
    230 		}
    231 
    232 		if (isset($this->request->post['config_address'])) {
    233 			$data['config_address'] = $this->request->post['config_address'];
    234 		} else {
    235 			$data['config_address'] = $this->config->get('config_address');
    236 		}
    237 
    238 		if (isset($this->request->post['config_geocode'])) {
    239 			$data['config_geocode'] = $this->request->post['config_geocode'];
    240 		} else {
    241 			$data['config_geocode'] = $this->config->get('config_geocode');
    242 		}
    243 
    244 		if (isset($this->request->post['config_email'])) {
    245 			$data['config_email'] = $this->request->post['config_email'];
    246 		} else {
    247 			$data['config_email'] = $this->config->get('config_email');
    248 		}
    249 
    250 		if (isset($this->request->post['config_telephone'])) {
    251 			$data['config_telephone'] = $this->request->post['config_telephone'];
    252 		} else {
    253 			$data['config_telephone'] = $this->config->get('config_telephone');
    254 		}
    255 		
    256 		if (isset($this->request->post['config_fax'])) {
    257 			$data['config_fax'] = $this->request->post['config_fax'];
    258 		} else {
    259 			$data['config_fax'] = $this->config->get('config_fax');
    260 		}
    261 		
    262 		if (isset($this->request->post['config_image'])) {
    263 			$data['config_image'] = $this->request->post['config_image'];
    264 		} else {
    265 			$data['config_image'] = $this->config->get('config_image');
    266 		}
    267 
    268 		$this->load->model('tool/image');
    269 
    270 		if (isset($this->request->post['config_image']) && is_file(DIR_IMAGE . $this->request->post['config_image'])) {
    271 			$data['thumb'] = $this->model_tool_image->resize($this->request->post['config_image'], 100, 100);
    272 		} elseif ($this->config->get('config_image') && is_file(DIR_IMAGE . $this->config->get('config_image'))) {
    273 			$data['thumb'] = $this->model_tool_image->resize($this->config->get('config_image'), 100, 100);
    274 		} else {
    275 			$data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
    276 		}
    277 
    278 		$data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
    279 
    280 		if (isset($this->request->post['config_open'])) {
    281 			$data['config_open'] = $this->request->post['config_open'];
    282 		} else {
    283 			$data['config_open'] = $this->config->get('config_open');
    284 		}
    285 
    286 		if (isset($this->request->post['config_comment'])) {
    287 			$data['config_comment'] = $this->request->post['config_comment'];
    288 		} else {
    289 			$data['config_comment'] = $this->config->get('config_comment');
    290 		}
    291 
    292 		$this->load->model('localisation/location');
    293 
    294 		$data['locations'] = $this->model_localisation_location->getLocations();
    295 
    296 		if (isset($this->request->post['config_location'])) {
    297 			$data['config_location'] = $this->request->post['config_location'];
    298 		} elseif ($this->config->get('config_location')) {
    299 			$data['config_location'] = $this->config->get('config_location');
    300 		} else {
    301 			$data['config_location'] = array();
    302 		}
    303 
    304 		if (isset($this->request->post['config_country_id'])) {
    305 			$data['config_country_id'] = $this->request->post['config_country_id'];
    306 		} else {
    307 			$data['config_country_id'] = $this->config->get('config_country_id');
    308 		}
    309 
    310 		$this->load->model('localisation/country');
    311 
    312 		$data['countries'] = $this->model_localisation_country->getCountries();
    313 
    314 		if (isset($this->request->post['config_zone_id'])) {
    315 			$data['config_zone_id'] = $this->request->post['config_zone_id'];
    316 		} else {
    317 			$data['config_zone_id'] = $this->config->get('config_zone_id');
    318 		}
    319 
    320 		if (isset($this->request->post['config_language'])) {
    321 			$data['config_language'] = $this->request->post['config_language'];
    322 		} else {
    323 			$data['config_language'] = $this->config->get('config_language');
    324 		}
    325 
    326 		$this->load->model('localisation/language');
    327 
    328 		$data['languages'] = $this->model_localisation_language->getLanguages();
    329 
    330 		if (isset($this->request->post['config_admin_language'])) {
    331 			$data['config_admin_language'] = $this->request->post['config_admin_language'];
    332 		} else {
    333 			$data['config_admin_language'] = $this->config->get('config_admin_language');
    334 		}
    335 
    336 		if (isset($this->request->post['config_currency'])) {
    337 			$data['config_currency'] = $this->request->post['config_currency'];
    338 		} else {
    339 			$data['config_currency'] = $this->config->get('config_currency');
    340 		}
    341 
    342 		if (isset($this->request->post['config_currency_auto'])) {
    343 			$data['config_currency_auto'] = $this->request->post['config_currency_auto'];
    344 		} else {
    345 			$data['config_currency_auto'] = $this->config->get('config_currency_auto');
    346 		}
    347 
    348 		$this->load->model('localisation/currency');
    349 
    350 		$data['currencies'] = $this->model_localisation_currency->getCurrencies();
    351 
    352 		if (isset($this->request->post['config_length_class_id'])) {
    353 			$data['config_length_class_id'] = $this->request->post['config_length_class_id'];
    354 		} else {
    355 			$data['config_length_class_id'] = $this->config->get('config_length_class_id');
    356 		}
    357 
    358 		$this->load->model('localisation/length_class');
    359 
    360 		$data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
    361 
    362 		if (isset($this->request->post['config_weight_class_id'])) {
    363 			$data['config_weight_class_id'] = $this->request->post['config_weight_class_id'];
    364 		} else {
    365 			$data['config_weight_class_id'] = $this->config->get('config_weight_class_id');
    366 		}
    367 
    368 		$this->load->model('localisation/weight_class');
    369 
    370 		$data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
    371 
    372 		if (isset($this->request->post['config_limit_admin'])) {
    373 			$data['config_limit_admin'] = $this->request->post['config_limit_admin'];
    374 		} else {
    375 			$data['config_limit_admin'] = $this->config->get('config_limit_admin');
    376 		}
    377 
    378 		if (isset($this->request->post['config_product_count'])) {
    379 			$data['config_product_count'] = $this->request->post['config_product_count'];
    380 		} else {
    381 			$data['config_product_count'] = $this->config->get('config_product_count');
    382 		}
    383 
    384 		if (isset($this->request->post['config_review_status'])) {
    385 			$data['config_review_status'] = $this->request->post['config_review_status'];
    386 		} else {
    387 			$data['config_review_status'] = $this->config->get('config_review_status');
    388 		}
    389 
    390 		if (isset($this->request->post['config_review_guest'])) {
    391 			$data['config_review_guest'] = $this->request->post['config_review_guest'];
    392 		} else {
    393 			$data['config_review_guest'] = $this->config->get('config_review_guest');
    394 		}
    395 
    396 		if (isset($this->request->post['config_voucher_min'])) {
    397 			$data['config_voucher_min'] = $this->request->post['config_voucher_min'];
    398 		} else {
    399 			$data['config_voucher_min'] = $this->config->get('config_voucher_min');
    400 		}
    401 
    402 		if (isset($this->request->post['config_voucher_max'])) {
    403 			$data['config_voucher_max'] = $this->request->post['config_voucher_max'];
    404 		} else {
    405 			$data['config_voucher_max'] = $this->config->get('config_voucher_max');
    406 		}
    407 
    408 		if (isset($this->request->post['config_tax'])) {
    409 			$data['config_tax'] = $this->request->post['config_tax'];
    410 		} else {
    411 			$data['config_tax'] = $this->config->get('config_tax');
    412 		}
    413 
    414 		if (isset($this->request->post['config_tax_default'])) {
    415 			$data['config_tax_default'] = $this->request->post['config_tax_default'];
    416 		} else {
    417 			$data['config_tax_default'] = $this->config->get('config_tax_default');
    418 		}
    419 
    420 		if (isset($this->request->post['config_tax_customer'])) {
    421 			$data['config_tax_customer'] = $this->request->post['config_tax_customer'];
    422 		} else {
    423 			$data['config_tax_customer'] = $this->config->get('config_tax_customer');
    424 		}
    425 
    426 		if (isset($this->request->post['config_customer_online'])) {
    427 			$data['config_customer_online'] = $this->request->post['config_customer_online'];
    428 		} else {
    429 			$data['config_customer_online'] = $this->config->get('config_customer_online');
    430 		}
    431 
    432 		if (isset($this->request->post['config_customer_activity'])) {
    433 			$data['config_customer_activity'] = $this->request->post['config_customer_activity'];
    434 		} else {
    435 			$data['config_customer_activity'] = $this->config->get('config_customer_activity');
    436 		}
    437 
    438 		if (isset($this->request->post['config_customer_search'])) {
    439 			$data['config_customer_search'] = $this->request->post['config_customer_search'];
    440 		} else {
    441 			$data['config_customer_search'] = $this->config->get('config_customer_search');
    442 		}
    443 
    444 		if (isset($this->request->post['config_customer_group_id'])) {
    445 			$data['config_customer_group_id'] = $this->request->post['config_customer_group_id'];
    446 		} else {
    447 			$data['config_customer_group_id'] = $this->config->get('config_customer_group_id');
    448 		}
    449 
    450 		$this->load->model('customer/customer_group');
    451 
    452 		$data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
    453 
    454 		if (isset($this->request->post['config_customer_group_display'])) {
    455 			$data['config_customer_group_display'] = $this->request->post['config_customer_group_display'];
    456 		} elseif ($this->config->get('config_customer_group_display')) {
    457 			$data['config_customer_group_display'] = $this->config->get('config_customer_group_display');
    458 		} else {
    459 			$data['config_customer_group_display'] = array();
    460 		}
    461 
    462 		if (isset($this->request->post['config_customer_price'])) {
    463 			$data['config_customer_price'] = $this->request->post['config_customer_price'];
    464 		} else {
    465 			$data['config_customer_price'] = $this->config->get('config_customer_price');
    466 		}
    467 
    468 		if (isset($this->request->post['config_login_attempts'])) {
    469 			$data['config_login_attempts'] = $this->request->post['config_login_attempts'];
    470 		} elseif ($this->config->has('config_login_attempts')) {
    471 			$data['config_login_attempts'] = $this->config->get('config_login_attempts');
    472 		} else {
    473 			$data['config_login_attempts'] = 5;
    474 		}
    475 
    476 		if (isset($this->request->post['config_account_id'])) {
    477 			$data['config_account_id'] = $this->request->post['config_account_id'];
    478 		} else {
    479 			$data['config_account_id'] = $this->config->get('config_account_id');
    480 		}
    481 
    482 		$this->load->model('catalog/information');
    483 
    484 		$data['informations'] = $this->model_catalog_information->getInformations();
    485 
    486 		if (isset($this->request->post['config_cart_weight'])) {
    487 			$data['config_cart_weight'] = $this->request->post['config_cart_weight'];
    488 		} else {
    489 			$data['config_cart_weight'] = $this->config->get('config_cart_weight');
    490 		}
    491 
    492 		if (isset($this->request->post['config_checkout_guest'])) {
    493 			$data['config_checkout_guest'] = $this->request->post['config_checkout_guest'];
    494 		} else {
    495 			$data['config_checkout_guest'] = $this->config->get('config_checkout_guest');
    496 		}
    497 
    498 		if (isset($this->request->post['config_checkout_id'])) {
    499 			$data['config_checkout_id'] = $this->request->post['config_checkout_id'];
    500 		} else {
    501 			$data['config_checkout_id'] = $this->config->get('config_checkout_id');
    502 		}
    503 
    504 		if (isset($this->request->post['config_invoice_prefix'])) {
    505 			$data['config_invoice_prefix'] = $this->request->post['config_invoice_prefix'];
    506 		} elseif ($this->config->get('config_invoice_prefix')) {
    507 			$data['config_invoice_prefix'] = $this->config->get('config_invoice_prefix');
    508 		} else {
    509 			$data['config_invoice_prefix'] = 'INV-' . date('Y') . '-00';
    510 		}
    511 
    512 		if (isset($this->request->post['config_order_status_id'])) {
    513 			$data['config_order_status_id'] = $this->request->post['config_order_status_id'];
    514 		} else {
    515 			$data['config_order_status_id'] = $this->config->get('config_order_status_id');
    516 		}
    517 
    518 		if (isset($this->request->post['config_processing_status'])) {
    519 			$data['config_processing_status'] = $this->request->post['config_processing_status'];
    520 		} elseif ($this->config->get('config_processing_status')) {
    521 			$data['config_processing_status'] = $this->config->get('config_processing_status');
    522 		} else {
    523 			$data['config_processing_status'] = array();
    524 		}
    525 
    526 		if (isset($this->request->post['config_complete_status'])) {
    527 			$data['config_complete_status'] = $this->request->post['config_complete_status'];
    528 		} elseif ($this->config->get('config_complete_status')) {
    529 			$data['config_complete_status'] = $this->config->get('config_complete_status');
    530 		} else {
    531 			$data['config_complete_status'] = array();
    532 		}
    533 
    534 		if (isset($this->request->post['config_fraud_status_id'])) {
    535 			$data['config_fraud_status_id'] = $this->request->post['config_fraud_status_id'];
    536 		} else {
    537 			$data['config_fraud_status_id'] = $this->config->get('config_fraud_status_id');
    538 		}
    539 
    540 		$this->load->model('localisation/order_status');
    541 
    542 		$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
    543 
    544 		if (isset($this->request->post['config_api_id'])) {
    545 			$data['config_api_id'] = $this->request->post['config_api_id'];
    546 		} else {
    547 			$data['config_api_id'] = $this->config->get('config_api_id');
    548 		}
    549 
    550 		$this->load->model('user/api');
    551 
    552 		$data['apis'] = $this->model_user_api->getApis();
    553 
    554 		if (isset($this->request->post['config_stock_display'])) {
    555 			$data['config_stock_display'] = $this->request->post['config_stock_display'];
    556 		} else {
    557 			$data['config_stock_display'] = $this->config->get('config_stock_display');
    558 		}
    559 
    560 		if (isset($this->request->post['config_stock_warning'])) {
    561 			$data['config_stock_warning'] = $this->request->post['config_stock_warning'];
    562 		} else {
    563 			$data['config_stock_warning'] = $this->config->get('config_stock_warning');
    564 		}
    565 
    566 		if (isset($this->request->post['config_stock_checkout'])) {
    567 			$data['config_stock_checkout'] = $this->request->post['config_stock_checkout'];
    568 		} else {
    569 			$data['config_stock_checkout'] = $this->config->get('config_stock_checkout');
    570 		}
    571 
    572 		if (isset($this->request->post['config_affiliate_group_id'])) {
    573 			$data['config_affiliate_group_id'] = $this->request->post['config_affiliate_group_id'];
    574 		} else {
    575 			$data['config_affiliate_group_id'] = $this->config->get('config_affiliate_group_id');
    576 		}
    577 
    578 		if (isset($this->request->post['config_affiliate_approval'])) {
    579 			$data['config_affiliate_approval'] = $this->request->post['config_affiliate_approval'];
    580 		} elseif ($this->config->has('config_affiliate_approval')) {
    581 			$data['config_affiliate_approval'] = $this->config->get('config_affiliate_approval');
    582 		} else {
    583 			$data['config_affiliate_approval'] = '';
    584 		}
    585 
    586 		if (isset($this->request->post['config_affiliate_auto'])) {
    587 			$data['config_affiliate_auto'] = $this->request->post['config_affiliate_auto'];
    588 		} elseif ($this->config->has('config_affiliate_auto')) {
    589 			$data['config_affiliate_auto'] = $this->config->get('config_affiliate_auto');
    590 		} else {
    591 			$data['config_affiliate_auto'] = '';
    592 		}
    593 
    594 		if (isset($this->request->post['config_affiliate_commission'])) {
    595 			$data['config_affiliate_commission'] = $this->request->post['config_affiliate_commission'];
    596 		} elseif ($this->config->has('config_affiliate_commission')) {
    597 			$data['config_affiliate_commission'] = $this->config->get('config_affiliate_commission');
    598 		} else {
    599 			$data['config_affiliate_commission'] = '5.00';
    600 		}
    601 
    602 		if (isset($this->request->post['config_affiliate_id'])) {
    603 			$data['config_affiliate_id'] = $this->request->post['config_affiliate_id'];
    604 		} else {
    605 			$data['config_affiliate_id'] = $this->config->get('config_affiliate_id');
    606 		}
    607 
    608 		if (isset($this->request->post['config_return_id'])) {
    609 			$data['config_return_id'] = $this->request->post['config_return_id'];
    610 		} else {
    611 			$data['config_return_id'] = $this->config->get('config_return_id');
    612 		}
    613 
    614 		if (isset($this->request->post['config_return_status_id'])) {
    615 			$data['config_return_status_id'] = $this->request->post['config_return_status_id'];
    616 		} else {
    617 			$data['config_return_status_id'] = $this->config->get('config_return_status_id');
    618 		}
    619 
    620 		$this->load->model('localisation/return_status');
    621 
    622 		$data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
    623 
    624 		if (isset($this->request->post['config_captcha'])) {
    625 			$data['config_captcha'] = $this->request->post['config_captcha'];
    626 		} else {
    627 			$data['config_captcha'] = $this->config->get('config_captcha');
    628 		}
    629 		
    630 		$this->load->model('setting/extension');
    631 
    632 		$data['captchas'] = array();
    633 
    634 		// Get a list of installed captchas
    635 		$extensions = $this->model_setting_extension->getInstalled('captcha');
    636 
    637 		foreach ($extensions as $code) {
    638 			$this->load->language('extension/captcha/' . $code, 'extension');
    639 
    640 			if ($this->config->get('captcha_' . $code . '_status')) {
    641 				$data['captchas'][] = array(
    642 					'text'  => $this->language->get('extension')->get('heading_title'),
    643 					'value' => $code
    644 				);
    645 			}
    646 		}		
    647 
    648 		if (isset($this->request->post['config_captcha_page'])) {
    649 			$data['config_captcha_page'] = $this->request->post['config_captcha_page'];
    650 		} elseif ($this->config->has('config_captcha_page')) {
    651 		   	$data['config_captcha_page'] = $this->config->get('config_captcha_page');
    652 		} else {
    653 			$data['config_captcha_page'] = array();
    654 		}
    655 
    656 		$data['captcha_pages'] = array();
    657 
    658 		$data['captcha_pages'][] = array(
    659 			'text'  => $this->language->get('text_register'),
    660 			'value' => 'register'
    661 		);
    662 		
    663 		$data['captcha_pages'][] = array(
    664 			'text'  => $this->language->get('text_guest'),
    665 			'value' => 'guest'
    666 		);
    667 		
    668 		$data['captcha_pages'][] = array(
    669 			'text'  => $this->language->get('text_review'),
    670 			'value' => 'review'
    671 		);
    672 
    673 		$data['captcha_pages'][] = array(
    674 			'text'  => $this->language->get('text_return'),
    675 			'value' => 'return'
    676 		);
    677 
    678 		$data['captcha_pages'][] = array(
    679 			'text'  => $this->language->get('text_contact'),
    680 			'value' => 'contact'
    681 		);
    682 
    683 		if (isset($this->request->post['config_logo'])) {
    684 			$data['config_logo'] = $this->request->post['config_logo'];
    685 		} else {
    686 			$data['config_logo'] = $this->config->get('config_logo');
    687 		}
    688 
    689 		if (isset($this->request->post['config_logo']) && is_file(DIR_IMAGE . $this->request->post['config_logo'])) {
    690 			$data['logo'] = $this->model_tool_image->resize($this->request->post['config_logo'], 100, 100);
    691 		} elseif ($this->config->get('config_logo') && is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
    692 			$data['logo'] = $this->model_tool_image->resize($this->config->get('config_logo'), 100, 100);
    693 		} else {
    694 			$data['logo'] = $this->model_tool_image->resize('no_image.png', 100, 100);
    695 		}
    696 
    697 		if (isset($this->request->post['config_icon'])) {
    698 			$data['config_icon'] = $this->request->post['config_icon'];
    699 		} else {
    700 			$data['config_icon'] = $this->config->get('config_icon');
    701 		}
    702 
    703 		if (isset($this->request->post['config_icon']) && is_file(DIR_IMAGE . $this->request->post['config_icon'])) {
    704 			$data['icon'] = $this->model_tool_image->resize($this->request->post['config_icon'], 100, 100);
    705 		} elseif ($this->config->get('config_icon') && is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
    706 			$data['icon'] = $this->model_tool_image->resize($this->config->get('config_icon'), 100, 100);
    707 		} else {
    708 			$data['icon'] = $this->model_tool_image->resize('no_image.png', 100, 100);
    709 		}
    710 
    711 		if (isset($this->request->post['config_mail_engine'])) {
    712 			$data['config_mail_engine'] = $this->request->post['config_mail_engine'];
    713 		} else {
    714 			$data['config_mail_engine'] = $this->config->get('config_mail_engine');
    715 		}
    716 
    717 		if (isset($this->request->post['config_mail_parameter'])) {
    718 			$data['config_mail_parameter'] = $this->request->post['config_mail_parameter'];
    719 		} else {
    720 			$data['config_mail_parameter'] = $this->config->get('config_mail_parameter');
    721 		}
    722 
    723 		if (isset($this->request->post['config_mail_smtp_hostname'])) {
    724 			$data['config_mail_smtp_hostname'] = $this->request->post['config_mail_smtp_hostname'];
    725 		} else {
    726 			$data['config_mail_smtp_hostname'] = $this->config->get('config_mail_smtp_hostname');
    727 		}
    728 
    729 		if (isset($this->request->post['config_mail_smtp_username'])) {
    730 			$data['config_mail_smtp_username'] = $this->request->post['config_mail_smtp_username'];
    731 		} else {
    732 			$data['config_mail_smtp_username'] = $this->config->get('config_mail_smtp_username');
    733 		}
    734 
    735 		if (isset($this->request->post['config_mail_smtp_password'])) {
    736 			$data['config_mail_smtp_password'] = $this->request->post['config_mail_smtp_password'];
    737 		} else {
    738 			$data['config_mail_smtp_password'] = $this->config->get('config_mail_smtp_password');
    739 		}
    740 
    741 		if (isset($this->request->post['config_mail_smtp_port'])) {
    742 			$data['config_mail_smtp_port'] = $this->request->post['config_mail_smtp_port'];
    743 		} elseif ($this->config->has('config_mail_smtp_port')) {
    744 			$data['config_mail_smtp_port'] = $this->config->get('config_mail_smtp_port');
    745 		} else {
    746 			$data['config_mail_smtp_port'] = 25;
    747 		}
    748 
    749 		if (isset($this->request->post['config_mail_smtp_timeout'])) {
    750 			$data['config_mail_smtp_timeout'] = $this->request->post['config_mail_smtp_timeout'];
    751 		} elseif ($this->config->has('config_mail_smtp_timeout')) {
    752 			$data['config_mail_smtp_timeout'] = $this->config->get('config_mail_smtp_timeout');
    753 		} else {
    754 			$data['config_mail_smtp_timeout'] = 5;
    755 		}
    756 
    757 		if (isset($this->request->post['config_mail_alert'])) {
    758 			$data['config_mail_alert'] = $this->request->post['config_mail_alert'];
    759 		} elseif ($this->config->has('config_mail_alert')) {
    760 		   	$data['config_mail_alert'] = $this->config->get('config_mail_alert');
    761 		} else {
    762 			$data['config_mail_alert'] = array();
    763 		}
    764 
    765 		$data['mail_alerts'] = array();
    766 
    767 		$data['mail_alerts'][] = array(
    768 			'text'  => $this->language->get('text_mail_account'),
    769 			'value' => 'account'
    770 		);
    771 
    772 		$data['mail_alerts'][] = array(
    773 			'text'  => $this->language->get('text_mail_affiliate'),
    774 			'value' => 'affiliate'
    775 		);
    776 
    777 		$data['mail_alerts'][] = array(
    778 			'text'  => $this->language->get('text_mail_order'),
    779 			'value' => 'order'
    780 		);
    781 
    782 		$data['mail_alerts'][] = array(
    783 			'text'  => $this->language->get('text_mail_review'),
    784 			'value' => 'review'
    785 		);
    786 
    787 		if (isset($this->request->post['config_mail_alert_email'])) {
    788 			$data['config_mail_alert_email'] = $this->request->post['config_mail_alert_email'];
    789 		} else {
    790 			$data['config_mail_alert_email'] = $this->config->get('config_mail_alert_email');
    791 		}
    792 		
    793 		if (isset($this->request->post['config_secure'])) {
    794 			$data['config_secure'] = $this->request->post['config_secure'];
    795 		} else {
    796 			$data['config_secure'] = $this->config->get('config_secure');
    797 		}
    798 
    799 		if (isset($this->request->post['config_shared'])) {
    800 			$data['config_shared'] = $this->request->post['config_shared'];
    801 		} else {
    802 			$data['config_shared'] = $this->config->get('config_shared');
    803 		}
    804 
    805 		if (isset($this->request->post['config_robots'])) {
    806 			$data['config_robots'] = $this->request->post['config_robots'];
    807 		} else {
    808 			$data['config_robots'] = $this->config->get('config_robots');
    809 		}
    810 
    811 		if (isset($this->request->post['config_seo_url'])) {
    812 			$data['config_seo_url'] = $this->request->post['config_seo_url'];
    813 		} else {
    814 			$data['config_seo_url'] = $this->config->get('config_seo_url');
    815 		}
    816 
    817 		if (isset($this->request->post['config_file_max_size'])) {
    818 			$data['config_file_max_size'] = $this->request->post['config_file_max_size'];
    819 		} elseif ($this->config->get('config_file_max_size')) {
    820 			$data['config_file_max_size'] = $this->config->get('config_file_max_size');
    821 		} else {
    822 			$data['config_file_max_size'] = 300000;
    823 		}
    824 
    825 		if (isset($this->request->post['config_file_ext_allowed'])) {
    826 			$data['config_file_ext_allowed'] = $this->request->post['config_file_ext_allowed'];
    827 		} else {
    828 			$data['config_file_ext_allowed'] = $this->config->get('config_file_ext_allowed');
    829 		}
    830 
    831 		if (isset($this->request->post['config_file_mime_allowed'])) {
    832 			$data['config_file_mime_allowed'] = $this->request->post['config_file_mime_allowed'];
    833 		} else {
    834 			$data['config_file_mime_allowed'] = $this->config->get('config_file_mime_allowed');
    835 		}
    836 
    837 		if (isset($this->request->post['config_maintenance'])) {
    838 			$data['config_maintenance'] = $this->request->post['config_maintenance'];
    839 		} else {
    840 			$data['config_maintenance'] = $this->config->get('config_maintenance');
    841 		}
    842 
    843 		if (isset($this->request->post['config_password'])) {
    844 			$data['config_password'] = $this->request->post['config_password'];
    845 		} else {
    846 			$data['config_password'] = $this->config->get('config_password');
    847 		}
    848 
    849 		if (isset($this->request->post['config_encryption'])) {
    850 			$data['config_encryption'] = $this->request->post['config_encryption'];
    851 		} else {
    852 			$data['config_encryption'] = $this->config->get('config_encryption');
    853 		}
    854 
    855 		if (isset($this->request->post['config_compression'])) {
    856 			$data['config_compression'] = $this->request->post['config_compression'];
    857 		} else {
    858 			$data['config_compression'] = $this->config->get('config_compression');
    859 		}
    860 
    861 		if (isset($this->request->post['config_error_display'])) {
    862 			$data['config_error_display'] = $this->request->post['config_error_display'];
    863 		} else {
    864 			$data['config_error_display'] = $this->config->get('config_error_display');
    865 		}
    866 
    867 		if (isset($this->request->post['config_error_log'])) {
    868 			$data['config_error_log'] = $this->request->post['config_error_log'];
    869 		} else {
    870 			$data['config_error_log'] = $this->config->get('config_error_log');
    871 		}
    872 
    873 		if (isset($this->request->post['config_error_filename'])) {
    874 			$data['config_error_filename'] = $this->request->post['config_error_filename'];
    875 		} else {
    876 			$data['config_error_filename'] = $this->config->get('config_error_filename');
    877 		}
    878 
    879 		$data['header'] = $this->load->controller('common/header');
    880 		$data['column_left'] = $this->load->controller('common/column_left');
    881 		$data['footer'] = $this->load->controller('common/footer');
    882 
    883 		$this->response->setOutput($this->load->view('setting/setting', $data));
    884 	}
    885 
    886 	protected function validate() {
    887 		if (!$this->user->hasPermission('modify', 'setting/setting')) {
    888 			$this->error['warning'] = $this->language->get('error_permission');
    889 		}
    890 
    891 		if (!$this->request->post['config_meta_title']) {
    892 			$this->error['meta_title'] = $this->language->get('error_meta_title');
    893 		}
    894 
    895 		if (!$this->request->post['config_name']) {
    896 			$this->error['name'] = $this->language->get('error_name');
    897 		}
    898 
    899 		if ((utf8_strlen($this->request->post['config_owner']) < 3) || (utf8_strlen($this->request->post['config_owner']) > 64)) {
    900 			$this->error['owner'] = $this->language->get('error_owner');
    901 		}
    902 
    903 		if ((utf8_strlen($this->request->post['config_address']) < 3) || (utf8_strlen($this->request->post['config_address']) > 256)) {
    904 			$this->error['address'] = $this->language->get('error_address');
    905 		}
    906 
    907 		if ((utf8_strlen($this->request->post['config_email']) > 96) || !filter_var($this->request->post['config_email'], FILTER_VALIDATE_EMAIL)) {
    908 			$this->error['email'] = $this->language->get('error_email');
    909 		}
    910 
    911 		if ((utf8_strlen($this->request->post['config_telephone']) < 3) || (utf8_strlen($this->request->post['config_telephone']) > 32)) {
    912 			$this->error['telephone'] = $this->language->get('error_telephone');
    913 		}
    914 
    915 		if (!empty($this->request->post['config_customer_group_display']) && !in_array($this->request->post['config_customer_group_id'], $this->request->post['config_customer_group_display'])) {
    916 			$this->error['customer_group_display'] = $this->language->get('error_customer_group_display');
    917 		}
    918 
    919 		if (!$this->request->post['config_limit_admin']) {
    920 			$this->error['limit_admin'] = $this->language->get('error_limit');
    921 		}
    922 
    923 		if ($this->request->post['config_login_attempts'] < 1) {
    924 			$this->error['login_attempts'] = $this->language->get('error_login_attempts');
    925 		}
    926 
    927 		if (!$this->request->post['config_voucher_min']) {
    928 			$this->error['voucher_min'] = $this->language->get('error_voucher_min');
    929 		}
    930 
    931 		if (!$this->request->post['config_voucher_max']) {
    932 			$this->error['voucher_max'] = $this->language->get('error_voucher_max');
    933 		}
    934 
    935 		if (!isset($this->request->post['config_processing_status'])) {
    936 			$this->error['processing_status'] = $this->language->get('error_processing_status');
    937 		}
    938 
    939 		if (!isset($this->request->post['config_complete_status'])) {
    940 			$this->error['complete_status'] = $this->language->get('error_complete_status');
    941 		}
    942 		
    943 		if (!$this->request->post['config_error_filename']) {
    944 			$this->error['log'] = $this->language->get('error_log_required');
    945 		} elseif (preg_match('/\.\.[\/\\\]?/', $this->request->post['config_error_filename'])) {
    946 			$this->error['log'] = $this->language->get('error_log_invalid');
    947 		} elseif (substr($this->request->post['config_error_filename'], strrpos($this->request->post['config_error_filename'], '.')) != '.log') {
    948 			$this->error['log'] = $this->language->get('error_log_extension');
    949 		}
    950 		
    951 		if ((utf8_strlen($this->request->post['config_encryption']) < 32) || (utf8_strlen($this->request->post['config_encryption']) > 1024)) {
    952 			$this->error['encryption'] = $this->language->get('error_encryption');
    953 		}
    954 
    955 		if ($this->error && !isset($this->error['warning'])) {
    956 			$this->error['warning'] = $this->language->get('error_warning');
    957 		}
    958 
    959 		return !$this->error;
    960 	}
    961 	
    962 	public function theme() {
    963 		if ($this->request->server['HTTPS']) {
    964 			$server = HTTPS_CATALOG;
    965 		} else {
    966 			$server = HTTP_CATALOG;
    967 		}
    968 		
    969 		// This is only here for compatibility with old themes.
    970 		if ($this->request->get['theme'] == 'theme_default') {
    971 			$theme = $this->config->get('theme_default_directory');
    972 		} else {
    973 			$theme = basename($this->request->get['theme']);
    974 		}
    975 		
    976 		if (is_file(DIR_CATALOG . 'view/theme/' . $theme . '/image/' . $theme . '.png')) {
    977 			$this->response->setOutput($server . 'catalog/view/theme/' . $theme . '/image/' . $theme . '.png');
    978 		} else {
    979 			$this->response->setOutput($server . 'image/no_image.png');
    980 		}
    981 	}	
    982 }