aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-18 10:38:09 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-18 10:38:09 +0200
commit0292e86cf884a26108a59d81d69cee83b54f4c88 (patch)
tree3f5b30fe172013802955213503a5827616be6fec /t
parentae9b583b9575679f129680a0f56163fdb6590052 (diff)
downloadcforum-0292e86cf884a26108a59d81d69cee83b54f4c88.tar.gz
Clean up database code
Diffstat (limited to 't')
-rw-r--r--t/front.t4
-rw-r--r--t/post.t10
2 files changed, 7 insertions, 7 deletions
diff --git a/t/front.t b/t/front.t
index fcdecdb..fd9f46c 100644
--- a/t/front.t
+++ b/t/front.t
@@ -2,8 +2,8 @@
<h1><%= site.name %></h1>
<h3>Latest posts</h3>
<table border="1">
- <% while(post = getpost(stmt, 0)){
- user = getuser(byid("users", post->user), 1); %>
+ <% while(post = nextpost(stmt)){
+ user = getuser(byid("users", post->user)); %>
<tr>
<td><a href="?post=<% printf("%d", post->id); %>"><%= post->subject %></a></td>
<td><a href="?user=<% printf("%d", post->user); %>"><%= user->name %></a></td>
diff --git a/t/post.t b/t/post.t
index 549b4ec..b1cbe99 100644
--- a/t/post.t
+++ b/t/post.t
@@ -13,16 +13,16 @@
<pre>
<%= post->text %>
</pre>
-<% if(attachment = getattachment(stmt, 0)){ %>
+<% if(att = nextatt(stmt)){ %>
<h3>Attachments</h3>
<table border="1">
<% do{ %>
<tr>
- <td><a href="?attachment=<% printf("%d", attachment->id); %>"><%= attachment->name %></a></td>
- <td><%= attachment->mime %></td>
- <td><%= attachment->description %></td>
+ <td><a href="?att=<% printf("%d", att->id); %>"><%= att->name %></a></td>
+ <td><%= att->mime %></td>
+ <td><%= att->description %></td>
</tr>
- <% }while(attachment = getattachment(stmt, 0)); %>
+ <% }while(att = nextatt(stmt)); %>
</table>
<% } %>
<% #include "foot.tc" %> \ No newline at end of file