summaryrefslogtreecommitdiff
path: root/ws2a
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-09 16:52:18 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-09 16:52:18 -0400
commit3daa5e663aa02ee9d3d553c6b80081cfde76fec4 (patch)
treef5a55fd98278b22f392fa40c0fff81a1cfdc25e7 /ws2a
parent15b265a00e5bd69c78cf51b01c8cdcf3e4c1828c (diff)
downloadwebpage-3daa5e663aa02ee9d3d553c6b80081cfde76fec4.tar.gz
webpage-3daa5e663aa02ee9d3d553c6b80081cfde76fec4.tar.bz2
webpage-3daa5e663aa02ee9d3d553c6b80081cfde76fec4.zip
More work on showing bugs
Diffstat (limited to 'ws2a')
-rw-r--r--ws2a/bugview.js17
-rw-r--r--ws2a/showbug.c3
2 files changed, 16 insertions, 4 deletions
diff --git a/ws2a/bugview.js b/ws2a/bugview.js
index 2f9740f..cbf3db0 100644
--- a/ws2a/bugview.js
+++ b/ws2a/bugview.js
@@ -14,11 +14,26 @@ function getQueryStrings() {
return assoc;
}
+function htmlEscape(str) {
+ return String(str)
+ .replace(/&/g, '&amp;')
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&#39;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/\//g, '&#x2F;');
+}
+
function loadLastBugs() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
- document.getElementById("longdesc").innerHTML = xhttp.responseText;
+ var parts = xhttp.response.split("\n");
+ document.getElementById("submitter").innerHTML = htmlEscape(parts[1]);
+ document.getElementById("date").innerHTML = htmlEscape(parts[2]);
+ document.getElementById("status").innerHTML = htmlEscape(parts[3]);
+ document.getElementById("longdesc").innerHTML = htmlEscape(parts[4]);
+ //document.getElementById("longdesc").innerHTML = xhttp.responseText;
}
};
var query = getQueryStrings();
diff --git a/ws2a/showbug.c b/ws2a/showbug.c
index 8aa4aeb..a92776e 100644
--- a/ws2a/showbug.c
+++ b/ws2a/showbug.c
@@ -9,7 +9,6 @@ int main(){
char* hardip = getenv("REMOTE_ADDR");
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
- printf("Data:%s",data);
FILE* lastfilenum;
lastfilenum = fopen("../ws2a/bugs/lastbug","r");
if(lastfilenum == NULL){
@@ -21,7 +20,6 @@ int main(){
fclose(lastfilenum);
long long thisid = 0;
sscanf(data,"id=%lld",&thisid);
- printf("Looking for bugid:%lld",thisid);
if(thisid > last){
printf("Invalid!");
return 1;
@@ -37,7 +35,6 @@ int main(){
printf("Unable to open bug file!");
return 1;
}
- printf("File:");
while(!feof(bugfile)){
putchar(fgetc(bugfile));
}