shop.balmet.com

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

api.php (1137B)


      1 <?php
      2 class ControllerMarketplaceApi extends Controller {
      3 	public function index() {	
      4 		$this->load->language('marketplace/api');
      5 			
      6 		$data['user_token'] = $this->session->data['user_token'];	
      7 			
      8 		$this->response->setOutput($this->load->view('marketplace/api', $data));
      9 	}
     10 	
     11 	public function save() {
     12 		$this->load->language('marketplace/api');
     13 
     14 		$json = array();
     15 		
     16 		if (!$this->user->hasPermission('modify', 'marketplace/api')) {
     17 			$json['error']['warning'] = $this->language->get('error_permission');
     18 		}
     19 
     20 		if (!$this->request->post['opencart_username']) {
     21 			$json['error']['username'] = $this->language->get('error_username');
     22 		}
     23 
     24 		if (!$this->request->post['opencart_secret']) {
     25 			$json['error']['secret'] = $this->language->get('error_secret');
     26 		}		
     27 
     28 		if (!$json) {
     29 			$this->load->model('setting/setting');
     30 			
     31 			$this->model_setting_setting->editSetting('opencart', $this->request->post);
     32 			
     33 			$json['success'] = $this->language->get('text_success');
     34 		}
     35 
     36 		$this->response->addHeader('Content-Type: application/json');
     37 		$this->response->setOutput(json_encode($json));
     38 	}
     39 }