Nickbur /
Sunrise-CMS
| 1 | <?php |
||
| 2 | |||
| 3 | /* Divine CMS - Open source CMS for widespread use. |
||
| 4 | Copyright (c) 2019 Mykola Burakov ([email protected]) |
||
| 5 | |||
| 6 | See SOURCE.txt for other and additional information. |
||
| 7 | |||
| 8 | This file is part of Divine CMS. |
||
| 9 | |||
| 10 | This program is free software: you can redistribute it and/or modify |
||
| 11 | it under the terms of the GNU General Public License as published by |
||
| 12 | the Free Software Foundation, either version 3 of the License, or |
||
| 13 | (at your option) any later version. |
||
| 14 | |||
| 15 | This program is distributed in the hope that it will be useful, |
||
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 18 | GNU General Public License for more details. |
||
| 19 | |||
| 20 | You should have received a copy of the GNU General Public License |
||
| 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
||
| 22 | |||
| 23 | class ControllerAccountAccount extends \Divine\Engine\Core\Controller |
||
|
0 ignored issues
–
show
|
|||
| 24 | { |
||
| 25 | public function index() |
||
|
0 ignored issues
–
show
|
|||
| 26 | { |
||
| 27 | if (!$this->customer->isLogged()) { |
||
| 28 | $this->session->data['redirect'] = $this->url->link('account/account', '', true); |
||
| 29 | |||
| 30 | $this->response->redirect($this->url->link('account/login', '', true)); |
||
| 31 | } |
||
| 32 | |||
| 33 | $this->load->language('account/account'); |
||
| 34 | |||
| 35 | $this->document->setTitle($this->language->get('heading_title')); |
||
| 36 | $this->document->setRobots('noindex,follow'); |
||
| 37 | |||
| 38 | $data['breadcrumbs'] = array(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 39 | |||
| 40 | $data['breadcrumbs'][] = array( |
||
| 41 | 'text' => $this->language->get('text_home'), |
||
| 42 | 'href' => $this->url->link('common/home') |
||
| 43 | ); |
||
| 44 | |||
| 45 | $data['breadcrumbs'][] = array( |
||
| 46 | 'text' => $this->language->get('text_account'), |
||
| 47 | 'href' => $this->url->link('account/account', '', true) |
||
| 48 | ); |
||
| 49 | |||
| 50 | if (isset($this->session->data['success'])) { |
||
| 51 | $data['success'] = $this->session->data['success']; |
||
| 52 | |||
| 53 | unset($this->session->data['success']); |
||
| 54 | } else { |
||
| 55 | $data['success'] = ''; |
||
| 56 | } |
||
| 57 | |||
| 58 | $data['heading_title'] = $this->language->get('heading_title'); |
||
| 59 | $this->document->setRobots('noindex,follow'); |
||
| 60 | |||
| 61 | $data['text_my_account'] = $this->language->get('text_my_account'); |
||
| 62 | $data['text_my_orders'] = $this->language->get('text_my_orders'); |
||
| 63 | $data['text_my_newsletter'] = $this->language->get('text_my_newsletter'); |
||
| 64 | $data['text_edit'] = $this->language->get('text_edit'); |
||
| 65 | $data['text_password'] = $this->language->get('text_password'); |
||
| 66 | $data['text_address'] = $this->language->get('text_address'); |
||
| 67 | $data['text_order'] = $this->language->get('text_order'); |
||
| 68 | $data['text_download'] = $this->language->get('text_download'); |
||
| 69 | $data['text_reward'] = $this->language->get('text_reward'); |
||
| 70 | $data['text_transaction'] = $this->language->get('text_transaction'); |
||
| 71 | $data['text_newsletter'] = $this->language->get('text_newsletter'); |
||
| 72 | |||
| 73 | $data['edit'] = $this->url->link('account/edit', '', true); |
||
| 74 | $data['password'] = $this->url->link('account/password', '', true); |
||
| 75 | $data['address'] = $this->url->link('account/address', '', true); |
||
| 76 | |||
| 77 | $data['order'] = $this->url->link('account/order', '', true); |
||
| 78 | $data['download'] = $this->url->link('account/download', '', true); |
||
| 79 | |||
| 80 | if ($this->config->get('reward_status')) { |
||
| 81 | $data['reward'] = $this->url->link('account/reward', '', true); |
||
| 82 | } else { |
||
| 83 | $data['reward'] = ''; |
||
| 84 | } |
||
| 85 | |||
| 86 | $data['transaction'] = $this->url->link('account/transaction', '', true); |
||
| 87 | $data['newsletter'] = $this->url->link('account/newsletter', '', true); |
||
| 88 | |||
| 89 | $data['column'] = $this->load->controller('common/column'); |
||
| 90 | $data['content_top'] = $this->load->controller('common/content_top'); |
||
| 91 | $data['content_bottom'] = $this->load->controller('common/content_bottom'); |
||
| 92 | $data['footer'] = $this->load->controller('common/footer'); |
||
| 93 | $data['header'] = $this->load->controller('common/header'); |
||
| 94 | |||
| 95 | $this->response->setOutput($this->load->view('account/account', $data)); |
||
| 96 | } |
||
| 97 | |||
| 98 | public function country() |
||
| 99 | { |
||
| 100 | $json = array(); |
||
| 101 | |||
| 102 | $this->load->model('localisation/country'); |
||
| 103 | |||
| 104 | $country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']); |
||
| 105 | |||
| 106 | if ($country_info) { |
||
| 107 | $this->load->model('localisation/zone'); |
||
| 108 | |||
| 109 | $json = array( |
||
| 110 | 'country_id' => $country_info['country_id'], |
||
| 111 | 'name' => $country_info['name'], |
||
| 112 | 'iso_code_2' => $country_info['iso_code_2'], |
||
| 113 | 'iso_code_3' => $country_info['iso_code_3'], |
||
| 114 | 'address_format' => $country_info['address_format'], |
||
| 115 | 'postcode_required' => $country_info['postcode_required'], |
||
| 116 | 'zone' => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']), |
||
| 117 | 'status' => $country_info['status'] |
||
| 118 | ); |
||
| 119 | } |
||
| 120 | |||
| 121 | $this->response->addHeader('Content-Type: application/json'); |
||
| 122 | $this->response->setOutput(json_encode($json)); |
||
| 123 | } |
||
| 124 | } |
||
| 125 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.