/** * Run init process of this module * */ public function perform($data = FALSE) { $mysqlExtension = $this->getMySqlExtensionType(); // session class require_once SMART_BASE_DIR . 'modules/common/includes/Smart' . $mysqlExtension . '.php'; // Check if a setup was successfull done else launch setup > 'setup' module if (file_exists($this->config['config_path'] . 'dbConnect.php')) { include_once $this->config['config_path'] . 'dbConnect.php'; } else { throw new SmartForwardAdminViewException($this->config['setup_module']); } // set db config vars $this->config['dbtype'] = 'mysql'; $this->config['dbhost'] = $db['dbhost']; $this->config['dbuser'] = $db['dbuser']; $this->config['dbpasswd'] = $db['dbpasswd']; $this->config['dbname'] = $db['dbname']; $this->config['dbTablePrefix'] = $db['dbTablePrefix']; $this->config['dbcharset'] = $db['dbcharset']; try { $this->model->dba = new DbMysql($db['dbhost'], $db['dbuser'], $db['dbpasswd'], $db['dbname']); //$dbaOptions = array(MYSQLI_OPT_CONNECT_TIMEOUT => 5); $this->model->dba->connect(); $this->model->dba->query("SET CHARACTER SET '{$db['dbcharset']}'"); } catch (SmartDbException $e) { // if no database connection stop here throw new SmartModelException(); } // set base url $this->model->baseUrlLocation = SmartCommonUtil::base_location(); // set session handler $this->model->sessionHandler = new SmartSessionHandler($this->model->dba, $this->config['dbTablePrefix']); // start session $this->model->session = new SmartCommonSession(); // load global config variables of the common module $this->loadConfig(); // enable zlib output compression if ($this->config['output_compression'] == TRUE) { ini_set('zlib.output_compression', '1'); ini_set('zlib.output_compression_level', $this->config['output_compression_level']); ini_set('zlib.output_handler', ''); } // set charset ini_set("default_charset", $this->config['charset']); @header("Content-type: text/html; charset={$this->config['charset']}"); // load module descriptions into config array $this->loadModulesInfo(); $this->checkModuleVersion(); }