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 ControllerStartupStartup extends \Divine\Engine\Core\Controller |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
public function index() |
|
|
|
|
26
|
|
|
{ |
27
|
|
|
// Settings |
28
|
|
|
$query = $this->db->query(" |
|
|
|
|
29
|
|
|
SELECT * |
30
|
|
|
FROM setting |
31
|
|
|
"); |
32
|
|
|
|
33
|
|
|
foreach ($query->rows as $setting) { |
34
|
|
|
if (!$setting['serialized']) { |
35
|
|
|
$this->config->set( |
36
|
|
|
$setting['key'], |
37
|
|
|
$setting['value'] |
38
|
|
|
); |
39
|
|
|
} else { |
40
|
|
|
$this->config->set( |
41
|
|
|
$setting['key'], |
42
|
|
|
json_decode($setting['value'], true) |
43
|
|
|
); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
// Language |
48
|
|
|
$query = $this->db->query(" |
49
|
|
|
SELECT * |
50
|
|
|
FROM `language` |
51
|
|
|
WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "' |
52
|
|
|
"); |
53
|
|
|
|
54
|
|
|
if ($query->num_rows) { |
55
|
|
|
$this->config->set( |
56
|
|
|
'config_language_id', |
57
|
|
|
$query->row['language_id'] |
58
|
|
|
); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
// Language |
62
|
|
|
$language = new \Divine\Engine\Library\Language( |
63
|
|
|
$this->config->get('config_admin_language') |
64
|
|
|
); |
65
|
|
|
$language->load( |
66
|
|
|
$this->config->get('config_admin_language') |
67
|
|
|
); |
68
|
|
|
$this->registry->set( |
69
|
|
|
'language', |
70
|
|
|
$language |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
// Customer |
74
|
|
|
$this->registry->set( |
75
|
|
|
'customer', |
76
|
|
|
new \Divine\Engine\Library\Customer( |
77
|
|
|
$this->registry |
78
|
|
|
) |
79
|
|
|
); |
80
|
|
|
|
81
|
|
|
// Currency |
82
|
|
|
$this->registry->set( |
83
|
|
|
'currency', |
84
|
|
|
new \Divine\Engine\Library\Currency( |
85
|
|
|
$this->registry |
86
|
|
|
) |
87
|
|
|
); |
88
|
|
|
|
89
|
|
|
// Cart |
90
|
|
|
$this->registry->set( |
91
|
|
|
'cart', |
92
|
|
|
new \Divine\Engine\Library\Cart( |
93
|
|
|
$this->registry |
94
|
|
|
) |
95
|
|
|
); |
96
|
|
|
|
97
|
|
|
// Encryption |
98
|
|
|
$this->registry->set( |
99
|
|
|
'encryption', |
100
|
|
|
new \Divine\Engine\Library\Encryption( |
101
|
|
|
$this->config->get('config_encryption') |
|
|
|
|
102
|
|
|
) |
103
|
|
|
); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
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.