Merge pull request #37 from kurtextrem/master
authorAlexander Ebert <ebert@woltlab.com>
Mon, 25 Jul 2011 14:35:20 +0000 (16:35 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 25 Jul 2011 14:35:20 +0000 (16:35 +0200)
wcfsetup/install/files/lib/system/exception/SystemException.class.php

index 2be027dd53130e7d0486bd1c736eb41d66de058c..b8034abfadc16ed294b3f8733199ee0c0be6d131 100644 (file)
-<?php\r
-namespace wcf\system\exception;\r
-use wcf\util\StringUtil;\r
-\r
-/**\r
- * A SystemException is thrown when an unexpected error occurs.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.exception\r
- * @category   Community Framework\r
- */\r
-class SystemException extends \Exception implements IPrintableException {\r
-       /**\r
-        * error description\r
-        * @var string\r
-        */\r
-       protected $description = null;\r
-       \r
-       /**\r
-        * additional information\r
-        * @var string\r
-        */\r
-       protected $information = '';\r
-       \r
-       /**\r
-        * additional information\r
-        * @var string\r
-        */\r
-       protected $functions = '';\r
-       \r
-       /**\r
-        * Creates a new SystemException.\r
-        * \r
-        * @param       string          $message        error message\r
-        * @param       integer         $code           error code\r
-        * @param       string          $description    description of the error        \r
-        */\r
-       public function __construct($message = '', $code = 0, $description = '') {\r
-               parent::__construct($message, $code);\r
-               $this->description = $description;\r
-       }\r
-       \r
-       /**\r
-        * Returns the description of this exception.\r
-        * \r
-        * @return      string\r
-        */\r
-       public function getDescription() {\r
-               return $this->description;\r
-       }\r
-       \r
-       /**\r
-        * Removes database password from stack trace.\r
-        * @see Exception::getTraceAsString()\r
-        */\r
-       public function __getTraceAsString() {\r
-               $string = preg_replace('/Database->__construct\(.*\)/', 'Database->__construct(...)', $this->getTraceAsString());\r
-               $string = preg_replace('/mysqli->mysqli\(.*\)/', 'mysqli->mysqli(...)', $string);\r
-               return $string;\r
-       }\r
-       \r
-       /**\r
-        * @see wcf\system\exception\IPrintableException::show()\r
-        */\r
-       public function show() {\r
-               // send status code\r
-               @header('HTTP/1.1 503 Service Unavailable');\r
-               \r
-               // print report\r
-               echo '<?xml version="1.0" encoding="UTF-8"?>';\r
-               ?>\r
-               \r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en">\r
-<head>\r
-<title>Fatal error: <?php echo StringUtil::encodeHTML($this->getMessage()); ?></title>\r
-<style type="text/css">\r
-/*<![CDATA[*/\r
-.systemException {\r
-       border: 1px outset lightgrey;\r
-       padding: 3px;\r
-       background-color: lightgrey;\r
-       text-align: left;\r
-       overflow: auto;\r
-       font-family: Verdana, Helvetica, sans-serif;\r
-       font-size: .8em;\r
-}\r
-.systemException div {\r
-       border: 1px inset lightgrey;\r
-       padding: 4px;\r
-}\r
-.systemException h1 {\r
-       background-color: #154268;\r
-       padding: 4px;\r
-       color: #fff;\r
-       margin: 0 0 3px 0;\r
-       font-size: 1.15em;\r
-}\r
-.systemException h2 {\r
-       font-size: 1.1em;\r
-       margin-bottom: 0;\r
-}\r
-.systemException pre, .systemException p {\r
-       margin: 0;\r
-}\r
-.systemException pre {\r
-       font-size: .85em;\r
-       font-family: "Courier New";\r
-}\r
-/*]]>*/\r
-</style>\r
-</head>\r
-<body>\r
-       <div class="systemException">\r
-               <h1>Fatal error: <?php echo StringUtil::encodeHTML($this->getMessage()); ?></h1>\r
-       \r
-               <div>\r
-                       <p><?php echo $this->getDescription(); ?></p>\r
-                       <?php if ($this->getCode()) { ?><p>You get more information about the problem in the official WoltLab knowledge base: <a href="http://www.woltlab.com/help/?code=<?php echo intval($this->getCode()); ?>">http://www.woltlab.com/help/?code=<?php echo intval($this->getCode()); ?></a></p><?php } ?>\r
-                       \r
-                       <h2>Information:</h2>\r
-                       <p>\r
-                               <b>error message:</b> <?php echo StringUtil::encodeHTML($this->getMessage()); ?><br />\r
-                               <b>error code:</b> <?php echo intval($this->getCode()); ?><br />                                \r
-                               <?php echo $this->information; ?>\r
-                               <b>file:</b> <?php echo StringUtil::encodeHTML($this->getFile()); ?> (<?php echo $this->getLine(); ?>)<br />\r
-                               <b>php version:</b> <?php echo StringUtil::encodeHTML(phpversion()); ?><br />\r
-                               <b>wcf version:</b> <?php echo WCF_VERSION; ?><br />\r
-                               <b>date:</b> <?php echo gmdate('r'); ?><br />\r
-                               <b>request:</b> <?php if (isset($_SERVER['REQUEST_URI'])) echo StringUtil::encodeHTML($_SERVER['REQUEST_URI']); ?><br />\r
-                               <b>referer:</b> <?php if (isset($_SERVER['HTTP_REFERER'])) echo StringUtil::encodeHTML($_SERVER['HTTP_REFERER']); ?><br />\r
-                       </p>\r
-                       \r
-                       <h2>Stacktrace:</h2>\r
-                       <pre><?php echo StringUtil::encodeHTML($this->__getTraceAsString()); ?></pre>\r
-               </div>\r
-               \r
-               <?php echo $this->functions; ?>\r
-       </div>\r
-</body>\r
-</html>\r
-\r
-<?php\r
-       }\r
+<?php
+namespace wcf\system\exception;
+use wcf\util\StringUtil;
+
+/**
+ * A SystemException is thrown when an unexpected error occurs.
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.exception
+ * @category   Community Framework
+ */
+class SystemException extends \Exception implements IPrintableException {
+       /**
+        * error description
+        * @var string
+        */
+       protected $description = null;
+       
+       /**
+        * additional information
+        * @var string
+        */
+       protected $information = '';
+       
+       /**
+        * additional information
+        * @var string
+        */
+       protected $functions = '';
+       
+       /**
+        * Creates a new SystemException.
+        *
+        * @param       string          $message        error message
+        * @param       integer         $code           error code
+        * @param       string          $description    description of the error
+        */
+       public function __construct($message = '', $code = 0, $description = '') {
+               parent::__construct($message, $code);
+               $this->description = $description;
+       }
+       
+       /**
+        * Returns the description of this exception.
+        *
+        * @return      string
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+       
+       /**
+        * Removes database password from stack trace.
+        * @see \Exception::getTraceAsString()
+        */
+       public function __getTraceAsString() {
+               $string = preg_replace('/Database->__construct\(.*\)/', 'Database->__construct(...)', $this->getTraceAsString());
+               $string = preg_replace('/mysqli->mysqli\(.*\)/', 'mysqli->mysqli(...)', $string);
+               return $string;
+       }
+       
+       /**
+        * @see wcf\system\exception\IPrintableException::show()
+        */
+       public function show() {
+               // send status code
+               @header('HTTP/1.1 503 Service Unavailable');
+               
+               // print report
+               echo '<?xml version="1.0" encoding="UTF-8"?>';
+               
+               ?>
+
+               <!DOCTYPE html>
+               <html>
+                       <head>
+                               <title>Fatal error: <?php echo StringUtil::encodeHTML($this->getMessage()); ?></title>
+                               <style>
+                                       .systemException {
+                                               border: 1px outset lightgrey;
+                                               padding: 3px;
+                                               background-color: lightgrey;
+                                               text-align: left;
+                                               overflow: auto;
+                                               font-family: Verdana, Helvetica, sans-serif;
+                                               font-size: .8em;
+                                       }
+                                       .systemException div {
+                                               border: 1px inset lightgrey;
+                                               padding: 4px;
+                                       }
+                                       .systemException h1 {
+                                               background-color: #154268;
+                                               padding: 4px;
+                                               color: #fff;
+                                               margin: 0 0 3px 0;
+                                               font-size: 1.15em;
+                                               word-wrap: break-word;
+                                       }
+                                       .systemException h2 {
+                                               font-size: 1.1em;
+                                               margin-bottom: 0;
+                                       }
+                                       .systemException pre, .systemException p {
+                                               margin: 0;
+                                       }
+                                       .systemException pre {
+                                               font-size: .85em;
+                                               font-family: "Courier New";
+                                               text-overflow: ellipsis;
+                                               overflow: hidden;
+                                       }
+                                       .systemException pre:hover{
+                                               overflow: auto;
+                                               text-overflow: clip;
+                                       }
+                               </style>
+                       </head>
+                       <body>
+                               <div class="systemException">
+                                       <h1>Fatal error: <?php echo StringUtil::encodeHTML($this->getMessage()); ?></h1>
+
+                                       <div>
+                                               <p><?php echo $this->getDescription(); ?></p>
+                                               <?php if ($this->getCode()) { ?><p>You get more information about the problem in the official WoltLab knowledge base: <a href="http://www.woltlab.com/help/?code=<?php echo intval($this->getCode()); ?>">http://www.woltlab.com/help/?code=<?php echo intval($this->getCode()); ?></a></p><?php } ?>
+
+                                               <h2>Information:</h2>
+                                               <p>
+                                                       <b>error message:</b> <?php echo StringUtil::encodeHTML($this->getMessage()); ?><br>
+                                                       <b>error code:</b> <?php echo intval($this->getCode()); ?><br>
+                                                       <?php echo $this->information; ?>
+                                                       <b>file:</b> <?php echo StringUtil::encodeHTML($this->getFile()); ?> (<?php echo $this->getLine(); ?>)<br>
+                                                       <b>php version:</b> <?php echo StringUtil::encodeHTML(phpversion()); ?><br>
+                                                       <b>wcf version:</b> <?php echo WCF_VERSION; ?><br>
+                                                       <b>date:</b> <?php echo gmdate('r'); ?><br>
+                                                       <b>request:</b> <?php if (isset($_SERVER['REQUEST_URI']))  echo StringUtil::encodeHTML($_SERVER['REQUEST_URI']); ?><br>
+                                                       <b>referer:</b> <?php if (isset($_SERVER['HTTP_REFERER'])) echo StringUtil::encodeHTML($_SERVER['HTTP_REFERER']); ?><br>
+                                               </p>
+
+                                               <h2>Stacktrace:</h2>
+                                               <pre><?php echo StringUtil::encodeHTML($this->__getTraceAsString()); ?></pre>
+                                       </div>
+
+                               <?php echo $this->functions; ?>
+                               </div>
+                       </body>
+               </html>
+
+               <?php
+       }
 }