Ejemplo n.º 1
0
 /**
  * Renders a Koch Framework Error.
  *
  * @param int    $errno
  * @param string $errstr
  * @param string $errfile
  * @param string $errline
  * @param int    $errline
  * @param string $errcontext
  * @param string $errorname
  */
 public static function renderError($errno, $errorname, $errstr, $errfile, $errline, $errcontext)
 {
     // shorten errorfile string by removing the root path
     $errfile_short = str_replace(APPLICATION_PATH, '', $errfile);
     $short_errorstring = \Koch\Functions\Functions::shortenString($errfile, 70, '...');
     // Header
     $html = '<html><head>';
     $html .= '<title>Koch Framework Error</title>';
     $html .= '<link rel="stylesheet" href="' . WWW_ROOT_THEMES_CORE . 'css/error.css" type="text/css" />';
     $html .= '</head>';
     // Body
     $html .= '<body>';
     // Fieldset with Legend
     $html .= '<fieldset id="top" class="error_red">';
     $html .= '<legend>Koch Framework Error</legend>';
     // Add Errorlogo
     $html .= '<div style="float: left; margin: 5px; margin-right: 25px; padding: 20px;">';
     $html .= '<img src="' . WWW_ROOT_THEMES_CORE . 'images/Clansuite-Toolbar-Icon-64-error.png"';
     $html .= ' style="border: 2px groove #000000;"/></div>';
     // Open Error Table
     $html .= '<table width="80%"><tr><td>';
     // Panel 1 - Errormessage
     $html .= '<div id="panel1" class="panel">';
     $html .= '<h3>Error - ' . $errorname . ' (' . $errno . ')</h3> ';
     $html .= '<p style="font-weight: bold;">' . $errstr . '</p>';
     $html .= '<p>in file "<span style="font-weight: bold;">' . $errfile_short . '</span>"';
     $html .= ' on line #<span style="font-weight: bold;">' . $errline . '.</span></p>';
     $html .= '</div>';
     // Panel 2 - Error Context
     $html .= '<div id="panel2" class="panel">';
     $html .= '<h3>Context</h3>';
     $html .= '<p><span class="small">You are viewing the source code of the file "';
     $html .= $errfile . '" around line ' . $errline . '.</span></p>';
     $html .= Errorhandler::getErrorContext($errfile, $errline, 8) . '</div>';
     // Panel 3 - Debug Backtracing
     $html .= Errorhandler::getDebugBacktrace($short_errorstring);
     // Panel 4 - Environmental Informations at Errortime
     $html .= '<div id="panel4" class="panel">';
     $html .= '<h3>Server Environment</h3>';
     $html .= '<p><table width="95%">';
     $html .= '<tr><td colspan="2"></td></tr>';
     $html .= '<tr><td><strong>Date: </strong></td><td>' . date('r') . '</td></tr>';
     $html .= '<tr><td><strong>Remote: </strong></td><td>' . $_SERVER['REMOTE_ADDR'] . '</td></tr>';
     $html .= '<tr><td><strong>Request: </strong></td><td>' . htmlentities($_SERVER['QUERY_STRING'], ENT_QUOTES);
     $html .= '</td></tr>';
     $html .= '<tr><td><strong>PHP: </strong></td><td>' . PHP_VERSION . ' ' . PHP_EXTRA_VERSION . '</td></tr>';
     $html .= '<tr><td><strong>Server: </strong></td><td>' . $_SERVER['SERVER_SOFTWARE'] . '</td></tr>';
     $html .= '<tr><td><strong>Agent: </strong></td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>';
     $html .= '<tr><td><strong>Clansuite: </strong></td><td>';
     $html .= APPLICATION_VERSION . ' ' . APPLICATION_VERSION_STATE . ' (' . APPLICATION_VERSION_NAME . ')';
     $html .= '</td></tr>';
     $html .= '</table></p></div>';
     // Panel 5 - Backlink to Bugtracker with Errormessage -> http://trac.clansuite.com/newticket
     $html .= Errorhandler::getBugtrackerBacklinks($errorname, $errfile, $errline, $errcontext);
     // Close Error Table
     $html .= '</table>';
     // Add Footer with Support-Backlinks
     $html .= Errorhandler::getSupportBacklinks();
     // Close all html elements
     $html .= '</fieldset><br /><br />';
     $html .= '</body></html>';
     return $html;
 }