From dc65abe0bf60b92f9f95b67222ad65c4d8bb2b62 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 9 Oct 2013 11:55:41 +0200 Subject: [PATCH] Properly cloning i18n style description --- .../lib/data/style/StyleAction.class.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wcfsetup/install/files/lib/data/style/StyleAction.class.php b/wcfsetup/install/files/lib/data/style/StyleAction.class.php index 6e6e9791fc..eee7cc6feb 100644 --- a/wcfsetup/install/files/lib/data/style/StyleAction.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleAction.class.php @@ -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) -- 2.20.1