<dt>{lang}wcf.acp.package.author{/lang}</dt>
<dd>{if $package->authorURL}<a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$package->authorURL|rawurlencode}" class="externalURL">{$package->author}</a>{else}{$package->author}{/if}</dd>
</dl>
+ {if $pluginStoreFileID}
+ {capture assign=_storeUrl}https://pluginstore.woltlab.com/file/{$pluginStoreFileID}/{/capture}
+ <dl>
+ <dt>{lang}wcf.acp.pluginStore.file{/lang}</dt>
+ <dd><a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$_storeUrl|rawurlencode}" class="externalURL">{lang}wcf.acp.pluginStore.file.link{/lang}</a></dd>
+ </dl>
+ {/if}
{event name='propertyFields'}
</div>
* package object
* @var Package
*/
- public $package = null;
+ public $package;
+
+ /**
+ * Plugin-Store fileID
+ * @var integer
+ */
+ public $pluginStoreFileID = 0;
/**
* @inheritDoc
}
}
+ /**
+ * @inheritDoc
+ */
+ public function readData() {
+ parent::readData();
+
+ $sql = "SELECT pluginStoreFileID
+ FROM wcf".WCF_N."_package_update
+ WHERE package = ?
+ AND pluginStoreFileID <> 0";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([$this->package->package]);
+ $this->pluginStoreFileID = intval($statement->fetchSingleColumn());
+ }
+
/**
* @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
- WCF::getTPL()->assign('package', $this->package);
+ WCF::getTPL()->assign([
+ 'package' => $this->package,
+ 'pluginStoreFileID' => $this->pluginStoreFileID
+ ]);
}
}
* @property-read string $author author of the package
* @property-read string $authorURL external url to the website of the package author
* @property-read integer $isApplication is `1` if the package update belongs to an application, otherwise `0`
+ * @property-read integer $pluginStoreFileID file id for related package on pluginstore.woltlab.com, otherwise `0`
*/
class PackageUpdate extends DatabaseObject {
/**
return false;
}
+
+ /**
+ * Returns true if the host is `update.woltlab.com`.
+ *
+ * @return boolean
+ */
+ public function isWoltLabUpdateServer() {
+ return Url::parse($this->serverURL)['host'] === 'update.woltlab.com';
+ }
+
+ /**
+ * Returns true if the host is `store.woltlab.com`.
+ *
+ * @return boolean
+ */
+ public function isWoltLabStoreServer() {
+ return Url::parse($this->serverURL)['host'] === 'store.woltlab.com';
+ }
}
$request = new HTTPRequest($updateServer->getListURL($forceHTTP), $settings);
- if ($updateServer->apiVersion == '2.1') {
+ $apiVersion = $updateServer->apiVersion;
+ if (in_array($apiVersion, ['2.1', '3.1'])) {
$metaData = $updateServer->getMetaData();
if (isset($metaData['list']['etag'])) $request->addHeader('if-none-match', $metaData['list']['etag']);
if (isset($metaData['list']['lastModified'])) $request->addHeader('if-modified-since', $metaData['list']['lastModified']);
// parse given package update xml
$allNewPackages = false;
- if ($updateServer->apiVersion == '2.0' || $reply['statusCode'] != 304) {
+ if ($apiVersion === '2.0' || $reply['statusCode'] != 304) {
$allNewPackages = $this->parsePackageUpdateXML($updateServer, $reply['body']);
}
];
// check if server indicates support for a newer API
- if ($updateServer->apiVersion == '2.0' && !empty($reply['httpHeaders']['wcf-update-server-api'])) {
+ if ($updateServer->apiVersion !== '3.1' && !empty($reply['httpHeaders']['wcf-update-server-api'])) {
$apiVersions = explode(' ', reset($reply['httpHeaders']['wcf-update-server-api']));
- if (in_array('2.1', $apiVersions)) {
- $data['apiVersion'] = '2.1';
+ if (in_array('3.1', $apiVersions)) {
+ $apiVersion = $data['apiVersion'] = '3.1';
+ }
+ else if (in_array('2.1', $apiVersions)) {
+ $apiVersion = $data['apiVersion'] = '2.1';
}
}
$metaData = [];
- if ($updateServer->apiVersion == '2.1' || (isset($data['apiVersion']) && $data['apiVersion'] == '2.1')) {
+ if (in_array($apiVersion, ['2.1', '3.1'])) {
if (empty($reply['httpHeaders']['etag']) && empty($reply['httpHeaders']['last-modified'])) {
throw new SystemException("Missing required HTTP headers 'etag' and 'last-modified'.");
}
'authorURL' => '',
'isApplication' => 0,
'packageDescription' => '',
- 'versions' => []
+ 'versions' => [],
+ 'pluginStoreFileID' => 0
];
// parse package information
case 'isapplication':
$packageInfo['isApplication'] = intval($element->nodeValue);
break;
+
+ case 'pluginStoreFileID':
+ if ($updateServer->isWoltLabStoreServer()) {
+ $packageInfo['pluginStoreFileID'] = intval($element->nodeValue);
+ }
+ break;
}
}
$key = '';
if ($this->hasAuthCode) {
- if (preg_match('~^https?://update\.woltlab\.com~', $updateServer->serverURL)) {
- $key = 'woltlab';
- }
- else if (preg_match('~^https?://store\.woltlab\.com~', $updateServer->serverURL)) {
- $key = 'pluginstore';
- }
+ if ($updateServer->isWoltLabUpdateServer()) $key = 'woltlab';
+ else if ($updateServer->isWoltLabStoreServer()) $key = 'pluginstore';
}
// parse versions
'packageDescription' => $packageData['packageDescription'],
'author' => $packageData['author'],
'authorURL' => $packageData['authorURL'],
- 'isApplication' => $packageData['isApplication']
+ 'isApplication' => $packageData['isApplication'],
+ 'pluginStoreFileID' => $packageData['pluginStoreFileID']
]);
$packageUpdateID = $packageUpdate->packageUpdateID;
<item name="wcf.acp.pluginStore.authorization.username"><![CDATA[Benutzername]]></item>
<item name="wcf.acp.pluginStore.authorization.password"><![CDATA[Passwort]]></item>
<item name="wcf.acp.pluginStore.authorization.saveCredentials"><![CDATA[Zugangsdaten für aktuelle Sitzung speichern]]></item>
+ <item name="wcf.acp.pluginStore.file"><![CDATA[WoltLab® Plugin-Store]]></item>
+ <item name="wcf.acp.pluginStore.file.link"><![CDATA[Eintrag im Plugin-Store anzeigen]]></item>
<item name="wcf.acp.pluginStore.purchasedItems.button.search"><![CDATA[Erworbene Produkte (Plugin-Store)]]></item>
<item name="wcf.acp.pluginStore.purchasedItems"><![CDATA[Erworbene Produkte (Plugin-Store)]]></item>
<item name="wcf.acp.pluginStore.purchasedItems.noResults"><![CDATA[Die Suche ergab keine Treffer, entweder {if LANGUAGE_USE_INFORMAL_VARIANT}hast du{else}haben Sie{/if} noch keine Produkte erworben oder diese sind nicht kompatibel.]]></item>
<item name="wcf.acp.pluginStore.authorization.username"><![CDATA[Username]]></item>
<item name="wcf.acp.pluginStore.authorization.password"><![CDATA[Password]]></item>
<item name="wcf.acp.pluginStore.authorization.saveCredentials"><![CDATA[Save credentials for this session only]]></item>
+ <item name="wcf.acp.pluginStore.file"><![CDATA[WoltLab® Plugin-Store]]></item>
+ <item name="wcf.acp.pluginStore.file.link"><![CDATA[Show listing in the Plugin-Store]]></item>
<item name="wcf.acp.pluginStore.purchasedItems.button.search"><![CDATA[Purchased Products (Plugin-Store)]]></item>
<item name="wcf.acp.pluginStore.purchasedItems"><![CDATA[Purchased Products (Plugin-Store)]]></item>
<item name="wcf.acp.pluginStore.purchasedItems.noResults"><![CDATA[The search returned no results, because either you have not purchased any products yet, or your purchases are not compatible with this version.]]></item>
author VARCHAR(255) NOT NULL DEFAULT '',
authorURL VARCHAR(255) NOT NULL DEFAULT '',
isApplication TINYINT(1) NOT NULL DEFAULT 0,
+ pluginStoreFileID INT(10) NOT NULL DEFAULT 0,
UNIQUE KEY packageUpdateServerID (packageUpdateServerID, package)
);
lastUpdateTime INT(10) NOT NULL DEFAULT 0,
status ENUM('online', 'offline') NOT NULL DEFAULT 'online',
errorMessage TEXT,
- apiVersion ENUM('2.0', '2.1') NOT NULL DEFAULT '2.0',
+ apiVersion ENUM('2.0', '2.1', '3.1') NOT NULL DEFAULT '2.0',
metaData TEXT
);