/* * Authorization required page (sends a 401, causing the browser to request login credentials) */ void authorization_required(void) { wcsession *WCC = WC; const char *message = ""; hprintf("HTTP/1.1 401 Authorization Required\r\n"); hprintf( "Server: %s / %s\r\n" "Connection: close\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software) ); hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", ChrPtr(WC->serv_info->serv_humannode)); /* if this is a false cookie authentication, remove it to avoid endless loops. */ if (StrLength(WCC->Hdr->HR.RawCookie) > 0) stuff_to_cookie(1); hprintf("Content-Type: text/html\r\n"); begin_burst(); wc_printf("<h1>"); wc_printf(_("Authorization Required")); wc_printf("</h1>\r\n"); if (WCC->ImportantMsg != NULL) { message = ChrPtr(WCC->ImportantMsg); } wc_printf( _("The resource you requested requires a valid username and password. " "You could not be logged in: %s\n"), message ); wDumpContent(0); }
int wiki_Cleanup(void **ViewSpecific) { char pagename[5]; safestrncpy(pagename, "home", sizeof pagename); display_wiki_page_backend(pagename, "", 0); wDumpContent(1); return 0; }
/* * Entry point for RSS feed generator */ void feed_rss(void) { char buf[1024]; output_headers(0, 0, 0, 0, 1, 0); hprintf("Content-type: text/xml; charset=utf-8\r\n"); hprintf( "Server: %s / %s\r\n" "Connection: close\r\n" , PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software) ); begin_burst(); wc_printf("<?xml version=\"1.0\"?>" "<rss version=\"2.0\">" "<channel>" ); wc_printf("<title>"); escputs(ChrPtr(WC->CurRoom.name)); wc_printf("</title>"); wc_printf("<link>"); escputs(ChrPtr(site_prefix)); wc_printf("/</link>"); serv_puts("RINF"); serv_getln(buf, sizeof buf); if (buf[0] == '1') { wc_printf("<description>\r\n"); while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { escputs(buf); wc_printf("\r\n"); } wc_printf("</description>"); } wc_printf("<image><title>"); escputs(ChrPtr(WC->CurRoom.name)); wc_printf("</title><url>"); escputs(ChrPtr(site_prefix)); wc_printf("/roompic?room="); urlescputs(ChrPtr(WC->CurRoom.name)); wc_printf("</url><link>"); escputs(ChrPtr(site_prefix)); wc_printf("/</link></image>\r\n"); feed_rss_do_room_info_as_description(); feed_rss_do_messages(); wc_printf("</channel>" "</rss>" "\r\n\r\n" ); wDumpContent(0); }
/* * Convenience functions to display a page containing only a string * * titlebarcolor color of the titlebar of the frame * titlebarmsg text to display in the title bar * messagetext body of the box */ void convenience_page(const char *titlebarcolor, const char *titlebarmsg, const char *messagetext) { hprintf("HTTP/1.1 200 OK\n"); output_headers(1, 1, 1, 0, 0, 0); wc_printf("<div id=\"room_banner_override\">\n"); wc_printf("<table width=100%% border=0 bgcolor=\"#%s\"><tr><td>", titlebarcolor); wc_printf("<span class=\"titlebar\">%s</span>\n", titlebarmsg); wc_printf("</td></tr></table>\n"); wc_printf("</div>\n<div id=\"content\">\n"); escputs(messagetext); wc_printf("<hr />\n"); wDumpContent(1); }
/* * Display a specific page from a wiki room */ void display_wiki_page(void) { char pagename[128]; char rev[128]; int do_revert = 0; output_headers(1, 1, 1, 0, 0, 0); safestrncpy(pagename, bstr("page"), sizeof pagename); str_wiki_index(pagename); safestrncpy(rev, bstr("rev"), sizeof rev); do_revert = atoi(bstr("revert")); display_wiki_page_backend(pagename, rev, do_revert); wDumpContent(1); }
/* * Display the OpenIDs associated with an account */ void display_openids(void) { wcsession *WCC = WC; char buf[1024]; int bg = 0; output_headers(1, 1, 1, 0, 0, 0); do_template("box_begin_1"); StrBufAppendBufPlain(WCC->WBuf, _("Manage Account/OpenID Associations"), -1, 0); do_template("box_begin_2"); if (WCC->serv_info->serv_supports_openid) { wc_printf("<table class=\"altern\">"); serv_puts("OIDL"); serv_getln(buf, sizeof buf); if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { bg = 1 - bg; wc_printf("<tr class=\"%s\">", (bg ? "even" : "odd")); wc_printf("<td><img src=\"static/webcit_icons/openid-small.gif\"></td><td>"); escputs(buf); wc_printf("</td><td>"); wc_printf("<a href=\"openid_detach?id_to_detach="); urlescputs(buf); wc_printf("\" onClick=\"return confirm('%s');\">", _("Do you really want to delete this OpenID?")); wc_printf("%s</a>", _("(delete)")); wc_printf("</td></tr>\n"); } wc_printf("</table><br>\n"); wc_printf("<form method=\"POST\" action=\"openid_attach\">\n"); wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WCC->nonce); wc_printf(_("Add an OpenID: ")); wc_printf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n"); wc_printf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">" "</form></center>\n", _("Attach")); } else { wc_printf(_("%s does not permit authentication via OpenID."), ChrPtr(WCC->serv_info->serv_humannode)); } do_template("box_end"); wDumpContent(2); }
/* * Display the screen containing multiuser chat for a room. */ void do_chat(void) { char buf[256]; WC->last_chat_seq = 0; WC->last_chat_user[0] = 0; output_headers(1, 1, 1, 0, 0, 0); do_template("roomchat"); serv_puts("RCHT enter"); serv_getln(buf, sizeof buf); wDumpContent(1); }
/* * print ajax response footer */ void end_ajax_response(void) { wDumpContent(0); }
/* * Display a blank page. */ void blank_page(void) { output_headers(1, 1, 0, 0, 0, 0); wDumpContent(2); }
int notes_Cleanup(void **ViewSpecific) { wDumpContent(1); return 0; }
/* * Display a list of all pages in a Wiki room. Search requests in a Wiki room also go here. */ void display_wiki_pagelist(void) { output_headers(1, 1, 1, 0, 0, 0); do_template("wiki_pagelist"); wDumpContent(1); }
/* * Display the revision history for a wiki page */ void display_wiki_history(void) { output_headers(1, 1, 1, 0, 0, 0); do_template("wiki_history"); wDumpContent(1); }
/* * display the dialog to verify the deletion */ void display_confirm_delete_node(void) { wDumpContent(1); }
/* * display all configured nodes */ void display_netconf(void) { wDumpContent(1); }
void display_pushemail(void) { folder Room; int Done = 0; StrBuf *Buf; long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5}; WCTemplputParams SubTP; char mobnum[20]; StackContext(NULL, &SubTP, &vector, CTX_LONGVECTOR, 0, NULL); vector[0] = 16; /* Find any existing settings*/ Buf = NewStrBuf(); memset(&Room, 0, sizeof(folder)); if (goto_config_room(Buf, &Room) == 0) { int msgnum = 0; serv_puts("MSGS ALL|0|1"); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 8) { serv_puts("subj|__ Push email settings __"); serv_puts("000"); while (!Done && StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { Done = 1; break; } msgnum = StrTol(Buf); } } if (msgnum > 0L) { serv_printf("MSG0 %d", msgnum); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 1) { int i =0; Done = 0; while (!Done && StrBuf_ServGetln(Buf) >= 0) { if (( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000"))|| ((StrLength(Buf)==4) && !strcmp(ChrPtr(Buf), "text"))) { Done = 1; break; } } if (!strcmp(ChrPtr(Buf), "text")) { Done = 0; while (!Done && StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { Done = 1; break; } if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) { vector[1] = 0; } else if (strncasecmp(ChrPtr(Buf), "textmessage", 11) == 0) { vector[1] = 1; i++; } else if (strncasecmp(ChrPtr(Buf), "funambol", 8) == 0) { vector[1] = 2; } else if (strncasecmp(ChrPtr(Buf), "httpmessage", 12) == 0) { vector[1] = 3; } else if (i == 1) { strncpy(mobnum, ChrPtr(Buf), 20); i++; } } } } } serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); StrBuf_ServGetln(Buf); GetServerStatus(Buf, NULL); } FlushFolder(&Room); output_headers(1, 1, 1, 0, 0, 0); DoTemplate(HKEY("prefs_pushemail"), NULL, &SubTP); wDumpContent(1); UnStackContext(&SubTP); FreeStrBuf(&Buf); }