throw new UserInputException('source', 'uploadFailed');
}
- // get filename
- $this->source['name'] = FileUtil::getTemporaryFilename('style_', preg_replace('!^.*(?=\.(?:tar\.gz|tgz|tar)$)!i', '', basename($this->source['name'])));
-
- if (!@move_uploaded_file($this->source['tmp_name'], $this->source['name'])) {
- throw new UserInputException('source', 'uploadFailed');
+ try {
+ $this->style = StyleEditor::import($this->source['tmp_name']);
+ }
+ catch (\Exception $e) {
+ @unlink($this->source['tmp_name']);
+ throw new UserInputException('source', 'importFailed');
}
}
public function save() {
parent::save();
- try {
- $this->style = StyleEditor::import($this->source['name']);
- }
- catch (\Exception $e) {
- @unlink($this->source['name']);
- }
-
- @unlink($this->source['name']);
+ @unlink($this->source['tmp_name']);
$this->saved();
WCF::getTPL()->assign('success', true);
<item name="wcf.acp.style.import.source"><![CDATA[Datenquelle]]></item>
<item name="wcf.acp.style.import.source.upload"><![CDATA[Stil hochladen]]></item>
<item name="wcf.acp.style.import.source.upload.description"><![CDATA[Geben Sie eine Stil-Datei von Ihrem lokalen Rechner an.]]></item>
+ <item name="wcf.acp.style.import.source.error.importFailed"><![CDATA[Der Stil konnte nicht importiert werden. Es handelt sich nicht um eine gültige Stil-Datei.]]></item>
<item name="wcf.acp.style.license"><![CDATA[Lizenz]]></item>
<item name="wcf.acp.style.list"><![CDATA[Stile auflisten]]></item>
<item name="wcf.acp.style.packageName"><![CDATA[Paketbezeichner]]></item>
<item name="wcf.acp.style.import.source"><![CDATA[Data Source]]></item>
<item name="wcf.acp.style.import.source.upload"><![CDATA[Upload Style]]></item>
<item name="wcf.acp.style.import.source.upload.description"><![CDATA[Upload a style from your local machine.]]></item>
+ <item name="wcf.acp.style.import.source.error.importFailed"><![CDATA[TODO: Der Stil konnte nicht importiert werden. Es handelt sich nicht um eine gültige Stil-Datei.]]></item>
<item name="wcf.acp.style.license"><![CDATA[License]]></item>
<item name="wcf.acp.style.list"><![CDATA[List Styles]]></item>
<item name="wcf.acp.style.packageName"><![CDATA[Package Identifier]]></item>