00062 {
00063
IWeb *pWeb = static_cast<IWeb *>(GetWeb());
00064 Database& db = pWeb -> GetDatabase();
00065 Query q(db);
00066 Query q2(db);
00067 Query q3(db);
00068
char sql[1000];
00069
00070
00071
Navigator();
00072 printf(
"</td><td align=right>");
00073
00074 printf(
"[ <a href=\"%s?page=2\">settings</a> ",GetCgiName().c_str());
00075 printf(
"| <a href=\"%s?logout=1\">logout</a> ",GetCgiName().c_str());
00076
00077 printf(
"]</td></tr></table>");
00078 printf(
"</div>");
00079
00080 q.get_result(
"select * from forum where deleted=0 order by updated desc");
00081 printf(
"<table cellpadding=\"0\" cellspacing=\"0\" class=forums width=\"100%%\">");
00082 printf(
"<tr>");
00083 printf(
"<th class=forums align=left>Forum</th>");
00084 printf(
"<th class=forums align=left>Topics</th>");
00085 printf(
"<th class=forums align=left>Messages</th>");
00086 printf(
"<th class=forums align=left>Last</th>");
00087 printf(
"</tr>");
00088
while (q.fetch_row())
00089 {
00090 db::Forum x(&db, &q);
00091 db::Account account(db, x.updated_by);
00092
long qthreads = 0;
00093
long qmessages = 0;
00094
00095 sprintf(sql,
"select num from thread where forum=%ld and deleted=0",x.num);
00096 q2.get_result(sql);
00097
while (q2.fetch_row())
00098 {
00099
long num = q2.getval();
00100 sprintf(sql,
"select count(*) from message where thread=%ld and deleted=0",num);
00101 qmessages += q3.get_count(sql);
00102 qthreads++;
00103 }
00104 q2.free_result();
00105
00106 printf(
"<tr>");
00107 printf(
"<td class=forums><a href=\"%s?ForumsForm=select&forum=%ld\">%s</a></td>",
00108 GetCgiName().c_str(),x.num,x.name.c_str());
00109 printf(
"<td class=forums align=right width=\"1%%\">%ld</td>",qthreads);
00110 printf(
"<td class=forums align=right width=\"1%%\">%ld</td>",qmessages);
00111 printf(
"<td class=forums width=\"1%%\">");
00112 printf(
"%s<br>",
GetAccountName(account).c_str());
00113 nbprintf(
"%s</td>", x.updated.c_str());
00114 printf(
"</tr>");
00115 }
00116 printf(
"</table>");
00117 q.free_result();
00118 }