Fossil SCM

Add 'th1-docs' setting to control whether or not TH1 scripts are allowed in embedded documentation files.

mistachkin 2014-09-08 18:13 UTC dynamicTh1Docs
Commit 4f0b0a6af275977612a6ab7a246d7f1d391cfbaa
--- src/configure.c
+++ src/configure.c
@@ -97,10 +97,11 @@
9797
{ "timeline-max-comment", CONFIGSET_SKIN },
9898
{ "timeline-plaintext", CONFIGSET_SKIN },
9999
{ "adunit", CONFIGSET_SKIN },
100100
{ "adunit-omit-if-admin", CONFIGSET_SKIN },
101101
{ "adunit-omit-if-user", CONFIGSET_SKIN },
102
+ { "th1-docs", CONFIGSET_TH1 },
102103
{ "th1-hooks", CONFIGSET_TH1 },
103104
{ "th1-setup", CONFIGSET_TH1 },
104105
{ "th1-uri-regexp", CONFIGSET_TH1 },
105106
106107
#ifdef FOSSIL_ENABLE_TCL
107108
--- src/configure.c
+++ src/configure.c
@@ -97,10 +97,11 @@
97 { "timeline-max-comment", CONFIGSET_SKIN },
98 { "timeline-plaintext", CONFIGSET_SKIN },
99 { "adunit", CONFIGSET_SKIN },
100 { "adunit-omit-if-admin", CONFIGSET_SKIN },
101 { "adunit-omit-if-user", CONFIGSET_SKIN },
 
102 { "th1-hooks", CONFIGSET_TH1 },
103 { "th1-setup", CONFIGSET_TH1 },
104 { "th1-uri-regexp", CONFIGSET_TH1 },
105
106 #ifdef FOSSIL_ENABLE_TCL
107
--- src/configure.c
+++ src/configure.c
@@ -97,10 +97,11 @@
97 { "timeline-max-comment", CONFIGSET_SKIN },
98 { "timeline-plaintext", CONFIGSET_SKIN },
99 { "adunit", CONFIGSET_SKIN },
100 { "adunit-omit-if-admin", CONFIGSET_SKIN },
101 { "adunit-omit-if-user", CONFIGSET_SKIN },
102 { "th1-docs", CONFIGSET_TH1 },
103 { "th1-hooks", CONFIGSET_TH1 },
104 { "th1-setup", CONFIGSET_TH1 },
105 { "th1-uri-regexp", CONFIGSET_TH1 },
106
107 #ifdef FOSSIL_ENABLE_TCL
108
+9
--- src/db.c
+++ src/db.c
@@ -2201,10 +2201,11 @@
22012201
{ "ssl-identity", 0, 40, 0, 0, "" },
22022202
#ifdef FOSSIL_ENABLE_TCL
22032203
{ "tcl", 0, 0, 0, 0, "off" },
22042204
{ "tcl-setup", 0, 40, 1, 1, "" },
22052205
#endif
2206
+ { "th1-docs", 0, 0, 0, 0, "off" },
22062207
{ "th1-hooks", 0, 0, 0, 0, "off" },
22072208
{ "th1-setup", 0, 40, 1, 1, "" },
22082209
{ "th1-uri-regexp", 0, 40, 1, 0, "" },
22092210
{ "web-browser", 0, 32, 0, 0, "" },
22102211
{ "white-foreground", 0, 0, 0, 0, "off" },
@@ -2408,10 +2409,18 @@
24082409
** expressions and scripts. Default: off.
24092410
**
24102411
** tcl-setup This is the setup script to be evaluated after creating
24112412
** (versionable) and initializing the Tcl interpreter. By default, this
24122413
** is empty and no extra setup is performed.
2414
+**
2415
+** th1-docs WARNING: If enabled, this allows embedded documentation
2416
+** files to contain TH1 scripts that are evaluated on the
2417
+** server. If native Tcl integration is also enabled, this
2418
+** setting has the potential to allow anybody with check-in
2419
+** privileges to do practically anything the associated
2420
+** operating system user account could do. Extreme caution
2421
+** should be used when enabling this setting.
24132422
**
24142423
** th1-hooks If enabled (and Fossil was compiled with support for TH1
24152424
** hooks), special TH1 commands will be called before and
24162425
** after any Fossil command or web page. Default: off.
24172426
**
24182427
--- src/db.c
+++ src/db.c
@@ -2201,10 +2201,11 @@
2201 { "ssl-identity", 0, 40, 0, 0, "" },
2202 #ifdef FOSSIL_ENABLE_TCL
2203 { "tcl", 0, 0, 0, 0, "off" },
2204 { "tcl-setup", 0, 40, 1, 1, "" },
2205 #endif
 
