Fossil SCM

Fix over-length code lines in the setup.c source file.

drh 2018-06-20 12:23 trunk
Commit 7001228a093ba66e3027d7c69bd160c576b46ec2c4f61593576f5abc06ccb6d1
1 file changed +66 -45
+66 -45
--- src/setup.c
+++ src/setup.c
@@ -74,11 +74,12 @@
7474
/* Make sure the header contains <base href="...">. Issue a warning
7575
** if it does not. */
7676
if( !cgi_header_contains("<base href=") ){
7777
@ <p class="generalError"><b>Configuration Error:</b> Please add
7878
@ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
79
- @ <tt>&lt;head&gt;</tt> in the <a href="setup_skinedit?w=2">HTML header</a>!</p>
79
+ @ <tt>&lt;head&gt;</tt> in the
80
+ @ <a href="setup_skinedit?w=2">HTML header</a>!</p>
8081
}
8182
8283
#if !defined(_WIN32)
8384
/* Check for /dev/null and /dev/urandom. We want both devices to be present,
8485
** but they are sometimes omitted (by mistake) from chroot jails. */
@@ -228,11 +229,12 @@
228229
@ data-column-types='ktxTTK' data-init-sort='2'>
229230
@ <thead><tr>
230231
@ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead>
231232
@ <tbody>
232233
db_multi_exec(
233
- "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;"
234
+ "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)"
235
+ "WITHOUT ROWID;"
234236
);
235237
if( db_table_exists("repository","accesslog") ){
236238
db_multi_exec(
237239
"INSERT INTO lastAccess(uname, atime)"
238240
" SELECT uname, max(mtime) FROM ("
@@ -247,11 +249,12 @@
247249
zWith = mprintf(" AND cap GLOB '*[%q]*'", zWith);
248250
}else{
249251
zWith = "";
250252
}
251253
db_prepare(&s,
252
- "SELECT uid, login, cap, info, date(mtime,'unixepoch'), lower(login) AS sortkey, "
254
+ "SELECT uid, login, cap, info, date(mtime,'unixepoch'),"
255
+ " lower(login) AS sortkey, "
253256
" CASE WHEN info LIKE '%%expires 20%%'"
254257
" THEN substr(info,instr(lower(info),'expires')+8,10)"
255258
" END AS exp,"
256259
"atime"
257260
" FROM user LEFT JOIN lastAccess ON login=uname"
@@ -271,11 +274,12 @@
271274
char *zAge = 0;
272275
if( rATime>0.0 ){
273276
zAge = human_readable_age(rNow - rATime);
274277
}
275278
@ <tr>
276
- @ <td data-sortkey='%h(zSortKey)'><a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
279
+ @ <td data-sortkey='%h(zSortKey)'>\
280
+ @ <a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
277281
@ <td>%h(zCap)
278282
@ <td>%h(zInfo)
279283
@ <td>%h(zDate?zDate:"")
280284
@ <td>%h(zExp?zExp:"")
281285
@ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
@@ -352,13 +356,13 @@
352356
}
353357
354358
/*
355359
** WEBPAGE: setup_ulist_notes
356360
**
357
-** A documentation page showing notes about user configuration. This information
358
-** used to be a side-bar on the user list page, but has been factored out for
359
-** improved presentation.
361
+** A documentation page showing notes about user configuration. This
362
+** information used to be a side-bar on the user list page, but has been
363
+** factored out for improved presentation.
360364
*/
361365
void setup_ulist_notes(void){
362366
style_header("User Configuration Notes");
363367
@ <h1>User Configuration Notes:</h1>
364368
@ <ol>
@@ -481,14 +485,15 @@
481485
482486
zCap[i] = 0;
483487
zPw = P("pw");
484488
zLogin = P("login");
485489
if( strlen(zLogin)==0 ){
490
+ char *zRef = cgi_referer("setup_ulist");
486491
style_header("User Creation Error");
487492
@ <span class="loginError">Empty login not allowed.</span>
488493
@
489
- @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
494
+ @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
490495
@ [Bummer]</a></p>
491496
style_footer();
492497
return;
493498
}
494499
if( isValidPwString(zPw) ){
@@ -495,16 +500,17 @@
495500
zPw = sha1_shared_secret(zPw, zLogin, 0);
496501
}else{
497502
zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid);
498503
}
499504
zOldLogin = db_text(0, "SELECT login FROM user WHERE uid=%d", uid);
500
- if( db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid) ){
505
+ if( db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d",zLogin,uid) ){
506
+ char *zRef = cgi_referer("setup_ulist");
501507
style_header("User Creation Error");
502508
@ <span class="loginError">Login "%h(zLogin)" is already used by
503509
@ a different user.</span>
504510
@
505
- @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
511
+ @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
506512
@ [Bummer]</a></p>
507513
style_footer();
508514
return;
509515
}
510516
login_verify_csrf_secret();
@@ -543,15 +549,16 @@
543549
blob_reset(&sql);
544550
admin_log( "Updated user [%q] in all login groups "
545551
"with capabilities [%q].",
546552
zLogin, zCap );
547553
if( zErr ){
554
+ char *zRef = cgi_referer("setup_ulist");
548555
style_header("User Change Error");
549556
admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
550557
@ <span class="loginError">%h(zErr)</span>
551558
@
552
- @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
559
+ @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
553560
@ [Bummer]</a></p>
554561
style_footer();
555562
return;
556563
}
557564
}
@@ -781,18 +788,20 @@
781788
@ indicates the privileges of <span class="usertype">nobody</span> that
782789
@ are available to all users regardless of whether or not they are logged in.
783790
@ </p></li>
784791
@
785792
@ <li><p>
786
- @ The "<span class="ueditInheritAnonymous"><sub>A</sub></span>" subscript suffix
793
+ @ The "<span class="ueditInheritAnonymous"><sub>A</sub></span>"
794
+ @ subscript suffix
787795
@ indicates the privileges of <span class="usertype">anonymous</span> that
788796
@ are inherited by all logged-in users.
789797
@ </p></li>
790798
@
791799
@ <li><p>
792
- @ The "<span class="ueditInheritDeveloper"><sub>D</sub></span>" subscript suffix
793
- @ indicates the privileges of <span class="usertype">developer</span> that
800
+ @ The "<span class="ueditInheritDeveloper"><sub>D</sub></span>"
801
+ @ subscript suffix indicates the privileges of
802
+ @ <span class="usertype">developer</span> that
794803
@ are inherited by all users with the
795804
@ <span class="capability">Developer</span> privilege.
796805
@ </p></li>
797806
@
798807
@ <li><p>
@@ -973,11 +982,12 @@
973982
db_set(zVar, zQ, 0);
974983
admin_log("Set entry_attribute %Q to: %.*s%s",
975984
zVar, 20, zQ, (nZQ>20 ? "..." : ""));
976985
zVal = zQ;
977986
}
978
- @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
987
+ @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" \
988
+ @ size="%d(width)"
979989
if( disabled ){
980990
@ disabled="disabled"
981991
}
982992
@ /> <b>%s(zLabel)</b>
983993
}
@@ -1364,11 +1374,12 @@
13641374
@ IP octets</a> in the login cookie across all repositories in the
13651375
@ same Login Group.
13661376
@ <hr /><h2>Implementation Details</h2>
13671377
@ <p>The following are fields from the CONFIG table related to login-groups,
13681378
@ provided here for instructional and debugging purposes:</p>
1369
- @ <table border='1' class='sortable' data-column-types='ttt' data-init-sort='1'>
1379
+ @ <table border='1' class='sortable' data-column-types='ttt' \
1380
+ @ data-init-sort='1'>
13701381
@ <thead><tr>
13711382
@ <th>Config.Name<th>Config.Value<th>Config.mtime</tr>
13721383
@ </thead><tbody>
13731384
db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config"
13741385
" WHERE name GLOB 'peer-*'"
@@ -1458,14 +1469,14 @@
14581469
@ <p>(Property: "timeline-utc")
14591470
@ <hr />
14601471
multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
14611472
"tdf", "0", count(azTimeFormats)/2, azTimeFormats);
14621473
@ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1463
- @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1464
- @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1465
- @ and time is shown on every timeline entry using the CSS class "timelineTime".
1466
- @ (Preperty: "timeline-date-format")</p>
1474
+ @ in a separate box (using CSS class "timelineDate") whenever the date
1475
+ @ changes. With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats,
1476
+ @ the complete date and time is shown on every timeline entry using the
1477
+ @ CSS class "timelineTime". (Preperty: "timeline-date-format")</p>
14671478
14681479
@ <hr />
14691480
onoff_attribute("Show version differences by default",
14701481
"show-version-diffs", "vdiff", 0, 0);
14711482
@ <p>The version-information pages linked from the timeline can either
@@ -1606,23 +1617,23 @@
16061617
@ engines as well as a short RSS description.
16071618
@ (Property: "project-description")</p>
16081619
@ <hr />
16091620
entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name",
16101621
"spn", "", 0);
1611
- @ <p>This is used as a prefix on the names of generated tarballs and ZIP archive.
1612
- @ For best results, keep this prefix brief and avoid special characters such
1613
- @ as "/" and "\".
1622
+ @ <p>This is used as a prefix on the names of generated tarballs and
1623
+ @ ZIP archive. For best results, keep this prefix brief and avoid special
1624
+ @ characters such as "/" and "\".
16141625
@ If no tarball prefix is specified, then the full Project Name above is used.
16151626
@ (Property: "short-project-name")
16161627
@ </p>
16171628
@ <hr />
16181629
entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0);
16191630
@ <p>The <a href='%R/download'>/download</a> page is designed to provide
16201631
@ a convenient place for newbies
1621
- @ to download a ZIP archive or a tarball of the project. By default, the latest
1622
- @ trunk check-in is downloaded. Change this tag to something else (ex: release)
1623
- @ to alter the behavior of the /download page.
1632
+ @ to download a ZIP archive or a tarball of the project. By default,
1633
+ @ the latest trunk check-in is downloaded. Change this tag to something
1634
+ @ else (ex: release) to alter the behavior of the /download page.
16241635
@ (Property: "download-tag")
16251636
@ </p>
16261637
@ <hr />
16271638
onoff_attribute("Enable WYSIWYG Wiki Editing",
16281639
"wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
@@ -1763,11 +1774,12 @@
17631774
@ <hr />
17641775
@ <b>Ad-Unit Notes:</b><ul>
17651776
@ <li>Leave both Ad-Units blank to disable all advertising.
17661777
@ <li>The "Banner Ad-Unit" is used for wide pages.
17671778
@ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1768
- @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
1779
+ @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is
1780
+ @ used on all pages.
17691781
@ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
17701782
@ "adunit-omit-if-user".
17711783
@ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
17721784
@ <blockquote><pre>
17731785
@ div.adunit_banner {
@@ -1876,11 +1888,12 @@
18761888
cgi_redirect("setup_logo");
18771889
}
18781890
style_header("Edit Project Logo And Background");
18791891
@ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
18801892
@ and looks like this:</p>
1881
- @ <blockquote><p><img src="%s(g.zTop)/logo/%z(zLogoMtime)" alt="logo" border="1" />
1893
+ @ <blockquote><p><img src="%s(g.zTop)/logo/%z(zLogoMtime)" \
1894
+ @ alt="logo" border="1" />
18821895
@ </p></blockquote>
18831896
@
18841897
@ <form action="%s(g.zTop)/setup_logo" method="post"
18851898
@ enctype="multipart/form-data"><div>
18861899
@ <p>The logo is accessible to all users at this URL:
@@ -1899,11 +1912,12 @@
18991912
@ </div></form>
19001913
@ <hr />
19011914
@
19021915
@ <p>The current background image has a MIME-Type of <b>%h(zBgMime)</b>
19031916
@ and looks like this:</p>
1904
- @ <blockquote><p><img src="%s(g.zTop)/background/%z(zBgMtime)" alt="background" border=1 />
1917
+ @ <blockquote><p><img src="%s(g.zTop)/background/%z(zBgMtime)" \
1918
+ @ alt="background" border=1 />
19051919
@ </p></blockquote>
19061920
@
19071921
@ <form action="%s(g.zTop)/setup_logo" method="post"
19081922
@ enctype="multipart/form-data"><div>
19091923
@ <p>The background image is accessible to all users at this URL:
@@ -1991,11 +2005,12 @@
19912005
19922006
if( P("configtab") ){
19932007
/* If the user presses the "CONFIG Table Query" button, populate the
19942008
** query text with a pre-packaged query against the CONFIG table */
19952009
zQ = "SELECT\n"
1996
- " CASE WHEN length(name)<50 THEN name ELSE printf('%.50s...',name) END AS name,\n"
2010
+ " CASE WHEN length(name)<50 THEN name ELSE printf('%.50s...',name)"
2011
+ " END AS name,\n"
19972012
" CASE WHEN typeof(value)<>'blob' AND length(value)<80 THEN value\n"
19982013
" ELSE '...' END AS value,\n"
19992014
" datetime(mtime, 'unixepoch') AS mtime\n"
20002015
"FROM config\n"
20012016
"-- ORDER BY mtime DESC; -- optional";
@@ -2011,11 +2026,12 @@
20112026
@ <input type="submit" name="tablelist" value="List Tables">
20122027
@ <input type="submit" name="configtab" value="CONFIG Table Query">
20132028
@ </form>
20142029
if( P("schema") ){
20152030
zQ = sqlite3_mprintf(
2016
- "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL ORDER BY name");
2031
+ "SELECT sql FROM repository.sqlite_master"
2032
+ " WHERE sql IS NOT NULL ORDER BY name");
20172033
go = 1;
20182034
}else if( P("tablelist") ){
20192035
zQ = sqlite3_mprintf(
20202036
"SELECT name FROM repository.sqlite_master WHERE type='table'"
20212037
" ORDER BY name");
@@ -2389,41 +2405,46 @@
23892405
@ <input type='hidden' name='namelist' value='%h(blob_str(&namelist))'>
23902406
@ <input type='submit' name='submit' value="Apply Changes">
23912407
@ </td><td></td></tr>
23922408
@ </table></form>
23932409
@ <hr>
2394
- @ <p>When the first term of an incoming URL exactly matches one of the "Aliases" on
2395
- @ the left-hand side (LHS) above, the URL is converted into the corresponding form
2396
- @ on the right-hand side (RHS).
2410
+ @ <p>When the first term of an incoming URL exactly matches one of
2411
+ @ the "Aliases" on the left-hand side (LHS) above, the URL is
2412
+ @ converted into the corresponding form on the right-hand side (RHS).
23972413
@ <ul>
23982414
@ <li><p>
23992415
@ The LHS is compared against only the first term of the incoming URL.
24002416
@ All LHS entries in the alias table should therefore begin with a
24012417
@ single "/" followed by a single path element.
24022418
@ <li><p>
2403
- @ The RHS entries in the alias table should begin with a single "/" followed by
2404
- @ a path element, and optionally followed by "?" and a list of query parameters.
2419
+ @ The RHS entries in the alias table should begin with a single "/"
2420
+ @ followed by a path element, and optionally followed by "?" and a
2421
+ @ list of query parameters.
24052422
@ <li><p>
24062423
@ Query parameters on the RHS are added to the set of query parameters
24072424
@ in the incoming URL.
24082425
@ <li><p>
2409
- @ If the same query parameter appears in both the incoming URL and on the RHS of the
2410
- @ alias, the RHS query parameter value overwrites the value on the incoming URL.
2426
+ @ If the same query parameter appears in both the incoming URL and
2427
+ @ on the RHS of the alias, the RHS query parameter value overwrites
2428
+ @ the value on the incoming URL.
24112429
@ <li><p>
2412
- @ If a query parameter on the RHS of the alias is of the form "X!" (a name followed
2413
- @ by "!") then the X query parameter is removed from the incoming URL if it exists.
2430
+ @ If a query parameter on the RHS of the alias is of the form "X!"
2431
+ @ (a name followed by "!") then the X query parameter is removed
2432
+ @ from the incoming URL if
2433
+ @ it exists.
24142434
@ <li><p>
24152435
@ Only a single alias operation occurs. It is not possible to nest aliases.
24162436
@ The RHS entries must be built-in webpage names.
24172437
@ <li><p>
2418
- @ The alias table is only checked if no built-in webpage matches the incoming URL.
2419
- @ Hence, it is not possible to override a built-in webpage using aliases. This is
2420
- @ by design.
2438
+ @ The alias table is only checked if no built-in webpage matches
2439
+ @ the incoming URL.
2440
+ @ Hence, it is not possible to override a built-in webpage using aliases.
2441
+ @ This is by design.
24212442
@ </ul>
24222443
@
24232444
@ <p>To delete an entry from the alias table, change its name or value to an
24242445
@ empty string and press "Apply Changes".
24252446
@
2426
- @ <p>To add a new alias, fill in the name and value in the bottom row of the table
2427
- @ above and press "Apply Changes".
2447
+ @ <p>To add a new alias, fill in the name and value in the bottom row
2448
+ @ of the table above and press "Apply Changes".
24282449
style_footer();
24292450
}
24302451
--- src/setup.c
+++ src/setup.c
@@ -74,11 +74,12 @@
74 /* Make sure the header contains <base href="...">. Issue a warning
75 ** if it does not. */
76 if( !cgi_header_contains("<base href=") ){
77 @ <p class="generalError"><b>Configuration Error:</b> Please add
78 @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
79 @ <tt>&lt;head&gt;</tt> in the <a href="setup_skinedit?w=2">HTML header</a>!</p>
 
80 }
81
82 #if !defined(_WIN32)
83 /* Check for /dev/null and /dev/urandom. We want both devices to be present,
84 ** but they are sometimes omitted (by mistake) from chroot jails. */
@@ -228,11 +229,12 @@
228 @ data-column-types='ktxTTK' data-init-sort='2'>
229 @ <thead><tr>
230 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead>
231 @ <tbody>
232 db_multi_exec(
233 "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;"
 
234 );
235 if( db_table_exists("repository","accesslog") ){
236 db_multi_exec(
237 "INSERT INTO lastAccess(uname, atime)"
238 " SELECT uname, max(mtime) FROM ("
@@ -247,11 +249,12 @@
247 zWith = mprintf(" AND cap GLOB '*[%q]*'", zWith);
248 }else{
249 zWith = "";
250 }
251 db_prepare(&s,
252 "SELECT uid, login, cap, info, date(mtime,'unixepoch'), lower(login) AS sortkey, "
 
253 " CASE WHEN info LIKE '%%expires 20%%'"
254 " THEN substr(info,instr(lower(info),'expires')+8,10)"
255 " END AS exp,"
256 "atime"
257 " FROM user LEFT JOIN lastAccess ON login=uname"
@@ -271,11 +274,12 @@
271 char *zAge = 0;
272 if( rATime>0.0 ){
273 zAge = human_readable_age(rNow - rATime);
274 }
275 @ <tr>
276 @ <td data-sortkey='%h(zSortKey)'><a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
 
277 @ <td>%h(zCap)
278 @ <td>%h(zInfo)
279 @ <td>%h(zDate?zDate:"")
280 @ <td>%h(zExp?zExp:"")
281 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
@@ -352,13 +356,13 @@
352 }
353
354 /*
355 ** WEBPAGE: setup_ulist_notes
356 **
357 ** A documentation page showing notes about user configuration. This information
358 ** used to be a side-bar on the user list page, but has been factored out for
359 ** improved presentation.
360 */
361 void setup_ulist_notes(void){
362 style_header("User Configuration Notes");
363 @ <h1>User Configuration Notes:</h1>
364 @ <ol>
@@ -481,14 +485,15 @@
481
482 zCap[i] = 0;
483 zPw = P("pw");
484 zLogin = P("login");
485 if( strlen(zLogin)==0 ){
 
486 style_header("User Creation Error");
487 @ <span class="loginError">Empty login not allowed.</span>
488 @
489 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
490 @ [Bummer]</a></p>
491 style_footer();
492 return;
493 }
494 if( isValidPwString(zPw) ){
@@ -495,16 +500,17 @@
495 zPw = sha1_shared_secret(zPw, zLogin, 0);
496 }else{
497 zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid);
498 }
499 zOldLogin = db_text(0, "SELECT login FROM user WHERE uid=%d", uid);
500 if( db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid) ){
 
501 style_header("User Creation Error");
502 @ <span class="loginError">Login "%h(zLogin)" is already used by
503 @ a different user.</span>
504 @
505 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
506 @ [Bummer]</a></p>
507 style_footer();
508 return;
509 }
510 login_verify_csrf_secret();
@@ -543,15 +549,16 @@
543 blob_reset(&sql);
544 admin_log( "Updated user [%q] in all login groups "
545 "with capabilities [%q].",
546 zLogin, zCap );
547 if( zErr ){
 
548 style_header("User Change Error");
549 admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
550 @ <span class="loginError">%h(zErr)</span>
551 @
552 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(cgi_referer("setup_ulist"))">
553 @ [Bummer]</a></p>
554 style_footer();
555 return;
556 }
557 }
@@ -781,18 +788,20 @@
781 @ indicates the privileges of <span class="usertype">nobody</span> that
782 @ are available to all users regardless of whether or not they are logged in.
783 @ </p></li>
784 @
785 @ <li><p>
786 @ The "<span class="ueditInheritAnonymous"><sub>A</sub></span>" subscript suffix
 
