diff --git a/htdocs/demo/index.php b/htdocs/demo/index.php index f36200a40..aac3017c7 100644 --- a/htdocs/demo/index.php +++ b/htdocs/demo/index.php @@ -40,7 +40,7 @@

Online Demo

-


+

(max 1024 characters)

- (max 1024 characters)

+ +

Examples

This code can be copy and pasted in the edit box above.

diff --git a/htdocs/demo/report/index.php b/htdocs/demo/report/index.php index 9537da490..4890b60dc 100644 --- a/htdocs/demo/report/index.php +++ b/htdocs/demo/report/index.php @@ -1,3 +1,62 @@ + $code + ) + ); + + $opts = array('http' => + array( + 'method' => 'POST', + 'header' => 'Content-type: application/x-www-form-urlencoded', + 'content' => $postdata + ) + ); + + $context = stream_context_create($opts); + + return @file_get_contents('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); + } + + function cut_string($string, $length = 1024) { + if (strlen($string) > $length) { + return substr($string, 0, $length); + } + return $string; + } + + //-------------------------------------------------------------------------------- + // XML output... + //-------------------------------------------------------------------------------- + if ($isXmlOutput) { //if XML output... + header('Content-Type: text/xml'); + + if (!$isCodePosted) { //if NO code posted... + echo "\n\n"; + exit; + } + + $output = get_democlient_output(cut_string($_POST['code'])); + + if ($output === false) { //if NO demo client output... + echo "\n\n"; + exit; + } + + echo $output; + exit; + } + //-------------------------------------------------------------------------------- +?> @@ -39,33 +98,6 @@

Online Demo Report

$code - ) - ); - - $opts = array('http' => - array( - 'method' => 'POST', - 'header' => 'Content-type: application/x-www-form-urlencoded', - 'content' => $postdata - ) - ); - - $context = stream_context_create($opts); - - return @file_get_contents('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); - } - /** * ... * @param string $output Output lines @@ -90,13 +122,6 @@ } } - function cut_string($string, $length = 1024) { - if (strlen($string) > $length) { - return substr($string, 0, $length); - } - return $string; - } - if ($isCodePosted) { //if code posted... include_once '../../site/geshi/geshi.php'; diff --git a/htdocs/site/css/all.css b/htdocs/site/css/all.css index 0db9e4a50..51da7422a 100644 --- a/htdocs/site/css/all.css +++ b/htdocs/site/css/all.css @@ -182,6 +182,13 @@ pre.cmd { text-align: center; } +/* Max characters */ +.maxChars { + margin-left: 2em; + color: #888; + font-size: smaller; +} + /* Printing */ @media print { #header { color: black; border-bottom: 1px solid black; }