4 * This is the actual program called by the webserver. It maintains a
5 * persistent session to the Citadel server, handling HTTP WebCit requests as
6 * they arrive and presenting a user interface.
17 #include <sys/types.h>
19 #include <sys/socket.h>
23 #include <netinet/in.h>
32 #include "webserver.h"
33 #include "mime_parser.h"
36 * String to unset the cookie.
37 * Any date "in the past" will work, so I chose my birthday, right down to
38 * the exact minute. :)
40 static char *unset = "; expires=28-May-1971 18:10:00 GMT";
42 void unescape_input(char *buf)
47 while ((isspace(buf[strlen(buf) - 1])) && (strlen(buf) > 0))
48 buf[strlen(buf) - 1] = 0;
50 for (a = 0; a < strlen(buf); ++a) {
57 sscanf(hex, "%02x", &b);
59 strcpy(&buf[a + 1], &buf[a + 3]);
66 void addurls(char *url)
74 while (strlen(up) > 0) {
76 /* locate the = sign */
77 safestrncpy(buf, up, sizeof buf);
79 for (a = 255; a >= 0; --a)
86 u = (struct urlcontent *) malloc(sizeof(struct urlcontent));
87 u->next = WC->urlstrings;
89 strcpy(u->url_key, buf);
91 /* now chop that part off */
92 for (a = 0; a <= b; ++a)
95 /* locate the & sign */
98 for (a = 0; a < strlen(up); ++a) {
99 if (!strncmp(ptr, "&", 1)) {
106 for (a = 0; a < b; ++a)
110 u->url_data = malloc(strlen(up) + 1);
111 strcpy(u->url_data, up);
113 unescape_input(u->url_data);
121 struct urlcontent *u;
123 while (WC->urlstrings != NULL) {
124 free(WC->urlstrings->url_data);
125 u = WC->urlstrings->next;
126 free(WC->urlstrings);
132 * Diagnostic function to display the contents of all variables
136 struct urlcontent *u;
138 for (u = WC->urlstrings; u != NULL; u = u->next) {
139 wprintf("%38s = %s\n", u->url_key, u->url_data);
143 char *bstr(char *key)
145 struct urlcontent *u;
147 for (u = WC->urlstrings; u != NULL; u = u->next) {
148 if (!strcasecmp(u->url_key, key))
149 return (u->url_data);
155 void wprintf(const char *format,...)
160 va_start(arg_ptr, format);
161 vsprintf(wbuf, format, arg_ptr);
164 write(WC->http_sock, wbuf, strlen(wbuf));
169 * wDumpContent() wraps up an HTTP session, closes tags, etc.
171 * print_standard_html_footer should be set to 0 to transmit only, 1 to
172 * append the main menu and closing tags, or 2 to
173 * append the closing tags only.
175 void wDumpContent(int print_standard_html_footer)
177 if (print_standard_html_footer) {
178 do_template("trailing");
186 * Copy a string, escaping characters which have meaning in HTML. If
187 * nbsp is nonzero, spaces are converted to non-breaking spaces.
189 void stresc(char *target, char *strbuf, int nbsp)
194 for (a = 0; a < strlen(strbuf); ++a) {
195 if (strbuf[a] == '<')
196 strcat(target, "<");
197 else if (strbuf[a] == '>')
198 strcat(target, ">");
199 else if (strbuf[a] == '&')
200 strcat(target, "&");
201 else if (strbuf[a] == '\"')
202 strcat(target, """);
203 else if (strbuf[a] == '\'')
204 strcat(target, "'");
205 else if (strbuf[a] == LB)
207 else if (strbuf[a] == RB)
209 else if (strbuf[a] == QU)
210 strcat(target, "\"");
211 else if ((strbuf[a] == 32) && (nbsp == 1)) {
212 strcat(target, " ");
214 strncat(target, &strbuf[a], 1);
219 void escputs1(char *strbuf, int nbsp)
222 stresc(buf, strbuf, nbsp);
226 void escputs(char *strbuf)
232 * Escape a string for feeding out as a URL.
233 * Returns a pointer to a buffer that must be freed by the caller!
235 void urlesc(char *outbuf, char *strbuf)
238 char *ec = " #&;`'|*?-~<>^()[]{}$\\";
242 for (a = 0; a < strlen(strbuf); ++a) {
244 for (b = 0; b < strlen(ec); ++b) {
245 if (strbuf[a] == ec[b])
250 sprintf(&outbuf[b], "%%%02x", strbuf[a]);
252 sprintf(&outbuf[b], "%c", strbuf[a]);
256 void urlescputs(char *strbuf)
260 urlesc(outbuf, strbuf);
261 wprintf("%s", outbuf);
268 * Output all that important stuff that the browser will want to see
273 * 0 = Nothing. Do not display any leading HTTP or HTML.
274 * 1 = HTTP headers plus the room banner
275 * 2 = HTTP headers required to terminate the session (unset cookies)
276 * 3 = HTTP and HTML headers, but no room banner
278 * Bit 2: Set to 1 to auto-refresh page every 30 seconds
280 * Bit 3: suppress check for express messages
282 void output_headers(int controlcode)
285 int print_standard_html_head = 0;
287 int suppress_check = 0;
289 static int pageseq = 0;
290 print_standard_html_head = controlcode & 0x03;
291 refresh30 = ((controlcode & 0x04) >> 2);
292 suppress_check = ((controlcode & 0x08) >> 3);
294 wprintf("HTTP/1.0 200 OK\n");
296 httpdate(httpnow, time(NULL));
298 if (print_standard_html_head > 0) {
299 wprintf("Content-type: text/html\n"
300 "Server: %s\n", SERVER
302 wprintf("Connection: close\n"
304 "Cache-Control: no-store\n"
307 stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
308 WC->wc_password, WC->wc_roomname);
309 if (print_standard_html_head == 2) {
310 wprintf("Set-cookie: webcit=%s\n", unset);
312 wprintf("Set-cookie: webcit=%s\n", cookie);
313 if (server_cookie != NULL) {
314 wprintf("%s\n", server_cookie);
318 if (print_standard_html_head > 0) {
321 if (refresh30) svprintf("REFRESHTAG", WCS_STRING,
322 "<META HTTP-EQUIV=\"refresh\" CONTENT=\"30\">\n");
323 else svprintf("REFRESHTAG", WCS_STRING,
324 "<META HTTP-EQUIV=\"refresh\" CONTENT=\"500363689;\">\n");
325 /* script for checking for pages (not always launched) */
326 svprintf("PAGERSCRIPT", WCS_STRING,
327 "<SCRIPT LANGUAGE=\"JavaScript\">\n"
328 "function launch_page_popup() {\n"
329 "pwin = window.open('/page_popup', 'CitaPage%d', "
330 "'toolbar=no,location=no,copyhistory=no,status=no,"
331 "scrollbars=yes,resizable=no,height=250,width=400');\n"
339 clear_local_substs();
341 if (!suppress_check) if (WC->HaveExpressMessages) {
342 svprintf("extrabodyparms", WCS_STRING, "%s",
343 "onload=\"launch_page_popup()\" ");
344 WC->HaveExpressMessages = 0;
347 do_template("background");
348 clear_local_substs();
350 if (print_standard_html_head == 1) {
351 wprintf("<A NAME=\"TheTop\"></A>");
353 embed_room_banner(NULL);
363 void http_redirect(char *whichpage) {
364 wprintf("HTTP/1.0 302 Moved Temporarily\n");
365 wprintf("Location: %s\n", whichpage);
366 wprintf("URI: %s\n", whichpage);
367 wprintf("Content-type: text/html\n\n");
368 wprintf("<html><body>\n");
369 wprintf("you really want to be <A HREF=\"%s\">here</A> now\n",
371 wprintf("</body></html>\n");
376 void check_for_express_messages()
382 if (buf[3] == '*') WC->HaveExpressMessages = 1;
389 * Output a piece of content to the web browser
391 void http_transmit_thing(char *thing, size_t length, char *content_type) {
393 wprintf("Content-type: %s\n"
394 "Content-length: %ld\n"
396 "Connection: close\n"
402 write(WC->http_sock, thing, (size_t)length);
408 void output_static(char *what)
415 char content_type[SIZ];
417 lprintf(9, "output_static(%s)\n", what);
418 sprintf(buf, "static/%s", what);
419 fp = fopen(buf, "rb");
421 wprintf("HTTP/1.0 404 %s\n", strerror(errno));
422 wprintf("Content-Type: text/plain\n");
424 wprintf("Cannot open %s: %s\n", what, strerror(errno));
426 if (!strncasecmp(&what[strlen(what) - 4], ".gif", 4))
427 strcpy(content_type, "image/gif");
428 else if (!strncasecmp(&what[strlen(what) - 4], ".txt", 4))
429 strcpy(content_type, "text/plain");
430 else if (!strncasecmp(&what[strlen(what) - 4], ".css", 4))
431 strcpy(content_type, "text/css");
432 else if (!strncasecmp(&what[strlen(what) - 4], ".jpg", 4))
433 strcpy(content_type, "image/jpeg");
434 else if (!strncasecmp(&what[strlen(what) - 4], ".png", 4))
435 strcpy(content_type, "image/png");
436 else if (!strncasecmp(&what[strlen(what) - 5], ".html", 5))
437 strcpy(content_type, "text/html");
438 else if (!strncasecmp(&what[strlen(what) - 4], ".wml", 4))
439 strcpy(content_type, "text/vnd.wap.wml");
440 else if (!strncasecmp(&what[strlen(what) - 5], ".wmls", 5))
441 strcpy(content_type, "text/vnd.wap.wmlscript");
442 else if (!strncasecmp(&what[strlen(what) - 5], ".wmlc", 5))
443 strcpy(content_type, "application/vnd.wap.wmlc");
444 else if (!strncasecmp(&what[strlen(what) - 6], ".wmlsc", 6))
445 strcpy(content_type, "application/vnd.wap.wmlscriptc");
446 else if (!strncasecmp(&what[strlen(what) - 5], ".wbmp", 5))
447 wprintf("Content-type: image/vnd.wap.wbmp");
449 wprintf("Content-type: application/octet-stream");
451 fstat(fileno(fp), &statbuf);
452 bytes = statbuf.st_size;
453 lprintf(3, "Static: %s, %ld bytes\n", what, bytes);
454 bigbuffer = malloc(bytes);
455 fread(bigbuffer, bytes, 1, fp);
458 http_transmit_thing(bigbuffer, (size_t)bytes, content_type);
461 if (!strcasecmp(bstr("force_close_session"), "yes")) {
462 end_webcit_session();
468 * When the browser requests an image file from the Citadel server,
469 * this function is called to transmit it.
474 char *xferbuf = NULL;
477 serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
480 bytes = extract_long(&buf[4], 0);
481 xferbuf = malloc(bytes);
483 /* Read it from the server */
484 read_server_binary(xferbuf, bytes);
488 /* Write it to the browser */
489 http_transmit_thing(xferbuf, (size_t)bytes, "image/gif");
493 wprintf("HTTP/1.0 404 %s\n", &buf[4]);
495 wprintf("Content-Type: text/plain\n"
497 "Error retrieving image: %s\n",
508 void output_mimepart()
512 char content_type[SIZ];
513 char *content = NULL;
515 serv_printf("OPNA %s|%s", bstr("msgnum"), bstr("partnum"));
518 bytes = extract_long(&buf[4], 0);
519 content = malloc(bytes);
520 extract(content_type, &buf[4], 3);
522 read_server_binary(content, bytes);
525 http_transmit_thing(content, bytes, content_type);
528 wprintf("HTTP/1.0 404 %s\n", &buf[4]);
530 wprintf("Content-Type: text/plain\n");
532 wprintf("Error retrieving part: %s\n", &buf[4]);
540 char *load_mimepart(long msgnum, char *partnum)
544 char content_type[SIZ];
547 serv_printf("OPNA %ld|%s", msgnum, partnum);
550 bytes = extract_long(&buf[4], 0);
551 extract(content_type, &buf[4], 3);
553 content = malloc(bytes + 1);
554 read_server_binary(content, bytes);
558 content[bytes] = 0; /* null terminate for good measure */
569 * Convenience functions to display a page containing only a string
571 void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext)
573 wprintf("HTTP/1.0 200 OK\n");
575 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=%s><TR><TD>", titlebarcolor);
576 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
577 wprintf("<B>%s</B>\n", titlebarmsg);
578 wprintf("</FONT></TD></TR></TABLE><BR>\n");
579 escputs(messagetext);
587 * Display a blank page.
589 void blank_page(void) {
598 * Offer to make any page the user's "start page."
600 void offer_start_page(void) {
601 wprintf("<A HREF=\"/change_start_page?startpage=");
602 urlescputs(WC->this_page);
604 "<FONT SIZE=-2 COLOR=#AAAAAA>Make this my start page</FONT>"
611 * Change the user's start page
613 void change_start_page(void) {
615 if (bstr("startpage") == NULL) {
616 display_error("startpage set to null");
620 set_preference("startpage", bstr("startpage"));
623 do_template("newstartpage");
630 void display_error(char *errormessage)
632 convenience_page("770000", "Error", errormessage);
635 void display_success(char *successmessage)
637 convenience_page("007700", "OK", successmessage);
642 void extract_action(char *actbuf, char *cmdbuf)
646 strcpy(actbuf, cmdbuf);
647 if (!strncasecmp(actbuf, "GET /", 5))
648 strcpy(actbuf, &actbuf[5]);
649 if (!strncasecmp(actbuf, "PUT /", 5))
650 strcpy(actbuf, &actbuf[5]);
651 if (!strncasecmp(actbuf, "POST /", 6))
652 strcpy(actbuf, &actbuf[6]);
654 for (i = 0; i < strlen(actbuf); ++i) {
655 if (actbuf[i] == ' ') {
659 if (actbuf[i] == '/') {
663 if (actbuf[i] == '?') {
667 if (actbuf[i] == '&') {
675 void upload_handler(char *name, char *filename, char *partnum, char *disp,
676 void *content, char *cbtype, size_t length,
677 char *encoding, void *userdata)
680 lprintf(5, "UPLOAD HANDLER CALLED\n");
681 lprintf(5, " name = %s\n", name);
682 lprintf(5, "filename = %s\n", filename);
683 lprintf(5, "encoding = %s\n", encoding);
684 lprintf(5, " type = %s\n", cbtype);
685 lprintf(5, " length = %ld\n", (long)length);
688 WC->upload = malloc(length);
689 if (WC->upload != NULL) {
690 WC->upload_length = length;
691 memcpy(WC->upload, content, length);
694 lprintf(9, "malloc() failed: %s\n",
704 * Entry point for WebCit transaction
706 void session_loop(struct httprequest *req)
712 int ContentLength = 0;
714 char ContentType[512];
717 struct httprequest *hptr;
718 char browser_host[SIZ];
719 char user_agent[SIZ];
721 /* We stuff these with the values coming from the client cookies,
722 * so we can use them to reconnect a timed out session if we have to.
726 char c_username[SIZ];
727 char c_password[SIZ];
728 char c_roomname[SIZ];
731 strcpy(c_host, defaulthost);
732 strcpy(c_port, defaultport);
733 strcpy(c_username, "");
734 strcpy(c_password, "");
735 strcpy(c_roomname, "");
737 WC->upload_length = 0;
743 if (hptr == NULL) return;
745 strcpy(cmd, hptr->line);
747 extract_action(action, cmd);
749 while (hptr != NULL) {
750 strcpy(buf, hptr->line);
753 if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
754 strcpy(cookie, &buf[15]);
755 cookie_to_stuff(cookie, NULL,
756 c_username, c_password, c_roomname);
758 else if (!strncasecmp(buf, "Content-length: ", 16)) {
759 ContentLength = atoi(&buf[16]);
761 else if (!strncasecmp(buf, "Content-type: ", 14)) {
762 safestrncpy(ContentType, &buf[14], sizeof ContentType);
764 else if (!strncasecmp(buf, "User-agent: ", 12)) {
765 safestrncpy(user_agent, &buf[12], sizeof user_agent);
767 else if (!strncasecmp(buf, "Host: ", 6)) {
768 safestrncpy(WC->http_host, &buf[6], sizeof WC->http_host);
770 /* Only WAP gateways explicitly name this content-type */
771 else if (strstr(buf, "text/vnd.wap.wml")) {
776 if (ContentLength > 0) {
777 lprintf(5, "Content length: %d\n", ContentLength);
778 content = malloc(ContentLength + 1);
779 memset(content, 0, ContentLength+1);
782 while (BytesRead < ContentLength) {
783 a=read(WC->http_sock, &content[BytesRead],
784 ContentLength - BytesRead);
785 if (a <= 0) BytesRead = ContentLength;
789 if (!strncasecmp(ContentType,
790 "application/x-www-form-urlencoded", 33)) {
792 } else if (!strncasecmp(ContentType, "multipart", 9)) {
793 content_end = content + ContentLength;
794 mime_parser(content, content_end, *upload_handler,
795 NULL, NULL, NULL, 0);
801 /* make a note of where we are in case the user wants to save it */
802 safestrncpy(WC->this_page, cmd, sizeof(WC->this_page));
803 remove_token(WC->this_page, 2, ' ');
804 remove_token(WC->this_page, 0, ' ');
806 /* If there are variables in the URL, we must grab them now */
807 for (a = 0; a < strlen(cmd); ++a) {
808 if ((cmd[a] == '?') || (cmd[a] == '&')) {
809 for (b = a; b < strlen(cmd); ++b)
812 addurls(&cmd[a + 1]);
818 * If we're not connected to a Citadel server, try to hook up the
819 * connection now. Preference is given to the host and port specified
820 * by browser cookies, if cookies have been supplied.
822 if (!WC->connected) {
823 if (strlen(bstr("host")) > 0)
824 strcpy(c_host, bstr("host"));
825 if (strlen(bstr("port")) > 0)
826 strcpy(c_port, bstr("port"));
828 if (!strcasecmp(c_host, "uds")) {
829 /* unix domain socket */
830 sprintf(buf, "%s/citadel.socket", c_port);
831 WC->serv_sock = uds_connectsock(buf);
835 WC->serv_sock = tcp_connectsock(c_host, c_port);
838 if (WC->serv_sock < 0) {
840 goto SKIP_ALL_THIS_CRAP;
844 serv_gets(buf); /* get the server welcome message */
845 locate_host(browser_host, WC->http_sock);
846 get_serv_info(browser_host, user_agent);
847 if (serv_info.serv_rev_level < MINIMUM_CIT_VERSION) {
848 wprintf("You are connected to a Citadel "
849 "server running Citadel %d.%02d;\nin "
850 "order to run this version of WebCit "
851 "you must also have Citadel %d.%02d or"
853 serv_info.serv_rev_level / 100,
854 serv_info.serv_rev_level % 100,
855 MINIMUM_CIT_VERSION / 100,
856 MINIMUM_CIT_VERSION % 100
858 end_webcit_session();
859 goto SKIP_ALL_THIS_CRAP;
865 * Functions which can be performed without logging in
867 if (!strcasecmp(action, "listsub")) {
869 goto SKIP_ALL_THIS_CRAP;
872 check_for_express_messages();
875 * If we're not logged in, but we have username and password cookies
876 * supplied by the browser, try using them to log in.
878 if ((!WC->logged_in) && (strlen(c_username) > 0) && (strlen(c_password) > 0)) {
879 serv_printf("USER %s", c_username);
882 serv_printf("PASS %s", c_password);
885 become_logged_in(c_username, c_password, buf);
890 * If we don't have a current room, but a cookie specifying the
891 * current room is supplied, make an effort to go there.
893 if ((strlen(WC->wc_roomname) == 0) && (strlen(c_roomname) > 0)) {
894 serv_printf("GOTO %s", c_roomname);
897 strcpy(WC->wc_roomname, c_roomname);
900 if (!strcasecmp(action, "static")) {
901 strcpy(buf, &cmd[12]);
902 for (a = 0; a < strlen(buf); ++a)
906 } else if (!strcasecmp(action, "image")) {
910 * All functions handled below this point ... make sure we log in
911 * before doing anything else!
913 } else if ((!WC->logged_in) && (!strcasecmp(action, "login"))) {
915 } else if (!WC->logged_in) {
920 * Various commands...
923 else if (!strcasecmp(action, "do_welcome")) {
925 } else if (!strcasecmp(action, "blank")) {
927 } else if (!strcasecmp(action, "display_main_menu")) {
929 } else if (!strcasecmp(action, "whobbs")) {
931 } else if (!strcasecmp(action, "knrooms")) {
933 } else if (!strcasecmp(action, "gotonext")) {
936 } else if (!strcasecmp(action, "skip")) {
938 } else if (!strcasecmp(action, "ungoto")) {
940 } else if (!strcasecmp(action, "dotgoto")) {
942 smart_goto(bstr("room"));
943 } else if (!strcasecmp(action, "dotskip")) {
944 smart_goto(bstr("room"));
945 } else if (!strcasecmp(action, "termquit")) {
947 } else if (!strcasecmp(action, "readnew")) {
949 } else if (!strcasecmp(action, "readold")) {
951 } else if (!strcasecmp(action, "readfwd")) {
953 } else if (!strcasecmp(action, "headers")) {
955 } else if (!strcasecmp(action, "display_enter")) {
957 } else if (!strcasecmp(action, "post")) {
959 } else if (!strcasecmp(action, "delete_msg")) {
961 } else if (!strcasecmp(action, "confirm_move_msg")) {
963 } else if (!strcasecmp(action, "move_msg")) {
965 } else if (!strcasecmp(action, "userlist")) {
967 } else if (!strcasecmp(action, "showuser")) {
969 } else if (!strcasecmp(action, "display_page")) {
971 } else if (!strcasecmp(action, "page_user")) {
973 } else if (!strcasecmp(action, "chat")) {
975 } else if (!strcasecmp(action, "display_private")) {
976 display_private("", 0);
977 } else if (!strcasecmp(action, "goto_private")) {
979 } else if (!strcasecmp(action, "zapped_list")) {
981 } else if (!strcasecmp(action, "display_zap")) {
983 } else if (!strcasecmp(action, "zap")) {
985 } else if (!strcasecmp(action, "display_entroom")) {
987 } else if (!strcasecmp(action, "entroom")) {
989 } else if (!strcasecmp(action, "display_editroom")) {
991 } else if (!strcasecmp(action, "netedit")) {
993 } else if (!strcasecmp(action, "editroom")) {
995 } else if (!strcasecmp(action, "display_whok")) {
997 } else if (!strcasecmp(action, "display_editinfo")) {
998 display_edit("Room info", "EINF 0", "RINF", "/editinfo");
999 } else if (!strcasecmp(action, "editinfo")) {
1000 save_edit("Room info", "EINF 1", 1);
1001 } else if (!strcasecmp(action, "display_editbio")) {
1002 sprintf(buf, "RBIO %s", WC->wc_username);
1003 display_edit("Your bio", "NOOP", buf, "editbio");
1004 } else if (!strcasecmp(action, "editbio")) {
1005 save_edit("Your bio", "EBIO", 0);
1006 } else if (!strcasecmp(action, "confirm_delete_room")) {
1007 confirm_delete_room();
1008 } else if (!strcasecmp(action, "delete_room")) {
1010 } else if (!strcasecmp(action, "validate")) {
1012 } else if (!strcasecmp(action, "display_editpic")) {
1013 display_graphics_upload("your photo",
1016 } else if (!strcasecmp(action, "editpic")) {
1017 do_graphics_upload("UIMG 1|_userpic_");
1018 } else if (!strcasecmp(action, "display_editroompic")) {
1019 display_graphics_upload("the graphic for this room",
1022 } else if (!strcasecmp(action, "editroompic")) {
1023 do_graphics_upload("UIMG 1|_roompic_");
1024 } else if (!strcasecmp(action, "delete_floor")) {
1026 } else if (!strcasecmp(action, "rename_floor")) {
1028 } else if (!strcasecmp(action, "create_floor")) {
1030 } else if (!strcasecmp(action, "display_editfloorpic")) {
1031 sprintf(buf, "UIMG 0|_floorpic_|%s",
1032 bstr("which_floor"));
1033 display_graphics_upload("the graphic for this floor",
1036 } else if (!strcasecmp(action, "editfloorpic")) {
1037 sprintf(buf, "UIMG 1|_floorpic_|%s",
1038 bstr("which_floor"));
1039 do_graphics_upload(buf);
1040 } else if (!strcasecmp(action, "display_reg")) {
1042 } else if (!strcasecmp(action, "display_changepw")) {
1044 } else if (!strcasecmp(action, "changepw")) {
1046 } else if (!strcasecmp(action, "display_edit_node")) {
1047 display_edit_node();
1048 } else if (!strcasecmp(action, "edit_node")) {
1050 } else if (!strcasecmp(action, "display_netconf")) {
1052 } else if (!strcasecmp(action, "display_confirm_delete_node")) {
1053 display_confirm_delete_node();
1054 } else if (!strcasecmp(action, "delete_node")) {
1056 } else if (!strcasecmp(action, "display_add_node")) {
1058 } else if (!strcasecmp(action, "add_node")) {
1060 } else if (!strcasecmp(action, "terminate_session")) {
1062 terminate_session();
1063 } else if (!strcasecmp(action, "edit_me")) {
1065 } else if (!strcasecmp(action, "display_siteconfig")) {
1066 display_siteconfig();
1067 } else if (!strcasecmp(action, "page_popup")) {
1069 } else if (!strcasecmp(action, "siteconfig")) {
1071 } else if (!strcasecmp(action, "display_generic")) {
1073 } else if (!strcasecmp(action, "do_generic")) {
1075 } else if (!strcasecmp(action, "display_menubar")) {
1077 } else if (!strcasecmp(action, "output_mimepart")) {
1079 } else if (!strcasecmp(action, "edit_vcard")) {
1081 } else if (!strcasecmp(action, "submit_vcard")) {
1083 } else if (!strcasecmp(action, "select_user_to_edit")) {
1084 select_user_to_edit(NULL, NULL);
1085 } else if (!strcasecmp(action, "display_edituser")) {
1086 display_edituser(NULL);
1087 } else if (!strcasecmp(action, "edituser")) {
1089 } else if (!strcasecmp(action, "create_user")) {
1091 } else if (!strcasecmp(action, "changeview")) {
1093 } else if (!strcasecmp(action, "folders")) {
1095 } else if (!strcasecmp(action, "do_stuff_to_msgs")) {
1097 } else if (!strcasecmp(action, "change_start_page")) {
1098 change_start_page();
1099 } else if (!strcasecmp(action, "display_floorconfig")) {
1100 display_floorconfig(NULL);
1101 } else if (!strcasecmp(action, "toggle_self_service")) {
1102 toggle_self_service();
1103 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
1104 } else if (!strcasecmp(action, "display_edit_task")) {
1105 display_edit_task();
1106 } else if (!strcasecmp(action, "save_task")) {
1108 } else if (!strcasecmp(action, "display_edit_event")) {
1109 display_edit_event();
1110 } else if (!strcasecmp(action, "save_event")) {
1112 } else if (!strcasecmp(action, "respond_to_request")) {
1113 respond_to_request();
1114 } else if (!strcasecmp(action, "handle_rsvp")) {
1117 } else if (!strcasecmp(action, "summary")) {
1119 } else if (!strcasecmp(action, "diagnostics")) {
1122 wprintf("You're in session %d<HR>\n", WC->wc_session);
1123 wprintf("Command: <BR><PRE>\n");
1125 wprintf("</PRE><HR>\n");
1126 wprintf("Variables: <BR><PRE>\n");
1128 wprintf("</PRE><HR>\n");
1131 /* When all else fais, display the main menu. */
1133 display_main_menu();
1138 if (content != NULL) {
1143 if (WC->upload_length > 0) {
1145 WC->upload_length = 0;