787 @ indicates the privileges of <span class="usertype">anonymous</span> that
788 @ are inherited by all logged-in users.
789 @ </p></li>
790 @
791 @ <li><p>
792 @ The "<span class="ueditInheritDeveloper"><sub>D</sub></span>" subscript suffix
793 @ indicates the privileges of <span class="usertype">developer</span> that
 
794 @ are inherited by all users with the
795 @ <span class="capability">Developer</span> privilege.
796 @ </p></li>
797 @
798 @ <li><p>
@@ -973,11 +982,12 @@
973 db_set(zVar, zQ, 0);
974 admin_log("Set entry_attribute %Q to: %.*s%s",
975 zVar, 20, zQ, (nZQ>20 ? "..." : ""));
976 zVal = zQ;
977 }
978 @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
 
979 if( disabled ){
980 @ disabled="disabled"
981 }
982 @ /> <b>%s(zLabel)</b>
983 }
@@ -1364,11 +1374,12 @@
1364 @ IP octets</a> in the login cookie across all repositories in the
1365 @ same Login Group.
1366 @ <hr /><h2>Implementation Details</h2>
1367 @ <p>The following are fields from the CONFIG table related to login-groups,
1368 @ provided here for instructional and debugging purposes:</p>
1369 @ <table border='1' class='sortable' data-column-types='ttt' data-init-sort='1'>
 
