+++ /dev/null
-{include file='header' pageTitle='wcf.acp.option.firstTimeSetup'}
-
-{event name='javascriptInclude'}
-
-<script data-relocate="true">
- $(function() {
- new WCF.Option.Handler();
- });
-
- {event name='javascriptInit'}
-</script>
-
-<header class="contentHeader">
- <div class="contentHeaderTitle">
- <h1 class="contentTitle">{lang}wcf.acp.option.firstTimeSetup{/lang}</h1>
- <p class="contentHeaderDescription">{lang}wcf.acp.option.firstTimeSetup.description{/lang}</p>
- </div>
-
- {hascontent}
- <nav class="contentHeaderNavigation">
- <ul>
- {content}
- <li><a href="{link}{/link}" class="button">{icon name='house'} <span>{lang}wcf.global.acp{/lang}</span></a></li>
-
- {event name='contentHeaderNavigation'}
- {/content}
- </ul>
- </nav>
- {/hascontent}
-</header>
-
-{if $success|isset}
- <p class="success">{lang}wcf.global.success.edit{/lang}</p>
-{/if}
-
-{include file='formError'}
-
-<form method="post" action="{link controller='FirstTimeSetup'}{/link}" enctype="multipart/form-data">
- {include file='optionFieldList' langPrefix='wcf.acp.option.'}
-
- <div class="formSubmit">
- <input type="submit" value="{lang}wcf.global.button.submit{/lang}" name="__submit" accesskey="s">
- {csrfToken}
- </div>
-</form>
-
-{include file='footer'}
--- /dev/null
+{include file='header' pageTitle='wcf.acp.firstTimeSetup.completed'}
+
+<header class="contentHeader">
+ <div class="contentHeaderTitle">
+ <h1 class="contentTitle">{lang}wcf.acp.firstTimeSetup.completed{/lang}</h1>
+ </div>
+
+ {hascontent}
+ <nav class="contentHeaderNavigation">
+ <ul>
+ {content}
+ <li><a href="{link}{/link}" class="button">{icon name='house'} <span>{lang}wcf.global.acp{/lang}</span></a></li>
+
+ {event name='contentHeaderNavigation'}
+ {/content}
+ </ul>
+ </nav>
+ {/hascontent}
+</header>
+
+{include file='footer'}
--- /dev/null
+{include file='header' pageTitle='wcf.acp.option.firstTimeSetup'}
+
+{event name='javascriptInclude'}
+
+<script data-relocate="true">
+ $(function() {
+ new WCF.Option.Handler();
+ });
+
+ {event name='javascriptInit'}
+</script>
+
+<header class="contentHeader">
+ <div class="contentHeaderTitle">
+ <h1 class="contentTitle">{lang}wcf.acp.option.firstTimeSetup{/lang}</h1>
+ <p class="contentHeaderDescription">{lang}wcf.acp.option.firstTimeSetup.description{/lang}</p>
+ </div>
+
+ {hascontent}
+ <nav class="contentHeaderNavigation">
+ <ul>
+ {content}
+ <li><a href="{link}{/link}" class="button">{icon name='house'} <span>{lang}wcf.global.acp{/lang}</span></a></li>
+
+ {event name='contentHeaderNavigation'}
+ {/content}
+ </ul>
+ </nav>
+ {/hascontent}
+</header>
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.success.edit{/lang}</p>
+{/if}
+
+{include file='formError'}
+
+<form method="post" action="{link controller='FirstTimeSetupOptions'}{/link}" enctype="multipart/form-data">
+ {include file='optionFieldList' langPrefix='wcf.acp.option.'}
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" name="__submit" accesskey="s">
+ {csrfToken}
+ </div>
+</form>
+
+{include file='footer'}
--- /dev/null
+<?php
+
+namespace wcf\acp\action;
+
+use Laminas\Diactoros\Response\RedirectResponse;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+use wcf\acp\form\FirstTimeSetupOptionsForm;
+use wcf\system\request\LinkHandler;
+use wcf\system\WCF;
+
+/**
+ * Dispatches to the first time setup steps.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+final class FirstTimeSetupAction implements RequestHandlerInterface
+{
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ WCF::getSession()->checkPermissions([
+ 'admin.general.canUseAcp',
+ ]);
+
+ $controller = match (\FIRST_TIME_SETUP_STATE) {
+ 0 => FirstTimeSetupOptionsForm::class,
+ default => FirstTimeSetupCompletedPage::class
+ };
+
+ return new RedirectResponse(LinkHandler::getInstance()->getControllerLink(
+ $controller
+ ), 303);
+ }
+}
+++ /dev/null
-<?php
-
-namespace wcf\acp\form;
-
-use wcf\data\option\Option;
-use wcf\data\option\OptionAction;
-use wcf\system\option\OptionHandler;
-use wcf\system\WCF;
-
-/**
- * Shows the option edit form.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- *
- * @property OptionHandler $optionHandler
- */
-class FirstTimeSetupForm extends AbstractOptionListForm
-{
- /**
- * @inheritDoc
- */
- public $activeMenuItem = 'wcf.acp.menu.link.configuration';
-
- /**
- * @inheritDoc
- */
- public $neededPermissions = ['admin.configuration.canEditOption'];
-
- /**
- * list of options
- * @var array
- */
- public $options = [];
-
- /**
- * @var string[]
- */
- public $optionNames = [
- 'page_title',
- 'timezone',
- 'mail_from_name',
- 'mail_from_address',
- 'mail_admin_address',
- 'module_contact_form',
- 'package_server_auth_code',
- ];
-
- /**
- * @inheritDoc
- */
- protected function initOptionHandler()
- {
- parent::initOptionHandler();
-
- $this->optionHandler->filterOptions($this->optionNames);
- }
-
- /**
- * @inheritDoc
- */
- public function readData()
- {
- parent::readData();
-
- foreach ($this->optionNames as $optionName) {
- $this->options[] = $this->optionHandler->getSingleOption($optionName);
- }
- }
-
- /**
- * @inheritDoc
- */
- public function save()
- {
- parent::save();
-
- $saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option');
- $saveOptions[Option::getOptionByName('offline')->optionID] = 0;
- $saveOptions[Option::getOptionByName('first_time_setup_state')->optionID] = 1;
- $this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]);
- $this->objectAction->executeAction();
- $this->saved();
-
- WCF::getTPL()->assign('success', true);
- }
-
- /**
- * @inheritDoc
- */
- public function assignVariables()
- {
- parent::assignVariables();
-
- WCF::getTPL()->assign([
- 'options' => $this->options,
- 'optionNames' => $this->optionNames,
- ]);
- }
-}
--- /dev/null
+<?php
+
+namespace wcf\acp\form;
+
+use wcf\data\option\Option;
+use wcf\data\option\OptionAction;
+use wcf\system\option\OptionHandler;
+use wcf\system\request\LinkHandler;
+use wcf\system\WCF;
+use wcf\util\HeaderUtil;
+
+/**
+ * Shows the option edit form.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ *
+ * @property OptionHandler $optionHandler
+ */
+final class FirstTimeSetupOptionsForm extends AbstractOptionListForm
+{
+ /**
+ * @inheritDoc
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.configuration';
+
+ /**
+ * @inheritDoc
+ */
+ public $neededPermissions = ['admin.configuration.canEditOption'];
+
+ /**
+ * list of options
+ * @var array
+ */
+ public $options = [];
+
+ /**
+ * @var string[]
+ */
+ public $optionNames = [
+ 'page_title',
+ 'timezone',
+ 'mail_from_name',
+ 'mail_from_address',
+ 'mail_admin_address',
+ 'module_contact_form',
+ 'package_server_auth_code',
+ ];
+
+ /**
+ * @inheritDoc
+ */
+ protected function initOptionHandler()
+ {
+ parent::initOptionHandler();
+
+ $this->optionHandler->filterOptions($this->optionNames);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function readData()
+ {
+ parent::readData();
+
+ foreach ($this->optionNames as $optionName) {
+ $this->options[] = $this->optionHandler->getSingleOption($optionName);
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function save()
+ {
+ parent::save();
+
+ $saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option');
+ $saveOptions[Option::getOptionByName('first_time_setup_state')->optionID] = 1;
+ $this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]);
+ $this->objectAction->executeAction();
+ $this->saved();
+
+ \http_response_code(303);
+ HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(
+ FirstTimeSetupAction::class,
+ ));
+
+ exit;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function assignVariables()
+ {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign([
+ 'options' => $this->options,
+ 'optionNames' => $this->optionNames,
+ ]);
+ }
+}
--- /dev/null
+<?php
+
+namespace wcf\acp\page;
+
+use wcf\data\option\Option;
+use wcf\data\option\OptionAction;
+use wcf\page\AbstractPage;
+
+/**
+ * Shows a success page for the completed first time setup.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+final class FirstTimeSetupCompletedPage extends AbstractPage
+{
+ /**
+ * @inheritDoc
+ */
+ public $neededPermissions = ['admin.general.canUseAcp'];
+
+ public function readData()
+ {
+ parent::readData();
+
+ if (\FIRST_TIME_SETUP_STATE != -1) {
+ $objectAction = new OptionAction(
+ [],
+ 'updateAll',
+ [
+ 'data' => [
+ Option::getOptionByName('offline')->optionID => 0,
+ Option::getOptionByName('first_time_setup_state')->optionID => -1,
+ ],
+ ]
+ );
+ $objectAction->executeAction();
+ }
+ }
+}
namespace wcf\acp\page;
-use wcf\acp\form\FirstTimeSetupForm;
+use wcf\acp\action\FirstTimeSetupAction;
use wcf\data\devtools\missing\language\item\DevtoolsMissingLanguageItemList;
use wcf\data\package\installation\queue\PackageInstallationQueue;
use wcf\data\user\User;
exit;
}
- if (\FIRST_TIME_SETUP_STATE != 1) {
+ if (\FIRST_TIME_SETUP_STATE != -1) {
HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(
- FirstTimeSetupForm::class,
+ FirstTimeSetupAction::class,
));
exit;
'offline',
]);
$statement->execute([
- 1,
+ -1,
'first_time_setup_state',
]);