diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-17 23:47:58 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-17 23:47:58 +0200 |
commit | 7d65ce8c8e304dc8367f4492948514f2acc07a3b (patch) | |
tree | 1d1e8584ad326cf3ea7701e2a726a0f0ae1cb6cf /t | |
parent | 56509ab16c8d2225182eb0400e5c6a4900870391 (diff) | |
download | cforum-7d65ce8c8e304dc8367f4492948514f2acc07a3b.tar.gz |
Whatever
Diffstat (limited to 't')
-rw-r--r-- | t/err.t | 4 | ||||
-rw-r--r-- | t/err.tc | 6 | ||||
-rw-r--r-- | t/front.t | 24 | ||||
-rw-r--r-- | t/front.tc | 34 | ||||
-rw-r--r-- | t/post.t | 13 | ||||
-rw-r--r-- | t/post.tc | 19 | ||||
-rw-r--r-- | t/user.t | 4 | ||||
-rw-r--r-- | t/user.tc | 6 |
8 files changed, 73 insertions, 37 deletions
@@ -1,2 +1,4 @@ +<% #include "head.tc" %> <h1><%= title %></h1> -<p><%= err %></p>
\ No newline at end of file +<p><%= err %></p> +<% #include "foot.tc" %>
\ No newline at end of file @@ -1,5 +1,7 @@ -printf("<h1>"); +#include "head.tc" +printf("\n<h1>"); printf("%s", title ); printf("</h1>\n<p>"); printf("%s", err ); -printf("</p>"); +printf("</p>\n"); +#include "foot.tc" @@ -1,20 +1,24 @@ +<% #include "head.tc" %> <h1><%= site.name %></h1> <p>Thanks for the <%= getenv("REQUEST_METHOD") %> request!</p> <table border="1"> - <tr style="font-weight: bold;"> - <td style="width: 60px;">Key</td> - <td style="width: 140px;">Value</td> - </tr> <% - char *p, *v; - while(p = nextparam(GET, 512)){ - v = split(p); + struct post *post; + struct user *user; + + while(post = getpost(stmt, 0)){ + user = getuser(byid("users", post->user), 1); %> <tr> - <td><%= p %></td> - <td><%= v %></td> + <td><a href="?user=<% printf("%d", post->user); %>"><%= + user->name + %></a></td> + <td><a href="?post=<% printf("%d", post->id); %>"><%= + post->subject + %></a></td> </tr> <% } %> -</table>
\ No newline at end of file +</table> +<% #include "foot.tc" %>
\ No newline at end of file @@ -1,17 +1,29 @@ -printf("<h1>"); +#include "head.tc" +printf("\n<h1>"); printf("%s", site.name ); printf("</h1>\n<p>Thanks for the "); printf("%s", getenv("REQUEST_METHOD") ); -printf(" request!</p>\n<table border=\"1\">\n <tr style=\"font-weight: bold;\">\n <td style=\"width: 60px;\">Key</td>\n <td style=\"width: 140px;\">Value</td>\n </tr>\n "); - char *p, *v; - while(p = nextparam(GET, 512)){ - v = split(p); +printf(" request!</p>\n<table border=\"1\">\n "); + struct post *post; + struct user *user; -printf("\n <tr>\n <td>"); -printf("%s", p ); -printf("</td>\n <td>"); -printf("%s", v ); -printf("</td>\n </tr>\n "); + while(post = getpost(stmt, 0)){ + user = getuser(byid("users", post->user), 1); + +printf("\n <tr>\n <td><a href=\"?user="); +printf("%d", post->user); +printf("\">"); +printf("%s", + user->name + ); +printf("</a></td>\n <td><a href=\"?post="); +printf("%d", post->id); +printf("\">"); +printf("%s", + post->subject + ); +printf("</a></td>\n </tr>\n "); } -printf("\n</table>"); +printf("\n</table>\n"); +#include "foot.tc" @@ -1,13 +1,16 @@ +<% #include "head.tc" %> <h1>Post <% printf("%d", id); %>: <%= post->subject %></h1> -<p>From: <%= user->full? user->full: "" %> <% -if(user->full) printf("<"); -%><a href="?user=<% printf("%d", user->id); %>"><%= user->name %></a><% -if(user->full) printf(">"); %> +<p>From: <%= user->full? user->full: "" %> +<% if(user->full) printf("<"); %><a href="?user=<% printf("%d", user->id); %>"><%= user->name %></a><% if(user->full) printf(">"); %> <br>Date: <% printdate(post->created); %> <% if(post->edited){ printf("<br>Edited: "); printdate(post->edited); } %> +<% if(post->parent){ %> +<br>In Reply To: <a href="?post=<% printf("%d", post->parent); %>"><% printf("%d", post->parent); %></a> +<% } %> <pre> <%= post->text %> -</pre>
\ No newline at end of file +</pre> +<% #include "foot.tc" %>
\ No newline at end of file @@ -1,12 +1,12 @@ -printf("<h1>Post "); +#include "head.tc" +printf("\n<h1>Post "); printf("%d", id); printf(": "); printf("%s", post->subject ); printf("</h1>\n<p>From: "); printf("%s", user->full? user->full: "" ); -printf(" "); -if(user->full) printf("<"); - +printf("\n"); +if(user->full) printf("<"); printf("<a href=\"?user="); printf("%d", user->id); printf("\">"); @@ -20,6 +20,15 @@ if(post->edited){ printf("<br>Edited: "); printdate(post->edited); } +printf("\n"); +if(post->parent){ +printf("\n<br>In Reply To: <a href=\"?post="); +printf("%d", post->parent); +printf("\">"); +printf("%d", post->parent); +printf("</a>\n"); +} printf("\n<pre>\n"); printf("%s", post->text ); -printf("\n</pre>"); +printf("\n</pre>\n"); +#include "foot.tc" @@ -1 +1,3 @@ -<h1>User <% printf("%d", id); %>: <%= user->name %></h1>
\ No newline at end of file +<% #include "head.tc" %> +<h1>User <% printf("%d", id); %>: <%= user->name %></h1> +<% #include "foot.tc" %>
\ No newline at end of file @@ -1,5 +1,7 @@ -printf("<h1>User "); +#include "head.tc" +printf("\n<h1>User "); printf("%d", id); printf(": "); printf("%s", user->name ); -printf("</h1>"); +printf("</h1>\n"); +#include "foot.tc" |