]> code.citadel.org Git - citadel.git/commitdiff
finished site-config screen and added generic-command screen
authorArt Cancro <ajc@citadel.org>
Tue, 12 Jan 1999 22:12:37 +0000 (22:12 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 12 Jan 1999 22:12:37 +0000 (22:12 +0000)
webcit/ChangeLog
webcit/child.h
webcit/mainmenu.c
webcit/siteconfig.c
webcit/webcit.c

index 819520bcd0eeb6ddc44ee0c4fe08fd5257eb8a1c..28e8b3f1c01b266aa0a268b9eade1074e4ca6fd1 100644 (file)
@@ -1,3 +1,7 @@
+Mon Jan 11 21:53:16 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Fixed the bugs in "Site-wide configuration"
+       * Added a "generic server commands" screen
+
 Fri Jan  8 22:20:54 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Reduced the multiple cookies down to one cookie combining all data.
 
index 6826a07f22b2cc1e764c588d1a07dd0035224a19..043afb69702b4933287f014d523fd27be286c136 100644 (file)
@@ -100,3 +100,5 @@ void terminate_session(void);
 void edit_me(void);
 void display_siteconfig(void);
 void siteconfig(void);
+void display_generic(void);
+void do_generic(void);
index e31967a7f187129dab28faf1092dfe9bb0f71024..c1c0c13f5fedd538218ef5117a7f9d095a607e15 100644 (file)
@@ -96,6 +96,9 @@ wprintf("Page another user</A>\n");
 wprintf("<LI><A HREF=\"/chat\">");
 wprintf("Chat with other online users</A>\n");
 
+wprintf("<LI><A HREF=\"/display_generic\">\n");
+wprintf("<FONT SIZE=-2>Generic server command</FONT></A>\n");
+
 wprintf("</UL>\n");
 
 wprintf("</TD><TD>");
@@ -213,3 +216,103 @@ void display_advanced_menu(void) {
        wprintf("</BODY></HTML>\n");
        wDumpContent();
        }
+
+
+/*
+ * Display the screen to enter a generic server command
+ */
+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("<CENTER>");
+       wprintf("This screen allows you to enter Citadel server commands which are\n");
+       wprintf("not supported by WebCit.  If you do not know what that means,\n");
+       wprintf("then this screen will not be of much use to you.<BR>\n");
+
+       wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_generic\">\n");
+
+       wprintf("Enter command:<BR>\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("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Send command\">");
+       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
+
+       wprintf("</FORM></CENTER>\n");
+       wprintf("</BODY></HTML>\n");
+       wDumpContent();
+       }
+
+void do_generic(void) {
+       char buf[256];
+       char gcontent[256];
+       char *junk;
+       size_t len;
+
+       if (strcasecmp(bstr("sc"), "Send command")) {
+               display_main_menu();
+               return;
+               }
+
+       serv_printf("%s", bstr("g_cmd"));
+       serv_gets(buf);
+
+       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>Server command results</B>\n");
+       wprintf("</FONT></TD></TR></TABLE>\n");
+
+       wprintf("<TABLE border=0><TR><TD>Command:</TD><TD><TT>");
+       escputs(bstr("g_cmd"));
+       wprintf("</TT></TD></TR><TR><TD>Result:</TD><TD><TT>");
+       escputs(buf);
+       wprintf("</TT></TD></TR></TABLE><BR>\n");
+
+       if (buf[0]=='8') {
+               serv_printf("\n\n000");
+               }
+
+       if ( (buf[0]=='1') || (buf[0]=='8') ) {
+               while(serv_gets(gcontent), strcmp(gcontent, "000")) {
+                       escputs(gcontent);
+                       wprintf("<BR>\n");
+                       }
+               wprintf("000");
+               }
+
+       if (buf[0]=='4') {
+               text_to_server(bstr("g_input"));
+               serv_puts("000");
+               }
+
+       if (buf[0]=='6') {
+               len = atol(&buf[4]);
+               junk = malloc(len);
+               serv_read(junk, len);
+               free(junk);
+               }
+
+       if (buf[0]=='7') {
+               len = atol(&buf[4]);
+               junk = malloc(len);
+               bzero(junk, len);
+               serv_write(junk, len);
+               free(junk);
+               }
+
+       wprintf("<HR>");
+       wprintf("<A HREF=\"/display_generic\">Enter another command</A><BR>\n");
+       wprintf("<A HREF=\"/display_advanced\">Return to menu</A>\n");
+       wprintf("</BODY></HTML>\n");
+       wDumpContent();
+       }
index 6976f5bfb03c21f464b5a184a32cfd52f68e5cc0..41c9261986374edc91eaf5f858055a8fc7a922f9 100644 (file)
@@ -55,7 +55,7 @@ void display_siteconfig(void) {
                        wprintf("</TD></TR>\n");
                        break;
                case 5: wprintf("<TR><TD>Automatically grant room-aide status to users who create private rooms</TD><TD>");
-                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_creataide\" VALUE=\"%s\">", (atoi(buf) ? "yes" : "no"));
+                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_creataide\" VALUE=\"yes\" %s>", ((atoi(buf)!=0) ? "CHECKED" : ""));
                        wprintf("</TD></TR>\n");
                        break;
                case 6: wprintf("<TR><TD>Server connection idle timeout (in seconds)</TD><TD>");
