Collapse some nested if statements
[lhc/web/wiklou.git] / includes / exception / MWExceptionRenderer.php
index f99ce1c..66775bf 100644 (file)
@@ -71,14 +71,12 @@ class MWExceptionRenderer {
                                                self::getShowBacktraceError( $e );
                                }
                                $message .= "\n";
+                       } elseif ( $wgShowExceptionDetails ) {
+                               $message = MWExceptionHandler::getLogMessage( $e ) .
+                                       "\nBacktrace:\n" .
+                                       MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n";
                        } else {
-                               if ( $wgShowExceptionDetails ) {
-                                       $message = MWExceptionHandler::getLogMessage( $e ) .
-                                               "\nBacktrace:\n" .
-                                               MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n";
-                               } else {
-                                       $message = MWExceptionHandler::getPublicLogMessage( $e );
-                               }
+                               $message = MWExceptionHandler::getPublicLogMessage( $e );
                        }
                        echo nl2br( htmlspecialchars( $message ) ) . "\n";
                }
@@ -268,6 +266,7 @@ class MWExceptionRenderer {
         * Print a message, if possible to STDERR.
         * Use this in command line mode only (see isCommandLine)
         *
+        * @suppress SecurityCheck-XSS
         * @param string $message Failure text
         */
        private static function printError( $message ) {
@@ -323,47 +322,7 @@ class MWExceptionRenderer {
                                htmlspecialchars( $e->getTraceAsString() ) . '</pre>';
                }
 
-               $html .= '<hr />';
-               $html .= self::googleSearchForm();
                $html .= '</body></html>';
                echo $html;
        }
-
-       /**
-        * @return string
-        */
-       private static function googleSearchForm() {
-               global $wgSitename, $wgCanonicalServer, $wgRequest;
-
-               $usegoogle = htmlspecialchars( self::msg(
-                       'dberr-usegoogle',
-                       'You can try searching via Google in the meantime.'
-               ) );
-               $outofdate = htmlspecialchars( self::msg(
-                       'dberr-outofdate',
-                       'Note that their indexes of our content may be out of date.'
-               ) );
-               $googlesearch = htmlspecialchars( self::msg( 'searchbutton', 'Search' ) );
-               $search = htmlspecialchars( $wgRequest->getVal( 'search' ) );
-               $server = htmlspecialchars( $wgCanonicalServer );
-               $sitename = htmlspecialchars( $wgSitename );
-               $trygoogle = <<<EOT
-<div style="margin: 1.5em">$usegoogle<br />
-<small>$outofdate</small>
-</div>
-<form method="get" action="//www.google.com/search" id="googlesearch">
-       <input type="hidden" name="domains" value="$server" />
-       <input type="hidden" name="num" value="50" />
-       <input type="hidden" name="ie" value="UTF-8" />
-       <input type="hidden" name="oe" value="UTF-8" />
-       <input type="text" name="q" size="31" maxlength="255" value="$search" />
-       <input type="submit" name="btnG" value="$googlesearch" />
-       <p>
-               <label><input type="radio" name="sitesearch" value="$server" checked="checked" />$sitename</label>
-               <label><input type="radio" name="sitesearch" value="" />WWW</label>
-       </p>
-</form>
-EOT;
-               return $trygoogle;
-       }
 }