Properly cloning i18n style description
authorAlexander Ebert <ebert@woltlab.com>
Wed, 9 Oct 2013 09:55:41 +0000 (11:55 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 9 Oct 2013 09:55:41 +0000 (11:55 +0200)
wcfsetup/install/files/lib/data/style/StyleAction.class.php

index 6e6e9791fcb8c679cb21804c17a0af39e34ee1f3..eee7cc6febdac6c61272da07e34adfdc5437e722 100644 (file)
@@ -418,6 +418,26 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                        'imagePath' => $this->styleEditor->imagePath
                ));
                
+               // check if style description uses i18n
+               if (preg_match('~^wcf.style.styleDescription\d+$~', $newStyle->styleDescription)) {
+                       $styleDescription = 'wcf.style.styleDescription'.$newStyle->styleID;
+                       
+                       // copy language items
+                       $sql = "INSERT INTO     wcf".WCF_N."_language_item
+                                               (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
+                               SELECT          languageID, '".$styleDescription."', languageItemValue, 0, languageCategoryID, packageID
+                               FROM            wcf".WCF_N."_language_item
+                               WHERE           languageItem = ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($newStyle->styleDescription));
+                       
+                       // update style description
+                       $styleEditor = new StyleEditor($newStyle);
+                       $styleEditor->update(array(
+                               'styleDescription' => $styleDescription
+                       ));
+               }
+               
                // copy style variables
                $sql = "INSERT INTO     wcf".WCF_N."_style_variable_value
                                        (styleID, variableID, variableValue)