Ejemplo n.º 1
0
 public static function formatScreenMessage(&$message, $level, $tag, $datetime, $log)
 {
     if ($message instanceof Error) {
         $errno = $message->errno & error_reporting();
         // problem when using error_reporting with the @ silent fail operator
         // it gives an errno 0, and in this case the objective is to NOT display anything on the screen!
         // is there any other case where the errno is zero at this point?
         if ($errno == 0) {
             $message = false;
             return;
         }
         Common::sendHeader('Content-Type: text/html; charset=utf-8');
         $htmlString = '';
         $htmlString .= "\n<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>\n        <strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\\Version') ? Version::VERSION : '') . ")\n        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>\n        ";
         $htmlString .= Error::getErrNoString($message->errno);
         $htmlString .= ":</strong> <em>{$message->errstr}</em> in <strong>{$message->errfile}</strong>";
         $htmlString .= " on line <strong>{$message->errline}</strong>\n";
         $htmlString .= "<br /><br />Backtrace --&gt;<div style=\"font-family:Courier;font-size:10pt\"><br />\n";
         $htmlString .= str_replace("\n", "<br />\n", $message->backtrace);
         $htmlString .= "</div><br />";
         $htmlString .= "\n </pre></div><br />";
         $message = $htmlString;
     }
 }