3
function menulayout($forward,$backward,$downloadlink,$heading,$headinglink,$filecontent)
5
echo "<body onload='resize();' onresize='resize();'>";
7
echo "<div class='Topmenu'>";
8
echo "<table style='width:100%;height:100%;border:solid 1px;'>";
11
echo "<td class='buttonstyle'>";
13
echo "<a href='".$backward."'><img src='CodeViewerLeftbutton.png'></a>";
15
echo "<img src='CodeViewerLeftbuttonGrayed.png'>";
19
echo "<td class='buttonstyle'>";
21
echo "<a href='".$forward."'><img src='CodeViewerRightbutton.png'></a>";
23
echo "<img src='CodeViewerLeftbuttonGrayed.png'>";
27
echo "<td class='verticalaligntext'>";
28
echo "<a STYLE='text-decoration:none' href='".$headinglink."'>".$heading."</a>";
31
echo "<td class='buttonstyle'>";
32
if($downloadlink!=""){
33
echo "<a href='".$downloadlink."'><img src='CodeViewerDownloadbutton.png'></a>";
35
echo "<img src='CodeViewerLeftbuttonGrayed.png'>";
44
echo "<div id='bottom' class='RestContainer'>";
46
echo "<div style='float:left;'>";
47
echo "<div id='panel' class='panel' onmousemove='resizepanel(event)' onmousedown='mdpanel(event)' onmouseup='mupanel(event)'>";
49
include($filecontent);
53
echo "<div class='codecontent'>";
56
function menulayoutend()
60
echo "<div style='clear:both;'></div>";
64
function showfile($interestingrows,$keywords,$highlight,$filename)
67
$handle = @fopen($filename, "r");
74
while (($buffer = fgets($handle, 4096)) !== false) {
75
$buffer = str_replace("\n","", $buffer);
76
$buffer = str_replace("\r","", $buffer);
77
$buffer=str_pad($buffer,150," ", STR_PAD_RIGHT);
78
$buffer=str_replace("<","<",$buffer);
79
$buffer=str_replace(">",">",$buffer);
80
$buffer=str_replace("\t"," ",$buffer);
84
foreach($interestingrows as $row){
85
if($lineno>=$row[0]&&$lineno<=$row[1]){
90
foreach($keywords as $keyword){
92
$buffer=str_replace($keyword,"<span class='keywordinteresting'>".$keyword."</span>",$buffer);
94
$buffer=str_replace($keyword,"<span class='keyword'>".$keyword."</span>",$buffer);
98
// Detect comments - 0 == No comment 1 == Line comment 2 == Start Comment 3 == End Comment
101
$commentpos=strpos($buffer,"/*");
107
$commentpos=strpos($buffer,"*/");
113
$commentpos=strpos($buffer,"//");
119
foreach($highlight as $highlightkeyword){
120
$foundpos=strpos($buffer,$highlightkeyword[0]);
122
// If line comment and keyword before comment marker
123
if(($foundpos<=$commentpos&&($commentkind==1||$commentkind==2))||($commentkind==0)||($foundpos>$commentpos&&$commentkind==3)){
124
if(!($commentkind==0&&$commenton==1)) $buffer=str_replace($highlightkeyword[0],"<span class='".$highlightkeyword[1]."'>".$highlightkeyword[0]."</span>",$buffer);
129
echo $commentkind.$commenton;
133
$buffer=str_replace("//","<span class='commented'>//",$buffer);
136
if($commentkind==2) $buffer=str_replace("/*","<span class='commented'>/*",$buffer);
137
if($commentkind==3) $buffer=str_replace("*/","*/</span>",$buffer);
142
$linenostr=str_pad($linenostr,3," ",STR_PAD_RIGHT);
145
echo "<span class='interesting'>";
146
echo "<span class='linenointeresting'>".$linenostr."</span> ";
149
echo "<span class='lineno'>".$linenostr."</span> ";
154
if($startspan) echo "</span>";
160
if (!feof($handle)) {
161
echo "Error: unexpected fgets() fail\n";
b'\\ No newline at end of file'