htdocs: remove trailing spaces
This commit is contained in:
parent
cc0b8fe78d
commit
a7794fd274
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$isCodePosted = isset($_POST['code']) && !empty($_POST['code']);
|
$isCodePosted = isset($_POST['code']) && !empty($_POST['code']);
|
||||||
$isXmlOutput = isset($_POST['xml']) && $_POST['xml'] == '1';
|
$isXmlOutput = isset($_POST['xml']) && $_POST['xml'] == '1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ...
|
* ...
|
||||||
* @param string $code Source code
|
* @param string $code Source code
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
'code' => $code
|
'code' => $code
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$opts = array('http' =>
|
$opts = array('http' =>
|
||||||
array(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
|
@ -21,37 +21,37 @@
|
||||||
'content' => $postdata
|
'content' => $postdata
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cut_string($string, $length = 1024) {
|
function cut_string($string, $length = 1024) {
|
||||||
if (strlen($string) > $length) {
|
if (strlen($string) > $length) {
|
||||||
return substr($string, 0, $length);
|
return substr($string, 0, $length);
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
// XML output...
|
// XML output...
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
if ($isXmlOutput) { //if XML output...
|
if ($isXmlOutput) { //if XML output...
|
||||||
header('Content-Type: text/xml');
|
header('Content-Type: text/xml');
|
||||||
|
|
||||||
if (!$isCodePosted) { //if NO code posted...
|
if (!$isCodePosted) { //if NO code posted...
|
||||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results></results>\n";
|
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results></results>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = get_democlient_output(cut_string($_POST['code']));
|
$output = get_democlient_output(cut_string($_POST['code']));
|
||||||
|
|
||||||
if ($output === false) { //if NO demo client output...
|
if ($output === false) { //if NO demo client output...
|
||||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results></results>\n";
|
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results></results>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $output;
|
echo $output;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -121,28 +121,28 @@
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isCodePosted) { //if code posted...
|
if ($isCodePosted) { //if code posted...
|
||||||
include_once '../../site/geshi/geshi.php';
|
include_once '../../site/geshi/geshi.php';
|
||||||
|
|
||||||
$code = cut_string($_POST['code']);
|
$code = cut_string($_POST['code']);
|
||||||
|
|
||||||
$geshi = new GeSHi($code, 'cpp');
|
$geshi = new GeSHi($code, 'cpp');
|
||||||
$geshi->enable_classes();
|
$geshi->enable_classes();
|
||||||
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
|
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
|
||||||
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||||
$geshi->set_overall_class('geshicode');
|
$geshi->set_overall_class('geshicode');
|
||||||
|
|
||||||
echo "<h3>Input</h3>\n";
|
echo "<h3>Input</h3>\n";
|
||||||
echo $geshi->parse_code();
|
echo $geshi->parse_code();
|
||||||
|
|
||||||
echo "<h3>Output</h3>\n";
|
echo "<h3>Output</h3>\n";
|
||||||
|
|
||||||
$output = get_democlient_output($code);
|
$output = get_democlient_output($code);
|
||||||
|
|
||||||
if (!$output === false) {
|
if (!$output === false) {
|
||||||
$results = parse_democlient_output($output);
|
$results = parse_democlient_output($output);
|
||||||
|
|
||||||
if (!empty($results)) {
|
if (!empty($results)) {
|
||||||
echo "<table id=\"resultsTable\">\n";
|
echo "<table id=\"resultsTable\">\n";
|
||||||
echo "<thead>\n";
|
echo "<thead>\n";
|
||||||
|
|
|
@ -115,7 +115,7 @@ add Cppcheck as an external tool.</p>
|
||||||
<p>You are welcome to contribute. Help is needed.</p>
|
<p>You are welcome to contribute. Help is needed.</p>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Testing</dt>
|
<dt>Testing</dt>
|
||||||
<dd>Pick a project and test it's source with latest version. Write tickets to
|
<dd>Pick a project and test it's source with latest version. Write tickets to
|
||||||
<a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a> about issues you
|
<a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a> about issues you
|
||||||
find from Cppcheck. If you test open source projects and write bug reports to
|
find from Cppcheck. If you test open source projects and write bug reports to
|
||||||
them, check the issues in the “<a href="http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Found_bugs">Found bugs</a>”
|
them, check the issues in the “<a href="http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Found_bugs">Found bugs</a>”
|
||||||
|
|
Loading…
Reference in New Issue