}
put_config();
snprintf(buf, sizeof buf,
- "The global system configuration has been edited by %s.\n",
- CC->curr_user);
+ "The global system configuration has been edited by %s.\n",
+ (CC->logged_in ? CC->curr_user : "an administrator")
+ );
CtdlAideMessage(buf,"Citadel Configuration Manager Message");
if (!IsEmptyStr(config.c_logpages))
/*
* Server-side module for Wiki rooms. This handles things like version control.
*
- * Copyright (c) 2009-2011 by the citadel.org team
+ * Copyright (c) 2009-2012 by the citadel.org team
*
* This program is open source software. You can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdep.h"
CtdlDecodeBase64(memo, filename, strlen(filename));
extract_token(this_rev, memo, 0, '|', sizeof this_rev);
- syslog(LOG_DEBUG, "callback found rev: %s\n", this_rev);
+ striplt(this_rev);
/* Perform the patch */
fp = popen(PATCH " -f -s -p0 -r /dev/null >/dev/null 2>/dev/null", "w");
memset(&hecbd, 0, sizeof(struct HistoryEraserCallBackData));
hecbd.tempfilename = temp;
hecbd.stop_when = rev;
+ striplt(hecbd.stop_when);
mime_parser(msg->cm_fields['M'], NULL, *wiki_rev_callback, NULL, NULL, (void *)&hecbd, 0);
CtdlFreeMessage(msg);
mkdir(buf, 0755);
}
snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n",
- CC->room.QRname, CC->curr_user);
+ CC->room.QRname,
+ (CC->logged_in ? CC->curr_user : "an administrator")
+ );
CtdlAideMessage(buf, "Room modification Message");
cprintf("%d Ok\n", CIT_OK);
}
/* tell the world what we did */
snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
- deleted_room_name, CC->curr_user);
+ deleted_room_name,
+ (CC->logged_in ? CC->curr_user : "an administrator")
+ );
CtdlAideMessage(msg, "Room Purger Message");
cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name);
} else {
snprintf(notification_message, 1024,
"A new room called \"%s\" has been created by %s%s%s%s%s%s\n",
new_room_name,
- CC->user.fullname,
+ (CC->logged_in ? CC->curr_user : "an administrator"),
((newflags & QR_MAILBOX) ? " [personal]" : ""),
((newflags & QR_PRIVATE) ? " [private]" : ""),
((newflags & QR_GUESSNAME) ? " [hidden]" : ""),
iuser,
((op == 1) ? "invited to" : "kicked out of"),
CC->room.QRname,
- CC->user.fullname);
+ (CC->logged_in ? CC->user.fullname : "an administrator")
+ );
CtdlAideMessage(bbb,"User Admin Message");
return(0);
if (deleted) {
snprintf(notify, SIZ,
"User \"%s\" has been deleted by %s.\n",
- usbuf.fullname, CC->user.fullname);
+ usbuf.fullname,
+ (CC->logged_in ? CC->user.fullname : "an administrator")
+ );
CtdlAideMessage(notify, "User Deletion Message");
}
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
- *
- *
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- *
- *
- *
*/
#include "webcit.h"
StrBuf *Recp = NULL;
StrBuf *Cc = NULL;
StrBuf *Bcc = NULL;
- const StrBuf *Wikipage = NULL;
+ char *wikipage = NULL;
const StrBuf *my_email_addr = NULL;
StrBuf *CmdBuf = NULL;
StrBuf *references = NULL;
FreeStrBuf(&EmailAddress);
FreeStrBuf(&EncBuf);
- Wikipage = sbstr("page");
+ wikipage = strdup(bstr("page"));
+ str_wiki_index(wikipage);
my_email_addr = sbstr("my_email_addr");
HeaderLen = StrLength(Recp) +
StrLength(encoded_subject) +
StrLength(Cc) +
StrLength(Bcc) +
- StrLength(Wikipage) +
+ strlen(wikipage) +
StrLength(my_email_addr) +
StrLength(references);
CmdBuf = NewStrBufPlain(NULL, sizeof (CMD) + HeaderLen);
ChrPtr(display_name),
saving_to_drafts?"":ChrPtr(Cc),
saving_to_drafts?"":ChrPtr(Bcc),
- ChrPtr(Wikipage),
+ wikipage,
ChrPtr(my_email_addr),
ChrPtr(references));
FreeStrBuf(&references);
FreeStrBuf(&encoded_subject);
+ free(wikipage);
if ((HeaderLen + StrLength(sbstr("msgtext")) < 10) &&
(GetCount(WCC->attachments) == 0)){
const StrBuf *Recp = NULL;
const StrBuf *Cc = NULL;
const StrBuf *Bcc = NULL;
- const StrBuf *Wikipage = NULL;
+ char *wikipage = NULL;
StrBuf *CmdBuf = NULL;
const char CMD[] = "ENT0 0|%s|%d|0||%s||%s|%s|%s";
Recp = sbstr("recp");
Cc = sbstr("cc");
Bcc = sbstr("bcc");
- Wikipage = sbstr("page");
+ wikipage = strdup(bstr("page"));
+ str_wiki_index(wikipage);
CmdBuf = NewStrBufPlain(NULL,
sizeof (CMD) +
StrLength(display_name) +
StrLength(Cc) +
StrLength(Bcc) +
- StrLength(Wikipage));
+ strlen(wikipage));
StrBufPrintf(CmdBuf,
CMD,
ChrPtr(display_name),
ChrPtr(Cc),
ChrPtr(Bcc),
- ChrPtr(Wikipage));
+ wikipage
+ );
serv_puts(ChrPtr(CmdBuf));
StrBuf_ServGetln(CmdBuf);
+ free(wikipage);
rc = GetServerStatusMsg(CmdBuf, &Result, 0, 0);
* to do it again.
*/
if (!havebstr("attach_button")) {
- msgnum = locate_message_by_uid(BSTR("page"));
+ char *wikipage = strdup(bstr("page"));
+ str_wiki_index(wikipage);
+ msgnum = locate_message_by_uid(wikipage);
+ free(wikipage);
if (msgnum >= 0L) {
Buf = NewStrBuf();
read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
<?MAIL:BODY>
-<?!("COND:MAIL:MIME:ATTACH:SUBMESSAGES", 10)><?ITERATE("MAIL:MIME:ATTACH:SUBMESSAGES", ="view_message_inline_attach")><?!("X", 10)>
+<?!("COND:MAIL:MIME:ATTACH:SUBMESSAGES", 10)>
+ <?ITERATE("MAIL:MIME:ATTACH:SUBMESSAGES", ="view_message_inline_attach")>
+<?!("X", 10)>
int get_time_format_cached (void);
void display_wiki_pagelist(void);
+void str_wiki_index(char *);
+
HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP);
/* actual supported locales */
*
* This program is open source software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
- *
- *
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- *
- *
- *
*/
#include "webcit.h"
* "rev" may be set to an empty string to display the current version.
* "do_revert" may be set to nonzero to perform a reversion to the specified version.
*/
-void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev, int do_revert)
+void display_wiki_page_backend(char *pagename, char *rev, int do_revert)
{
const StrBuf *Mime;
long msgnum = (-1L);
char buf[256];
- str_wiki_index(pagename);
-
- if (StrLength(roomname) > 0) {
-
- /* If we're not in the correct room, try going there. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- gotoroom(roomname);
- }
-
- /* If we're still not in the correct room, it doesn't exist. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- wc_printf(_("There is no room called '%s'."), ChrPtr(roomname));
- return;
- }
-
- }
-
if (WC->CurRoom.view != VIEW_WIKI) {
- wc_printf(_("'%s' is not a Wiki room."), ChrPtr(roomname));
+ wc_printf(_("'%s' is not a Wiki room."), ChrPtr(WC->CurRoom.name) );
return;
}
strcpy(pagename, "home");
}
- /* Found it! Now read it. */
+ str_wiki_index(pagename); /* convert index name to lowercase and numeric only */
if ((rev != NULL) && (strlen(rev) > 0)) {
/* read an older revision */
}
}
else {
- /* read the current revision? */
+ /* read the current revision */
msgnum = locate_message_by_uid(pagename);
}
*/
void display_wiki_page(void)
{
- const StrBuf *roomname;
char pagename[128];
char rev[128];
int do_revert = 0;
output_headers(1, 1, 1, 0, 0, 0);
- roomname = sbstr("room");
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(roomname, pagename, rev, do_revert);
+ display_wiki_page_backend(pagename, rev, do_revert);
wDumpContent(1);
}
*/
void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
{
- const StrBuf *roomname;
char pagename[128];
StrBuf *Buf;
int row = 0;
- roomname = sbstr("room");
safestrncpy(pagename, bstr("page"), sizeof pagename);
str_wiki_index(pagename);
- if (StrLength(roomname) > 0) {
-
- /* If we're not in the correct room, try going there. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- gotoroom(roomname);
- }
-
- /* If we're still not in the correct room, it doesn't exist. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- wc_printf(_("There is no room called '%s'."), ChrPtr(roomname));
- return;
- }
-
- }
-
serv_printf("WIKI history|%s", pagename);
Buf = NewStrBuf();
StrBuf_ServGetln(Buf);
wc_printf("</td>");
if (row == 0) {
- wc_printf("<td><a href=\"wiki?page=%s\">%s</a></td>",
- bstr("page"),
- _("(show)")
- );
+ wc_printf("<td><a href=\"wiki?page=%s", bstr("page"));
+ wc_printf("?go="); urlescputs(ChrPtr(WC->CurRoom.name));
+ wc_printf("\">%s</a></td>", _("(show)"));
wc_printf("<td>(%s)</td>", _("Current version"));
}
*/
void tmplput_display_wiki_pagelist(StrBuf *Target, WCTemplputParams *TP)
{
- const StrBuf *roomname;
StrBuf *Buf;
int row = 0;
- roomname = sbstr("room");
- if (StrLength(roomname) > 0) {
- /* If we're not in the correct room, try going there. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- gotoroom(roomname);
- }
-
- /* If we're still not in the correct room, it doesn't exist. */
- if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) {
- wc_printf(_("There is no room called '%s'."), ChrPtr(roomname));
- return;
- }
- }
-
if (!IsEmptyStr(bstr("query"))) {
serv_printf("MSGS SEARCH|%s||4", bstr("query")); /* search-reduced list */
}
{
char pagename[5];
safestrncpy(pagename, "home", sizeof pagename);
- display_wiki_page_backend(WC->CurRoom.name, pagename, "", 0);
+ display_wiki_page_backend(pagename, "", 0);
wDumpContent(1);
return 0;
}