| | @@ -1985,10 +1985,11 @@ |
| 1985 | 1985 | void forumnew_page(void){ |
| 1986 | 1986 | const char *zTitle = PDT("title",""); |
| 1987 | 1987 | const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); |
| 1988 | 1988 | const char *zContent = PDT("content",""); |
| 1989 | 1989 | const int bLegacy = PB("legacy"); /* True for legacy HTML form */ |
| 1990 | + |
| 1990 | 1991 | login_check_credentials(); |
| 1991 | 1992 | if( !g.perm.WrForum ){ |
| 1992 | 1993 | login_needed(g.anon.WrForum); |
| 1993 | 1994 | return; |
| 1994 | 1995 | } |
| | @@ -2027,10 +2028,11 @@ |
| 2027 | 2028 | When it's enabled, the above won't do anything and |
| 2028 | 2029 | JS will render the editor form in the next element. */ |
| 2029 | 2030 | @ <div hidden id='forumnew-placeholder'> |
| 2030 | 2031 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2031 | 2032 | login_insert_csrf_secret(); |
| 2033 | + captcha_generate_for_js(0x02); |
| 2032 | 2034 | @ </div> |
| 2033 | 2035 | } |
| 2034 | 2036 | forum_emit_js(); |
| 2035 | 2037 | style_finish_page(); |
| 2036 | 2038 | } |
| | @@ -2051,17 +2053,23 @@ |
| 2051 | 2053 | const char *zMimetype = 0; |
| 2052 | 2054 | const char *zContent = 0; |
| 2053 | 2055 | const char *zTitle = 0; |
| 2054 | 2056 | char *zDate = 0; |
| 2055 | 2057 | const char *zFpid = PD("fpid",""); |
| 2058 | + const int bLegacy = PB("legacy"); /* True for legacy HTML form */ |
| 2056 | 2059 | int isCsrfSafe; |
| 2057 | 2060 | int isDelete = 0; |
| 2058 | 2061 | int iClosed = 0; |
| 2059 | 2062 | int bSameUser; /* True if author is also the reader */ |
| 2060 | 2063 | int bPreview; /* True in preview mode. */ |
| 2061 | 2064 | int bPrivate; /* True if post is private (not yet moderated) */ |
| 2062 | 2065 | int bReply; /* True if replying to a post */ |
| 2066 | + |
| 2067 | + if( !bLegacy ){ |
| 2068 | + forumedit_page_v2(); |
| 2069 | + return; |
| 2070 | + } |
| 2063 | 2071 | |
| 2064 | 2072 | login_check_credentials(); |
| 2065 | 2073 | if( !g.perm.WrForum ){ |
| 2066 | 2074 | login_needed(g.anon.WrForum); |
| 2067 | 2075 | return; |
| | @@ -2215,10 +2223,11 @@ |
| 2215 | 2223 | forum_post_widget(0, zMimetype, zContent); |
| 2216 | 2224 | } |
| 2217 | 2225 | if( !isDelete ){ |
| 2218 | 2226 | @ <input type="submit" name="preview" value="Preview"> |
| 2219 | 2227 | } |
| 2228 | + @ <input type="hidden" name="legacy" value="1"> |
| 2220 | 2229 | @ <input type="submit" name="cancel" value="Cancel"> |
| 2221 | 2230 | if( (bPreview && !whitespace_only(zContent)) || isDelete ){ |
| 2222 | 2231 | if( !iClosed || g.perm.Admin ) { |
| 2223 | 2232 | @ <input type="submit" name="submit" value="Submit"> |
| 2224 | 2233 | } |
| | @@ -2230,10 +2239,39 @@ |
| 2230 | 2239 | forum_render_attachment_list(rid_to_uuid(fpid)); |
| 2231 | 2240 | } |
| 2232 | 2241 | forum_render_attachment_notice(); |
| 2233 | 2242 | forum_emit_js(); |
| 2234 | 2243 | style_finish_page(); |
| 2244 | +} |
| 2245 | + |
| 2246 | +/* |
| 2247 | +** WEBPAGE: forume2_v2 hidden |
| 2248 | +** |
| 2249 | +** A work in progress. |
| 2250 | +*/ |
| 2251 | +void forumedit_page_v2(void){ |
| 2252 | + const char *zFpid = PD("fpid",""); |
| 2253 | + |
| 2254 | + login_check_credentials(); |
| 2255 | + if( !g.perm.WrForum ){ |
| 2256 | + login_needed(g.anon.WrForum); |
| 2257 | + return; |
| 2258 | + } |
| 2259 | + style_set_current_feature("forum"); |
| 2260 | + style_header("Edit Forum Post"); |
| 2261 | + (void)zFpid; |
| 2262 | + @ Much to do here. |
| 2263 | + @ <div hidden id='forumedit-placeholder'> |
| 2264 | +#if 0 |
| 2265 | + @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2266 | +#endif |
| 2267 | + login_insert_csrf_secret(); |
| 2268 | + captcha_generate_for_js(0); |
| 2269 | + @ </div> |
| 2270 | + forum_emit_js(); |
| 2271 | + style_finish_page(); |
| 2272 | + |
| 2235 | 2273 | } |
| 2236 | 2274 | |
| 2237 | 2275 | /* |
| 2238 | 2276 | ** SETTING: forum-close-policy boolean default=off |
| 2239 | 2277 | ** If true, forum moderators may close/re-open forum posts, and reply |
| 2240 | 2278 | |