Beispiel #1
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Check the database settings
     if ($this->test_database_config() === FALSE) {
         redirect(base_url() . 'install/');
         die;
     }
     $this->load->database();
     if (!$this->db->db_select()) {
         $error =& load_class('Exceptions', 'core');
         echo $error->show_error('Database Error', 'Unable to connect to the specified database : ' . $this->db->database, 'error_db');
         exit;
     }
     // Models
     $this->load->model(array('base_model', 'settings_model'), '', TRUE);
     // Helpers
     $this->load->helper('file');
     $this->load->helper('trace');
     // Get all the website languages from DB and store them into config file "languages" key
     $languages = $this->settings_model->get_languages();
     Settings::set_languages($languages);
     // 	Settings : google analytics string, filemanager, etc.
     //	Each setting is accessible through Settings::get('setting_name');
     Settings::set_settings_from_list($this->settings_model->get_settings(), 'name', 'content');
     Settings::set_settings_from_list($this->settings_model->get_lang_settings(config_item('detected_lang_code')), 'name', 'content');
     if (Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
         Settings::set_all_languages_online();
     }
     // Try to find the installer class : No access if install folder is already there
     $installer = glob(BASEPATH . '../*/class/installer' . EXT);
     // If installer class is already here, avoid site access
     if (!empty($installer)) {
         // Get languages codes from available languages folder/translation file
         $languages = $this->settings_model->get_admin_langs();
         if (!in_array(config_item('detected_lang_code'), $languages)) {
             $this->config->set_item('detected_lang_code', config_item('default_admin_lang'));
         }
         $this->lang->load('admin', config_item('detected_lang_code'));
         Theme::set_theme('admin');
         // Set the view to output
         $this->output('system/delete_installer');
         // Display the view directly
         $this->output->_display();
         // Don't do anything more
         die;
     }
 }