From 9fd127617efa59309b4bd3fce2b8925bcaacc480 Mon Sep 17 00:00:00 2001 From: Tim Gerundt Date: Tue, 18 Sep 2012 15:21:14 +0200 Subject: [PATCH] htdocs: Say that we have problems to call the demo client instead to show "No errors found" --- htdocs/demo/report/index.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/demo/report/index.php b/htdocs/demo/report/index.php index 9f54a8039..9537da490 100644 --- a/htdocs/demo/report/index.php +++ b/htdocs/demo/report/index.php @@ -63,7 +63,7 @@ $context = stream_context_create($opts); - return file_get_contents('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); + return @file_get_contents('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); } /** @@ -114,25 +114,31 @@ echo "

Output

\n"; $output = get_democlient_output($code); - $results = parse_democlient_output($output); - if (!empty($results)) { - echo "\n"; - echo "\n"; - echo " \n"; - echo "\n"; - echo "\n"; - foreach ($results as $result) { //for each result... - echo " \n"; + if (!$output === false) { + $results = parse_democlient_output($output); + + if (!empty($results)) { + echo "
LineSeverityMessage
" . htmlspecialchars($result['line']) . "" . htmlspecialchars($result['severity']) . "" . htmlspecialchars($result['msg']) . "
\n"; + echo "\n"; + echo " \n"; + echo "\n"; + echo "\n"; + foreach ($results as $result) { //for each result... + echo " \n"; + } + echo "\n"; + echo "
LineSeverityMessage
" . htmlspecialchars($result['line']) . "" . htmlspecialchars($result['severity']) . "" . htmlspecialchars($result['msg']) . "
\n"; + } + else { + echo "

No errors found.

\n"; } - echo "\n"; - echo "\n"; } else { - echo "

No errors found.

\n"; + echo "

Problem with demo client. Please try again.

\n"; } } - else { + else { //if NO code posted... echo "

Use the online demo page to create the report.

\n"; } ?>