1370 @ <thead><tr>
1371 @ <th>Config.Name<th>Config.Value<th>Config.mtime</tr>
1372 @ </thead><tbody>
1373 db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config"
1374 " WHERE name GLOB 'peer-*'"
@@ -1458,14 +1469,14 @@
1458 @ <p>(Property: "timeline-utc")
1459 @ <hr />
1460 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1461 "tdf", "0", count(azTimeFormats)/2, azTimeFormats);
1462 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1463 @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1464 @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1465 @ and time is shown on every timeline entry using the CSS class "timelineTime".
1466 @ (Preperty: "timeline-date-format")</p>
1467
1468 @ <hr />
1469 onoff_attribute("Show version differences by default",
1470 "show-version-diffs", "vdiff", 0, 0);
1471 @ <p>The version-information pages linked from the timeline can either
@@ -1606,23 +1617,23 @@
1606 @ engines as well as a short RSS description.
1607 @ (Property: "project-description")</p>
1608 @ <hr />
1609 entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name",
1610 "spn", "", 0);
1611 @ <p>This is used as a prefix on the names of generated tarballs and ZIP archive.
1612 @ For best results, keep this prefix brief and avoid special characters such
1613 @ as "/" and "\".
1614 @ If no tarball prefix is specified, then the full Project Name above is used.
1615 @ (Property: "short-project-name")
1616 @ </p>
1617 @ <hr />
1618 entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0);
1619 @ <p>The <a href='%R/download'>/download</a> page is designed to provide
1620 @ a convenient place for newbies
1621 @ to download a ZIP archive or a tarball of the project. By default, the latest
1622 @ trunk check-in is downloaded. Change this tag to something else (ex: release)
1623 @ to alter the behavior of the /download page.
1624 @ (Property: "download-tag")
1625 @ </p>
1626 @ <hr />
1627 onoff_attribute("Enable WYSIWYG Wiki Editing",
1628 "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
@@ -1763,11 +1774,12 @@
1763 @ <hr />
1764 @ <b>Ad-Unit Notes:</b><ul>
1765 @ <li>Leave both Ad-Units blank to disable all advertising.
1766 @ <li>The "Banner Ad-Unit" is used for wide pages.
1767 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1768 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
 
1769 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1770 @ "adunit-omit-if-user".
1771 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1772 @ <blockquote><pre>
1773 @ div.adunit_banner {
@@ -1876,11 +1888,12 @@
1876 cgi_redirect("setup_logo");
1877 }
1878 style_header("Edit Project Logo And Background");
1879 @ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
1880 @ and looks like this:</p>
1881 @ <blockquote><p><img src="%s(g.zTop)/logo/%z(zLogoMtime)" alt="logo" border="1" />
 
1882 @ </p></blockquote>
1883 @
1884 @ <form action="%s(g.zTop)/setup_logo" method="post"
1885 @ enctype="multipart/form-data"><div>
1886 @ <p>The logo is accessible to all users at this URL:
@@ -1899,11 +1912,12 @@
1899 @ </div></form>
1900 @ <hr />
1901 @
1902 @ <p>The current background image has a MIME-Type of <b>%h(zBgMime)</b>
1903 @ and looks like this:</p>
1904 @ <blockquote><p><img src="%s(g.zTop)/background/%z(zBgMtime)" alt="background" border=1 />
 
1905 @ </p></blockquote>
1906 @
1907 @ <form action="%s(g.zTop)/setup_logo" method="post"
1908 @ enctype="multipart/form-data"><div>
1909 @ <p>The background image is accessible to all users at this URL:
@@ -1991,11 +2005,12 @@
1991
1992 if( P("configtab") ){
1993 /* If the user presses the "CONFIG Table Query" button, populate the
1994 ** query text with a pre-packaged query against the CONFIG table */
1995 zQ = "SELECT\n"
1996 " CASE WHEN length(name)<50 THEN name ELSE printf('%.50s...',name) END AS name,\n"
 
1997 " CASE WHEN typeof(value)<>'blob' AND length(value)<80 THEN value\n"
1998 " ELSE '...' END AS value,\n"
1999 " datetime(mtime, 'unixepoch') AS mtime\n"
2000 "FROM config\n"
2001 "-- ORDER BY mtime DESC; -- optional";
@@ -2011,11 +2026,12 @@
2011 @ <input type="submit" name="tablelist" value="List Tables">
2012 @ <input type="submit" name="configtab" value="CONFIG Table Query">
2013 @ </form>
2014 if( P("schema") ){
2015 zQ = sqlite3_mprintf(
2016 "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL ORDER BY name");
 
2017 go = 1;
2018 }else if( P("tablelist") ){
2019 zQ = sqlite3_mprintf(
2020 "SELECT name FROM repository.sqlite_master WHERE type='table'"
2021 " ORDER BY name");
@@ -2389,41 +2405,46 @@
2389 @ <input type='hidden' name='namelist' value='%h(blob_str(&namelist))'>
2390 @ <input type='submit' name='submit' value="Apply Changes">
2391 @ </td><td></td></tr>
2392 @ </table></form>
2393 @ <hr>
2394 @ <p>When the first term of an incoming URL exactly matches one of the "Aliases" on
2395 @ the left-hand side (LHS) above, the URL is converted into the corresponding form
2396 @ on the right-hand side (RHS).
2397 @ <ul>
2398 @ <li><p>
2399 @ The LHS is compared against only the first term of the incoming URL.
2400 @ All LHS entries in the alias table should therefore begin with a
2401 @ single "/" followed by a single path element.
2402 @ <li><p>
2403 @ The RHS entries in the alias table should begin with a single "/" followed by
2404 @ a path element, and optionally followed by "?" and a list of query parameters.
 
2405 @ <li><p>
2406 @ Query parameters on the RHS are added to the set of query parameters
2407 @ in the incoming URL.
2408 @ <li><p>
2409 @ If the same query parameter appears in both the incoming URL and on the RHS of the
2410 @ alias, the RHS query parameter value overwrites the value on the incoming URL.
 
2411 @ <li><p>
2412 @ If a query parameter on the RHS of the alias is of the form "X!" (a name followed
2413 @ by "!") then the X query parameter is removed from the incoming URL if it exists.
 
 
2414 @ <li><p>
2415 @ Only a single alias operation occurs. It is not possible to nest aliases.
2416 @ The RHS entries must be built-in webpage names.
2417 @ <li><p>
2418 @ The alias table is only checked if no built-in webpage matches the incoming URL.
2419 @ Hence, it is not possible to override a built-in webpage using aliases. This is
2420 @ by design.
 
2421 @ </ul>
2422 @
2423 @ <p>To delete an entry from the alias table, change its name or value to an
2424 @ empty string and press "Apply Changes".
2425 @
2426 @ <p>To add a new alias, fill in the name and value in the bottom row of the table
2427 @ above and press "Apply Changes".
2428 style_footer();
2429 }
2430
--- src/setup.c
+++ src/setup.c
@@ -74,11 +74,12 @@
74 /* Make sure the header contains <base href="...">. Issue a warning
75 ** if it does not. */
76 if( !cgi_header_contains("<base href=") ){
77 @ <p class="generalError"><b>Configuration Error:</b> Please add
78 @ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
79 @ <tt>&lt;head&gt;</tt> in the
80 @ <a href="setup_skinedit?w=2">HTML header</a>!</p>
81 }
82
83 #if !defined(_WIN32)
84 /* Check for /dev/null and /dev/urandom. We want both devices to be present,
85 ** but they are sometimes omitted (by mistake) from chroot jails. */
@@ -228,11 +229,12 @@
229 @ data-column-types='ktxTTK' data-init-sort='2'>
230 @ <thead><tr>
231 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead>
232 @ <tbody>
233 db_multi_exec(
234 "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)"
235 "WITHOUT ROWID;"
236 );
237 if( db_table_exists("repository","accesslog") ){
238 db_multi_exec(
239 "INSERT INTO lastAccess(uname, atime)"
240 " SELECT uname, max(mtime) FROM ("
@@ -247,11 +249,12 @@
249 zWith = mprintf(" AND cap GLOB '*[%q]*'", zWith);
250 }else{
251 zWith = "";
252 }
253 db_prepare(&s,
254 "SELECT uid, login, cap, info, date(mtime,'unixepoch'),"
255 " lower(login) AS sortkey, "
256 " CASE WHEN info LIKE '%%expires 20%%'"
257 " THEN substr(info,instr(lower(info),'expires')+8,10)"
258 " END AS exp,"
259 "atime"
260 " FROM user LEFT JOIN lastAccess ON login=uname"
@@ -271,11 +274,12 @@
274 char *zAge = 0;
275 if( rATime>0.0 ){
276 zAge = human_readable_age(rNow - rATime);
277 }
278 @ <tr>
279 @ <td data-sortkey='%h(zSortKey)'>\
280 @ <a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
281 @ <td>%h(zCap)
282 @ <td>%h(zInfo)
283 @ <td>%h(zDate?zDate:"")
284 @ <td>%h(zExp?zExp:"")
285 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
@@ -352,13 +356,13 @@
356 }
357
358 /*
359 ** WEBPAGE: setup_ulist_notes
360 **
361 ** A documentation page showing notes about user configuration. This
362 ** information used to be a side-bar on the user list page, but has been
363 ** factored out for improved presentation.
364 */
365 void setup_ulist_notes(void){
366 style_header("User Configuration Notes");
367 @ <h1>User Configuration Notes:</h1>
368 @ <ol>
@@ -481,14 +485,15 @@
485
486 zCap[i] = 0;
487 zPw = P("pw");
488 zLogin = P("login");
489 if( strlen(zLogin)==0 ){
490 char *zRef = cgi_referer("setup_ulist");
491 style_header("User Creation Error");
492 @ <span class="loginError">Empty login not allowed.</span>
493 @
494 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
495 @ [Bummer]</a></p>
496 style_footer();
497 return;
498 }
499 if( isValidPwString(zPw) ){
@@ -495,16 +500,17 @@
500 zPw = sha1_shared_secret(zPw, zLogin, 0);
501 }else{
502 zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid);
503 }
504 zOldLogin = db_text(0, "SELECT login FROM user WHERE uid=%d", uid);
505 if( db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d",zLogin,uid) ){
506 char *zRef = cgi_referer("setup_ulist");
507 style_header("User Creation Error");
508 @ <span class="loginError">Login "%h(zLogin)" is already used by
509 @ a different user.</span>
510 @
511 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
512 @ [Bummer]</a></p>
513 style_footer();
514 return;
515 }
516 login_verify_csrf_secret();
@@ -543,15 +549,16 @@
549 blob_reset(&sql);
550 admin_log( "Updated user [%q] in all login groups "
551 "with capabilities [%q].",
552 zLogin, zCap );
553 if( zErr ){
554 char *zRef = cgi_referer("setup_ulist");
555 style_header("User Change Error");
556 admin_log( "Error updating user '%q': %s'.", zLogin, zErr );
557 @ <span class="loginError">%h(zErr)</span>
558 @
559 @ <p><a href="setup_uedit?id=%d(uid)&referer=%T(zRef)">
560 @ [Bummer]</a></p>
561 style_footer();
562 return;
563 }
564 }
@@ -781,18 +788,20 @@
788 @ indicates the privileges of <span class="usertype">nobody</span> that
789 @ are available to all users regardless of whether or not they are logged in.
790 @ </p></li>
791 @
792 @ <li><p>
793 @ The "<span class="ueditInheritAnonymous"><sub>A</sub></span>"
794 @ subscript suffix
795 @ indicates the privileges of <span class="usertype">anonymous</span> that
796 @ are inherited by all logged-in users.
797 @ </p></li>
798 @
799 @ <li><p>
800 @ The "<span class="ueditInheritDeveloper"><sub>D</sub></span>"
801 @ subscript suffix indicates the privileges of
802 @ <span class="usertype">developer</span> that
803 @ are inherited by all users with the
804 @ <span class="capability">Developer</span> privilege.
805 @ </p></li>
806 @
807 @ <li><p>
@@ -973,11 +982,12 @@
982 db_set(zVar, zQ, 0);
983 admin_log("Set entry_attribute %Q to: %.*s%s",
984 zVar, 20, zQ, (nZQ>20 ? "..." : ""));
985 zVal = zQ;
986 }
987 @ <input type="text" id="%s(zQParm)" name="%s(zQParm)" value="%h(zVal)" \
988 @ size="%d(width)"
989 if( disabled ){
990 @ disabled="disabled"
991 }
992 @ /> <b>%s(zLabel)</b>
993 }
@@ -1364,11 +1374,12 @@
1374 @ IP octets</a> in the login cookie across all repositories in the
1375 @ same Login Group.
1376 @ <hr /><h2>Implementation Details</h2>
1377 @ <p>The following are fields from the CONFIG table related to login-groups,
1378 @ provided here for instructional and debugging purposes:</p>
1379 @ <table border='1' class='sortable' data-column-types='ttt' \
1380 @ data-init-sort='1'>
1381 @ <thead><tr>
1382 @ <th>Config.Name<th>Config.Value<th>Config.mtime</tr>
1383 @ </thead><tbody>
1384 db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config"
1385 " WHERE name GLOB 'peer-*'"
@@ -1458,14 +1469,14 @@
1469 @ <p>(Property: "timeline-utc")
1470 @ <hr />
1471 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1472 "tdf", "0", count(azTimeFormats)/2, azTimeFormats);
1473 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1474 @ in a separate box (using CSS class "timelineDate") whenever the date
1475 @ changes. With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats,
1476 @ the complete date and time is shown on every timeline entry using the
1477 @ CSS class "timelineTime". (Preperty: "timeline-date-format")</p>
1478
1479 @ <hr />
1480 onoff_attribute("Show version differences by default",
1481 "show-version-diffs", "vdiff", 0, 0);
1482 @ <p>The version-information pages linked from the timeline can either
@@ -1606,23 +1617,23 @@
1617 @ engines as well as a short RSS description.
1618 @ (Property: "project-description")</p>
1619 @ <hr />
1620 entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name",
1621 "spn", "", 0);
1622 @ <p>This is used as a prefix on the names of generated tarballs and
1623 @ ZIP archive. For best results, keep this prefix brief and avoid special
1624 @ characters such as "/" and "\".
1625 @ If no tarball prefix is specified, then the full Project Name above is used.
1626 @ (Property: "short-project-name")
1627 @ </p>
1628 @ <hr />
1629 entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0);
1630 @ <p>The <a href='%R/download'>/download</a> page is designed to provide
1631 @ a convenient place for newbies
1632 @ to download a ZIP archive or a tarball of the project. By default,
1633 @ the latest trunk check-in is downloaded. Change this tag to something
1634 @ else (ex: release) to alter the behavior of the /download page.
1635 @ (Property: "download-tag")
1636 @ </p>
1637 @ <hr />
1638 onoff_attribute("Enable WYSIWYG Wiki Editing",
1639 "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
@@ -1763,11 +1774,12 @@
1774 @ <hr />
1775 @ <b>Ad-Unit Notes:</b><ul>
1776 @ <li>Leave both Ad-Units blank to disable all advertising.
1777 @ <li>The "Banner Ad-Unit" is used for wide pages.
1778 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1779 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is
1780 @ used on all pages.
1781 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1782 @ "adunit-omit-if-user".
1783 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1784 @ <blockquote><pre>
1785 @ div.adunit_banner {
@@ -1876,11 +1888,12 @@
1888 cgi_redirect("setup_logo");
1889 }
1890 style_header("Edit Project Logo And Background");
1891 @ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b>
1892 @ and looks like this:</p>
1893 @ <blockquote><p><img src="%s(g.zTop)/logo/%z(zLogoMtime)" \
1894 @ alt="logo" border="1" />
1895 @ </p></blockquote>
1896 @
1897 @ <form action="%s(g.zTop)/setup_logo" method="post"
1898 @ enctype="multipart/form-data"><div>
1899 @ <p>The logo is accessible to all users at this URL:
@@ -1899,11 +1912,12 @@
1912 @ </div></form>
1913 @ <hr />
1914 @
1915 @ <p>The current background image has a MIME-Type of <b>%h(zBgMime)</b>
1916 @ and looks like this:</p>
1917 @ <blockquote><p><img src="%s(g.zTop)/background/%z(zBgMtime)" \
1918 @ alt="background" border=1 />
1919 @ </p></blockquote>
1920 @
1921 @ <form action="%s(g.zTop)/setup_logo" method="post"
1922 @ enctype="multipart/form-data"><div>
1923 @ <p>The background image is accessible to all users at this URL:
@@ -1991,11 +2005,12 @@
2005
2006 if( P("configtab") ){
2007 /* If the user presses the "CONFIG Table Query" button, populate the
2008 ** query text with a pre-packaged query against the CONFIG table */
2009 zQ = "SELECT\n"
2010 " CASE WHEN length(name)<50 THEN name ELSE printf('%.50s...',name)"
2011 " END AS name,\n"
2012 " CASE WHEN typeof(value)<>'blob' AND length(value)<80 THEN value\n"
2013 " ELSE '...' END AS value,\n"
2014 " datetime(mtime, 'unixepoch') AS mtime\n"
2015 "FROM config\n"
2016 "-- ORDER BY mtime DESC; -- optional";
@@ -2011,11 +2026,12 @@
2026 @ <input type="submit" name="tablelist" value="List Tables">
2027 @ <input type="submit" name="configtab" value="CONFIG Table Query">
2028 @ </form>
2029 if( P("schema") ){
2030 zQ = sqlite3_mprintf(
2031 "SELECT sql FROM repository.sqlite_master"
2032 " WHERE sql IS NOT NULL ORDER BY name");
2033 go = 1;
2034 }else if( P("tablelist") ){
2035 zQ = sqlite3_mprintf(
2036 "SELECT name FROM repository.sqlite_master WHERE type='table'"
2037 " ORDER BY name");
@@ -2389,41 +2405,46 @@
2405 @ <input type='hidden' name='namelist' value='%h(blob_str(&namelist))'>
2406 @ <input type='submit' name='submit' value="Apply Changes">
2407 @ </td><td></td></tr>
2408 @ </table></form>
2409 @ <hr>
2410 @ <p>When the first term of an incoming URL exactly matches one of
2411 @ the "Aliases" on the left-hand side (LHS) above, the URL is
2412 @ converted into the corresponding form on the right-hand side (RHS).
2413 @ <ul>
2414 @ <li><p>
2415 @ The LHS is compared against only the first term of the incoming URL.
2416 @ All LHS entries in the alias table should therefore begin with a
2417 @ single "/" followed by a single path element.
2418 @ <li><p>
2419 @ The RHS entries in the alias table should begin with a single "/"
2420 @ followed by a path element, and optionally followed by "?" and a
2421 @ list of query parameters.
2422 @ <li><p>
2423 @ Query parameters on the RHS are added to the set of query parameters
2424 @ in the incoming URL.
2425 @ <li><p>
2426 @ If the same query parameter appears in both the incoming URL and
2427 @ on the RHS of the alias, the RHS query parameter value overwrites
2428 @ the value on the incoming URL.
2429 @ <li><p>
2430 @ If a query parameter on the RHS of the alias is of the form "X!"
2431 @ (a name followed by "!") then the X query parameter is removed
2432 @ from the incoming URL if
2433 @ it exists.
2434 @ <li><p>
2435 @ Only a single alias operation occurs. It is not possible to nest aliases.
2436 @ The RHS entries must be built-in webpage names.
2437 @ <li><p>
2438 @ The alias table is only checked if no built-in webpage matches
2439 @ the incoming URL.
2440 @ Hence, it is not possible to override a built-in webpage using aliases.
2441 @ This is by design.
2442 @ </ul>
2443 @
2444 @ <p>To delete an entry from the alias table, change its name or value to an
2445 @ empty string and press "Apply Changes".
2446 @
2447 @ <p>To add a new alias, fill in the name and value in the bottom row
2448 @ of the table above and press "Apply Changes".
2449 style_footer();
2450 }
2451

Keyboard Shortcuts

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