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 ControllerCommonHeader extends \Divine\Engine\Core\Controller |
||
|
0 ignored issues
–
show
|
|||
| 24 | { |
||
| 25 | public function index() |
||
|
0 ignored issues
–
show
|
|||
| 26 | { |
||
| 27 | // scripts & styles |
||
| 28 | $this->document->addStyle('/public_html/assets/css/administration/general/styles.css'); |
||
| 29 | $this->document->addStyle('https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.6/css/uikit.min.css'); |
||
| 30 | $this->document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'); |
||
| 31 | $this->document->addScript('https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.6/js/uikit.min.js'); |
||
| 32 | $this->document->addScript('https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.6/js/uikit-icons.min.js'); |
||
| 33 | |||
| 34 | $data['title'] = $this->document->getTitle(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 35 | |||
| 36 | $data['description'] = $this->document->getDescription(); |
||
| 37 | $data['links'] = $this->document->getLinks(); |
||
| 38 | $data['styles'] = $this->document->getStyles(); |
||
| 39 | $data['scripts'] = $this->document->getScripts(); |
||
| 40 | $data['lang'] = $this->language->get('code'); |
||
| 41 | $data['direction'] = $this->language->get('direction'); |
||
| 42 | |||
| 43 | $this->load->language('common/header'); |
||
| 44 | |||
| 45 | $data['heading_title'] = $this->language->get('heading_title'); |
||
| 46 | |||
| 47 | $data['text_order'] = $this->language->get('text_order'); |
||
| 48 | $data['text_customer'] = $this->language->get('text_customer'); |
||
| 49 | $data['text_online'] = $this->language->get('text_online'); |
||
| 50 | $data['text_approval'] = $this->language->get('text_approval'); |
||
| 51 | $data['text_product'] = $this->language->get('text_product'); |
||
| 52 | $data['text_stock'] = $this->language->get('text_stock'); |
||
| 53 | $data['text_review'] = $this->language->get('text_review'); |
||
| 54 | $data['text_front'] = $this->language->get('text_front'); |
||
| 55 | $data['text_logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName()); |
||
| 56 | $data['text_logout'] = $this->language->get('text_logout'); |
||
| 57 | |||
| 58 | $data['text_new'] = $this->language->get('text_new'); |
||
| 59 | $data['text_new_category'] = $this->language->get('text_new_category'); |
||
| 60 | $data['text_new_customer'] = $this->language->get('text_new_customer'); |
||
| 61 | $data['text_new_download'] = $this->language->get('text_new_download'); |
||
| 62 | $data['text_new_manufacturer'] = $this->language->get('text_new_manufacturer'); |
||
| 63 | $data['text_new_product'] = $this->language->get('text_new_product'); |
||
| 64 | |||
| 65 | $data['button_clearsystemcache'] = $this->language->get('button_clearsystemcache'); |
||
| 66 | |||
| 67 | // Autoupdate system begins here |
||
| 68 | // Cookies are checked for the presence of a previously completed check record (the check is started each time the administration is opened) |
||
| 69 | if (isset($_COOKIE['autoupdate']) && ($_COOKIE['autoupdate'] == 'checked')) { |
||
| 70 | // \Tracy\Debugger::barDump('Auto-update cookies already set, continue'); |
||
| 71 | |||
| 72 | // start checking new version |
||
| 73 | $core_new_version = '2'; |
||
| 74 | $core_current_version = '1'; |
||
| 75 | |||
| 76 | if ($core_new_version > $core_current_version) { |
||
| 77 | // \Tracy\Debugger::barDump('The new core version is greater than the current core version, continue'); |
||
| 78 | |||
| 79 | // we set a variable to track the output of a notification about the availability of a new version and show the button for switching to the system update functional page |
||
| 80 | $core_new_version_available = true; |
||
| 81 | } |
||
| 82 | } else { |
||
| 83 | // \Tracy\Debugger::barDump('Cookies check failed, return'); |
||
| 84 | |||
| 85 | $core_new_version_available = false; |
||
| 86 | } |
||
| 87 | |||
| 88 | if (!isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) { |
||
| 89 | $data['logged'] = ''; |
||
| 90 | |||
| 91 | $data['home'] = $this->url->link('common/dashboard', '', true); |
||
| 92 | } else { |
||
| 93 | $data['logged'] = true; |
||
| 94 | |||
| 95 | $data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true); |
||
| 96 | $data['logout'] = $this->url->link('common/logout', 'token=' . $this->session->data['token'], true); |
||
| 97 | |||
| 98 | // we set a variable to track the output of a notification about the availability of a new version and show the button for switching to the system update functional page |
||
| 99 | $data['core_new_version_available'] = $core_new_version_available; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 100 | // set a link to the functional system update page |
||
| 101 | $data['core_new_version_link'] = $this->url->link('tool/updater/update', 'token=' . $this->session->data['token'], true); |
||
| 102 | |||
| 103 | //CacheManager |
||
| 104 | $data['clearsystemcache'] = ('/administration/index.php?route=extension/module/cachemanager/clearsystemcache&token=' . $this->session->data['token']); |
||
| 105 | |||
| 106 | // fast add menu |
||
| 107 | $data['new_category'] = $this->url->link('catalog/category/add', 'token=' . $this->session->data['token'], true); |
||
| 108 | $data['new_customer'] = $this->url->link('user/user/add', 'token=' . $this->session->data['token'], true); |
||
| 109 | $data['new_download'] = $this->url->link('catalog/download/add', 'token=' . $this->session->data['token'], true); |
||
| 110 | $data['new_manufacturer'] = $this->url->link('catalog/manufacturer/add', 'token=' . $this->session->data['token'], true); |
||
| 111 | $data['new_product'] = $this->url->link('catalog/product/add', 'token=' . $this->session->data['token'], true); |
||
| 112 | |||
| 113 | // Customers |
||
| 114 | $this->load->model('customer/customer'); |
||
| 115 | |||
| 116 | $customer_total = $this->model_customer_customer->getTotalCustomers(array('filter_approved' => false)); |
||
| 117 | |||
| 118 | $data['customer_total'] = $customer_total; |
||
| 119 | $data['customer_approval'] = $this->url->link('customer/customer', 'token=' . $this->session->data['token'] . '&filter_approved=0', true); |
||
| 120 | |||
| 121 | // Products |
||
| 122 | $this->load->model('catalog/product'); |
||
| 123 | |||
| 124 | $product_total = $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0)); |
||
| 125 | |||
| 126 | $data['product_total'] = $product_total; |
||
| 127 | |||
| 128 | $data['product'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&filter_quantity=0', true); |
||
| 129 | |||
| 130 | // Reviews |
||
| 131 | $this->load->model('catalog/review'); |
||
| 132 | |||
| 133 | $review_total = $this->model_catalog_review->getTotalReviews(array('filter_status' => 0)); |
||
| 134 | |||
| 135 | $data['review_total'] = $review_total; |
||
| 136 | |||
| 137 | $data['review'] = $this->url->link('catalog/review', 'token=' . $this->session->data['token'] . '&filter_status=0', true); |
||
| 138 | |||
| 139 | $data['alerts'] = $customer_total + $product_total + $review_total; |
||
| 140 | |||
| 141 | // Store |
||
| 142 | $data['store_name'] = $this->config->get('config_name'); |
||
| 143 | } |
||
| 144 | |||
| 145 | return $this->load->view('common/header', $data); |
||
| 146 | } |
||
| 147 | } |
||
| 148 |
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.