Removed obsolete icon path
authorMarcel Werk <burntime@woltlab.com>
Fri, 22 Feb 2013 22:03:23 +0000 (23:03 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 22 Feb 2013 22:03:23 +0000 (23:03 +0100)
wcfsetup/install/files/acp/templates/styleAdd.tpl
wcfsetup/install/files/acp/templates/styleExport.tpl
wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php
wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php
wcfsetup/install/files/lib/data/style/StyleAction.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/lang/de.xml
wcfsetup/setup/db/install.sql

index 60da7a4eb19dc778b1525d4dd8fd454f91ef714a..022c13faef46cf2495fca2d11bdb7ceb97789181 100644 (file)
                                                </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>
index bdc7abd34659d021995d79363f4ec188b66e31e0..1da04bbfb3614c198172c6457e81b7625bb8453a 100644 (file)
                        <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>
index da3a17f87fb10d0c3d5eb9ff040ad0939925476e..7ca219682afe5952db0c66ac6a33868f1581919d 100644 (file)
@@ -99,12 +99,6 @@ class StyleAddForm extends AbstractForm {
         */
        public $globals = array();
        
-       /**
-        * icon path
-        * @var string
-        */
-       public $iconPath = 'icon/';
-       
        /**
         * image path
         * @var string
@@ -229,7 +223,6 @@ class StyleAddForm extends AbstractForm {
                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']);
@@ -286,14 +279,6 @@ class StyleAddForm extends AbstractForm {
                        }
                }
                
-               // 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));
@@ -494,8 +479,7 @@ class StyleAddForm extends AbstractForm {
                                'copyright' => $this->copyright,
                                'license' => $this->license,
                                'authorName' => $this->authorName,
-                               'authorURL' => $this->authorURL,
-                               'iconPath' => $this->iconPath
+                               'authorURL' => $this->authorURL
                        ),
                        'tmpHash' => $this->tmpHash,
                        'variables' => $this->variables
@@ -518,7 +502,6 @@ class StyleAddForm extends AbstractForm {
                $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;
                
@@ -545,7 +528,6 @@ class StyleAddForm extends AbstractForm {
                        'availableUnits' => $this->availableUnits,
                        'copyright' => $this->copyright,
                        'fontFamily' => $this->fontFamily,
-                       'iconPath' => $this->iconPath,
                        'imagePath' => $this->imagePath,
                        'license' => $this->license,
                        'styleDate' => $this->styleDate,
index 4d61392d12cff820a6987035c4ae70a66c75f0fd..ba27ccdca134fc9f34cb830d86bde2a0adf0b1e2 100644 (file)
@@ -80,7 +80,6 @@ class StyleEditForm extends StyleAddForm {
                        $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;
@@ -107,8 +106,7 @@ class StyleEditForm extends StyleAddForm {
                                'copyright' => $this->copyright,
                                'license' => $this->license,
                                'authorName' => $this->authorName,
-                               'authorURL' => $this->authorURL,
-                               'iconPath' => $this->iconPath
+                               'authorURL' => $this->authorURL
                        ),
                        'tmpHash' => $this->tmpHash,
                        'variables' => $this->variables
index 4d87c6e21f3b3a15442f286e93b98023380f4599..aeb737343e9f2495b8c16e965ed5ffbea17cff64 100644 (file)
@@ -25,12 +25,6 @@ class StyleExportForm extends AbstractForm {
         */
        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
@@ -49,12 +43,6 @@ class StyleExportForm extends AbstractForm {
         */
        public $exportAsPackage = false;
        
-       /**
-        * true, if icons should be exported
-        * @var boolean
-        */
-       public $exportIcons = false;
-       
        /**
         * true, if images should be exported
         * @var boolean
@@ -102,7 +90,6 @@ class StyleExportForm extends AbstractForm {
                        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;
        }
@@ -113,7 +100,6 @@ class StyleExportForm extends AbstractForm {
        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;
                
@@ -167,7 +153,7 @@ class StyleExportForm extends AbstractForm {
                
                // 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();
@@ -182,11 +168,9 @@ class StyleExportForm extends AbstractForm {
                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,
index 5af04b76fc99ff88364a40d3e763af235a1f5ce6..1af9e585424d3348738a66afb429ff79c589a797 100644 (file)
@@ -98,11 +98,6 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                $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);
@@ -400,7 +395,6 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                        'license' => $this->styleEditor->license,
                        'authorName' => $this->styleEditor->authorName,
                        'authorURL' => $this->styleEditor->authorURL,
-                       'iconPath' => $this->styleEditor->iconPath,
                        'imagePath' => $this->styleEditor->imagePath
                ));
                
index bd2018f9b56f84a316cb5801c27eb48b0f57e8b0..4caa4b9796f92df224b6e43d46dc9cd49c8b54ce 100644 (file)
@@ -132,7 +132,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                $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/*');
@@ -391,67 +391,6 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                        }
                }
                
-               // 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']);
@@ -488,7 +427,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                                                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
@@ -616,10 +555,9 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
         * 
         * @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);
@@ -673,7 +611,6 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                $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
@@ -755,27 +692,6 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                        @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();
                
index ed08fc68384dfce779b5be3f69fefd60e1899d80..bab64458f6f214d4b17918d0e7d6197e7b7cc519 100644 (file)
                <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>
index f1cba06078ea2e90bcfffcc1dbcdac0c4787b5a4..792a3341594510bafca4286420e7dbf419565726 100644 (file)
@@ -561,7 +561,6 @@ CREATE TABLE wcf1_style (
        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 ''
 );