public function run($template) { if (file_exists(TEMP_CONFIG_FILE)) { Engine::getConfig()->setConfigFilename(TEMP_CONFIG_FILE); Engine::getConfig()->open(); } }
public function onLoad() { $this->config = Engine::getConfig(); $this->config->setConfigFilename(TEMP_CONFIG_FILE); $this->config->open(); //If it has been done already & we can connect, ignore. if ($this->try_connect($this->config->DB_HOST, $this->config->DB_USERNAME, $this->config->DB_PASSWORD, $this->config->DB_NAME) === true) { $this->setEnabled(false); } }
public function onSubmit() { ErrorHandler::stop(); $config = Engine::getConfig(); $config->setConfigFilename(TEMP_CONFIG_FILE); $done_config = $config->save(true); $done_htaccess = file_put_contents($this->htaccessFilename, "Options -Indexes\r\nRewriteEngine On\r\n#RewriteBase /\r\n#RewriteCond %{HTTPS} !on\r\n#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\r\n\r\nRewriteCond %{REQUEST_FILENAME} -f\r\nRewriteRule \\.(jp[e]?g|gif|png|css|js|ttf|woff|ico|bmp|pdf|doc[x]?)\$ - [L]\r\n\r\n#Redirect all files not match index.php\r\nRewriteCond %{REQUEST_FILENAME} !(.*)/index\\.php\$\r\nRewriteRule ^.*\$ index.php?current_engine_page=\$0 [L,NC,QSA]"); if (!$done_htaccess || !$done_config || !in_array('mod_rewrite', apache_get_modules())) { $this->sendStatus(true, array($this->addName('write-error'))); } }
public function onSubmit() { $templateName = $_POST[$this->addName("options")]; if ($this->testTemplate($templateName) === true) { $config = Engine::getConfig(); $config->setConfigFilename(TEMP_CONFIG_FILE); $config->TEMPLATE = $templateName; $template = (include Engine::getTemplate($templateName)); if (!$template instanceof Template) { $this->sendStatus(true, array($this->addName("error"))); } else { $template->configure($this); $config->save(true); } } else { $this->sendStatus(true, array($this->addName("error"))); } }
public function test_getConfig() { //Make sure that what we get from the engine, gives us the actual config class and an instantiated object $this->assertEquals(true, Engine::getConfig() !== null && Engine::getConfig() instanceof Config); }