Fossil SCM
After deleting a newly proposed ticket or wiki page via moderation, redirect to the list of pending moderation requests. Changes to permit easier debugging of the moderation subsystem. Fix some TH1 script errors that could occur when attempting to view non-existent tickets.
Commit
636c3346d0de6f1f521727b21c6c65eedc60daea
Parent
12b463ca05d5495…
6 files changed
+2
-2
+24
-4
+1
-1
+29
-3
+30
-15
+30
-8
+2
-2
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -288,12 +288,12 @@ | ||
| 288 | 288 | if( pManifest ){ |
| 289 | 289 | blob_compress(&content, &content); |
| 290 | 290 | addCompress = 1; |
| 291 | 291 | } |
| 292 | 292 | needModerator = |
| 293 | - (zTkt!=0 && g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1) || | |
| 294 | - (zPage!=0 && g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1); | |
| 293 | + (zTkt!=0 && ticket_need_moderation(0)) || | |
| 294 | + (zPage!=0 && wiki_need_moderation(0)); | |
| 295 | 295 | rid = content_put_ex(&content, 0, 0, 0, needModerator); |
| 296 | 296 | zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 297 | 297 | blob_zero(&manifest); |
| 298 | 298 | for(i=n=0; zName[i]; i++){ |
| 299 | 299 | if( zName[i]=='/' || zName[i]=='\\' ) n = i; |
| 300 | 300 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -288,12 +288,12 @@ | |
| 288 | if( pManifest ){ |
| 289 | blob_compress(&content, &content); |
| 290 | addCompress = 1; |
| 291 | } |
| 292 | needModerator = |
| 293 | (zTkt!=0 && g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1) || |
| 294 | (zPage!=0 && g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1); |
| 295 | rid = content_put_ex(&content, 0, 0, 0, needModerator); |
| 296 | zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 297 | blob_zero(&manifest); |
| 298 | for(i=n=0; zName[i]; i++){ |
| 299 | if( zName[i]=='/' || zName[i]=='\\' ) n = i; |
| 300 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -288,12 +288,12 @@ | |
| 288 | if( pManifest ){ |
| 289 | blob_compress(&content, &content); |
| 290 | addCompress = 1; |
| 291 | } |
| 292 | needModerator = |
| 293 | (zTkt!=0 && ticket_need_moderation(0)) || |
| 294 | (zPage!=0 && wiki_need_moderation(0)); |
| 295 | rid = content_put_ex(&content, 0, 0, 0, needModerator); |
| 296 | zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 297 | blob_zero(&manifest); |
| 298 | for(i=n=0; zName[i]; i++){ |
| 299 | if( zName[i]=='/' || zName[i]=='\\' ) n = i; |
| 300 |
+24
-4
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -764,12 +764,22 @@ | ||
| 764 | 764 | return; |
| 765 | 765 | } |
| 766 | 766 | if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){ |
| 767 | 767 | if( strcmp(zModAction,"delete")==0 ){ |
| 768 | 768 | moderation_disapprove(rid); |
| 769 | - cgi_redirectf("%R/wiki?name=%T", pWiki->zWikiTitle); | |
| 770 | - /*NOTREACHED*/ | |
| 769 | + /* | |
| 770 | + ** Next, check if the wiki page still exists; if not, we cannot | |
| 771 | + ** redirect to it. | |
| 772 | + */ | |
| 773 | + if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)" | |
| 774 | + " WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){ | |
| 775 | + cgi_redirectf("%R/wiki?name=%T", pWiki->zWikiTitle); | |
| 776 | + /*NOTREACHED*/ | |
| 777 | + }else{ | |
| 778 | + cgi_redirectf("%R/modreq"); | |
| 779 | + /*NOTREACHED*/ | |
| 780 | + } | |
| 771 | 781 | } |
| 772 | 782 | if( strcmp(zModAction,"approve")==0 ){ |
| 773 | 783 | moderation_approve(rid); |
| 774 | 784 | } |
| 775 | 785 | } |
| @@ -1889,12 +1899,22 @@ | ||
| 1889 | 1899 | zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); |
| 1890 | 1900 | memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1); |
| 1891 | 1901 | if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){ |
| 1892 | 1902 | if( strcmp(zModAction,"delete")==0 ){ |
| 1893 | 1903 | moderation_disapprove(rid); |
| 1894 | - cgi_redirectf("%R/tktview/%s", zTktName); | |
| 1895 | - /*NOTREACHED*/ | |
| 1904 | + /* | |
| 1905 | + ** Next, check if the ticket still exists; if not, we cannot | |
| 1906 | + ** redirect to it. | |
| 1907 | + */ | |
| 1908 | + if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", | |
| 1909 | + zTktName) ){ | |
| 1910 | + cgi_redirectf("%R/tktview/%s", zTktName); | |
| 1911 | + /*NOTREACHED*/ | |
| 1912 | + }else{ | |
| 1913 | + cgi_redirectf("%R/modreq"); | |
| 1914 | + /*NOTREACHED*/ | |
| 1915 | + } | |
| 1896 | 1916 | } |
| 1897 | 1917 | if( strcmp(zModAction,"approve")==0 ){ |
| 1898 | 1918 | moderation_approve(rid); |
| 1899 | 1919 | } |
| 1900 | 1920 | } |
| 1901 | 1921 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -764,12 +764,22 @@ | |
| 764 | return; |
| 765 | } |
| 766 | if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){ |
| 767 | if( strcmp(zModAction,"delete")==0 ){ |
| 768 | moderation_disapprove(rid); |
| 769 | cgi_redirectf("%R/wiki?name=%T", pWiki->zWikiTitle); |
| 770 | /*NOTREACHED*/ |
| 771 | } |
| 772 | if( strcmp(zModAction,"approve")==0 ){ |
| 773 | moderation_approve(rid); |
| 774 | } |
| 775 | } |
| @@ -1889,12 +1899,22 @@ | |
| 1889 | zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); |
| 1890 | memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1); |
| 1891 | if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){ |
| 1892 | if( strcmp(zModAction,"delete")==0 ){ |
| 1893 | moderation_disapprove(rid); |
| 1894 | cgi_redirectf("%R/tktview/%s", zTktName); |
| 1895 | /*NOTREACHED*/ |
| 1896 | } |
| 1897 | if( strcmp(zModAction,"approve")==0 ){ |
| 1898 | moderation_approve(rid); |
| 1899 | } |
| 1900 | } |
| 1901 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -764,12 +764,22 @@ | |
| 764 | return; |
| 765 | } |
| 766 | if( g.perm.ModWiki && (zModAction = P("modaction"))!=0 ){ |
| 767 | if( strcmp(zModAction,"delete")==0 ){ |
| 768 | moderation_disapprove(rid); |
| 769 | /* |
| 770 | ** Next, check if the wiki page still exists; if not, we cannot |
| 771 | ** redirect to it. |
| 772 | */ |
| 773 | if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)" |
| 774 | " WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){ |
| 775 | cgi_redirectf("%R/wiki?name=%T", pWiki->zWikiTitle); |
| 776 | /*NOTREACHED*/ |
| 777 | }else{ |
| 778 | cgi_redirectf("%R/modreq"); |
| 779 | /*NOTREACHED*/ |
| 780 | } |
| 781 | } |
| 782 | if( strcmp(zModAction,"approve")==0 ){ |
| 783 | moderation_approve(rid); |
| 784 | } |
| 785 | } |
| @@ -1889,12 +1899,22 @@ | |
| 1899 | zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); |
| 1900 | memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1); |
| 1901 | if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){ |
| 1902 | if( strcmp(zModAction,"delete")==0 ){ |
| 1903 | moderation_disapprove(rid); |
| 1904 | /* |
| 1905 | ** Next, check if the ticket still exists; if not, we cannot |
| 1906 | ** redirect to it. |
| 1907 | */ |
| 1908 | if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", |
| 1909 | zTktName) ){ |
| 1910 | cgi_redirectf("%R/tktview/%s", zTktName); |
| 1911 | /*NOTREACHED*/ |
| 1912 | }else{ |
| 1913 | cgi_redirectf("%R/modreq"); |
| 1914 | /*NOTREACHED*/ |
| 1915 | } |
| 1916 | } |
| 1917 | if( strcmp(zModAction,"approve")==0 ){ |
| 1918 | moderation_approve(rid); |
| 1919 | } |
| 1920 | } |
| 1921 |
+1
-1
| --- src/json_wiki.c | ||
| +++ src/json_wiki.c | ||
| @@ -375,11 +375,11 @@ | ||
| 375 | 375 | blob_append(&content, cson_string_cstr(jstr),contentLen); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | zMimeType = json_find_option_cstr("mimetype","mimetype","M"); |
| 379 | 379 | |
| 380 | - wiki_cmd_commit(zPageName, 0==rid, &content, zMimeType); | |
| 380 | + wiki_cmd_commit(zPageName, 0==rid, &content, zMimeType, 0); | |
| 381 | 381 | blob_reset(&content); |
| 382 | 382 | /* |
| 383 | 383 | Our return value here has a race condition: if this operation |
| 384 | 384 | is called concurrently for the same wiki page via two requests, |
| 385 | 385 | payV could reflect the results of the other save operation. |
| 386 | 386 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -375,11 +375,11 @@ | |
| 375 | blob_append(&content, cson_string_cstr(jstr),contentLen); |
| 376 | } |
| 377 | |
| 378 | zMimeType = json_find_option_cstr("mimetype","mimetype","M"); |
| 379 | |
| 380 | wiki_cmd_commit(zPageName, 0==rid, &content, zMimeType); |
| 381 | blob_reset(&content); |
| 382 | /* |
| 383 | Our return value here has a race condition: if this operation |
| 384 | is called concurrently for the same wiki page via two requests, |
| 385 | payV could reflect the results of the other save operation. |
| 386 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -375,11 +375,11 @@ | |
| 375 | blob_append(&content, cson_string_cstr(jstr),contentLen); |
| 376 | } |
| 377 | |
| 378 | zMimeType = json_find_option_cstr("mimetype","mimetype","M"); |
| 379 | |
| 380 | wiki_cmd_commit(zPageName, 0==rid, &content, zMimeType, 0); |
| 381 | blob_reset(&content); |
| 382 | /* |
| 383 | Our return value here has a race condition: if this operation |
| 384 | is called concurrently for the same wiki page via two requests, |
| 385 | payV could reflect the results of the other save operation. |
| 386 |
+29
-3
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -273,10 +273,33 @@ | ||
| 273 | 273 | blob_reset(&sql2); |
| 274 | 274 | blob_reset(&sql3); |
| 275 | 275 | fossil_free(aUsed); |
| 276 | 276 | return tktid; |
| 277 | 277 | } |
| 278 | + | |
| 279 | +/* | |
| 280 | +** Returns non-zero if moderation is required for ticket changes and ticket | |
| 281 | +** attachments. | |
| 282 | +*/ | |
| 283 | +int ticket_need_moderation( | |
| 284 | + int localUser /* Are we being called for a local interactive user? */ | |
| 285 | +){ | |
| 286 | + /* | |
| 287 | + ** If the FOSSIL_FORCE_TICKET_MODERATION variable is set, *ALL* changes for | |
| 288 | + ** tickets will be required to go through moderation (even those performed | |
| 289 | + ** by the local interactive user via the command line). This can be useful | |
| 290 | + ** for local (or remote) testing of the moderation subsystem and its impact | |
| 291 | + ** on the contents and status of tickets. | |
| 292 | + */ | |
| 293 | + if( fossil_getenv("FOSSIL_FORCE_TICKET_MODERATION")!=0 ){ | |
| 294 | + return 1; | |
| 295 | + } | |
| 296 | + if( localUser ){ | |
| 297 | + return 0; | |
| 298 | + } | |
| 299 | + return g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1; | |
| 300 | +} | |
| 278 | 301 | |
| 279 | 302 | /* |
| 280 | 303 | ** Rebuild an entire entry in the TICKET table |
| 281 | 304 | */ |
| 282 | 305 | void ticket_rebuild_entry(const char *zTktUuid){ |
| @@ -567,10 +590,11 @@ | ||
| 567 | 590 | char *zDate; |
| 568 | 591 | const char *zUuid; |
| 569 | 592 | int i; |
| 570 | 593 | int nJ = 0; |
| 571 | 594 | Blob tktchng, cksum; |
| 595 | + int needMod; | |
| 572 | 596 | |
| 573 | 597 | login_verify_csrf_secret(); |
| 574 | 598 | if( !captcha_is_correct() ){ |
| 575 | 599 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 576 | 600 | return TH_OK; |
| @@ -622,25 +646,27 @@ | ||
| 622 | 646 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 623 | 647 | if( nJ==0 ){ |
| 624 | 648 | blob_reset(&tktchng); |
| 625 | 649 | return TH_OK; |
| 626 | 650 | } |
| 651 | + needMod = ticket_need_moderation(0); | |
| 627 | 652 | if( g.zPath[0]=='d' ){ |
| 653 | + const char *zNeedMod = needMod ? "required" : "skipped"; | |
| 628 | 654 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 629 | 655 | @ <font color="blue"> |
| 630 | 656 | @ <p>Ticket artifact that would have been submitted:</p> |
| 631 | 657 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 658 | + @ <blockquote><pre>Moderation would be %h(zNeedMod).</pre></blockquote> | |
| 632 | 659 | @ <hr /></font> |
| 633 | 660 | return TH_OK; |
| 634 | 661 | }else{ |
| 635 | 662 | if( g.thTrace ){ |
| 636 | 663 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 637 | 664 | "}<br />\n", |
| 638 | 665 | blob_str(&tktchng)); |
| 639 | 666 | } |
| 640 | - ticket_put(&tktchng, zUuid, | |
| 641 | - (g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1)); | |
| 667 | + ticket_put(&tktchng, zUuid, needMod); | |
| 642 | 668 | } |
| 643 | 669 | return ticket_change(zUuid); |
| 644 | 670 | } |
| 645 | 671 | |
| 646 | 672 | |
| @@ -1347,14 +1373,14 @@ | ||
| 1347 | 1373 | } |
| 1348 | 1374 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1349 | 1375 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1350 | 1376 | md5sum_blob(&tktchng, &cksum); |
| 1351 | 1377 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1352 | - if( ticket_put(&tktchng, zTktUuid, 0) ){ | |
| 1378 | + if( ticket_put(&tktchng, zTktUuid, ticket_need_moderation(1)) ){ | |
| 1353 | 1379 | fossil_fatal("%s\n", g.zErrMsg); |
| 1354 | 1380 | }else{ |
| 1355 | 1381 | fossil_print("ticket %s succeeded for %s\n", |
| 1356 | 1382 | (eCmd==set?"set":"add"),zTktUuid); |
| 1357 | 1383 | } |
| 1358 | 1384 | } |
| 1359 | 1385 | } |
| 1360 | 1386 | } |
| 1361 | 1387 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -273,10 +273,33 @@ | |
| 273 | blob_reset(&sql2); |
| 274 | blob_reset(&sql3); |
| 275 | fossil_free(aUsed); |
| 276 | return tktid; |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | ** Rebuild an entire entry in the TICKET table |
| 281 | */ |
| 282 | void ticket_rebuild_entry(const char *zTktUuid){ |
| @@ -567,10 +590,11 @@ | |
| 567 | char *zDate; |
| 568 | const char *zUuid; |
| 569 | int i; |
| 570 | int nJ = 0; |
| 571 | Blob tktchng, cksum; |
| 572 | |
| 573 | login_verify_csrf_secret(); |
| 574 | if( !captcha_is_correct() ){ |
| 575 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 576 | return TH_OK; |
| @@ -622,25 +646,27 @@ | |
| 622 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 623 | if( nJ==0 ){ |
| 624 | blob_reset(&tktchng); |
| 625 | return TH_OK; |
| 626 | } |
| 627 | if( g.zPath[0]=='d' ){ |
| 628 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 629 | @ <font color="blue"> |
| 630 | @ <p>Ticket artifact that would have been submitted:</p> |
| 631 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 632 | @ <hr /></font> |
| 633 | return TH_OK; |
| 634 | }else{ |
| 635 | if( g.thTrace ){ |
| 636 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 637 | "}<br />\n", |
| 638 | blob_str(&tktchng)); |
| 639 | } |
| 640 | ticket_put(&tktchng, zUuid, |
| 641 | (g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1)); |
| 642 | } |
| 643 | return ticket_change(zUuid); |
| 644 | } |
| 645 | |
| 646 | |
| @@ -1347,14 +1373,14 @@ | |
| 1347 | } |
| 1348 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1349 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1350 | md5sum_blob(&tktchng, &cksum); |
| 1351 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1352 | if( ticket_put(&tktchng, zTktUuid, 0) ){ |
| 1353 | fossil_fatal("%s\n", g.zErrMsg); |
| 1354 | }else{ |
| 1355 | fossil_print("ticket %s succeeded for %s\n", |
| 1356 | (eCmd==set?"set":"add"),zTktUuid); |
| 1357 | } |
| 1358 | } |
| 1359 | } |
| 1360 | } |
| 1361 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -273,10 +273,33 @@ | |
| 273 | blob_reset(&sql2); |
| 274 | blob_reset(&sql3); |
| 275 | fossil_free(aUsed); |
| 276 | return tktid; |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | ** Returns non-zero if moderation is required for ticket changes and ticket |
| 281 | ** attachments. |
| 282 | */ |
| 283 | int ticket_need_moderation( |
| 284 | int localUser /* Are we being called for a local interactive user? */ |
| 285 | ){ |
| 286 | /* |
| 287 | ** If the FOSSIL_FORCE_TICKET_MODERATION variable is set, *ALL* changes for |
| 288 | ** tickets will be required to go through moderation (even those performed |
| 289 | ** by the local interactive user via the command line). This can be useful |
| 290 | ** for local (or remote) testing of the moderation subsystem and its impact |
| 291 | ** on the contents and status of tickets. |
| 292 | */ |
| 293 | if( fossil_getenv("FOSSIL_FORCE_TICKET_MODERATION")!=0 ){ |
| 294 | return 1; |
| 295 | } |
| 296 | if( localUser ){ |
| 297 | return 0; |
| 298 | } |
| 299 | return g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1; |
| 300 | } |
| 301 | |
| 302 | /* |
| 303 | ** Rebuild an entire entry in the TICKET table |
| 304 | */ |
| 305 | void ticket_rebuild_entry(const char *zTktUuid){ |
| @@ -567,10 +590,11 @@ | |
| 590 | char *zDate; |
| 591 | const char *zUuid; |
| 592 | int i; |
| 593 | int nJ = 0; |
| 594 | Blob tktchng, cksum; |
| 595 | int needMod; |
| 596 | |
| 597 | login_verify_csrf_secret(); |
| 598 | if( !captcha_is_correct() ){ |
| 599 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 600 | return TH_OK; |
| @@ -622,25 +646,27 @@ | |
| 646 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 647 | if( nJ==0 ){ |
| 648 | blob_reset(&tktchng); |
| 649 | return TH_OK; |
| 650 | } |
| 651 | needMod = ticket_need_moderation(0); |
| 652 | if( g.zPath[0]=='d' ){ |
| 653 | const char *zNeedMod = needMod ? "required" : "skipped"; |
| 654 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 655 | @ <font color="blue"> |
| 656 | @ <p>Ticket artifact that would have been submitted:</p> |
| 657 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 658 | @ <blockquote><pre>Moderation would be %h(zNeedMod).</pre></blockquote> |
| 659 | @ <hr /></font> |
| 660 | return TH_OK; |
| 661 | }else{ |
| 662 | if( g.thTrace ){ |
| 663 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 664 | "}<br />\n", |
| 665 | blob_str(&tktchng)); |
| 666 | } |
| 667 | ticket_put(&tktchng, zUuid, needMod); |
| 668 | } |
| 669 | return ticket_change(zUuid); |
| 670 | } |
| 671 | |
| 672 | |
| @@ -1347,14 +1373,14 @@ | |
| 1373 | } |
| 1374 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1375 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1376 | md5sum_blob(&tktchng, &cksum); |
| 1377 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1378 | if( ticket_put(&tktchng, zTktUuid, ticket_need_moderation(1)) ){ |
| 1379 | fossil_fatal("%s\n", g.zErrMsg); |
| 1380 | }else{ |
| 1381 | fossil_print("ticket %s succeeded for %s\n", |
| 1382 | (eCmd==set?"set":"add"),zTktUuid); |
| 1383 | } |
| 1384 | } |
| 1385 | } |
| 1386 | } |
| 1387 |
+30
-15
| --- src/tktsetup.c | ||
| +++ src/tktsetup.c | ||
| @@ -435,15 +435,24 @@ | ||
| 435 | 435 | |
| 436 | 436 | static const char zDefaultView[] = |
| 437 | 437 | @ <table cellpadding="5"> |
| 438 | 438 | @ <tr><td class="tktDspLabel">Ticket UUID:</td> |
| 439 | 439 | @ <th1> |
| 440 | -@ if {[hascap s]} { | |
| 441 | -@ html "<td class='tktDspValue' colspan='3'>$tkt_uuid " | |
| 442 | -@ html "($tkt_id)</td></tr>\n" | |
| 440 | +@ if {[info exists tkt_uuid]} { | |
| 441 | +@ if {[hascap s]} { | |
| 442 | +@ html "<td class='tktDspValue' colspan='3'>$tkt_uuid " | |
| 443 | +@ html "($tkt_id)</td></tr>\n" | |
| 444 | +@ } else { | |
| 445 | +@ html "<td class='tktDspValue' colspan='3'>$tkt_uuid</td></tr>\n" | |
| 446 | +@ } | |
| 443 | 447 | @ } else { |
| 444 | -@ html "<td class='tktDspValue' colspan='3'>$tkt_uuid</td></tr>\n" | |
| 448 | +@ if {[hascap s]} { | |
| 449 | +@ html "<td class='tktDspValue' colspan='3'>Deleted " | |
| 450 | +@ html "(0)</td></tr>\n" | |
| 451 | +@ } else { | |
| 452 | +@ html "<td class='tktDspValue' colspan='3'>Deleted</td></tr>\n" | |
| 453 | +@ } | |
| 445 | 454 | @ } |
| 446 | 455 | @ </th1> |
| 447 | 456 | @ <tr><td class="tktDspLabel">Title:</td> |
| 448 | 457 | @ <td class="tktDspValue" colspan="3"> |
| 449 | 458 | @ $<title> |
| @@ -465,11 +474,15 @@ | ||
| 465 | 474 | @ </td> |
| 466 | 475 | @ <td class="tktDspLabel">Resolution:</td><td class="tktDspValue"> |
| 467 | 476 | @ $<resolution> |
| 468 | 477 | @ </td></tr> |
| 469 | 478 | @ <tr><td class="tktDspLabel">Last Modified:</td><td class="tktDspValue"> |
| 470 | -@ $<tkt_datetime> | |
| 479 | +@ <th1> | |
| 480 | +@ if {[info exists tkt_datetime]} { | |
| 481 | +@ html $tkt_datetime | |
| 482 | +@ } | |
| 483 | +@ </th1> | |
| 471 | 484 | @ </td> |
| 472 | 485 | @ <th1>enable_output [hascap e]</th1> |
| 473 | 486 | @ <td class="tktDspLabel">Contact:</td><td class="tktDspValue"> |
| 474 | 487 | @ $<private_contact> |
| 475 | 488 | @ </td> |
| @@ -479,20 +492,22 @@ | ||
| 479 | 492 | @ <td colspan="3" valign="top" class="tktDspValue"> |
| 480 | 493 | @ $<foundin> |
| 481 | 494 | @ </td></tr> |
| 482 | 495 | @ |
| 483 | 496 | @ <th1> |
| 484 | -@ if {[info exists comment] && [string length $comment]>10} { | |
| 485 | -@ html { | |
| 486 | -@ <tr><td class="tktDspLabel">Description:</td></tr> | |
| 487 | -@ <tr><td colspan="5" class="tktDspValue"> | |
| 488 | -@ } | |
| 489 | -@ if {[info exists plaintext]} { | |
| 490 | -@ set r [randhex] | |
| 491 | -@ wiki "<verbatim-$r links>\n$comment\n</verbatim-$r>" | |
| 492 | -@ } else { | |
| 493 | -@ wiki $comment | |
| 497 | +@ if {[info exists comment]} { | |
| 498 | +@ if {[string length $comment]>10} { | |
| 499 | +@ html { | |
| 500 | +@ <tr><td class="tktDspLabel">Description:</td></tr> | |
| 501 | +@ <tr><td colspan="5" class="tktDspValue"> | |
| 502 | +@ } | |
| 503 | +@ if {[info exists plaintext]} { | |
| 504 | +@ set r [randhex] | |
| 505 | +@ wiki "<verbatim-$r links>\n$comment\n</verbatim-$r>" | |
| 506 | +@ } else { | |
| 507 | +@ wiki $comment | |
| 508 | +@ } | |
| 494 | 509 | @ } |
| 495 | 510 | @ } |
| 496 | 511 | @ set seenRow 0 |
| 497 | 512 | @ set alwaysPlaintext [info exists plaintext] |
| 498 | 513 | @ query {SELECT datetime(tkt_mtime) AS xdate, login AS xlogin, |
| 499 | 514 |
| --- src/tktsetup.c | |
| +++ src/tktsetup.c | |
| @@ -435,15 +435,24 @@ | |
| 435 | |
| 436 | static const char zDefaultView[] = |
| 437 | @ <table cellpadding="5"> |
| 438 | @ <tr><td class="tktDspLabel">Ticket UUID:</td> |
| 439 | @ <th1> |
| 440 | @ if {[hascap s]} { |
| 441 | @ html "<td class='tktDspValue' colspan='3'>$tkt_uuid " |
| 442 | @ html "($tkt_id)</td></tr>\n" |
| 443 | @ } else { |
| 444 | @ html "<td class='tktDspValue' colspan='3'>$tkt_uuid</td></tr>\n" |
| 445 | @ } |
| 446 | @ </th1> |
| 447 | @ <tr><td class="tktDspLabel">Title:</td> |
| 448 | @ <td class="tktDspValue" colspan="3"> |
| 449 | @ $<title> |
| @@ -465,11 +474,15 @@ | |
| 465 | @ </td> |
| 466 | @ <td class="tktDspLabel">Resolution:</td><td class="tktDspValue"> |
| 467 | @ $<resolution> |
| 468 | @ </td></tr> |
| 469 | @ <tr><td class="tktDspLabel">Last Modified:</td><td class="tktDspValue"> |
| 470 | @ $<tkt_datetime> |
| 471 | @ </td> |
| 472 | @ <th1>enable_output [hascap e]</th1> |
| 473 | @ <td class="tktDspLabel">Contact:</td><td class="tktDspValue"> |
| 474 | @ $<private_contact> |
| 475 | @ </td> |
| @@ -479,20 +492,22 @@ | |
| 479 | @ <td colspan="3" valign="top" class="tktDspValue"> |
| 480 | @ $<foundin> |
| 481 | @ </td></tr> |
| 482 | @ |
| 483 | @ <th1> |
| 484 | @ if {[info exists comment] && [string length $comment]>10} { |
| 485 | @ html { |
| 486 | @ <tr><td class="tktDspLabel">Description:</td></tr> |
| 487 | @ <tr><td colspan="5" class="tktDspValue"> |
| 488 | @ } |
| 489 | @ if {[info exists plaintext]} { |
| 490 | @ set r [randhex] |
| 491 | @ wiki "<verbatim-$r links>\n$comment\n</verbatim-$r>" |
| 492 | @ } else { |
| 493 | @ wiki $comment |
| 494 | @ } |
| 495 | @ } |
| 496 | @ set seenRow 0 |
| 497 | @ set alwaysPlaintext [info exists plaintext] |
| 498 | @ query {SELECT datetime(tkt_mtime) AS xdate, login AS xlogin, |
| 499 |
| --- src/tktsetup.c | |
| +++ src/tktsetup.c | |
| @@ -435,15 +435,24 @@ | |
| 435 | |
| 436 | static const char zDefaultView[] = |
| 437 | @ <table cellpadding="5"> |
| 438 | @ <tr><td class="tktDspLabel">Ticket UUID:</td> |
| 439 | @ <th1> |
| 440 | @ if {[info exists tkt_uuid]} { |
| 441 | @ if {[hascap s]} { |
| 442 | @ html "<td class='tktDspValue' colspan='3'>$tkt_uuid " |
| 443 | @ html "($tkt_id)</td></tr>\n" |
| 444 | @ } else { |
| 445 | @ html "<td class='tktDspValue' colspan='3'>$tkt_uuid</td></tr>\n" |
| 446 | @ } |
| 447 | @ } else { |
| 448 | @ if {[hascap s]} { |
| 449 | @ html "<td class='tktDspValue' colspan='3'>Deleted " |
| 450 | @ html "(0)</td></tr>\n" |
| 451 | @ } else { |
| 452 | @ html "<td class='tktDspValue' colspan='3'>Deleted</td></tr>\n" |
| 453 | @ } |
| 454 | @ } |
| 455 | @ </th1> |
| 456 | @ <tr><td class="tktDspLabel">Title:</td> |
| 457 | @ <td class="tktDspValue" colspan="3"> |
| 458 | @ $<title> |
| @@ -465,11 +474,15 @@ | |
| 474 | @ </td> |
| 475 | @ <td class="tktDspLabel">Resolution:</td><td class="tktDspValue"> |
| 476 | @ $<resolution> |
| 477 | @ </td></tr> |
| 478 | @ <tr><td class="tktDspLabel">Last Modified:</td><td class="tktDspValue"> |
| 479 | @ <th1> |
| 480 | @ if {[info exists tkt_datetime]} { |
| 481 | @ html $tkt_datetime |
| 482 | @ } |
| 483 | @ </th1> |
| 484 | @ </td> |
| 485 | @ <th1>enable_output [hascap e]</th1> |
| 486 | @ <td class="tktDspLabel">Contact:</td><td class="tktDspValue"> |
| 487 | @ $<private_contact> |
| 488 | @ </td> |
| @@ -479,20 +492,22 @@ | |
| 492 | @ <td colspan="3" valign="top" class="tktDspValue"> |
| 493 | @ $<foundin> |
| 494 | @ </td></tr> |
| 495 | @ |
| 496 | @ <th1> |
| 497 | @ if {[info exists comment]} { |
| 498 | @ if {[string length $comment]>10} { |
| 499 | @ html { |
| 500 | @ <tr><td class="tktDspLabel">Description:</td></tr> |
| 501 | @ <tr><td colspan="5" class="tktDspValue"> |
| 502 | @ } |
| 503 | @ if {[info exists plaintext]} { |
| 504 | @ set r [randhex] |
| 505 | @ wiki "<verbatim-$r links>\n$comment\n</verbatim-$r>" |
| 506 | @ } else { |
| 507 | @ wiki $comment |
| 508 | @ } |
| 509 | @ } |
| 510 | @ } |
| 511 | @ set seenRow 0 |
| 512 | @ set alwaysPlaintext [info exists plaintext] |
| 513 | @ query {SELECT datetime(tkt_mtime) AS xdate, login AS xlogin, |
| 514 |
+30
-8
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -156,10 +156,32 @@ | ||
| 156 | 156 | @ %h(blob_str(pWiki)) |
| 157 | 157 | @ </pre> |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | +/* | |
| 162 | +** Returns non-zero if moderation is required for wiki changes and wiki | |
| 163 | +** attachments. | |
| 164 | +*/ | |
| 165 | +int wiki_need_moderation( | |
| 166 | + int localUser /* Are we being called for a local interactive user? */ | |
| 167 | +){ | |
| 168 | + /* | |
| 169 | + ** If the FOSSIL_FORCE_WIKI_MODERATION variable is set, *ALL* changes for | |
| 170 | + ** wiki pages will be required to go through moderation (even those performed | |
| 171 | + ** by the local interactive user via the command line). This can be useful | |
| 172 | + ** for local (or remote) testing of the moderation subsystem and its impact | |
| 173 | + ** on the contents and status of wiki pages. | |
| 174 | + */ | |
| 175 | + if( fossil_getenv("FOSSIL_FORCE_WIKI_MODERATION")!=0 ){ | |
| 176 | + return 1; | |
| 177 | + } | |
| 178 | + if( localUser ){ | |
| 179 | + return 0; | |
| 180 | + } | |
| 181 | + return g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1; | |
| 182 | +} | |
| 161 | 183 | |
| 162 | 184 | /* |
| 163 | 185 | ** WEBPAGE: wiki |
| 164 | 186 | ** URL: /wiki?name=PAGENAME |
| 165 | 187 | */ |
| @@ -282,13 +304,13 @@ | ||
| 282 | 304 | } |
| 283 | 305 | |
| 284 | 306 | /* |
| 285 | 307 | ** Write a wiki artifact into the repository |
| 286 | 308 | */ |
| 287 | -static void wiki_put(Blob *pWiki, int parent){ | |
| 309 | +static void wiki_put(Blob *pWiki, int parent, int needMod){ | |
| 288 | 310 | int nrid; |
| 289 | - if( g.perm.ModWiki || db_get_boolean("modreq-wiki",0)==0 ){ | |
| 311 | + if( !needMod ){ | |
| 290 | 312 | nrid = content_put_ex(pWiki, 0, 0, 0, 0); |
| 291 | 313 | if( parent) content_deltify(parent, nrid, 0); |
| 292 | 314 | }else{ |
| 293 | 315 | nrid = content_put_ex(pWiki, 0, 0, 0, 1); |
| 294 | 316 | moderation_table_create(); |
| @@ -427,11 +449,11 @@ | ||
| 427 | 449 | } |
| 428 | 450 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 429 | 451 | md5sum_blob(&wiki, &cksum); |
| 430 | 452 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 431 | 453 | blob_reset(&cksum); |
| 432 | - wiki_put(&wiki, 0); | |
| 454 | + wiki_put(&wiki, 0, wiki_need_moderation(0)); | |
| 433 | 455 | } |
| 434 | 456 | db_end_transaction(0); |
| 435 | 457 | cgi_redirectf("wiki?name=%T", zPageName); |
| 436 | 458 | } |
| 437 | 459 | if( P("cancel")!=0 ){ |
| @@ -658,11 +680,11 @@ | ||
| 658 | 680 | appendRemark(&body, zMimetype); |
| 659 | 681 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 660 | 682 | md5sum_blob(&wiki, &cksum); |
| 661 | 683 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 662 | 684 | blob_reset(&cksum); |
| 663 | - wiki_put(&wiki, rid); | |
| 685 | + wiki_put(&wiki, rid, wiki_need_moderation(0)); | |
| 664 | 686 | db_end_transaction(0); |
| 665 | 687 | } |
| 666 | 688 | cgi_redirectf("wiki?name=%T", zPageName); |
| 667 | 689 | } |
| 668 | 690 | if( P("cancel")!=0 ){ |
| @@ -961,11 +983,11 @@ | ||
| 961 | 983 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 962 | 984 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 963 | 985 | ** ignored. |
| 964 | 986 | */ |
| 965 | 987 | int wiki_cmd_commit(const char *zPageName, int isNew, Blob *pContent, |
| 966 | - const char *zMimeType){ | |
| 988 | + const char *zMimeType, int localUser){ | |
| 967 | 989 | Blob wiki; /* Wiki page content */ |
| 968 | 990 | Blob cksum; /* wiki checksum */ |
| 969 | 991 | int rid; /* artifact ID of parent page */ |
| 970 | 992 | char *zDate; /* timestamp */ |
| 971 | 993 | char *zUuid; /* uuid for rid */ |
| @@ -1011,11 +1033,11 @@ | ||
| 1011 | 1033 | blob_str(pContent) ); |
| 1012 | 1034 | md5sum_blob(&wiki, &cksum); |
| 1013 | 1035 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1014 | 1036 | blob_reset(&cksum); |
| 1015 | 1037 | db_begin_transaction(); |
| 1016 | - wiki_put(&wiki, 0); | |
| 1038 | + wiki_put(&wiki, 0, wiki_need_moderation(localUser)); | |
| 1017 | 1039 | db_end_transaction(0); |
| 1018 | 1040 | return 1; |
| 1019 | 1041 | } |
| 1020 | 1042 | |
| 1021 | 1043 | /* |
| @@ -1119,14 +1141,14 @@ | ||
| 1119 | 1141 | && (pWiki->zMimetype && *pWiki->zMimetype)){ |
| 1120 | 1142 | zMimeType = pWiki->zMimetype; |
| 1121 | 1143 | } |
| 1122 | 1144 | } |
| 1123 | 1145 | if( g.argv[2][1]=='r' ){ |
| 1124 | - wiki_cmd_commit(zPageName, 1, &content, zMimeType); | |
| 1146 | + wiki_cmd_commit(zPageName, 1, &content, zMimeType, 1); | |
| 1125 | 1147 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 1126 | 1148 | }else{ |
| 1127 | - wiki_cmd_commit(zPageName, 0, &content, zMimeType); | |
| 1149 | + wiki_cmd_commit(zPageName, 0, &content, zMimeType, 1); | |
| 1128 | 1150 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 1129 | 1151 | } |
| 1130 | 1152 | manifest_destroy(pWiki); |
| 1131 | 1153 | blob_reset(&content); |
| 1132 | 1154 | }else if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1133 | 1155 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -156,10 +156,32 @@ | |
| 156 | @ %h(blob_str(pWiki)) |
| 157 | @ </pre> |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | |
| 162 | /* |
| 163 | ** WEBPAGE: wiki |
| 164 | ** URL: /wiki?name=PAGENAME |
| 165 | */ |
| @@ -282,13 +304,13 @@ | |
| 282 | } |
| 283 | |
| 284 | /* |
| 285 | ** Write a wiki artifact into the repository |
| 286 | */ |
| 287 | static void wiki_put(Blob *pWiki, int parent){ |
| 288 | int nrid; |
| 289 | if( g.perm.ModWiki || db_get_boolean("modreq-wiki",0)==0 ){ |
| 290 | nrid = content_put_ex(pWiki, 0, 0, 0, 0); |
| 291 | if( parent) content_deltify(parent, nrid, 0); |
| 292 | }else{ |
| 293 | nrid = content_put_ex(pWiki, 0, 0, 0, 1); |
| 294 | moderation_table_create(); |
| @@ -427,11 +449,11 @@ | |
| 427 | } |
| 428 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 429 | md5sum_blob(&wiki, &cksum); |
| 430 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 431 | blob_reset(&cksum); |
| 432 | wiki_put(&wiki, 0); |
| 433 | } |
| 434 | db_end_transaction(0); |
| 435 | cgi_redirectf("wiki?name=%T", zPageName); |
| 436 | } |
| 437 | if( P("cancel")!=0 ){ |
| @@ -658,11 +680,11 @@ | |
| 658 | appendRemark(&body, zMimetype); |
| 659 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 660 | md5sum_blob(&wiki, &cksum); |
| 661 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 662 | blob_reset(&cksum); |
| 663 | wiki_put(&wiki, rid); |
| 664 | db_end_transaction(0); |
| 665 | } |
| 666 | cgi_redirectf("wiki?name=%T", zPageName); |
| 667 | } |
| 668 | if( P("cancel")!=0 ){ |
| @@ -961,11 +983,11 @@ | |
| 961 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 962 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 963 | ** ignored. |
| 964 | */ |
| 965 | int wiki_cmd_commit(const char *zPageName, int isNew, Blob *pContent, |
| 966 | const char *zMimeType){ |
| 967 | Blob wiki; /* Wiki page content */ |
| 968 | Blob cksum; /* wiki checksum */ |
| 969 | int rid; /* artifact ID of parent page */ |
| 970 | char *zDate; /* timestamp */ |
| 971 | char *zUuid; /* uuid for rid */ |
| @@ -1011,11 +1033,11 @@ | |
| 1011 | blob_str(pContent) ); |
| 1012 | md5sum_blob(&wiki, &cksum); |
| 1013 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1014 | blob_reset(&cksum); |
| 1015 | db_begin_transaction(); |
| 1016 | wiki_put(&wiki, 0); |
| 1017 | db_end_transaction(0); |
| 1018 | return 1; |
| 1019 | } |
| 1020 | |
| 1021 | /* |
| @@ -1119,14 +1141,14 @@ | |
| 1119 | && (pWiki->zMimetype && *pWiki->zMimetype)){ |
| 1120 | zMimeType = pWiki->zMimetype; |
| 1121 | } |
| 1122 | } |
| 1123 | if( g.argv[2][1]=='r' ){ |
| 1124 | wiki_cmd_commit(zPageName, 1, &content, zMimeType); |
| 1125 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 1126 | }else{ |
| 1127 | wiki_cmd_commit(zPageName, 0, &content, zMimeType); |
| 1128 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 1129 | } |
| 1130 | manifest_destroy(pWiki); |
| 1131 | blob_reset(&content); |
| 1132 | }else if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1133 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -156,10 +156,32 @@ | |
| 156 | @ %h(blob_str(pWiki)) |
| 157 | @ </pre> |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /* |
| 162 | ** Returns non-zero if moderation is required for wiki changes and wiki |
| 163 | ** attachments. |
| 164 | */ |
| 165 | int wiki_need_moderation( |
| 166 | int localUser /* Are we being called for a local interactive user? */ |
| 167 | ){ |
| 168 | /* |
| 169 | ** If the FOSSIL_FORCE_WIKI_MODERATION variable is set, *ALL* changes for |
| 170 | ** wiki pages will be required to go through moderation (even those performed |
| 171 | ** by the local interactive user via the command line). This can be useful |
| 172 | ** for local (or remote) testing of the moderation subsystem and its impact |
| 173 | ** on the contents and status of wiki pages. |
| 174 | */ |
| 175 | if( fossil_getenv("FOSSIL_FORCE_WIKI_MODERATION")!=0 ){ |
| 176 | return 1; |
| 177 | } |
| 178 | if( localUser ){ |
| 179 | return 0; |
| 180 | } |
| 181 | return g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1; |
| 182 | } |
| 183 | |
| 184 | /* |
| 185 | ** WEBPAGE: wiki |
| 186 | ** URL: /wiki?name=PAGENAME |
| 187 | */ |
| @@ -282,13 +304,13 @@ | |
| 304 | } |
| 305 | |
| 306 | /* |
| 307 | ** Write a wiki artifact into the repository |
| 308 | */ |
| 309 | static void wiki_put(Blob *pWiki, int parent, int needMod){ |
| 310 | int nrid; |
| 311 | if( !needMod ){ |
| 312 | nrid = content_put_ex(pWiki, 0, 0, 0, 0); |
| 313 | if( parent) content_deltify(parent, nrid, 0); |
| 314 | }else{ |
| 315 | nrid = content_put_ex(pWiki, 0, 0, 0, 1); |
| 316 | moderation_table_create(); |
| @@ -427,11 +449,11 @@ | |
| 449 | } |
| 450 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 451 | md5sum_blob(&wiki, &cksum); |
| 452 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 453 | blob_reset(&cksum); |
| 454 | wiki_put(&wiki, 0, wiki_need_moderation(0)); |
| 455 | } |
| 456 | db_end_transaction(0); |
| 457 | cgi_redirectf("wiki?name=%T", zPageName); |
| 458 | } |
| 459 | if( P("cancel")!=0 ){ |
| @@ -658,11 +680,11 @@ | |
| 680 | appendRemark(&body, zMimetype); |
| 681 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 682 | md5sum_blob(&wiki, &cksum); |
| 683 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 684 | blob_reset(&cksum); |
| 685 | wiki_put(&wiki, rid, wiki_need_moderation(0)); |
| 686 | db_end_transaction(0); |
| 687 | } |
| 688 | cgi_redirectf("wiki?name=%T", zPageName); |
| 689 | } |
| 690 | if( P("cancel")!=0 ){ |
| @@ -961,11 +983,11 @@ | |
| 983 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 984 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 985 | ** ignored. |
| 986 | */ |
| 987 | int wiki_cmd_commit(const char *zPageName, int isNew, Blob *pContent, |
| 988 | const char *zMimeType, int localUser){ |
| 989 | Blob wiki; /* Wiki page content */ |
| 990 | Blob cksum; /* wiki checksum */ |
| 991 | int rid; /* artifact ID of parent page */ |
| 992 | char *zDate; /* timestamp */ |
| 993 | char *zUuid; /* uuid for rid */ |
| @@ -1011,11 +1033,11 @@ | |
| 1033 | blob_str(pContent) ); |
| 1034 | md5sum_blob(&wiki, &cksum); |
| 1035 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1036 | blob_reset(&cksum); |
| 1037 | db_begin_transaction(); |
| 1038 | wiki_put(&wiki, 0, wiki_need_moderation(localUser)); |
| 1039 | db_end_transaction(0); |
| 1040 | return 1; |
| 1041 | } |
| 1042 | |
| 1043 | /* |
| @@ -1119,14 +1141,14 @@ | |
| 1141 | && (pWiki->zMimetype && *pWiki->zMimetype)){ |
| 1142 | zMimeType = pWiki->zMimetype; |
| 1143 | } |
| 1144 | } |
| 1145 | if( g.argv[2][1]=='r' ){ |
| 1146 | wiki_cmd_commit(zPageName, 1, &content, zMimeType, 1); |
| 1147 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 1148 | }else{ |
| 1149 | wiki_cmd_commit(zPageName, 0, &content, zMimeType, 1); |
| 1150 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 1151 | } |
| 1152 | manifest_destroy(pWiki); |
| 1153 | blob_reset(&content); |
| 1154 | }else if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1155 |