Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
99.28% |
415 / 418 |
|
77.78% |
7 / 9 |
CRAP | |
0.00% |
0 / 1 |
| DefaultDataSeeder | |
99.28% |
415 / 418 |
|
77.78% |
7 / 9 |
12 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getMainConfig | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| applyPersonalSettings | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| seedConfig | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getMainRights | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFormInputs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| buildDefaultConfig | |
99.53% |
213 / 214 |
|
0.00% |
0 / 1 |
3 | |||
| buildDefaultRights | |
100.00% |
55 / 55 |
|
100.00% |
1 / 1 |
1 | |||
| buildDefaultFormInputs | |
100.00% |
137 / 137 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Holds default configuration, permissions, and form inputs for installation. |
| 5 | * |
| 6 | * Provides data arrays previously embedded in the monolithic Installer class, |
| 7 | * plus convenience methods for recording seed operations. |
| 8 | * |
| 9 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 10 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 11 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 12 | * |
| 13 | * @package phpMyFAQ |
| 14 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 15 | * @copyright 2026 phpMyFAQ Team |
| 16 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 17 | * @link https://www.phpmyfaq.de |
| 18 | * @since 2026-01-31 |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace phpMyFAQ\Setup\Installation; |
| 24 | |
| 25 | use phpMyFAQ\Configuration; |
| 26 | use phpMyFAQ\Enums\PermissionType; |
| 27 | use phpMyFAQ\Enums\ReleaseType; |
| 28 | use phpMyFAQ\System; |
| 29 | |
| 30 | class DefaultDataSeeder |
| 31 | { |
| 32 | /** |
| 33 | * Configuration array. |
| 34 | * |
| 35 | * @var array<string, string|null> |
| 36 | */ |
| 37 | private array $mainConfig; |
| 38 | |
| 39 | /** |
| 40 | * Array with user rights. |
| 41 | * @var array<array<string, string>> |
| 42 | */ |
| 43 | private readonly array $mainRights; |
| 44 | |
| 45 | /** |
| 46 | * Array with form inputs. |
| 47 | * @var array<array<string, int|string>> |
| 48 | */ |
| 49 | private readonly array $formInputs; |
| 50 | |
| 51 | /** |
| 52 | * @throws \Exception |
| 53 | */ |
| 54 | public function __construct() |
| 55 | { |
| 56 | $this->mainConfig = self::buildDefaultConfig(); |
| 57 | $this->mainRights = self::buildDefaultRights(); |
| 58 | $this->formInputs = self::buildDefaultFormInputs(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns the configuration array with dynamic values applied. |
| 63 | * |
| 64 | * @return array<string, string|null> |
| 65 | */ |
| 66 | public function getMainConfig(): array |
| 67 | { |
| 68 | return $this->mainConfig; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Applies personal settings to the config. |
| 73 | */ |
| 74 | public function applyPersonalSettings(string $realname, string $email, string $language, string $permLevel): void |
| 75 | { |
| 76 | $this->mainConfig['main.metaPublisher'] = $realname; |
| 77 | $this->mainConfig['main.administrationMail'] = $email; |
| 78 | $this->mainConfig['main.language'] = $language; |
| 79 | $this->mainConfig['security.permLevel'] = $permLevel; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Seeds all configuration entries into the database. |
| 84 | */ |
| 85 | public function seedConfig(Configuration $configuration): void |
| 86 | { |
| 87 | foreach ($this->mainConfig as $name => $value) { |
| 88 | $configuration->add($name, $value); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Returns the permissions array. |
| 94 | * |
| 95 | * @return array<array<string, string>> |
| 96 | */ |
| 97 | public function getMainRights(): array |
| 98 | { |
| 99 | return $this->mainRights; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Returns the form inputs array. |
| 104 | * |
| 105 | * @return array<array<string, int|string>> |
| 106 | */ |
| 107 | public function getFormInputs(): array |
| 108 | { |
| 109 | return $this->formInputs; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * @return array<string, string|null> |
| 114 | * @throws \Exception |
| 115 | */ |
| 116 | private static function buildDefaultConfig(): array |
| 117 | { |
| 118 | $config = [ |
| 119 | 'main.currentVersion' => null, |
| 120 | 'main.currentApiVersion' => null, |
| 121 | 'main.language' => '__PHPMYFAQ_LANGUAGE__', |
| 122 | 'main.languageDetection' => 'true', |
| 123 | 'main.phpMyFAQToken' => null, |
| 124 | 'main.referenceURL' => '__PHPMYFAQ_REFERENCE_URL__', |
| 125 | 'main.administrationMail' => 'webmaster@example.org', |
| 126 | 'main.contactInformation' => '', |
| 127 | 'main.enableAdminLog' => 'true', |
| 128 | 'main.enableUserTracking' => 'true', |
| 129 | 'main.metaDescription' => 'phpMyFAQ should be the answer for all questions in life', |
| 130 | 'main.metaPublisher' => '__PHPMYFAQ_PUBLISHER__', |
| 131 | 'main.titleFAQ' => 'phpMyFAQ Codename Palaimon', |
| 132 | 'main.enableWysiwygEditor' => 'true', |
| 133 | 'main.enableWysiwygEditorFrontend' => 'false', |
| 134 | 'main.enableMarkdownEditor' => 'false', |
| 135 | 'main.enableCommentEditor' => 'false', |
| 136 | 'main.dateFormat' => 'Y-m-d H:i', |
| 137 | 'main.maintenanceMode' => 'false', |
| 138 | 'main.enableGravatarSupport' => 'false', |
| 139 | 'main.customPdfHeader' => '', |
| 140 | 'main.customPdfFooter' => '', |
| 141 | 'main.enableSmartAnswering' => 'true', |
| 142 | 'main.enableCategoryRestrictions' => 'true', |
| 143 | 'main.enableSendToFriend' => 'true', |
| 144 | 'main.privacyURL' => '', |
| 145 | 'main.termsURL' => '', |
| 146 | 'main.imprintURL' => '', |
| 147 | 'main.cookiePolicyURL' => '', |
| 148 | 'main.accessibilityStatementURL' => '', |
| 149 | 'main.enableAutoUpdateHint' => 'true', |
| 150 | 'main.enableAskQuestions' => 'false', |
| 151 | 'main.enableNotifications' => 'false', |
| 152 | 'main.botIgnoreList' => |
| 153 | 'nustcrape,webpost,GoogleBot,msnbot,crawler,scooter,bravobrian,archiver,' |
| 154 | . 'w3c,controler,wget,bot,spider,Yahoo! Slurp,htdig,gsa-crawler,AirControler,Uptime-Kuma,facebookcatalog/1.0,' |
| 155 | . 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php),facebookexternalhit/1.1', |
| 156 | 'records.numberOfRecordsPerPage' => '10', |
| 157 | 'records.numberOfShownNewsEntries' => '3', |
| 158 | 'records.defaultActivation' => 'false', |
| 159 | 'records.defaultAllowComments' => 'false', |
| 160 | 'records.enableVisibilityQuestions' => 'false', |
| 161 | 'records.numberOfRelatedArticles' => '5', |
| 162 | 'records.orderby' => 'id', |
| 163 | 'records.sortby' => 'DESC', |
| 164 | 'records.orderingPopularFaqs' => 'visits', |
| 165 | 'records.disableAttachments' => 'true', |
| 166 | 'records.maxAttachmentSize' => '100000', |
| 167 | 'records.attachmentsPath' => 'content/user/attachments', |
| 168 | 'records.attachmentsStorageType' => '0', |
| 169 | 'records.enableAttachmentEncryption' => 'false', |
| 170 | 'records.defaultAttachmentEncKey' => '', |
| 171 | 'records.enableCloseQuestion' => 'false', |
| 172 | 'records.enableDeleteQuestion' => 'false', |
| 173 | 'records.randomSort' => 'false', |
| 174 | 'records.allowCommentsForGuests' => 'true', |
| 175 | 'records.allowQuestionsForGuests' => 'true', |
| 176 | 'records.allowNewFaqsForGuests' => 'true', |
| 177 | 'records.hideEmptyCategories' => 'false', |
| 178 | 'records.allowDownloadsForGuests' => 'false', |
| 179 | 'records.numberMaxStoredRevisions' => '10', |
| 180 | 'records.enableAutoRevisions' => 'false', |
| 181 | 'records.orderStickyFaqsCustom' => 'false', |
| 182 | 'records.allowedMediaHosts' => 'www.youtube.com', |
| 183 | 'search.numberSearchTerms' => '10', |
| 184 | 'search.relevance' => 'thema,content,keywords', |
| 185 | 'search.enableRelevance' => 'false', |
| 186 | 'search.enableHighlighting' => 'true', |
| 187 | 'search.searchForSolutionId' => 'true', |
| 188 | 'search.popularSearchTimeWindow' => '180', |
| 189 | 'search.enableElasticsearch' => 'false', |
| 190 | 'search.enableOpenSearch' => 'false', |
| 191 | 'security.permLevel' => 'basic', |
| 192 | 'security.ipCheck' => 'false', |
| 193 | 'security.enableLoginOnly' => 'false', |
| 194 | 'security.bannedIPs' => '', |
| 195 | 'security.ssoSupport' => 'false', |
| 196 | 'security.ssoLogoutRedirect' => '', |
| 197 | 'security.useSslForLogins' => 'false', |
| 198 | 'security.useSslOnly' => 'false', |
| 199 | 'security.forcePasswordUpdate' => 'false', |
| 200 | 'security.enableRegistration' => 'true', |
| 201 | 'security.domainWhiteListForRegistrations' => '', |
| 202 | 'security.enableSignInWithMicrosoft' => 'false', |
| 203 | 'security.enableGoogleReCaptchaV2' => 'false', |
| 204 | 'security.googleReCaptchaV2SiteKey' => '', |
| 205 | 'security.googleReCaptchaV2SecretKey' => '', |
| 206 | 'security.loginWithEmailAddress' => 'false', |
| 207 | 'security.enableWebAuthnSupport' => 'false', |
| 208 | 'security.enableAdminSessionTimeoutCounter' => 'true', |
| 209 | 'keycloak.enable' => 'false', |
| 210 | 'keycloak.baseUrl' => '', |
| 211 | 'keycloak.realm' => '', |
| 212 | 'keycloak.clientId' => '', |
| 213 | 'keycloak.clientSecret' => '', |
| 214 | 'keycloak.redirectUri' => '', |
| 215 | 'keycloak.scopes' => 'openid profile email', |
| 216 | 'keycloak.autoProvision' => 'false', |
| 217 | 'keycloak.groupAutoAssign' => 'false', |
| 218 | 'keycloak.groupSyncOnLogin' => 'false', |
| 219 | 'keycloak.groupMapping' => '', |
| 220 | 'keycloak.logoutRedirectUrl' => '', |
| 221 | 'spam.checkBannedWords' => 'true', |
| 222 | 'spam.enableCaptchaCode' => null, |
| 223 | 'spam.enableSafeEmail' => 'true', |
| 224 | 'spam.manualActivation' => 'true', |
| 225 | 'spam.mailAddressInExport' => 'true', |
| 226 | 'seo.title' => 'phpMyFAQ Codename Porus', |
| 227 | 'seo.description' => 'phpMyFAQ should be the answer for all questions in life', |
| 228 | 'seo.enableXMLSitemap' => 'true', |
| 229 | 'seo.enableRichSnippets' => 'false', |
| 230 | 'seo.metaTagsHome' => 'index, follow', |
| 231 | 'seo.metaTagsFaqs' => 'index, follow', |
| 232 | 'seo.metaTagsCategories' => 'index, follow', |
| 233 | 'seo.metaTagsPages' => 'index, follow', |
| 234 | 'seo.metaTagsAdmin' => 'noindex, nofollow', |
| 235 | 'seo.contentRobotsText' => 'User-agent: *\nDisallow: /admin/\nSitemap: /sitemap.xml', |
| 236 | 'seo.contentLlmsText' => |
| 237 | "# phpMyFAQ LLMs.txt\n\n" |
| 238 | . "This file provides information about the AI/LLM training data availability for this FAQ system.\n\n" |
| 239 | . "Contact: Please see the contact information on the main website.\n\n" |
| 240 | . "The FAQ content in this system is available for LLM training purposes.\n" |
| 241 | . "Please respect the licensing terms and usage guidelines of the content.\n\n" |
| 242 | . 'For more information about this FAQ system, visit: https://www.phpmyfaq.de', |
| 243 | 'mail.noReplySenderAddress' => '', |
| 244 | 'mail.remoteSMTP' => 'false', |
| 245 | 'mail.remoteSMTPServer' => '', |
| 246 | 'mail.remoteSMTPUsername' => '', |
| 247 | 'mail.remoteSMTPPassword' => '', |
| 248 | 'mail.remoteSMTPPort' => '25', |
| 249 | 'mail.remoteSMTPDisableTLSPeerVerification' => 'false', |
| 250 | 'mail.useQueue' => 'true', |
| 251 | 'mail.provider' => 'smtp', |
| 252 | 'mail.sendgridApiKey' => '', |
| 253 | 'mail.sesAccessKeyId' => '', |
| 254 | 'mail.sesSecretAccessKey' => '', |
| 255 | 'mail.sesRegion' => 'us-east-1', |
| 256 | 'mail.mailgunApiKey' => '', |
| 257 | 'mail.mailgunDomain' => '', |
| 258 | 'mail.mailgunRegion' => 'eu', |
| 259 | 'ldap.ldapSupport' => 'false', |
| 260 | 'ldap.ldap_mapping.name' => 'cn', |
| 261 | 'ldap.ldap_mapping.username' => 'samAccountName', |
| 262 | 'ldap.ldap_mapping.mail' => 'mail', |
| 263 | 'ldap.ldap_mapping.memberOf' => '', |
| 264 | 'ldap.ldap_use_domain_prefix' => 'true', |
| 265 | 'ldap.ldap_options.LDAP_OPT_PROTOCOL_VERSION' => '3', |
| 266 | 'ldap.ldap_options.LDAP_OPT_REFERRALS' => '0', |
| 267 | 'ldap.ldap_use_memberOf' => 'false', |
| 268 | 'ldap.ldap_use_sasl' => 'false', |
| 269 | 'ldap.ldap_use_multiple_servers' => 'false', |
| 270 | 'ldap.ldap_use_anonymous_login' => 'false', |
| 271 | 'ldap.ldap_use_dynamic_login' => 'false', |
| 272 | 'ldap.ldap_dynamic_login_attribute' => 'uid', |
| 273 | 'ldap.ldap_use_group_restriction' => 'false', |
| 274 | 'ldap.ldap_group_allowed_groups' => '', |
| 275 | 'ldap.ldap_group_auto_assign' => 'false', |
| 276 | 'ldap.ldap_group_mapping' => '', |
| 277 | 'api.enableAccess' => 'true', |
| 278 | 'api.apiClientToken' => bin2hex(random_bytes(32)), |
| 279 | 'api.onlyActiveFaqs' => 'true', |
| 280 | 'api.onlyActiveCategories' => 'true', |
| 281 | 'api.rateLimit.requests' => '100', |
| 282 | 'api.rateLimit.interval' => '3600', |
| 283 | 'translation.provider' => 'none', |
| 284 | 'translation.googleApiKey' => '', |
| 285 | 'translation.deeplApiKey' => '', |
| 286 | 'translation.deeplUseFreeApi' => 'true', |
| 287 | 'translation.azureKey' => '', |
| 288 | 'translation.azureRegion' => '', |
| 289 | 'translation.amazonAccessKeyId' => '', |
| 290 | 'translation.amazonSecretAccessKey' => '', |
| 291 | 'translation.amazonRegion' => 'us-east-1', |
| 292 | 'translation.libreTranslateUrl' => 'https://libretranslate.com', |
| 293 | 'translation.libreTranslateApiKey' => '', |
| 294 | 'api.onlyPublicQuestions' => 'true', |
| 295 | 'api.ignoreOrphanedFaqs' => 'true', |
| 296 | 'queue.transport' => 'database', |
| 297 | 'session.handler' => 'files', |
| 298 | 'session.redisDsn' => 'tcp://redis:6379?database=0', |
| 299 | 'storage.useRedisForConfiguration' => 'false', |
| 300 | 'storage.redisDsn' => 'tcp://redis:6379?database=1', |
| 301 | 'storage.redisPrefix' => 'pmf:config:', |
| 302 | 'storage.redisConnectTimeout' => '1.0', |
| 303 | 'storage.cacheAdapter' => 'filesystem', |
| 304 | 'storage.cacheRedisDsn' => 'redis://redis:6379/2', |
| 305 | 'storage.cacheRedisPrefix' => 'pmf_cache_', |
| 306 | 'storage.cacheRedisConnectTimeout' => '1.0', |
| 307 | 'storage.cacheDefaultTtl' => '3600', |
| 308 | 'upgrade.dateLastChecked' => '', |
| 309 | 'upgrade.lastDownloadedPackage' => '', |
| 310 | 'upgrade.onlineUpdateEnabled' => 'false', |
| 311 | 'upgrade.releaseEnvironment' => '__PHPMYFAQ_RELEASE__', |
| 312 | 'layout.templateSet' => 'default', |
| 313 | 'layout.defaultLayoutMode' => 'auto', |
| 314 | 'layout.allowUserLayoutMode' => 'true', |
| 315 | 'layout.enablePrivacyLink' => 'true', |
| 316 | 'layout.enableCookieConsent' => 'true', |
| 317 | 'layout.contactInformationHTML' => 'false', |
| 318 | 'layout.customCss' => '', |
| 319 | 'push.enableWebPush' => 'false', |
| 320 | 'push.vapidPublicKey' => '', |
| 321 | 'push.vapidPrivateKey' => '', |
| 322 | 'push.vapidSubject' => '', |
| 323 | ]; |
| 324 | |
| 325 | // Apply dynamic values |
| 326 | $config['main.currentVersion'] = System::getVersion(); |
| 327 | $config['main.currentApiVersion'] = System::getApiVersion(); |
| 328 | $config['main.phpMyFAQToken'] = bin2hex(random_bytes(16)); |
| 329 | $config['spam.enableCaptchaCode'] = extension_loaded('gd') ? 'true' : 'false'; |
| 330 | $config['upgrade.releaseEnvironment'] = System::isDevelopmentVersion() |
| 331 | ? ReleaseType::DEVELOPMENT->value |
| 332 | : ReleaseType::STABLE->value; |
| 333 | |
| 334 | return $config; |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * @return array<array<string, string>> |
| 339 | */ |
| 340 | private static function buildDefaultRights(): array |
| 341 | { |
| 342 | return [ |
| 343 | ['name' => PermissionType::USER_ADD->value, 'description' => 'Right to add user accounts'], |
| 344 | ['name' => PermissionType::USER_EDIT->value, 'description' => 'Right to edit user accounts'], |
| 345 | ['name' => PermissionType::USER_DELETE->value, 'description' => 'Right to delete user accounts'], |
| 346 | ['name' => PermissionType::FAQ_ADD->value, 'description' => 'Right to add faq entries'], |
| 347 | ['name' => PermissionType::FAQ_EDIT->value, 'description' => 'Right to edit faq entries'], |
| 348 | ['name' => PermissionType::FAQ_DELETE->value, 'description' => 'Right to delete faq entries'], |
| 349 | ['name' => PermissionType::STATISTICS_VIEWLOGS->value, 'description' => 'Right to view logfiles'], |
| 350 | ['name' => PermissionType::STATISTICS_ADMINLOG->value, 'description' => 'Right to view admin log'], |
| 351 | ['name' => PermissionType::COMMENT_DELETE->value, 'description' => 'Right to delete comments'], |
| 352 | ['name' => PermissionType::NEWS_ADD->value, 'description' => 'Right to add news'], |
| 353 | ['name' => PermissionType::NEWS_EDIT->value, 'description' => 'Right to edit news'], |
| 354 | ['name' => PermissionType::NEWS_DELETE->value, 'description' => 'Right to delete news'], |
| 355 | ['name' => PermissionType::PAGE_ADD->value, 'description' => 'Right to add custom pages'], |
| 356 | ['name' => PermissionType::PAGE_EDIT->value, 'description' => 'Right to edit custom pages'], |
| 357 | ['name' => PermissionType::PAGE_DELETE->value, 'description' => 'Right to delete custom pages'], |
| 358 | ['name' => PermissionType::CATEGORY_ADD->value, 'description' => 'Right to add categories'], |
| 359 | ['name' => PermissionType::CATEGORY_EDIT->value, 'description' => 'Right to edit categories'], |
| 360 | ['name' => PermissionType::CATEGORY_DELETE->value, 'description' => 'Right to delete categories'], |
| 361 | ['name' => PermissionType::PASSWORD_CHANGE->value, 'description' => 'Right to change passwords'], |
| 362 | ['name' => PermissionType::CONFIGURATION_EDIT->value, 'description' => 'Right to edit configuration'], |
| 363 | [ |
| 364 | 'name' => PermissionType::VIEW_ADMIN_LINK->value, |
| 365 | 'description' => 'Right to see the link to the admin section', |
| 366 | ], |
| 367 | ['name' => PermissionType::BACKUP->value, 'description' => 'Right to save backups'], |
| 368 | ['name' => PermissionType::RESTORE->value, 'description' => 'Right to load backups'], |
| 369 | ['name' => PermissionType::QUESTION_DELETE->value, 'description' => 'Right to delete questions'], |
| 370 | ['name' => PermissionType::GLOSSARY_ADD->value, 'description' => 'Right to add glossary entries'], |
| 371 | ['name' => PermissionType::GLOSSARY_EDIT->value, 'description' => 'Right to edit glossary entries'], |
| 372 | ['name' => PermissionType::GLOSSARY_DELETE->value, 'description' => 'Right to delete glossary entries'], |
| 373 | ['name' => PermissionType::REVISION_UPDATE->value, 'description' => 'Right to edit revisions'], |
| 374 | ['name' => PermissionType::GROUP_ADD->value, 'description' => 'Right to add group accounts'], |
| 375 | ['name' => PermissionType::GROUP_EDIT->value, 'description' => 'Right to edit group accounts'], |
| 376 | ['name' => PermissionType::GROUP_DELETE->value, 'description' => 'Right to delete group accounts'], |
| 377 | ['name' => PermissionType::FAQ_APPROVE->value, 'description' => 'Right to approve FAQs'], |
| 378 | ['name' => PermissionType::ATTACHMENT_ADD->value, 'description' => 'Right to add attachments'], |
| 379 | ['name' => PermissionType::ATTACHMENT_EDIT->value, 'description' => 'Right to edit attachments'], |
| 380 | ['name' => PermissionType::ATTACHMENT_DELETE->value, 'description' => 'Right to delete attachments'], |
| 381 | ['name' => PermissionType::ATTACHMENT_DOWNLOAD->value, 'description' => 'Right to download attachments'], |
| 382 | ['name' => PermissionType::REPORTS->value, 'description' => 'Right to generate reports'], |
| 383 | ['name' => PermissionType::FAQ_ADD->value, 'description' => 'Right to add FAQs in frontend'], |
| 384 | ['name' => PermissionType::QUESTION_ADD->value, 'description' => 'Right to add questions in frontend'], |
| 385 | ['name' => PermissionType::COMMENT_ADD->value, 'description' => 'Right to add comments in frontend'], |
| 386 | ['name' => PermissionType::INSTANCE_EDIT->value, 'description' => 'Right to edit multi-site instances'], |
| 387 | ['name' => PermissionType::INSTANCE_ADD->value, 'description' => 'Right to add multi-site instances'], |
| 388 | ['name' => PermissionType::INSTANCE_DELETE->value, 'description' => 'Right to delete multi-site instances'], |
| 389 | ['name' => PermissionType::EXPORT->value, 'description' => 'Right to export the complete FAQ'], |
| 390 | ['name' => PermissionType::FAQS_VIEW->value, 'description' => 'Right to view FAQs'], |
| 391 | ['name' => PermissionType::CATEGORIES_VIEW->value, 'description' => 'Right to view categories'], |
| 392 | ['name' => PermissionType::NEWS_VIEW->value, 'description' => 'Right to view news'], |
| 393 | ['name' => PermissionType::GROUPS_ADMINISTRATE->value, 'description' => 'Right to administrate groups'], |
| 394 | ['name' => PermissionType::FORMS_EDIT->value, 'description' => 'Right to edit forms'], |
| 395 | ['name' => PermissionType::FAQ_TRANSLATE->value, 'description' => 'Right to translate FAQs'], |
| 396 | ]; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * @return array<array<string, int|string>> |
| 401 | */ |
| 402 | private static function buildDefaultFormInputs(): array |
| 403 | { |
| 404 | return [ |
| 405 | // Ask Question inputs |
| 406 | [ |
| 407 | 'form_id' => 1, |
| 408 | 'input_id' => 1, |
| 409 | 'input_type' => 'title', |
| 410 | 'input_label' => 'msgQuestion', |
| 411 | 'input_active' => 1, |
| 412 | 'input_required' => -1, |
| 413 | 'input_lang' => 'default', |
| 414 | ], |
| 415 | [ |
| 416 | 'form_id' => 1, |
| 417 | 'input_id' => 2, |
| 418 | 'input_type' => 'message', |
| 419 | 'input_label' => 'msgNewQuestion', |
| 420 | 'input_active' => 1, |
| 421 | 'input_required' => -1, |
| 422 | 'input_lang' => 'default', |
| 423 | ], |
| 424 | [ |
| 425 | 'form_id' => 1, |
| 426 | 'input_id' => 3, |
| 427 | 'input_type' => 'text', |
| 428 | 'input_label' => 'msgNewContentName', |
| 429 | 'input_active' => 1, |
| 430 | 'input_required' => 1, |
| 431 | 'input_lang' => 'default', |
| 432 | ], |
| 433 | [ |
| 434 | 'form_id' => 1, |
| 435 | 'input_id' => 4, |
| 436 | 'input_type' => 'email', |
| 437 | 'input_label' => 'msgNewContentMail', |
| 438 | 'input_active' => 1, |
| 439 | 'input_required' => 1, |
| 440 | 'input_lang' => 'default', |
| 441 | ], |
| 442 | [ |
| 443 | 'form_id' => 1, |
| 444 | 'input_id' => 5, |
| 445 | 'input_type' => 'select', |
| 446 | 'input_label' => 'msgNewContentCategory', |
| 447 | 'input_active' => 1, |
| 448 | 'input_required' => 1, |
| 449 | 'input_lang' => 'default', |
| 450 | ], |
| 451 | [ |
| 452 | 'form_id' => 1, |
| 453 | 'input_id' => 6, |
| 454 | 'input_type' => 'textarea', |
| 455 | 'input_label' => 'msgAskYourQuestion', |
| 456 | 'input_active' => -1, |
| 457 | 'input_required' => -1, |
| 458 | 'input_lang' => 'default', |
| 459 | ], |
| 460 | // Add New FAQ inputs |
| 461 | [ |
| 462 | 'form_id' => 2, |
| 463 | 'input_id' => 1, |
| 464 | 'input_type' => 'title', |
| 465 | 'input_label' => 'msgNewContentHeader', |
| 466 | 'input_active' => 1, |
| 467 | 'input_required' => -1, |
| 468 | 'input_lang' => 'default', |
| 469 | ], |
| 470 | [ |
| 471 | 'form_id' => 2, |
| 472 | 'input_id' => 2, |
| 473 | 'input_type' => 'message', |
| 474 | 'input_label' => 'msgNewContentAddon', |
| 475 | 'input_active' => 1, |
| 476 | 'input_required' => -1, |
| 477 | 'input_lang' => 'default', |
| 478 | ], |
| 479 | [ |
| 480 | 'form_id' => 2, |
| 481 | 'input_id' => 3, |
| 482 | 'input_type' => 'text', |
| 483 | 'input_label' => 'msgNewContentName', |
| 484 | 'input_active' => 1, |
| 485 | 'input_required' => 1, |
| 486 | 'input_lang' => 'default', |
| 487 | ], |
| 488 | [ |
| 489 | 'form_id' => 2, |
| 490 | 'input_id' => 4, |
| 491 | 'input_type' => 'email', |
| 492 | 'input_label' => 'msgNewContentMail', |
| 493 | 'input_active' => 1, |
| 494 | 'input_required' => 1, |
| 495 | 'input_lang' => 'default', |
| 496 | ], |
| 497 | [ |
| 498 | 'form_id' => 2, |
| 499 | 'input_id' => 5, |
| 500 | 'input_type' => 'select', |
| 501 | 'input_label' => 'msgNewContentCategory', |
| 502 | 'input_active' => 1, |
| 503 | 'input_required' => 1, |
| 504 | 'input_lang' => 'default', |
| 505 | ], |
| 506 | [ |
| 507 | 'form_id' => 2, |
| 508 | 'input_id' => 6, |
| 509 | 'input_type' => 'textarea', |
| 510 | 'input_label' => 'msgNewContentTheme', |
| 511 | 'input_active' => -1, |
| 512 | 'input_required' => -1, |
| 513 | 'input_lang' => 'default', |
| 514 | ], |
| 515 | [ |
| 516 | 'form_id' => 2, |
| 517 | 'input_id' => 7, |
| 518 | 'input_type' => 'textarea', |
| 519 | 'input_label' => 'msgNewContentArticle', |
| 520 | 'input_active' => 1, |
| 521 | 'input_required' => 1, |
| 522 | 'input_lang' => 'default', |
| 523 | ], |
| 524 | [ |
| 525 | 'form_id' => 2, |
| 526 | 'input_id' => 8, |
| 527 | 'input_type' => 'text', |
| 528 | 'input_label' => 'msgNewContentKeywords', |
| 529 | 'input_active' => 1, |
| 530 | 'input_required' => 1, |
| 531 | 'input_lang' => 'default', |
| 532 | ], |
| 533 | [ |
| 534 | 'form_id' => 2, |
| 535 | 'input_id' => 9, |
| 536 | 'input_type' => 'title', |
| 537 | 'input_label' => 'msgNewContentLink', |
| 538 | 'input_active' => 1, |
| 539 | 'input_required' => 1, |
| 540 | 'input_lang' => 'default', |
| 541 | ], |
| 542 | ]; |
| 543 | } |
| 544 | } |