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='buttonstyle'>";
 
28
 
                                        echo "<a href='../Lindex.html'><img src='CodeViewerRightbutton.png'></a>";
 
31
 
                        echo "<td class='verticalaligntext'>";
 
32
 
                        echo "<a STYLE='text-decoration:none' href='".$headinglink."'>".$heading."</a>";
 
35
 
                        echo "<td class='buttonstyle'>";
 
36
 
                        if($downloadlink!=""){
 
37
 
                                        echo "<a href='".$downloadlink."'><img src='CodeViewerDownloadbutton.png'></a>";
 
39
 
                                        echo "<img src='CodeViewerLeftbuttonGrayed.png'>";
 
48
 
echo "<div id='bottom' class='RestContainer'>";
 
50
 
                        echo "<div style='float:left;'>";
 
51
 
                                        echo "<div id='panel' class='panel' onmousemove='resizepanel(event)' onmousedown='mdpanel(event)' onmouseup='mupanel(event)'>";
 
53
 
                                        include($filecontent);
 
57
 
                        echo "<div class='codecontent'>";
 
60
 
        function menulayoutend()
 
64
 
                echo "<div style='clear:both;'></div>";
 
68
 
        function showfile($interestingrows,$keywords,$highlight,$filename)
 
71
 
                        $handle = @fopen($filename, "r");
 
78
 
                            while (($buffer = fgets($handle, 4096)) !== false) {
 
79
 
                                                        $buffer = str_replace("\n","", $buffer);
 
80
 
                                                        $buffer = str_replace("\r","", $buffer);
 
81
 
                                                        $buffer=str_pad($buffer,150," ", STR_PAD_RIGHT);
 
82
 
                                $buffer=str_replace("&","&",$buffer);
 
83
 
                                $buffer=str_replace("<","<",$buffer);
 
84
 
                                $buffer=str_replace(">",">",$buffer);
 
85
 
                                $buffer=str_replace("\t"," ",$buffer);
 
89
 
                                foreach($interestingrows as $row){
 
90
 
                                                if($lineno>=$row[0]&&$lineno<=$row[1]){
 
95
 
                                foreach($keywords as $keyword){
 
97
 
                                                                                        $buffer=str_replace($keyword,"<span class='keywordinteresting'>".$keyword."</span>",$buffer);
 
99
 
                                                                                        $buffer=str_replace($keyword,"<span class='keyword'>".$keyword."</span>",$buffer);
 
103
 
                                                        // Detect comments - 0 == No comment 1 == Line comment 2 == Start Comment 3 == End Comment
 
106
 
                                                        $commentpos=strpos($buffer,"/*");
 
109
 
                                                                        $subby=substr($buffer,$commentpos+2,1);
 
114
 
                                                        if($commentpos&&$subby!='"'){
 
119
 
                                                        $commentpos=strpos($buffer,"*/");
 
125
 
                                                        $commentpos=strpos($buffer,"//");
 
131
 
                                foreach($highlight as $highlightkeyword){
 
132
 
                                                                                $foundpos=strpos($buffer,$highlightkeyword[0]);
 
134
 
                                                                                // If line comment and keyword before comment marker
 
135
 
                                                                                if(($foundpos<=$commentpos&&($commentkind==1||$commentkind==2))||($commentkind==0)||($foundpos>$commentpos&&$commentkind==3)){
 
136
 
                                                                                        if(!($commentkind==0&&$commenton==1)) $buffer=str_replace($highlightkeyword[0],"<span class='".$highlightkeyword[1]."'>".$highlightkeyword[0]."</span>",$buffer);
 
141
 
                                                        // echo $commentkind.$commenton;
 
145
 
                                                                                        $buffer=str_replace("//","<span class='commented'>//",$buffer);
 
148
 
                                                                        if($commentkind==2) $buffer=str_replace("/*","<span class='commented'>/*",$buffer);
 
149
 
                                                                        if($commentkind==3) $buffer=str_replace("*/","*/</span>",$buffer);
 
154
 
                                                        $linenostr=str_pad($linenostr,3," ",STR_PAD_RIGHT);
 
157
 
                                                echo "<span class='interesting'>";
 
158
 
                                                echo "<span class='linenointeresting'>".$linenostr."</span> ";
 
161
 
                                                echo "<span class='lineno'>".$linenostr."</span> ";                                
 
166
 
                                                        if($startspan) echo "</span>";
 
172
 
                            if (!feof($handle)) {
 
173
 
                                echo "Error: unexpected fgets() fail\n";
 
 
3
         * Takes 6 arguments and outputs a HTML navigation menu 
 
 
4
         * $forward = link to "next page", i.e. "nextPage.html"
 
 
5
         * $backward = link to "previous page", i.e. "previousPage.html"
 
 
6
         * $downloadlink = link to download source file, on download button, i.e. "sourceFile.txt"
 
 
7
         * headinglink = link in heading, i.e. "sourceFile.txt"
 
 
8
         * filecontent = file containing info in the left panel, i.e. "panelContent.txt"
 
 
10
        function menulayout($forward,$backward,$downloadlink,$heading,$headinglink,$filecontent) {
 
 
12
                        $backwardButton = "<a href='".$backward."'><img src='../media/codeviewer/CodeViewerLeftbutton.png'></a>";
 
 
14
                        $backwardButton = "<img src='../media/codeviewer/CodeViewerLeftbuttonGrayed.png'>";
 
 
18
                        $forwardButton = "<a href='".$forward."'><img src='../media/codeviewer/CodeViewerRightbutton.png'></a>";
 
 
20
                        $forwardButton = "<img src='../media/codeviewer/CodeViewerLeftbuttonGrayed.png'>";
 
 
23
                if($downloadlink != ""){
 
 
24
                        $downloadButton = "<a href='".$downloadlink."'><img src='../media/codeviewer/CodeViewerDownloadbutton.png'></a>";
 
 
26
                        $downloadButton = "<img src='../media/codeviewer/CodeViewerLeftbuttonGrayed.png'>";
 
 
29
                echo '          <body onload="resize();" onresize="resize();">
 
 
31
                                <table style="width:100%;height:100%;border:solid 1px;">
 
 
33
                                                <td class="buttonstyle">
 
 
36
                                                <td class="buttonstyle">
 
 
39
                                                <td class="buttonstyle">
 
 
40
                                                        <a href="../Lindex.html"><img src="../media/codeviewer/CodeViewerRightbutton.png"></a>
 
 
42
                                                <td class="verticalaligntext">
 
 
43
                                                        <a href="'. $headinglink .'" style="text-decoration: none">'. $heading .'</a>
 
 
45
                                                <td class="buttonstyle">
 
 
51
                        <div id="bottom" class="restContainer">
 
 
52
                                <div style="float: left;">
 
 
53
                                        <div id="panel" class="panel" onmousemove="resizepanel(event)" onmousedown="mdpanel(event)" onmouseup="mupanel(event)">';
 
 
54
                                                include($filecontent);
 
 
57
                                <div class="codecontent">';
 
 
60
        /* function menulayoutend
 
 
61
         * Outputs ending tags in HTML
 
 
63
        function menulayoutend() {
 
 
67
                        <div style="clear: both;"></div>
 
 
73
         * Outputs html with syntax highlighting.
 
 
75
         * interestingrows: array containing arrays, each with 3 set values -- start line number, end line number, comment
 
 
76
         * keywords: array containing keywords 
 
 
77
         * highlight: array containing arrays, each with two values - string to highlight, and HTML class to apply to highlight */
 
 
78
        function showfile($interestingrows,$keywords,$highlight,$filename) {
 
 
80
                $handle = @fopen($filename, "r");
 
 
87
                        while (($buffer = fgets($handle, 4096)) !== false) {
 
 
88
                                $buffer = str_replace("\n", "", $buffer);
 
 
89
                                $buffer = str_replace("\r", "", $buffer);
 
 
90
                                $buffer = str_pad($buffer, 150, " ", STR_PAD_RIGHT);
 
 
91
                                $buffer = str_replace("&", "&", $buffer);
 
 
92
                                $buffer = str_replace("<", "<", $buffer);
 
 
93
                                $buffer = str_replace(">", ">", $buffer);
 
 
94
                                $buffer = str_replace("\t", " ", $buffer);
 
 
98
                                foreach($interestingrows as $row){
 
 
99
                                        if($lineno >= $row[0] && $lineno <= $row[1]){
 
 
104
                                foreach($keywords as $keyword){
 
 
106
                                                $buffer = str_replace($keyword,"<span class='keywordinteresting'>".$keyword."</span>", $buffer);
 
 
108
                                                $buffer = str_replace($keyword,"<span class='keyword'>".$keyword."</span>", $buffer);
 
 
112
                                // Detect comments - 0 == No comment 1 == Line comment 2 == Start Comment 3 == End Comment
 
 
114
                                $commentpos = strpos($buffer,"/*");
 
 
116
                                if($commentpos >= 0){
 
 
117
                                        $subby = substr($buffer,$commentpos+2,1);
 
 
122
                                if($commentpos && $subby != '"'){
 
 
127
                                $commentpos = strpos($buffer,"*/");
 
 
134
                                $commentpos=strpos($buffer,"//");
 
 
141
                                foreach($highlight as $highlightkeyword){
 
 
142
                                        $foundpos = strpos($buffer, $highlightkeyword[0]);
 
 
144
                                        // If line comment and keyword before comment marker
 
 
145
                                        if(($foundpos <= $commentpos && ($commentkind == 1 || $commentkind == 2)) || ($commentkind == 0) || ($foundpos > $commentpos && $commentkind == 3)) {
 
 
146
                                                if(!($commentkind==0&&$commenton==1)) {
 
 
147
                                                        $buffer = str_replace($highlightkeyword[0],"<span class='".$highlightkeyword[1]."'>".$highlightkeyword[0]."</span>",$buffer);
 
 
153
                                // echo $commentkind.$commenton;
 
 
154
                                if($commentkind > 0){
 
 
155
                                        if($commentkind == 1){
 
 
156
                                                $buffer = str_replace("//","<span class='commented'>//",$buffer);
 
 
157
                                                $buffer .= "</span>";
 
 
159
                                        if($commentkind==2) {
 
 
160
                                                $buffer=str_replace("/*","<span class='commented'>/*",$buffer);
 
 
162
                                        if($commentkind==3) {
 
 
163
                                                $buffer=str_replace("*/","*/</span>",$buffer);
 
 
167
                                $linenostr = $lineno;
 
 
168
                                $linenostr = str_pad($linenostr,3," ",STR_PAD_RIGHT);
 
 
171
                                        echo "<span class='interesting'>";
 
 
172
                                        echo "<span class='linenointeresting'>".$linenostr."</span> ";
 
 
175
                                        echo "<span class='lineno'>".$linenostr."</span> ";                                
 
 
187
                        if (!feof($handle)) {
 
 
188
                                echo "Error: unexpected fgets() fail\n";
 
 
 
b'\\ No newline at end of file'