@@ -67,11 +67,11 @@ void display_siteconfig(void) {
                        wprintf("</TD></TR>\n");
                        break;
                case 8: wprintf("<TR><TD>Require registration for new users</TD><TD>");
-                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_regiscall\" VALUE=\"%s\">", (atoi(buf) ? "yes" : "no"));
+                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_regiscall\" VALUE=\"yes\" %s>", ((atoi(buf)!=0) ? "CHECKED" : ""));
                        wprintf("</TD></TR>\n");
                        break;
                case 9: wprintf("<TR><TD>Move problem user messages to twitroom</TD><TD>");
-                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_twitdetect\" VALUE=\"%s\">", (atoi(buf) ? "yes" : "no"));
+                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_twitdetect\" VALUE=\"yes\" %s>", ((atoi(buf)!=0) ? "CHECKED" : ""));
                        wprintf("</TD></TR>\n");
                        break;
                case 10:wprintf("<TR><TD>Name of twitroom</TD><TD>");
@@ -83,7 +83,7 @@ void display_siteconfig(void) {
                        wprintf("</TD></TR>\n");
                        break;
                case 12:wprintf("<TR><TD>Restrict access to Internet mail</TD><TD>");
-                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_restrict\" VALUE=\"%s\">", (atoi(buf) ? "yes" : "no"));
+                       wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_restrict\" VALUE=\"yes\" %s>", ((atoi(buf)!=0) ? "CHECKED" : ""));
                        wprintf("</TD></TR>\n");
                        break;
                case 13:wprintf("<TR><TD>Geographic location of this system</TD><TD>");
@@ -98,7 +98,7 @@ void display_siteconfig(void) {
                        wprintf("<INPUT TYPE=\"text\" NAME=\"c_maxsessions\" MAXLENGTH=\"5\" VALUE=\"%s\">", buf);
                        wprintf("</TD></TR>\n");
                        break;
-               case 16:wprintf("<TR><TD>Maximum concurrent sessions</TD><TD>");
+               case 16:wprintf("<TR><TD>Server-to-server networking password</TD><TD>");
                        wprintf("<INPUT TYPE=\"password\" NAME=\"c_net_password\" MAXLENGTH=\"19\" VALUE=\"%s\">", buf);
                        wprintf("</TD></TR>\n");
                        break;
@@ -133,7 +133,7 @@ void siteconfig(void) {
                return;
        }
 
-       serv_printf("SEXP ignatius t foobar|-");
+       serv_printf("CONF set");
        serv_gets(buf);
        if (buf[0]!='4') {
                display_error(&buf[4]);
@@ -144,14 +144,14 @@ void siteconfig(void) {
        serv_printf("%s", bstr("c_fqdn"));
        serv_printf("%s", bstr("c_humannode"));
        serv_printf("%s", bstr("c_phonenum"));
-       serv_printf("%s", ( (!strcasecmp(bstr("c_creataide"), "yes") ? 1 : 0)));
+       serv_printf("%s", ( (!strcasecmp(bstr("c_creataide"), "yes") ? "1" : "0")));
        serv_printf("%s", bstr("c_sleeping"));
        serv_printf("%s", bstr("c_initax"));
-       serv_printf("%s", ( (!strcasecmp(bstr("c_regiscall"), "yes") ? 1 : 0)));
-       serv_printf("%s", ( (!strcasecmp(bstr("c_twitdetect"), "yes") ? 1 : 0)));
+       serv_printf("%s", ( (!strcasecmp(bstr("c_regiscall"), "yes") ? "1" : "0")));
+       serv_printf("%s", ( (!strcasecmp(bstr("c_twitdetect"), "yes") ? "1" : "0")));
        serv_printf("%s", bstr("c_twitroom"));
        serv_printf("%s", bstr("c_moreprompt"));
-       serv_printf("%s", ( (!strcasecmp(bstr("c_restrict"), "yes") ? 1 : 0)));
+       serv_printf("%s", ( (!strcasecmp(bstr("c_restrict"), "yes") ? "1" : "0")));
        serv_printf("%s", bstr("c_bbs_city"));
        serv_printf("%s", bstr("c_sysadm"));
        serv_printf("%s", bstr("c_maxsessions"));
@@ -160,5 +160,5 @@ void siteconfig(void) {
        serv_printf("%s", bstr("c_roompurge"));
        serv_printf("%s", bstr("c_logpages"));
        serv_printf("000");
-       display_main_menu();
-}
+       display_success("System configuration has been updated.");
+       }
index 0e56def6d4f6b83887a54f2aa7e9dce43163a49f..047be7edaf0862d8fc314faf6d3626e6cafa2dfe 100644 (file)
@@ -871,6 +871,14 @@ void session_loop(void) {
                siteconfig();
                }
 
+       else if (!strcasecmp(action, "display_generic")) {
+               display_generic();
+               }
+
+       else if (!strcasecmp(action, "do_generic")) {
+               do_generic();
+               }
+
        /* When all else fails... */
        else {
                printf("HTTP/1.0 200 OK\n");