{* custom declarations *}
<div id="advanced-custom" class="tabMenuContent">
- <section class="section">
+ <section class="section"{if $errorField == 'individualScss'} formError{/if}>
<h2 class="sectionTitle">{lang}wcf.acp.style.advanced.individualScss{/lang}</h2>
<dl class="wide">
</div>
<small>{lang}wcf.acp.style.advanced.individualScss.description{/lang}</small>
</dd>
+ {if $errorField == 'individualScss'}
+ <small class="innerError">
+ {lang}wcf.acp.style.advanced.individualScss.error{/lang}
+ </small>
+ {/if}
</dl>
</section>
<div id="advanced-original" class="tabMenuContent">
{/if}
- <section class="section">
+ <section class="section{if $errorField == 'individualScss' && $isTainted} formError{/if}">
<h2 class="sectionTitle">{lang}wcf.acp.style.advanced.individualScss{/lang}{if !$isTainted} ({lang}wcf.acp.style.protected.less{/lang}){/if}</h2>
<dl class="wide">
</div>
<small>{lang}wcf.acp.style.advanced.individualScss.description{/lang}</small>
</dd>
+ {if $errorField == 'individualScss' && $isTainted}
+ <small class="innerError">
+ {lang}wcf.acp.style.advanced.individualScss.error{/lang}
+ </small>
+ {/if}
</dl>
</section>
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
use wcf\system\Regex;
+use wcf\system\style\StyleCompiler;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
use wcf\util\DateUtil;
$this->parseOverrides();
}
+ $this->validateIndividualScss();
+
$this->validateApiVersion();
}
+ /**
+ * Validates the individual scss.
+ * @throws UserInputException
+ * @since 5.3
+ */
+ public function validateIndividualScss() {
+ $variables = array_merge(StyleCompiler::getDefaultVariables(), $this->variables);
+
+ $result = StyleCompiler::getInstance()->testStyle($this->apiVersion, $this->imagePath, $variables);
+
+ if ($result !== true) {
+ throw new UserInputException('individualScss', [
+ 'message' => $result,
+ ]);
+ }
+ }
+
/**
* Disallow the use of `com.woltlab.*` for package names to avoid accidental collisions.
*
use wcf\data\user\cover\photo\UserCoverPhoto;
use wcf\form\AbstractForm;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\SystemException;
+use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
+use wcf\system\style\StyleCompiler;
use wcf\system\WCF;
/**
}
}
+ /**
+ * @inheritDoc
+ */
+ public function validateIndividualScss() {
+ $variables = $this->variables;
+ if (!$this->style->isTainted) {
+ $variables['individualScss'] = Style::joinLessVariables($variables['individualScss'], $variables['individualScssCustom']);
+ $variables['overrideScss'] = Style::joinLessVariables($variables['overrideScss'], $variables['overrideScssCustom']);
+
+ unset($variables['individualScssCustom']);
+ unset($variables['overrideScssCustom']);
+ }
+
+ $variables = array_merge(StyleCompiler::getDefaultVariables(), $variables);
+
+ $result = StyleCompiler::getInstance()->testStyle($this->apiVersion, $this->imagePath, $variables);
+
+ if ($result !== true) {
+ throw new UserInputException('individualScss', [
+ 'message' => $result,
+ ]);
+ }
+ }
+
/**
* @inheritDoc
*/
<item name="wcf.acp.style.advanced.overrideScss.error.invalid"><![CDATA[Eingabe „{$error[text]}“ ungültig]]></item>
<item name="wcf.acp.style.advanced.overrideScss.error.predefined"><![CDATA[Variable „{$error[text]}“ wird bereits durch den Stil-Editor gesetzt]]></item>
<item name="wcf.acp.style.advanced.overrideScss.error.unknown"><![CDATA[Variable „{$error[text]}“ unbekannt]]></item>
+ <item name="wcf.acp.style.advanced.individualScss.error"><![CDATA[Der SCSS-Code ist invalid: {$errorType.message}.]]></item>
<item name="wcf.acp.style.apiVersion"><![CDATA[Kompatibilität mit WoltLab Suite in Version]]></item>
<item name="wcf.acp.style.apiVersion.deprecated"><![CDATA[veraltet]]></item>
<item name="wcf.acp.style.apiVersion.description"><![CDATA[Deaktiviert ausgewählte Stil-Verbesserungen, um die Kompatibilität mit Stilen für eine ältere Version von WoltLab Suite zu gewährleisten.]]></item>
<item name="wcf.acp.style.advanced.overrideScss.error.invalid"><![CDATA[The input for “{$error[text]}” invalid.]]></item>
<item name="wcf.acp.style.advanced.overrideScss.error.predefined"><![CDATA[The variable “{$error[text]}” is already defined by the style editor.]]></item>
<item name="wcf.acp.style.advanced.overrideScss.error.unknown"><![CDATA[The variable “{$error[text]}” is not recognized.]]></item>
+ <item name="wcf.acp.style.advanced.individualScss.error"><![CDATA[The SCSS code is invalid: {$errorType.message}.]]></item>
<item name="wcf.acp.style.apiVersion"><![CDATA[Enable Compatibility Mode with WoltLab Suite]]></item>
<item name="wcf.acp.style.apiVersion.deprecated"><![CDATA[deprecated]]></item>
<item name="wcf.acp.style.apiVersion.description"><![CDATA[Disables selected style improvements in order to maximize compatibility with styles for earlier versions of WoltLab Suite.]]></item>