/** * @inheritdoc */ public function preDispatch() { $this->setLanguage(); // Einige Template Variablen setzen $this->view->assign('LANGUAGES', $this->languagesDropdown($this->translator->getLocale())); $this->view->assign('PHP_SELF', $this->appPath->getPhpSelf()); $this->view->assign('REQUEST_URI', $this->request->getServer()->get('REQUEST_URI')); $this->view->assign('ROOT_DIR', $this->appPath->getWebRoot()); $this->view->assign('INSTALLER_ROOT_DIR', $this->appPath->getInstallerWebRoot()); $this->view->assign('DESIGN_PATH', $this->appPath->getDesignPathWeb()); $this->view->assign('UA_IS_MOBILE', $this->request->getUserAgent()->isMobileBrowser()); $this->view->assign('IS_AJAX', $this->request->isXmlHttpRequest()); $languageInfo = simplexml_load_file($this->appPath->getInstallerModulesDir() . 'Install/Resources/i18n/' . $this->translator->getLocale() . '.xml'); $this->view->assign('LANG_DIRECTION', isset($languageInfo->info->direction) ? $languageInfo->info->direction : 'ltr'); $this->view->assign('LANG', $this->translator->getShortIsoCode()); }
/** * @param array $formData * @throws \Exception */ public function createSuperUser(array $formData) { /** @var \ACP3\Core\Database\Connection db */ $this->db = $this->container->get('core.db'); $salt = $this->secure->salt(UserModel::SALT_LENGTH); $currentDate = gmdate('Y-m-d H:i:s'); $queries = ["INSERT INTO\n `{pre}users`\n VALUES\n (1, 1, {$this->db->getConnection()->quote($formData["user_name"])}, '{$this->secure->generateSaltedPassword($salt, $formData["user_pwd"], 'sha512')}', '{$salt}', '', 0, '', '1', '', 0, '{$formData["mail"]}', 0, '', '', '', '', '', '', '', '', 0, 0, {$this->db->getConnection()->quote($formData["date_format_long"])}, {$this->db->getConnection()->quote($formData["date_format_short"])}, '{$formData["date_time_zone"]}', '{$this->translator->getLocale()}', '{$currentDate}');", "INSERT INTO `{pre}acl_user_roles` (`user_id`, `role_id`) VALUES (1, 4);"]; if ($this->container->get('core.modules.schemaHelper')->executeSqlQueries($queries) === false) { throw new \Exception("Error while creating the super user."); } }