Require logged-in in order to revert a wiki page
authorArt Cancro <ajc@citadel.org>
Tue, 11 Jan 2011 04:41:27 +0000 (23:41 -0500)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 11:19:13 +0000 (11:19 +0000)
citadel/modules/wiki/serv_wiki.c
webcit/wiki.c

index f3b6ce1027a24dff1a25ec8b184b3542f9936373..81825c689c0d84d0207163d88d9229f6b4e5a7b1 100644 (file)
@@ -484,6 +484,14 @@ void wiki_rev(char *pagename, char *rev, char *operation)
                return;
        }
 
+       if (!strcasecmp(operation, "revert")) {
+               r = CtdlDoIHavePermissionToPostInThisRoom(temp, sizeof temp, NULL, POST_LOGGED_IN, 0);
+               if (r != 0) {
+                       cprintf("%d %s\n", r, temp);
+                       return;
+               }
+       }
+
        /* Begin by fetching the current version of the page.  We're going to patch
         * backwards through the diffs until we get the one we want.
         */
index c5bb3086c7ba8c76db3e9c7fe9b086a63d262f26..152954e22cbbd00dc236536fce606eb9fe6857e9 100644 (file)
@@ -201,7 +201,7 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
                                        ChrPtr(rev_uuid),
                                        _("(show)")
                                );
-                               wc_printf("<td><a href=\"wiki?page=%s?rev=%s?revert=1\">%s</a></td>",
+                               wc_printf("<td><a href=\"javascript:GetLoggedInFirst(encodeURIComponent('wiki?page=%s?rev=%s?revert=1'))\">%s</a></td>",
                                        bstr("page"),
                                        ChrPtr(rev_uuid),
                                        _("(revert)")