use CuyZ\Valinor\MapperBuilder;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Psr7\Request;
+use Laminas\Diactoros\Response\RedirectResponse;
use Psr\Http\Client\ClientExceptionInterface;
use wcf\data\option\Option;
use wcf\data\option\OptionAction;
use wcf\data\package\update\server\PackageUpdateServerList;
use wcf\form\AbstractForm;
use wcf\form\AbstractFormBuilderForm;
+use wcf\system\application\ApplicationHandler;
use wcf\system\form\builder\container\FormContainer;
use wcf\system\form\builder\field\CheckboxFormField;
use wcf\system\form\builder\field\dependency\EmptyFormFieldDependency;
use wcf\system\form\builder\field\validation\FormFieldValidationError;
use wcf\system\form\builder\field\validation\FormFieldValidator;
use wcf\system\io\HttpFactory;
+use wcf\system\request\LinkHandler;
+use wcf\system\WCF;
/**
* Set up or edit the license data.
private array $apiResponse;
+ private string $url;
+
+ /**
+ * @inheritDoc
+ */
+ public function readParameters()
+ {
+ parent::readParameters();
+
+ $url = $_GET['url'] ?? '';
+ if ($url && ApplicationHandler::getInstance()->isInternalURL($url)) {
+ $this->url = $url;
+ }
+ }
+
/**
* @inheritDoc
*/
}
}
+ /**
+ * @inheritDoc
+ */
+ protected function setFormAction()
+ {
+ if (!isset($this->url)) {
+ parent::setFormAction();
+ return;
+ }
+
+ $this->form->action(
+ LinkHandler::getInstance()->getControllerLink(static::class, [
+ 'url' => $this->url,
+ ])
+ );
+ }
+
private function getLicenseData(string $licenseNo, string $serialNo): array
{
$request = new Request(
}
$this->saved();
+
+ if (isset($this->url)) {
+ return new RedirectResponse($this->url);
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function assignVariables()
+ {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign([
+ 'url' => $this->url,
+ ]);
}
}
if (!$this->hasLicenseCredentials()) {
return new RedirectResponse(
- LinkHandler::getInstance()->getControllerLink(LicenseEditForm::class),
+ LinkHandler::getInstance()->getControllerLink(
+ LicenseEditForm::class,
+ [
+ 'url' => LinkHandler::getInstance()->getControllerLink(LicensePage::class),
+ ],
+ ),
);
}