2206 { "th1-hooks", 0, 0, 0, 0, "off" },
2207 { "th1-setup", 0, 40, 1, 1, "" },
2208 { "th1-uri-regexp", 0, 40, 1, 0, "" },
2209 { "web-browser", 0, 32, 0, 0, "" },
2210 { "white-foreground", 0, 0, 0, 0, "off" },
@@ -2408,10 +2409,18 @@
2408 ** expressions and scripts. Default: off.
2409 **
2410 ** tcl-setup This is the setup script to be evaluated after creating
2411 ** (versionable) and initializing the Tcl interpreter. By default, this
2412 ** is empty and no extra setup is performed.
 
 
 
 
 
 
 
 
2413 **
2414 ** th1-hooks If enabled (and Fossil was compiled with support for TH1
2415 ** hooks), special TH1 commands will be called before and
2416 ** after any Fossil command or web page. Default: off.
2417 **
2418
--- src/db.c
+++ src/db.c
@@ -2201,10 +2201,11 @@
2201 { "ssl-identity", 0, 40, 0, 0, "" },
2202 #ifdef FOSSIL_ENABLE_TCL
2203 { "tcl", 0, 0, 0, 0, "off" },
2204 { "tcl-setup", 0, 40, 1, 1, "" },
2205 #endif
2206 { "th1-docs", 0, 0, 0, 0, "off" },
2207 { "th1-hooks", 0, 0, 0, 0, "off" },
2208 { "th1-setup", 0, 40, 1, 1, "" },
2209 { "th1-uri-regexp", 0, 40, 1, 0, "" },
2210 { "web-browser", 0, 32, 0, 0, "" },
2211 { "white-foreground", 0, 0, 0, 0, "off" },
@@ -2408,10 +2409,18 @@
2409 ** expressions and scripts. Default: off.
2410 **
2411 ** tcl-setup This is the setup script to be evaluated after creating
2412 ** (versionable) and initializing the Tcl interpreter. By default, this
2413 ** is empty and no extra setup is performed.
2414 **
2415 ** th1-docs WARNING: If enabled, this allows embedded documentation
2416 ** files to contain TH1 scripts that are evaluated on the
2417 ** server. If native Tcl integration is also enabled, this
2418 ** setting has the potential to allow anybody with check-in
2419 ** privileges to do practically anything the associated
2420 ** operating system user account could do. Extreme caution
2421 ** should be used when enabling this setting.
2422 **
2423 ** th1-hooks If enabled (and Fossil was compiled with support for TH1
2424 ** hooks), special TH1 commands will be called before and
2425 ** after any Fossil command or web page. Default: off.
2426 **
2427
+2 -1
--- src/doc.c
+++ src/doc.c
@@ -525,11 +525,12 @@
525525
style_header("Documentation");
526526
@ <blockquote><pre>
527527
@ %h(blob_str(&filebody))
528528
@ </pre></blockquote>
529529
style_footer();
530
- }else if( fossil_strcmp(zMime, "application/x-th1")==0 ){
530
+ }else if( db_get_boolean("th1-docs", 0) &&
531
+ fossil_strcmp(zMime, "application/x-th1")==0 ){
531532
style_header("Documentation");
532533
Th_Render(blob_str(&filebody));
533534
style_footer();
534535
}else{
535536
cgi_set_content_type(zMime);
536537
--- src/doc.c
+++ src/doc.c
@@ -525,11 +525,12 @@
525 style_header("Documentation");
526 @ <blockquote><pre>
527 @ %h(blob_str(&filebody))
528 @ </pre></blockquote>
529 style_footer();
530 }else if( fossil_strcmp(zMime, "application/x-th1")==0 ){
 
531 style_header("Documentation");
532 Th_Render(blob_str(&filebody));
533 style_footer();
534 }else{
535 cgi_set_content_type(zMime);
536
--- src/doc.c
+++ src/doc.c
@@ -525,11 +525,12 @@
525 style_header("Documentation");
526 @ <blockquote><pre>
527 @ %h(blob_str(&filebody))
528 @ </pre></blockquote>
529 style_footer();
530 }else if( db_get_boolean("th1-docs", 0) &&
531 fossil_strcmp(zMime, "application/x-th1")==0 ){
532 style_header("Documentation");
533 Th_Render(blob_str(&filebody));
534 style_footer();
535 }else{
536 cgi_set_content_type(zMime);
537

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button