Fixed error handling for controller aliasing
authorAlexander Ebert <ebert@woltlab.com>
Thu, 19 Feb 2015 15:35:18 +0000 (16:35 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 19 Feb 2015 15:35:18 +0000 (16:35 +0100)
wcfsetup/install/files/lib/system/option/UrlControllerReplacementOptionType.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index b06a269e63c834bc125fab8cb4494284334763f4..30e59861d686aa38be9942a69a6ead432551e0ae 100644 (file)
@@ -42,7 +42,7 @@ class UrlControllerReplacementOptionType extends TextareaOptionType {
                        $controllers = array();
                        for ($i = 0, $length = count($lines); $i < $length; $i++) {
                                $line = $lines[$i];
-                               if (preg_match('~^(?P<controller>[a-z0-9\-]+)=(?P<alias>[a-z0-9\-]+)$~', $line, $matches)) {
+                               if (preg_match('~^(?P<controller>[a-z][a-z0-9\-]+)=(?P<alias>[a-z][a-z0-9\-]+)$~', $line, $matches)) {
                                        // check if there is already a replacement for given controller
                                        if (in_array($matches['controller'], $controllers)) {
                                                WCF::getTPL()->assign('urlControllerReplacementError', $matches['controller']);
@@ -71,6 +71,7 @@ class UrlControllerReplacementOptionType extends TextareaOptionType {
                                        }
                                }
                                else {
+                                       WCF::getTPL()->assign('urlControllerReplacementError', $line);
                                        throw new UserInputException($option->optionName, 'controllerReplacementInvalidFormat', array('line' => $line));
                                }
                        }
index 3632ff2b0716d096d8f58b83a4d8d721cb55b273..6f271aec21687fc6e5108927a0100a9faecb7984 100644 (file)
                <item name="wcf.acp.option.error.controllerReplacementCollision"><![CDATA[Das Alias „{$urlControllerReplacementError}“ kollidiert mit einem real existierenden Controller und ist daher unzulässig.]]></item>
                <item name="wcf.acp.option.error.controllerReplacementDuplicateAlias"><![CDATA[Das Alias „{$urlControllerReplacementError}“ wird bereits verwendet.]]></item>
                <item name="wcf.acp.option.error.controllerReplacementDuplicateController"><![CDATA[Dem Controller „{$urlControllerReplacementError}“ wurde bereits ein Alias zugewiesen.]]></item>
-               <item name="wcf.acp.option.error.controllerReplacementDuplicateUnknown"><![CDATA[Der Controller „{$urlControllerReplacementError}“ ist unbekannt.]]></item>
+               <item name="wcf.acp.option.error.controllerReplacementInvalidFormat"><![CDATA[Die Angabe muss im Format „realer-name=neuer-name“ erfolgen, die Zeile „{$urlControllerReplacementError}“ is ungültig.]]></item>
+               <item name="wcf.acp.option.error.controllerReplacementUnknown"><![CDATA[Der Controller „{$urlControllerReplacementError}“ ist unbekannt.]]></item>
                <item name="wcf.acp.option.error.tooHigh"><![CDATA[Der angegebene Wert ist zu hoch.{if $option->maxvalue !== null} Der maximale Wert ist {#$option->maxvalue}.{/if}]]></item>
                <item name="wcf.acp.option.error.tooLow"><![CDATA[Der angegebene Wert ist zu gering.{if $option->minvalue !== null} Der minimale Wert ist {#$option->minvalue}.{/if}]]></item>
                <item name="wcf.acp.option.export"><![CDATA[Optionen sichern]]></item>
index ea3ebd6c4f2354d3469fb666e701b6d8f1aeeff5..9d24f1fb43a2dd04de6c1454d2fd35c1d38d147c 100644 (file)
@@ -739,7 +739,8 @@ Examples for medium ID detection:
                <item name="wcf.acp.option.error.controllerReplacementCollision"><![CDATA[The alias “{$urlControllerReplacementError}” equals an existing controller and cannot be used.]]></item>
                <item name="wcf.acp.option.error.controllerReplacementDuplicateAlias"><![CDATA[The alias “{$urlControllerReplacementError}” is already in use.]]></item>
                <item name="wcf.acp.option.error.controllerReplacementDuplicateController"><![CDATA[The controller “{$urlControllerReplacementError}” has already been aliased.]]></item>
-               <item name="wcf.acp.option.error.controllerReplacementDuplicateUnknown"><![CDATA[The controller “{$urlControllerReplacementError}” is unknown.]]></item>
+               <item name="wcf.acp.option.error.controllerReplacementInvalidFormat"><![CDATA[You must provide aliases using “real-name=custom-name”, the line “{$urlControllerReplacementError}” violates it.]]></item>
+               <item name="wcf.acp.option.error.controllerReplacementUnknown"><![CDATA[The controller “{$urlControllerReplacementError}” is unknown.]]></item>
                <item name="wcf.acp.option.error.tooHigh"><![CDATA[Exceeds the maximum value{if $option->maxvalue !== null} of {#$option->maxvalue}{/if}.]]></item>
                <item name="wcf.acp.option.error.tooLow"><![CDATA[Below the minimum value{if $option->minvalue !== null} of {#$option->minvalue}{/if}.]]></item>
                <item name="wcf.acp.option.export"><![CDATA[Download Options]]></item>