Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Apr 2012 09:45:28 +0000 (11:45 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Apr 2012 09:45:28 +0000 (11:45 +0200)
citadel/control.c
citadel/modules/wiki/serv_wiki.c
citadel/room_ops.c
citadel/user_ops.c
webcit/messages.c
webcit/msg_renderers.c
webcit/static/t/view_message/wikiedit.html
webcit/webcit.h
webcit/wiki.c

index 1e469b489ef84178f4466574a9ad5d2b780e1d11..b81526cf1dc855078349afb8ed70a4803bb0388d 100644 (file)
@@ -693,8 +693,9 @@ void cmd_conf(char *argbuf)
                }
                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))
index 680f63733aed4c47088b8da5b60c075a87f8b1fb..07e5eed41e231aca188764b375681559b62d8692 100644 (file)
@@ -1,21 +1,15 @@
 /*
  * 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"
@@ -431,7 +425,7 @@ void wiki_rev_callback(char *name, char *filename, char *partnum, char *disp,
 
        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");
@@ -566,6 +560,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
        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);
index c915517390cdf465736de669369eefbe96839e92..c9e651b155ab9d2f8a81a9f49caba3e07cdef84a 100644 (file)
@@ -1608,7 +1608,9 @@ void cmd_setr(char *args)
                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);
 }
@@ -1853,7 +1855,9 @@ void cmd_kill(char *argbuf)
 
                /* 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 {
@@ -2071,7 +2075,7 @@ void cmd_cre8(char *args)
        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]" : ""),
index 37cbfcd6464d2c61253f9107865661a94f30021f..7bc53ce36f6488016388c92b3ca68bb5c5dae0a0 100644 (file)
@@ -1587,7 +1587,8 @@ int CtdlInvtKick(char *iuser, int op) {
                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);
@@ -1966,7 +1967,9 @@ void cmd_asup(char *cmdbuf)
        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");
        }
 
index 0c4786c87c8760850e2c86f96616d04baabcad07..f990c8700b09d1e358e502181194cccc5ec5c045 100644 (file)
@@ -5,17 +5,11 @@
  *
  * 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"
@@ -1017,7 +1011,7 @@ void post_message(void)
                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;
@@ -1072,14 +1066,15 @@ void post_message(void)
                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);
@@ -1091,11 +1086,12 @@ void post_message(void)
                             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)){
@@ -1579,14 +1575,15 @@ void display_enter(void)
                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) + 
@@ -1594,7 +1591,7 @@ void display_enter(void)
                                        StrLength(display_name) +
                                        StrLength(Cc) +
                                        StrLength(Bcc) + 
-                                       StrLength(Wikipage));
+                                       strlen(wikipage));
 
                StrBufPrintf(CmdBuf, 
                             CMD,
@@ -1603,9 +1600,11 @@ void display_enter(void)
                             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);
 
index c00817739d823cdfe80f65b266271fc0dc596db1..d2de1f4bdf89313408ce64e2eff38ed9169b9876 100644 (file)
@@ -938,7 +938,10 @@ void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP)
         * 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);
index ac3f3102ef988b688c9573c0d97cf0a3b2819457..a44881877b6270d0fb3373c5bcb8f982fd2aa8d8 100644 (file)
@@ -1,2 +1,4 @@
 <?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)>
index 3d5b861164fe1a36ec0d8b46bf5048f2c36e1fc2..fd64a229cdffe670b6318e28d9ec22b0c8697184 100644 (file)
@@ -756,6 +756,8 @@ void end_tab(int tabnum, int num_tabs);
 
 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 */
index 4f14137904ca34dd02172e3bf58535876b946c5e..c72dbf656a726508f00c3f87d0b3893b1d33933e 100644 (file)
@@ -5,17 +5,11 @@
  *
  * 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"
@@ -49,31 +43,14 @@ void str_wiki_index(char *s)
  * "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;
        }
 
@@ -81,7 +58,7 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev
                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 */
@@ -92,7 +69,7 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev
                }
        }
        else {
-               /* read the current revision? */
+               /* read the current revision */
                msgnum = locate_message_by_uid(pagename);
        }
 
@@ -121,17 +98,16 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev
  */
 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);
 }
 
@@ -141,30 +117,13 @@ void display_wiki_page(void)
  */
 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);
@@ -204,10 +163,9 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
                        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"));
                        }
 
@@ -266,24 +224,9 @@ void display_wiki_history(void)
  */
 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 */
        }
@@ -336,7 +279,7 @@ int wiki_Cleanup(void **ViewSpecific)
 {
        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;
 }