/* $Id$ */
+
+
+
+#include <ctype.h>
#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <stdio.h>
-#include <ctype.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
#include <string.h>
+#include <pwd.h>
#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
#include "webcit.h"
-#include "child.h"
-/*
- * menu of commands (just the menu html itself)
- */
-void embed_main_menu(void)
+/*
+ * The Main Menu
+ */
+void display_main_menu(void)
{
- wprintf("<CENTER><TABLE border=0><TR>");
+ output_headers(1);
+
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>"
+ "<SPAN CLASS=\"titlebar\">Basic commands</SPAN>\n"
+ "</TD></TR></TABLE>\n"
+ "<CENTER><TABLE border=0><TR>"
+ );
wprintf("<TD>"); /* start of first column */
wprintf("</TD><TD>"); /* start of third column */
wprintf("<UL>");
- wprintf("<LI><B><A HREF=\"/whobbs\">\n");
- wprintf("Who is online?</B></A><BR>(users <EM>currently</EM> logged on)</LI>\n");
+ wprintf("<LI><B><A HREF=\"/summary\">\n");
+ wprintf("Summary page</B></A><BR>Summary of my account</LI>\n");
wprintf("<LI><B><A HREF=\"/userlist\">\n");
wprintf("User list</B></A><BR>(all registered users)</LI>\n");
- wprintf("<LI><B><A HREF=\"/advanced\">\n");
- wprintf("Advanced options</B></A><BR>...and maintenance</LI>\n");
-
- wprintf("<LI><B><A HREF=\"/termquit\">\n");
+ wprintf("<LI><B><A HREF=\"/termquit\" TARGET=\"_top\">\n");
wprintf("Log off</B></A><BR>Bye!</LI>\n");
wprintf("</UL>\n");
wprintf("</TR></TABLE>\n");
- wprintf("</CENTER>\n");
-}
-
-/*
- * advanced options
- */
-void embed_advanced_menu(void)
-{
+ wprintf("<TABLE WIDTH=100%%><TR VALIGN=TOP><TD>");
- wprintf("<TABLE WIDTH=100%><TR VALIGN=TOP><TD>");
-
-
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Interaction</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Interaction</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<UL>");
- wprintf("<LI><A HREF=\"/display_page\">\n");
- wprintf("Page another user</A>\n");
-
+ wprintf("<LI><A HREF=\"/whobbs\">\n");
+ wprintf("Who is online?</A><font size=-2> "
+ "(users <EM>currently</EM> logged on)</font>\n");
wprintf("<LI><A HREF=\"/chat\">");
wprintf("Chat with other online users</A>\n");
wprintf("</TD><TD>");
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Your info</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#007700\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Your info</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<UL>");
wprintf("<LI><A HREF=\"/display_editbio\">\n");
wprintf("</TD></TR><TR VALIGN=TOP><TD>");
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Advanced room commands</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#000077\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Advanced room commands</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<UL>");
wprintf("<LI><A HREF=\"/display_private\">\n");
wprintf("<LI><A HREF=\"/display_zap\">");
wprintf("Zap (forget) this room (%s)</A>\n", WC->wc_roomname);
+ wprintf("<LI><A HREF=\"/display_whok\">\n");
+ wprintf("Access controls for this room</A>\n");
+
wprintf("<LI><A HREF=\"/zapped_list\">");
wprintf("List all forgotten rooms</A>\n");
wprintf("</TD><TD>");
if ((WC->axlevel >= 6) || (WC->is_room_aide)) {
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007777><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Administrative functions</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#007777\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Administrative functions</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<UL>");
wprintf("<LI><A HREF=\"/display_editroom\">\n");
wprintf("Edit site-wide configuration</A>\n");
if (WC->axlevel >= 6) {
+ wprintf("<LI><A HREF=\"/select_user_to_edit\">\n");
+ wprintf("Add, change, delete user accounts</A>\n");
+
wprintf("<LI><A HREF=\"/validate\">\n");
wprintf("Validate new users</A>\n");
- wprintf("<LI><A HREF=\"/select_floor_to_edit_pic\">\n");
- wprintf("Set or change a floor label graphic</A>\n");
+ wprintf("<LI><A HREF=\"/display_floorconfig\">\n");
+ wprintf("Add, change, or delete floors</A>\n");
wprintf("<LI><A HREF=\"/display_netconf\">\n");
wprintf("Configure networking with other systems</A>\n");
+ wprintf("<LI><A HREF=\"/static/colorpicker.html\">\n");
+ wprintf("Reconfigure color scheme</A>\n");
}
wprintf("</UL>\n");
}
wprintf("</TD></TR></TABLE>");
-
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Basic commands</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
-
-}
-
-
-
-
-/*
- * menu of commands (as a page)
- */
-void display_main_menu(void)
-{
- printf("HTTP/1.0 200 OK\n");
- output_headers(1);
- embed_main_menu();
wDumpContent(2);
}
-void display_advanced_menu(void)
-{
- printf("HTTP/1.0 200 OK\n");
- output_headers(1);
- embed_advanced_menu();
- embed_main_menu();
- wDumpContent(2);
-}
+
/*
*/
void display_generic(void)
{
- printf("HTTP/1.0 200 OK\n");
output_headers(1);
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Enter a server command</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Enter a server command</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<CENTER>");
wprintf("This screen allows you to enter Citadel server commands which are\n");
wprintf("<INPUT TYPE=\"text\" NAME=\"g_cmd\" SIZE=80 MAXLENGTH=\"250\"><BR>\n");
wprintf("Command input (if requesting SEND_LISTING transfer mode):<BR>\n");
- wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA>\n");
+ wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA><BR>\n");
+ wprintf("<FONT SIZE=-2>Detected host header is http://%s</FONT>\n",
+ WC->http_host);
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Send command\">");
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
void do_generic(void)
{
- char buf[256];
- char gcontent[256];
+ char buf[SIZ];
+ char gcontent[SIZ];
char *junk;
size_t len;
return;
}
- printf("HTTP/1.0 200 OK\n");
output_headers(1);
serv_printf("%s", bstr("g_cmd"));
serv_gets(buf);
- wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Server command results</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770077\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Server command results</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<TABLE border=0><TR><TD>Command:</TD><TD><TT>");
escputs(bstr("g_cmd"));
wprintf("000");
}
if (buf[0] == '4') {
- text_to_server(bstr("g_input"));
+ text_to_server(bstr("g_input"), 0);
serv_puts("000");
}
if (buf[0] == '6') {
if (buf[0] == '7') {
len = atol(&buf[4]);
junk = malloc(len);
- bzero(junk, len);
+ memset(junk, 0, len);
serv_write(junk, len);
free(junk);
}
* that the menubar is being embedded in another page.
*/
void display_menubar(int as_single_page) {
- FILE *menubar_body;
- char buf[256];
if (as_single_page) {
- printf("HTTP/1.0 200 OK\n");
output_headers(0);
wprintf("<HTML>\n"
"<HEAD>\n"
"<STYLE TYPE=\"text/css\">\n"
"BODY { text-decoration: none; }\n"
"</STYLE>\n"
- "</HEAD>\n"
- "<BODY BACKGROUND=\"/image&name=background\" "
- "TEXT=\"#000000\" LINK=\"#FFFFFF\" "
- "ALINK=\"#FFFFFF\" VLINK=\"#FFFFFF\">\n");
+ "</HEAD>\n");
+ do_template("background");
}
- menubar_body = fopen("static/menubar.html", "r");
- if (menubar_body == NULL) {
- wprintf("menubar<BR>%s", strerror(errno));
- } else {
- while (fgets(buf, sizeof(buf), menubar_body) != NULL) {
- wprintf("%s", buf);
- }
- fclose(menubar_body);
- }
-
+ do_template("menubar");
if (as_single_page) {
wDumpContent(2);
}
+
+