userlist.c

00001 /*
00002  * $Id: userlist.c 5147 2007-05-08 15:36:22Z ajc $
00003  */
00010 #include "webcit.h"
00011 
00015 struct namelist {
00016         struct namelist *next; 
00017         char name[32];         
00018 };
00019 
00023 void userlist(void)
00024 {
00025         char buf[256];
00026         char fl[256];
00027         char title[256];
00028         struct tm tmbuf;
00029         time_t lc;
00030         struct namelist *bio = NULL;
00031         struct namelist *bptr;
00032         int has_bio;
00033         int bg = 0;
00034 
00035         serv_puts("LBIO");
00036         serv_getln(buf, sizeof buf);
00037         if (buf[0] == '1')
00038                 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
00039                         bptr = (struct namelist *) malloc(sizeof(struct namelist));
00040                         bptr->next = bio;
00041                         strcpy(bptr->name, buf);
00042                         bio = bptr;
00043                 }
00044         output_headers(1, 1, 2, 0, 0, 0);
00045         wprintf("<div id=\"banner\">\n"
00046                 "<table class=\"userlist_banner\"><tr><td>"
00047                 "<span class=\"titlebar\">");
00048         snprintf(title, sizeof title, _("User list for %s"), serv_info.serv_humannode);
00049         escputs(title);
00050         wprintf("</span>"
00051                 "</td></tr></table>\n"
00052                 "</div>\n<div id=\"content\">\n"
00053         );
00054 
00055         serv_puts("LIST");
00056         serv_getln(buf, sizeof buf);
00057         if (buf[0] != '1') {
00058                 wprintf("<em>%s</em><br />\n", &buf[4]);
00059                 goto DONE;
00060         }
00061 
00062         wprintf("<div class=\"fix_scrollbar_bug\">"
00063                 "<table class=\"userlist_background\"><tr><td>\n");
00064         wprintf("<tr><th>%s</th><th>%s</th><th>%s</th>"
00065                         "<th>%s</th><th>%s</th><th>%s</th></tr>",
00066                         _("User Name"),
00067                         _("Number"),
00068                         _("Access Level"),
00069                         _("Last Login"),
00070                         _("Total Logins"),
00071                         _("Total Posts"));
00072 
00073         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
00074                 extract_token(fl, buf, 0, '|', sizeof fl);
00075                 has_bio = 0;
00076                 for (bptr = bio; bptr != NULL; bptr = bptr->next) {
00077                         if (!strcasecmp(fl, bptr->name))
00078                                 has_bio = 1;
00079                 }
00080                 bg = 1 - bg;
00081                 wprintf("<tr bgcolor=\"#%s\"><td>",
00082                         (bg ? "DDDDDD" : "FFFFFF")
00083                 );
00084                 if (has_bio) {
00085                         wprintf("<a href=\"showuser&who=");
00086                         urlescputs(fl);
00087                         wprintf("\">");
00088                         escputs(fl);
00089                         wprintf("</A>");
00090                 } else {
00091                         escputs(fl);
00092                 }
00093                 wprintf("</td><td>%ld</td><td>%d</td><td>",
00094                         extract_long(buf, 2),
00095                         extract_int(buf, 1));
00096                 lc = extract_long(buf, 3);
00097                 localtime_r(&lc, &tmbuf);
00098                 wprintf("%02d/%02d/%04d ",
00099                         (tmbuf.tm_mon + 1),
00100                         tmbuf.tm_mday,
00101                         (tmbuf.tm_year + 1900));
00102 
00103 
00104                 wprintf("</td><td>%ld</td><td>%5ld</td></tr>\n",
00105                         extract_long(buf, 4), extract_long(buf, 5));
00106 
00107         }
00108         wprintf("</table></div>\n");
00109 DONE:   wDumpContent(1);
00110 }
00111 
00112 
00116 void showuser(void)
00117 {
00118         char who[256];
00119         char buf[256];
00120         int have_pic;
00121 
00122         strcpy(who, bstr("who"));
00123 
00124         output_headers(1, 1, 2, 0, 0, 0);
00125         wprintf("<div id=\"banner\">\n"
00126                 "<table class=\"userlist_banner\"><tr>"
00127                 "<td><img src=\"static/usermanag_48x.gif\"></td>"
00128                 "<td align=left><span class=\"titlebar\">");
00129         wprintf(_("User profile"));
00130         wprintf("</span>"
00131                 "</td></tr></table>\n"
00132                 "</div>\n<div id=\"content\">\n"
00133         );
00134 
00135         wprintf("<div class=\"fix_scrollbar_bug\">"
00136                 "<table class=\"userlist_background\"><tr><td>\n");
00137 
00138         serv_printf("OIMG _userpic_|%s", who);
00139         serv_getln(buf, sizeof buf);
00140         if (buf[0] == '2') {
00141                 have_pic = 1;
00142                 serv_puts("CLOS");
00143                 serv_getln(buf, sizeof buf);
00144         } else {
00145                 have_pic = 0;
00146         }
00147 
00148         wprintf("<center><table><tr><td>");
00149         if (have_pic == 1) {
00150                 wprintf("<img src=\"image&name=_userpic_&parm=");
00151                 urlescputs(who);
00152                 wprintf("\">");
00153         }
00154         wprintf("</td><td><h1>%s</h1></td></tr></table></center>\n", who);
00155         serv_printf("RBIO %s", who);
00156         serv_getln(buf, sizeof buf);
00157         if (buf[0] == '1') {
00158                 fmout("JUSTIFY");
00159         }
00160         wprintf("<br /><a href=\"display_page?recp=");
00161         urlescputs(who);
00162         wprintf("\">"
00163                 "<img src=\"static/citadelchat_24x.gif\" "
00164                 "align=middle border=0>&nbsp;&nbsp;");
00165         snprintf(buf, sizeof buf, _("Click here to send an instant message to %s"), who);
00166         escputs(buf);
00167         wprintf("</a>\n");
00168 
00169         wprintf("</td></tr></table></div>\n");
00170         wDumpContent(1);
00171 }
00172 
00173 

Generated on Wed Jun 20 23:13:11 2007 for webcit by  doxygen 1.5.2