Add the exception_privacy option
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 29 Sep 2015 20:31:17 +0000 (22:31 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 1 Dec 2015 21:15:48 +0000 (22:15 +0100)
com.woltlab.wcf/option.xml
wcfsetup/install/files/lib/core.functions.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index fa5ea7b49c888323330185fca8210e610c2ac3ee..053be465ce0a86f7f6116a2150d1dcc40c9251f4 100644 (file)
@@ -42,6 +42,9 @@
                                        <parent>general</parent>
                                        <showorder>3</showorder>
                                </category>
+                                       <category name="general.system.error">
+                                               <parent>general.system</parent>
+                                       </category>
                                        <category name="general.system.cookie">
                                                <parent>general.system</parent>
                                        </category>
@@ -496,6 +499,17 @@ imagick:wcf.acp.option.image_adapter_type.imagick]]>
                        </option>
                        <!-- /general.system.search -->
                        
+                       <!-- general.system.error -->
+                       <option name="exception_privacy">
+                               <categoryname>general.system.error</categoryname>
+                               <optiontype>radioButton</optiontype>
+                               <defaultvalue><![CDATA[mysql]]></defaultvalue>
+                               <selectoptions><![CDATA[public:wcf.acp.option.exception_privacy.public
+reduced:wcf.acp.option.exception_privacy.reduced
+private:wcf.acp.option.exception_privacy.private]]></selectoptions>
+                       </option>
+                       <!-- /general.system.error-->
+                       
                        <!-- general.system.cookie -->
                        <option name="cookie_prefix">
                                <categoryname>general.system.cookie</categoryname>
