From d38c2db2ac4f4285a6da1d374458398593225251 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 6 Sep 2023 21:16:37 +0200 Subject: [PATCH] Detect paid updates in the Plugin-Store during the process See https://www.woltlab.com/community/thread/296689/ --- ...ckageUpdateUnauthorizedException.class.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php index 9c845ef354..64d118d7ea 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php @@ -61,13 +61,25 @@ class PackageUpdateUnauthorizedException extends UserException $serverReply = $this->request->getReply(); $authInsufficient = (($serverReply['httpHeaders']['wcf-update-server-auth'][0] ?? '') === 'unauthorized'); - if (ENABLE_ENTERPRISE_MODE && $authInsufficient && !empty($this->packageUpdateVersion['pluginStoreFileID'])) { - WCF::getTPL()->assign([ - 'packageName' => $this->packageUpdateVersion['packageName'], - 'pluginStoreFileID' => $this->packageUpdateVersion['pluginStoreFileID'], - ]); + if ($authInsufficient && !empty($this->packageUpdateVersion['pluginStoreFileID'])) { + $hasOnlyTrustedServers = true; + if (!ENABLE_ENTERPRISE_MODE) { + foreach (PackageUpdateServer::getActiveUpdateServers() as $updateServer) { + if (!$updateServer->isWoltLabUpdateServer() && !$updateServer->isWoltLabStoreServer()) { + $hasOnlyTrustedServers = false; + break; + } + } + } - return WCF::getTPL()->fetch('packageUpdateUnauthorizedPurchaseRequired'); + if ($hasOnlyTrustedServers) { + WCF::getTPL()->assign([ + 'packageName' => $this->packageUpdateVersion['packageName'], + 'pluginStoreFileID' => $this->packageUpdateVersion['pluginStoreFileID'], + ]); + + return WCF::getTPL()->fetch('packageUpdateUnauthorizedPurchaseRequired'); + } } WCF::getTPL()->assign([ -- 2.20.1