htdocs: Say that we have problems to call the demo client instead to show "No errors found"

This commit is contained in:
Tim Gerundt 2012-09-18 15:21:14 +02:00
parent b35110ba21
commit 9fd127617e
1 changed files with 20 additions and 14 deletions

View File

@ -63,7 +63,7 @@
$context = stream_context_create($opts); $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 "<h3>Output</h3>\n"; echo "<h3>Output</h3>\n";
$output = get_democlient_output($code); $output = get_democlient_output($code);
$results = parse_democlient_output($output);
if (!empty($results)) { if (!$output === false) {
echo "<table id=\"resultsTable\">\n"; $results = parse_democlient_output($output);
echo "<thead>\n";
echo " <tr><th class=\"center\" filter-type=\"ddl\">Line</th><th class=\"center\" filter-type=\"ddl\">Severity</th><th>Message</th></tr>\n"; if (!empty($results)) {
echo "</thead>\n"; echo "<table id=\"resultsTable\">\n";
echo "<tbody>\n"; echo "<thead>\n";
foreach ($results as $result) { //for each result... echo " <tr><th class=\"center\" filter-type=\"ddl\">Line</th><th class=\"center\" filter-type=\"ddl\">Severity</th><th>Message</th></tr>\n";
echo " <tr><td class=\"center\">" . htmlspecialchars($result['line']) . "</td><td class=\"center\">" . htmlspecialchars($result['severity']) . "</td><td>" . htmlspecialchars($result['msg']) . "</td></tr>\n"; echo "</thead>\n";
echo "<tbody>\n";
foreach ($results as $result) { //for each result...
echo " <tr><td class=\"center\">" . htmlspecialchars($result['line']) . "</td><td class=\"center\">" . htmlspecialchars($result['severity']) . "</td><td>" . htmlspecialchars($result['msg']) . "</td></tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
}
else {
echo "<p>No errors found.</p>\n";
} }
echo "</tbody>\n";
echo "</table>\n";
} }
else { else {
echo "<p>No errors found.</p>\n"; echo "<p>Problem with demo client. Please try again.</p>\n";
} }
} }
else { else { //if NO code posted...
echo "<p>Use the <a href=\"/demo/\">online demo</a> page to create the report.</p>\n"; echo "<p>Use the <a href=\"/demo/\">online demo</a> page to create the report.</p>\n";
} }
?> ?>