/** * @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."); } }
private function setLanguage() { $cookieLocale = $this->request->getCookies()->get('ACP3_INSTALLER_LANG', ''); if (!preg_match('=/=', $cookieLocale) && is_file($this->appPath->getInstallerModulesDir() . 'Install/Resources/i18n/' . $cookieLocale . '.xml') === true) { $language = $cookieLocale; } else { $language = 'en_US'; // Fallback language foreach ($this->request->getUserAgent()->parseAcceptLanguage() as $locale => $val) { $locale = str_replace('-', '_', $locale); if ($this->translator->languagePackExists($locale) === true) { $language = $locale; break; } } } $this->translator->setLocale($language); }
/** * @param string $fileOrDirectory * * @return array */ private function requiredFileOrFolderHasPermission($fileOrDirectory) { $result = []; $result['path'] = $fileOrDirectory; // Überprüfen, ob es eine Datei oder ein Ordner ist if (is_file(ACP3_ROOT_DIR . $fileOrDirectory) === true) { $result['class_1'] = self::CLASS_SUCCESS; $result['exists'] = $this->translator->t('install', 'found'); } elseif (is_dir(ACP3_ROOT_DIR . $fileOrDirectory) === true) { $result['class_1'] = self::CLASS_SUCCESS; $result['exists'] = $this->translator->t('install', 'found'); } else { $result['class_1'] = self::CLASS_ERROR; $result['exists'] = $this->translator->t('install', 'not_found'); } $result['class_2'] = is_writable(ACP3_ROOT_DIR . $fileOrDirectory) === true ? self::CLASS_SUCCESS : self::CLASS_ERROR; $result['writable'] = $result['class_2'] === self::CLASS_SUCCESS ? $this->translator->t('install', 'writable') : $this->translator->t('install', 'not_writable'); return $result; }