<?php
class ControllerStartupStartup extends Controller {
	public function index() {
		// Settings
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
		
		foreach ($query->rows as $setting) {
			if (!$setting['serialized']) {
				$this->config->set($setting['key'], $setting['value']);
			} else {
				$this->config->set($setting['key'], json_decode($setting['value'], true));
			}
		}

		// Theme
		$this->config->set('template_cache', $this->config->get('developer_theme'));
				
		// Language
		$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "'");
		
		if ($query->num_rows) {
			$this->config->set('config_language_id', $query->row['language_id']);
		}
		
		// Language
		$language = new Language($this->config->get('config_admin_language'));
		$language->load($this->config->get('config_admin_language'));
		$this->registry->set('language', $language);

		// Currency
		$this->registry->set('currency', new Cart\Currency($this->registry));
		$this->registry->set('image', new Bunny(BUNNY_API_KEY,BUNNY_STORAGE_KEY));

        // Tax
		$this->registry->set('tax', new Cart\Tax($this->registry));

        $this->registry->set('hb', new Marketplace\hb($this->registry));
        $this->registry->set('ty', new Marketplace\ty($this->registry));
        $this->registry->set('cs', new Marketplace\cs($this->registry));
        $this->registry->set('n11', new Marketplace\n11($this->registry));
        $this->registry->set('eptt', new Marketplace\eptt($this->registry));
        $this->registry->set('pz', new Marketplace\pz($this->registry));

        //if($this->user->getId()){

      //  }
        //User Db

        $this->registry->set('entegrasyon', new Entegrasyon ($this->registry));
		
		// Encryption
		$this->registry->set('encryption', new Encryption($this->config->get('config_encryption')));
		

	}
}