Beispiel #1
0
 /**
  * Smarty Error Display.
  *
  * This method defines the html-output when an Smarty Template Error occurs.
  * It's output is a shortened version of the normal error report, presenting
  * only the errorname, filename and the line of the error.
  * The parameters used for the small report are $errorname, $errorfile, $errorline.
  * If you need a full errorreport, you can add more parameters from the methodsignature
  * to the $errormessage output.
  *
  * Smarty Template Errors are only displayed, when Koch Framework is in DEBUG Mode.
  *
  * @see \Koch\Exception\Errorhandler
  *
  * A direct link to the template editor for editing the file with the error
  * is only displayed, when Koch Framework runs in DEVELOPMENT Mode.
  * @see addTemplateEditorLink()
  *
  * @param int         $errno      contains the error as integer
  * @param string      $errstr     contains error string info
  * @param string      $errfile    contains the filename with occuring error
  * @param string      $errline    contains the line of error
  * @param string|null $errcontext contains vars from error context
  * @param string      $errorname
  *
  * @return string HTML with Smarty Error Text and Link.
  */
 public static function render($errno, $errorname, $errstr, $errfile, $errline, $errcontext)
 {
     $html = '';
     $html .= '<span>';
     $html .= '<h4><font color="#ff0000">&raquo; Smarty Template Error &laquo;</font></h4>';
     #$html .= '<u>' . $errorname . ' (' . $errno . '): </u><br/>';
     $html .= '<b>' . wordwrap($errstr, 50, "\n") . '</b><br/>';
     $html .= 'File: ' . $errfile . '<br/>Line: ' . $errline;
     $html .= Errorhandler::getTemplateEditorLink($errfile, $errline, $errcontext);
     $html .= '<br/></span>';
     return $html;
 }
Beispiel #2
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;
 }