function install_tpl_feedback_flag($flag, $class = 'error') { if (INSTALL::getFeedback()->getFlag($flag)) { return $class; } return ''; }
public function __construct() { parent::__construct(); $this->assign('msgs', INSTALL::getFeedback()->getMessages()); }
public function install() { $success = true; $configFile = OW_DIR_INC . 'config.php'; $dirs = array(OW_DIR_PLUGINFILES, OW_DIR_USERFILES, OW_DIR_STATIC, OW_DIR_SMARTY . 'template_c' . DS); $errorDirs = array(); $this->checkWritable($dirs, $errorDirs); if (OW::getRequest()->isPost()) { if (!empty($_POST['isConfigWritable'])) { @file_put_contents($configFile, $_POST['configContent']); } if (!empty($errorDirs)) { //INSTALL::getFeedback()->errorMessage('Some directories are not writable'); $this->redirect(); } try { OW::getDbo(); } catch (InvalidArgumentException $e) { INSTALL::getFeedback()->errorMessage('Could not connect to Database'); $this->redirect(); } try { $this->sqlImport(INSTALL_DIR_FILES . 'install.sql'); } catch (Exception $e) { INSTALL::getFeedback()->errorMessage($e->getMessage()); $this->redirect(); } try { OW::getConfig()->saveConfig('base', 'site_installed', 0); } catch (Exception $e) { OW::getConfig()->addConfig('base', 'site_installed', 0); } if (isset($_POST['continue'])) { $this->redirect(OW::getRouter()->urlForRoute('plugins')); } } $this->setPageTitle('Installation'); INSTALL::getStepIndicator()->activate('install'); $configContent = file_get_contents(INSTALL_DIR_FILES . 'config.txt'); $data = INSTALL::getStorage()->getAll(); $hostInfo = explode(':', $data['db_host']); $data['db_host'] = $hostInfo[0]; $data['db_port'] = empty($hostInfo[1]) ? 'null' : '"' . $hostInfo[1] . '"'; $data['password_salt'] = uniqid(); $search = array(); $replace = array(); foreach ($data as $name => $value) { $search[] = '{$' . $name . '}'; $replace[] = $value; } $outConfigContent = str_replace($search, $replace, $configContent); $this->assign('configContent', $outConfigContent); $this->assign('dirs', $errorDirs); $this->assign('isConfigWritable', is_writable($configFile)); }