Changeset 1127

Show
Ignore:
Timestamp:
06/04/2008 09:25:43 AM (2 years ago)
Author:
DotMG
Message:

refs #772

Avoiding LetterSaladOutput when using key files errors or debug. Usages are:

  • if file debug present: output is full of debug information, ugly page layout
  • if file errors present: PHP notices, warnings, errors will appear.
  • if no file called debug nor errors present: for production use, PHP notices will not show.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wikka.php

    r1124 r1127  
    6363 * code. 
    6464 */ 
    65 $errors = (file_exists('errors')) ? TRUE : FALSE; 
     65$track_errors = (file_exists('errors')) ? TRUE : FALSE; 
     66ob_start();                                                     // need to pick up tracing messages 
    6667/** 
    6768 * Interpret debugging and development/production modes. 
    6869 */ 
    69 if ($debug) 
    70 { 
    71         ob_start();                                                     // need to pick up tracing messages 
     70if ($debug || $track_errors) 
     71{ 
    7272        error_reporting(E_ALL);                         // always on for debug mode 
    7373} 
    7474else 
    7575{ 
    76         if ($errors) 
    77         { 
    78                 ob_start(); 
    79                 error_reporting(E_ALL);                         // development mode 
    80         } 
    81         else 
    82         { 
    83                 error_reporting(E_ALL ^ E_NOTICE);      // production mode 
    84         } 
     76        error_reporting(E_ALL ^ E_NOTICE);      // production mode 
    8577} 
    8678// -------------------- END DEBUGGING AND ERROR REPORTING --------------------- 
     
    998990//     - Compatibility library loaded 
    999991if ($debug) echo "roll...<br/>\n"; 
     992$debug_info = ''; 
    1000993if (!$debug) 
    1001994{ 
    1002         ob_end_clean(); // in case there was a previous buffer left from debug mode! 
     995        $debug_info = ob_get_contents(); 
     996        @ob_end_clean();        // in case there was a previous buffer left from debug mode! 
    1003997        ob_start();             // start buffering output 
    1004998} 
     
    10221016        //output result // @@@ use paragraph 
    10231017        echo '<div class="smallprint">'.sprintf(PAGE_GENERATION_TIME, $totaltime)."</div>\n";   // @@@ should be paragraph 
     1018        if ($track_errors) 
     1019        { 
     1020                echo '<p class="debuginfo">'.$debug_info.'</p>'."\n"; 
     1021        } 
    10241022        echo "</body>\n</html>"; 
    10251023} 
     
    10691067 */ 
    10701068//header('Content-Length: '.$page_length); 
    1071 ob_end_clean(); 
     1069@ob_end_clean(); 
    10721070 
    10731071/**