/** * Obtener los datos para el interface del instalador */ public function getInstaller() { $this->view->addTemplate('install'); $this->view->addTemplate('footer'); $this->view->addTemplate('body-end'); $this->view->assign('modulesErrors', Util::checkModules()); $this->view->assign('versionErrors', Util::checkPhpVersion()); $this->view->assign('securityErrors', array()); $this->view->assign('resInstall', array()); $this->view->assign('isCompleted', false); $this->view->assign('adminlogin', Request::analyze('adminlogin', 'admin')); $this->view->assign('adminpass', Request::analyzeEncrypted('adminpass')); $this->view->assign('masterpassword', Request::analyzeEncrypted('masterpassword')); $this->view->assign('dbuser', Request::analyze('dbuser', 'root')); $this->view->assign('dbpass', Request::analyzeEncrypted('dbpass')); $this->view->assign('dbname', Request::analyze('dbname', 'syspass')); $this->view->assign('dbhost', Request::analyze('dbhost', 'localhost')); $this->view->assign('hostingmode', Request::analyze('hostingmode', false)); if (@file_exists(__FILE__ . "Nullbyte")) { $this->view->append('securityErrors', array('type' => SPException::SP_WARNING, 'description' => _('La version de PHP es vulnerable al ataque NULL Byte (CVE-2006-7243)'), 'hint' => _('Actualice la versión de PHP para usar sysPass de forma segura'))); } if (!Util::secureRNG_available()) { $this->view->append('securityErrors', array('type' => SPException::SP_WARNING, 'description' => _('No se encuentra el generador de números aleatorios.'), 'hint' => _('Sin esta función un atacante puede utilizar su cuenta al resetear la clave'))); } if (Request::analyze('install', false)) { Installer::setUsername($this->view->adminlogin); Installer::setPassword($this->view->adminpass); Installer::setMasterPassword($this->view->masterpassword); Installer::setDbuser($this->view->dbuser); Installer::setDbpass($this->view->dbpass); Installer::setDbname($this->view->dbname); Installer::setDbhost($this->view->dbhost); Installer::setIsHostingMode($this->view->hostingmode); $this->view->assign('resInstall', Installer::install()); if (count($this->view->resInstall) == 0) { $this->view->append('errors', array('type' => SPException::SP_OK, 'description' => _('Instalación finalizada'), 'hint' => _('Pulse <a href="index.php" title="Acceder">aquí</a> para acceder'))); $this->view->assign('isCompleted', true); return true; } } $this->view->assign('errors', array_merge($this->view->modulesErrors, $this->view->securityErrors, $this->view->resInstall)); }