</dd>
</dl>
{/hascontent}
- <dl{if $errorField == 'iconPath'} class="formError"{/if}>
- <dt><label for="iconPath">{lang}wcf.acp.style.iconPath{/lang}</label></dt>
- <dd>
- <input type="text" name="iconPath" id="iconPath" value="{$iconPath}" class="long" />
- {if $errorField == 'iconPath'}
- <small class="innerError">
- {if $errorType == 'empty'}
- {lang}wcf.global.form.error.empty{/lang}
- {else}
- {lang}wcf.acp.style.error.iconPath.{$errorType}{/lang}
- {/if}
- </small>
- {/if}
- <small>{lang}wcf.acp.style.iconPath.description{/lang}</small>
- </dd>
- </dl>
<dl{if $errorField == 'imagePath'} class="formError"{/if}>
<dt><label for="imagePath">{lang}wcf.acp.style.imagePath{/lang}</label></dt>
<dd>
<legend>{lang}wcf.acp.style.exportStyle.components{/lang}</legend>
<small>{lang}wcf.acp.style.exportStyle.components.description{/lang}</small>
- <dl>
- <dd>
- <label><input type="checkbox" name="exportIcons" value="1"{if $exportIcons} checked="checked"{/if}{if !$canExportIcons} disabled="disabled"{/if} /> <span>{lang}wcf.acp.style.exportIcons{/lang}</span></label>
- </dd>
- </dl>
<dl>
<dd>
<label><input type="checkbox" name="exportImages" value="1"{if $exportImages} checked="checked"{/if}{if !$canExportImages} disabled="disabled"{/if} /> <span>{lang}wcf.acp.style.exportImages{/lang}</span></label>
*/
public $globals = array();
- /**
- * icon path
- * @var string
- */
- public $iconPath = 'icon/';
-
/**
* image path
* @var string
if (isset($_POST['authorName'])) $this->authorName = StringUtil::trim($_POST['authorName']);
if (isset($_POST['authorURL'])) $this->authorURL = StringUtil::trim($_POST['authorURL']);
if (isset($_POST['copyright'])) $this->copyright = StringUtil::trim($_POST['copyright']);
- if (isset($_POST['iconPath'])) $this->iconPath = StringUtil::trim($_POST['iconPath']);
if (isset($_POST['imagePath'])) $this->imagePath = StringUtil::trim($_POST['imagePath']);
if (isset($_POST['license'])) $this->license = StringUtil::trim($_POST['license']);
if (isset($_POST['styleDate'])) $this->styleDate = StringUtil::trim($_POST['styleDate']);
}
}
- // ensure icon path is below WCF_DIR/icon/
- if ($this->iconPath) {
- $relativePath = FileUtil::unifyDirSeperator(FileUtil::getRelativePath(WCF_DIR.'icon/', WCF_DIR.$this->iconPath));
- if (strpos($relativePath, '../') !== false) {
- throw new UserInputException('iconPath', 'notValid');
- }
- }
-
// ensure image path is below WCF_DIR/images/
if ($this->imagePath) {
$relativePath = FileUtil::unifyDirSeperator(FileUtil::getRelativePath(WCF_DIR.'images/', WCF_DIR.$this->imagePath));
'copyright' => $this->copyright,
'license' => $this->license,
'authorName' => $this->authorName,
- 'authorURL' => $this->authorURL,
- 'iconPath' => $this->iconPath
+ 'authorURL' => $this->authorURL
),
'tmpHash' => $this->tmpHash,
'variables' => $this->variables
$this->authorName = $this->authorURL = $this->copyright = $this->fontFamily = $this->image = '';
$this->license = $this->styleDate = $this->styleDescription = $this->styleName = $this->styleVersion = '';
- $this->iconPath = 'icon/';
$this->imagePath = 'images/';
$this->templateGroupID = 0;
'availableUnits' => $this->availableUnits,
'copyright' => $this->copyright,
'fontFamily' => $this->fontFamily,
- 'iconPath' => $this->iconPath,
'imagePath' => $this->imagePath,
'license' => $this->license,
'styleDate' => $this->styleDate,
$this->authorName = $this->style->authorName;
$this->authorURL = $this->style->authorURL;
$this->copyright = $this->style->copyright;
- $this->iconPath = $this->style->iconPath;
$this->imagePath = $this->style->imagePath;
$this->license = $this->style->license;
$this->styleDate = $this->style->styleDate;
'copyright' => $this->copyright,
'license' => $this->license,
'authorName' => $this->authorName,
- 'authorURL' => $this->authorURL,
- 'iconPath' => $this->iconPath
+ 'authorURL' => $this->authorURL
),
'tmpHash' => $this->tmpHash,
'variables' => $this->variables
*/
public $activeMenuItem = 'wcf.acp.menu.link.style';
- /**
- * true, if style has custom icons
- * @var boolean
- */
- public $canExportIcons = false;
-
/**
* true, if style has custom images
* @var boolean
*/
public $exportAsPackage = false;
- /**
- * true, if icons should be exported
- * @var boolean
- */
- public $exportIcons = false;
-
/**
* true, if images should be exported
* @var boolean
throw new IllegalLinkException();
}
- if ($this->style->iconPath && $this->style->iconPath != 'icon/') $this->canExportIcons = true;
if ($this->style->imagePath && $this->style->imagePath != 'images/') $this->canExportImages = true;
if ($this->style->templateGroupID) $this->canExportTemplates = true;
}
public function readFormParameters() {
parent::readFormParameters();
- if ($this->canExportIcons && isset($_POST['exportIcons'])) $this->exportIcons = true;
if ($this->canExportImages && isset($_POST['exportImages'])) $this->exportImages = true;
if ($this->canExportTemplates && isset($_POST['exportTemplates'])) $this->exportTemplates = true;
// export style
$styleEditor = new StyleEditor($this->style);
- $styleEditor->export($this->exportTemplates, $this->exportImages, $this->exportIcons, $this->packageName);
+ $styleEditor->export($this->exportTemplates, $this->exportImages, $this->packageName);
// call saved event
$this->saved();
parent::assignVariables();
WCF::getTPL()->assign(array(
- 'canExportIcons' => $this->canExportIcons,
'canExportImages' => $this->canExportImages,
'canExportTemplates' => $this->canExportTemplates,
'exportAsPackage' => $this->exportAsPackage,
- 'exportIcons' => $this->exportIcons,
'exportImages' => $this->exportImages,
'exportTemplates' => $this->exportTemplates,
'packageName' => $this->packageName,
$count = parent::delete();
foreach ($this->objects as $style) {
- // remove custom icons
- if ($style->iconPath && $style->iconPath != 'icon/') {
- $this->removeDirectory($style->iconPath);
- }
-
// remove custom images
if ($style->imagePath && $style->imagePath != 'images/') {
$this->removeDirectory($style->imagePath);
'license' => $this->styleEditor->license,
'authorName' => $this->styleEditor->authorName,
'authorURL' => $this->styleEditor->authorURL,
- 'iconPath' => $this->styleEditor->iconPath,
'imagePath' => $this->styleEditor->imagePath
));
$data = array(
'name' => '', 'description' => array(), 'version' => '', 'image' => '', 'copyright' => '', 'default' => false,
'license' => '', 'authorName' => '', 'authorURL' => '', 'templates' => '', 'images' => '',
- 'variables' => '', 'date' => '0000-00-00', 'icons' => '', 'iconsPath' => '', 'imagesPath' => ''
+ 'variables' => '', 'date' => '0000-00-00', 'imagesPath' => ''
);
$categories = $xpath->query('/ns:style/*');
}
}
- // import icons
- if (!empty($data['icons']) && $data['iconsPath'] != 'icon/') {
- $iconsLocation = FileUtil::getRelativePath(WCF_DIR, self::getFileLocation($data['imagesPath']));
- $styleData['iconPath'] = $iconsLocation;
-
- $index = $tar->getIndexByFilename($data['icons']);
- if ($index !== false) {
- // extract icons tar
- $destination = FileUtil::getTemporaryFilename('icons_');
- $tar->extract($index, $destination);
-
- // open icons tar and group icons by package
- $iconsTar = new Tar($destination);
- $contentList = $iconsTar->getContentList();
- $packageToIcons = array();
- foreach ($contentList as $val) {
- if ($val['type'] == 'file') {
- $folders = explode('/', $val['filename']);
- $packageName = array_shift($folders);
- if (!isset($packageToIcons[$packageName])) {
- $packageToIcons[$packageName] = array();
- }
- $packageToIcons[$packageName][] = array('index' => $val['index'], 'filename' => implode('/', $folders));
- }
- }
-
- // copy icons
- foreach ($packageToIcons as $package => $icons) {
- // try to find package
- $sql = "SELECT packageDir
- FROM wcf".WCF_N."_package
- WHERE package = ?
- AND isApplication = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $package,
- 1
- ));
- while ($row = $statement->fetchArray()) {
- // get icon path
- $iconDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']).$iconsLocation;
-
- // create icon path
- if (!file_exists($iconDir)) {
- @mkdir($iconDir, 0777, true);
- @chmod($iconDir, 0777);
- }
-
- // copy icons
- foreach ($icons as $icon) {
- $iconsTar->extract($icon['index'], $iconDir.$icon['filename']);
- }
- }
- }
-
- // delete tmp file
- $iconsTar->close();
- @unlink($destination);
- }
- }
-
// import templates
if (!empty($data['templates'])) {
$index = $tar->getIndexByFilename($data['templates']);
1
));
while ($row = $statement->fetchArray()) {
- // get icon path
+ // get template path
$templatesDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$row['packageDir']).'templates/'.$templateGroupFolderName);
// create template path
*
* @param boolean $templates
* @param boolean $images
- * @param boolean $icons
* @param string $packageName
*/
- public function export($templates = false, $images = false, $icons = false, $packageName = '') {
+ public function export($templates = false, $images = false, $packageName = '') {
// create style tar
$styleTarName = FileUtil::getTemporaryFilename('style_', '.tgz');
$styleTar = new TarWriter($styleTarName, true);
$xml->writeElement('variables', 'variables.xml');
if ($templates) $xml->writeElement('templates', 'templates.tar');
if ($images) $xml->writeElement('images', 'images.tar', array('path' => $this->imagePath));
- if ($icons) $xml->writeElement('icons', 'icons.tar', array('path' => $this->iconPath));
$xml->endElement();
// append style info file to style tar
@unlink($imagesTarName);
}
- // export icons
- if ($icons && ($this->iconPath && $this->iconPath != 'icon/')) {
- // create icons tar
- $iconsTarName = FileUtil::getTemporaryFilename('icons_', '.tar');
- $iconsTar = new TarWriter($iconsTarName);
- @chmod($iconsTar, 0777);
-
- // append icons to tar
- $path = FileUtil::addTrailingSlash(WCF_DIR.$this->iconPath);
- if (file_exists($path) && is_dir($path)) {
- $icons = glob($path.'*.svg');
- foreach ($icons as $icon) {
- $iconsTar->add($icon, '', $path);
- }
- }
-
- $iconsTar->create();
- $styleTar->add($iconsTarName, 'icons.tar', $iconsTarName);
- @unlink($iconsTarName);
- }
-
// output file content
$styleTar->create();
<item name="wcf.acp.style.delete.confirmMessage"><![CDATA[Möchten Sie den Stil „{$style->styleName}“ wirklich löschen?]]></item>
<item name="wcf.acp.style.edit"><![CDATA[Stil bearbeiten]]></item>
<item name="wcf.acp.style.exportAsPackage"><![CDATA[Als Paket exportieren]]></item>
- <item name="wcf.acp.style.exportIcons"><![CDATA[Icons exportieren ({$style->iconPath})]]></item>
<item name="wcf.acp.style.exportImages"><![CDATA[Grafiken exportieren ({$style->imagePath})]]></item>
<item name="wcf.acp.style.exportTemplates"><![CDATA[Templates exportieren]]></item>
<item name="wcf.acp.style.exportStyle"><![CDATA[Stil exportieren]]></item>
<item name="wcf.acp.style.globals.fontSize"><![CDATA[Schriftgröße]]></item>
<item name="wcf.acp.style.globals.layout"><![CDATA[Layout]]></item>
<item name="wcf.acp.style.globals.useFluidLayout"><![CDATA[Flexible Breite verwenden]]></item>
- <item name="wcf.acp.style.iconPath"><![CDATA[Icon-Pfad]]></item>
- <item name="wcf.acp.style.iconPath.description"><![CDATA[Wenn Ihr Stil eigene Icons benötigt, sollten diese in einem Unterordner des Ordners „icons“ ablegen. Geben Sie hier den Pfad zu diesem Ordner an.]]></item>
<item name="wcf.acp.style.image"><![CDATA[Vorschaubild]]></item>
<item name="wcf.acp.style.image.description"><![CDATA[Laden Sie hier ein Vorschaubild dieses Stiles hoch, als Bildformate sind JPG und PNG zulässig. Es wird empfohlen Vorschaubilder immer mit der Größe 102px × 64px anzulegen, größere Grafiken werden automatisch skaliert.]]></item>
<item name="wcf.acp.style.imagePath"><![CDATA[Bilder-Pfad]]></item>
license VARCHAR(255) NOT NULL DEFAULT '',
authorName VARCHAR(255) NOT NULL DEFAULT '',
authorURL VARCHAR(255) NOT NULL DEFAULT '',
- iconPath VARCHAR(255) NOT NULL DEFAULT '',
imagePath VARCHAR(255) NOT NULL DEFAULT ''
);