We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27310
    • 18 Posts
    SimonSimCity Reply #1, 18 years ago
    Why didn’t we get a cool Error-return if f.e. the Database is down ?

    Now I’ve styled my own for ModX 0.9.6.1

    To be valide I had to change the function logEvent()
    Because I can’t close all my HTML-Tags - This funtion has an echo!

    --- manager\includes\document.parser.class.inc.php	2008-09-14 10:42:19.015625000 +0200
    +++ manager\includes\document.parser.class.inc_old.php	2008-09-14 10:41:43.984375000 +0200
    @@ -1280,7 +1280,7 @@
         }
     
         # Add an a alert message to the system event log
    -    function logEvent($evtid, $type, $msg, $source= 'Parser', $isError = 0) {
    +    function logEvent($evtid, $type, $msg, $source= 'Parser') {
             $msg= mysql_escape_string($msg);
             $source= mysql_escape_string($source);
             $evtid= intval($evtid);
    @@ -1295,7 +1295,6 @@
             $ds= @mysql_query($sql);
             if (!$ds) {
                 echo "Error while inserting event log into database.";
    -			if ($isError === 1) echo "</div></div></div></body></html>";
                 exit();
             }
         }
    @@ -2540,16 +2539,8 @@
             $version= isset ($GLOBALS['version']) ? $GLOBALS['version'] : '';
             $code_name= isset ($GLOBALS['code_name']) ? $GLOBALS['code_name'] : '';
             $parsedMessageString= "
    -              <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
    -			  <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
    -			  <head><title>MySite | Content Manager $version » $code_name</title>
    -			  <script type=\"text/javascript\" src=\"manager/media/script/mootools/mootools.js\"></script>
    -              <style type=\"text/css\">
    -				TD, BODY { font-size: 11px;}
    -				body {background-color:#3B61FF;font-family:arial,verdana;font-size:12px;}
    -				.ErrorHead_h1 {border:1px solid #888888;border-bottom: 0;background-color:#E9A553;background-image:url(assets/templates/queckerhomepage/img/navheads.gif);height:17px;padding:2px 0 0 2px;}
    -				.Error {margin-bottom:10px;display: table; margin: 0 auto;}
    -			  </style>
    +              <html><head><title>MODx Content Manager $version » $code_name</title>
    +              <style>TD, BODY { font-size: 11px; font-family:verdana; }</style>
                   <script type='text/javascript'>
                   function copyToClip()
                   {
    @@ -2557,33 +2548,18 @@
                     Copied = holdtext.createTextRange();
                     Copied.execCommand('Copy');
                   }
    -			  window.addEvent('domready',
    -			  function(){var mySlide=new Fx.Slide('error_content');mySlide.hide();$('error_toggle').addEvent('click',function(e){e=new Event(e);mySlide.toggle();e.stop();});});
                 </script>
                   </head><body>
    -			  <div class=\"Error\">
    -			  <div class=\"ErrorHead_h1\">An Error has appeared</div>
    -			  <div style=\"border:1px solid #888888;background-color:#CFCFCF;padding-left: 3px;\">
    -			  <p>This site is currently not avaiable<br />
    -			  ";
    -		if ($text == "mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'localhost' (10061)")
    -			$parsedMessageString .= "ModX cannot connect to the database.</p>";
    -		else
    -			$parsedMessageString .= $text."</p>";
    -			$parsedMessageString .= "
    -			  <p>If the error appears next time pleace call the Administrator: <a href=\"mailto:admin@localhost\">admin@localhost</a></p>
    -			  <a id=\"error_toggle\" href=\"#\">[ show Errordetails ]</a>
    -			  <div id=\"error_content\" style=\"padding: 3px;\">
                   ";
             if ($is_error) {
                $parsedMessageString .= "<h3 style='color:red'>« Parse Error »</h3>
     
    @@ -2616,7 +2592,7 @@
                 $parsedMessageString .= "</tr>";
     
                 $parsedMessageString .= "<tr><td valign='top'>  Error type/ Nr.: </td>";
    -            $parsedMessageString .= "<td colspan='2'><b>" . $errortype[$nr] . " - $nr</b></td><td> </td>";
    +            $parsedMessageString .= "<td colspan='2'>" . $errortype[$nr] . " - $nr</b></td><td> </td>";
                 $parsedMessageString .= "</tr>";
     
                 $parsedMessageString .= "<tr><td>  File: </td>";
    @@ -2647,7 +2623,8 @@
             $parsedMessageString .= "<td><i>[^t^]</i></td><td> </td>";
             $parsedMessageString .= "</tr>";
     
    -        $parsedMessageString .= "</table><br />";
    +        $parsedMessageString .= "</table>";
    +        $parsedMessageString .= "</body></html>";
     
             $totalTime= ($this->getMicroTime() - $this->tstart);
             $queryTime= $this->queryTime;
    @@ -2667,7 +2644,7 @@
             ob_end_flush();
     
             // Log error
    -        $this->logEvent(0, 3, $parsedMessageString, $source= 'Parser', 1);
    +        $this->logEvent(0, 3, $parsedMessageString, $source= 'Parser');
     
             // Make sure and die!
             exit();
    

    Sorry for my bad english, but I had to translate it verry rapid ...

    For all those who don’t know, how to use a DIFF-File: http://www.iosn.net/Members/kaeru/articles/software-development/patches/

    Windowsversion of the DIFF-Linux command: http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16423&release_id=240610

    Windowsversion of the PATCH-Linux command: http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=32165