index 4649cabdd9c77c102d324510369b2ffe7315ebc7..fc0dfc01a00276cb4b1752710f8da744cf7973dc 100644 (file)
@@ -100,7 +100,7 @@ namespace wcf\functions\exception {
        ?><!DOCTYPE html>
        <html>
                <head>
-                       <?php if (WCF::debugModeIsEnabled()) { ?>
+                       <?php if (!defined('EXCEPTION_PRIVACY') || EXCEPTION_PRIVACY !== 'private') { ?>
                        <title>Fatal Error: <?php echo StringUtil::encodeHTML($e->getMessage()); ?></title>
                        <?php } else { ?>
                        <title>Fatal Error</title>
@@ -184,7 +184,7 @@ namespace wcf\functions\exception {
                </head>
                <body>
                        <div class="exception">
-                               <?php if (WCF::debugModeIsEnabled()) { ?>
+                               <?php if (!defined('EXCEPTION_PRIVACY') || EXCEPTION_PRIVACY !== 'private') { ?>
                                <h1>Fatal Error: <?php echo StringUtil::encodeHTML($e->getMessage()); ?></h1>
                                <?php } else { ?>
                                <h1>Fatal Error <!-- :( --></h1>
@@ -194,7 +194,7 @@ namespace wcf\functions\exception {
                                        <p>An unrecoverable error occured while trying to handle your request. The internal error code is as follows: <code><?php echo $exceptionID; ?></code></p>
                                        <p>Please send this code to the administrator to help him fix the issue.</p>
                                </div>
-                               <?php if (WCF::debugModeIsEnabled()) { ?>
+                               <?php if (!defined('EXCEPTION_PRIVACY') || EXCEPTION_PRIVACY !== 'private') { ?>
                                        <div>
                                                <h2>System Information</h2>
                                                <dl>
@@ -327,6 +327,10 @@ namespace wcf\functions\exception {
        }
 
        function sanitizePath($path) {
+               if (WCF::debugModeIsEnabled() && defined('EXCEPTION_PRIVACY') && EXCEPTION_PRIVACY === 'public') {
+                       return $path;
+               }
+               
                return '*/'.FileUtil::removeTrailingSlash(FileUtil::getRelativePath(WCF_DIR, $path));
        }
 }
index 802904bde2d70adc38a0a8c6b1346a6f49c05a8b..61a0c84116abb6fe2e76e7948f48f9b0ad97f342 100644 (file)
@@ -205,6 +205,10 @@ class PackageInstallationDispatcher {
                                                        1,
                                                        'enable_debug_mode'
                                                ));
+                                               $statement->execute(array(
+                                                       'public',
+                                                       'exception_privacy'
+                                               ));
                                        }
                                        
                                        // update options.inc.php
index 6fcfa3b0c6446f79ae100369b4caaef8178599b3..49255cca324092fb81d7946d4f5f316cb2b03709 100644 (file)
                <item name="wcf.acp.option.category.general.system.date"><![CDATA[Datum &amp; Zeit]]></item>
                <item name="wcf.acp.option.category.general.system.image"><![CDATA[Grafik]]></item>
                <item name="wcf.acp.option.category.general.system"><![CDATA[System]]></item>
+               <item name="wcf.acp.option.category.general.system.error"><![CDATA[Fehlermeldungen]]></item>
                <item name="wcf.acp.option.category.general.system.cookie"><![CDATA[Cookies]]></item>
                <item name="wcf.acp.option.category.general.system.http"><![CDATA[HTTP]]></item>
                <item name="wcf.acp.option.category.general.system.proxy"><![CDATA[Proxy-Server]]></item>
                <item name="wcf.acp.option.category.security.antispam"><![CDATA[Anti-Spam]]></item>
                <item name="wcf.acp.option.category.security.censorship"><![CDATA[Zensur]]></item>
                <item name="wcf.acp.option.category.general.system.jquery"><![CDATA[jQuery]]></item>
+               <item name="wcf.acp.option.exception_privacy"><![CDATA[Privatsphäre]]></item>
+               <item name="wcf.acp.option.exception_privacy.description"><![CDATA[Gibt an, wie detailliert die Fehlermeldungen sind. Privat versteckt Fehler vollständig, gekürzt versucht private Informationen zu verstecken und öffentlich (nur bei aktivem Debug-Modus) zeigt alle Informationen an.]]></item>
+               <item name="wcf.acp.option.exception_privacy.public"><![CDATA[Öffentlich]]></item>
+               <item name="wcf.acp.option.exception_privacy.reduced"><![CDATA[Gekürzt]]></item>
+               <item name="wcf.acp.option.exception_privacy.private"><![CDATA[Privat]]></item>
                <item name="wcf.acp.option.cookie_domain"><![CDATA[Cookiedomain]]></item>
                <item name="wcf.acp.option.cookie_domain.description"><![CDATA[Standardmäßig sollten Sie dieses Feld frei lassen, da ein Ausfüllen nur in wenigen Fällen notwendig ist.]]></item>
                <item name="wcf.acp.option.cookie_path"><![CDATA[Cookiepfad]]></item>
index cfc8ba2dc56df45ef307773e42a7308516ab8e9c..9416109a0722c38a4b906dcf912d2f0339485f87 100644 (file)
@@ -709,6 +709,7 @@ Examples for medium ID detection:
                <item name="wcf.acp.option.category.general.system.date"><![CDATA[Date &amp; Time]]></item>
                <item name="wcf.acp.option.category.general.system.image"><![CDATA[Graphics]]></item>
                <item name="wcf.acp.option.category.general.system"><![CDATA[System]]></item>
+               <item name="wcf.acp.option.category.general.system.error"><![CDATA[Error messages]]></item>
                <item name="wcf.acp.option.category.general.system.cookie"><![CDATA[Cookies]]></item>
                <item name="wcf.acp.option.category.general.system.http"><![CDATA[HTTP]]></item>
                <item name="wcf.acp.option.category.general.system.proxy"><![CDATA[Proxy-Server]]></item>
@@ -739,6 +740,11 @@ Examples for medium ID detection:
                <item name="wcf.acp.option.category.security.antispam"><![CDATA[Anti-Spam]]></item>
                <item name="wcf.acp.option.category.security.censorship"><![CDATA[Censorship]]></item>
                <item name="wcf.acp.option.category.general.system.jquery"><![CDATA[jQuery]]></item>
+               <item name="wcf.acp.option.exception_privacy"><![CDATA[Privacy]]></item>
+               <item name="wcf.acp.option.exception_privacy.description"><![CDATA[Specifies how detailed the error messages are. Private completely hides the error message, reduced tries to hide sensitive information and public (only supported in debug mode) shows everything.]]></item>
+               <item name="wcf.acp.option.exception_privacy.public"><![CDATA[Public]]></item>
+               <item name="wcf.acp.option.exception_privacy.reduced"><![CDATA[Reduced]]></item>
+               <item name="wcf.acp.option.exception_privacy.private"><![CDATA[Private]]></item>
                <item name="wcf.acp.option.cookie_domain"><![CDATA[Cookie Domain]]></item>
                <item name="wcf.acp.option.cookie_domain.description"><![CDATA[Should be left blank except for special circumstances.]]></item>
                <item name="wcf.acp.option.cookie_path"><![CDATA[Cookie Path]]></item>