startup.php (2237B)
1 <?php 2 class ControllerStartupStartup extends Controller { 3 public function index() { 4 // Settings 5 $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'"); 6 7 foreach ($query->rows as $setting) { 8 if (!$setting['serialized']) { 9 $this->config->set($setting['key'], $setting['value']); 10 } else { 11 $this->config->set($setting['key'], json_decode($setting['value'], true)); 12 } 13 } 14 15 // Theme 16 $this->config->set('template_cache', $this->config->get('developer_theme')); 17 18 // Language 19 $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "'"); 20 21 if ($query->num_rows) { 22 $this->config->set('config_language_id', $query->row['language_id']); 23 } 24 25 // Language 26 $language = new Language($this->config->get('config_admin_language')); 27 $language->load($this->config->get('config_admin_language')); 28 $this->registry->set('language', $language); 29 30 // Customer 31 $this->registry->set('customer', new Cart\Customer($this->registry)); 32 33 // Currency 34 $this->registry->set('currency', new Cart\Currency($this->registry)); 35 36 // Tax 37 $this->registry->set('tax', new Cart\Tax($this->registry)); 38 39 if ($this->config->get('config_tax_default') == 'shipping') { 40 $this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id')); 41 } 42 43 if ($this->config->get('config_tax_default') == 'payment') { 44 $this->tax->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id')); 45 } 46 47 $this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id')); 48 49 // Weight 50 $this->registry->set('weight', new Cart\Weight($this->registry)); 51 52 // Length 53 $this->registry->set('length', new Cart\Length($this->registry)); 54 55 // Cart 56 $this->registry->set('cart', new Cart\Cart($this->registry)); 57 58 // Encryption 59 $this->registry->set('encryption', new Encryption($this->config->get('config_encryption'))); 60 61 // OpenBay Pro 62 $this->registry->set('openbay', new Openbay($this->registry)); 63 } 64 }