$this->packageInfo['name'] = $packageName;
- // set default values
- $this->packageInfo['isApplication'] = 0;
- $this->packageInfo['packageURL'] = '';
-
- // get package information
$packageInformation = $xpath->query('./ns:packageinformation', $package)->item(0);
if ($packageInformation !== null) {
$elements = $xpath->query('child::*', $packageInformation);
- /** @var \DOMElement $element */
foreach ($elements as $element) {
+ \assert($element instanceof \DOMElement);
+
switch ($element->tagName) {
case 'packagename':
case 'packagedescription':
break;
case 'isapplication':
+ if (isset($this->packageInfo['isApplication'])) {
+ throw new PackageValidationException(
+ PackageValidationException::DUPLICATE_PACKAGE_INFORMATION,
+ [
+ 'tag' => $element->tagName,
+ ]
+ );
+ }
+
$this->packageInfo['isApplication'] = \intval($element->nodeValue);
break;
case 'applicationdirectory':
+ if (isset($this->packageInfo['applicationdirectory'])) {
+ throw new PackageValidationException(
+ PackageValidationException::DUPLICATE_PACKAGE_INFORMATION,
+ [
+ 'tag' => $element->tagName,
+ ]
+ );
+ }
+
if (\preg_match('~^[a-z0-9\-\_]+$~', $element->nodeValue)) {
$this->packageInfo['applicationDirectory'] = $element->nodeValue;
}
break;
case 'packageurl':
+ if (isset($this->packageInfo['packageURL'])) {
+ throw new PackageValidationException(
+ PackageValidationException::DUPLICATE_PACKAGE_INFORMATION,
+ [
+ 'tag' => $element->tagName,
+ ]
+ );
+ }
+
$this->packageInfo['packageURL'] = $element->nodeValue;
break;
case 'version':
+ if (isset($this->packageInfo['version'])) {
+ throw new PackageValidationException(
+ PackageValidationException::DUPLICATE_PACKAGE_INFORMATION,
+ [
+ 'tag' => $element->tagName,
+ ]
+ );
+ }
+
if (!Package::isValidVersion($element->nodeValue)) {
throw new PackageValidationException(
PackageValidationException::INVALID_PACKAGE_VERSION,
break;
case 'date':
+ if (isset($this->packageInfo['date'])) {
+ throw new PackageValidationException(
+ PackageValidationException::DUPLICATE_PACKAGE_INFORMATION,
+ [
+ 'tag' => $element->tagName,
+ ]
+ );
+ }
+
DateUtil::validateDate($element->nodeValue);
$this->packageInfo['date'] = @\strtotime($element->nodeValue);
}
}
+ // set default values
+ $this->packageInfo['isApplication'] ??= 0;
+ $this->packageInfo['packageURL'] ??= '';
+
// get author information
$authorInformation = $xpath->query('./ns:authorinformation', $package)->item(0);
if ($authorInformation !== null) {
<item name="wcf.acp.package.validation.errorCode.25"><![CDATA[Die <authorinformation> enthalten das unbekannte Element „{$tag}“.]]></item>
<item name="wcf.acp.package.validation.errorCode.26"><![CDATA[Es wurden keine (gültigen) <authorinformation> hinterlegt.]]></item>
<item name="wcf.acp.package.validation.errorCode.27"><![CDATA[Es wurde kein (gültiger) <packagename> hinterlegt.]]></item>
+ <item name="wcf.acp.package.validation.errorCode.28"><![CDATA[Die <packageinformation> enthalten das doppelte Element „{$tag}“.]]></item>
<item name="wcf.acp.package.validation.failed"><![CDATA[Das hochgeladene Paket kann nicht installiert werden, bitte {if LANGUAGE_USE_INFORMAL_VARIANT}beachte{else}beachten Sie{/if} das unten stehende Prüfungsergebnis.]]></item>
<item name="wcf.acp.package.evaluation.expired"><![CDATA[Die Testphase von <strong>{$packageName}</strong> ist abgelaufen. Bitte aktualisiere{if !LANGUAGE_USE_INFORMAL_VARIANT}n Sie{/if} auf die aktuelle Version, um diese Software weiterhin legal betreiben zu können.{if $pluginStoreFileID || $isWoltLab}<br>{if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} die aktuelle Version sicher und bequem <strong>{if $pluginStoreFileID}<a href="https://pluginstore.woltlab.com/file/{$pluginStoreFileID}/">im WoltLab Plugin-Store</a>{else}<a href="https://www.woltlab.com/de/kaufen/">auf WoltLab.com</a>{/if}</strong> erwerben.{/if}]]></item>
<item name="wcf.acp.package.evaluation.pending"><![CDATA[Bei den folgenden installierten Apps handelt es sich um Testversionen, die am <strong>{$evaluationEndDate|plainTime}</strong> ({@$evaluationEndDate|dateDiff:TIME_NOW:true}) ablaufen. Mit Ablauf der Frist deaktiviert sich die App automatisch, es ist dann notwendig diese auf die endgültige Version zu aktualisieren, um den legalen Betrieb fortzusetzen.
<item name="wcf.acp.package.validation.errorCode.25"><![CDATA[The <authorinformation> contain the unknown child element “{$tag}”.]]></item>
<item name="wcf.acp.package.validation.errorCode.26"><![CDATA[No (valid) <authorinformation> have been given.]]></item>
<item name="wcf.acp.package.validation.errorCode.27"><![CDATA[No (valid) <packagename> have been given.]]></item>
+ <item name="wcf.acp.package.validation.errorCode.28"><![CDATA[The <packageinformation> contain the duplicate child element “{$tag}”.]]></item>
<item name="wcf.acp.package.validation.failed"><![CDATA[The package cannot be installed, please review the validation results below.]]></item>
<item name="wcf.acp.package.evaluation.expired"><![CDATA[The evaluation period of <strong>{$packageName}</strong> has expired. For a legal use of this software, please update to the latest available version.{if $pluginStoreFileID || $isWoltLab}<br>The latest version can be purchased quickly and securely <strong>{if $pluginStoreFileID}<a href="https://pluginstore.woltlab.com/file/{$pluginStoreFileID}/">in the WoltLab Plugin-Store</a>{else}<a href="https://www.woltlab.com/en/purchase/">on WoltLab.com</a>{/if}</strong>.{/if}]]></item>
<item name="wcf.acp.package.evaluation.pending"><![CDATA[The evaluation period of the apps listed below will expire on <strong>{$evaluationEndDate|plainTime}</strong> ({@$evaluationEndDate|dateDiff:TIME_NOW:true}). The apps will automatically disable themselves after this date and become unusable, you'll need to install the latest versions of the apps to active them again.