0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 37 20 44 2e 20 52 69 63 68 (c) 2007 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 53 69 6d 70 6c 69 66 69 65 64 20 42 53 44 20 Simplified BSD
00a0: 4c 69 63 65 6e 73 65 20 28 61 6c 73 6f 0a 2a 2a License (also.**
00b0: 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 22 32 known as the "2
00c0: 2d 43 6c 61 75 73 65 20 4c 69 63 65 6e 73 65 22 -Clause License"
00d0: 20 6f 72 20 22 46 72 65 65 42 53 44 20 4c 69 63 or "FreeBSD Lic
00e0: 65 6e 73 65 22 2e 29 0a 2a 2a 0a 2a 2a 20 54 68 ense".).**.** Th
00f0: 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 is program is di
0100: 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 stributed in the
0110: 20 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 hope that it wi
0120: 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a ll be useful,.**
0130: 20 62 75 74 20 77 69 74 68 6f 75 74 20 61 6e 79 but without any
0140: 20 77 61 72 72 61 6e 74 79 3b 20 77 69 74 68 6f warranty; witho
0150: 75 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c ut even the impl
0160: 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a ied warranty of.
0170: 2a 2a 20 6d 65 72 63 68 61 6e 74 61 62 69 6c 69 ** merchantabili
0180: 74 79 20 6f 72 20 66 69 74 6e 65 73 73 20 66 6f ty or fitness fo
0190: 72 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 70 r a particular p
01a0: 75 72 70 6f 73 65 2e 0a 2a 2a 0a 2a 2a 20 41 75 urpose..**.** Au
01b0: 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69 6e 66 thor contact inf
01c0: 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 20 64 ormation:.** d
01d0: 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a 2a 20 rh@hwaci.com.**
01e0: 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68 77 61 http://www.hwa
01f0: 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a 0a 2a ci.com/drh/.**.*
0200: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0210: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0220: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0230: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0240: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a **************.*
0250: 2a 0a 2a 2a 20 49 6d 70 6c 65 6d 65 6e 74 61 74 *.** Implementat
0260: 69 6f 6e 20 6f 66 20 74 68 65 20 53 65 74 75 70 ion of the Setup
0270: 20 70 61 67 65 0a 2a 2f 0a 23 69 6e 63 6c 75 64 page.*/.#includ
0280: 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e e "config.h".#in
0290: 63 6c 75 64 65 20 3c 61 73 73 65 72 74 2e 68 3e clude <assert.h>
02a0: 0a 23 69 6e 63 6c 75 64 65 20 22 73 65 74 75 70 .#include "setup
02b0: 2e 68 22 0a 0a 2f 2a 0a 2a 2a 20 49 6e 63 72 65 .h"../*.** Incre
02c0: 6d 65 6e 74 20 74 68 65 20 22 63 66 67 63 6e 74 ment the "cfgcnt
02d0: 22 20 76 61 72 69 61 62 6c 65 2c 20 73 6f 20 74 " variable, so t
02e0: 68 61 74 20 45 54 61 67 73 20 77 69 6c 6c 20 6b hat ETags will k
02f0: 6e 6f 77 20 74 68 61 74 0a 2a 2a 20 74 68 65 20 now that.** the
0300: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 68 61 configuration ha
0310: 73 20 63 68 61 6e 67 65 64 2e 0a 2a 2f 0a 76 6f s changed..*/.vo
0320: 69 64 20 73 65 74 75 70 5f 69 6e 63 72 5f 63 66 id setup_incr_cf
0330: 67 63 6e 74 28 76 6f 69 64 29 7b 0a 20 20 73 74 gcnt(void){. st
0340: 61 74 69 63 20 69 6e 74 20 6f 6e 63 65 20 3d 20 atic int once =
0350: 31 3b 0a 20 20 69 66 28 20 6f 6e 63 65 20 29 7b 1;. if( once ){
0360: 0a 20 20 20 20 6f 6e 63 65 20 3d 20 30 3b 0a 20 . once = 0;.
0370: 20 20 20 64 62 5f 75 6e 70 72 6f 74 65 63 74 28 db_unprotect(
0380: 50 52 4f 54 45 43 54 5f 43 4f 4e 46 49 47 29 3b PROTECT_CONFIG);
0390: 0a 20 20 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 . db_multi_ex
03a0: 65 63 28 22 55 50 44 41 54 45 20 63 6f 6e 66 69 ec("UPDATE confi
03b0: 67 20 53 45 54 20 76 61 6c 75 65 3d 76 61 6c 75 g SET value=valu
03c0: 65 2b 31 20 57 48 45 52 45 20 6e 61 6d 65 3d 27 e+1 WHERE name='
03d0: 63 66 67 63 6e 74 27 22 29 3b 0a 20 20 20 20 69 cfgcnt'");. i
03e0: 66 28 20 64 62 5f 63 68 61 6e 67 65 73 28 29 3d f( db_changes()=
03f0: 3d 30 20 29 7b 0a 20 20 20 20 20 20 64 62 5f 6d =0 ){. db_m
0400: 75 6c 74 69 5f 65 78 65 63 28 22 49 4e 53 45 52 ulti_exec("INSER
0410: 54 20 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 T INTO config(na
0420: 6d 65 2c 76 61 6c 75 65 29 20 56 41 4c 55 45 53 me,value) VALUES
0430: 28 27 63 66 67 63 6e 74 27 2c 31 29 22 29 3b 0a ('cfgcnt',1)");.
0440: 20 20 20 20 7d 0a 20 20 20 20 64 62 5f 70 72 6f }. db_pro
0450: 74 65 63 74 5f 70 6f 70 28 29 3b 0a 20 20 7d 0a tect_pop();. }.
0460: 7d 0a 0a 2f 2a 0a 2a 2a 20 4f 75 74 70 75 74 20 }../*.** Output
0470: 61 20 73 69 6e 67 6c 65 20 65 6e 74 72 79 20 66 a single entry f
0480: 6f 72 20 61 20 6d 65 6e 75 20 67 65 6e 65 72 61 or a menu genera
0490: 74 65 64 20 75 73 69 6e 67 20 61 6e 20 48 54 4d ted using an HTM
04a0: 4c 20 74 61 62 6c 65 2e 0a 2a 2a 20 49 66 20 7a L table..** If z
04b0: 4c 69 6e 6b 20 69 73 20 6e 6f 74 20 4e 55 4c 4c Link is not NULL
04c0: 20 6f 72 20 61 6e 20 65 6d 70 74 79 20 73 74 72 or an empty str
04d0: 69 6e 67 2c 20 74 68 65 6e 20 69 74 20 69 73 20 ing, then it is
04e0: 74 68 65 20 70 61 67 65 20 74 68 61 74 0a 2a 2a the page that.**
04f0: 20 74 68 65 20 6d 65 6e 75 20 65 6e 74 72 79 20 the menu entry
0500: 77 69 6c 6c 20 68 79 70 65 72 6c 69 6e 6b 20 74 will hyperlink t
0510: 6f 2e 20 20 49 66 20 7a 4c 69 6e 6b 20 69 73 20 o. If zLink is
0520: 4e 55 4c 4c 20 6f 72 20 22 22 2c 20 74 68 65 6e NULL or "", then
0530: 0a 2a 2a 20 74 68 65 20 6d 65 6e 75 20 65 6e 74 .** the menu ent
0540: 72 79 20 68 61 73 20 6e 6f 20 68 79 70 65 72 6c ry has no hyperl
0550: 69 6e 6b 20 2d 20 69 74 20 69 73 20 64 69 73 61 ink - it is disa
0560: 62 6c 65 64 2e 0a 2a 2f 0a 76 6f 69 64 20 73 65 bled..*/.void se
0570: 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 0a tup_menu_entry(.
0580: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 54 const char *zT
0590: 69 74 6c 65 2c 0a 20 20 63 6f 6e 73 74 20 63 68 itle,. const ch
05a0: 61 72 20 2a 7a 4c 69 6e 6b 2c 0a 20 20 63 6f 6e ar *zLink,. con
05b0: 73 74 20 63 68 61 72 20 2a 7a 44 65 73 63 0a 29 st char *zDesc.)
05c0: 7b 0a 20 20 40 20 3c 74 72 3e 3c 74 64 20 76 61 {. @ <tr><td va
05d0: 6c 69 67 6e 3d 22 74 6f 70 22 20 61 6c 69 67 6e lign="top" align
05e0: 3d 22 72 69 67 68 74 22 3e 0a 20 20 69 66 28 20 ="right">. if(
05f0: 7a 4c 69 6e 6b 20 26 26 20 7a 4c 69 6e 6b 5b 30 zLink && zLink[0
0600: 5d 20 29 7b 0a 20 20 20 20 40 20 3c 61 20 68 72 ] ){. @ <a hr
0610: 65 66 3d 22 25 73 28 7a 4c 69 6e 6b 29 22 3e 25 ef="%s(zLink)">%
0620: 68 28 7a 54 69 74 6c 65 29 3c 2f 61 3e 0a 20 20 h(zTitle)</a>.
0630: 7d 65 6c 73 65 7b 0a 20 20 20 20 40 20 25 68 28 }else{. @ %h(
0640: 7a 54 69 74 6c 65 29 0a 20 20 7d 0a 20 20 40 20 zTitle). }. @
0650: 3c 2f 74 64 3e 3c 74 64 20 77 69 64 74 68 3d 22 </td><td width="
0660: 35 22 3e 3c 2f 74 64 3e 3c 74 64 20 76 61 6c 69 5"></td><td vali
0670: 67 6e 3d 22 74 6f 70 22 3e 25 68 28 7a 44 65 73 gn="top">%h(zDes
0680: 63 29 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 7d 0a 0a c)</td></tr>.}..
0690: 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 3a ../*.** WEBPAGE:
06a0: 20 73 65 74 75 70 0a 2a 2a 0a 2a 2a 20 4d 61 69 setup.**.** Mai
06b0: 6e 20 6d 65 6e 75 20 66 6f 72 20 74 68 65 20 61 n menu for the a
06c0: 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 70 61 dministrative pa
06d0: 67 65 73 2e 20 20 52 65 71 75 69 72 65 73 20 41 ges. Requires A
06e0: 64 6d 69 6e 20 6f 72 20 53 65 74 75 70 0a 2a 2a dmin or Setup.**
06f0: 20 70 72 69 76 69 6c 65 67 65 73 2e 20 20 4c 69 privileges. Li
0700: 6e 6b 73 20 74 6f 20 73 75 62 2d 70 61 67 65 73 nks to sub-pages
0710: 20 6f 6e 6c 79 20 75 73 61 62 6c 65 20 62 79 20 only usable by
0720: 53 65 74 75 70 20 75 73 65 72 73 20 61 72 65 0a Setup users are.
0730: 2a 2a 20 73 68 6f 77 6e 20 6f 6e 6c 79 20 74 6f ** shown only to
0740: 20 53 65 74 75 70 20 75 73 65 72 73 2e 0a 2a 2f Setup users..*/
0750: 0a 76 6f 69 64 20 73 65 74 75 70 5f 70 61 67 65 .void setup_page
0760: 28 76 6f 69 64 29 7b 0a 20 20 69 6e 74 20 73 65 (void){. int se
0770: 74 75 70 5f 75 73 65 72 20 3d 20 30 3b 0a 20 20 tup_user = 0;.
0780: 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 login_check_cred
0790: 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 entials();. if(
07a0: 20 21 67 2e 70 65 72 6d 2e 41 64 6d 69 6e 20 29 !g.perm.Admin )
07b0: 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 {. login_need
07c0: 65 64 28 30 29 3b 0a 20 20 7d 0a 20 20 73 65 74 ed(0);. }. set
07d0: 75 70 5f 75 73 65 72 20 3d 20 67 2e 70 65 72 6d up_user = g.perm
07e0: 2e 53 65 74 75 70 3b 0a 0a 20 20 73 74 79 6c 65 .Setup;.. style
07f0: 5f 68 65 61 64 65 72 28 22 53 65 72 76 65 72 20 _header("Server
0800: 41 64 6d 69 6e 69 73 74 72 61 74 69 6f 6e 22 29 Administration")
0810: 3b 0a 0a 20 20 2f 2a 20 4d 61 6b 65 20 73 75 72 ;.. /* Make sur
0820: 65 20 74 68 65 20 68 65 61 64 65 72 20 63 6f 6e e the header con
0830: 74 61 69 6e 73 20 3c 62 61 73 65 20 68 72 65 66 tains <base href
0840: 3d 22 2e 2e 2e 22 3e 2e 20 20 20 49 73 73 75 65 ="...">. Issue
0850: 20 61 20 77 61 72 6e 69 6e 67 0a 20 20 2a 2a 20 a warning. **
0860: 69 66 20 69 74 20 64 6f 65 73 20 6e 6f 74 2e 20 if it does not.
0870: 2a 2f 0a 20 20 69 66 28 20 21 63 67 69 5f 68 65 */. if( !cgi_he
0880: 61 64 65 72 5f 63 6f 6e 74 61 69 6e 73 28 22 3c ader_contains("<
0890: 62 61 73 65 20 68 72 65 66 3d 22 29 20 29 7b 0a base href=") ){.
08a0: 20 20 20 20 40 20 3c 70 20 63 6c 61 73 73 3d 22 @ <p class="
08b0: 67 65 6e 65 72 61 6c 45 72 72 6f 72 22 3e 3c 62 generalError"><b
08c0: 3e 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 45 >Configuration E
08d0: 72 72 6f 72 3a 3c 2f 62 3e 20 50 6c 65 61 73 65 rror:</b> Please
08e0: 20 61 64 64 0a 20 20 20 20 40 20 3c 74 74 3e 26 add. @ <tt>&
08f0: 6c 74 3b 62 61 73 65 20 68 72 65 66 3d 22 24 73 lt;base href="$s
0900: 65 63 75 72 65 75 72 6c 2f 24 63 75 72 72 65 6e ecureurl/$curren
0910: 74 5f 70 61 67 65 22 26 67 74 3b 3c 2f 74 74 3e t_page"></tt>
0920: 20 61 66 74 65 72 0a 20 20 20 20 40 20 3c 74 74 after. @ <tt
0930: 3e 26 6c 74 3b 68 65 61 64 26 67 74 3b 3c 2f 74 ><head></t
0940: 74 3e 20 69 6e 20 74 68 65 0a 20 20 20 20 40 20 t> in the. @
0950: 3c 61 20 68 72 65 66 3d 22 73 65 74 75 70 5f 73 <a href="setup_s
0960: 6b 69 6e 65 64 69 74 3f 77 3d 32 22 3e 48 54 4d kinedit?w=2">HTM
0970: 4c 20 68 65 61 64 65 72 3c 2f 61 3e 21 3c 2f 70 L header</a>!</p
0980: 3e 0a 20 20 7d 0a 0a 23 69 66 20 21 64 65 66 69 >. }..#if !defi
0990: 6e 65 64 28 5f 57 49 4e 33 32 29 0a 20 20 2f 2a ned(_WIN32). /*
09a0: 20 43 68 65 63 6b 20 66 6f 72 20 2f 64 65 76 2f Check for /dev/
09b0: 6e 75 6c 6c 20 61 6e 64 20 2f 64 65 76 2f 75 72 null and /dev/ur
09c0: 61 6e 64 6f 6d 2e 20 20 57 65 20 77 61 6e 74 20 andom. We want
09d0: 62 6f 74 68 20 64 65 76 69 63 65 73 20 74 6f 20 both devices to
09e0: 62 65 20 70 72 65 73 65 6e 74 2c 0a 20 20 2a 2a be present,. **
09f0: 20 62 75 74 20 74 68 65 79 20 61 72 65 20 73 6f but they are so
0a00: 6d 65 74 69 6d 65 73 20 6f 6d 69 74 74 65 64 20 metimes omitted
0a10: 28 62 79 20 6d 69 73 74 61 6b 65 29 20 66 72 6f (by mistake) fro
0a20: 6d 20 63 68 72 6f 6f 74 20 6a 61 69 6c 73 2e 20 m chroot jails.
0a30: 2a 2f 0a 20 20 69 66 28 20 61 63 63 65 73 73 28 */. if( access(
0a40: 22 2f 64 65 76 2f 6e 75 6c 6c 22 2c 20 52 5f 4f "/dev/null", R_O
0a50: 4b 7c 57 5f 4f 4b 29 20 29 7b 0a 20 20 20 20 40 K|W_OK) ){. @
0a60: 20 3c 70 20 63 6c 61 73 73 3d 22 67 65 6e 65 72 <p class="gener
0a70: 61 6c 45 72 72 6f 72 22 3e 57 41 52 4e 49 4e 47 alError">WARNING
0a80: 3a 20 44 65 76 69 63 65 20 22 2f 64 65 76 2f 6e : Device "/dev/n
0a90: 75 6c 6c 22 20 69 73 20 6e 6f 74 20 61 76 61 69 ull" is not avai
0aa0: 6c 61 62 6c 65 0a 20 20 20 20 40 20 66 6f 72 20 lable. @ for
0ab0: 72 65 61 64 69 6e 67 20 61 6e 64 20 77 72 69 74 reading and writ
0ac0: 69 6e 67 2e 3c 2f 70 3e 0a 20 20 7d 0a 20 20 69 ing.</p>. }. i
0ad0: 66 28 20 61 63 63 65 73 73 28 22 2f 64 65 76 2f f( access("/dev/
0ae0: 75 72 61 6e 64 6f 6d 22 2c 20 52 5f 4f 4b 29 20 urandom", R_OK)
0af0: 29 7b 0a 20 20 20 20 40 20 3c 70 20 63 6c 61 73 ){. @ <p clas
0b00: 73 3d 22 67 65 6e 65 72 61 6c 45 72 72 6f 72 22 s="generalError"
0b10: 3e 57 41 52 4e 49 4e 47 3a 20 44 65 76 69 63 65 >WARNING: Device
0b20: 20 22 2f 64 65 76 2f 75 72 61 6e 64 6f 6d 22 20 "/dev/urandom"
0b30: 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 is not available
0b40: 0a 20 20 20 20 40 20 66 6f 72 20 72 65 61 64 69 . @ for readi
0b50: 6e 67 2e 20 54 68 69 73 20 6d 65 61 6e 73 20 74 ng. This means t
0b60: 68 61 74 20 74 68 65 20 70 73 65 75 64 6f 2d 72 hat the pseudo-r
0b70: 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 67 65 6e andom number gen
0b80: 65 72 61 74 6f 72 20 75 73 65 64 0a 20 20 20 20 erator used.
0b90: 40 20 62 79 20 53 51 4c 69 74 65 20 77 69 6c 6c @ by SQLite will
0ba0: 20 62 65 20 70 6f 6f 72 6c 79 20 73 65 65 64 65 be poorly seede
0bb0: 64 2e 3c 2f 70 3e 0a 20 20 7d 0a 23 65 6e 64 69 d.</p>. }.#endi
0bc0: 66 0a 0a 20 20 40 20 3c 74 61 62 6c 65 20 62 6f f.. @ <table bo
0bd0: 72 64 65 72 3d 22 30 22 20 63 65 6c 6c 73 70 61 rder="0" cellspa
0be0: 63 69 6e 67 3d 22 33 22 3e 0a 20 20 73 65 74 75 cing="3">. setu
0bf0: 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 55 73 p_menu_entry("Us
0c00: 65 72 73 22 2c 20 22 73 65 74 75 70 5f 75 6c 69 ers", "setup_uli
0c10: 73 74 22 2c 0a 20 20 20 20 22 47 72 61 6e 74 20 st",. "Grant
0c20: 70 72 69 76 69 6c 65 67 65 73 20 74 6f 20 69 6e privileges to in
0c30: 64 69 76 69 64 75 61 6c 20 75 73 65 72 73 2e 22 dividual users."
0c40: 29 3b 0a 20 20 69 66 28 20 73 65 74 75 70 5f 75 );. if( setup_u
0c50: 73 65 72 20 29 7b 0a 20 20 20 20 73 65 74 75 70 ser ){. setup
0c60: 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 41 63 63 _menu_entry("Acc
0c70: 65 73 73 22 2c 20 22 73 65 74 75 70 5f 61 63 63 ess", "setup_acc
0c80: 65 73 73 22 2c 0a 20 20 20 20 20 20 22 43 6f 6e ess",. "Con
0c90: 74 72 6f 6c 20 61 63 63 65 73 73 20 73 65 74 74 trol access sett
0ca0: 69 6e 67 73 2e 22 29 3b 0a 20 20 20 20 73 65 74 ings.");. set
0cb0: 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 43 up_menu_entry("C
0cc0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 2c 20 22 onfiguration", "
0cd0: 73 65 74 75 70 5f 63 6f 6e 66 69 67 22 2c 0a 20 setup_config",.
0ce0: 20 20 20 20 20 22 43 6f 6e 66 69 67 75 72 65 20 "Configure
0cf0: 74 68 65 20 57 57 57 20 63 6f 6d 70 6f 6e 65 6e the WWW componen
0d00: 74 73 20 6f 66 20 74 68 65 20 72 65 70 6f 73 69 ts of the reposi
0d10: 74 6f 72 79 22 29 3b 0a 20 20 7d 0a 20 20 73 65 tory");. }. se
0d20: 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 tup_menu_entry("
0d30: 53 65 63 75 72 69 74 79 2d 41 75 64 69 74 22 2c Security-Audit",
0d40: 20 22 73 65 63 61 75 64 69 74 30 22 2c 0a 20 20 "secaudit0",.
0d50: 20 20 22 41 6e 61 6c 79 7a 65 20 74 68 65 20 63 "Analyze the c
0d60: 75 72 72 65 6e 74 20 63 6f 6e 66 69 67 75 72 61 urrent configura
0d70: 74 69 6f 6e 20 66 6f 72 20 73 65 63 75 72 69 74 tion for securit
0d80: 79 20 70 72 6f 62 6c 65 6d 73 22 29 3b 0a 20 20 y problems");.
0d90: 69 66 28 20 73 65 74 75 70 5f 75 73 65 72 20 29 if( setup_user )
0da0: 7b 0a 20 20 20 20 73 65 74 75 70 5f 6d 65 6e 75 {. setup_menu
0db0: 5f 65 6e 74 72 79 28 22 53 65 74 74 69 6e 67 73 _entry("Settings
0dc0: 22 2c 20 22 73 65 74 75 70 5f 73 65 74 74 69 6e ", "setup_settin
0dd0: 67 73 22 2c 0a 20 20 20 20 20 20 22 57 65 62 20 gs",. "Web
0de0: 69 6e 74 65 72 66 61 63 65 20 74 6f 20 74 68 65 interface to the
0df0: 20 5c 22 66 6f 73 73 69 6c 20 73 65 74 74 69 6e \"fossil settin
0e00: 67 73 5c 22 20 63 6f 6d 6d 61 6e 64 22 29 3b 0a gs\" command");.
0e10: 20 20 7d 0a 20 20 73 65 74 75 70 5f 6d 65 6e 75 }. setup_menu
0e20: 5f 65 6e 74 72 79 28 22 54 69 6d 65 6c 69 6e 65 _entry("Timeline
0e30: 22 2c 20 22 73 65 74 75 70 5f 74 69 6d 65 6c 69 ", "setup_timeli
0e40: 6e 65 22 2c 0a 20 20 20 20 22 54 69 6d 65 6c 69 ne",. "Timeli
0e50: 6e 65 20 64 69 73 70 6c 61 79 20 70 72 65 66 65 ne display prefe
0e60: 72 65 6e 63 65 73 22 29 3b 0a 20 20 69 66 28 20 rences");. if(
0e70: 73 65 74 75 70 5f 75 73 65 72 20 29 7b 0a 20 20 setup_user ){.
0e80: 20 20 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 setup_menu_ent
0e90: 72 79 28 22 4c 6f 67 69 6e 2d 47 72 6f 75 70 22 ry("Login-Group"
0ea0: 2c 20 22 73 65 74 75 70 5f 6c 6f 67 69 6e 5f 67 , "setup_login_g
0eb0: 72 6f 75 70 22 2c 0a 20 20 20 20 20 20 22 4d 61 roup",. "Ma
0ec0: 6e 61 67 65 20 73 69 6e 67 6c 65 20 73 69 67 6e nage single sign
0ed0: 2d 6f 6e 20 62 65 74 77 65 65 6e 20 74 68 69 73 -on between this
0ee0: 20 72 65 70 6f 73 69 74 6f 72 79 20 61 6e 64 20 repository and
0ef0: 6f 74 68 65 72 73 22 0a 20 20 20 20 20 20 22 20 others". "
0f00: 6f 6e 20 74 68 65 20 73 61 6d 65 20 73 65 72 76 on the same serv
0f10: 65 72 22 29 3b 0a 20 20 20 20 73 65 74 75 70 5f er");. setup_
0f20: 6d 65 6e 75 5f 65 6e 74 72 79 28 22 54 69 63 6b menu_entry("Tick
0f30: 65 74 73 22 2c 20 22 74 6b 74 73 65 74 75 70 22 ets", "tktsetup"
0f40: 2c 0a 20 20 20 20 20 20 22 43 6f 6e 66 69 67 75 ,. "Configu
0f50: 72 65 20 74 68 65 20 74 72 6f 75 62 6c 65 2d 74 re the trouble-t
0f60: 69 63 6b 65 74 69 6e 67 20 73 79 73 74 65 6d 20 icketing system
0f70: 66 6f 72 20 74 68 69 73 20 72 65 70 6f 73 69 74 for this reposit
0f80: 6f 72 79 22 29 3b 0a 20 20 20 20 73 65 74 75 70 ory");. setup
0f90: 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 57 69 6b _menu_entry("Wik
0fa0: 69 22 2c 20 22 73 65 74 75 70 5f 77 69 6b 69 22 i", "setup_wiki"
0fb0: 2c 0a 20 20 20 20 20 20 22 43 6f 6e 66 69 67 75 ,. "Configu
0fc0: 72 65 20 74 68 65 20 77 69 6b 69 20 66 6f 72 20 re the wiki for
0fd0: 74 68 69 73 20 72 65 70 6f 73 69 74 6f 72 79 22 this repository"
0fe0: 29 3b 0a 20 20 7d 0a 20 20 73 65 74 75 70 5f 6d );. }. setup_m
0ff0: 65 6e 75 5f 65 6e 74 72 79 28 22 53 65 61 72 63 enu_entry("Searc
1000: 68 22 2c 22 73 72 63 68 73 65 74 75 70 22 2c 0a h","srchsetup",.
1010: 20 20 20 20 22 43 6f 6e 66 69 67 75 72 65 20 74 "Configure t
1020: 68 65 20 62 75 69 6c 74 2d 69 6e 20 73 65 61 72 he built-in sear
1030: 63 68 20 65 6e 67 69 6e 65 22 29 3b 0a 20 20 73 ch engine");. s
1040: 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 etup_menu_entry(
1050: 22 55 52 4c 20 41 6c 69 61 73 65 73 22 2c 20 22 "URL Aliases", "
1060: 77 61 6c 69 61 73 73 65 74 75 70 22 2c 0a 20 20 waliassetup",.
1070: 20 20 22 43 6f 6e 66 69 67 75 72 65 20 55 52 4c "Configure URL
1080: 20 61 6c 69 61 73 65 73 22 29 3b 0a 20 20 69 66 aliases");. if
1090: 28 20 73 65 74 75 70 5f 75 73 65 72 20 29 7b 0a ( setup_user ){.
10a0: 20 20 20 20 73 65 74 75 70 5f 6d 65 6e 75 5f 65 setup_menu_e
10b0: 6e 74 72 79 28 22 4e 6f 74 69 66 69 63 61 74 69 ntry("Notificati
10c0: 6f 6e 22 2c 20 22 73 65 74 75 70 5f 6e 6f 74 69 on", "setup_noti
10d0: 66 69 63 61 74 69 6f 6e 22 2c 0a 20 20 20 20 20 fication",.
10e0: 20 22 41 75 74 6f 6d 61 74 69 63 20 6e 6f 74 69 "Automatic noti
10f0: 66 69 63 61 74 69 6f 6e 73 20 6f 66 20 63 68 61 fications of cha
1100: 6e 67 65 73 20 76 69 61 20 6f 75 74 62 6f 75 6e nges via outboun
1110: 64 20 65 6d 61 69 6c 22 29 3b 0a 20 20 20 20 73 d email");. s
1120: 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 etup_menu_entry(
1130: 22 45 6d 61 69 6c 2d 53 65 72 76 65 72 22 2c 20 "Email-Server",
1140: 22 73 65 74 75 70 5f 73 6d 74 70 22 2c 0a 20 20 "setup_smtp",.
1150: 20 20 20 20 22 41 63 74 69 76 61 74 65 20 61 6e "Activate an
1160: 64 20 63 6f 6e 66 69 67 75 72 65 20 74 68 65 20 d configure the
1170: 62 75 69 6c 74 2d 69 6e 20 65 6d 61 69 6c 20 73 built-in email s
1180: 65 72 76 65 72 22 29 3b 0a 20 20 20 20 73 65 74 erver");. set
1190: 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 54 up_menu_entry("T
11a0: 72 61 6e 73 66 65 72 73 22 2c 20 22 78 66 65 72 ransfers", "xfer
11b0: 73 65 74 75 70 22 2c 0a 20 20 20 20 20 20 22 43 setup",. "C
11c0: 6f 6e 66 69 67 75 72 65 20 74 68 65 20 74 72 61 onfigure the tra
11d0: 6e 73 66 65 72 20 73 79 73 74 65 6d 20 66 6f 72 nsfer system for
11e0: 20 74 68 69 73 20 72 65 70 6f 73 69 74 6f 72 79 this repository
11f0: 22 29 3b 0a 20 20 7d 0a 20 20 73 65 74 75 70 5f ");. }. setup_
1200: 6d 65 6e 75 5f 65 6e 74 72 79 28 22 53 6b 69 6e menu_entry("Skin
1210: 73 22 2c 20 22 73 65 74 75 70 5f 73 6b 69 6e 22 s", "setup_skin"
1220: 2c 0a 20 20 20 20 22 53 65 6c 65 63 74 20 61 6e ,. "Select an
1230: 64 2f 6f 72 20 6d 6f 64 69 66 79 20 74 68 65 20 d/or modify the
1240: 77 65 62 20 69 6e 74 65 72 66 61 63 65 20 5c 22 web interface \"
1250: 73 6b 69 6e 73 5c 22 22 29 3b 0a 20 20 73 65 74 skins\"");. set
1260: 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 4d up_menu_entry("M
1270: 6f 64 65 72 61 74 69 6f 6e 22 2c 20 22 73 65 74 oderation", "set
1280: 75 70 5f 6d 6f 64 72 65 71 22 2c 0a 20 20 20 20 up_modreq",.
1290: 22 45 6e 61 62 6c 65 2f 44 69 73 61 62 6c 65 20 "Enable/Disable
12a0: 72 65 71 75 69 72 69 6e 67 20 6d 6f 64 65 72 61 requiring modera
12b0: 74 6f 72 20 61 70 70 72 6f 76 61 6c 20 6f 66 20 tor approval of
12c0: 57 69 6b 69 20 61 6e 64 2f 6f 72 20 54 69 63 6b Wiki and/or Tick
12d0: 65 74 22 0a 20 20 20 20 22 20 63 68 61 6e 67 65 et". " change
12e0: 73 20 61 6e 64 20 61 74 74 61 63 68 6d 65 6e 74 s and attachment
12f0: 73 2e 22 29 3b 0a 20 20 73 65 74 75 70 5f 6d 65 s.");. setup_me
1300: 6e 75 5f 65 6e 74 72 79 28 22 41 64 2d 55 6e 69 nu_entry("Ad-Uni
1310: 74 22 2c 20 22 73 65 74 75 70 5f 61 64 75 6e 69 t", "setup_aduni
1320: 74 22 2c 0a 20 20 20 20 22 45 64 69 74 20 48 54 t",. "Edit HT
1330: 4d 4c 20 74 65 78 74 20 66 6f 72 20 61 6e 20 61 ML text for an a
1340: 64 20 75 6e 69 74 20 69 6e 73 65 72 74 65 64 20 d unit inserted
1350: 61 66 74 65 72 20 74 68 65 20 6d 65 6e 75 20 62 after the menu b
1360: 61 72 22 29 3b 0a 20 20 73 65 74 75 70 5f 6d 65 ar");. setup_me
1370: 6e 75 5f 65 6e 74 72 79 28 22 55 52 4c 73 20 26 nu_entry("URLs &
1380: 20 43 68 65 63 6b 6f 75 74 73 22 2c 20 22 75 72 Checkouts", "ur
1390: 6c 6c 69 73 74 22 2c 0a 20 20 20 20 22 53 68 6f llist",. "Sho
13a0: 77 20 55 52 4c 73 20 75 73 65 64 20 74 6f 20 61 w URLs used to a
13b0: 63 63 65 73 73 20 74 68 69 73 20 72 65 70 6f 20 ccess this repo
13c0: 61 6e 64 20 6b 6e 6f 77 6e 20 63 68 65 63 6b 2d and known check-
13d0: 6f 75 74 73 22 29 3b 0a 20 20 69 66 28 20 73 65 outs");. if( se
13e0: 74 75 70 5f 75 73 65 72 20 29 7b 0a 20 20 20 20 tup_user ){.
13f0: 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 setup_menu_entry
1400: 28 22 57 65 62 2d 43 61 63 68 65 22 2c 20 22 63 ("Web-Cache", "c
1410: 61 63 68 65 73 74 61 74 22 2c 0a 20 20 20 20 20 achestat",.
1420: 20 22 56 69 65 77 20 74 68 65 20 73 74 61 74 75 "View the statu
1430: 73 20 6f 66 20 74 68 65 20 65 78 70 65 6e 73 69 s of the expensi
1440: 76 65 2d 70 61 67 65 20 63 61 63 68 65 22 29 3b ve-page cache");
1450: 0a 20 20 7d 0a 20 20 73 65 74 75 70 5f 6d 65 6e . }. setup_men
1460: 75 5f 65 6e 74 72 79 28 22 4c 6f 67 6f 22 2c 20 u_entry("Logo",
1470: 22 73 65 74 75 70 5f 6c 6f 67 6f 22 2c 0a 20 20 "setup_logo",.
1480: 20 20 22 43 68 61 6e 67 65 20 74 68 65 20 6c 6f "Change the lo
1490: 67 6f 20 61 6e 64 20 62 61 63 6b 67 72 6f 75 6e go and backgroun
14a0: 64 20 69 6d 61 67 65 73 20 66 6f 72 20 74 68 65 d images for the
14b0: 20 73 65 72 76 65 72 22 29 3b 0a 20 20 73 65 74 server");. set
14c0: 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 53 up_menu_entry("S
14d0: 68 75 6e 6e 65 64 22 2c 20 22 73 68 75 6e 22 2c hunned", "shun",
14e0: 0a 20 20 20 20 22 53 68 6f 77 20 61 72 74 69 66 . "Show artif
14f0: 61 63 74 73 20 74 68 61 74 20 61 72 65 20 73 68 acts that are sh
1500: 75 6e 6e 65 64 20 62 79 20 74 68 69 73 20 72 65 unned by this re
1510: 70 6f 73 69 74 6f 72 79 22 29 3b 0a 20 20 73 65 pository");. se
1520: 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 tup_menu_entry("
1530: 41 72 74 69 66 61 63 74 20 52 65 63 65 69 70 74 Artifact Receipt
1540: 73 20 4c 6f 67 22 2c 20 22 72 63 76 66 72 6f 6d s Log", "rcvfrom
1550: 6c 69 73 74 22 2c 0a 20 20 20 20 22 41 20 72 65 list",. "A re
1560: 63 6f 72 64 20 6f 66 20 72 65 63 65 69 76 65 64 cord of received
1570: 20 61 72 74 69 66 61 63 74 73 20 61 6e 64 20 74 artifacts and t
1580: 68 65 69 72 20 73 6f 75 72 63 65 73 22 29 3b 0a heir sources");.
1590: 20 20 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 setup_menu_ent
15a0: 72 79 28 22 55 73 65 72 20 4c 6f 67 22 2c 20 22 ry("User Log", "
15b0: 61 63 63 65 73 73 5f 6c 6f 67 22 2c 0a 20 20 20 access_log",.
15c0: 20 22 41 20 72 65 63 6f 72 64 20 6f 66 20 6c 6f "A record of lo
15d0: 67 69 6e 20 61 74 74 65 6d 70 74 73 22 29 3b 0a gin attempts");.
15e0: 20 20 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 setup_menu_ent
15f0: 72 79 28 22 41 64 6d 69 6e 69 73 74 72 61 74 69 ry("Administrati
1600: 76 65 20 4c 6f 67 22 2c 20 22 61 64 6d 69 6e 5f ve Log", "admin_
1610: 6c 6f 67 22 2c 0a 20 20 20 20 22 56 69 65 77 20 log",. "View
1620: 74 68 65 20 61 64 6d 69 6e 5f 6c 6f 67 20 65 6e the admin_log en
1630: 74 72 69 65 73 22 29 3b 0a 20 20 73 65 74 75 70 tries");. setup
1640: 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 45 72 72 _menu_entry("Err
1650: 6f 72 20 4c 6f 67 22 2c 20 22 65 72 72 6f 72 6c or Log", "errorl
1660: 6f 67 22 2c 0a 20 20 20 20 22 56 69 65 77 20 74 og",. "View t
1670: 68 65 20 46 6f 73 73 69 6c 20 73 65 72 76 65 72 he Fossil server
1680: 20 65 72 72 6f 72 20 6c 6f 67 22 29 3b 0a 20 20 error log");.
1690: 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 setup_menu_entry
16a0: 28 22 55 6e 76 65 72 73 69 6f 6e 65 64 20 46 69 ("Unversioned Fi
16b0: 6c 65 73 22 2c 20 22 75 76 6c 69 73 74 3f 62 79 les", "uvlist?by
16c0: 61 67 65 3d 31 22 2c 0a 20 20 20 20 22 53 68 6f age=1",. "Sho
16d0: 77 20 61 6c 6c 20 75 6e 76 65 72 73 69 6f 6e 65 w all unversione
16e0: 64 20 66 69 6c 65 73 20 68 65 6c 64 22 29 3b 0a d files held");.
16f0: 20 20 73 65 74 75 70 5f 6d 65 6e 75 5f 65 6e 74 setup_menu_ent
1700: 72 79 28 22 53 74 61 74 73 22 2c 20 22 73 74 61 ry("Stats", "sta
1710: 74 22 2c 0a 20 20 20 20 22 52 65 70 6f 73 69 74 t",. "Reposit
1720: 6f 72 79 20 53 74 61 74 75 73 20 52 65 70 6f 72 ory Status Repor
1730: 74 73 22 29 3b 0a 20 20 73 65 74 75 70 5f 6d 65 ts");. setup_me
1740: 6e 75 5f 65 6e 74 72 79 28 22 53 69 74 65 6d 61 nu_entry("Sitema
1750: 70 22 2c 20 22 73 69 74 65 6d 61 70 22 2c 0a 20 p", "sitemap",.
1760: 20 20 20 22 4c 69 6e 6b 73 20 74 6f 20 6d 69 73 "Links to mis
1770: 63 65 6c 6c 61 6e 65 6f 75 73 20 70 61 67 65 73 cellaneous pages
1780: 22 29 3b 0a 20 20 69 66 28 20 73 65 74 75 70 5f ");. if( setup_
1790: 75 73 65 72 20 29 7b 0a 20 20 20 20 73 65 74 75 user ){. setu
17a0: 70 5f 6d 65 6e 75 5f 65 6e 74 72 79 28 22 53 51 p_menu_entry("SQ
17b0: 4c 22 2c 20 22 61 64 6d 69 6e 5f 73 71 6c 22 2c L", "admin_sql",
17c0: 0a 20 20 20 20 20 20 22 45 6e 74 65 72 20 72 61 . "Enter ra
17d0: 77 20 53 51 4c 20 63 6f 6d 6d 61 6e 64 73 22 29 w SQL commands")
17e0: 3b 0a 20 20 20 20 73 65 74 75 70 5f 6d 65 6e 75 ;. setup_menu
17f0: 5f 65 6e 74 72 79 28 22 54 48 31 22 2c 20 22 61 _entry("TH1", "a
1800: 64 6d 69 6e 5f 74 68 31 22 2c 0a 20 20 20 20 20 dmin_th1",.
1810: 20 22 45 6e 74 65 72 20 72 61 77 20 54 48 31 20 "Enter raw TH1
1820: 63 6f 6d 6d 61 6e 64 73 22 29 3b 0a 20 20 7d 0a commands");. }.
1830: 20 20 40 20 3c 2f 74 61 62 6c 65 3e 0a 0a 20 20 @ </table>..
1840: 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a style_footer();.
1850: 7d 0a 0a 2f 2a 0a 2a 2a 20 47 65 6e 65 72 61 74 }../*.** Generat
1860: 65 20 61 20 63 68 65 63 6b 62 6f 78 20 66 6f 72 e a checkbox for
1870: 20 61 6e 20 61 74 74 72 69 62 75 74 65 2e 0a 2a an attribute..*
1880: 2f 0a 76 6f 69 64 20 6f 6e 6f 66 66 5f 61 74 74 /.void onoff_att
1890: 72 69 62 75 74 65 28 0a 20 20 63 6f 6e 73 74 20 ribute(. const
18a0: 63 68 61 72 20 2a 7a 4c 61 62 65 6c 2c 20 20 20 char *zLabel,
18b0: 2f 2a 20 54 68 65 20 74 65 78 74 20 6c 61 62 65 /* The text labe
18c0: 6c 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 62 6f l on the checkbo
18d0: 78 20 2a 2f 0a 20 20 63 6f 6e 73 74 20 63 68 61 x */. const cha
18e0: 72 20 2a 7a 56 61 72 2c 20 20 20 20 20 2f 2a 20 r *zVar, /*
18f0: 54 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e The correspondin
1900: 67 20 72 6f 77 20 69 6e 20 74 68 65 20 56 41 52 g row in the VAR
1910: 20 74 61 62 6c 65 20 2a 2f 0a 20 20 63 6f 6e 73 table */. cons
1920: 74 20 63 68 61 72 20 2a 7a 51 50 61 72 6d 2c 20 t char *zQParm,
1930: 20 20 2f 2a 20 54 68 65 20 71 75 65 72 79 20 70 /* The query p
1940: 61 72 61 6d 65 74 65 72 20 2a 2f 0a 20 20 69 6e arameter */. in
1950: 74 20 64 66 6c 74 56 61 6c 2c 20 20 20 20 20 20 t dfltVal,
1960: 20 20 20 20 2f 2a 20 44 65 66 61 75 6c 74 20 76 /* Default v
1970: 61 6c 75 65 20 69 66 20 56 41 52 20 74 61 62 6c alue if VAR tabl
1980: 65 20 65 6e 74 72 79 20 64 6f 65 73 20 6e 6f 74 e entry does not
1990: 20 65 78 69 73 74 20 2a 2f 0a 20 20 69 6e 74 20 exist */. int
19a0: 64 69 73 61 62 6c 65 64 20 20 20 20 20 20 20 20 disabled
19b0: 20 20 2f 2a 20 31 20 69 66 20 64 69 73 61 62 6c /* 1 if disabl
19c0: 65 64 20 2a 2f 0a 29 7b 0a 20 20 63 6f 6e 73 74 ed */.){. const
19d0: 20 63 68 61 72 20 2a 7a 51 20 3d 20 50 28 7a 51 char *zQ = P(zQ
19e0: 50 61 72 6d 29 3b 0a 20 20 69 6e 74 20 69 56 61 Parm);. int iVa
19f0: 6c 20 3d 20 64 62 5f 67 65 74 5f 62 6f 6f 6c 65 l = db_get_boole
1a00: 61 6e 28 7a 56 61 72 2c 20 64 66 6c 74 56 61 6c an(zVar, dfltVal
1a10: 29 3b 0a 20 20 69 66 28 20 7a 51 3d 3d 30 20 26 );. if( zQ==0 &
1a20: 26 20 21 64 69 73 61 62 6c 65 64 20 26 26 20 50 & !disabled && P
1a30: 28 22 73 75 62 6d 69 74 22 29 20 29 7b 0a 20 20 ("submit") ){.
1a40: 20 20 7a 51 20 3d 20 22 6f 66 66 22 3b 0a 20 20 zQ = "off";.
1a50: 7d 0a 20 20 69 66 28 20 7a 51 20 29 7b 0a 20 20 }. if( zQ ){.
1a60: 20 20 69 6e 74 20 69 51 20 3d 20 66 6f 73 73 69 int iQ = fossi
1a70: 6c 5f 73 74 72 63 6d 70 28 7a 51 2c 22 6f 6e 22 l_strcmp(zQ,"on"
1a80: 29 3d 3d 30 20 7c 7c 20 61 74 6f 69 28 7a 51 29 )==0 || atoi(zQ)
1a90: 3b 0a 20 20 20 20 69 66 28 20 69 51 21 3d 69 56 ;. if( iQ!=iV
1aa0: 61 6c 20 29 7b 0a 20 20 20 20 20 20 6c 6f 67 69 al ){. logi
1ab0: 6e 5f 76 65 72 69 66 79 5f 63 73 72 66 5f 73 65 n_verify_csrf_se
1ac0: 63 72 65 74 28 29 3b 0a 20 20 20 20 20 20 64 62 cret();. db
1ad0: 5f 70 72 6f 74 65 63 74 5f 6f 6e 6c 79 28 50 52 _protect_only(PR
1ae0: 4f 54 45 43 54 5f 4e 4f 4e 45 29 3b 0a 20 20 20 OTECT_NONE);.
1af0: 20 20 20 64 62 5f 73 65 74 28 7a 56 61 72 2c 20 db_set(zVar,
1b00: 69 51 20 3f 20 22 31 22 20 3a 20 22 30 22 2c 20 iQ ? "1" : "0",
1b10: 30 29 3b 0a 20 20 20 20 20 20 64 62 5f 70 72 6f 0);. db_pro
1b20: 74 65 63 74 5f 70 6f 70 28 29 3b 0a 20 20 20 20 tect_pop();.
1b30: 20 20 73 65 74 75 70 5f 69 6e 63 72 5f 63 66 67 setup_incr_cfg
1b40: 63 6e 74 28 29 3b 0a 20 20 20 20 20 20 61 64 6d cnt();. adm
1b50: 69 6e 5f 6c 6f 67 28 22 53 65 74 20 6f 70 74 69 in_log("Set opti
1b60: 6f 6e 20 5b 25 71 5d 20 74 6f 20 5b 25 71 5d 2e on [%q] to [%q].
1b70: 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ",.
1b80: 20 20 20 7a 56 61 72 2c 20 69 51 20 3f 20 22 6f zVar, iQ ? "o
1b90: 6e 22 20 3a 20 22 6f 66 66 22 29 3b 0a 20 20 20 n" : "off");.
1ba0: 20 20 20 69 56 61 6c 20 3d 20 69 51 3b 0a 20 20 iVal = iQ;.
1bb0: 20 20 7d 0a 20 20 7d 0a 20 20 40 20 3c 6c 61 62 }. }. @ <lab
1bc0: 65 6c 3e 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 el><input type="
1bd0: 63 68 65 63 6b 62 6f 78 22 20 6e 61 6d 65 3d 22 checkbox" name="
1be0: 25 73 28 7a 51 50 61 72 6d 29 22 20 5c 0a 20 20 %s(zQParm)" \.
1bf0: 40 20 61 72 69 61 2d 6c 61 62 65 6c 3d 22 25 73 @ aria-label="%s
1c00: 28 7a 4c 61 62 65 6c 5b 30 5d 3f 7a 4c 61 62 65 (zLabel[0]?zLabe
1c10: 6c 3a 7a 51 50 61 72 6d 29 22 20 5c 0a 20 20 69 l:zQParm)" \. i
1c20: 66 28 20 69 56 61 6c 20 29 7b 0a 20 20 20 20 40 f( iVal ){. @
1c30: 20 63 68 65 63 6b 65 64 3d 22 63 68 65 63 6b 65 checked="checke
1c40: 64 22 20 5c 0a 20 20 7d 0a 20 20 69 66 28 20 64 d" \. }. if( d
1c50: 69 73 61 62 6c 65 64 20 29 7b 0a 20 20 20 20 40 isabled ){. @
1c60: 20 64 69 73 61 62 6c 65 64 3d 22 64 69 73 61 62 disabled="disab
1c70: 6c 65 64 22 20 5c 0a 20 20 7d 0a 20 20 40 20 2f led" \. }. @ /
1c80: 3e 20 3c 62 3e 25 73 28 7a 4c 61 62 65 6c 29 3c > <b>%s(zLabel)<
1c90: 2f 62 3e 3c 2f 6c 61 62 65 6c 3e 0a 7d 0a 0a 2f /b></label>.}../
1ca0: 2a 0a 2a 2a 20 47 65 6e 65 72 61 74 65 20 61 6e *.** Generate an
1cb0: 20 65 6e 74 72 79 20 62 6f 78 20 66 6f 72 20 61 entry box for a
1cc0: 6e 20 61 74 74 72 69 62 75 74 65 2e 0a 2a 2f 0a n attribute..*/.
1cd0: 76 6f 69 64 20 65 6e 74 72 79 5f 61 74 74 72 69 void entry_attri
1ce0: 62 75 74 65 28 0a 20 20 63 6f 6e 73 74 20 63 68 bute(. const ch
1cf0: 61 72 20 2a 7a 4c 61 62 65 6c 2c 20 20 20 2f 2a ar *zLabel, /*
1d00: 20 54 68 65 20 74 65 78 74 20 6c 61 62 65 6c 20 The text label
1d10: 6f 6e 20 74 68 65 20 65 6e 74 72 79 20 62 6f 78 on the entry box
1d20: 20 2a 2f 0a 20 20 69 6e 74 20 77 69 64 74 68 2c */. int width,
1d30: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 57 /* W
1d40: 69 64 74 68 20 6f 66 20 74 68 65 20 65 6e 74 72 idth of the entr
1d50: 79 20 62 6f 78 20 2a 2f 0a 20 20 63 6f 6e 73 74 y box */. const
1d60: 20 63 68 61 72 20 2a 7a 56 61 72 2c 20 20 20 20 char *zVar,
1d70: 20 2f 2a 20 54 68 65 20 63 6f 72 72 65 73 70 6f /* The correspo
1d80: 6e 64 69 6e 67 20 72 6f 77 20 69 6e 20 74 68 65 nding row in the
1d90: 20 56 41 52 20 74 61 62 6c 65 20 2a 2f 0a 20 20 VAR table */.
1da0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 51 50 61 const char *zQPa
1db0: 72 6d 2c 20 20 20 2f 2a 20 54 68 65 20 71 75 65 rm, /* The que
1dc0: 72 79 20 70 61 72 61 6d 65 74 65 72 20 2a 2f 0a ry parameter */.
1dd0: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 const char *zD
1de0: 66 6c 74 2c 20 20 20 20 2f 2a 20 44 65 66 61 75 flt, /* Defau
1df0: 6c 74 20 76 61 6c 75 65 20 69 66 20 56 41 52 20 lt value if VAR
1e00: 74 61 62 6c 65 20 65 6e 74 72 79 20 64 6f 65 73 table entry does
1e10: 20 6e 6f 74 20 65 78 69 73 74 20 2a 2f 0a 20 20 not exist */.
1e20: 69 6e 74 20 64 69 73 61 62 6c 65 64 20 20 20 20 int disabled
1e30: 20 20 20 20 20 20 2f 2a 20 31 20 69 66 20 64 69 /* 1 if di
1e40: 73 61 62 6c 65 64 20 2a 2f 0a 29 7b 0a 20 20 63 sabled */.){. c
1e50: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 56 61 6c 20 onst char *zVal
1e60: 3d 20 64 62 5f 67 65 74 28 7a 56 61 72 2c 20 7a = db_get(zVar, z
1e70: 44 66 6c 74 29 3b 0a 20 20 63 6f 6e 73 74 20 63 Dflt);. const c
1e80: 68 61 72 20 2a 7a 51 20 3d 20 50 28 7a 51 50 61 har *zQ = P(zQPa
1e90: 72 6d 29 3b 0a 20 20 69 66 28 20 7a 51 20 26 26 rm);. if( zQ &&
1ea0: 20 66 6f 73 73 69 6c 5f 73 74 72 63 6d 70 28 7a fossil_strcmp(z
1eb0: 51 2c 7a 56 61 6c 29 21 3d 30 20 29 7b 0a 20 20 Q,zVal)!=0 ){.
1ec0: 20 20 63 6f 6e 73 74 20 69 6e 74 20 6e 5a 51 20 const int nZQ
1ed0: 3d 20 28 69 6e 74 29 73 74 72 6c 65 6e 28 7a 51 = (int)strlen(zQ
1ee0: 29 3b 0a 20 20 20 20 6c 6f 67 69 6e 5f 76 65 72 );. login_ver
1ef0: 69 66 79 5f 63 73 72 66 5f 73 65 63 72 65 74 28 ify_csrf_secret(
1f00: 29 3b 0a 20 20 20 20 73 65 74 75 70 5f 69 6e 63 );. setup_inc
1f10: 72 5f 63 66 67 63 6e 74 28 29 3b 0a 20 20 20 20 r_cfgcnt();.
1f20: 64 62 5f 70 72 6f 74 65 63 74 5f 6f 6e 6c 79 28 db_protect_only(
1f30: 50 52 4f 54 45 43 54 5f 4e 4f 4e 45 29 3b 0a 20 PROTECT_NONE);.
1f40: 20 20 20 64 62 5f 73 65 74 28 7a 56 61 72 2c 20 db_set(zVar,
1f50: 7a 51 2c 20 30 29 3b 0a 20 20 20 20 64 62 5f 70 zQ, 0);. db_p
1f60: 72 6f 74 65 63 74 5f 70 6f 70 28 29 3b 0a 20 20 rotect_pop();.
1f70: 20 20 61 64 6d 69 6e 5f 6c 6f 67 28 22 53 65 74 admin_log("Set
1f80: 20 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 65 entry_attribute
1f90: 20 25 51 20 74 6f 3a 20 25 2e 2a 73 25 73 22 2c %Q to: %.*s%s",
1fa0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7a . z
1fb0: 56 61 72 2c 20 32 30 2c 20 7a 51 2c 20 28 6e 5a Var, 20, zQ, (nZ
1fc0: 51 3e 32 30 20 3f 20 22 2e 2e 2e 22 20 3a 20 22 Q>20 ? "..." : "
1fd0: 22 29 29 3b 0a 20 20 20 20 7a 56 61 6c 20 3d 20 "));. zVal =
1fe0: 7a 51 3b 0a 20 20 7d 0a 20 20 40 20 3c 69 6e 70 zQ;. }. @ <inp
1ff0: 75 74 20 61 72 69 61 2d 6c 61 62 65 6c 3d 22 25 ut aria-label="%
2000: 68 28 7a 4c 61 62 65 6c 5b 30 5d 3f 7a 4c 61 62 h(zLabel[0]?zLab
2010: 65 6c 3a 7a 51 50 61 72 6d 29 22 20 74 79 70 65 el:zQParm)" type
2020: 3d 22 74 65 78 74 22 20 5c 0a 20 20 40 20 69 64 ="text" \. @ id
2030: 3d 22 25 73 28 7a 51 50 61 72 6d 29 22 20 6e 61 ="%s(zQParm)" na
2040: 6d 65 3d 22 25 73 28 7a 51 50 61 72 6d 29 22 20 me="%s(zQParm)"
2050: 76 61 6c 75 65 3d 22 25 68 28 7a 56 61 6c 29 22 value="%h(zVal)"
2060: 20 73 69 7a 65 3d 22 25 64 28 77 69 64 74 68 29 size="%d(width)
2070: 22 20 5c 0a 20 20 69 66 28 20 64 69 73 61 62 6c " \. if( disabl
2080: 65 64 20 29 7b 0a 20 20 20 20 40 20 64 69 73 61 ed ){. @ disa
2090: 62 6c 65 64 3d 22 64 69 73 61 62 6c 65 64 22 20 bled="disabled"
20a0: 5c 0a 20 20 7d 0a 20 20 40 20 2f 3e 20 3c 62 3e \. }. @ /> <b>
20b0: 25 73 28 7a 4c 61 62 65 6c 29 3c 2f 62 3e 0a 7d %s(zLabel)</b>.}
20c0: 0a 0a 2f 2a 0a 2a 2a 20 47 65 6e 65 72 61 74 65 ../*.** Generate
20d0: 20 61 20 74 65 78 74 20 62 6f 78 20 66 6f 72 20 a text box for
20e0: 61 6e 20 61 74 74 72 69 62 75 74 65 2e 0a 2a 2f an attribute..*/
20f0: 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a 74 65 78 .const char *tex
2100: 74 61 72 65 61 5f 61 74 74 72 69 62 75 74 65 28 tarea_attribute(
2110: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a . const char *z
2120: 4c 61 62 65 6c 2c 20 20 20 2f 2a 20 54 68 65 20 Label, /* The
2130: 74 65 78 74 20 6c 61 62 65 6c 20 6f 6e 20 74 68 text label on th
2140: 65 20 74 65 78 74 61 72 65 61 20 2a 2f 0a 20 20 e textarea */.
2150: 69 6e 74 20 72 6f 77 73 2c 20 20 20 20 20 20 20 int rows,
2160: 20 20 20 20 20 20 2f 2a 20 52 6f 77 73 20 69 6e /* Rows in
2170: 20 74 68 65 20 74 65 78 74 61 72 65 61 20 2a 2f the textarea */
2180: 0a 20 20 69 6e 74 20 63 6f 6c 73 2c 20 20 20 20 . int cols,
2190: 20 20 20 20 20 20 20 20 20 2f 2a 20 43 6f 6c 75 /* Colu
21a0: 6d 6e 73 20 69 6e 20 74 68 65 20 74 65 78 74 61 mns in the texta
21b0: 72 65 61 20 2a 2f 0a 20 20 63 6f 6e 73 74 20 63 rea */. const c
21c0: 68 61 72 20 2a 7a 56 61 72 2c 20 20 20 20 20 2f har *zVar, /
21d0: 2a 20 54 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 * The correspond
21e0: 69 6e 67 20 72 6f 77 20 69 6e 20 74 68 65 20 56 ing row in the V
21f0: 41 52 20 74 61 62 6c 65 20 2a 2f 0a 20 20 63 6f AR table */. co
2200: 6e 73 74 20 63 68 61 72 20 2a 7a 51 50 2c 20 20 nst char *zQP,
2210: 20 20 20 20 2f 2a 20 54 68 65 20 71 75 65 72 79 /* The query
2220: 20 70 61 72 61 6d 65 74 65 72 20 2a 2f 0a 20 20 parameter */.
2230: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 66 6c const char *zDfl
2240: 74 2c 20 20 20 20 2f 2a 20 44 65 66 61 75 6c 74 t, /* Default
2250: 20 76 61 6c 75 65 20 69 66 20 56 41 52 20 74 61 value if VAR ta
2260: 62 6c 65 20 65 6e 74 72 79 20 64 6f 65 73 20 6e ble entry does n
2270: 6f 74 20 65 78 69 73 74 20 2a 2f 0a 20 20 69 6e ot exist */. in
2280: 74 20 64 69 73 61 62 6c 65 64 20 20 20 20 20 20 t disabled
2290: 20 20 20 20 2f 2a 20 31 20 69 66 20 74 68 65 20 /* 1 if the
22a0: 74 65 78 74 61 72 65 61 20 73 68 6f 75 6c 64 20 textarea should
22b0: 20 6e 6f 74 20 62 65 20 65 64 69 74 61 62 6c 65 not be editable
22c0: 20 2a 2f 0a 29 7b 0a 20 20 63 6f 6e 73 74 20 63 */.){. const c
22d0: 68 61 72 20 2a 7a 20 3d 20 64 62 5f 67 65 74 28 har *z = db_get(
22e0: 7a 56 61 72 2c 20 7a 44 66 6c 74 29 3b 0a 20 20 zVar, zDflt);.
22f0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 51 20 3d const char *zQ =
2300: 20 50 28 7a 51 50 29 3b 0a 20 20 69 66 28 20 7a P(zQP);. if( z
2310: 51 20 26 26 20 21 64 69 73 61 62 6c 65 64 20 26 Q && !disabled &
2320: 26 20 66 6f 73 73 69 6c 5f 73 74 72 63 6d 70 28 & fossil_strcmp(
2330: 7a 51 2c 7a 29 21 3d 30 29 7b 0a 20 20 20 20 63 zQ,z)!=0){. c
2340: 6f 6e 73 74 20 69 6e 74 20 6e 5a 51 20 3d 20 28 onst int nZQ = (
2350: 69 6e 74 29 73 74 72 6c 65 6e 28 7a 51 29 3b 0a int)strlen(zQ);.
2360: 20 20 20 20 6c 6f 67 69 6e 5f 76 65 72 69 66 79 login_verify
2370: 5f 63 73 72 66 5f 73 65 63 72 65 74 28 29 3b 0a _csrf_secret();.
2380: 20 20 20 20 64 62 5f 70 72 6f 74 65 63 74 5f 6f db_protect_o
2390: 6e 6c 79 28 50 52 4f 54 45 43 54 5f 4e 4f 4e 45 nly(PROTECT_NONE
23a0: 29 3b 0a 20 20 20 20 64 62 5f 73 65 74 28 7a 56 );. db_set(zV
23b0: 61 72 2c 20 7a 51 2c 20 30 29 3b 0a 20 20 20 20 ar, zQ, 0);.
23c0: 64 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 28 29 db_protect_pop()
23d0: 3b 0a 20 20 20 20 73 65 74 75 70 5f 69 6e 63 72 ;. setup_incr
23e0: 5f 63 66 67 63 6e 74 28 29 3b 0a 20 20 20 20 61 _cfgcnt();. a
23f0: 64 6d 69 6e 5f 6c 6f 67 28 22 53 65 74 20 74 65 dmin_log("Set te
2400: 78 74 61 72 65 61 5f 61 74 74 72 69 62 75 74 65 xtarea_attribute
2410: 20 25 51 20 74 6f 3a 20 25 2e 2a 73 25 73 22 2c %Q to: %.*s%s",
2420: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7a . z
2430: 56 61 72 2c 20 32 30 2c 20 7a 51 2c 20 28 6e 5a Var, 20, zQ, (nZ
2440: 51 3e 32 30 20 3f 20 22 2e 2e 2e 22 20 3a 20 22 Q>20 ? "..." : "
2450: 22 29 29 3b 0a 20 20 20 20 7a 20 3d 20 7a 51 3b "));. z = zQ;
2460: 0a 20 20 7d 0a 20 20 69 66 28 20 72 6f 77 73 3e . }. if( rows>
2470: 30 20 26 26 20 63 6f 6c 73 3e 30 20 29 7b 0a 20 0 && cols>0 ){.
2480: 20 20 20 40 20 3c 74 65 78 74 61 72 65 61 20 69 @ <textarea i
2490: 64 3d 22 69 64 25 73 28 7a 51 50 29 22 20 6e 61 d="id%s(zQP)" na
24a0: 6d 65 3d 22 25 73 28 7a 51 50 29 22 20 72 6f 77 me="%s(zQP)" row
24b0: 73 3d 22 25 64 28 72 6f 77 73 29 22 20 5c 0a 20 s="%d(rows)" \.
24c0: 20 20 20 40 20 61 72 69 61 2d 6c 61 62 65 6c 3d @ aria-label=
24d0: 22 25 68 28 7a 4c 61 62 65 6c 5b 30 5d 3f 7a 4c "%h(zLabel[0]?zL
24e0: 61 62 65 6c 3a 7a 51 50 29 22 20 5c 0a 20 20 20 abel:zQP)" \.
24f0: 20 69 66 28 20 64 69 73 61 62 6c 65 64 20 29 7b if( disabled ){
2500: 0a 20 20 20 20 20 20 40 20 64 69 73 61 62 6c 65 . @ disable
2510: 64 3d 22 64 69 73 61 62 6c 65 64 22 20 5c 0a 20 d="disabled" \.
2520: 20 20 20 7d 0a 20 20 20 20 40 20 63 6f 6c 73 3d }. @ cols=
2530: 22 25 64 28 63 6f 6c 73 29 22 3e 25 68 28 7a 29 "%d(cols)">%h(z)
2540: 3c 2f 74 65 78 74 61 72 65 61 3e 0a 20 20 20 20 </textarea>.
2550: 69 66 28 20 2a 7a 4c 61 62 65 6c 20 29 7b 0a 20 if( *zLabel ){.
2560: 20 20 20 20 20 40 20 3c 73 70 61 6e 20 63 6c 61 @ <span cla
2570: 73 73 3d 22 74 65 78 74 61 72 65 61 4c 61 62 65 ss="textareaLabe
2580: 6c 22 3e 25 73 28 7a 4c 61 62 65 6c 29 3c 2f 73 l">%s(zLabel)</s
2590: 70 61 6e 3e 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 pan>. }. }.
25a0: 20 72 65 74 75 72 6e 20 7a 3b 0a 7d 0a 0a 2f 2a return z;.}../*
25b0: 0a 2a 2a 20 47 65 6e 65 72 61 74 65 20 61 20 74 .** Generate a t
25c0: 65 78 74 20 62 6f 78 20 66 6f 72 20 61 6e 20 61 ext box for an a
25d0: 74 74 72 69 62 75 74 65 2e 0a 2a 2f 0a 76 6f 69 ttribute..*/.voi
25e0: 64 20 6d 75 6c 74 69 70 6c 65 5f 63 68 6f 69 63 d multiple_choic
25f0: 65 5f 61 74 74 72 69 62 75 74 65 28 0a 20 20 63 e_attribute(. c
2600: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4c 61 62 65 onst char *zLabe
2610: 6c 2c 20 20 20 2f 2a 20 54 68 65 20 74 65 78 74 l, /* The text
2620: 20 6c 61 62 65 6c 20 6f 6e 20 74 68 65 20 6d 65 label on the me
2630: 6e 75 20 2a 2f 0a 20 20 63 6f 6e 73 74 20 63 68 nu */. const ch
2640: 61 72 20 2a 7a 56 61 72 2c 20 20 20 20 20 2f 2a ar *zVar, /*
2650: 20 54 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 The correspondi
2660: 6e 67 20 72 6f 77 20 69 6e 20 74 68 65 20 56 41 ng row in the VA
2670: 52 20 74 61 62 6c 65 20 2a 2f 0a 20 20 63 6f 6e R table */. con
2680: 73 74 20 63 68 61 72 20 2a 7a 51 50 2c 20 20 20 st char *zQP,
2690: 20 20 20 2f 2a 20 54 68 65 20 71 75 65 72 79 20 /* The query
26a0: 70 61 72 61 6d 65 74 65 72 20 2a 2f 0a 20 20 63 parameter */. c
26b0: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 66 6c 74 onst char *zDflt
26c0: 2c 20 20 20 20 2f 2a 20 44 65 66 61 75 6c 74 20 , /* Default
26d0: 76 61 6c 75 65 20 69 66 20 56 41 52 20 74 61 62 value if VAR tab
26e0: 6c 65 20 65 6e 74 72 79 20 64 6f 65 73 20 6e 6f le entry does no
26f0: 74 20 65 78 69 73 74 20 2a 2f 0a 20 20 69 6e 74 t exist */. int
2700: 20 6e 43 68 6f 69 63 65 2c 20 20 20 20 20 20 20 nChoice,
2710: 20 20 20 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 /* Number of
2720: 63 68 6f 69 63 65 73 20 2a 2f 0a 20 20 63 6f 6e choices */. con
2730: 73 74 20 63 68 61 72 20 2a 63 6f 6e 73 74 20 2a st char *const *
2740: 61 7a 43 68 6f 69 63 65 20 2f 2a 20 43 68 6f 69 azChoice /* Choi
2750: 63 65 73 20 69 6e 20 70 61 69 72 73 20 28 56 41 ces in pairs (VA
2760: 52 20 76 61 6c 75 65 2c 20 44 69 73 70 6c 61 79 R value, Display
2770: 29 20 2a 2f 0a 29 7b 0a 20 20 63 6f 6e 73 74 20 ) */.){. const
2780: 63 68 61 72 20 2a 7a 20 3d 20 64 62 5f 67 65 74 char *z = db_get
2790: 28 7a 56 61 72 2c 20 7a 44 66 6c 74 29 3b 0a 20 (zVar, zDflt);.
27a0: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 51 20 const char *zQ
27b0: 3d 20 50 28 7a 51 50 29 3b 0a 20 20 69 6e 74 20 = P(zQP);. int
27c0: 69 3b 0a 20 20 69 66 28 20 7a 51 20 26 26 20 66 i;. if( zQ && f
27d0: 6f 73 73 69 6c 5f 73 74 72 63 6d 70 28 7a 51 2c ossil_strcmp(zQ,
27e0: 7a 29 21 3d 30 29 7b 0a 20 20 20 20 63 6f 6e 73 z)!=0){. cons
27f0: 74 20 69 6e 74 20 6e 5a 51 20 3d 20 28 69 6e 74 t int nZQ = (int
2800: 29 73 74 72 6c 65 6e 28 7a 51 29 3b 0a 20 20 20 )strlen(zQ);.
2810: 20 6c 6f 67 69 6e 5f 76 65 72 69 66 79 5f 63 73 login_verify_cs
2820: 72 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 20 rf_secret();.
2830: 20 64 62 5f 75 6e 70 72 6f 74 65 63 74 28 50 52 db_unprotect(PR
2840: 4f 54 45 43 54 5f 41 4c 4c 29 3b 0a 20 20 20 20 OTECT_ALL);.
2850: 64 62 5f 73 65 74 28 7a 56 61 72 2c 20 7a 51 2c db_set(zVar, zQ,
2860: 20 30 29 3b 0a 20 20 20 20 73 65 74 75 70 5f 69 0);. setup_i
2870: 6e 63 72 5f 63 66 67 63 6e 74 28 29 3b 0a 20 20 ncr_cfgcnt();.
2880: 20 20 64 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 db_protect_pop
2890: 28 29 3b 0a 20 20 20 20 61 64 6d 69 6e 5f 6c 6f ();. admin_lo
28a0: 67 28 22 53 65 74 20 6d 75 6c 74 69 70 6c 65 5f g("Set multiple_
28b0: 63 68 6f 69 63 65 5f 61 74 74 72 69 62 75 74 65 choice_attribute
28c0: 20 25 51 20 74 6f 3a 20 25 2e 2a 73 25 73 22 2c %Q to: %.*s%s",
28d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7a . z
28e0: 56 61 72 2c 20 32 30 2c 20 7a 51 2c 20 28 6e 5a Var, 20, zQ, (nZ
28f0: 51 3e 32 30 20 3f 20 22 2e 2e 2e 22 20 3a 20 22 Q>20 ? "..." : "
2900: 22 29 29 3b 0a 20 20 20 20 7a 20 3d 20 7a 51 3b "));. z = zQ;
2910: 0a 20 20 7d 0a 20 20 40 20 3c 73 65 6c 65 63 74 . }. @ <select
2920: 20 61 72 69 61 2d 6c 61 62 65 6c 3d 22 25 68 28 aria-label="%h(
2930: 7a 4c 61 62 65 6c 29 22 20 73 69 7a 65 3d 22 31 zLabel)" size="1
2940: 22 20 6e 61 6d 65 3d 22 25 73 28 7a 51 50 29 22 " name="%s(zQP)"
2950: 20 69 64 3d 22 69 64 25 73 28 7a 51 50 29 22 3e id="id%s(zQP)">
2960: 0a 20 20 66 6f 72 28 69 3d 30 3b 20 69 3c 6e 43 . for(i=0; i<nC
2970: 68 6f 69 63 65 2a 32 3b 20 69 2b 3d 32 29 7b 0a hoice*2; i+=2){.
2980: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
2990: 7a 53 65 6c 20 3d 20 66 6f 73 73 69 6c 5f 73 74 zSel = fossil_st
29a0: 72 63 6d 70 28 61 7a 43 68 6f 69 63 65 5b 69 5d rcmp(azChoice[i]
29b0: 2c 7a 29 3d 3d 30 20 3f 20 22 20 73 65 6c 65 63 ,z)==0 ? " selec
29c0: 74 65 64 22 20 3a 20 22 22 3b 0a 20 20 20 20 40 ted" : "";. @
29d0: 20 3c 6f 70 74 69 6f 6e 20 76 61 6c 75 65 3d 22 <option value="
29e0: 25 68 28 61 7a 43 68 6f 69 63 65 5b 69 5d 29 22 %h(azChoice[i])"
29f0: 25 73 28 7a 53 65 6c 29 3e 25 68 28 61 7a 43 68 %s(zSel)>%h(azCh
2a00: 6f 69 63 65 5b 69 2b 31 5d 29 3c 2f 6f 70 74 69 oice[i+1])</opti
2a10: 6f 6e 3e 0a 20 20 7d 0a 20 20 40 20 3c 2f 73 65 on>. }. @ </se
2a20: 6c 65 63 74 3e 20 3c 62 3e 25 68 28 7a 4c 61 62 lect> <b>%h(zLab
2a30: 65 6c 29 3c 2f 62 3e 0a 7d 0a 0a 0a 2f 2a 0a 2a el)</b>.}.../*.*
2a40: 2a 20 57 45 42 50 41 47 45 3a 20 73 65 74 75 70 * WEBPAGE: setup
2a50: 5f 61 63 63 65 73 73 0a 2a 2a 0a 2a 2a 20 54 68 _access.**.** Th
2a60: 65 20 61 63 63 65 73 73 2d 63 6f 6e 74 72 6f 6c e access-control
2a70: 20 73 65 74 74 69 6e 67 73 20 70 61 67 65 2e 20 settings page.
2a80: 20 52 65 71 75 69 72 65 73 20 53 65 74 75 70 20 Requires Setup
2a90: 70 72 69 76 69 6c 65 67 65 73 2e 0a 2a 2f 0a 76 privileges..*/.v
2aa0: 6f 69 64 20 73 65 74 75 70 5f 61 63 63 65 73 73 oid setup_access
2ab0: 28 76 6f 69 64 29 7b 0a 20 20 73 74 61 74 69 63 (void){. static
2ac0: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6e const char *con
2ad0: 73 74 20 61 7a 52 65 64 69 72 65 63 74 4f 70 74 st azRedirectOpt
2ae0: 73 5b 5d 20 3d 20 7b 0a 20 20 20 20 22 30 22 2c s[] = {. "0",
2af0: 20 22 4f 66 66 22 2c 0a 20 20 20 20 22 31 22 2c "Off",. "1",
2b00: 20 22 4c 6f 67 69 6e 20 50 61 67 65 20 4f 6e 6c "Login Page Onl
2b10: 79 22 2c 0a 20 20 20 20 22 32 22 2c 20 22 41 6c y",. "2", "Al
2b20: 6c 20 50 61 67 65 73 22 0a 20 20 7d 3b 0a 20 20 l Pages". };.
2b30: 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 login_check_cred
2b40: 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 entials();. if(
2b50: 20 21 67 2e 70 65 72 6d 2e 53 65 74 75 70 20 29 !g.perm.Setup )
2b60: 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 {. login_need
2b70: 65 64 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 ed(0);. retur
2b80: 6e 3b 0a 20 20 7d 0a 0a 20 20 73 74 79 6c 65 5f n;. }.. style_
2b90: 68 65 61 64 65 72 28 22 41 63 63 65 73 73 20 43 header("Access C
2ba0: 6f 6e 74 72 6f 6c 20 53 65 74 74 69 6e 67 73 22 ontrol Settings"
2bb0: 29 3b 0a 20 20 64 62 5f 62 65 67 69 6e 5f 74 72 );. db_begin_tr
2bc0: 61 6e 73 61 63 74 69 6f 6e 28 29 3b 0a 20 20 40 ansaction();. @
2bd0: 20 3c 66 6f 72 6d 20 61 63 74 69 6f 6e 3d 22 25 <form action="%
2be0: 52 2f 73 65 74 75 70 5f 61 63 63 65 73 73 22 20 R/setup_access"
2bf0: 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 3e 3c 64 method="post"><d
2c00: 69 76 3e 0a 20 20 6c 6f 67 69 6e 5f 69 6e 73 65 iv>. login_inse
2c10: 72 74 5f 63 73 72 66 5f 73 65 63 72 65 74 28 29 rt_csrf_secret()
2c20: 3b 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 ;. @ <input typ
2c30: 65 3d 22 73 75 62 6d 69 74 22 20 20 6e 61 6d 65 e="submit" name
2c40: 3d 22 73 75 62 6d 69 74 22 20 76 61 6c 75 65 3d ="submit" value=
2c50: 22 41 70 70 6c 79 20 43 68 61 6e 67 65 73 22 20 "Apply Changes"
2c60: 2f 3e 3c 2f 70 3e 0a 20 20 40 20 3c 68 72 20 2f /></p>. @ <hr /
2c70: 3e 0a 20 20 6d 75 6c 74 69 70 6c 65 5f 63 68 6f >. multiple_cho
2c80: 69 63 65 5f 61 74 74 72 69 62 75 74 65 28 22 52 ice_attribute("R
2c90: 65 64 69 72 65 63 74 20 74 6f 20 48 54 54 50 53 edirect to HTTPS
2ca0: 22 2c 0a 20 20 20 20 20 22 72 65 64 69 72 65 63 ",. "redirec
2cb0: 74 2d 74 6f 2d 68 74 74 70 73 22 2c 20 22 72 65 t-to-https", "re
2cc0: 64 69 72 68 74 74 70 73 22 2c 20 22 30 22 2c 0a dirhttps", "0",.
2cd0: 20 20 20 20 20 63 6f 75 6e 74 28 61 7a 52 65 64 count(azRed
2ce0: 69 72 65 63 74 4f 70 74 73 29 2f 32 2c 20 61 7a irectOpts)/2, az
2cf0: 52 65 64 69 72 65 63 74 4f 70 74 73 29 3b 0a 20 RedirectOpts);.
2d00: 20 40 20 3c 70 3e 46 6f 72 63 65 20 74 68 65 20 @ <p>Force the
2d10: 75 73 65 20 6f 66 20 48 54 54 50 53 20 62 79 20 use of HTTPS by
2d20: 72 65 64 69 72 65 63 74 69 6e 67 20 74 6f 20 48 redirecting to H
2d30: 54 54 50 53 20 77 68 65 6e 20 61 6e 0a 20 20 40 TTPS when an. @
2d40: 20 75 6e 65 6e 63 72 79 70 74 65 64 20 72 65 71 unencrypted req
2d50: 75 65 73 74 20 69 73 20 72 65 63 65 69 76 65 64 uest is received
2d60: 2e 20 20 54 68 69 73 20 66 65 61 74 75 72 65 20 . This feature
2d70: 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 0a 20 can be enabled.
2d80: 20 40 20 66 6f 72 20 74 68 65 20 4c 6f 67 69 6e @ for the Login
2d90: 20 70 61 67 65 20 6f 6e 6c 79 2c 20 6f 72 20 66 page only, or f
2da0: 6f 72 20 61 6c 6c 20 70 61 67 65 73 2e 0a 20 20 or all pages..
2db0: 40 20 3c 70 3e 46 75 72 74 68 65 72 20 64 65 74 @ <p>Further det
2dc0: 61 69 6c 73 3a 20 20 57 68 65 6e 20 65 6e 61 62 ails: When enab
2dd0: 6c 65 64 2c 20 74 68 69 73 20 6f 70 74 69 6f 6e led, this option
2de0: 20 63 61 75 73 65 73 20 74 68 65 20 24 73 65 63 causes the $sec
2df0: 75 72 65 75 72 6c 20 54 48 31 0a 20 20 40 20 76 ureurl TH1. @ v
2e00: 61 72 69 61 62 6c 65 20 69 73 20 73 65 74 20 74 ariable is set t
2e10: 6f 20 61 6e 20 22 68 74 74 70 73 3a 22 20 76 61 o an "https:" va
2e20: 72 69 61 6e 74 20 6f 66 20 24 62 61 73 65 75 72 riant of $baseur
2e30: 6c 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 0a 20 l. Otherwise,.
2e40: 20 40 20 24 73 65 63 75 72 65 75 72 6c 20 69 73 @ $secureurl is
2e50: 20 6a 75 73 74 20 61 6e 20 61 6c 69 61 73 20 66 just an alias f
2e60: 6f 72 20 24 62 61 73 65 75 72 6c 2e 0a 20 20 40 or $baseurl.. @
2e70: 20 28 50 72 6f 70 65 72 74 79 3a 20 22 72 65 64 (Property: "red
2e80: 69 72 65 63 74 2d 74 6f 2d 68 74 74 70 73 22 2e irect-to-https".
2e90: 20 20 22 30 22 20 66 6f 72 20 6f 66 66 2c 20 22 "0" for off, "
2ea0: 31 22 20 66 6f 72 20 4c 6f 67 69 6e 20 70 61 67 1" for Login pag
2eb0: 65 20 6f 6e 6c 79 2c 0a 20 20 40 20 22 32 22 20 e only,. @ "2"
2ec0: 6f 74 68 65 72 77 69 73 65 2e 29 0a 20 20 40 20 otherwise.). @
2ed0: 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 <hr />. onoff_a
2ee0: 74 74 72 69 62 75 74 65 28 22 52 65 71 75 69 72 ttribute("Requir
2ef0: 65 20 70 61 73 73 77 6f 72 64 20 66 6f 72 20 6c e password for l
2f00: 6f 63 61 6c 20 61 63 63 65 73 73 22 2c 0a 20 20 ocal access",.
2f10: 20 20 20 22 6c 6f 63 61 6c 61 75 74 68 22 2c 20 "localauth",
2f20: 22 6c 6f 63 61 6c 61 75 74 68 22 2c 20 30 2c 20 "localauth", 0,
2f30: 30 29 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 20 0);. @ <p>When
2f40: 65 6e 61 62 6c 65 64 2c 20 74 68 65 20 70 61 73 enabled, the pas
2f50: 73 77 6f 72 64 20 73 69 67 6e 2d 69 6e 20 69 73 sword sign-in is
2f60: 20 61 6c 77 61 79 73 20 72 65 71 75 69 72 65 64 always required
2f70: 20 66 6f 72 0a 20 20 40 20 77 65 62 20 61 63 63 for. @ web acc
2f80: 65 73 73 2e 20 20 57 68 65 6e 20 64 69 73 61 62 ess. When disab
2f90: 6c 65 64 2c 20 75 6e 72 65 73 74 72 69 63 74 65 led, unrestricte
2fa0: 64 20 77 65 62 20 61 63 63 65 73 73 20 66 72 6f d web access fro
2fb0: 6d 20 31 32 37 2e 30 2e 30 2e 31 0a 20 20 40 20 m 127.0.0.1. @
2fc0: 69 73 20 61 6c 6c 6f 77 65 64 20 66 6f 72 20 74 is allowed for t
2fd0: 68 65 20 3c 61 20 68 72 65 66 3d 22 25 52 2f 68 he <a href="%R/h
2fe0: 65 6c 70 2f 75 69 22 3e 66 6f 73 73 69 6c 20 75 elp/ui">fossil u
2ff0: 69 3c 2f 61 3e 20 63 6f 6d 6d 61 6e 64 20 6f 72 i</a> command or
3000: 0a 20 20 40 20 66 72 6f 6d 20 74 68 65 20 3c 61 . @ from the <a
3010: 20 68 72 65 66 3d 22 25 52 2f 68 65 6c 70 2f 73 href="%R/help/s
3020: 65 72 76 65 72 22 3e 66 6f 73 73 69 6c 20 73 65 erver">fossil se
3030: 72 76 65 72 3c 2f 61 3e 2c 0a 20 20 40 20 3c 61 rver</a>,. @ <a
3040: 20 68 72 65 66 3d 22 25 52 2f 68 65 6c 70 2f 68 href="%R/help/h
3050: 74 74 70 22 3e 66 6f 73 73 69 6c 20 68 74 74 70 ttp">fossil http
3060: 3c 2f 61 3e 20 63 6f 6d 6d 61 6e 64 73 20 77 68 </a> commands wh
3070: 65 6e 20 74 68 65 0a 20 20 40 20 22 2d 2d 6c 6f en the. @ "--lo
3080: 63 61 6c 61 75 74 68 22 20 63 6f 6d 6d 61 6e 64 calauth" command
3090: 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 20 69 73 line options is
30a0: 20 75 73 65 64 2c 20 6f 72 20 66 72 6f 6d 20 74 used, or from t
30b0: 68 65 0a 20 20 40 20 3c 61 20 68 72 65 66 3d 22 he. @ <a href="
30c0: 25 52 2f 68 65 6c 70 2f 63 67 69 22 3e 66 6f 73 %R/help/cgi">fos
30d0: 73 69 6c 20 63 67 69 3c 2f 61 3e 20 69 66 20 61 sil cgi</a> if a
30e0: 20 6c 69 6e 65 20 63 6f 6e 74 61 69 6e 69 6e 67 line containing
30f0: 0a 20 20 40 20 74 68 65 20 77 6f 72 64 20 22 6c . @ the word "l
3100: 6f 63 61 6c 61 75 74 68 22 20 61 70 70 65 61 72 ocalauth" appear
3110: 73 20 69 6e 20 74 68 65 20 43 47 49 20 73 63 72 s in the CGI scr
3120: 69 70 74 2e 0a 20 20 40 0a 20 20 40 20 3c 70 3e ipt.. @. @ <p>
3130: 41 20 70 61 73 73 77 6f 72 64 20 69 73 20 61 6c A password is al
3140: 77 61 79 73 20 72 65 71 75 69 72 65 64 20 69 66 ways required if
3150: 20 61 6e 79 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 any one or more
3160: 0a 20 20 40 20 6f 66 20 74 68 65 20 66 6f 6c 6c . @ of the foll
3170: 6f 77 69 6e 67 20 61 72 65 20 74 72 75 65 3a 0a owing are true:.
3180: 20 20 40 20 3c 6f 6c 3e 0a 20 20 40 20 3c 6c 69 @ <ol>. @ <li
3190: 3e 20 54 68 69 73 20 62 75 74 74 6f 6e 20 69 73 > This button is
31a0: 20 63 68 65 63 6b 65 64 0a 20 20 40 20 3c 6c 69 checked. @ <li
31b0: 3e 20 54 68 65 20 69 6e 62 6f 75 6e 64 20 54 43 > The inbound TC
31c0: 50 2f 49 50 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 P/IP connection
31d0: 69 73 20 6e 6f 74 20 66 72 6f 6d 20 31 32 37 2e is not from 127.
31e0: 30 2e 30 2e 31 0a 20 20 40 20 3c 6c 69 3e 20 54 0.0.1. @ <li> T
31f0: 68 65 20 73 65 72 76 65 72 20 69 73 20 73 74 61 he server is sta
3200: 72 74 65 64 20 75 73 69 6e 67 20 65 69 74 68 65 rted using eithe
3210: 72 20 6f 66 20 74 68 65 0a 20 20 40 20 3c 61 20 r of the. @ <a
3220: 68 72 65 66 3d 22 25 52 2f 68 65 6c 70 2f 73 65 href="%R/help/se
3230: 72 76 65 72 22 3e 66 6f 73 73 69 6c 20 73 65 72 rver">fossil ser
3240: 76 65 72 3c 2f 61 3e 20 6f 72 0a 20 20 40 20 3c ver</a> or. @ <
3250: 61 20 68 72 65 66 3d 22 25 52 2f 68 65 6c 70 2f a href="%R/help/
3260: 73 65 72 76 65 72 22 3e 66 6f 73 73 69 6c 20 68 server">fossil h
3270: 74 74 70 3c 2f 61 3e 20 63 6f 6d 6d 61 6e 64 73 ttp</a> commands
3280: 0a 20 20 40 20 77 69 74 68 6f 75 74 20 74 68 65 . @ without the
3290: 20 22 2d 2d 6c 6f 63 61 6c 61 75 74 68 22 20 6f "--localauth" o
32a0: 70 74 69 6f 6e 2e 0a 20 20 40 20 3c 6c 69 3e 20 ption.. @ <li>
32b0: 54 68 65 20 73 65 72 76 65 72 20 69 73 20 73 74 The server is st
32c0: 61 72 74 65 64 20 66 72 6f 6d 20 43 47 49 20 77 arted from CGI w
32d0: 69 74 68 6f 75 74 20 74 68 65 20 22 6c 6f 63 61 ithout the "loca
32e0: 6c 61 75 74 68 22 20 6b 65 79 77 6f 72 64 0a 20 lauth" keyword.
32f0: 20 40 20 69 6e 20 74 68 65 20 43 47 49 20 73 63 @ in the CGI sc
3300: 72 69 70 74 2e 0a 20 20 40 20 3c 2f 6f 6c 3e 0a ript.. @ </ol>.
3310: 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 @ (Property: "
3320: 6c 6f 63 61 6c 61 75 74 68 22 29 0a 20 20 40 0a localauth"). @.
3330: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f @ <hr />. ono
3340: 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 45 6e ff_attribute("En
3350: 61 62 6c 65 20 2f 74 65 73 74 5f 65 6e 76 22 2c able /test_env",
3360: 0a 20 20 20 20 20 22 74 65 73 74 5f 65 6e 76 5f . "test_env_
3370: 65 6e 61 62 6c 65 22 2c 20 22 74 65 73 74 5f 65 enable", "test_e
3380: 6e 76 5f 65 6e 61 62 6c 65 22 2c 20 30 2c 20 30 nv_enable", 0, 0
3390: 29 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 20 65 );. @ <p>When e
33a0: 6e 61 62 6c 65 64 2c 20 74 68 65 20 25 68 28 67 nabled, the %h(g
33b0: 2e 7a 42 61 73 65 55 52 4c 29 2f 74 65 73 74 5f .zBaseURL)/test_
33c0: 65 6e 76 20 55 52 4c 20 69 73 20 61 76 61 69 6c env URL is avail
33d0: 61 62 6c 65 20 74 6f 20 61 6c 6c 0a 20 20 40 20 able to all. @
33e0: 75 73 65 72 73 2e 20 20 57 68 65 6e 20 64 69 73 users. When dis
33f0: 61 62 6c 65 64 20 28 74 68 65 20 64 65 66 61 75 abled (the defau
3400: 6c 74 29 20 6f 6e 6c 79 20 75 73 65 72 73 20 41 lt) only users A
3410: 64 6d 69 6e 20 61 6e 64 20 53 65 74 75 70 20 63 dmin and Setup c
3420: 61 6e 20 76 69 73 69 74 0a 20 20 40 20 74 68 65 an visit. @ the
3430: 20 2f 74 65 73 74 5f 65 6e 76 20 70 61 67 65 2e /test_env page.
3440: 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 . @ (Property:
3450: 22 74 65 73 74 5f 65 6e 76 5f 65 6e 61 62 6c 65 "test_env_enable
3460: 22 29 0a 20 20 40 20 3c 2f 70 3e 0a 20 20 40 0a "). @ </p>. @.
3470: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f @ <hr />. ono
3480: 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 45 6e ff_attribute("En
3490: 61 62 6c 65 20 2f 61 72 74 69 66 61 63 74 5f 73 able /artifact_s
34a0: 74 61 74 73 22 2c 0a 20 20 20 20 20 22 61 72 74 tats",. "art
34b0: 69 66 61 63 74 5f 73 74 61 74 73 5f 65 6e 61 62 ifact_stats_enab
34c0: 6c 65 22 2c 20 22 61 72 74 69 66 61 63 74 5f 73 le", "artifact_s
34d0: 74 61 74 73 5f 65 6e 61 62 6c 65 22 2c 20 30 2c tats_enable", 0,
34e0: 20 30 29 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 0);. @ <p>When
34f0: 20 65 6e 61 62 6c 65 64 2c 20 74 68 65 20 25 68 enabled, the %h
3500: 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 61 72 74 (g.zBaseURL)/art
3510: 69 66 61 63 74 5f 73 74 61 74 73 20 55 52 4c 20 ifact_stats URL
3520: 69 73 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 is available to
3530: 61 6c 6c 0a 20 20 40 20 75 73 65 72 73 2e 20 20 all. @ users.
3540: 57 68 65 6e 20 64 69 73 61 62 6c 65 64 20 28 74 When disabled (t
3550: 68 65 20 64 65 66 61 75 6c 74 29 20 6f 6e 6c 79 he default) only
3560: 20 75 73 65 72 73 20 77 69 74 68 20 63 68 65 63 users with chec
3570: 6b 2d 69 6e 20 70 72 69 76 69 6c 65 67 65 20 6d k-in privilege m
3580: 61 79 0a 20 20 40 20 61 63 63 65 73 73 20 74 68 ay. @ access th
3590: 65 20 2f 61 72 74 69 66 61 63 74 5f 73 74 61 74 e /artifact_stat
35a0: 73 20 70 61 67 65 2e 0a 20 20 40 20 28 50 72 6f s page.. @ (Pro
35b0: 70 65 72 74 79 3a 20 22 61 72 74 69 66 61 63 74 perty: "artifact
35c0: 5f 73 74 61 74 73 5f 65 6e 61 62 6c 65 22 29 0a _stats_enable").
35d0: 20 20 40 20 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 @ </p>. @. @
35e0: 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f <hr />. onoff_
35f0: 61 74 74 72 69 62 75 74 65 28 22 41 6c 6c 6f 77 attribute("Allow
3600: 20 52 45 4d 4f 54 45 5f 55 53 45 52 20 61 75 74 REMOTE_USER aut
3610: 68 65 6e 74 69 63 61 74 69 6f 6e 22 2c 0a 20 20 hentication",.
3620: 20 20 20 22 72 65 6d 6f 74 65 5f 75 73 65 72 5f "remote_user_
3630: 6f 6b 22 2c 20 22 72 65 6d 6f 74 65 5f 75 73 65 ok", "remote_use
3640: 72 5f 6f 6b 22 2c 20 30 2c 20 30 29 3b 0a 20 20 r_ok", 0, 0);.
3650: 40 20 3c 70 3e 57 68 65 6e 20 65 6e 61 62 6c 65 @ <p>When enable
3660: 64 2c 20 69 66 20 74 68 65 20 52 45 4d 4f 54 45 d, if the REMOTE
3670: 5f 55 53 45 52 20 65 6e 76 69 72 6f 6e 6d 65 6e _USER environmen
3680: 74 20 76 61 72 69 61 62 6c 65 20 69 73 20 73 65 t variable is se
3690: 74 20 74 6f 20 74 68 65 0a 20 20 40 20 6c 6f 67 t to the. @ log
36a0: 69 6e 20 6e 61 6d 65 20 6f 66 20 61 20 76 61 6c in name of a val
36b0: 69 64 20 75 73 65 72 20 61 6e 64 20 6e 6f 20 6f id user and no o
36c0: 74 68 65 72 20 6c 6f 67 69 6e 20 63 72 65 64 65 ther login crede
36d0: 6e 74 69 61 6c 73 20 61 72 65 20 61 76 61 69 6c ntials are avail
36e0: 61 62 6c 65 2c 0a 20 20 40 20 74 68 65 6e 20 74 able,. @ then t
36f0: 68 65 20 52 45 4d 4f 54 45 5f 55 53 45 52 20 69 he REMOTE_USER i
3700: 73 20 61 63 63 65 70 74 65 64 20 61 73 20 61 6e s accepted as an
3710: 20 61 75 74 68 65 6e 74 69 63 61 74 65 64 20 75 authenticated u
3720: 73 65 72 2e 0a 20 20 40 20 28 50 72 6f 70 65 72 ser.. @ (Proper
3730: 74 79 3a 20 22 72 65 6d 6f 74 65 5f 75 73 65 72 ty: "remote_user
3740: 5f 6f 6b 22 29 0a 20 20 40 20 3c 2f 70 3e 0a 20 _ok"). @ </p>.
3750: 20 40 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 @. @ <hr />.
3760: 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 onoff_attribute(
3770: 22 41 6c 6c 6f 77 20 48 54 54 50 5f 41 55 54 48 "Allow HTTP_AUTH
3780: 45 4e 54 49 43 41 54 49 4f 4e 20 61 75 74 68 65 ENTICATION authe
3790: 6e 74 69 63 61 74 69 6f 6e 22 2c 0a 20 20 20 20 ntication",.
37a0: 20 22 68 74 74 70 5f 61 75 74 68 65 6e 74 69 63 "http_authentic
37b0: 61 74 69 6f 6e 5f 6f 6b 22 2c 20 22 68 74 74 70 ation_ok", "http
37c0: 5f 61 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 5f _authentication_
37d0: 6f 6b 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 ok", 0, 0);. @
37e0: 3c 70 3e 57 68 65 6e 20 65 6e 61 62 6c 65 64 2c <p>When enabled,
37f0: 20 61 6c 6c 6f 77 20 74 68 65 20 75 73 65 20 6f allow the use o
3800: 66 20 74 68 65 20 48 54 54 50 5f 41 55 54 48 45 f the HTTP_AUTHE
3810: 4e 54 49 43 41 54 49 4f 4e 20 65 6e 76 69 72 6f NTICATION enviro
3820: 6e 6d 65 6e 74 0a 20 20 40 20 76 61 72 69 61 62 nment. @ variab
3830: 6c 65 20 6f 72 20 74 68 65 20 22 41 75 74 68 65 le or the "Authe
3840: 6e 74 69 63 61 74 69 6f 6e 3a 22 20 48 54 54 50 ntication:" HTTP
3850: 20 68 65 61 64 65 72 20 74 6f 20 66 69 6e 64 20 header to find
3860: 74 68 65 20 75 73 65 72 6e 61 6d 65 20 61 6e 64 the username and
3870: 0a 20 20 40 20 70 61 73 73 77 6f 72 64 2e 20 54 . @ password. T
3880: 68 69 73 20 69 73 20 61 6e 6f 74 68 65 72 20 77 his is another w
3890: 61 79 20 6f 66 20 73 75 70 70 6f 72 74 69 6e 67 ay of supporting
38a0: 20 42 61 73 69 63 20 41 75 74 68 65 6e 74 69 63 Basic Authentic
38b0: 61 74 69 6f 6e 2e 0a 20 20 40 20 28 50 72 6f 70 ation.. @ (Prop
38c0: 65 72 74 79 3a 20 22 68 74 74 70 5f 61 75 74 68 erty: "http_auth
38d0: 65 6e 74 69 63 61 74 69 6f 6e 5f 6f 6b 22 29 0a entication_ok").
38e0: 20 20 40 20 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 @ </p>. @. @
38f0: 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f <hr />. entry_
3900: 61 74 74 72 69 62 75 74 65 28 22 4c 6f 67 69 6e attribute("Login
3910: 20 65 78 70 69 72 61 74 69 6f 6e 20 74 69 6d 65 expiration time
3920: 22 2c 20 36 2c 20 22 63 6f 6f 6b 69 65 2d 65 78 ", 6, "cookie-ex
3930: 70 69 72 65 22 2c 20 22 63 65 78 22 2c 0a 20 20 pire", "cex",.
3940: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3950: 22 38 37 36 36 22 2c 20 30 29 3b 0a 20 20 40 20 "8766", 0);. @
3960: 3c 70 3e 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 <p>The number of
3970: 20 68 6f 75 72 73 20 66 6f 72 20 77 68 69 63 68 hours for which
3980: 20 61 20 6c 6f 67 69 6e 20 69 73 20 76 61 6c 69 a login is vali
3990: 64 2e 20 20 54 68 69 73 20 6d 75 73 74 20 62 65 d. This must be
39a0: 20 61 0a 20 20 40 20 70 6f 73 69 74 69 76 65 20 a. @ positive
39b0: 6e 75 6d 62 65 72 2e 20 20 54 68 65 20 64 65 66 number. The def
39c0: 61 75 6c 74 20 69 73 20 38 37 36 36 20 68 6f 75 ault is 8766 hou
39d0: 72 73 20 77 68 69 63 68 20 69 73 20 61 70 70 72 rs which is appr
39e0: 6f 78 69 6d 61 74 65 6c 79 20 65 71 75 61 6c 0a oximately equal.
39f0: 20 20 40 20 74 6f 20 61 20 79 65 61 72 2e 0a 20 @ to a year..
3a00: 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 63 @ (Property: "c
3a10: 6f 6f 6b 69 65 2d 65 78 70 69 72 65 22 29 3c 2f ookie-expire")</
3a20: 70 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 p>.. @ <hr />.
3a30: 20 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 65 entry_attribute
3a40: 28 22 44 6f 77 6e 6c 6f 61 64 20 70 61 63 6b 65 ("Download packe
3a50: 74 20 6c 69 6d 69 74 22 2c 20 31 30 2c 20 22 6d t limit", 10, "m
3a60: 61 78 2d 64 6f 77 6e 6c 6f 61 64 22 2c 20 22 6d ax-download", "m
3a70: 78 64 77 6e 22 2c 0a 20 20 20 20 20 20 20 20 20 xdwn",.
3a80: 20 20 20 20 20 20 20 20 20 22 35 30 30 30 30 30 "500000
3a90: 30 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 46 0", 0);. @ <p>F
3aa0: 6f 73 73 69 6c 20 74 72 69 65 73 20 74 6f 20 6c ossil tries to l
3ab0: 69 6d 69 74 20 6f 75 74 2d 62 6f 75 6e 64 20 73 imit out-bound s
3ac0: 79 6e 63 2c 20 63 6c 6f 6e 65 2c 20 61 6e 64 20 ync, clone, and
3ad0: 70 75 6c 6c 20 70 61 63 6b 65 74 73 0a 20 20 40 pull packets. @
3ae0: 20 74 6f 20 74 68 69 73 20 6d 61 6e 79 20 62 79 to this many by
3af0: 74 65 73 2c 20 75 6e 63 6f 6d 70 72 65 73 73 65 tes, uncompresse
3b00: 64 2e 20 20 49 66 20 74 68 65 20 63 6c 69 65 6e d. If the clien
3b10: 74 20 72 65 71 75 69 72 65 73 20 6d 6f 72 65 20 t requires more
3b20: 64 61 74 61 0a 20 20 40 20 74 68 61 6e 20 74 68 data. @ than th
3b30: 69 73 2c 20 74 68 65 6e 20 74 68 65 20 63 6c 69 is, then the cli
3b40: 65 6e 74 20 77 69 6c 6c 20 69 73 73 75 65 20 6d ent will issue m
3b50: 75 6c 74 69 70 6c 65 20 48 54 54 50 20 72 65 71 ultiple HTTP req
3b60: 75 65 73 74 73 2e 0a 20 20 40 20 56 61 6c 75 65 uests.. @ Value
3b70: 73 20 62 65 6c 6f 77 20 31 20 6d 69 6c 6c 69 6f s below 1 millio
3b80: 6e 20 61 72 65 20 6e 6f 74 20 72 65 63 6f 6d 6d n are not recomm
3b90: 65 6e 64 65 64 2e 20 20 35 20 6d 69 6c 6c 69 6f ended. 5 millio
3ba0: 6e 20 69 73 20 61 0a 20 20 40 20 72 65 61 73 6f n is a. @ reaso
3bb0: 6e 61 62 6c 65 20 6e 75 6d 62 65 72 2e 20 20 28 nable number. (
3bc0: 50 72 6f 70 65 72 74 79 3a 20 22 6d 61 78 2d 64 Property: "max-d
3bd0: 6f 77 6e 6c 6f 61 64 22 29 3c 2f 70 3e 0a 0a 20 ownload")</p>..
3be0: 20 40 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 72 @ <hr />. entr
3bf0: 79 5f 61 74 74 72 69 62 75 74 65 28 22 44 6f 77 y_attribute("Dow
3c00: 6e 6c 6f 61 64 20 74 69 6d 65 20 6c 69 6d 69 74 nload time limit
3c10: 22 2c 20 31 31 2c 20 22 6d 61 78 2d 64 6f 77 6e ", 11, "max-down
3c20: 6c 6f 61 64 2d 74 69 6d 65 22 2c 20 22 6d 78 64 load-time", "mxd
3c30: 77 6e 74 22 2c 0a 20 20 20 20 20 20 20 20 20 20 wnt",.
3c40: 20 20 20 20 20 20 20 20 22 33 30 22 2c 20 30 29 "30", 0)
3c50: 3b 0a 0a 20 20 40 20 3c 70 3e 46 6f 73 73 69 6c ;.. @ <p>Fossil
3c60: 20 74 72 69 65 73 20 74 6f 20 73 70 65 6e 64 20 tries to spend
3c70: 6c 65 73 73 20 74 68 61 6e 20 74 68 69 73 20 6d less than this m
3c80: 61 6e 79 20 73 65 63 6f 6e 64 73 20 67 61 74 68 any seconds gath
3c90: 65 72 69 6e 67 0a 20 20 40 20 74 68 65 20 6f 75 ering. @ the ou
3ca0: 74 2d 62 6f 75 6e 64 20 64 61 74 61 20 6f 66 20 t-bound data of
3cb0: 73 79 6e 63 2c 20 63 6c 6f 6e 65 2c 20 61 6e 64 sync, clone, and
3cc0: 20 70 75 6c 6c 20 70 61 63 6b 65 74 73 2e 0a 20 pull packets..
3cd0: 20 40 20 49 66 20 74 68 65 20 63 6c 69 65 6e 74 @ If the client
3ce0: 20 72 65 71 75 65 73 74 20 74 61 6b 65 73 20 6c request takes l
3cf0: 6f 6e 67 65 72 2c 20 61 20 70 61 72 74 69 61 6c onger, a partial
3d00: 20 72 65 70 6c 79 20 69 73 20 67 69 76 65 6e 20 reply is given
3d10: 73 69 6d 69 6c 61 72 0a 20 20 40 20 74 6f 20 74 similar. @ to t
3d20: 68 65 20 64 6f 77 6e 6c 6f 61 64 20 70 61 63 6b he download pack
3d30: 65 74 20 6c 69 6d 69 74 2e 20 33 30 73 20 69 73 et limit. 30s is
3d40: 20 61 20 72 65 61 73 6f 6e 61 62 6c 65 20 64 65 a reasonable de
3d50: 66 61 75 6c 74 2e 0a 20 20 40 20 28 50 72 6f 70 fault.. @ (Prop
3d60: 65 72 74 79 3a 20 22 6d 61 78 2d 64 6f 77 6e 6c erty: "max-downl
3d70: 6f 61 64 2d 74 69 6d 65 22 29 3c 2f 70 3e 0a 0a oad-time")</p>..
3d80: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 @ <hr />. ent
3d90: 72 79 5f 61 74 74 72 69 62 75 74 65 28 22 53 65 ry_attribute("Se
3da0: 72 76 65 72 20 4c 6f 61 64 20 41 76 65 72 61 67 rver Load Averag
3db0: 65 20 4c 69 6d 69 74 22 2c 20 31 31 2c 20 22 6d e Limit", 11, "m
3dc0: 61 78 2d 6c 6f 61 64 61 76 67 22 2c 20 22 6d 78 ax-loadavg", "mx
3dd0: 6c 64 61 76 67 22 2c 0a 20 20 20 20 20 20 20 20 ldavg",.
3de0: 20 20 20 20 20 20 20 20 20 20 22 30 2e 30 22 2c "0.0",
3df0: 20 30 29 3b 0a 20 20 40 20 3c 70 3e 53 6f 6d 65 0);. @ <p>Some
3e00: 20 65 78 70 65 6e 73 69 76 65 20 6f 70 65 72 61 expensive opera
3e10: 74 69 6f 6e 73 20 28 73 75 63 68 20 61 73 20 63 tions (such as c
3e20: 6f 6d 70 75 74 69 6e 67 20 74 61 72 62 61 6c 6c omputing tarball
3e30: 73 2c 20 7a 69 70 20 61 72 63 68 69 76 65 73 2c s, zip archives,
3e40: 0a 20 20 40 20 6f 72 20 61 6e 6e 6f 74 61 74 69 . @ or annotati
3e50: 6f 6e 2f 62 6c 61 6d 65 20 70 61 67 65 73 29 20 on/blame pages)
3e60: 61 72 65 20 70 72 6f 68 69 62 69 74 65 64 20 69 are prohibited i
3e70: 66 20 74 68 65 20 6c 6f 61 64 20 61 76 65 72 61 f the load avera
3e80: 67 65 20 6f 6e 20 74 68 65 20 68 6f 73 74 0a 20 ge on the host.
3e90: 20 40 20 63 6f 6d 70 75 74 65 72 20 69 73 20 74 @ computer is t
3ea0: 6f 6f 20 6c 61 72 67 65 2e 20 20 53 65 74 20 74 oo large. Set t
3eb0: 68 65 20 74 68 72 65 73 68 6f 6c 64 20 66 6f 72 he threshold for
3ec0: 20 64 69 73 61 6c 6c 6f 77 69 6e 67 20 65 78 70 disallowing exp
3ed0: 65 6e 73 69 76 65 0a 20 20 40 20 63 6f 6d 70 75 ensive. @ compu
3ee0: 74 61 74 69 6f 6e 73 20 68 65 72 65 2e 20 20 53 tations here. S
3ef0: 65 74 20 74 68 69 73 20 74 6f 20 30 2e 30 20 74 et this to 0.0 t
3f00: 6f 20 64 69 73 61 62 6c 65 20 74 68 65 20 6c 6f o disable the lo
3f10: 61 64 20 61 76 65 72 61 67 65 20 6c 69 6d 69 74 ad average limit
3f20: 2e 0a 20 20 40 20 54 68 69 73 20 6c 69 6d 69 74 .. @ This limit
3f30: 20 69 73 20 6f 6e 6c 79 20 65 6e 66 6f 72 63 65 is only enforce
3f40: 64 20 6f 6e 20 55 6e 69 78 20 73 65 72 76 65 72 d on Unix server
3f50: 73 2e 20 20 4f 6e 20 4c 69 6e 75 78 20 73 79 73 s. On Linux sys
3f60: 74 65 6d 73 2c 0a 20 20 40 20 61 63 63 65 73 73 tems,. @ access
3f70: 20 74 6f 20 74 68 65 20 2f 70 72 6f 63 20 76 69 to the /proc vi
3f80: 72 74 75 61 6c 20 66 69 6c 65 73 79 73 74 65 6d rtual filesystem
3f90: 20 69 73 20 72 65 71 75 69 72 65 64 2c 20 77 68 is required, wh
3fa0: 69 63 68 20 6d 65 61 6e 73 20 74 68 69 73 20 6c ich means this l
3fb0: 69 6d 69 74 0a 20 20 40 20 6d 69 67 68 74 20 6e imit. @ might n
3fc0: 6f 74 20 77 6f 72 6b 20 69 6e 73 69 64 65 20 61 ot work inside a
3fd0: 20 63 68 72 6f 6f 74 28 29 20 6a 61 69 6c 2e 0a chroot() jail..
3fe0: 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 @ (Property: "
3ff0: 6d 61 78 2d 6c 6f 61 64 61 76 67 22 29 3c 2f 70 max-loadavg")</p
4000: 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 >.. @ <hr />.
4010: 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 onoff_attribute(
4020: 0a 20 20 20 20 20 20 22 45 6e 61 62 6c 65 20 68 . "Enable h
4030: 79 70 65 72 6c 69 6e 6b 73 20 66 6f 72 20 5c 22 yperlinks for \"
4040: 6e 6f 62 6f 64 79 5c 22 20 62 61 73 65 64 20 6f nobody\" based o
4050: 6e 20 55 73 65 72 2d 41 67 65 6e 74 20 61 6e 64 n User-Agent and
4060: 20 4a 61 76 61 73 63 72 69 70 74 22 2c 0a 20 20 Javascript",.
4070: 20 20 20 20 22 61 75 74 6f 2d 68 79 70 65 72 6c "auto-hyperl
4080: 69 6e 6b 22 2c 20 22 61 75 74 6f 68 79 70 65 72 ink", "autohyper
4090: 6c 69 6e 6b 22 2c 20 31 2c 20 30 29 3b 0a 20 20 link", 1, 0);.
40a0: 40 20 3c 70 3e 45 6e 61 62 6c 65 20 68 79 70 65 @ <p>Enable hype
40b0: 72 6c 69 6e 6b 73 20 28 74 68 65 20 65 71 75 69 rlinks (the equi
40c0: 76 61 6c 65 6e 74 20 6f 66 20 74 68 65 20 22 68 valent of the "h
40d0: 22 20 70 65 72 6d 69 73 73 69 6f 6e 29 20 66 6f " permission) fo
40e0: 72 20 61 6c 6c 20 75 73 65 72 73 2c 0a 20 20 40 r all users,. @
40f0: 20 69 6e 63 6c 75 64 69 6e 67 20 75 73 65 72 20 including user
4100: 22 6e 6f 62 6f 64 79 22 2c 20 61 73 20 6c 6f 6e "nobody", as lon
4110: 67 20 61 73 0a 20 20 40 20 3c 6f 6c 3e 3c 6c 69 g as. @ <ol><li
4120: 3e 74 68 65 20 55 73 65 72 2d 41 67 65 6e 74 20 >the User-Agent
4130: 73 74 72 69 6e 67 20 69 6e 20 74 68 65 0a 20 20 string in the.
4140: 40 20 48 54 54 50 20 68 65 61 64 65 72 20 69 6e @ HTTP header in
4150: 64 69 63 61 74 65 73 20 74 68 61 74 20 74 68 65 dicates that the
4160: 20 72 65 71 75 65 73 74 20 69 73 20 63 6f 6d 69 request is comi
4170: 6e 67 20 66 72 6f 6d 20 61 6e 20 61 63 74 75 61 ng from an actua
4180: 6c 20 68 75 6d 61 6e 0a 20 20 40 20 62 65 69 6e l human. @ bein
4190: 67 2c 20 61 6e 64 0a 20 20 40 20 3c 6c 69 3e 74 g, and. @ <li>t
41a0: 68 65 20 75 73 65 72 20 61 67 65 6e 74 20 69 73 he user agent is
41b0: 20 61 62 6c 65 20 74 6f 0a 20 20 40 20 72 75 6e able to. @ run
41c0: 20 4a 61 76 61 73 63 72 69 70 74 20 69 6e 20 6f Javascript in o
41d0: 72 64 65 72 20 74 6f 20 73 65 74 20 74 68 65 20 rder to set the
41e0: 68 72 65 66 3d 20 61 74 74 72 69 62 75 74 65 20 href= attribute
41f0: 6f 66 20 68 79 70 65 72 6c 69 6e 6b 73 2c 20 61 of hyperlinks, a
4200: 6e 64 0a 20 20 40 20 3c 6c 69 3e 6d 6f 75 73 65 nd. @ <li>mouse
4210: 20 6d 6f 76 65 6d 65 6e 74 20 69 73 20 64 65 74 movement is det
4220: 65 63 74 65 64 20 28 6f 70 74 69 6f 6e 61 6c 20 ected (optional
4230: 2d 20 73 65 65 20 74 68 65 20 63 68 65 63 6b 62 - see the checkb
4240: 6f 78 20 62 65 6c 6f 77 29 2c 20 61 6e 64 0a 20 ox below), and.
4250: 20 40 20 3c 6c 69 3e 61 20 6e 75 6d 62 65 72 20 @ <li>a number
4260: 6f 66 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 of milliseconds
4270: 68 61 76 65 20 70 61 73 73 65 64 20 73 69 6e 63 have passed sinc
4280: 65 20 74 68 65 20 70 61 67 65 20 6c 6f 61 64 65 e the page loade
4290: 64 2e 3c 2f 6f 6c 3e 0a 20 20 40 0a 20 20 40 20 d.</ol>. @. @
42a0: 3c 70 3e 54 68 69 73 20 73 65 74 74 69 6e 67 20 <p>This setting
42b0: 69 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 67 is designed to g
42c0: 69 76 65 20 65 61 73 79 20 61 63 63 65 73 73 20 ive easy access
42d0: 74 6f 20 68 75 6d 61 6e 73 20 77 68 69 6c 65 0a to humans while.
42e0: 20 20 40 20 6b 65 65 70 69 6e 67 20 6f 75 74 20 @ keeping out
42f0: 72 6f 62 6f 74 73 20 61 6e 64 20 73 70 69 64 65 robots and spide
4300: 72 73 2e 0a 20 20 40 20 59 6f 75 20 64 6f 20 6e rs.. @ You do n
4310: 6f 74 20 6e 6f 72 6d 61 6c 6c 79 20 77 61 6e 74 ot normally want
4320: 20 61 20 72 6f 62 6f 74 20 74 6f 20 77 61 6c 6b a robot to walk
4330: 20 79 6f 75 72 20 65 6e 74 69 72 65 20 72 65 70 your entire rep
4340: 6f 73 69 74 6f 72 79 20 62 65 63 61 75 73 65 0a ository because.
4350: 20 20 40 20 69 66 20 69 74 20 64 6f 65 73 2c 20 @ if it does,
4360: 79 6f 75 72 20 73 65 72 76 65 72 20 77 69 6c 6c your server will
4370: 20 65 6e 64 20 75 70 20 63 6f 6d 70 75 74 69 6e end up computin
4380: 67 20 64 69 66 66 73 20 61 6e 64 20 61 6e 6e 6f g diffs and anno
4390: 74 61 74 69 6f 6e 73 20 66 6f 72 0a 20 20 40 20 tations for. @
43a0: 65 76 65 72 79 20 68 69 73 74 6f 72 69 63 61 6c every historical
43b0: 20 76 65 72 73 69 6f 6e 20 6f 66 20 65 76 65 72 version of ever
43c0: 79 20 66 69 6c 65 20 61 6e 64 20 63 72 65 61 74 y file and creat
43d0: 69 6e 67 20 5a 49 50 73 20 61 6e 64 20 74 61 72 ing ZIPs and tar
43e0: 62 61 6c 6c 73 20 6f 66 0a 20 20 40 20 65 76 65 balls of. @ eve
43f0: 72 79 20 68 69 73 74 6f 72 69 63 61 6c 20 63 68 ry historical ch
4400: 65 63 6b 2d 69 6e 2c 20 77 68 69 63 68 20 63 61 eck-in, which ca
4410: 6e 20 75 73 65 20 61 20 6c 6f 74 20 6f 66 20 43 n use a lot of C
4420: 50 55 20 61 6e 64 20 62 61 6e 64 77 69 64 74 68 PU and bandwidth
4430: 0a 20 20 40 20 65 76 65 6e 20 66 6f 72 20 72 65 . @ even for re
4440: 6c 61 74 69 76 65 6c 79 20 73 6d 61 6c 6c 20 70 latively small p
4450: 72 6f 6a 65 63 74 73 2e 3c 2f 70 3e 0a 20 20 40 rojects.</p>. @
4460: 0a 20 20 40 20 3c 70 3e 41 64 64 69 74 69 6f 6e . @ <p>Addition
4470: 61 6c 20 70 61 72 61 6d 65 74 65 72 73 20 74 68 al parameters th
4480: 61 74 20 63 6f 6e 74 72 6f 6c 20 74 68 69 73 20 at control this
4490: 62 65 68 61 76 69 6f 72 3a 3c 2f 70 3e 0a 20 20 behavior:</p>.
44a0: 40 20 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 @ <blockquote>.
44b0: 20 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 onoff_attribute
44c0: 28 22 52 65 71 75 69 72 65 20 6d 6f 75 73 65 20 ("Require mouse
44d0: 6d 6f 76 65 6d 65 6e 74 20 62 65 66 6f 72 65 20 movement before
44e0: 65 6e 61 62 6c 69 6e 67 20 68 79 70 65 72 6c 69 enabling hyperli
44f0: 6e 6b 73 22 2c 0a 20 20 20 20 20 20 20 20 20 20 nks",.
4500: 20 20 20 20 20 20 20 20 22 61 75 74 6f 2d 68 79 "auto-hy
4510: 70 65 72 6c 69 6e 6b 2d 6d 6f 75 73 65 6f 76 65 perlink-mouseove
4520: 72 22 2c 20 22 61 68 6d 6f 22 2c 20 30 2c 20 30 r", "ahmo", 0, 0
4530: 29 3b 0a 20 20 40 20 3c 62 72 20 2f 3e 0a 20 20 );. @ <br />.
4540: 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 65 28 entry_attribute(
4550: 22 44 65 6c 61 79 20 69 6e 20 6d 69 6c 6c 69 73 "Delay in millis
4560: 65 63 6f 6e 64 73 20 62 65 66 6f 72 65 20 65 6e econds before en
4570: 61 62 6c 69 6e 67 20 68 79 70 65 72 6c 69 6e 6b abling hyperlink
4580: 73 22 2c 20 35 2c 0a 20 20 20 20 20 20 20 20 20 s", 5,.
4590: 20 20 20 20 20 20 20 20 20 22 61 75 74 6f 2d 68 "auto-h
45a0: 79 70 65 72 6c 69 6e 6b 2d 64 65 6c 61 79 22 2c yperlink-delay",
45b0: 20 22 61 68 2d 64 65 6c 61 79 22 2c 20 22 35 30 "ah-delay", "50
45c0: 22 2c 20 30 29 3b 0a 20 20 40 20 3c 2f 62 6c 6f ", 0);. @ </blo
45d0: 63 6b 71 75 6f 74 65 3e 0a 20 20 40 20 3c 70 3e ckquote>. @ <p>
45e0: 46 6f 72 20 6d 61 78 69 6d 75 6d 20 72 6f 62 6f For maximum robo
45f0: 74 20 64 65 66 65 6e 73 65 2c 20 74 68 65 20 22 t defense, the "
4600: 72 65 71 75 69 72 65 20 6d 6f 75 73 65 20 6d 6f require mouse mo
4610: 76 65 6d 65 6e 74 22 20 73 68 6f 75 6c 64 0a 20 vement" should.
4620: 20 40 20 62 65 20 74 75 72 6e 65 64 20 6f 6e 20 @ be turned on
4630: 61 6e 64 20 74 68 65 20 22 44 65 6c 61 79 22 20 and the "Delay"
4640: 73 68 6f 75 6c 64 20 62 65 20 61 74 20 6c 65 61 should be at lea
4650: 73 74 20 35 30 20 6d 69 6c 6c 69 73 65 63 6f 6e st 50 millisecon
4660: 64 73 2e 3c 2f 70 3e 0a 20 20 40 20 28 50 72 6f ds.</p>. @ (Pro
4670: 70 65 72 74 69 65 73 3a 20 22 61 75 74 6f 2d 68 perties: "auto-h
4680: 79 70 65 72 6c 69 6e 6b 22 2c 0a 20 20 40 20 22 yperlink",. @ "
4690: 61 75 74 6f 2d 68 79 70 65 72 6c 69 6e 6b 2d 6d auto-hyperlink-m
46a0: 6f 75 73 65 6f 76 65 72 22 2c 20 61 6e 64 20 22 ouseover", and "
46b0: 61 75 74 6f 2d 68 79 70 65 72 6c 69 6e 6b 2d 64 auto-hyperlink-d
46c0: 65 6c 61 79 22 29 3c 2f 70 3e 0a 0a 20 20 40 20 elay")</p>.. @
46d0: 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 <hr />. onoff_a
46e0: 74 74 72 69 62 75 74 65 28 22 52 65 71 75 69 72 ttribute("Requir
46f0: 65 20 61 20 43 41 50 54 43 48 41 20 69 66 20 6e e a CAPTCHA if n
4700: 6f 74 20 6c 6f 67 67 65 64 20 69 6e 22 2c 0a 20 ot logged in",.
4710: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4720: 20 22 72 65 71 75 69 72 65 2d 63 61 70 74 63 68 "require-captch
4730: 61 22 2c 20 22 72 65 71 63 61 70 74 22 2c 20 31 a", "reqcapt", 1
4740: 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 52 65 71 , 0);. @ <p>Req
4750: 75 69 72 65 20 61 20 43 41 50 54 43 48 41 20 66 uire a CAPTCHA f
4760: 6f 72 20 65 64 69 74 20 6f 70 65 72 61 74 69 6f or edit operatio
4770: 6e 73 20 28 61 70 70 65 6e 64 69 6e 67 2c 20 63 ns (appending, c
4780: 72 65 61 74 69 6e 67 2c 20 6f 72 0a 20 20 40 20 reating, or. @
4790: 65 64 69 74 69 6e 67 20 77 69 6b 69 20 6f 72 20 editing wiki or
47a0: 74 69 63 6b 65 74 73 20 6f 72 20 61 64 64 69 6e tickets or addin
47b0: 67 20 61 74 74 61 63 68 6d 65 6e 74 73 20 74 6f g attachments to
47c0: 20 77 69 6b 69 20 6f 72 20 74 69 63 6b 65 74 73 wiki or tickets
47d0: 29 0a 20 20 40 20 66 6f 72 20 75 73 65 72 73 20 ). @ for users
47e0: 77 68 6f 20 61 72 65 20 6e 6f 74 20 6c 6f 67 67 who are not logg
47f0: 65 64 20 69 6e 2e 20 28 50 72 6f 70 65 72 74 79 ed in. (Property
4800: 3a 20 22 72 65 71 75 69 72 65 2d 63 61 70 74 63 : "require-captc
4810: 68 61 22 29 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 ha")</p>.. @ <h
4820: 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 r />. entry_att
4830: 72 69 62 75 74 65 28 22 50 75 62 6c 69 63 20 70 ribute("Public p
4840: 61 67 65 73 22 2c 20 33 30 2c 20 22 70 75 62 6c ages", 30, "publ
4850: 69 63 2d 70 61 67 65 73 22 2c 0a 20 20 20 20 20 ic-pages",.
4860: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 70 75 "pu
4870: 62 70 61 67 65 22 2c 20 22 22 2c 20 30 29 3b 0a bpage", "", 0);.
4880: 20 20 40 20 3c 70 3e 41 20 63 6f 6d 6d 61 2d 73 @ <p>A comma-s
4890: 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 eparated list of
48a0: 20 67 6c 6f 62 20 70 61 74 74 65 72 6e 73 20 66 glob patterns f
48b0: 6f 72 20 70 61 67 65 73 20 74 68 61 74 20 61 72 or pages that ar
48c0: 65 20 61 63 63 65 73 73 69 62 6c 65 0a 20 20 40 e accessible. @
48d0: 20 77 69 74 68 6f 75 74 20 6e 65 65 64 69 6e 67 without needing
48e0: 20 61 20 6c 6f 67 69 6e 20 61 6e 64 20 75 73 69 a login and usi
48f0: 6e 67 20 74 68 65 20 70 72 69 76 69 6c 65 67 65 ng the privilege
4900: 73 20 67 69 76 65 6e 20 62 79 20 74 68 65 0a 20 s given by the.
4910: 20 40 20 22 44 65 66 61 75 6c 74 20 70 72 69 76 @ "Default priv
4920: 69 6c 65 67 65 73 22 20 73 65 74 74 69 6e 67 20 ileges" setting
4930: 62 65 6c 6f 77 2e 20 0a 20 20 40 0a 20 20 40 20 below. . @. @
4940: 3c 70 3e 45 78 61 6d 70 6c 65 20 75 73 65 20 63 <p>Example use c
4950: 61 73 65 3a 20 53 65 74 20 74 68 69 73 20 66 69 ase: Set this fi
4960: 65 6c 64 20 74 6f 20 22 2f 64 6f 63 2f 74 72 75 eld to "/doc/tru
4970: 6e 6b 2f 77 77 77 2f 2a 22 20 61 6e 64 20 73 65 nk/www/*" and se
4980: 74 0a 20 20 40 20 74 68 65 20 22 44 65 66 61 75 t. @ the "Defau
4990: 6c 74 20 70 72 69 76 69 6c 65 67 65 73 22 20 74 lt privileges" t
49a0: 6f 20 69 6e 63 6c 75 64 65 20 74 68 65 20 22 6f o include the "o
49b0: 22 20 70 72 69 76 69 6c 65 67 65 0a 20 20 40 20 " privilege. @
49c0: 74 6f 20 67 69 76 65 20 61 6e 6f 6e 79 6d 6f 75 to give anonymou
49d0: 73 20 75 73 65 72 73 20 72 65 61 64 2d 6f 6e 6c s users read-onl
49e0: 79 20 70 65 72 6d 69 73 73 69 6f 6e 20 74 6f 20 y permission to
49f0: 74 68 65 0a 20 20 40 20 6c 61 74 65 73 74 20 76 the. @ latest v
4a00: 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 65 6d ersion of the em
4a10: 62 65 64 64 65 64 20 64 6f 63 75 6d 65 6e 74 61 bedded documenta
4a20: 74 69 6f 6e 20 69 6e 20 74 68 65 20 77 77 77 2f tion in the www/
4a30: 20 66 6f 6c 64 65 72 20 77 69 74 68 6f 75 74 0a folder without.
4a40: 20 20 40 20 61 6c 6c 6f 77 69 6e 67 20 74 68 65 @ allowing the
4a50: 6d 20 74 6f 20 73 65 65 20 74 68 65 20 72 65 73 m to see the res
4a60: 74 20 6f 66 20 74 68 65 20 73 6f 75 72 63 65 20 t of the source
4a70: 63 6f 64 65 2e 0a 20 20 40 20 28 50 72 6f 70 65 code.. @ (Prope
4a80: 72 74 79 3a 20 22 70 75 62 6c 69 63 2d 70 61 67 rty: "public-pag
4a90: 65 73 22 29 0a 20 20 40 20 3c 2f 70 3e 0a 0a 20 es"). @ </p>..
4aa0: 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 @ <hr />. onof
4ab0: 66 5f 61 74 74 72 69 62 75 74 65 28 22 41 6c 6c f_attribute("All
4ac0: 6f 77 20 75 73 65 72 73 20 74 6f 20 72 65 67 69 ow users to regi
4ad0: 73 74 65 72 20 74 68 65 6d 73 65 6c 76 65 73 22 ster themselves"
4ae0: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.
4af0: 20 20 20 20 22 73 65 6c 66 2d 72 65 67 69 73 74 "self-regist
4b00: 65 72 22 2c 20 22 73 65 6c 66 72 65 67 22 2c 20 er", "selfreg",
4b10: 30 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 41 6c 0, 0);. @ <p>Al
4b20: 6c 6f 77 20 75 73 65 72 73 20 74 6f 20 72 65 67 low users to reg
4b30: 69 73 74 65 72 20 74 68 65 6d 73 65 6c 76 65 73 ister themselves
4b40: 20 6f 6e 20 74 68 65 20 2f 72 65 67 69 73 74 65 on the /registe
4b50: 72 20 77 65 62 70 61 67 65 2e 0a 20 20 40 20 41 r webpage.. @ A
4b60: 20 73 65 6c 66 2d 72 65 67 69 73 74 72 61 74 69 self-registrati
4b70: 6f 6e 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 on creates a new
4b80: 20 65 6e 74 72 79 20 69 6e 20 74 68 65 20 55 53 entry in the US
4b90: 45 52 20 74 61 62 6c 65 20 61 6e 64 0a 20 20 40 ER table and. @
4ba0: 20 70 65 72 68 61 70 73 20 61 6c 73 6f 20 69 6e perhaps also in
4bb0: 20 74 68 65 20 53 55 42 53 43 52 49 42 45 52 20 the SUBSCRIBER
4bc0: 74 61 62 6c 65 20 69 66 20 65 6d 61 69 6c 20 6e table if email n
4bd0: 6f 74 69 66 69 63 61 74 69 6f 6e 20 69 73 0a 20 otification is.
4be0: 20 40 20 65 6e 61 62 6c 65 64 2e 0a 20 20 40 20 @ enabled.. @
4bf0: 28 50 72 6f 70 65 72 74 79 3a 20 22 73 65 6c 66 (Property: "self
4c00: 2d 72 65 67 69 73 74 65 72 22 29 3c 2f 70 3e 0a -register")</p>.
4c10: 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e . @ <hr />. on
4c20: 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 45 off_attribute("E
4c30: 6d 61 69 6c 20 76 65 72 69 66 69 63 61 74 69 6f mail verificatio
4c40: 6e 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 73 n required for s
4c50: 65 6c 66 2d 72 65 67 69 73 74 72 61 74 69 6f 6e elf-registration
4c60: 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ",.
4c70: 20 20 20 20 20 22 73 65 6c 66 72 65 67 2d 76 65 "selfreg-ve
4c80: 72 69 66 79 22 2c 20 22 73 66 76 65 72 69 66 79 rify", "sfverify
4c90: 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 3c 70 ", 0, 0);. @ <p
4ca0: 3e 49 66 20 65 6e 61 62 6c 65 64 2c 20 73 65 6c >If enabled, sel
4cb0: 66 2d 72 65 67 69 73 74 72 61 74 69 6f 6e 20 63 f-registration c
4cc0: 72 65 61 74 65 73 20 61 20 6e 65 77 20 65 6e 74 reates a new ent
4cd0: 72 79 20 69 6e 20 74 68 65 20 55 53 45 52 20 74 ry in the USER t
4ce0: 61 62 6c 65 0a 20 20 40 20 77 69 74 68 20 6f 6e able. @ with on
4cf0: 6c 79 20 63 61 70 61 62 69 6c 69 74 69 65 73 20 ly capabilities
4d00: 22 37 22 2e 20 20 54 68 65 20 64 65 66 61 75 6c "7". The defaul
4d10: 74 20 75 73 65 72 20 63 61 70 61 62 69 6c 69 74 t user capabilit
4d20: 69 65 73 20 61 72 65 20 6e 6f 74 0a 20 20 40 20 ies are not. @
4d30: 61 64 64 65 64 20 75 6e 74 69 6c 20 74 68 65 20 added until the
4d40: 65 6d 61 69 6c 20 61 64 64 72 65 73 73 20 61 73 email address as
4d50: 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 sociated with th
4d60: 65 20 73 65 6c 66 2d 72 65 67 69 73 74 72 61 74 e self-registrat
4d70: 69 6f 6e 0a 20 20 40 20 68 61 73 20 62 65 65 6e ion. @ has been
4d80: 20 76 65 72 69 66 69 65 64 2e 20 54 68 69 73 20 verified. This
4d90: 73 65 74 74 69 6e 67 20 6f 6e 6c 79 20 6d 61 6b setting only mak
4da0: 65 73 20 73 65 6e 73 65 20 69 66 0a 20 20 40 20 es sense if. @
4db0: 65 6d 61 69 6c 20 6e 6f 74 69 66 69 63 61 74 69 email notificati
4dc0: 6f 6e 73 20 61 72 65 20 65 6e 61 62 6c 65 64 2e ons are enabled.
4dd0: 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 . @ (Property:
4de0: 22 73 65 6c 66 72 65 67 2d 76 65 72 69 66 79 22 "selfreg-verify"
4df0: 29 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 72 20 2f )</p>.. @ <hr /
4e00: 3e 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 72 69 62 >. onoff_attrib
4e10: 75 74 65 28 22 41 6c 6c 6f 77 20 61 6e 6f 6e 79 ute("Allow anony
4e20: 6d 6f 75 73 20 73 75 62 73 63 72 69 70 74 69 6f mous subscriptio
4e30: 6e 73 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 ns",.
4e40: 20 20 20 20 20 20 20 22 61 6e 6f 6e 2d 73 75 62 "anon-sub
4e50: 73 63 72 69 62 65 22 2c 20 22 61 6e 6f 6e 73 75 scribe", "anonsu
4e60: 62 22 2c 20 31 2c 20 30 29 3b 0a 20 20 40 20 3c b", 1, 0);. @ <
4e70: 70 3e 49 66 20 64 69 73 61 62 6c 65 64 2c 20 65 p>If disabled, e
4e80: 6d 61 69 6c 20 6e 6f 74 69 66 69 63 61 74 69 6f mail notificatio
4e90: 6e 20 73 75 62 73 63 72 69 70 74 69 6f 6e 73 20 n subscriptions
4ea0: 61 72 65 20 6f 6e 6c 79 20 61 6c 6c 6f 77 65 64 are only allowed
4eb0: 0a 20 20 40 20 66 6f 72 20 75 73 65 72 73 20 77 . @ for users w
4ec0: 69 74 68 20 61 20 6c 6f 67 69 6e 2e 20 20 49 66 ith a login. If
4ed0: 20 4e 6f 62 6f 64 79 20 6f 72 20 41 6e 6f 6e 79 Nobody or Anony
4ee0: 6d 6f 75 73 20 76 69 73 69 74 20 74 68 65 20 2f mous visit the /
4ef0: 73 75 62 73 63 72 69 62 65 0a 20 20 40 20 70 61 subscribe. @ pa
4f00: 67 65 2c 20 74 68 65 79 20 61 72 65 20 72 65 64 ge, they are red
4f10: 69 72 65 63 74 65 64 20 74 6f 20 2f 72 65 67 69 irected to /regi
4f20: 73 74 65 72 20 6f 72 20 2f 6c 6f 67 69 6e 2e 0a ster or /login..
4f30: 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 @ (Property: "
4f40: 61 6e 6f 6e 2d 73 75 62 73 63 72 69 62 65 22 29 anon-subscribe")
4f50: 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e </p>.. @ <hr />
4f60: 0a 20 20 65 6e 74 72 79 5f 61 74 74 72 69 62 75 . entry_attribu
4f70: 74 65 28 22 41 75 74 68 6f 72 69 7a 65 64 20 73 te("Authorized s
4f80: 75 62 73 63 72 69 70 74 69 6f 6e 20 65 6d 61 69 ubscription emai
4f90: 6c 20 61 64 64 72 65 73 73 65 73 22 2c 20 33 35 l addresses", 35
4fa0: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.
4fb0: 20 20 20 20 22 61 75 74 68 2d 73 75 62 2d 65 6d "auth-sub-em
4fc0: 61 69 6c 22 2c 20 22 61 73 65 6d 61 69 6c 22 2c ail", "asemail",
4fd0: 20 22 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e "", 0);. @ <p>
4fe0: 54 68 69 73 20 69 73 20 61 20 63 6f 6d 6d 61 2d This is a comma-
4ff0: 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f separated list o
5000: 66 20 47 4c 4f 42 20 70 61 74 74 65 72 6e 73 20 f GLOB patterns
5010: 74 68 61 74 20 73 70 65 63 69 66 79 0a 20 20 40 that specify. @
5020: 20 65 6d 61 69 6c 20 61 64 64 72 65 73 73 65 73 email addresses
5030: 20 74 68 61 74 20 61 72 65 20 61 75 74 68 6f 72 that are author
5040: 69 7a 65 64 20 74 6f 20 73 75 62 73 63 72 69 70 ized to subscrip
5050: 74 69 6f 6e 73 2e 20 20 49 66 20 62 6c 61 6e 6b tions. If blank
5060: 0a 20 20 40 20 28 74 68 65 20 75 73 75 61 6c 20 . @ (the usual
5070: 63 61 73 65 29 2c 20 74 68 65 6e 20 61 6e 79 20 case), then any
5080: 65 6d 61 69 6c 20 61 64 64 72 65 73 73 20 63 61 email address ca
5090: 6e 20 62 65 20 75 73 65 64 20 74 6f 20 73 65 6c n be used to sel
50a0: 66 2d 72 65 67 69 73 74 65 72 2e 0a 20 20 40 20 f-register.. @
50b0: 54 68 69 73 20 73 65 74 74 69 6e 67 20 69 73 20 This setting is
50c0: 75 73 65 64 20 74 6f 20 6c 69 6d 69 74 20 73 75 used to limit su
50d0: 62 73 63 72 69 70 74 69 6f 6e 73 20 74 6f 20 6d bscriptions to m
50e0: 65 6d 62 65 72 73 20 6f 66 20 61 20 70 61 72 74 embers of a part
50f0: 69 63 75 6c 61 72 0a 20 20 40 20 6f 72 67 61 6e icular. @ organ
5100: 69 7a 61 74 69 6f 6e 20 6f 72 20 67 72 6f 75 70 ization or group
5110: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 69 72 20 based on their
5120: 65 6d 61 69 6c 20 61 64 64 72 65 73 73 2e 0a 20 email address..
5130: 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 61 @ (Property: "a
5140: 75 74 68 2d 73 75 62 2d 65 6d 61 69 6c 22 29 3c uth-sub-email")<
5150: 2f 70 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a /p>.. @ <hr />.
5160: 20 20 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 entry_attribut
5170: 65 28 22 44 65 66 61 75 6c 74 20 70 72 69 76 69 e("Default privi
5180: 6c 65 67 65 73 22 2c 20 31 30 2c 20 22 64 65 66 leges", 10, "def
5190: 61 75 6c 74 2d 70 65 72 6d 73 22 2c 0a 20 20 20 ault-perms",.
51a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
51b0: 64 65 66 61 75 6c 74 70 65 72 6d 73 22 2c 20 22 defaultperms", "
51c0: 75 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 50 u", 0);. @ <p>P
51d0: 65 72 6d 69 73 73 69 6f 6e 73 20 67 69 76 65 6e ermissions given
51e0: 20 74 6f 20 75 73 65 72 73 20 74 68 61 74 2e 2e to users that..
51f0: 2e 20 3c 75 6c 3e 3c 6c 69 3e 72 65 67 69 73 74 . <ul><li>regist
5200: 65 72 20 74 68 65 6d 73 65 6c 76 65 73 20 75 73 er themselves us
5210: 69 6e 67 0a 20 20 40 20 74 68 65 20 73 65 6c 66 ing. @ the self
5220: 2d 72 65 67 69 73 74 72 61 74 69 6f 6e 20 70 72 -registration pr
5230: 6f 63 65 64 75 72 65 20 28 69 66 20 65 6e 61 62 ocedure (if enab
5240: 6c 65 64 29 2c 20 6f 72 20 3c 6c 69 3e 61 63 63 led), or <li>acc
5250: 65 73 73 20 22 70 75 62 6c 69 63 22 0a 20 20 40 ess "public". @
5260: 20 70 61 67 65 73 20 69 64 65 6e 74 69 66 69 65 pages identifie
5270: 64 20 62 79 20 74 68 65 20 70 75 62 6c 69 63 2d d by the public-
5280: 70 61 67 65 73 20 67 6c 6f 62 20 70 61 74 74 65 pages glob patte
5290: 72 6e 20 61 62 6f 76 65 2c 20 6f 72 20 3c 6c 69 rn above, or <li
52a0: 3e 0a 20 20 40 20 61 72 65 20 75 73 65 72 73 20 >. @ are users
52b0: 6e 65 77 6c 79 20 63 72 65 61 74 65 64 20 62 79 newly created by
52c0: 20 74 68 65 20 61 64 6d 69 6e 69 73 74 72 61 74 the administrat
52d0: 6f 72 2e 3c 2f 75 6c 3e 0a 20 20 40 20 3c 70 3e or.</ul>. @ <p>
52e0: 52 65 63 6f 6d 6d 65 6e 64 65 64 20 76 61 6c 75 Recommended valu
52f0: 65 3a 20 22 75 22 20 66 6f 72 20 52 65 61 64 65 e: "u" for Reade
5300: 72 2e 0a 20 20 40 20 3c 61 20 68 72 65 66 3d 22 r.. @ <a href="
5310: 25 52 2f 73 65 74 75 70 5f 75 63 61 70 5f 6c 69 %R/setup_ucap_li
5320: 73 74 22 3e 43 61 70 61 62 69 6c 69 74 79 20 4b st">Capability K
5330: 65 79 3c 2f 61 3e 2e 0a 20 20 40 20 28 50 72 6f ey</a>.. @ (Pro
5340: 70 65 72 74 79 3a 20 22 64 65 66 61 75 6c 74 2d perty: "default-
5350: 70 65 72 6d 73 22 29 0a 20 20 40 20 3c 2f 70 3e perms"). @ </p>
5360: 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f .. @ <hr />. o
5370: 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 noff_attribute("
5380: 53 68 6f 77 20 6a 61 76 61 73 63 72 69 70 74 20 Show javascript
5390: 62 75 74 74 6f 6e 20 74 6f 20 66 69 6c 6c 20 69 button to fill i
53a0: 6e 20 43 41 50 54 43 48 41 22 2c 0a 20 20 20 20 n CAPTCHA",.
53b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 61 "a
53c0: 75 74 6f 2d 63 61 70 74 63 68 61 22 2c 20 22 61 uto-captcha", "a
53d0: 75 74 6f 63 61 70 74 63 68 61 22 2c 20 30 2c 20 utocaptcha", 0,
53e0: 30 29 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 20 0);. @ <p>When
53f0: 65 6e 61 62 6c 65 64 2c 20 61 20 62 75 74 74 6f enabled, a butto
5400: 6e 20 61 70 70 65 61 72 73 20 6f 6e 20 74 68 65 n appears on the
5410: 20 6c 6f 67 69 6e 20 73 63 72 65 65 6e 20 66 6f login screen fo
5420: 72 20 75 73 65 72 0a 20 20 40 20 22 61 6e 6f 6e r user. @ "anon
5430: 79 6d 6f 75 73 22 20 74 68 61 74 20 77 69 6c 6c ymous" that will
5440: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 66 automatically f
5450: 69 6c 6c 20 69 6e 20 74 68 65 20 43 41 50 54 43 ill in the CAPTC
5460: 48 41 20 70 61 73 73 77 6f 72 64 2e 0a 20 20 40 HA password.. @
5470: 20 54 68 69 73 20 69 73 20 6c 65 73 73 20 73 65 This is less se
5480: 63 75 72 65 20 74 68 61 6e 20 66 6f 72 63 69 6e cure than forcin
5490: 67 20 74 68 65 20 75 73 65 72 20 74 6f 20 64 6f g the user to do
54a0: 20 69 74 20 6d 61 6e 75 61 6c 6c 79 2c 20 62 75 it manually, bu
54b0: 74 20 69 73 0a 20 20 40 20 70 72 6f 62 61 62 6c t is. @ probabl
54c0: 79 20 73 65 63 75 72 65 20 65 6e 6f 75 67 68 20 y secure enough
54d0: 61 6e 64 20 69 74 20 69 73 20 63 65 72 74 61 69 and it is certai
54e0: 6e 6c 79 20 6d 6f 72 65 20 63 6f 6e 76 65 6e 69 nly more conveni
54f0: 65 6e 74 20 66 6f 72 0a 20 20 40 20 61 6e 6f 6e ent for. @ anon
5500: 79 6d 6f 75 73 20 75 73 65 72 73 2e 20 20 28 50 ymous users. (P
5510: 72 6f 70 65 72 74 79 3a 20 22 61 75 74 6f 2d 63 roperty: "auto-c
5520: 61 70 74 63 68 61 22 29 3c 2f 70 3e 0a 0a 20 20 aptcha")</p>..
5530: 40 20 3c 68 72 20 2f 3e 0a 20 20 40 20 3c 70 3e @ <hr />. @ <p>
5540: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 <input type="sub
5550: 6d 69 74 22 20 20 6e 61 6d 65 3d 22 73 75 62 6d mit" name="subm
5560: 69 74 22 20 76 61 6c 75 65 3d 22 41 70 70 6c 79 it" value="Apply
5570: 20 43 68 61 6e 67 65 73 22 20 2f 3e 3c 2f 70 3e Changes" /></p>
5580: 0a 20 20 40 20 3c 2f 64 69 76 3e 3c 2f 66 6f 72 . @ </div></for
5590: 6d 3e 0a 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e m>. db_end_tran
55a0: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 20 73 74 saction(0);. st
55b0: 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d 0a yle_footer();.}.
55c0: 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 3a 20 ./*.** WEBPAGE:
55d0: 73 65 74 75 70 5f 6c 6f 67 69 6e 5f 67 72 6f 75 setup_login_grou
55e0: 70 0a 2a 2a 0a 2a 2a 20 43 68 61 6e 67 65 20 68 p.**.** Change h
55f0: 6f 77 20 74 68 65 20 63 75 72 72 65 6e 74 20 72 ow the current r
5600: 65 70 6f 73 69 74 6f 72 79 20 70 61 72 74 69 63 epository partic
5610: 69 70 61 74 65 73 20 69 6e 20 61 20 6c 6f 67 69 ipates in a logi
5620: 6e 0a 2a 2a 20 67 72 6f 75 70 2e 0a 2a 2f 0a 76 n.** group..*/.v
5630: 6f 69 64 20 73 65 74 75 70 5f 6c 6f 67 69 6e 5f oid setup_login_
5640: 67 72 6f 75 70 28 76 6f 69 64 29 7b 0a 20 20 63 group(void){. c
5650: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 47 72 6f 75 onst char *zGrou
5660: 70 3b 0a 20 20 63 68 61 72 20 2a 7a 45 72 72 4d p;. char *zErrM
5670: 73 67 20 3d 20 30 3b 0a 20 20 42 6c 6f 62 20 66 sg = 0;. Blob f
5680: 75 6c 6c 4e 61 6d 65 3b 0a 20 20 63 68 61 72 20 ullName;. char
5690: 2a 7a 53 65 6c 66 52 65 70 6f 3b 0a 20 20 63 6f *zSelfRepo;. co
56a0: 6e 73 74 20 63 68 61 72 20 2a 7a 52 65 70 6f 20 nst char *zRepo
56b0: 3d 20 50 44 28 22 72 65 70 6f 22 2c 20 22 22 29 = PD("repo", "")
56c0: 3b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a ;. const char *
56d0: 7a 4c 6f 67 69 6e 20 3d 20 50 44 28 22 6c 6f 67 zLogin = PD("log
56e0: 69 6e 22 2c 20 22 22 29 3b 0a 20 20 63 6f 6e 73 in", "");. cons
56f0: 74 20 63 68 61 72 20 2a 7a 50 77 20 3d 20 50 44 t char *zPw = PD
5700: 28 22 70 77 22 2c 20 22 22 29 3b 0a 20 20 63 6f ("pw", "");. co
5710: 6e 73 74 20 63 68 61 72 20 2a 7a 4e 65 77 4e 61 nst char *zNewNa
5720: 6d 65 20 3d 20 50 44 28 22 6e 65 77 6e 61 6d 65 me = PD("newname
5730: 22 2c 20 22 4e 65 77 20 4c 6f 67 69 6e 20 47 72 ", "New Login Gr
5740: 6f 75 70 22 29 3b 0a 0a 20 20 6c 6f 67 69 6e 5f oup");.. login_
5750: 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 61 6c check_credential
5760: 73 28 29 3b 0a 20 20 69 66 28 20 21 67 2e 70 65 s();. if( !g.pe
5770: 72 6d 2e 53 65 74 75 70 20 29 7b 0a 20 20 20 20 rm.Setup ){.
5780: 6c 6f 67 69 6e 5f 6e 65 65 64 65 64 28 30 29 3b login_needed(0);
5790: 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d . return;. }
57a0: 0a 20 20 66 69 6c 65 5f 63 61 6e 6f 6e 69 63 61 . file_canonica
57b0: 6c 5f 6e 61 6d 65 28 67 2e 7a 52 65 70 6f 73 69 l_name(g.zReposi
57c0: 74 6f 72 79 4e 61 6d 65 2c 20 26 66 75 6c 6c 4e toryName, &fullN
57d0: 61 6d 65 2c 20 30 29 3b 0a 20 20 7a 53 65 6c 66 ame, 0);. zSelf
57e0: 52 65 70 6f 20 3d 20 66 6f 73 73 69 6c 5f 73 74 Repo = fossil_st
57f0: 72 64 75 70 28 62 6c 6f 62 5f 73 74 72 28 26 66 rdup(blob_str(&f
5800: 75 6c 6c 4e 61 6d 65 29 29 3b 0a 20 20 62 6c 6f ullName));. blo
5810: 62 5f 72 65 73 65 74 28 26 66 75 6c 6c 4e 61 6d b_reset(&fullNam
5820: 65 29 3b 0a 20 20 69 66 28 20 50 28 22 6a 6f 69 e);. if( P("joi
5830: 6e 22 29 21 3d 30 20 29 7b 0a 20 20 20 20 6c 6f n")!=0 ){. lo
5840: 67 69 6e 5f 67 72 6f 75 70 5f 6a 6f 69 6e 28 7a gin_group_join(z
5850: 52 65 70 6f 2c 20 31 2c 20 7a 4c 6f 67 69 6e 2c Repo, 1, zLogin,
5860: 20 7a 50 77 2c 20 7a 4e 65 77 4e 61 6d 65 2c 20 zPw, zNewName,
5870: 26 7a 45 72 72 4d 73 67 29 3b 0a 20 20 7d 65 6c &zErrMsg);. }el
5880: 73 65 20 69 66 28 20 50 28 22 6c 65 61 76 65 22 se if( P("leave"
5890: 29 20 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 67 ) ){. login_g
58a0: 72 6f 75 70 5f 6c 65 61 76 65 28 26 7a 45 72 72 roup_leave(&zErr
58b0: 4d 73 67 29 3b 0a 20 20 7d 0a 20 20 73 74 79 6c Msg);. }. styl
58c0: 65 5f 68 65 61 64 65 72 28 22 4c 6f 67 69 6e 20 e_header("Login
58d0: 47 72 6f 75 70 20 43 6f 6e 66 69 67 75 72 61 74 Group Configurat
58e0: 69 6f 6e 22 29 3b 0a 20 20 69 66 28 20 7a 45 72 ion");. if( zEr
58f0: 72 4d 73 67 20 29 7b 0a 20 20 20 20 40 20 3c 70 rMsg ){. @ <p
5900: 20 63 6c 61 73 73 3d 22 67 65 6e 65 72 61 6c 45 class="generalE
5910: 72 72 6f 72 22 3e 25 73 28 7a 45 72 72 4d 73 67 rror">%s(zErrMsg
5920: 29 3c 2f 70 3e 0a 20 20 7d 0a 20 20 7a 47 72 6f )</p>. }. zGro
5930: 75 70 20 3d 20 6c 6f 67 69 6e 5f 67 72 6f 75 70 up = login_group
5940: 5f 6e 61 6d 65 28 29 3b 0a 20 20 69 66 28 20 7a _name();. if( z
5950: 47 72 6f 75 70 3d 3d 30 20 29 7b 0a 20 20 20 20 Group==0 ){.
5960: 40 20 3c 70 3e 54 68 69 73 20 72 65 70 6f 73 69 @ <p>This reposi
5970: 74 6f 72 79 20 28 69 6e 20 74 68 65 20 66 69 6c tory (in the fil
5980: 65 20 6e 61 6d 65 64 20 22 25 68 28 7a 53 65 6c e named "%h(zSel
5990: 66 52 65 70 6f 29 22 29 0a 20 20 20 20 40 20 69 fRepo)"). @ i
59a0: 73 20 6e 6f 74 20 63 75 72 72 65 6e 74 6c 79 20 s not currently
59b0: 70 61 72 74 20 6f 66 20 61 6e 79 20 6c 6f 67 69 part of any logi
59c0: 6e 2d 67 72 6f 75 70 2e 0a 20 20 20 20 40 20 54 n-group.. @ T
59d0: 6f 20 6a 6f 69 6e 20 61 20 6c 6f 67 69 6e 20 67 o join a login g
59e0: 72 6f 75 70 2c 20 66 69 6c 6c 20 6f 75 74 20 74 roup, fill out t
59f0: 68 65 20 66 6f 72 6d 20 62 65 6c 6f 77 2e 3c 2f he form below.</
5a00: 70 3e 0a 20 20 20 20 40 0a 20 20 20 20 40 20 3c p>. @. @ <
5a10: 66 6f 72 6d 20 61 63 74 69 6f 6e 3d 22 25 52 2f form action="%R/
5a20: 73 65 74 75 70 5f 6c 6f 67 69 6e 5f 67 72 6f 75 setup_login_grou
5a30: 70 22 20 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 p" method="post"
5a40: 3e 3c 64 69 76 3e 0a 20 20 20 20 6c 6f 67 69 6e ><div>. login
5a50: 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 65 63 _insert_csrf_sec
5a60: 72 65 74 28 29 3b 0a 20 20 20 20 40 20 3c 62 6c ret();. @ <bl
5a70: 6f 63 6b 71 75 6f 74 65 3e 3c 74 61 62 6c 65 20 ockquote><table
5a80: 62 6f 72 64 65 72 3d 22 30 22 3e 0a 20 20 20 20 border="0">.
5a90: 40 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 68 20 @. @ <tr><th
5aa0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 20 69 64 align="right" id
5ab0: 3d 22 72 66 69 67 74 6a 22 3e 52 65 70 6f 73 69 ="rfigtj">Reposi
5ac0: 74 6f 72 79 20 66 69 6c 65 6e 61 6d 65 20 5c 0a tory filename \.
5ad0: 20 20 20 20 40 20 69 6e 20 67 72 6f 75 70 20 74 @ in group t
5ae0: 6f 20 6a 6f 69 6e 3a 3c 2f 74 68 3e 0a 20 20 20 o join:</th>.
5af0: 20 40 20 3c 74 64 20 77 69 64 74 68 3d 22 35 22 @ <td width="5"
5b00: 3e 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 ></td><td>. @
5b10: 20 3c 69 6e 70 75 74 20 61 72 69 61 2d 6c 61 62 <input aria-lab
5b20: 65 6c 6c 65 64 62 79 3d 22 72 66 69 67 74 6a 22 elledby="rfigtj"
5b30: 20 74 79 70 65 3d 22 74 65 78 74 22 20 73 69 7a type="text" siz
5b40: 65 3d 22 35 30 22 20 5c 0a 20 20 20 20 40 20 76 e="50" \. @ v
5b50: 61 6c 75 65 3d 22 25 68 28 7a 52 65 70 6f 29 22 alue="%h(zRepo)"
5b60: 20 6e 61 6d 65 3d 22 72 65 70 6f 22 3e 3c 2f 74 name="repo"></t
5b70: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 0a 20 20 d></tr>. @.
5b80: 20 20 40 20 3c 74 72 3e 3c 74 68 20 61 6c 69 67 @ <tr><th alig
5b90: 6e 3d 22 72 69 67 68 74 22 20 69 64 3d 22 6c 6f n="right" id="lo
5ba0: 74 61 72 22 3e 4c 6f 67 69 6e 20 6f 6e 20 74 68 tar">Login on th
5bb0: 65 20 61 62 6f 76 65 20 72 65 70 6f 3a 3c 2f 74 e above repo:</t
5bc0: 68 3e 0a 20 20 20 20 40 20 3c 74 64 20 77 69 64 h>. @ <td wid
5bd0: 74 68 3d 22 35 22 3e 3c 2f 74 64 3e 3c 74 64 3e th="5"></td><td>
5be0: 0a 20 20 20 20 40 20 3c 69 6e 70 75 74 20 61 72 . @ <input ar
5bf0: 69 61 2d 6c 61 62 65 6c 6c 65 64 62 79 3d 22 6c ia-labelledby="l
5c00: 6f 74 61 72 22 20 74 79 70 65 3d 22 74 65 78 74 otar" type="text
5c10: 22 20 73 69 7a 65 3d 22 32 30 22 20 5c 0a 20 20 " size="20" \.
5c20: 20 20 40 20 76 61 6c 75 65 3d 22 25 68 28 7a 4c @ value="%h(zL
5c30: 6f 67 69 6e 29 22 20 6e 61 6d 65 3d 22 6c 6f 67 ogin)" name="log
5c40: 69 6e 22 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 in"></td></tr>.
5c50: 20 20 20 40 0a 20 20 20 20 40 20 3c 74 72 3e 3c @. @ <tr><
5c60: 74 68 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 th align="right"
5c70: 20 69 64 3d 22 6c 67 70 77 22 3e 50 61 73 73 77 id="lgpw">Passw
5c80: 6f 72 64 3a 3c 2f 74 68 3e 0a 20 20 20 20 40 20 ord:</th>. @
5c90: 3c 74 64 20 77 69 64 74 68 3d 22 35 22 3e 3c 2f <td width="5"></
5ca0: 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 3c 69 td><td>. @ <i
5cb0: 6e 70 75 74 20 61 72 69 61 2d 6c 61 62 65 6c 6c nput aria-labell
5cc0: 65 64 62 79 3d 22 6c 67 70 77 22 20 74 79 70 65 edby="lgpw" type
5cd0: 3d 22 70 61 73 73 77 6f 72 64 22 20 73 69 7a 65 ="password" size
5ce0: 3d 22 32 30 22 20 6e 61 6d 65 3d 22 70 77 22 3e ="20" name="pw">
5cf0: 5c 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 \. @ </td></t
5d00: 72 3e 0a 20 20 20 20 40 0a 20 20 20 20 40 20 3c r>. @. @ <
5d10: 74 72 3e 3c 74 68 20 61 6c 69 67 6e 3d 22 72 69 tr><th align="ri
5d20: 67 68 74 22 20 69 64 3d 22 6e 6f 6c 67 22 3e 4e ght" id="nolg">N
5d30: 61 6d 65 20 6f 66 20 6c 6f 67 69 6e 2d 67 72 6f ame of login-gro
5d40: 75 70 3a 3c 2f 74 68 3e 0a 20 20 20 20 40 20 3c up:</th>. @ <
5d50: 74 64 20 77 69 64 74 68 3d 22 35 22 3e 3c 2f 74 td width="5"></t
5d60: 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 3c 69 6e d><td>. @ <in
5d70: 70 75 74 20 61 72 69 61 2d 6c 61 62 65 6c 6c 65 put aria-labelle
5d80: 64 62 79 3d 22 6e 6f 6c 67 22 20 74 79 70 65 3d dby="nolg" type=
5d90: 22 74 65 78 74 22 20 73 69 7a 65 3d 22 33 30 22 "text" size="30"
5da0: 20 5c 0a 20 20 20 20 40 20 76 61 6c 75 65 3d 22 \. @ value="
5db0: 25 68 28 7a 4e 65 77 4e 61 6d 65 29 22 20 6e 61 %h(zNewName)" na
5dc0: 6d 65 3d 22 6e 65 77 6e 61 6d 65 22 3e 0a 20 20 me="newname">.
5dd0: 20 20 40 20 28 6f 6e 6c 79 20 75 73 65 64 20 69 @ (only used i
5de0: 66 20 63 72 65 61 74 69 6e 67 20 61 20 6e 65 77 f creating a new
5df0: 20 6c 6f 67 69 6e 2d 67 72 6f 75 70 29 2e 3c 2f login-group).</
5e00: 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 0a 20 td></tr>. @.
5e10: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 63 6f 6c @ <tr><td col
5e20: 73 70 61 6e 3d 22 33 22 20 61 6c 69 67 6e 3d 22 span="3" align="
5e30: 63 65 6e 74 65 72 22 3e 0a 20 20 20 20 40 20 3c center">. @ <
5e40: 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d input type="subm
5e50: 69 74 22 20 76 61 6c 75 65 3d 22 4a 6f 69 6e 22 it" value="Join"
5e60: 20 6e 61 6d 65 3d 22 6a 6f 69 6e 22 3e 3c 2f 74 name="join"></t
5e70: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 2f d></tr>. @ </
5e80: 74 61 62 6c 65 3e 3c 2f 62 6c 6f 63 6b 71 75 6f table></blockquo
5e90: 74 65 3e 3c 2f 64 69 76 3e 3c 2f 66 6f 72 6d 3e te></div></form>
5ea0: 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 53 74 . }else{. St
5eb0: 6d 74 20 71 3b 0a 20 20 20 20 69 6e 74 20 6e 20 mt q;. int n
5ec0: 3d 20 30 3b 0a 20 20 20 20 40 20 3c 70 3e 54 68 = 0;. @ <p>Th
5ed0: 69 73 20 72 65 70 6f 73 69 74 6f 72 79 20 28 69 is repository (i
5ee0: 6e 20 74 68 65 20 66 69 6c 65 20 22 25 68 28 7a n the file "%h(z
5ef0: 53 65 6c 66 52 65 70 6f 29 22 29 0a 20 20 20 20 SelfRepo)").
5f00: 40 20 69 73 20 63 75 72 72 65 6e 74 6c 79 20 70 @ is currently p
5f10: 61 72 74 20 6f 66 20 74 68 65 20 22 3c 62 3e 25 art of the "<b>%
5f20: 68 28 7a 47 72 6f 75 70 29 3c 2f 62 3e 22 20 6c h(zGroup)</b>" l
5f30: 6f 67 69 6e 20 67 72 6f 75 70 2e 0a 20 20 20 20 ogin group..
5f40: 40 20 4f 74 68 65 72 20 72 65 70 6f 73 69 74 6f @ Other reposito
5f50: 72 69 65 73 20 69 6e 20 74 68 61 74 20 67 72 6f ries in that gro
5f60: 75 70 20 61 72 65 3a 3c 2f 70 3e 0a 20 20 20 20 up are:</p>.
5f70: 40 20 3c 74 61 62 6c 65 20 62 6f 72 64 65 72 3d @ <table border=
5f80: 22 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d "0" cellspacing=
5f90: 22 34 22 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c "4">. @ <tr><
5fa0: 74 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e 3c td colspan="2"><
5fb0: 74 68 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e th align="left">
5fc0: 50 72 6f 6a 65 63 74 20 4e 61 6d 65 3c 74 64 3e Project Name<td>
5fd0: 0a 20 20 20 20 40 20 3c 74 68 20 61 6c 69 67 6e . @ <th align
5fe0: 3d 22 6c 65 66 74 22 3e 52 65 70 6f 73 69 74 6f ="left">Reposito
5ff0: 72 79 20 46 69 6c 65 3c 2f 74 72 3e 0a 20 20 20 ry File</tr>.
6000: 20 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c 0a db_prepare(&q,.
6010: 20 20 20 20 20 20 20 22 53 45 4c 45 43 54 20 76 "SELECT v
6020: 61 6c 75 65 2c 22 0a 20 20 20 20 20 20 20 22 20 alue,". "
6030: 20 20 20 20 20 20 28 53 45 4c 45 43 54 20 76 61 (SELECT va
6040: 6c 75 65 20 46 52 4f 4d 20 63 6f 6e 66 69 67 22 lue FROM config"
6050: 0a 20 20 20 20 20 20 20 22 20 20 20 20 20 20 20 . "
6060: 20 20 57 48 45 52 45 20 6e 61 6d 65 3d 28 27 70 WHERE name=('p
6070: 65 65 72 2d 6e 61 6d 65 2d 27 20 7c 7c 20 73 75 eer-name-' || su
6080: 62 73 74 72 28 78 2e 6e 61 6d 65 2c 31 31 29 29 bstr(x.name,11))
6090: 29 22 0a 20 20 20 20 20 20 20 22 20 20 46 52 4f )". " FRO
60a0: 4d 20 63 6f 6e 66 69 67 20 41 53 20 78 22 0a 20 M config AS x".
60b0: 20 20 20 20 20 20 22 20 57 48 45 52 45 20 6e 61 " WHERE na
60c0: 6d 65 20 47 4c 4f 42 20 27 70 65 65 72 2d 72 65 me GLOB 'peer-re
60d0: 70 6f 2d 2a 27 22 0a 20 20 20 20 20 20 20 22 20 po-*'". "
60e0: 4f 52 44 45 52 20 42 59 20 76 61 6c 75 65 22 0a ORDER BY value".
60f0: 20 20 20 20 29 3b 0a 20 20 20 20 77 68 69 6c 65 );. while
6100: 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 ( db_step(&q)==S
6110: 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 QLITE_ROW ){.
6120: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a const char *z
6130: 52 65 70 6f 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e Repo = db_column
6140: 5f 74 65 78 74 28 26 71 2c 20 30 29 3b 0a 20 20 _text(&q, 0);.
6150: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
6160: 7a 54 69 74 6c 65 20 3d 20 64 62 5f 63 6f 6c 75 zTitle = db_colu
6170: 6d 6e 5f 74 65 78 74 28 26 71 2c 20 31 29 3b 0a mn_text(&q, 1);.
6180: 20 20 20 20 20 20 6e 2b 2b 3b 0a 20 20 20 20 20 n++;.
6190: 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e @ <tr><td align
61a0: 3d 22 72 69 67 68 74 22 3e 25 64 28 6e 29 2e 3c ="right">%d(n).<
61b0: 2f 74 64 3e 3c 74 64 20 77 69 64 74 68 3d 22 34 /td><td width="4
61c0: 22 3e 0a 20 20 20 20 20 20 40 20 3c 74 64 3e 25 ">. @ <td>%
61d0: 68 28 7a 54 69 74 6c 65 29 3c 74 64 20 77 69 64 h(zTitle)<td wid
61e0: 74 68 3d 22 31 30 22 3e 3c 74 64 3e 25 68 28 7a th="10"><td>%h(z
61f0: 52 65 70 6f 29 3c 2f 74 72 3e 0a 20 20 20 20 7d Repo)</tr>. }
6200: 0a 20 20 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 . db_finalize
6210: 28 26 71 29 3b 0a 20 20 20 20 40 20 3c 2f 74 61 (&q);. @ </ta
6220: 62 6c 65 3e 0a 20 20 20 20 40 0a 20 20 20 20 40 ble>. @. @
6230: 20 3c 70 3e 3c 66 6f 72 6d 20 61 63 74 69 6f 6e <p><form action
6240: 3d 22 25 52 2f 73 65 74 75 70 5f 6c 6f 67 69 6e ="%R/setup_login
6250: 5f 67 72 6f 75 70 22 20 6d 65 74 68 6f 64 3d 22 _group" method="
6260: 70 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 20 20 post"><div>.
6270: 6c 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 login_insert_csr
6280: 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 20 20 f_secret();.
6290: 40 20 54 6f 20 6c 65 61 76 65 20 74 68 69 73 20 @ To leave this
62a0: 6c 6f 67 69 6e 20 67 72 6f 75 70 20 70 72 65 73 login group pres
62b0: 73 0a 20 20 20 20 40 20 3c 69 6e 70 75 74 20 74 s. @ <input t
62c0: 79 70 65 3d 22 73 75 62 6d 69 74 22 20 76 61 6c ype="submit" val
62d0: 75 65 3d 22 4c 65 61 76 65 20 4c 6f 67 69 6e 20 ue="Leave Login
62e0: 47 72 6f 75 70 22 20 6e 61 6d 65 3d 22 6c 65 61 Group" name="lea
62f0: 76 65 22 3e 0a 20 20 20 20 40 20 3c 2f 66 6f 72 ve">. @ </for
6300: 6d 3e 3c 2f 70 3e 0a 20 20 20 20 40 20 3c 62 72 m></p>. @ <br
6310: 20 2f 3e 46 6f 72 20 62 65 73 74 20 72 65 73 75 />For best resu
6320: 6c 74 73 2c 20 75 73 65 20 74 68 65 20 73 61 6d lts, use the sam
6330: 65 20 6e 75 6d 62 65 72 20 6f 66 20 3c 61 20 68 e number of <a h
6340: 72 65 66 3d 22 73 65 74 75 70 5f 61 63 63 65 73 ref="setup_acces
6350: 73 23 69 70 74 22 3e 0a 20 20 20 20 40 20 49 50 s#ipt">. @ IP
6360: 20 6f 63 74 65 74 73 3c 2f 61 3e 20 69 6e 20 74 octets</a> in t
6370: 68 65 20 6c 6f 67 69 6e 20 63 6f 6f 6b 69 65 20 he login cookie
6380: 61 63 72 6f 73 73 20 61 6c 6c 20 72 65 70 6f 73 across all repos
6390: 69 74 6f 72 69 65 73 20 69 6e 20 74 68 65 0a 20 itories in the.
63a0: 20 20 20 40 20 73 61 6d 65 20 4c 6f 67 69 6e 20 @ same Login
63b0: 47 72 6f 75 70 2e 0a 20 20 20 20 40 20 3c 68 72 Group.. @ <hr
63c0: 20 2f 3e 3c 68 32 3e 49 6d 70 6c 65 6d 65 6e 74 /><h2>Implement
63d0: 61 74 69 6f 6e 20 44 65 74 61 69 6c 73 3c 2f 68 ation Details</h
63e0: 32 3e 0a 20 20 20 20 40 20 3c 70 3e 54 68 65 20 2>. @ <p>The
63f0: 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 66 69 following are fi
6400: 65 6c 64 73 20 66 72 6f 6d 20 74 68 65 20 43 4f elds from the CO
6410: 4e 46 49 47 20 74 61 62 6c 65 20 72 65 6c 61 74 NFIG table relat
6420: 65 64 20 74 6f 20 6c 6f 67 69 6e 2d 67 72 6f 75 ed to login-grou
6430: 70 73 2c 0a 20 20 20 20 40 20 70 72 6f 76 69 64 ps,. @ provid
6440: 65 64 20 68 65 72 65 20 66 6f 72 20 69 6e 73 74 ed here for inst
6450: 72 75 63 74 69 6f 6e 61 6c 20 61 6e 64 20 64 65 ructional and de
6460: 62 75 67 67 69 6e 67 20 70 75 72 70 6f 73 65 73 bugging purposes
6470: 3a 3c 2f 70 3e 0a 20 20 20 20 40 20 3c 74 61 62 :</p>. @ <tab
6480: 6c 65 20 62 6f 72 64 65 72 3d 27 31 27 20 63 6c le border='1' cl
6490: 61 73 73 3d 27 73 6f 72 74 61 62 6c 65 27 20 64 ass='sortable' d
64a0: 61 74 61 2d 63 6f 6c 75 6d 6e 2d 74 79 70 65 73 ata-column-types
64b0: 3d 27 74 74 74 27 20 5c 0a 20 20 20 20 40 20 64 ='ttt' \. @ d
64c0: 61 74 61 2d 69 6e 69 74 2d 73 6f 72 74 3d 27 31 ata-init-sort='1
64d0: 27 3e 0a 20 20 20 20 40 20 3c 74 68 65 61 64 3e '>. @ <thead>
64e0: 3c 74 72 3e 0a 20 20 20 20 40 20 3c 74 68 3e 43 <tr>. @ <th>C
64f0: 6f 6e 66 69 67 2e 4e 61 6d 65 3c 74 68 3e 43 6f onfig.Name<th>Co
6500: 6e 66 69 67 2e 56 61 6c 75 65 3c 74 68 3e 43 6f nfig.Value<th>Co
6510: 6e 66 69 67 2e 6d 74 69 6d 65 3c 2f 74 72 3e 0a nfig.mtime</tr>.
6520: 20 20 20 20 40 20 3c 2f 74 68 65 61 64 3e 3c 74 @ </thead><t
6530: 62 6f 64 79 3e 0a 20 20 20 20 64 62 5f 70 72 65 body>. db_pre
6540: 70 61 72 65 28 26 71 2c 20 22 53 45 4c 45 43 54 pare(&q, "SELECT
6550: 20 6e 61 6d 65 2c 20 76 61 6c 75 65 2c 20 64 61 name, value, da
6560: 74 65 74 69 6d 65 28 6d 74 69 6d 65 2c 27 75 6e tetime(mtime,'un
6570: 69 78 65 70 6f 63 68 27 29 20 46 52 4f 4d 20 63 ixepoch') FROM c
6580: 6f 6e 66 69 67 22 0a 20 20 20 20 20 20 20 20 20 onfig".
6590: 20 20 20 20 20 20 20 20 20 20 22 20 57 48 45 52 " WHER
65a0: 45 20 6e 61 6d 65 20 47 4c 4f 42 20 27 70 65 65 E name GLOB 'pee
65b0: 72 2d 2a 27 22 0a 20 20 20 20 20 20 20 20 20 20 r-*'".
65c0: 20 20 20 20 20 20 20 20 20 22 20 20 20 20 4f 52 " OR
65d0: 20 6e 61 6d 65 20 47 4c 4f 42 20 27 70 72 6f 6a name GLOB 'proj
65e0: 65 63 74 2d 2a 27 22 0a 20 20 20 20 20 20 20 20 ect-*'".
65f0: 20 20 20 20 20 20 20 20 20 20 20 22 20 20 20 20 "
6600: 4f 52 20 6e 61 6d 65 20 47 4c 4f 42 20 27 6c 6f OR name GLOB 'lo
6610: 67 69 6e 2d 67 72 6f 75 70 2d 2a 27 22 0a 20 20 gin-group-*'".
6620: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6630: 20 22 20 4f 52 44 45 52 20 42 59 20 6e 61 6d 65 " ORDER BY name
6640: 22 29 3b 0a 20 20 20 20 77 68 69 6c 65 28 20 64 ");. while( d
6650: 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 51 4c 49 b_step(&q)==SQLI
6660: 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 20 20 TE_ROW ){.
6670: 40 20 3c 74 72 3e 3c 74 64 3e 25 68 28 64 62 5f @ <tr><td>%h(db_
6680: 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c 30 column_text(&q,0
6690: 29 29 3c 2f 74 64 3e 0a 20 20 20 20 20 20 40 20 ))</td>. @
66a0: 3c 74 64 3e 25 68 28 64 62 5f 63 6f 6c 75 6d 6e <td>%h(db_column
66b0: 5f 74 65 78 74 28 26 71 2c 31 29 29 3c 2f 74 64 _text(&q,1))</td
66c0: 3e 0a 20 20 20 20 20 20 40 20 3c 74 64 3e 25 68 >. @ <td>%h
66d0: 28 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 (db_column_text(
66e0: 26 71 2c 32 29 29 3c 2f 74 64 3e 3c 2f 74 72 3e &q,2))</td></tr>
66f0: 0a 20 20 20 20 7d 0a 20 20 20 20 64 62 5f 66 69 . }. db_fi
6700: 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 20 20 20 20 nalize(&q);.
6710: 40 20 3c 2f 74 62 6f 64 79 3e 3c 2f 74 61 62 6c @ </tbody></tabl
6720: 65 3e 0a 20 20 20 20 73 74 79 6c 65 5f 74 61 62 e>. style_tab
6730: 6c 65 5f 73 6f 72 74 65 72 28 29 3b 0a 20 20 7d le_sorter();. }
6740: 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 . style_footer(
6750: 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 );.}../*.** WEBP
6760: 41 47 45 3a 20 73 65 74 75 70 5f 74 69 6d 65 6c AGE: setup_timel
6770: 69 6e 65 0a 2a 2a 0a 2a 2a 20 45 64 69 74 20 61 ine.**.** Edit a
6780: 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 73 65 dministrative se
6790: 74 74 69 6e 67 73 20 63 6f 6e 74 72 6f 6c 6c 69 ttings controlli
67a0: 6e 67 20 74 68 65 20 64 69 73 70 6c 61 79 20 6f ng the display o
67b0: 66 0a 2a 2a 20 74 69 6d 65 6c 69 6e 65 73 2e 0a f.** timelines..
67c0: 2a 2f 0a 76 6f 69 64 20 73 65 74 75 70 5f 74 69 */.void setup_ti
67d0: 6d 65 6c 69 6e 65 28 76 6f 69 64 29 7b 0a 20 20 meline(void){.
67e0: 64 6f 75 62 6c 65 20 74 6d 44 69 66 66 3b 0a 20 double tmDiff;.
67f0: 20 63 68 61 72 20 7a 54 6d 44 69 66 66 5b 32 30 char zTmDiff[20
6800: 5d 3b 0a 20 20 73 74 61 74 69 63 20 63 6f 6e 73 ];. static cons
6810: 74 20 63 68 61 72 20 2a 63 6f 6e 73 74 20 61 7a t char *const az
6820: 54 69 6d 65 46 6f 72 6d 61 74 73 5b 5d 20 3d 20 TimeFormats[] =
6830: 7b 0a 20 20 20 20 20 20 22 30 22 2c 20 22 48 48 {. "0", "HH
6840: 3a 4d 4d 22 2c 0a 20 20 20 20 20 20 22 31 22 2c :MM",. "1",
6850: 20 22 48 48 3a 4d 4d 3a 53 53 22 2c 0a 20 20 20 "HH:MM:SS",.
6860: 20 20 20 22 32 22 2c 20 22 59 59 59 59 2d 4d 4d "2", "YYYY-MM
6870: 2d 44 44 20 48 48 3a 4d 4d 22 2c 0a 20 20 20 20 -DD HH:MM",.
6880: 20 20 22 33 22 2c 20 22 59 59 4d 4d 44 44 20 48 "3", "YYMMDD H
6890: 48 3a 4d 4d 22 2c 0a 20 20 20 20 20 20 22 34 22 H:MM",. "4"
68a0: 2c 20 22 28 6f 66 66 29 22 0a 20 20 7d 3b 0a 20 , "(off)". };.
68b0: 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 login_check_cre
68c0: 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 dentials();. if
68d0: 28 20 21 67 2e 70 65 72 6d 2e 41 64 6d 69 6e 20 ( !g.perm.Admin
68e0: 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 ){. login_nee
68f0: 64 65 64 28 30 29 3b 0a 20 20 20 20 72 65 74 75 ded(0);. retu
6900: 72 6e 3b 0a 20 20 7d 0a 0a 20 20 73 74 79 6c 65 rn;. }.. style
6910: 5f 68 65 61 64 65 72 28 22 54 69 6d 65 6c 69 6e _header("Timelin
6920: 65 20 44 69 73 70 6c 61 79 20 50 72 65 66 65 72 e Display Prefer
6930: 65 6e 63 65 73 22 29 3b 0a 20 20 64 62 5f 62 65 ences");. db_be
6940: 67 69 6e 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 gin_transaction(
6950: 29 3b 0a 20 20 40 20 3c 66 6f 72 6d 20 61 63 74 );. @ <form act
6960: 69 6f 6e 3d 22 25 52 2f 73 65 74 75 70 5f 74 69 ion="%R/setup_ti
6970: 6d 65 6c 69 6e 65 22 20 6d 65 74 68 6f 64 3d 22 meline" method="
6980: 70 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 6c 6f post"><div>. lo
6990: 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f gin_insert_csrf_
69a0: 73 65 63 72 65 74 28 29 3b 0a 20 20 40 20 3c 70 secret();. @ <p
69b0: 3e 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 ><input type="su
69c0: 62 6d 69 74 22 20 20 6e 61 6d 65 3d 22 73 75 62 bmit" name="sub
69d0: 6d 69 74 22 20 76 61 6c 75 65 3d 22 41 70 70 6c mit" value="Appl
69e0: 79 20 43 68 61 6e 67 65 73 22 20 2f 3e 3c 2f 70 y Changes" /></p
69f0: 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 >.. @ <hr />.
6a00: 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 onoff_attribute(
6a10: 22 41 6c 6c 6f 77 20 62 6c 6f 63 6b 2d 6d 61 72 "Allow block-mar
6a20: 6b 75 70 20 69 6e 20 74 69 6d 65 6c 69 6e 65 22 kup in timeline"
6a30: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.
6a40: 20 20 20 20 22 74 69 6d 65 6c 69 6e 65 2d 62 6c "timeline-bl
6a50: 6f 63 6b 2d 6d 61 72 6b 75 70 22 2c 20 22 74 62 ock-markup", "tb
6a60: 6d 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 3c m", 0, 0);. @ <
6a70: 70 3e 49 6e 20 74 69 6d 65 6c 69 6e 65 20 64 69 p>In timeline di
6a80: 73 70 6c 61 79 73 2c 20 63 68 65 63 6b 2d 69 6e splays, check-in
6a90: 20 63 6f 6d 6d 65 6e 74 73 20 63 61 6e 20 62 65 comments can be
6aa0: 20 64 69 73 70 6c 61 79 65 64 20 77 69 74 68 20 displayed with
6ab0: 6f 72 0a 20 20 40 20 77 69 74 68 6f 75 74 20 62 or. @ without b
6ac0: 6c 6f 63 6b 20 6d 61 72 6b 75 70 20 73 75 63 68 lock markup such
6ad0: 20 61 73 20 70 61 72 61 67 72 61 70 68 73 2c 20 as paragraphs,
6ae0: 74 61 62 6c 65 73 2c 20 65 74 63 2e 0a 20 20 40 tables, etc.. @
6af0: 20 28 50 72 6f 70 65 72 74 79 3a 20 22 74 69 6d (Property: "tim
6b00: 65 6c 69 6e 65 2d 62 6c 6f 63 6b 2d 6d 61 72 6b eline-block-mark
6b10: 75 70 22 29 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 up")</p>.. @ <h
6b20: 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 r />. onoff_att
6b30: 72 69 62 75 74 65 28 22 50 6c 61 69 6e 74 65 78 ribute("Plaintex
6b40: 74 20 63 6f 6d 6d 65 6e 74 73 20 6f 6e 20 74 69 t comments on ti
6b50: 6d 65 6c 69 6e 65 73 22 2c 0a 20 20 20 20 20 20 melines",.
6b60: 20 20 20 20 20 20 20 20 20 20 20 20 22 74 69 6d "tim
6b70: 65 6c 69 6e 65 2d 70 6c 61 69 6e 74 65 78 74 22 eline-plaintext"
6b80: 2c 20 22 74 70 74 22 2c 20 30 2c 20 30 29 3b 0a , "tpt", 0, 0);.
6b90: 20 20 40 20 3c 70 3e 49 6e 20 74 69 6d 65 6c 69 @ <p>In timeli
6ba0: 6e 65 20 64 69 73 70 6c 61 79 73 2c 20 63 68 65 ne displays, che
6bb0: 63 6b 2d 69 6e 20 63 6f 6d 6d 65 6e 74 73 20 61 ck-in comments a
6bc0: 72 65 20 64 69 73 70 6c 61 79 65 64 20 6c 69 74 re displayed lit
6bd0: 65 72 61 6c 6c 79 2c 0a 20 20 40 20 77 69 74 68 erally,. @ with
6be0: 6f 75 74 20 61 6e 79 20 77 69 6b 69 20 6f 72 20 out any wiki or
6bf0: 48 54 4d 4c 20 69 6e 74 65 72 70 72 65 74 61 74 HTML interpretat
6c00: 69 6f 6e 2e 20 20 55 73 65 20 43 53 53 20 74 6f ion. Use CSS to
6c10: 20 63 68 61 6e 67 65 0a 20 20 40 20 64 69 73 70 change. @ disp
6c20: 6c 61 79 20 66 6f 72 6d 61 74 74 69 6e 67 20 66 lay formatting f
6c30: 65 61 74 75 72 65 73 20 73 75 63 68 20 61 73 20 eatures such as
6c40: 66 6f 6e 74 73 20 61 6e 64 20 6c 69 6e 65 2d 77 fonts and line-w
6c50: 72 61 70 70 69 6e 67 20 62 65 68 61 76 69 6f 72 rapping behavior
6c60: 2e 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a .. @ (Property:
6c70: 20 22 74 69 6d 65 6c 69 6e 65 2d 70 6c 61 69 6e "timeline-plain
6c80: 74 65 78 74 22 29 3c 2f 70 3e 0a 0a 20 20 40 20 text")</p>.. @
6c90: 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 <hr />. onoff_a
6ca0: 74 74 72 69 62 75 74 65 28 22 54 72 75 6e 63 61 ttribute("Trunca
6cb0: 74 65 20 63 6f 6d 6d 65 6e 74 20 61 74 20 66 69 te comment at fi
6cc0: 72 73 74 20 62 6c 61 6e 6b 20 6c 69 6e 65 20 28 rst blank line (
6cd0: 47 69 74 2d 73 74 79 6c 65 29 22 2c 0a 20 20 20 Git-style)",.
6ce0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
6cf0: 74 69 6d 65 6c 69 6e 65 2d 74 72 75 6e 63 61 74 timeline-truncat
6d00: 65 2d 61 74 2d 62 6c 61 6e 6b 22 2c 20 22 74 74 e-at-blank", "tt
6d10: 62 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 3c b", 0, 0);. @ <
6d20: 70 3e 49 6e 20 74 69 6d 65 6c 69 6e 65 20 64 69 p>In timeline di
6d30: 73 70 6c 61 79 73 2c 20 63 68 65 63 6b 2d 69 6e splays, check-in
6d40: 20 63 6f 6d 6d 65 6e 74 73 20 61 72 65 20 64 69 comments are di
6d50: 73 70 6c 61 79 65 64 20 6f 6e 6c 79 20 74 68 72 splayed only thr
6d60: 6f 75 67 68 0a 20 20 40 20 74 68 65 20 66 69 72 ough. @ the fir
6d70: 73 74 20 62 6c 61 6e 6b 20 6c 69 6e 65 2e 20 20 st blank line.
6d80: 54 68 69 73 20 69 73 20 74 68 65 20 74 72 61 64 This is the trad
6d90: 69 74 69 6f 6e 61 6c 20 77 61 79 20 74 6f 20 64 itional way to d
6da0: 69 73 70 6c 61 79 20 63 6f 6d 6d 65 6e 74 73 0a isplay comments.
6db0: 20 20 40 20 69 6e 20 47 69 74 20 72 65 70 6f 73 @ in Git repos
6dc0: 69 74 6f 72 69 65 73 20 28 50 72 6f 70 65 72 74 itories (Propert
6dd0: 79 3a 20 22 74 69 6d 65 6c 69 6e 65 2d 74 72 75 y: "timeline-tru
6de0: 6e 63 61 74 65 2d 61 74 2d 62 6c 61 6e 6b 22 29 ncate-at-blank")
6df0: 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 72 20 2f 3e </p>.. @ <hr />
6e00: 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 . onoff_attribu
6e10: 74 65 28 22 42 72 65 61 6b 20 63 6f 6d 6d 65 6e te("Break commen
6e20: 74 73 20 61 74 20 6e 65 77 6c 69 6e 65 20 63 68 ts at newline ch
6e30: 61 72 61 63 74 65 72 73 22 2c 0a 20 20 20 20 20 aracters",.
6e40: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 74 69 "ti
6e50: 6d 65 6c 69 6e 65 2d 68 61 72 64 2d 6e 65 77 6c meline-hard-newl
6e60: 69 6e 65 73 22 2c 20 22 74 68 6e 6c 22 2c 20 30 ines", "thnl", 0
6e70: 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 49 6e 20 , 0);. @ <p>In
6e80: 74 69 6d 65 6c 69 6e 65 20 64 69 73 70 6c 61 79 timeline display
6e90: 73 2c 20 6e 65 77 6c 69 6e 65 20 63 68 61 72 61 s, newline chara
6ea0: 63 74 65 72 73 20 69 6e 20 63 68 65 63 6b 2d 69 cters in check-i
6eb0: 6e 20 63 6f 6d 6d 65 6e 74 73 20 66 6f 72 63 65 n comments force
6ec0: 0a 20 20 40 20 61 20 6c 69 6e 65 20 62 72 65 61 . @ a line brea
6ed0: 6b 20 6f 6e 20 74 68 65 20 64 69 73 70 6c 61 79 k on the display
6ee0: 2e 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a .. @ (Property:
6ef0: 20 22 74 69 6d 65 6c 69 6e 65 2d 68 61 72 64 2d "timeline-hard-
6f00: 6e 65 77 6c 69 6e 65 73 22 29 3c 2f 70 3e 0a 0a newlines")</p>..
6f10: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f @ <hr />. ono
6f20: 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 55 73 ff_attribute("Us
6f30: 65 20 55 6e 69 76 65 72 73 61 6c 20 43 6f 6f 72 e Universal Coor
6f40: 64 69 6e 61 74 65 64 20 54 69 6d 65 20 28 55 54 dinated Time (UT
6f50: 43 29 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 C)",.
6f60: 20 20 20 20 20 20 20 22 74 69 6d 65 6c 69 6e 65 "timeline
6f70: 2d 75 74 63 22 2c 20 22 75 74 63 22 2c 20 31 2c -utc", "utc", 1,
6f80: 20 30 29 3b 0a 20 20 40 20 3c 70 3e 53 68 6f 77 0);. @ <p>Show
6f90: 20 74 69 6d 65 73 20 61 73 20 55 54 43 20 28 61 times as UTC (a
6fa0: 6c 73 6f 20 73 6f 6d 65 74 69 6d 65 73 20 63 61 lso sometimes ca
6fb0: 6c 6c 65 64 20 47 72 65 65 6e 77 69 63 68 20 4d lled Greenwich M
6fc0: 65 61 6e 20 54 69 6d 65 20 28 47 4d 54 29 20 6f ean Time (GMT) o
6fd0: 72 0a 20 20 40 20 5a 75 6c 75 29 20 69 6e 73 74 r. @ Zulu) inst
6fe0: 65 61 64 20 6f 66 20 69 6e 20 6c 6f 63 61 6c 20 ead of in local
6ff0: 74 69 6d 65 2e 20 20 4f 6e 20 74 68 69 73 20 73 time. On this s
7000: 65 72 76 65 72 2c 20 6c 6f 63 61 6c 20 74 69 6d erver, local tim
7010: 65 20 69 73 20 63 75 72 72 65 6e 74 6c 79 0a 20 e is currently.
7020: 20 74 6d 44 69 66 66 20 3d 20 64 62 5f 64 6f 75 tmDiff = db_dou
7030: 62 6c 65 28 30 2e 30 2c 20 22 53 45 4c 45 43 54 ble(0.0, "SELECT
7040: 20 6a 75 6c 69 61 6e 64 61 79 28 27 6e 6f 77 27 julianday('now'
7050: 29 22 29 3b 0a 20 20 74 6d 44 69 66 66 20 3d 20 )");. tmDiff =
7060: 64 62 5f 64 6f 75 62 6c 65 28 30 2e 30 2c 0a 20 db_double(0.0,.
7070: 20 20 20 20 20 20 20 22 53 45 4c 45 43 54 20 28 "SELECT (
7080: 6a 75 6c 69 61 6e 64 61 79 28 25 2e 31 37 67 2c julianday(%.17g,
7090: 27 6c 6f 63 61 6c 74 69 6d 65 27 29 2d 6a 75 6c 'localtime')-jul
70a0: 69 61 6e 64 61 79 28 25 2e 31 37 67 29 29 2a 32 ianday(%.17g))*2
70b0: 34 2e 30 22 2c 0a 20 20 20 20 20 20 20 20 74 6d 4.0",. tm
70c0: 44 69 66 66 2c 20 74 6d 44 69 66 66 29 3b 0a 20 Diff, tmDiff);.
70d0: 20 73 71 6c 69 74 65 33 5f 73 6e 70 72 69 6e 74 sqlite3_snprint
70e0: 66 28 73 69 7a 65 6f 66 28 7a 54 6d 44 69 66 66 f(sizeof(zTmDiff
70f0: 29 2c 20 7a 54 6d 44 69 66 66 2c 20 22 25 2e 31 ), zTmDiff, "%.1
7100: 66 22 2c 20 74 6d 44 69 66 66 29 3b 0a 20 20 69 f", tmDiff);. i
7110: 66 28 20 73 74 72 63 6d 70 28 7a 54 6d 44 69 66 f( strcmp(zTmDif
7120: 66 2c 20 22 30 2e 30 22 29 3d 3d 30 20 29 7b 0a f, "0.0")==0 ){.
7130: 20 20 20 20 40 20 74 68 65 20 73 61 6d 65 20 61 @ the same a
7140: 73 20 55 54 43 20 61 6e 64 20 73 6f 20 74 68 69 s UTC and so thi
7150: 73 20 73 65 74 74 69 6e 67 20 77 69 6c 6c 20 6d s setting will m
7160: 61 6b 65 20 6e 6f 20 64 69 66 66 65 72 65 6e 63 ake no differenc
7170: 65 20 69 6e 0a 20 20 20 20 40 20 74 68 65 20 64 e in. @ the d
7180: 69 73 70 6c 61 79 2e 3c 2f 70 3e 0a 20 20 7d 65 isplay.</p>. }e
7190: 6c 73 65 20 69 66 28 20 74 6d 44 69 66 66 3c 30 lse if( tmDiff<0
71a0: 2e 30 20 29 7b 0a 20 20 20 20 73 71 6c 69 74 65 .0 ){. sqlite
71b0: 33 5f 73 6e 70 72 69 6e 74 66 28 73 69 7a 65 6f 3_snprintf(sizeo
71c0: 66 28 7a 54 6d 44 69 66 66 29 2c 20 7a 54 6d 44 f(zTmDiff), zTmD
71d0: 69 66 66 2c 20 22 25 2e 31 66 22 2c 20 2d 74 6d iff, "%.1f", -tm
71e0: 44 69 66 66 29 3b 0a 20 20 20 20 40 20 25 73 28 Diff);. @ %s(
71f0: 7a 54 6d 44 69 66 66 29 20 68 6f 75 72 73 20 62 zTmDiff) hours b
7200: 65 68 69 6e 64 20 55 54 43 2e 3c 2f 70 3e 0a 20 ehind UTC.</p>.
7210: 20 7d 65 6c 73 65 7b 0a 20 20 20 20 40 20 25 73 }else{. @ %s
7220: 28 7a 54 6d 44 69 66 66 29 20 68 6f 75 72 73 20 (zTmDiff) hours
7230: 61 68 65 61 64 20 6f 66 20 55 54 43 2e 3c 2f 70 ahead of UTC.</p
7240: 3e 0a 20 20 7d 0a 20 20 40 20 3c 70 3e 28 50 72 >. }. @ <p>(Pr
7250: 6f 70 65 72 74 79 3a 20 22 74 69 6d 65 6c 69 6e operty: "timelin
7260: 65 2d 75 74 63 22 29 0a 0a 20 20 40 20 3c 68 72 e-utc").. @ <hr
7270: 20 2f 3e 0a 20 20 6d 75 6c 74 69 70 6c 65 5f 63 />. multiple_c
7280: 68 6f 69 63 65 5f 61 74 74 72 69 62 75 74 65 28 hoice_attribute(
7290: 22 53 74 79 6c 65 22 2c 20 22 74 69 6d 65 6c 69 "Style", "timeli
72a0: 6e 65 2d 64 65 66 61 75 6c 74 2d 73 74 79 6c 65 ne-default-style
72b0: 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 ",. "
72c0: 74 64 73 73 22 2c 20 22 30 22 2c 20 4e 5f 54 49 tdss", "0", N_TI
72d0: 4d 45 4c 49 4e 45 5f 56 49 45 57 5f 53 54 59 4c MELINE_VIEW_STYL
72e0: 45 2c 20 74 69 6d 65 6c 69 6e 65 5f 76 69 65 77 E, timeline_view
72f0: 5f 73 74 79 6c 65 73 29 3b 0a 20 20 40 20 3c 70 _styles);. @ <p
7300: 3e 54 68 65 20 64 65 66 61 75 6c 74 20 74 69 6d >The default tim
7310: 65 6c 69 6e 65 20 76 69 65 77 69 6e 67 20 73 74 eline viewing st
7320: 79 6c 65 2c 20 66 6f 72 20 77 68 65 6e 20 74 68 yle, for when th
7330: 65 20 75 73 65 72 20 68 61 73 20 6e 6f 74 0a 20 e user has not.
7340: 20 40 20 73 70 65 63 69 66 69 65 64 20 61 6e 20 @ specified an
7350: 61 6c 74 65 72 6e 61 74 69 76 65 2e 20 20 28 50 alternative. (P
7360: 72 6f 70 65 72 74 79 3a 20 22 74 69 6d 65 6c 69 roperty: "timeli
7370: 6e 65 2d 64 65 66 61 75 6c 74 2d 73 74 79 6c 65 ne-default-style
7380: 22 29 3c 2f 70 3e 0a 0a 20 20 40 20 3c 68 72 20 ")</p>.. @ <hr
7390: 2f 3e 0a 20 20 6d 75 6c 74 69 70 6c 65 5f 63 68 />. multiple_ch
73a0: 6f 69 63 65 5f 61 74 74 72 69 62 75 74 65 28 22 oice_attribute("
73b0: 50 65 72 2d 49 74 65 6d 20 54 69 6d 65 20 46 6f Per-Item Time Fo
73c0: 72 6d 61 74 22 2c 20 22 74 69 6d 65 6c 69 6e 65 rmat", "timeline
73d0: 2d 64 61 74 65 2d 66 6f 72 6d 61 74 22 2c 0a 20 -date-format",.
73e0: 20 20 20 20 20 20 20 20 20 20 20 22 74 64 66 22 "tdf"
73f0: 2c 20 22 30 22 2c 20 63 6f 75 6e 74 28 61 7a 54 , "0", count(azT
7400: 69 6d 65 46 6f 72 6d 61 74 73 29 2f 32 2c 20 61 imeFormats)/2, a
7410: 7a 54 69 6d 65 46 6f 72 6d 61 74 73 29 3b 0a 20 zTimeFormats);.
7420: 20 40 20 3c 70 3e 49 66 20 74 68 65 20 22 48 48 @ <p>If the "HH
7430: 3a 4d 4d 22 20 6f 72 20 22 48 48 3a 4d 4d 3a 53 :MM" or "HH:MM:S
7440: 53 22 20 66 6f 72 6d 61 74 20 69 73 20 73 65 6c S" format is sel
7450: 65 63 74 65 64 2c 20 74 68 65 6e 20 74 68 65 20 ected, then the
7460: 64 61 74 65 20 69 73 20 73 68 6f 77 6e 0a 20 20 date is shown.
7470: 40 20 69 6e 20 61 20 73 65 70 61 72 61 74 65 20 @ in a separate
7480: 62 6f 78 20 28 75 73 69 6e 67 20 43 53 53 20 63 box (using CSS c
7490: 6c 61 73 73 20 22 74 69 6d 65 6c 69 6e 65 44 61 lass "timelineDa
74a0: 74 65 22 29 20 77 68 65 6e 65 76 65 72 20 74 68 te") whenever th
74b0: 65 20 64 61 74 65 0a 20 20 40 20 63 68 61 6e 67 e date. @ chang
74c0: 65 73 2e 20 20 57 69 74 68 20 74 68 65 20 22 59 es. With the "Y
74d0: 59 59 59 2d 4d 4d 2d 44 44 26 6e 62 73 70 3b 48 YYY-MM-DD H
74e0: 48 3a 4d 4d 22 20 61 6e 64 20 22 59 59 4d 4d 44 H:MM" and "YYMMD
74f0: 44 20 2e 2e 2e 22 20 66 6f 72 6d 61 74 73 2c 0a D ..." formats,.
7500: 20 20 40 20 74 68 65 20 63 6f 6d 70 6c 65 74 65 @ the complete
7510: 20 64 61 74 65 20 61 6e 64 20 74 69 6d 65 20 69 date and time i
7520: 73 20 73 68 6f 77 6e 20 6f 6e 20 65 76 65 72 79 s shown on every
7530: 20 74 69 6d 65 6c 69 6e 65 20 65 6e 74 72 79 20 timeline entry
7540: 75 73 69 6e 67 20 74 68 65 0a 20 20 40 20 43 53 using the. @ CS
7550: 53 20 63 6c 61 73 73 20 22 74 69 6d 65 6c 69 6e S class "timelin
7560: 65 54 69 6d 65 22 2e 20 28 50 72 6f 70 65 72 74 eTime". (Propert
7570: 79 3a 20 22 74 69 6d 65 6c 69 6e 65 2d 64 61 74 y: "timeline-dat
7580: 65 2d 66 6f 72 6d 61 74 22 29 3c 2f 70 3e 0a 0a e-format")</p>..
7590: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 @ <hr />. ent
75a0: 72 79 5f 61 74 74 72 69 62 75 74 65 28 22 4d 61 ry_attribute("Ma
75b0: 78 20 74 69 6d 65 6c 69 6e 65 20 63 6f 6d 6d 65 x timeline comme
75c0: 6e 74 20 6c 65 6e 67 74 68 22 2c 20 36 2c 0a 20 nt length", 6,.
75d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
75e0: 20 22 74 69 6d 65 6c 69 6e 65 2d 6d 61 78 2d 63 "timeline-max-c
75f0: 6f 6d 6d 65 6e 74 22 2c 20 22 74 6d 63 22 2c 20 omment", "tmc",
7600: 22 30 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e "0", 0);. @ <p>
7610: 54 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 The maximum leng
7620: 74 68 20 6f 66 20 61 20 63 6f 6d 6d 65 6e 74 20 th of a comment
7630: 74 6f 20 62 65 20 64 69 73 70 6c 61 79 65 64 20 to be displayed
7640: 69 6e 20 61 20 74 69 6d 65 6c 69 6e 65 2e 0a 20 in a timeline..
7650: 20 40 20 22 30 22 20 74 68 65 72 65 20 69 73 20 @ "0" there is
7660: 6e 6f 20 6c 65 6e 67 74 68 20 6c 69 6d 69 74 2e no length limit.
7670: 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a 20 . @ (Property:
7680: 22 74 69 6d 65 6c 69 6e 65 2d 6d 61 78 2d 63 6f "timeline-max-co
7690: 6d 6d 65 6e 74 22 29 3c 2f 70 3e 0a 0a 20 20 40 mment")</p>.. @
76a0: 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f <hr />. entry_
76b0: 61 74 74 72 69 62 75 74 65 28 22 54 6f 6f 6c 74 attribute("Toolt
76c0: 69 70 20 64 77 65 6c 6c 20 74 69 6d 65 20 28 6d ip dwell time (m
76d0: 69 6c 6c 69 73 65 63 6f 6e 64 73 29 22 2c 20 36 illiseconds)", 6
76e0: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.
76f0: 20 20 20 20 22 74 69 6d 65 6c 69 6e 65 2d 64 77 "timeline-dw
7700: 65 6c 6c 74 69 6d 65 22 2c 20 22 74 64 74 22 2c elltime", "tdt",
7710: 20 22 31 30 30 22 2c 20 30 29 3b 0a 20 20 40 20 "100", 0);. @
7720: 3c 62 72 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 <br>. entry_att
7730: 72 69 62 75 74 65 28 22 54 6f 6f 6c 74 69 70 20 ribute("Tooltip
7740: 63 6c 6f 73 65 20 74 69 6d 65 20 28 6d 69 6c 6c close time (mill
7750: 69 73 65 63 6f 6e 64 73 29 22 2c 20 36 2c 0a 20 iseconds)", 6,.
7760: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7770: 20 22 74 69 6d 65 6c 69 6e 65 2d 63 6c 6f 73 65 "timeline-close
7780: 74 69 6d 65 22 2c 20 22 74 63 74 22 2c 20 22 32 time", "tct", "2
7790: 35 30 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 50", 0);. @ <p>
77a0: 54 68 65 20 3c 73 74 72 6f 6e 67 3e 64 77 65 6c The <strong>dwel
77b0: 6c 20 74 69 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 l time</strong>
77c0: 64 65 66 69 6e 65 73 20 68 6f 77 20 6c 6f 6e 67 defines how long
77d0: 20 74 68 65 20 6d 6f 75 73 65 20 70 6f 69 6e 74 the mouse point
77e0: 65 72 0a 20 20 40 20 73 68 6f 75 6c 64 20 62 65 er. @ should be
77f0: 20 73 74 61 74 69 6f 6e 61 72 79 20 61 62 6f 76 stationary abov
7800: 65 20 61 6e 20 6f 62 6a 65 63 74 20 6f 66 20 74 e an object of t
7810: 68 65 20 67 72 61 70 68 20 62 65 66 6f 72 65 20 he graph before
7820: 61 20 74 6f 6f 6c 74 69 70 0a 20 20 40 20 61 70 a tooltip. @ ap
7830: 70 65 61 72 73 2e 3c 62 72 3e 0a 20 20 40 20 54 pears.<br>. @ T
7840: 68 65 20 3c 73 74 72 6f 6e 67 3e 63 6c 6f 73 65 he <strong>close
7850: 20 74 69 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 64 time</strong> d
7860: 65 66 69 6e 65 73 20 68 6f 77 20 6c 6f 6e 67 20 efines how long
7870: 74 68 65 20 6d 6f 75 73 65 20 70 6f 69 6e 74 65 the mouse pointe
7880: 72 0a 20 20 40 20 63 61 6e 20 62 65 20 61 77 61 r. @ can be awa
7890: 79 20 66 72 6f 6d 20 61 6e 20 6f 62 6a 65 63 74 y from an object
78a0: 20 62 65 66 6f 72 65 20 61 20 74 6f 6f 6c 74 69 before a toolti
78b0: 70 20 69 73 20 63 6c 6f 73 65 64 2e 3c 2f 70 3e p is closed.</p>
78c0: 0a 20 20 40 20 3c 70 3e 53 65 74 20 3c 73 74 72 . @ <p>Set <str
78d0: 6f 6e 67 3e 64 77 65 6c 6c 20 74 69 6d 65 3c 2f ong>dwell time</
78e0: 73 74 72 6f 6e 67 3e 20 74 6f 20 22 30 22 20 74 strong> to "0" t
78f0: 6f 20 64 69 73 61 62 6c 65 20 74 6f 6f 6c 74 69 o disable toolti
7900: 70 73 2e 3c 62 72 3e 0a 20 20 40 20 53 65 74 20 ps.<br>. @ Set
7910: 3c 73 74 72 6f 6e 67 3e 63 6c 6f 73 65 20 74 69 <strong>close ti
7920: 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 74 6f 20 22 me</strong> to "
7930: 30 22 20 74 6f 20 6b 65 65 70 20 74 6f 6f 6c 74 0" to keep toolt
7940: 69 70 73 20 76 69 73 69 62 6c 65 20 75 6e 74 69 ips visible unti
7950: 6c 0a 20 20 40 20 74 68 65 20 6d 6f 75 73 65 20 l. @ the mouse
7960: 69 73 20 63 6c 69 63 6b 65 64 20 65 6c 73 65 77 is clicked elsew
7970: 68 65 72 65 2e 3c 70 3e 0a 20 20 40 20 3c 70 3e here.<p>. @ <p>
7980: 28 50 72 6f 70 65 72 74 69 65 73 3a 20 22 74 69 (Properties: "ti
7990: 6d 65 6c 69 6e 65 2d 64 77 65 6c 6c 74 69 6d 65 meline-dwelltime
79a0: 22 2c 20 22 74 69 6d 65 6c 69 6e 65 2d 63 6c 6f ", "timeline-clo
79b0: 73 65 74 69 6d 65 22 29 3c 2f 70 3e 0a 0a 20 20 setime")</p>..
79c0: 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 @ <hr />. onoff
79d0: 5f 61 74 74 72 69 62 75 74 65 28 22 54 69 6d 65 _attribute("Time
79e0: 73 74 61 6d 70 20 68 79 70 65 72 6c 69 6e 6b 73 stamp hyperlinks
79f0: 20 74 6f 20 2f 69 6e 66 6f 22 2c 0a 20 20 20 20 to /info",.
7a00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 74 "t
7a10: 69 6d 65 6c 69 6e 65 2d 74 73 6c 69 6e 6b 2d 69 imeline-tslink-i
7a20: 6e 66 6f 22 2c 20 22 74 74 6c 74 69 22 2c 20 30 nfo", "ttlti", 0
7a30: 2c 20 30 29 3b 0a 20 20 40 20 3c 70 3e 54 68 65 , 0);. @ <p>The
7a40: 20 68 79 70 65 72 6c 69 6e 6b 20 6f 6e 20 74 68 hyperlink on th
7a50: 65 20 74 69 6d 65 73 74 61 6d 70 20 61 73 73 6f e timestamp asso
7a60: 63 69 61 74 65 64 20 77 69 74 68 20 65 61 63 68 ciated with each
7a70: 20 74 69 6d 65 6c 69 6e 65 20 65 6e 74 72 79 2c timeline entry,
7a80: 0a 20 20 40 20 6f 6e 20 74 68 65 20 66 61 72 20 . @ on the far
7a90: 6c 65 66 74 2d 68 61 6e 64 20 73 69 64 65 20 6f left-hand side o
7aa0: 66 20 74 68 65 20 73 63 72 65 65 6e 2c 20 6e 6f f the screen, no
7ab0: 72 6d 61 6c 6c 79 20 74 61 72 67 65 74 73 20 61 rmally targets a
7ac0: 6e 6f 74 68 65 72 0a 20 20 40 20 2f 74 69 6d 65 nother. @ /time
7ad0: 6c 69 6e 65 20 70 61 67 65 20 74 68 61 74 20 73 line page that s
7ae0: 68 6f 77 73 20 74 68 65 20 65 6e 74 72 79 20 69 hows the entry i
7af0: 6e 20 63 6f 6e 74 65 78 74 2e 20 20 48 6f 77 65 n context. Howe
7b00: 76 65 72 2c 20 69 66 20 74 68 69 73 0a 20 20 40 ver, if this. @
7b10: 20 6f 70 74 69 6f 6e 20 69 73 20 74 75 72 6e 65 option is turne
7b20: 64 20 6f 6e 2c 20 74 68 61 74 20 68 79 70 65 72 d on, that hyper
7b30: 6c 69 6e 6b 20 74 61 72 67 65 74 73 20 74 68 65 link targets the
7b40: 20 2f 69 6e 66 6f 20 70 61 67 65 20 73 68 6f 77 /info page show
7b50: 69 6e 67 0a 20 20 40 20 74 68 65 20 64 65 74 61 ing. @ the deta
7b60: 69 6c 73 20 6f 66 20 74 68 65 20 65 6e 74 72 79 ils of the entry
7b70: 2e 0a 20 20 40 20 3c 70 3e 54 68 65 20 2f 74 69 .. @ <p>The /ti
7b80: 6d 65 6c 69 6e 65 20 6c 69 6e 6b 20 69 73 20 74 meline link is t
7b90: 68 65 20 64 65 66 61 75 6c 74 20 73 69 6e 63 65 he default since
7ba0: 20 69 74 20 69 73 20 6f 66 74 65 6e 20 75 73 65 it is often use
7bb0: 66 75 6c 20 74 6f 0a 20 20 40 20 73 65 65 20 61 ful to. @ see a
7bc0: 6e 20 65 6e 74 72 79 20 69 6e 20 63 6f 6e 74 65 n entry in conte
7bd0: 78 74 2c 20 61 6e 64 20 62 65 63 61 75 73 65 20 xt, and because
7be0: 74 68 61 74 20 6c 69 6e 6b 20 69 73 20 6e 6f 74 that link is not
7bf0: 20 6f 74 68 65 72 77 69 73 65 0a 20 20 40 20 61 otherwise. @ a
7c00: 63 63 65 73 73 69 62 6c 65 20 6f 6e 20 74 68 65 ccessible on the
7c10: 20 74 69 6d 65 6c 69 6e 65 2e 20 20 54 68 65 20 timeline. The
7c20: 2f 69 6e 66 6f 20 6c 69 6e 6b 20 69 73 20 61 6c /info link is al
7c30: 73 6f 20 61 63 63 65 73 73 69 62 6c 65 20 62 79 so accessible by
7c40: 0a 20 20 40 20 64 6f 75 62 6c 65 2d 63 6c 69 63 . @ double-clic
7c50: 6b 69 6e 67 20 74 68 65 20 74 69 6d 65 6c 69 6e king the timelin
7c60: 65 20 6e 6f 64 65 20 6f 72 20 62 79 20 63 6c 69 e node or by cli
7c70: 63 6b 69 6e 67 20 6f 6e 20 74 68 65 20 68 61 73 cking on the has
7c80: 68 20 74 68 61 74 0a 20 20 40 20 66 6f 6c 6c 6f h that. @ follo
7c90: 77 73 20 22 63 68 65 63 6b 2d 69 6e 3a 22 20 69 ws "check-in:" i
7ca0: 6e 20 74 68 65 20 73 75 70 70 6c 69 6d 65 6e 74 n the suppliment
7cb0: 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 al information s
7cc0: 65 63 74 69 6f 6e 20 6f 6e 20 74 68 65 0a 20 20 ection on the.
7cd0: 40 20 72 69 67 68 74 20 6f 66 20 74 68 65 20 65 @ right of the e
7ce0: 6e 74 72 79 2e 0a 20 20 40 20 3c 70 3e 28 50 72 ntry.. @ <p>(Pr
7cf0: 6f 70 65 72 74 69 65 73 3a 20 22 74 69 6d 65 6c operties: "timel
7d00: 69 6e 65 2d 74 73 6c 69 6e 6b 2d 69 6e 66 6f 22 ine-tslink-info"
7d10: 29 0a 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 ).. @ <hr />.
7d20: 40 20 3c 70 3e 3c 69 6e 70 75 74 20 74 79 70 65 @ <p><input type
7d30: 3d 22 73 75 62 6d 69 74 22 20 20 6e 61 6d 65 3d ="submit" name=
7d40: 22 73 75 62 6d 69 74 22 20 76 61 6c 75 65 3d 22 "submit" value="
7d50: 41 70 70 6c 79 20 43 68 61 6e 67 65 73 22 20 2f Apply Changes" /
7d60: 3e 3c 2f 70 3e 0a 20 20 40 20 3c 2f 64 69 76 3e ></p>. @ </div>
7d70: 3c 2f 66 6f 72 6d 3e 0a 20 20 64 62 5f 65 6e 64 </form>. db_end
7d80: 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b _transaction(0);
7d90: 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 . style_footer(
7da0: 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 );.}../*.** WEBP
7db0: 41 47 45 3a 20 73 65 74 75 70 5f 73 65 74 74 69 AGE: setup_setti
7dc0: 6e 67 73 0a 2a 2a 0a 2a 2a 20 43 68 61 6e 67 65 ngs.**.** Change
7dd0: 20 6f 72 20 76 69 65 77 20 6d 69 73 63 65 6c 6c or view miscell
7de0: 61 6e 65 6f 75 73 20 73 65 74 74 69 6e 67 73 2e aneous settings.
7df0: 20 20 50 61 72 74 20 6f 66 20 74 68 65 0a 2a 2a Part of the.**
7e00: 20 2f 73 65 74 75 70 20 70 61 67 65 73 20 72 65 /setup pages re
7e10: 71 75 69 72 69 6e 67 20 53 65 74 75 70 20 70 72 quiring Setup pr
7e20: 69 76 69 6c 65 67 65 73 2e 0a 2a 2f 0a 76 6f 69 ivileges..*/.voi
7e30: 64 20 73 65 74 75 70 5f 73 65 74 74 69 6e 67 73 d setup_settings
7e40: 28 76 6f 69 64 29 7b 0a 20 20 69 6e 74 20 6e 53 (void){. int nS
7e50: 65 74 74 69 6e 67 3b 0a 20 20 69 6e 74 20 69 3b etting;. int i;
7e60: 0a 20 20 53 65 74 74 69 6e 67 20 63 6f 6e 73 74 . Setting const
7e70: 20 2a 70 53 65 74 3b 0a 20 20 63 6f 6e 73 74 20 *pSet;. const
7e80: 53 65 74 74 69 6e 67 20 2a 61 53 65 74 74 69 6e Setting *aSettin
7e90: 67 20 3d 20 73 65 74 74 69 6e 67 5f 69 6e 66 6f g = setting_info
7ea0: 28 26 6e 53 65 74 74 69 6e 67 29 3b 0a 0a 20 20 (&nSetting);..
7eb0: 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 login_check_cred
7ec0: 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 entials();. if(
7ed0: 20 21 67 2e 70 65 72 6d 2e 53 65 74 75 70 20 29 !g.perm.Setup )
7ee0: 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 {. login_need
7ef0: 65 64 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 ed(0);. retur
7f00: 6e 3b 0a 20 20 7d 0a 0a 20 20 73 74 79 6c 65 5f n;. }.. style_
7f10: 68 65 61 64 65 72 28 22 53 65 74 74 69 6e 67 73 header("Settings
7f20: 22 29 3b 0a 20 20 69 66 28 21 67 2e 72 65 70 6f ");. if(!g.repo
7f30: 73 69 74 6f 72 79 4f 70 65 6e 29 7b 0a 20 20 20 sitoryOpen){.
7f40: 20 2f 2a 20 50 72 6f 76 69 64 65 20 72 65 61 64 /* Provide read
7f50: 2d 6f 6e 6c 79 20 61 63 63 65 73 73 20 74 6f 20 -only access to
7f60: 76 65 72 73 69 6f 6e 65 64 20 73 65 74 74 69 6e versioned settin
7f70: 67 73 2c 0a 20 20 20 20 20 20 20 62 75 74 20 6f gs,. but o
7f80: 6e 6c 79 20 69 66 20 6e 6f 20 72 65 70 6f 20 66 nly if no repo f
7f90: 69 6c 65 20 77 61 73 20 65 78 70 6c 69 63 69 74 ile was explicit
7fa0: 6c 79 20 70 72 6f 76 69 64 65 64 2e 20 2a 2f 0a ly provided. */.
7fb0: 20 20 20 20 64 62 5f 6f 70 65 6e 5f 6c 6f 63 61 db_open_loca
7fc0: 6c 28 30 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 62 l(0);. }. db_b
7fd0: 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69 6f 6e egin_transaction
7fe0: 28 29 3b 0a 20 20 40 20 3c 70 3e 53 65 74 74 69 ();. @ <p>Setti
7ff0: 6e 67 73 20 6d 61 72 6b 65 64 20 77 69 74 68 20 ngs marked with
8000: 28 76 29 20 61 72 65 20 22 76 65 72 73 69 6f 6e (v) are "version
8010: 61 62 6c 65 22 20 61 6e 64 20 77 69 6c 6c 20 62 able" and will b
8020: 65 20 6f 76 65 72 72 69 64 64 65 6e 0a 20 20 40 e overridden. @
8030: 20 62 79 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 by the contents
8040: 20 6f 66 20 6d 61 6e 61 67 65 64 20 66 69 6c 65 of managed file
8050: 73 20 6e 61 6d 65 64 0a 20 20 40 20 22 3c 74 74 s named. @ "<tt
8060: 3e 2e 66 6f 73 73 69 6c 2d 73 65 74 74 69 6e 67 >.fossil-setting
8070: 73 2f 3c 2f 74 74 3e 3c 69 3e 53 45 54 54 49 4e s/</tt><i>SETTIN
8080: 47 2d 4e 41 4d 45 3c 2f 69 3e 22 2e 0a 20 20 40 G-NAME</i>".. @
8090: 20 49 66 20 74 68 65 20 66 69 6c 65 20 66 6f 72 If the file for
80a0: 20 61 20 76 65 72 73 69 6f 6e 61 62 6c 65 20 73 a versionable s
80b0: 65 74 74 69 6e 67 20 65 78 69 73 74 73 2c 20 74 etting exists, t
80c0: 68 65 20 76 61 6c 75 65 20 63 61 6e 6e 6f 74 20 he value cannot
80d0: 62 65 0a 20 20 40 20 63 68 61 6e 67 65 64 20 6f be. @ changed o
80e0: 6e 20 74 68 69 73 20 73 63 72 65 65 6e 2e 3c 2f n this screen.</
80f0: 70 3e 3c 68 72 20 2f 3e 3c 70 3e 0a 20 20 40 0a p><hr /><p>. @.
8100: 20 20 40 20 3c 66 6f 72 6d 20 61 63 74 69 6f 6e @ <form action
8110: 3d 22 25 52 2f 73 65 74 75 70 5f 73 65 74 74 69 ="%R/setup_setti
8120: 6e 67 73 22 20 6d 65 74 68 6f 64 3d 22 70 6f 73 ngs" method="pos
8130: 74 22 3e 3c 64 69 76 3e 0a 20 20 40 20 3c 74 61 t"><div>. @ <ta
8140: 62 6c 65 20 62 6f 72 64 65 72 3d 22 30 22 3e 3c ble border="0"><
8150: 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74 tr><td valign="t
8160: 6f 70 22 3e 0a 20 20 6c 6f 67 69 6e 5f 69 6e 73 op">. login_ins
8170: 65 72 74 5f 63 73 72 66 5f 73 65 63 72 65 74 28 ert_csrf_secret(
8180: 29 3b 0a 20 20 66 6f 72 28 69 3d 30 2c 20 70 53 );. for(i=0, pS
8190: 65 74 3d 61 53 65 74 74 69 6e 67 3b 20 69 3c 6e et=aSetting; i<n
81a0: 53 65 74 74 69 6e 67 3b 20 69 2b 2b 2c 20 70 53 Setting; i++, pS
81b0: 65 74 2b 2b 29 7b 0a 20 20 20 20 69 66 28 20 70 et++){. if( p
81c0: 53 65 74 2d 3e 77 69 64 74 68 3d 3d 30 20 29 7b Set->width==0 ){
81d0: 0a 20 20 20 20 20 20 69 6e 74 20 68 61 73 56 65 . int hasVe
81e0: 72 73 69 6f 6e 61 62 6c 65 56 61 6c 75 65 20 3d rsionableValue =
81f0: 20 70 53 65 74 2d 3e 76 65 72 73 69 6f 6e 61 62 pSet->versionab
8200: 6c 65 20 26 26 0a 20 20 20 20 20 20 20 20 20 20 le &&.
8210: 28 64 62 5f 67 65 74 5f 76 65 72 73 69 6f 6e 65 (db_get_versione
8220: 64 28 70 53 65 74 2d 3e 6e 61 6d 65 2c 20 4e 55 d(pSet->name, NU
8230: 4c 4c 29 21 3d 30 29 3b 0a 20 20 20 20 20 20 6f LL)!=0);. o
8240: 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 noff_attribute("
8250: 22 2c 20 70 53 65 74 2d 3e 6e 61 6d 65 2c 0a 20 ", pSet->name,.
8260: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8270: 20 20 20 20 20 70 53 65 74 2d 3e 76 61 72 21 3d pSet->var!=
8280: 30 20 3f 20 70 53 65 74 2d 3e 76 61 72 20 3a 20 0 ? pSet->var :
8290: 70 53 65 74 2d 3e 6e 61 6d 65 2c 0a 20 20 20 20 pSet->name,.
82a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
82b0: 20 20 69 73 5f 74 72 75 74 68 28 70 53 65 74 2d is_truth(pSet-
82c0: 3e 64 65 66 29 2c 20 68 61 73 56 65 72 73 69 6f >def), hasVersio
82d0: 6e 61 62 6c 65 56 61 6c 75 65 29 3b 0a 20 20 20 nableValue);.
82e0: 20 20 20 40 20 3c 61 20 68 72 65 66 3d 27 25 52 @ <a href='%R
82f0: 2f 68 65 6c 70 3f 63 6d 64 3d 25 73 28 70 53 65 /help?cmd=%s(pSe
8300: 74 2d 3e 6e 61 6d 65 29 27 3e 25 68 28 70 53 65 t->name)'>%h(pSe
8310: 74 2d 3e 6e 61 6d 65 29 3c 2f 61 3e 0a 20 20 20 t->name)</a>.
8320: 20 20 20 69 66 28 20 70 53 65 74 2d 3e 76 65 72 if( pSet->ver
8330: 73 69 6f 6e 61 62 6c 65 20 29 7b 0a 20 20 20 20 sionable ){.
8340: 20 20 20 20 40 20 20 28 76 29 3c 62 72 20 2f 3e @ (v)<br />
8350: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a . } else {.
8360: 20 20 20 20 20 20 20 20 40 20 3c 62 72 20 2f 3e @ <br />
8370: 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 . }. }.
8380: 20 7d 0a 20 20 40 20 3c 62 72 20 2f 3e 3c 69 6e }. @ <br /><in
8390: 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 74 put type="submit
83a0: 22 20 20 6e 61 6d 65 3d 22 73 75 62 6d 69 74 22 " name="submit"
83b0: 20 76 61 6c 75 65 3d 22 41 70 70 6c 79 20 43 68 value="Apply Ch
83c0: 61 6e 67 65 73 22 20 2f 3e 0a 20 20 40 20 3c 2f anges" />. @ </
83d0: 74 64 3e 3c 74 64 20 73 74 79 6c 65 3d 22 77 69 td><td style="wi
83e0: 64 74 68 3a 35 30 70 78 3b 22 3e 3c 2f 74 64 3e dth:50px;"></td>
83f0: 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22 <td valign="top"
8400: 3e 0a 20 20 40 20 3c 74 61 62 6c 65 3e 0a 20 20 >. @ <table>.
8410: 66 6f 72 28 69 3d 30 2c 20 70 53 65 74 3d 61 53 for(i=0, pSet=aS
8420: 65 74 74 69 6e 67 3b 20 69 3c 6e 53 65 74 74 69 etting; i<nSetti
8430: 6e 67 3b 20 69 2b 2b 2c 20 70 53 65 74 2b 2b 29 ng; i++, pSet++)
8440: 7b 0a 20 20 20 20 69 66 28 20 70 53 65 74 2d 3e {. if( pSet->
8450: 77 69 64 74 68 3e 30 20 26 26 20 21 70 53 65 74 width>0 && !pSet
8460: 2d 3e 66 6f 72 63 65 54 65 78 74 41 72 65 61 20 ->forceTextArea
8470: 29 7b 0a 20 20 20 20 20 20 69 6e 74 20 68 61 73 ){. int has
8480: 56 65 72 73 69 6f 6e 61 62 6c 65 56 61 6c 75 65 VersionableValue
8490: 20 3d 20 70 53 65 74 2d 3e 76 65 72 73 69 6f 6e = pSet->version
84a0: 61 62 6c 65 20 26 26 0a 20 20 20 20 20 20 20 20 able &&.
84b0: 20 20 28 64 62 5f 67 65 74 5f 76 65 72 73 69 6f (db_get_versio
84c0: 6e 65 64 28 70 53 65 74 2d 3e 6e 61 6d 65 2c 20 ned(pSet->name,
84d0: 4e 55 4c 4c 29 21 3d 30 29 3b 0a 20 20 20 20 20 NULL)!=0);.
84e0: 20 40 20 3c 74 72 3e 3c 74 64 3e 0a 20 20 20 20 @ <tr><td>.
84f0: 20 20 40 20 3c 61 20 68 72 65 66 3d 27 25 52 2f @ <a href='%R/
8500: 68 65 6c 70 3f 63 6d 64 3d 25 73 28 70 53 65 74 help?cmd=%s(pSet
8510: 2d 3e 6e 61 6d 65 29 27 3e 25 68 28 70 53 65 74 ->name)'>%h(pSet
8520: 2d 3e 6e 61 6d 65 29 3c 2f 61 3e 0a 20 20 20 20 ->name)</a>.
8530: 20 20 69 66 28 20 70 53 65 74 2d 3e 76 65 72 73 if( pSet->vers
8540: 69 6f 6e 61 62 6c 65 20 29 7b 0a 20 20 20 20 20 ionable ){.
8550: 20 20 20 40 20 20 28 76 29 0a 20 20 20 20 20 20 @ (v).
8560: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 } else {.
8570: 20 40 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 @. }.
8580: 20 40 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 @</td><td>.
8590: 20 20 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 entry_attribut
85a0: 65 28 22 22 2c 20 2f 2a 70 53 65 74 2d 3e 77 69 e("", /*pSet->wi
85b0: 64 74 68 2a 2f 20 32 35 2c 20 70 53 65 74 2d 3e dth*/ 25, pSet->
85c0: 6e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 name,.
85d0: 20 20 20 20 20 20 20 20 20 20 20 20 70 53 65 74 pSet
85e0: 2d 3e 76 61 72 21 3d 30 20 3f 20 70 53 65 74 2d ->var!=0 ? pSet-
85f0: 3e 76 61 72 20 3a 20 70 53 65 74 2d 3e 6e 61 6d >var : pSet->nam
8600: 65 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e,.
8610: 20 20 20 20 20 20 20 20 20 28 63 68 61 72 2a 29 (char*)
8620: 70 53 65 74 2d 3e 64 65 66 2c 20 68 61 73 56 65 pSet->def, hasVe
8630: 72 73 69 6f 6e 61 62 6c 65 56 61 6c 75 65 29 3b rsionableValue);
8640: 0a 20 20 20 20 20 20 40 3c 2f 74 64 3e 3c 2f 74 . @</td></t
8650: 72 3e 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 40 r>. }. }. @
8660: 3c 2f 74 61 62 6c 65 3e 0a 20 20 40 20 3c 2f 74 </table>. @ </t
8670: 64 3e 3c 74 64 20 73 74 79 6c 65 3d 22 77 69 64 d><td style="wid
8680: 74 68 3a 35 30 70 78 3b 22 3e 3c 2f 74 64 3e 3c th:50px;"></td><
8690: 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f 70 22 3e td valign="top">
86a0: 0a 20 20 66 6f 72 28 69 3d 30 2c 20 70 53 65 74 . for(i=0, pSet
86b0: 3d 61 53 65 74 74 69 6e 67 3b 20 69 3c 6e 53 65 =aSetting; i<nSe
86c0: 74 74 69 6e 67 3b 20 69 2b 2b 2c 20 70 53 65 74 tting; i++, pSet
86d0: 2b 2b 29 7b 0a 20 20 20 20 69 66 28 20 70 53 65 ++){. if( pSe
86e0: 74 2d 3e 77 69 64 74 68 3e 30 20 26 26 20 70 53 t->width>0 && pS
86f0: 65 74 2d 3e 66 6f 72 63 65 54 65 78 74 41 72 65 et->forceTextAre
8700: 61 20 29 7b 0a 20 20 20 20 20 20 69 6e 74 20 68 a ){. int h
8710: 61 73 56 65 72 73 69 6f 6e 61 62 6c 65 56 61 6c asVersionableVal
8720: 75 65 20 3d 20 64 62 5f 67 65 74 5f 76 65 72 73 ue = db_get_vers
8730: 69 6f 6e 65 64 28 70 53 65 74 2d 3e 6e 61 6d 65 ioned(pSet->name
8740: 2c 20 4e 55 4c 4c 29 21 3d 30 3b 0a 20 20 20 20 , NULL)!=0;.
8750: 20 20 40 20 3c 61 20 68 72 65 66 3d 27 25 52 2f @ <a href='%R/
8760: 68 65 6c 70 3f 63 6d 64 3d 25 73 28 70 53 65 74 help?cmd=%s(pSet
8770: 2d 3e 6e 61 6d 65 29 27 3e 25 73 28 70 53 65 74 ->name)'>%s(pSet
8780: 2d 3e 6e 61 6d 65 29 3c 2f 61 3e 0a 20 20 20 20 ->name)</a>.
8790: 20 20 69 66 28 20 70 53 65 74 2d 3e 76 65 72 73 if( pSet->vers
87a0: 69 6f 6e 61 62 6c 65 20 29 7b 0a 20 20 20 20 20 ionable ){.
87b0: 20 20 20 40 20 20 28 76 29 3c 62 72 20 2f 3e 0a @ (v)<br />.
87c0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 } else {.
87d0: 20 20 20 20 20 20 20 40 20 3c 62 72 20 2f 3e 0a @ <br />.
87e0: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 74 65 }. te
87f0: 78 74 61 72 65 61 5f 61 74 74 72 69 62 75 74 65 xtarea_attribute
8800: 28 22 22 2c 20 2f 2a 72 6f 77 73 2a 2f 20 32 2c ("", /*rows*/ 2,
8810: 20 2f 2a 63 6f 6c 73 2a 2f 20 33 35 2c 20 70 53 /*cols*/ 35, pS
8820: 65 74 2d 3e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 et->name,.
8830: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8840: 70 53 65 74 2d 3e 76 61 72 21 3d 30 20 3f 20 70 pSet->var!=0 ? p
8850: 53 65 74 2d 3e 76 61 72 20 3a 20 70 53 65 74 2d Set->var : pSet-
8860: 3e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 >name,.
8870: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 68 (ch
8880: 61 72 2a 29 70 53 65 74 2d 3e 64 65 66 2c 20 68 ar*)pSet->def, h
8890: 61 73 56 65 72 73 69 6f 6e 61 62 6c 65 56 61 6c asVersionableVal
88a0: 75 65 29 3b 0a 20 20 20 20 20 20 40 3c 62 72 20 ue);. @<br
88b0: 2f 3e 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 40 />. }. }. @
88c0: 20 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 </td></tr></tab
88d0: 6c 65 3e 0a 20 20 40 20 3c 2f 64 69 76 3e 3c 2f le>. @ </div></
88e0: 66 6f 72 6d 3e 0a 20 20 64 62 5f 65 6e 64 5f 74 form>. db_end_t
88f0: 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 ransaction(0);.
8900: 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b style_footer();
8910: 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 .}../*.** WEBPAG
8920: 45 3a 20 73 65 74 75 70 5f 63 6f 6e 66 69 67 0a E: setup_config.
8930: 2a 2a 0a 2a 2a 20 54 68 65 20 22 41 64 6d 69 6e **.** The "Admin
8940: 2f 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 20 /Configuration"
8950: 70 61 67 65 2e 20 20 52 65 71 75 69 72 65 73 20 page. Requires
8960: 53 65 74 75 70 20 70 72 69 76 69 6c 65 67 65 2e Setup privilege.
8970: 0a 2a 2f 0a 76 6f 69 64 20 73 65 74 75 70 5f 63 .*/.void setup_c
8980: 6f 6e 66 69 67 28 76 6f 69 64 29 7b 0a 20 20 6c onfig(void){. l
8990: 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 ogin_check_crede
89a0: 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 ntials();. if(
89b0: 21 67 2e 70 65 72 6d 2e 53 65 74 75 70 20 29 7b !g.perm.Setup ){
89c0: 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 65 . login_neede
89d0: 64 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 6e d(0);. return
89e0: 3b 0a 20 20 7d 0a 0a 20 20 73 74 79 6c 65 5f 68 ;. }.. style_h
89f0: 65 61 64 65 72 28 22 57 57 57 20 43 6f 6e 66 69 eader("WWW Confi
8a00: 67 75 72 61 74 69 6f 6e 22 29 3b 0a 20 20 64 62 guration");. db
8a10: 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69 _begin_transacti
8a20: 6f 6e 28 29 3b 0a 20 20 40 20 3c 66 6f 72 6d 20 on();. @ <form
8a30: 61 63 74 69 6f 6e 3d 22 25 52 2f 73 65 74 75 70 action="%R/setup
8a40: 5f 63 6f 6e 66 69 67 22 20 6d 65 74 68 6f 64 3d _config" method=
8a50: 22 70 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 6c "post"><div>. l
8a60: 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 ogin_insert_csrf
8a70: 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 40 20 3c _secret();. @ <
8a80: 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d input type="subm
8a90: 69 74 22 20 20 6e 61 6d 65 3d 22 73 75 62 6d 69 it" name="submi
8aa0: 74 22 20 76 61 6c 75 65 3d 22 41 70 70 6c 79 20 t" value="Apply
8ab0: 43 68 61 6e 67 65 73 22 20 2f 3e 3c 2f 70 3e 0a Changes" /></p>.
8ac0: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 @ <hr />. ent
8ad0: 72 79 5f 61 74 74 72 69 62 75 74 65 28 22 50 72 ry_attribute("Pr
8ae0: 6f 6a 65 63 74 20 4e 61 6d 65 22 2c 20 36 30 2c oject Name", 60,
8af0: 20 22 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 2c "project-name",
8b00: 20 22 70 6e 22 2c 20 22 22 2c 20 30 29 3b 0a 20 "pn", "", 0);.
8b10: 20 40 20 3c 70 3e 41 20 62 72 69 65 66 20 70 72 @ <p>A brief pr
8b20: 6f 6a 65 63 74 20 6e 61 6d 65 20 73 6f 20 76 69 oject name so vi
8b30: 73 69 74 6f 72 73 20 6b 6e 6f 77 20 77 68 61 74 sitors know what
8b40: 20 74 68 69 73 20 73 69 74 65 20 69 73 20 61 62 this site is ab
8b50: 6f 75 74 2e 0a 20 20 40 20 54 68 65 20 70 72 6f out.. @ The pro
8b60: 6a 65 63 74 20 6e 61 6d 65 20 77 69 6c 6c 20 61 ject name will a
8b70: 6c 73 6f 20 62 65 20 75 73 65 64 20 61 73 20 74 lso be used as t
8b80: 68 65 20 52 53 53 20 66 65 65 64 20 74 69 74 6c he RSS feed titl
8b90: 65 2e 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 e.. @ (Property
8ba0: 3a 20 22 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 : "project-name"
8bb0: 29 0a 20 20 40 20 3c 2f 70 3e 0a 20 20 40 20 3c ). @ </p>. @ <
8bc0: 68 72 20 2f 3e 0a 20 20 74 65 78 74 61 72 65 61 hr />. textarea
8bd0: 5f 61 74 74 72 69 62 75 74 65 28 22 50 72 6f 6a _attribute("Proj
8be0: 65 63 74 20 44 65 73 63 72 69 70 74 69 6f 6e 22 ect Description"
8bf0: 2c 20 33 2c 20 38 30 2c 0a 20 20 20 20 20 20 20 , 3, 80,.
8c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 70 "p
8c10: 72 6f 6a 65 63 74 2d 64 65 73 63 72 69 70 74 69 roject-descripti
8c20: 6f 6e 22 2c 20 22 70 64 22 2c 20 22 22 2c 20 30 on", "pd", "", 0
8c30: 29 3b 0a 20 20 40 20 3c 70 3e 44 65 73 63 72 69 );. @ <p>Descri
8c40: 62 65 20 79 6f 75 72 20 70 72 6f 6a 65 63 74 2e be your project.
8c50: 20 54 68 69 73 20 77 69 6c 6c 20 62 65 20 75 73 This will be us
8c60: 65 64 20 69 6e 20 70 61 67 65 20 68 65 61 64 65 ed in page heade
8c70: 72 73 20 66 6f 72 20 73 65 61 72 63 68 0a 20 20 rs for search.
8c80: 40 20 65 6e 67 69 6e 65 73 20 61 73 20 77 65 6c @ engines as wel
8c90: 6c 20 61 73 20 61 20 73 68 6f 72 74 20 52 53 53 l as a short RSS
8ca0: 20 64 65 73 63 72 69 70 74 69 6f 6e 2e 0a 20 20 description..
8cb0: 40 20 28 50 72 6f 70 65 72 74 79 3a 20 22 70 72 @ (Property: "pr
8cc0: 6f 6a 65 63 74 2d 64 65 73 63 72 69 70 74 69 6f oject-descriptio
8cd0: 6e 22 29 3c 2f 70 3e 0a 20 20 40 20 3c 68 72 20 n")</p>. @ <hr
8ce0: 2f 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 72 69 />. entry_attri
8cf0: 62 75 74 65 28 22 54 61 72 62 61 6c 6c 20 61 6e bute("Tarball an
8d00: 64 20 5a 49 50 2d 61 72 63 68 69 76 65 20 50 72 d ZIP-archive Pr
8d10: 65 66 69 78 22 2c 20 32 30 2c 20 22 73 68 6f 72 efix", 20, "shor
8d20: 74 2d 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 2c t-project-name",
8d30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
8d40: 20 20 20 22 73 70 6e 22 2c 20 22 22 2c 20 30 29 "spn", "", 0)
8d50: 3b 0a 20 20 40 20 3c 70 3e 54 68 69 73 20 69 73 ;. @ <p>This is
8d60: 20 75 73 65 64 20 61 73 20 61 20 70 72 65 66 69 used as a prefi
8d70: 78 20 6f 6e 20 74 68 65 20 6e 61 6d 65 73 20 6f x on the names o
8d80: 66 20 67 65 6e 65 72 61 74 65 64 20 74 61 72 62 f generated tarb
8d90: 61 6c 6c 73 20 61 6e 64 0a 20 20 40 20 5a 49 50 alls and. @ ZIP
8da0: 20 61 72 63 68 69 76 65 2e 20 46 6f 72 20 62 65 archive. For be
8db0: 73 74 20 72 65 73 75 6c 74 73 2c 20 6b 65 65 70 st results, keep
8dc0: 20 74 68 69 73 20 70 72 65 66 69 78 20 62 72 69 this prefix bri
8dd0: 65 66 20 61 6e 64 20 61 76 6f 69 64 20 73 70 65 ef and avoid spe
8de0: 63 69 61 6c 0a 20 20 40 20 63 68 61 72 61 63 74 cial. @ charact
8df0: 65 72 73 20 73 75 63 68 20 61 73 20 22 2f 22 20 ers such as "/"
8e00: 61 6e 64 20 22 5c 22 2e 0a 20 20 40 20 49 66 20 and "\".. @ If
8e10: 6e 6f 20 74 61 72 62 61 6c 6c 20 70 72 65 66 69 no tarball prefi
8e20: 78 20 69 73 20 73 70 65 63 69 66 69 65 64 2c 20 x is specified,
8e30: 74 68 65 6e 20 74 68 65 20 66 75 6c 6c 20 50 72 then the full Pr
8e40: 6f 6a 65 63 74 20 4e 61 6d 65 20 61 62 6f 76 65 oject Name above
8e50: 20 69 73 20 75 73 65 64 2e 0a 20 20 40 20 28 50 is used.. @ (P
8e60: 72 6f 70 65 72 74 79 3a 20 22 73 68 6f 72 74 2d roperty: "short-
8e70: 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 29 0a 20 project-name").
8e80: 20 40 20 3c 2f 70 3e 0a 20 20 40 20 3c 68 72 20 @ </p>. @ <hr
8e90: 2f 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 72 69 />. entry_attri
8ea0: 62 75 74 65 28 22 44 6f 77 6e 6c 6f 61 64 20 54 bute("Download T
8eb0: 61 67 22 2c 20 32 30 2c 20 22 64 6f 77 6e 6c 6f ag", 20, "downlo
8ec0: 61 64 2d 74 61 67 22 2c 20 22 64 6c 74 22 2c 20 ad-tag", "dlt",
8ed0: 22 74 72 75 6e 6b 22 2c 20 30 29 3b 0a 20 20 40 "trunk", 0);. @
8ee0: 20 3c 70 3e 54 68 65 20 3c 61 20 68 72 65 66 3d <p>The <a href=
8ef0: 27 25 52 2f 64 6f 77 6e 6c 6f 61 64 27 3e 2f 64 '%R/download'>/d
8f00: 6f 77 6e 6c 6f 61 64 3c 2f 61 3e 20 70 61 67 65 ownload</a> page
8f10: 20 69 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 is designed to
8f20: 70 72 6f 76 69 64 65 0a 20 20 40 20 61 20 63 6f provide. @ a co
8f30: 6e 76 65 6e 69 65 6e 74 20 70 6c 61 63 65 20 66 nvenient place f
8f40: 6f 72 20 6e 65 77 62 69 65 73 0a 20 20 40 20 74 or newbies. @ t
8f50: 6f 20 64 6f 77 6e 6c 6f 61 64 20 61 20 5a 49 50 o download a ZIP
8f60: 20 61 72 63 68 69 76 65 20 6f 72 20 61 20 74 61 archive or a ta
8f70: 72 62 61 6c 6c 20 6f 66 20 74 68 65 20 70 72 6f rball of the pro
8f80: 6a 65 63 74 2e 20 20 42 79 20 64 65 66 61 75 6c ject. By defaul
8f90: 74 2c 0a 20 20 40 20 74 68 65 20 6c 61 74 65 73 t,. @ the lates
8fa0: 74 20 74 72 75 6e 6b 20 63 68 65 63 6b 2d 69 6e t trunk check-in
8fb0: 20 69 73 20 64 6f 77 6e 6c 6f 61 64 65 64 2e 20 is downloaded.
8fc0: 20 43 68 61 6e 67 65 20 74 68 69 73 20 74 61 67 Change this tag
8fd0: 20 74 6f 20 73 6f 6d 65 74 68 69 6e 67 0a 20 20 to something.
8fe0: 40 20 65 6c 73 65 20 28 65 78 3a 20 72 65 6c 65 @ else (ex: rele
8ff0: 61 73 65 29 20 74 6f 20 61 6c 74 65 72 20 74 68 ase) to alter th
9000: 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 e behavior of th
9010: 65 20 2f 64 6f 77 6e 6c 6f 61 64 20 70 61 67 65 e /download page
9020: 2e 0a 20 20 40 20 28 50 72 6f 70 65 72 74 79 3a .. @ (Property:
9030: 20 22 64 6f 77 6e 6c 6f 61 64 2d 74 61 67 22 29 "download-tag")
9040: 0a 20 20 40 20 3c 2f 70 3e 0a 20 20 40 20 3c 68 . @ </p>. @ <h
9050: 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 r />. entry_att
9060: 72 69 62 75 74 65 28 22 49 6e 64 65 78 20 50 61 ribute("Index Pa
9070: 67 65 22 2c 20 36 30 2c 20 22 69 6e 64 65 78 2d ge", 60, "index-
9080: 70 61 67 65 22 2c 20 22 69 64 78 70 67 22 2c 20 page", "idxpg",
9090: 22 2f 68 6f 6d 65 22 2c 20 30 29 3b 0a 20 20 40 "/home", 0);. @
90a0: 20 3c 70 3e 45 6e 74 65 72 20 74 68 65 20 70 61 <p>Enter the pa
90b0: 74 68 6e 61 6d 65 20 6f 66 20 74 68 65 20 70 61 thname of the pa
90c0: 67 65 20 74 6f 20 64 69 73 70 6c 61 79 20 77 68 ge to display wh
90d0: 65 6e 20 74 68 65 20 22 48 6f 6d 65 22 20 6d 65 en the "Home" me
90e0: 6e 75 0a 20 20 40 20 6f 70 74 69 6f 6e 20 69 73 nu. @ option is
90f0: 20 73 65 6c 65 63 74 65 64 20 61 6e 64 20 77 68 selected and wh
9100: 65 6e 20 6e 6f 20 70 61 74 68 6e 61 6d 65 20 69 en no pathname i
9110: 73 0a 20 20 40 20 73 70 65 63 69 66 69 65 64 20 s. @ specified
9120: 69 6e 20 74 68 65 20 55 52 4c 2e 20 20 46 6f 72 in the URL. For
9130: 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 79 6f 75 example, if you
9140: 20 76 69 73 69 74 20 74 68 65 20 75 72 6c 3a 3c visit the url:<
9150: 2f 70 3e 0a 20 20 40 0a 20 20 40 20 3c 62 6c 6f /p>. @. @ <blo
9160: 63 6b 71 75 6f 74 65 3e 3c 70 3e 25 68 28 67 2e ckquote><p>%h(g.
9170: 7a 42 61 73 65 55 52 4c 29 3c 2f 70 3e 3c 2f 62 zBaseURL)</p></b
9180: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 40 0a 20 lockquote>. @.
9190: 20 40 20 3c 70 3e 41 6e 64 20 79 6f 75 20 68 61 @ <p>And you ha
91a0: 76 65 20 73 70 65 63 69 66 69 65 64 20 61 6e 20 ve specified an
91b0: 69 6e 64 65 78 20 70 61 67 65 20 6f 66 20 22 2f index page of "/
91c0: 68 6f 6d 65 22 20 74 68 65 20 61 62 6f 76 65 20 home" the above
91d0: 77 69 6c 6c 0a 20 20 40 20 61 75 74 6f 6d 61 74 will. @ automat
91e0: 69 63 61 6c 6c 79 20 72 65 64 69 72 65 63 74 20 ically redirect
91f0: 74 6f 3a 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 20 to:</p>. @. @
9200: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 3c 70 3e 25 <blockquote><p>%
9210: 68 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 68 6f h(g.zBaseURL)/ho
9220: 6d 65 3c 2f 70 3e 3c 2f 62 6c 6f 63 6b 71 75 6f me</p></blockquo
9230: 74 65 3e 0a 20 20 40 0a 20 20 40 20 3c 70 3e 54 te>. @. @ <p>T
9240: 68 65 20 64 65 66 61 75 6c 74 20 22 2f 68 6f 6d he default "/hom
9250: 65 22 20 70 61 67 65 20 64 69 73 70 6c 61 79 73 e" page displays
9260: 20 61 20 57 69 6b 69 20 70 61 67 65 20 77 69 74 a Wiki page wit
9270: 68 20 74 68 65 20 73 61 6d 65 20 6e 61 6d 65 0a h the same name.
9280: 20 20 40 20 61 73 20 74 68 65 20 50 72 6f 6a 65 @ as the Proje
9290: 63 74 20 4e 61 6d 65 20 73 70 65 63 69 66 69 65 ct Name specifie
92a0: 64 20 61 62 6f 76 65 2e 20 20 53 6f 6d 65 20 73 d above. Some s
92b0: 69 74 65 73 20 70 72 65 66 65 72 20 74 6f 20 72 ites prefer to r
92c0: 65 64 69 72 65 63 74 0a 20 20 40 20 74 6f 20 61 edirect. @ to a
92d0: 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 70 documentation p
92e0: 61 67 65 20 28 65 78 3a 20 22 2f 64 6f 63 2f 74 age (ex: "/doc/t
92f0: 69 70 2f 69 6e 64 65 78 2e 77 69 6b 69 22 29 20 ip/index.wiki")
9300: 6f 72 20 74 6f 20 22 2f 74 69 6d 65 6c 69 6e 65 or to "/timeline
9310: 22 2e 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 20 3c ".</p>. @. @ <
9320: 70 3e 4e 6f 74 65 3a 20 20 54 6f 20 61 76 6f 69 p>Note: To avoi
9330: 64 20 61 20 72 65 64 69 72 65 63 74 20 6c 6f 6f d a redirect loo
9340: 70 20 6f 72 20 6f 74 68 65 72 20 70 72 6f 62 6c p or other probl
9350: 65 6d 73 2c 20 74 68 69 73 20 65 6e 74 72 79 20 ems, this entry
9360: 6d 75 73 74 0a 20 20 40 20 62 65 67 69 6e 20 77 must. @ begin w
9370: 69 74 68 20 22 2f 22 20 61 6e 64 20 69 74 20 6d ith "/" and it m
9380: 75 73 74 20 73 70 65 63 69 66 79 20 61 20 76 61 ust specify a va
9390: 6c 69 64 20 70 61 67 65 2e 20 20 46 6f 72 20 65 lid page. For e
93a0: 78 61 6d 70 6c 65 2c 0a 20 20 40 20 22 3c 62 3e xample,. @ "<b>
93b0: 2f 68 6f 6d 65 3c 2f 62 3e 22 20 77 69 6c 6c 20 /home</b>" will
93c0: 77 6f 72 6b 20 62 75 74 20 22 3c 62 3e 68 6f 6d work but "<b>hom
93d0: 65 3c 2f 62 3e 22 20 77 69 6c 6c 20 6e 6f 74 2c e</b>" will not,
93e0: 20 73 69 6e 63 65 20 69 74 20 6f 6d 69 74 73 20 since it omits
93f0: 74 68 65 0a 20 20 40 20 6c 65 61 64 69 6e 67 20 the. @ leading
9400: 22 2f 22 2e 3c 2f 70 3e 0a 20 20 40 20 3c 70 3e "/".</p>. @ <p>
9410: 28 50 72 6f 70 65 72 74 79 3a 20 22 69 6e 64 65 (Property: "inde
9420: 78 2d 70 61 67 65 22 29 0a 20 20 40 20 3c 68 72 x-page"). @ <hr
9430: 3e 0a 20 20 40 20 3c 70 3e 45 78 74 72 61 20 6c >. @ <p>Extra l
9440: 69 6e 6b 73 20 74 6f 20 61 70 70 65 61 72 20 6f inks to appear o
9450: 6e 20 74 68 65 20 3c 61 20 68 72 65 66 3d 22 25 n the <a href="%
9460: 52 2f 73 69 74 65 6d 61 70 22 3e 2f 73 69 74 65 R/sitemap">/site
9470: 6d 61 70 3c 2f 61 3e 20 70 61 67 65 2e 0a 20 20 map</a> page..
9480: 40 20 4f 66 74 65 6e 20 74 68 65 73 65 20 61 72 @ Often these ar
9490: 65 20 66 69 6c 6c 65 64 20 69 6e 20 77 69 74 68 e filled in with
94a0: 20 6c 69 6e 6b 73 20 6c 69 6b 65 0a 20 20 40 20 links like. @
94b0: 22 2f 64 6f 63 2f 74 72 75 6e 6b 2f 64 6f 63 2f "/doc/trunk/doc/
94c0: 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69 3e 2e <i>filename</i>.
94d0: 6d 64 22 20 73 6f 20 74 68 61 74 20 74 68 65 79 md" so that they
94e0: 20 72 65 66 65 72 20 74 6f 0a 20 20 40 20 65 6d refer to. @ em
94f0: 62 65 64 64 65 64 20 64 6f 63 75 6d 65 6e 74 61 bedded documenta
9500: 74 69 6f 6e 2c 20 6f 72 20 6c 69 6b 65 20 22 2f tion, or like "/
9510: 77 69 6b 69 2f 3c 69 3e 70 61 67 65 6e 61 6d 65 wiki/<i>pagename
9520: 3c 2f 69 3e 22 20 74 6f 20 72 65 66 65 72 0a 20 </i>" to refer.
9530: 20 40 20 74 6f 20 77 69 6b 69 20 70 61 67 65 73 @ to wiki pages
9540: 2e 0a 20 20 40 20 4c 65 61 76 65 20 62 6c 61 6e .. @ Leave blan
9550: 6b 20 74 6f 20 6f 6d 69 74 2e 0a 20 20 40 20 3c k to omit.. @ <
9560: 70 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 72 69 p>. entry_attri
9570: 62 75 74 65 28 22 44 6f 63 75 6d 65 6e 74 61 74 bute("Documentat
9580: 69 6f 6e 20 49 6e 64 65 78 22 2c 20 34 30 2c 20 ion Index", 40,
9590: 22 73 69 74 65 6d 61 70 2d 64 6f 63 69 64 78 22 "sitemap-docidx"
95a0: 2c 20 22 73 6d 64 6f 63 69 64 78 22 2c 0a 20 20 , "smdocidx",.
95b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
95c0: 22 22 2c 20 30 29 3b 0a 20 20 40 20 28 50 72 6f "", 0);. @ (Pro
95d0: 70 65 72 74 79 3a 20 73 69 74 65 6d 61 70 2d 64 perty: sitemap-d
95e0: 6f 63 69 64 78 29 3c 62 72 3e 0a 20 20 65 6e 74 ocidx)<br>. ent
95f0: 72 79 5f 61 74 74 72 69 62 75 74 65 28 22 44 6f ry_attribute("Do
9600: 77 6e 6c 6f 61 64 22 2c 20 34 30 2c 20 22 73 69 wnload", 40, "si
9610: 74 65 6d 61 70 2d 64 6f 77 6e 6c 6f 61 64 22 2c temap-download",
9620: 20 22 73 6d 64 6f 77 6e 6c 6f 61 64 22 2c 0a 20 "smdownload",.
9630: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9640: 20 22 22 2c 20 30 29 3b 0a 20 20 40 20 28 50 72 "", 0);. @ (Pr
9650: 6f 70 65 72 74 79 3a 20 73 69 74 65 6d 61 70 2d operty: sitemap-
9660: 64 6f 77 6e 6c 6f 61 64 29 3c 62 72 3e 0a 20 20 download)<br>.
9670: 65 6e 74 72 79 5f 61 74 74 72 69 62 75 74 65 28 entry_attribute(
9680: 22 4c 69 63 65 6e 73 65 22 2c 20 34 30 2c 20 22 "License", 40, "
9690: 73 69 74 65 6d 61 70 2d 6c 69 63 65 6e 73 65 22 sitemap-license"
96a0: 2c 20 22 73 6d 6c 69 63 65 6e 73 65 22 2c 0a 20 , "smlicense",.
96b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
96c0: 20 22 22 2c 20 30 29 3b 0a 20 20 40 20 28 50 72 "", 0);. @ (Pr
96d0: 6f 70 65 72 74 79 3a 20 73 69 74 65 6d 61 70 2d operty: sitemap-
96e0: 6c 69 63 65 6e 73 65 29 3c 62 72 3e 0a 20 20 65 license)<br>. e
96f0: 6e 74 72 79 5f 61 74 74 72 69 62 75 74 65 28 22 ntry_attribute("
9700: 43 6f 6e 74 61 63 74 22 2c 20 34 30 2c 20 22 73 Contact", 40, "s
9710: 69 74 65 6d 61 70 2d 63 6f 6e 74 61 63 74 22 2c itemap-contact",
9720: 20 22 73 6d 63 6f 6e 74 61 63 74 22 2c 0a 20 20 "smcontact",.
9730: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9740: 22 22 2c 20 30 29 3b 0a 20 20 40 20 28 50 72 6f "", 0);. @ (Pro
9750: 70 65 72 74 79 3a 20 73 69 74 65 6d 61 70 2d 63 perty: sitemap-c
9760: 6f 6e 74 61 63 74 29 0a 20 20 40 20 3c 68 72 20 ontact). @ <hr
9770: 2f 3e 0a 20 20 40 20 3c 70 3e 3c 69 6e 70 75 74 />. @ <p><input
9780: 20 74 79 70 65 3d 22 73 75 62 6d 69 74 22 20 20 type="submit"
9790: 6e 61 6d 65 3d 22 73 75 62 6d 69 74 22 20 76 61 name="submit" va
97a0: 6c 75 65 3d 22 41 70 70 6c 79 20 43 68 61 6e 67 lue="Apply Chang
97b0: 65 73 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 20 3c es" /></p>. @ <
97c0: 2f 64 69 76 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 64 /div></form>. d
97d0: 62 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f b_end_transactio
97e0: 6e 28 30 29 3b 0a 20 20 73 74 79 6c 65 5f 66 6f n(0);. style_fo
97f0: 6f 74 65 72 28 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a oter();.}../*.**
9800: 20 57 45 42 50 41 47 45 3a 20 73 65 74 75 70 5f WEBPAGE: setup_
9810: 77 69 6b 69 0a 2a 2a 0a 2a 2a 20 54 68 65 20 22 wiki.**.** The "
9820: 41 64 6d 69 6e 2f 57 69 6b 69 22 20 70 61 67 65 Admin/Wiki" page
9830: 2e 20 20 52 65 71 75 69 72 65 73 20 53 65 74 75 . Requires Setu
9840: 70 20 70 72 69 76 69 6c 65 67 65 2e 0a 2a 2f 0a p privilege..*/.
9850: 76 6f 69 64 20 73 65 74 75 70 5f 77 69 6b 69 28 void setup_wiki(
9860: 76 6f 69 64 29 7b 0a 20 20 6c 6f 67 69 6e 5f 63 void){. login_c
9870: 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 61 6c 73 heck_credentials
9880: 28 29 3b 0a 20 20 69 66 28 20 21 67 2e 70 65 72 ();. if( !g.per
9890: 6d 2e 53 65 74 75 70 20 29 7b 0a 20 20 20 20 6c m.Setup ){. l
98a0: 6f 67 69 6e 5f 6e 65 65 64 65 64 28 30 29 3b 0a ogin_needed(0);.
98b0: 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d 0a return;. }.
98c0: 0a 20 20 73 74 79 6c 65 5f 68 65 61 64 65 72 28 . style_header(
98d0: 22 57 69 6b 69 20 43 6f 6e 66 69 67 75 72 61 74 "Wiki Configurat
98e0: 69 6f 6e 22 29 3b 0a 20 20 64 62 5f 62 65 67 69 ion");. db_begi
98f0: 6e 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 29 3b n_transaction();
9900: 0a 20 20 40 20 3c 66 6f 72 6d 20 61 63 74 69 6f . @ <form actio
9910: 6e 3d 22 25 52 2f 73 65 74 75 70 5f 77 69 6b 69 n="%R/setup_wiki
9920: 22 20 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 3e " method="post">
9930: 3c 64 69 76 3e 0a 20 20 6c 6f 67 69 6e 5f 69 6e <div>. login_in
9940: 73 65 72 74 5f 63 73 72 66 5f 73 65 63 72 65 74 sert_csrf_secret
9950: 28 29 3b 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 ();. @ <input t
9960: 79 70 65 3d 22 73 75 62 6d 69 74 22 20 20 6e 61 ype="submit" na
9970: 6d 65 3d 22 73 75 62 6d 69 74 22 20 76 61 6c 75 me="submit" valu
9980: 65 3d 22 41 70 70 6c 79 20 43 68 61 6e 67 65 73 e="Apply Changes
9990: 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 20 3c 68 72 " /></p>. @ <hr
99a0: 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 72 />. onoff_attr
99b0: 69 62 75 74 65 28 22 41 73 73 6f 63 69 61 74 65 ibute("Associate
99c0: 20 57 69 6b 69 20 50 61 67 65 73 20 57 69 74 68 Wiki Pages With
99d0: 20 42 72 61 6e 63 68 65 73 2c 20 54 61 67 73 2c Branches, Tags,
99e0: 20 6f 72 20 43 68 65 63 6b 69 6e 73 22 2c 0a 20 or Checkins",.
99f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9a00: 20 22 77 69 6b 69 2d 61 62 6f 75 74 22 2c 20 22 "wiki-about", "
9a10: 77 69 6b 69 2d 61 62 6f 75 74 22 2c 20 31 2c 20 wiki-about", 1,
9a20: 30 29 3b 0a 20 20 40 20 3c 70 3e 0a 20 20 40 20 0);. @ <p>. @
9a30: 41 73 73 6f 63 69 61 74 65 20 77 69 6b 69 20 70 Associate wiki p
9a40: 61 67 65 73 20 77 69 74 68 20 62 72 61 6e 63 68 ages with branch
9a50: 65 73 2c 20 74 61 67 73 2c 20 6f 72 20 63 68 65 es, tags, or che
9a60: 63 6b 69 6e 73 2c 20 62 61 73 65 64 20 6f 6e 0a ckins, based on.
9a70: 20 20 40 20 74 68 65 20 77 69 6b 69 20 70 61 67 @ the wiki pag
9a80: 65 20 6e 61 6d 65 2e 20 20 57 69 6b 69 20 70 61 e name. Wiki pa
9a90: 67 65 73 20 74 68 61 74 20 62 65 67 69 6e 20 77 ges that begin w
9aa0: 69 74 68 20 22 62 72 61 6e 63 68 2f 22 2c 20 22 ith "branch/", "
9ab0: 63 68 65 63 6b 69 6e 2f 22 0a 20 20 40 20 6f 72 checkin/". @ or
9ac0: 20 22 74 61 67 2f 22 20 61 6e 64 20 77 68 69 63 "tag/" and whic
9ad0: 68 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 h continue with
9ae0: 74 68 65 20 6e 61 6d 65 20 6f 66 20 61 6e 20 65 the name of an e
9af0: 78 69 73 74 69 6e 67 20 62 72 61 6e 63 68 2c 20 xisting branch,
9b00: 63 68 65 63 6b 69 6e 0a 20 20 40 20 6f 72 20 74 checkin. @ or t
9b10: 61 67 20 61 72 65 20 74 72 65 61 74 65 64 20 73 ag are treated s
9b20: 70 65 63 69 61 6c 6c 79 20 77 68 65 6e 20 74 68 pecially when th
9b30: 69 73 20 66 65 61 74 75 72 65 20 69 73 20 65 6e is feature is en
9b40: 61 62 6c 65 64 2e 0a 20 20 40 20 3c 75 6c 3e 0a abled.. @ <ul>.
9b50: 20 20 40 20 3c 6c 69 3e 20 3c 62 3e 62 72 61 6e @ <li> <b>bran
9b60: 63 68 2f 3c 2f 62 3e 3c 69 3e 62 72 61 6e 63 68 ch/</b><i>branch
9b70: 2d 6e 61 6d 65 3c 2f 69 3e 0a 20 20 40 20 3c 6c -name</i>. @ <l
9b80: 69 3e 20 3c 62 3e 63 68 65 63 6b 69 6e 2f 3c 2f i> <b>checkin/</
9b90: 62 3e 3c 69 3e 66 75 6c 6c 2d 63 68 65 63 6b 69 b><i>full-checki
9ba0: 6e 2d 68 61 73 68 3c 2f 69 3e 0a 20 20 40 20 3c n-hash</i>. @ <
9bb0: 6c 69 3e 20 3c 62 3e 74 61 67 2f 3c 2f 62 3e 3c li> <b>tag/</b><
9bc0: 69 3e 74 61 67 2d 6e 61 6d 65 3c 2f 69 3e 0a 20 i>tag-name</i>.
9bd0: 20 40 20 3c 2f 75 6c 3e 0a 20 20 40 20 28 50 72 @ </ul>. @ (Pr
9be0: 6f 70 65 72 74 79 3a 20 22 77 69 6b 69 2d 61 62 operty: "wiki-ab
9bf0: 6f 75 74 22 29 3c 2f 70 3e 0a 20 20 40 20 3c 68 out")</p>. @ <h
9c00: 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f 61 74 74 r />. entry_att
9c10: 72 69 62 75 74 65 28 22 41 6c 6c 6f 77 20 55 6e ribute("Allow Un
9c20: 73 61 66 65 20 48 54 4d 4c 20 49 6e 20 4d 61 72 safe HTML In Mar
9c30: 6b 64 6f 77 6e 22 2c 20 36 2c 0a 20 20 20 20 20 kdown", 6,.
9c40: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 73 61 "sa
9c50: 66 65 2d 68 74 6d 6c 22 2c 20 22 73 61 66 65 2d fe-html", "safe-
9c60: 68 74 6d 6c 22 2c 20 22 22 2c 20 30 29 3b 0a 20 html", "", 0);.
9c70: 20 40 20 3c 70 3e 41 6c 6c 6f 77 20 22 75 6e 73 @ <p>Allow "uns
9c80: 61 66 65 22 20 48 54 4d 4c 20 28 65 78 3a 20 26 afe" HTML (ex: &
9c90: 6c 74 3b 73 63 72 69 70 74 26 67 74 3b 2c 20 26 lt;script>, &
9ca0: 6c 74 3b 66 6f 72 6d 26 67 74 3b 2c 20 65 74 63 lt;form>, etc
9cb0: 29 20 74 6f 20 62 65 0a 20 20 40 20 67 65 6e 65 ) to be. @ gene
9cc0: 72 61 74 65 64 20 62 79 20 3c 61 20 68 72 65 66 rated by <a href
9cd0: 3d 22 25 52 2f 6d 64 5f 72 75 6c 65 73 22 3e 4d ="%R/md_rules">M
9ce0: 61 72 6b 64 6f 77 6e 2d 66 6f 72 6d 61 74 74 65 arkdown-formatte
9cf0: 64 3c 2f 61 3e 20 64 6f 63 75 6d 65 6e 74 73 2e d</a> documents.
9d00: 0a 20 20 40 20 54 68 69 73 20 73 65 74 74 69 6e . @ This settin
9d10: 67 20 69 73 20 61 20 73 74 72 69 6e 67 20 77 68 g is a string wh
9d20: 65 72 65 20 65 61 63 68 20 63 68 61 72 61 63 74 ere each charact
9d30: 65 72 20 69 6e 64 69 63 61 74 65 73 20 61 20 22 er indicates a "
9d40: 74 79 70 65 22 20 6f 66 0a 20 20 40 20 64 6f 63 type" of. @ doc
9d50: 75 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 ument in which t
9d60: 6f 20 61 6c 6c 6f 77 20 75 6e 73 61 66 65 20 48 o allow unsafe H
9d70: 54 4d 4c 3a 0a 20 20 40 20 3c 75 6c 3e 0a 20 20 TML:. @ <ul>.
9d80: 40 20 3c 6c 69 3e 20 3c 62 3e 62 3c 2f 62 3e 20 @ <li> <b>b</b>
9d90: 26 72 61 72 72 3b 20 63 68 65 63 6b 65 64 2d 69 → checked-i
9da0: 6e 20 66 69 6c 65 73 2c 20 65 6d 62 65 64 64 65 n files, embedde
9db0: 64 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 0a d documentation.
9dc0: 20 20 40 20 3c 6c 69 3e 20 3c 62 3e 66 3c 2f 62 @ <li> <b>f</b
9dd0: 3e 20 26 72 61 72 72 3b 20 66 6f 72 75 6d 20 70 > → forum p
9de0: 6f 73 74 73 0a 20 20 40 20 3c 6c 69 3e 20 3c 62 osts. @ <li> <b
9df0: 3e 74 3c 2f 62 3e 20 26 72 61 72 72 3b 20 74 69 >t</b> → ti
9e00: 63 6b 65 74 73 0a 20 20 40 20 3c 6c 69 3e 20 3c ckets. @ <li> <
9e10: 62 3e 77 3c 2f 62 3e 20 26 72 61 72 72 3b 20 77 b>w</b> → w
9e20: 69 6b 69 20 70 61 67 65 73 0a 20 20 40 20 3c 2f iki pages. @ </
9e30: 75 6c 3e 0a 20 20 40 20 49 6e 63 6c 75 64 65 20 ul>. @ Include
9e40: 6c 65 74 74 65 72 73 20 66 6f 72 20 65 61 63 68 letters for each
9e50: 20 74 79 70 65 20 6f 66 20 64 6f 63 75 6d 65 6e type of documen
9e60: 74 20 66 6f 72 20 77 68 69 63 68 20 75 6e 73 61 t for which unsa
9e70: 66 65 20 48 54 4d 4c 20 73 68 6f 75 6c 64 0a 20 fe HTML should.
9e80: 20 40 20 62 65 20 61 6c 6c 6f 77 65 64 2e 20 20 @ be allowed.
9e90: 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 For example, to
9ea0: 61 6c 6c 6f 77 20 75 6e 73 61 66 65 20 48 54 4d allow unsafe HTM
9eb0: 4c 20 6f 6e 6c 79 20 66 6f 72 20 63 68 65 63 6b L only for check
9ec0: 65 64 2d 69 6e 20 66 69 6c 65 73 2c 0a 20 20 40 ed-in files,. @
9ed0: 20 6d 61 6b 65 20 74 68 69 73 20 73 65 74 74 69 make this setti
9ee0: 6e 67 20 62 65 20 6a 75 73 74 20 22 3c 62 3e 62 ng be just "<b>b
9ef0: 3c 2f 62 3e 22 2e 20 20 54 6f 20 61 6c 6c 6f 77 </b>". To allow
9f00: 20 75 6e 73 61 66 65 20 48 54 4d 4c 20 61 6e 79 unsafe HTML any
9f10: 77 68 65 72 65 20 65 78 63 65 70 74 0a 20 20 40 where except. @
9f20: 20 69 6e 20 66 6f 72 75 6d 20 70 6f 73 74 73 2c in forum posts,
9f30: 20 6d 61 6b 65 20 74 68 69 73 20 73 65 74 74 69 make this setti
9f40: 6e 67 20 62 65 20 22 3c 62 3e 62 74 77 3c 2f 62 ng be "<b>btw</b
9f50: 3e 22 2e 20 20 54 68 65 20 64 65 66 61 75 6c 74 >". The default
9f60: 20 69 73 20 61 6e 0a 20 20 40 20 65 6d 70 74 79 is an. @ empty
9f70: 20 73 74 72 69 6e 67 20 77 68 69 63 68 20 6d 65 string which me
9f80: 61 6e 73 20 74 68 61 74 20 46 6f 73 73 69 6c 20 ans that Fossil
9f90: 6e 65 76 65 72 20 61 6c 6c 6f 77 73 20 4d 61 72 never allows Mar
9fa0: 6b 64 6f 77 6e 20 64 6f 63 75 6d 65 6e 74 73 0a kdown documents.
9fb0: 20 20 40 20 74 6f 20 67 65 6e 65 72 61 74 65 20 @ to generate
9fc0: 75 6e 73 61 66 65 20 48 54 4d 4c 2e 0a 20 20 40 unsafe HTML.. @
9fd0: 20 28 50 72 6f 70 65 72 74 79 3a 20 22 73 61 66 (Property: "saf
9fe0: 65 2d 68 74 6d 6c 22 29 3c 2f 70 3e 0a 20 20 40 e-html")</p>. @
9ff0: 20 3c 68 72 20 2f 3e 0a 20 20 40 20 54 68 65 20 <hr />. @ The
a000: 63 75 72 72 65 6e 74 20 69 6e 74 65 72 77 69 6b current interwik
a010: 69 20 74 61 67 20 6d 61 70 20 69 73 20 61 73 20 i tag map is as
a020: 66 6f 6c 6c 6f 77 73 3a 0a 20 20 69 6e 74 65 72 follows:. inter
a030: 77 69 6b 69 5f 61 70 70 65 6e 64 5f 6d 61 70 5f wiki_append_map_
a040: 74 61 62 6c 65 28 63 67 69 5f 6f 75 74 70 75 74 table(cgi_output
a050: 5f 62 6c 6f 62 28 29 29 3b 0a 20 20 40 20 3c 70 _blob());. @ <p
a060: 3e 56 69 73 69 74 20 3c 61 20 68 72 65 66 3d 22 >Visit <a href="
a070: 2e 2f 69 6e 74 65 72 6d 61 70 22 3e 25 52 2f 69 ./intermap">%R/i
a080: 6e 74 65 72 6d 61 70 3c 2f 61 3e 20 66 6f 72 20 ntermap</a> for
a090: 64 65 74 61 69 6c 73 20 6f 72 20 74 6f 0a 20 20 details or to.
a0a0: 40 20 6d 6f 64 69 66 79 20 74 68 65 20 69 6e 74 @ modify the int
a0b0: 65 72 77 69 6b 69 20 74 61 67 20 6d 61 70 2e 0a erwiki tag map..
a0c0: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f @ <hr />. ono
a0d0: 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 55 73 ff_attribute("Us
a0e0: 65 20 48 54 4d 4c 20 61 73 20 77 69 6b 69 20 6d e HTML as wiki m
a0f0: 61 72 6b 75 70 20 6c 61 6e 67 75 61 67 65 22 2c arkup language",
a100: 0a 20 20 20 20 22 77 69 6b 69 2d 75 73 65 2d 68 . "wiki-use-h
a110: 74 6d 6c 22 2c 20 22 77 69 6b 69 2d 75 73 65 2d tml", "wiki-use-
a120: 68 74 6d 6c 22 2c 20 30 2c 20 30 29 3b 0a 20 20 html", 0, 0);.
a130: 40 20 3c 70 3e 55 73 65 20 48 54 4d 4c 20 61 73 @ <p>Use HTML as
a140: 20 74 68 65 20 77 69 6b 69 20 6d 61 72 6b 75 70 the wiki markup
a150: 20 6c 61 6e 67 75 61 67 65 2e 20 57 69 6b 69 20 language. Wiki
a160: 6c 69 6e 6b 73 20 77 69 6c 6c 20 73 74 69 6c 6c links will still
a170: 20 62 65 20 70 61 72 73 65 64 0a 20 20 40 20 62 be parsed. @ b
a180: 75 74 20 61 6c 6c 20 6f 74 68 65 72 20 77 69 6b ut all other wik
a190: 69 20 66 6f 72 6d 61 74 74 69 6e 67 20 77 69 6c i formatting wil
a1a0: 6c 20 62 65 20 69 67 6e 6f 72 65 64 2e 3c 2f 70 l be ignored.</p
a1b0: 3e 0a 20 20 40 20 3c 70 3e 3c 73 74 72 6f 6e 67 >. @ <p><strong
a1c0: 3e 43 41 55 54 49 4f 4e 3a 3c 2f 73 74 72 6f 6e >CAUTION:</stron
a1d0: 67 3e 20 77 68 65 6e 0a 20 20 40 20 65 6e 61 62 g> when. @ enab
a1e0: 6c 69 6e 67 2c 20 3c 69 3e 61 6c 6c 3c 2f 69 3e ling, <i>all</i>
a1f0: 20 48 54 4d 4c 20 74 61 67 73 20 61 6e 64 20 61 HTML tags and a
a200: 74 74 72 69 62 75 74 65 73 20 61 72 65 20 61 63 ttributes are ac
a210: 63 65 70 74 65 64 20 69 6e 20 74 68 65 20 77 69 cepted in the wi
a220: 6b 69 2e 0a 20 20 40 20 4e 6f 20 73 61 6e 69 74 ki.. @ No sanit
a230: 69 7a 61 74 69 6f 6e 20 69 73 20 64 6f 6e 65 2e ization is done.
a240: 20 54 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 This means that
a250: 20 69 74 20 69 73 20 76 65 72 79 20 70 6f 73 73 it is very poss
a260: 69 62 6c 65 20 66 6f 72 20 6d 61 6c 69 63 69 6f ible for malicio
a270: 75 73 0a 20 20 40 20 75 73 65 72 73 20 74 6f 20 us. @ users to
a280: 69 6e 6a 65 63 74 20 64 61 6e 67 65 72 6f 75 73 inject dangerous
a290: 20 48 54 4d 4c 2c 20 43 53 53 20 61 6e 64 20 4a HTML, CSS and J
a2a0: 61 76 61 53 63 72 69 70 74 20 63 6f 64 65 20 69 avaScript code i
a2b0: 6e 74 6f 20 79 6f 75 72 20 77 69 6b 69 2e 3c 2f nto your wiki.</
a2c0: 70 3e 0a 20 20 40 20 3c 70 3e 54 68 69 73 20 73 p>. @ <p>This s
a2d0: 68 6f 75 6c 64 20 3c 73 74 72 6f 6e 67 3e 6f 6e hould <strong>on
a2e0: 6c 79 3c 2f 73 74 72 6f 6e 67 3e 20 62 65 20 65 ly</strong> be e
a2f0: 6e 61 62 6c 65 64 20 77 68 65 6e 20 77 69 6b 69 nabled when wiki
a300: 20 65 64 69 74 69 6e 67 20 69 73 20 6c 69 6d 69 editing is limi
a310: 74 65 64 0a 20 20 40 20 74 6f 20 74 72 75 73 74 ted. @ to trust
a320: 65 64 20 75 73 65 72 73 2e 20 49 74 20 73 68 6f ed users. It sho
a330: 75 6c 64 20 3c 73 74 72 6f 6e 67 3e 6e 6f 74 3c uld <strong>not<
a340: 2f 73 74 72 6f 6e 67 3e 20 62 65 20 75 73 65 64 /strong> be used
a350: 20 6f 6e 20 61 20 70 75 62 6c 69 63 6c 79 0a 20 on a publicly.
a360: 20 40 20 65 64 69 74 61 62 6c 65 20 77 69 6b 69 @ editable wiki
a370: 2e 3c 2f 70 3e 0a 20 20 40 20 28 50 72 6f 70 65 .</p>. @ (Prope
a380: 72 74 79 3a 20 22 77 69 6b 69 2d 75 73 65 2d 68 rty: "wiki-use-h
a390: 74 6d 6c 22 29 0a 20 20 40 20 3c 68 72 20 2f 3e tml"). @ <hr />
a3a0: 0a 20 20 40 20 3c 70 3e 3c 69 6e 70 75 74 20 74 . @ <p><input t
a3b0: 79 70 65 3d 22 73 75 62 6d 69 74 22 20 20 6e 61 ype="submit" na
a3c0: 6d 65 3d 22 73 75 62 6d 69 74 22 20 76 61 6c 75 me="submit" valu
a3d0: 65 3d 22 41 70 70 6c 79 20 43 68 61 6e 67 65 73 e="Apply Changes
a3e0: 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 20 3c 2f 64 " /></p>. @ </d
a3f0: 69 76 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 64 62 5f iv></form>. db_
a400: 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 end_transaction(
a410: 30 29 3b 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 0);. style_foot
a420: 65 72 28 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 er();.}../*.** W
a430: 45 42 50 41 47 45 3a 20 73 65 74 75 70 5f 6d 6f EBPAGE: setup_mo
a440: 64 72 65 71 0a 2a 2a 0a 2a 2a 20 41 64 6d 69 6e dreq.**.** Admin
a450: 20 70 61 67 65 20 66 6f 72 20 73 65 74 74 69 6e page for settin
a460: 67 20 75 70 20 6d 6f 64 65 72 61 74 69 6f 6e 20 g up moderation
a470: 6f 66 20 74 69 63 6b 65 74 73 20 61 6e 64 20 77 of tickets and w
a480: 69 6b 69 2e 0a 2a 2f 0a 76 6f 69 64 20 73 65 74 iki..*/.void set
a490: 75 70 5f 6d 6f 64 72 65 71 28 76 6f 69 64 29 7b up_modreq(void){
a4a0: 0a 20 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 . login_check_c
a4b0: 72 65 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 redentials();.
a4c0: 69 66 28 20 21 67 2e 70 65 72 6d 2e 41 64 6d 69 if( !g.perm.Admi
a4d0: 6e 20 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e n ){. login_n
a4e0: 65 65 64 65 64 28 30 29 3b 0a 20 20 20 20 72 65 eeded(0);. re
a4f0: 74 75 72 6e 3b 0a 20 20 7d 0a 0a 20 20 73 74 79 turn;. }.. sty
a500: 6c 65 5f 68 65 61 64 65 72 28 22 4d 6f 64 65 72 le_header("Moder
a510: 61 74 6f 72 20 46 6f 72 20 57 69 6b 69 20 41 6e ator For Wiki An
a520: 64 20 54 69 63 6b 65 74 73 22 29 3b 0a 20 20 64 d Tickets");. d
a530: 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 b_begin_transact
a540: 69 6f 6e 28 29 3b 0a 20 20 40 20 3c 66 6f 72 6d ion();. @ <form
a550: 20 61 63 74 69 6f 6e 3d 22 25 52 2f 73 65 74 75 action="%R/setu
a560: 70 5f 6d 6f 64 72 65 71 22 20 6d 65 74 68 6f 64 p_modreq" method
a570: 3d 22 70 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 ="post"><div>.
a580: 6c 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 login_insert_csr
a590: 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 40 20 f_secret();. @
a5a0: 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 <hr />. onoff_a
a5b0: 74 74 72 69 62 75 74 65 28 22 4d 6f 64 65 72 61 ttribute("Modera
a5c0: 74 65 20 74 69 63 6b 65 74 20 63 68 61 6e 67 65 te ticket change
a5d0: 73 22 2c 0a 20 20 20 20 20 22 6d 6f 64 72 65 71 s",. "modreq
a5e0: 2d 74 6b 74 22 2c 20 22 6d 6f 64 72 65 71 2d 74 -tkt", "modreq-t
a5f0: 6b 74 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 kt", 0, 0);. @
a600: 3c 70 3e 57 68 65 6e 20 65 6e 61 62 6c 65 64 2c <p>When enabled,
a610: 20 61 6e 79 20 63 68 61 6e 67 65 20 74 6f 20 74 any change to t
a620: 69 63 6b 65 74 73 20 69 73 20 73 75 62 6a 65 63 ickets is subjec
a630: 74 20 74 6f 20 74 68 65 20 61 70 70 72 6f 76 61 t to the approva
a640: 6c 0a 20 20 40 20 62 79 20 61 20 74 69 63 6b 65 l. @ by a ticke
a650: 74 20 6d 6f 64 65 72 61 74 6f 72 20 2d 20 61 20 t moderator - a
a660: 75 73 65 72 20 77 69 74 68 20 74 68 65 20 22 71 user with the "q
a670: 22 20 6f 72 20 4d 6f 64 2d 54 6b 74 20 70 72 69 " or Mod-Tkt pri
a680: 76 69 6c 65 67 65 2e 0a 20 20 40 20 54 69 63 6b vilege.. @ Tick
a690: 65 74 20 63 68 61 6e 67 65 73 20 65 6e 74 65 72 et changes enter
a6a0: 20 74 68 65 20 73 79 73 74 65 6d 20 61 6e 64 20 the system and
a6b0: 61 72 65 20 73 68 6f 77 6e 20 6c 6f 63 61 6c 6c are shown locall
a6c0: 79 2c 20 62 75 74 20 61 72 65 20 6e 6f 74 0a 20 y, but are not.
a6d0: 20 40 20 73 79 6e 63 65 64 20 75 6e 74 69 6c 20 @ synced until
a6e0: 74 68 65 79 20 61 72 65 20 61 70 70 72 6f 76 65 they are approve
a6f0: 64 2e 20 20 54 68 65 20 6d 6f 64 65 72 61 74 6f d. The moderato
a700: 72 20 68 61 73 20 74 68 65 20 6f 70 74 69 6f 6e r has the option
a710: 20 74 6f 0a 20 20 40 20 64 65 6c 65 74 65 20 74 to. @ delete t
a720: 68 65 20 63 68 61 6e 67 65 20 72 61 74 68 65 72 he change rather
a730: 20 74 68 61 6e 20 61 70 70 72 6f 76 65 20 69 74 than approve it
a740: 2e 20 20 54 69 63 6b 65 74 20 63 68 61 6e 67 65 . Ticket change
a750: 73 20 6d 61 64 65 20 62 79 0a 20 20 40 20 61 20 s made by. @ a
a760: 75 73 65 72 20 77 68 6f 20 68 61 73 20 74 68 65 user who has the
a770: 20 4d 6f 64 2d 54 6b 74 20 70 72 69 76 69 6c 65 Mod-Tkt privile
a780: 67 65 20 61 72 65 20 6e 65 76 65 72 20 73 75 62 ge are never sub
a790: 6a 65 63 74 20 74 6f 0a 20 20 40 20 6d 6f 64 65 ject to. @ mode
a7a0: 72 61 74 69 6f 6e 2e 20 28 50 72 6f 70 65 72 74 ration. (Propert
a7b0: 79 3a 20 22 6d 6f 64 72 65 71 2d 74 6b 74 22 29 y: "modreq-tkt")
a7c0: 0a 20 20 40 0a 20 20 40 20 3c 68 72 20 2f 3e 0a . @. @ <hr />.
a7d0: 20 20 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 onoff_attribut
a7e0: 65 28 22 4d 6f 64 65 72 61 74 65 20 77 69 6b 69 e("Moderate wiki
a7f0: 20 63 68 61 6e 67 65 73 22 2c 0a 20 20 20 20 20 changes",.
a800: 22 6d 6f 64 72 65 71 2d 77 69 6b 69 22 2c 20 22 "modreq-wiki", "
a810: 6d 6f 64 72 65 71 2d 77 69 6b 69 22 2c 20 30 2c modreq-wiki", 0,
a820: 20 30 29 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 0);. @ <p>When
a830: 20 65 6e 61 62 6c 65 64 2c 20 61 6e 79 20 63 68 enabled, any ch
a840: 61 6e 67 65 20 74 6f 20 77 69 6b 69 20 69 73 20 ange to wiki is
a850: 73 75 62 6a 65 63 74 20 74 6f 20 74 68 65 20 61 subject to the a
a860: 70 70 72 6f 76 61 6c 0a 20 20 40 20 62 79 20 61 pproval. @ by a
a870: 20 77 69 6b 69 20 6d 6f 64 65 72 61 74 6f 72 20 wiki moderator
a880: 2d 20 61 20 75 73 65 72 20 77 69 74 68 20 74 68 - a user with th
a890: 65 20 22 6c 22 20 6f 72 20 4d 6f 64 2d 57 69 6b e "l" or Mod-Wik
a8a0: 69 20 70 72 69 76 69 6c 65 67 65 2e 0a 20 20 40 i privilege.. @
a8b0: 20 57 69 6b 69 20 63 68 61 6e 67 65 73 20 65 6e Wiki changes en
a8c0: 74 65 72 20 74 68 65 20 73 79 73 74 65 6d 20 61 ter the system a
a8d0: 6e 64 20 61 72 65 20 73 68 6f 77 6e 20 6c 6f 63 nd are shown loc
a8e0: 61 6c 6c 79 2c 20 62 75 74 20 61 72 65 20 6e 6f ally, but are no
a8f0: 74 0a 20 20 40 20 73 79 6e 63 65 64 20 75 6e 74 t. @ synced unt
a900: 69 6c 20 74 68 65 79 20 61 72 65 20 61 70 70 72 il they are appr
a910: 6f 76 65 64 2e 20 20 54 68 65 20 6d 6f 64 65 72 oved. The moder
a920: 61 74 6f 72 20 68 61 73 20 74 68 65 20 6f 70 74 ator has the opt
a930: 69 6f 6e 20 74 6f 0a 20 20 40 20 64 65 6c 65 74 ion to. @ delet
a940: 65 20 74 68 65 20 63 68 61 6e 67 65 20 72 61 74 e the change rat
a950: 68 65 72 20 74 68 61 6e 20 61 70 70 72 6f 76 65 her than approve
a960: 20 69 74 2e 20 20 57 69 6b 69 20 63 68 61 6e 67 it. Wiki chang
a970: 65 73 20 6d 61 64 65 20 62 79 0a 20 20 40 20 61 es made by. @ a
a980: 20 75 73 65 72 20 77 68 6f 20 68 61 73 20 74 68 user who has th
a990: 65 20 4d 6f 64 2d 57 69 6b 69 20 70 72 69 76 69 e Mod-Wiki privi
a9a0: 6c 65 67 65 20 61 72 65 20 6e 65 76 65 72 20 73 lege are never s
a9b0: 75 62 6a 65 63 74 20 74 6f 0a 20 20 40 20 6d 6f ubject to. @ mo
a9c0: 64 65 72 61 74 69 6f 6e 2e 20 28 50 72 6f 70 65 deration. (Prope
a9d0: 72 74 79 3a 20 22 6d 6f 64 72 65 71 2d 77 69 6b rty: "modreq-wik
a9e0: 69 22 29 0a 20 20 40 20 3c 2f 70 3e 0a 0a 20 20 i"). @ </p>..
a9f0: 40 20 3c 68 72 20 2f 3e 0a 20 20 40 20 3c 70 3e @ <hr />. @ <p>
aa00: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 <input type="sub
aa10: 6d 69 74 22 20 20 6e 61 6d 65 3d 22 73 75 62 6d mit" name="subm
aa20: 69 74 22 20 76 61 6c 75 65 3d 22 41 70 70 6c 79 it" value="Apply
aa30: 20 43 68 61 6e 67 65 73 22 20 2f 3e 3c 2f 70 3e Changes" /></p>
aa40: 0a 20 20 40 20 3c 2f 64 69 76 3e 3c 2f 66 6f 72 . @ </div></for
aa50: 6d 3e 0a 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e m>. db_end_tran
aa60: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 20 73 74 saction(0);. st
aa70: 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 0a 7d yle_footer();..}
aa80: 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 3a ../*.** WEBPAGE:
aa90: 20 73 65 74 75 70 5f 61 64 75 6e 69 74 0a 2a 2a setup_adunit.**
aaa0: 0a 2a 2a 20 41 64 6d 69 6e 69 73 74 72 61 74 69 .** Administrati
aab0: 76 65 20 70 61 67 65 20 66 6f 72 20 63 6f 6e 66 ve page for conf
aac0: 69 67 75 72 69 6e 67 20 61 6e 64 20 63 6f 6e 74 iguring and cont
aad0: 72 6f 6c 6c 69 6e 67 20 61 64 20 75 6e 69 74 73 rolling ad units
aae0: 0a 2a 2a 20 61 6e 64 20 68 6f 77 20 74 68 65 79 .** and how they
aaf0: 20 61 72 65 20 64 69 73 70 6c 61 79 65 64 2e 0a are displayed..
ab00: 2a 2f 0a 76 6f 69 64 20 73 65 74 75 70 5f 61 64 */.void setup_ad
ab10: 75 6e 69 74 28 76 6f 69 64 29 7b 0a 20 20 6c 6f unit(void){. lo
ab20: 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e gin_check_creden
ab30: 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 tials();. if( !
ab40: 67 2e 70 65 72 6d 2e 41 64 6d 69 6e 20 29 7b 0a g.perm.Admin ){.
ab50: 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 65 64 login_needed
ab60: 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 6e 3b (0);. return;
ab70: 0a 20 20 7d 0a 20 20 64 62 5f 62 65 67 69 6e 5f . }. db_begin_
ab80: 74 72 61 6e 73 61 63 74 69 6f 6e 28 29 3b 0a 20 transaction();.
ab90: 20 69 66 28 20 50 28 22 63 6c 65 61 72 22 29 21 if( P("clear")!
aba0: 3d 30 20 26 26 20 63 67 69 5f 63 73 72 66 5f 73 =0 && cgi_csrf_s
abb0: 61 66 65 28 31 29 20 29 7b 0a 20 20 20 20 64 62 afe(1) ){. db
abc0: 5f 75 6e 70 72 6f 74 65 63 74 28 50 52 4f 54 45 _unprotect(PROTE
abd0: 43 54 5f 43 4f 4e 46 49 47 29 3b 0a 20 20 20 20 CT_CONFIG);.
abe0: 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 44 db_multi_exec("D
abf0: 45 4c 45 54 45 20 46 52 4f 4d 20 63 6f 6e 66 69 ELETE FROM confi
ac00: 67 20 57 48 45 52 45 20 6e 61 6d 65 20 47 4c 4f g WHERE name GLO
ac10: 42 20 27 61 64 75 6e 69 74 2a 27 22 29 3b 0a 20 B 'adunit*'");.
ac20: 20 20 20 64 62 5f 70 72 6f 74 65 63 74 5f 70 6f db_protect_po
ac30: 70 28 29 3b 0a 20 20 20 20 63 67 69 5f 72 65 70 p();. cgi_rep
ac40: 6c 61 63 65 5f 70 61 72 61 6d 65 74 65 72 28 22 lace_parameter("
ac50: 61 64 75 6e 69 74 22 2c 22 22 29 3b 0a 20 20 20 adunit","");.
ac60: 20 63 67 69 5f 72 65 70 6c 61 63 65 5f 70 61 72 cgi_replace_par
ac70: 61 6d 65 74 65 72 28 22 61 64 72 69 67 68 74 22 ameter("adright"
ac80: 2c 22 22 29 3b 0a 20 20 20 20 73 65 74 75 70 5f ,"");. setup_
ac90: 69 6e 63 72 5f 63 66 67 63 6e 74 28 29 3b 0a 20 incr_cfgcnt();.
aca0: 20 7d 0a 0a 20 20 73 74 79 6c 65 5f 68 65 61 64 }.. style_head
acb0: 65 72 28 22 45 64 69 74 20 41 64 20 55 6e 69 74 er("Edit Ad Unit
acc0: 22 29 3b 0a 20 20 40 20 3c 66 6f 72 6d 20 61 63 ");. @ <form ac
acd0: 74 69 6f 6e 3d 22 25 52 2f 73 65 74 75 70 5f 61 tion="%R/setup_a
ace0: 64 75 6e 69 74 22 20 6d 65 74 68 6f 64 3d 22 70 dunit" method="p
acf0: 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 6c 6f 67 ost"><div>. log
ad00: 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 in_insert_csrf_s
ad10: 65 63 72 65 74 28 29 3b 0a 20 20 40 20 3c 62 3e ecret();. @ <b>
ad20: 42 61 6e 6e 65 72 20 41 64 2d 55 6e 69 74 3a 3c Banner Ad-Unit:<
ad30: 2f 62 3e 3c 62 72 20 2f 3e 0a 20 74 65 78 74 61 /b><br />. texta
ad40: 72 65 61 5f 61 74 74 72 69 62 75 74 65 28 22 22 rea_attribute(""
ad50: 2c 20 36 2c 20 38 30 2c 20 22 61 64 75 6e 69 74 , 6, 80, "adunit
ad60: 22 2c 20 22 61 64 75 6e 69 74 22 2c 20 22 22 2c ", "adunit", "",
ad70: 20 30 29 3b 0a 20 20 40 20 3c 62 72 20 2f 3e 0a 0);. @ <br />.
ad80: 20 20 40 20 3c 62 3e 52 69 67 68 74 2d 43 6f 6c @ <b>Right-Col
ad90: 75 6d 6e 20 41 64 2d 55 6e 69 74 3a 3c 2f 62 3e umn Ad-Unit:</b>
ada0: 3c 62 72 20 2f 3e 0a 20 20 74 65 78 74 61 72 65 <br />. textare
adb0: 61 5f 61 74 74 72 69 62 75 74 65 28 22 22 2c 20 a_attribute("",
adc0: 36 2c 20 38 30 2c 20 22 61 64 75 6e 69 74 2d 72 6, 80, "adunit-r
add0: 69 67 68 74 22 2c 20 22 61 64 72 69 67 68 74 22 ight", "adright"
ade0: 2c 20 22 22 2c 20 30 29 3b 0a 20 20 40 20 3c 62 , "", 0);. @ <b
adf0: 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 r />. onoff_att
ae00: 72 69 62 75 74 65 28 22 4f 6d 69 74 20 61 64 73 ribute("Omit ads
ae10: 20 74 6f 20 61 64 6d 69 6e 69 73 74 72 61 74 6f to administrato
ae20: 72 22 2c 0a 20 20 20 20 20 22 61 64 75 6e 69 74 r",. "adunit
ae30: 2d 6f 6d 69 74 2d 69 66 2d 61 64 6d 69 6e 22 2c -omit-if-admin",
ae40: 20 22 6f 69 61 22 2c 20 30 2c 20 30 29 3b 0a 20 "oia", 0, 0);.
ae50: 20 40 20 3c 62 72 20 2f 3e 0a 20 20 6f 6e 6f 66 @ <br />. onof
ae60: 66 5f 61 74 74 72 69 62 75 74 65 28 22 4f 6d 69 f_attribute("Omi
ae70: 74 20 61 64 73 20 74 6f 20 6c 6f 67 67 65 64 2d t ads to logged-
ae80: 69 6e 20 75 73 65 72 73 22 2c 0a 20 20 20 20 20 in users",.
ae90: 22 61 64 75 6e 69 74 2d 6f 6d 69 74 2d 69 66 2d "adunit-omit-if-
aea0: 75 73 65 72 22 2c 20 22 6f 69 75 22 2c 20 30 2c user", "oiu", 0,
aeb0: 20 30 29 3b 0a 20 20 40 20 3c 62 72 20 2f 3e 0a 0);. @ <br />.
aec0: 20 20 6f 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 onoff_attribut
aed0: 65 28 22 54 65 6d 70 6f 72 61 72 69 6c 79 20 64 e("Temporarily d
aee0: 69 73 61 62 6c 65 20 61 6c 6c 20 61 64 73 22 2c isable all ads",
aef0: 0a 20 20 20 20 20 22 61 64 75 6e 69 74 2d 64 69 . "adunit-di
af00: 73 61 62 6c 65 22 2c 20 22 6f 61 6c 6c 22 2c 20 sable", "oall",
af10: 30 2c 20 30 29 3b 0a 20 20 40 20 3c 62 72 20 2f 0, 0);. @ <br /
af20: 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 >. @ <input typ
af30: 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d e="submit" name=
af40: 22 73 75 62 6d 69 74 22 20 76 61 6c 75 65 3d 22 "submit" value="
af50: 41 70 70 6c 79 20 43 68 61 6e 67 65 73 22 20 2f Apply Changes" /
af60: 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 >. @ <input typ
af70: 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d e="submit" name=
af80: 22 63 6c 65 61 72 22 20 76 61 6c 75 65 3d 22 44 "clear" value="D
af90: 65 6c 65 74 65 20 41 64 2d 55 6e 69 74 22 20 2f elete Ad-Unit" /
afa0: 3e 0a 20 20 40 20 3c 2f 64 69 76 3e 3c 2f 66 6f >. @ </div></fo
afb0: 72 6d 3e 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 rm>. @ <hr />.
afc0: 20 40 20 3c 62 3e 41 64 2d 55 6e 69 74 20 4e 6f @ <b>Ad-Unit No
afd0: 74 65 73 3a 3c 2f 62 3e 3c 75 6c 3e 0a 20 20 40 tes:</b><ul>. @
afe0: 20 3c 6c 69 3e 4c 65 61 76 65 20 62 6f 74 68 20 <li>Leave both
aff0: 41 64 2d 55 6e 69 74 73 20 62 6c 61 6e 6b 20 74 Ad-Units blank t
b000: 6f 20 64 69 73 61 62 6c 65 20 61 6c 6c 20 61 64 o disable all ad
b010: 76 65 72 74 69 73 69 6e 67 2e 0a 20 20 40 20 3c vertising.. @ <
b020: 6c 69 3e 54 68 65 20 22 42 61 6e 6e 65 72 20 41 li>The "Banner A
b030: 64 2d 55 6e 69 74 22 20 69 73 20 75 73 65 64 20 d-Unit" is used
b040: 66 6f 72 20 77 69 64 65 20 70 61 67 65 73 2e 0a for wide pages..
b050: 20 20 40 20 3c 6c 69 3e 54 68 65 20 22 52 69 67 @ <li>The "Rig
b060: 68 74 2d 43 6f 6c 75 6d 6e 20 41 64 2d 55 6e 69 ht-Column Ad-Uni
b070: 74 22 20 69 73 20 75 73 65 64 20 6f 6e 20 70 61 t" is used on pa
b080: 67 65 73 20 77 69 74 68 20 74 61 6c 6c 2c 20 6e ges with tall, n
b090: 61 72 72 6f 77 20 63 6f 6e 74 65 6e 74 2e 0a 20 arrow content..
b0a0: 20 40 20 3c 6c 69 3e 49 66 20 74 68 65 20 22 52 @ <li>If the "R
b0b0: 69 67 68 74 2d 43 6f 6c 75 6d 6e 20 41 64 2d 55 ight-Column Ad-U
b0c0: 6e 69 74 22 20 69 73 20 62 6c 61 6e 6b 2c 20 74 nit" is blank, t
b0d0: 68 65 20 22 42 61 6e 6e 65 72 20 41 64 2d 55 6e he "Banner Ad-Un
b0e0: 69 74 22 20 69 73 0a 20 20 40 20 20 20 20 20 75 it" is. @ u
b0f0: 73 65 64 20 6f 6e 20 61 6c 6c 20 70 61 67 65 73 sed on all pages
b100: 2e 0a 20 20 40 20 3c 6c 69 3e 50 72 6f 70 65 72 .. @ <li>Proper
b110: 74 69 65 73 3a 20 22 61 64 75 6e 69 74 22 2c 20 ties: "adunit",
b120: 22 61 64 75 6e 69 74 2d 72 69 67 68 74 22 2c 20 "adunit-right",
b130: 22 61 64 75 6e 69 74 2d 6f 6d 69 74 2d 69 66 2d "adunit-omit-if-
b140: 61 64 6d 69 6e 22 2c 20 61 6e 64 0a 20 20 40 20 admin", and. @
b150: 20 20 20 20 22 61 64 75 6e 69 74 2d 6f 6d 69 74 "adunit-omit
b160: 2d 69 66 2d 75 73 65 72 22 2e 0a 20 20 40 20 3c -if-user".. @ <
b170: 6c 69 3e 53 75 67 67 65 73 74 65 64 20 3c 61 20 li>Suggested <a
b180: 68 72 65 66 3d 22 73 65 74 75 70 5f 73 6b 69 6e href="setup_skin
b190: 65 64 69 74 3f 77 3d 30 22 3e 43 53 53 3c 2f 61 edit?w=0">CSS</a
b1a0: 3e 20 63 68 61 6e 67 65 73 3a 0a 20 20 40 20 3c > changes:. @ <
b1b0: 62 6c 6f 63 6b 71 75 6f 74 65 3e 3c 70 72 65 3e blockquote><pre>
b1c0: 0a 20 20 40 20 64 69 76 2e 61 64 75 6e 69 74 5f . @ div.adunit_
b1d0: 62 61 6e 6e 65 72 20 7b 0a 20 20 40 20 20 20 6d banner {. @ m
b1e0: 61 72 67 69 6e 3a 20 61 75 74 6f 3b 0a 20 20 40 argin: auto;. @
b1f0: 20 20 20 77 69 64 74 68 3a 20 31 30 30 25 25 3b width: 100%%;
b200: 0a 20 20 40 20 7d 0a 20 20 40 20 64 69 76 2e 61 . @ }. @ div.a
b210: 64 75 6e 69 74 5f 72 69 67 68 74 20 7b 0a 20 20 dunit_right {.
b220: 40 20 20 20 66 6c 6f 61 74 3a 20 72 69 67 68 74 @ float: right
b230: 3b 0a 20 20 40 20 7d 0a 20 20 40 20 64 69 76 2e ;. @ }. @ div.
b240: 61 64 75 6e 69 74 5f 72 69 67 68 74 5f 63 6f 6e adunit_right_con
b250: 74 61 69 6e 65 72 20 7b 0a 20 20 40 20 20 20 6d tainer {. @ m
b260: 69 6e 2d 68 65 69 67 68 74 3a 20 3c 69 3e 68 65 in-height: <i>he
b270: 69 67 68 74 2d 6f 66 2d 72 69 67 68 74 2d 63 6f ight-of-right-co
b280: 6c 75 6d 6e 2d 61 64 2d 75 6e 69 74 3c 2f 69 3e lumn-ad-unit</i>
b290: 3b 0a 20 20 40 20 7d 0a 20 20 40 20 3c 2f 70 72 ;. @ }. @ </pr
b2a0: 65 3e 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a e></blockquote>.
b2b0: 20 20 40 20 3c 6c 69 3e 46 6f 72 20 61 20 70 6c @ <li>For a pl
b2c0: 61 63 65 2d 68 6f 6c 64 65 72 20 41 64 2d 55 6e ace-holder Ad-Un
b2d0: 69 74 20 66 6f 72 20 74 65 73 74 69 6e 67 2c 20 it for testing,
b2e0: 43 6f 70 79 2f 50 61 73 74 65 20 74 68 65 20 66 Copy/Paste the f
b2f0: 6f 6c 6c 6f 77 69 6e 67 0a 20 20 40 20 77 69 74 ollowing. @ wit
b300: 68 20 61 70 70 72 6f 70 72 69 61 74 65 20 61 64 h appropriate ad
b310: 6a 75 73 74 6d 65 6e 74 73 20 74 6f 20 22 77 69 justments to "wi
b320: 64 74 68 3a 22 20 61 6e 64 20 22 68 65 69 67 68 dth:" and "heigh
b330: 74 3a 22 2e 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 t:".. @ <blockq
b340: 75 6f 74 65 3e 3c 70 72 65 3e 0a 20 20 40 20 26 uote><pre>. @ &
b350: 6c 74 3b 64 69 76 20 73 74 79 6c 65 3d 27 0a 20 lt;div style='.
b360: 20 40 20 20 20 6d 61 72 67 69 6e 3a 20 30 20 61 @ margin: 0 a
b370: 75 74 6f 3b 0a 20 20 40 20 20 20 77 69 64 74 68 uto;. @ width
b380: 3a 20 36 30 30 70 78 3b 0a 20 20 40 20 20 20 68 : 600px;. @ h
b390: 65 69 67 68 74 3a 20 39 30 70 78 3b 0a 20 20 40 eight: 90px;. @
b3a0: 20 20 20 62 6f 72 64 65 72 3a 20 31 70 78 20 73 border: 1px s
b3b0: 6f 6c 69 64 20 23 66 31 31 3b 0a 20 20 40 20 20 olid #f11;. @
b3c0: 20 62 61 63 6b 67 72 6f 75 6e 64 2d 63 6f 6c 6f background-colo
b3d0: 72 3a 20 23 66 63 63 3b 0a 20 20 40 20 27 26 67 r: #fcc;. @ '&g
b3e0: 74 3b 44 65 6d 6f 20 41 64 26 6c 74 3b 2f 64 69 t;Demo Ad</di
b3f0: 76 26 67 74 3b 0a 20 20 40 20 3c 2f 70 72 65 3e v>. @ </pre>
b400: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 </blockquote>.
b410: 40 20 3c 2f 6c 69 3e 0a 20 20 73 74 79 6c 65 5f @ </li>. style_
b420: 66 6f 6f 74 65 72 28 29 3b 0a 20 20 64 62 5f 65 footer();. db_e
b430: 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 nd_transaction(0
b440: 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 );.}../*.** WEBP
b450: 41 47 45 3a 20 73 65 74 75 70 5f 6c 6f 67 6f 0a AGE: setup_logo.
b460: 2a 2a 0a 2a 2a 20 41 64 6d 69 6e 69 73 74 72 61 **.** Administra
b470: 74 69 76 65 20 70 61 67 65 20 66 6f 72 20 63 68 tive page for ch
b480: 61 6e 67 69 6e 67 20 74 68 65 20 6c 6f 67 6f 2c anging the logo,
b490: 20 62 61 63 6b 67 72 6f 75 6e 64 2c 20 61 6e 64 background, and
b4a0: 20 69 63 6f 6e 20 69 6d 61 67 65 73 2e 0a 2a 2f icon images..*/
b4b0: 0a 76 6f 69 64 20 73 65 74 75 70 5f 6c 6f 67 6f .void setup_logo
b4c0: 28 76 6f 69 64 29 7b 0a 20 20 63 6f 6e 73 74 20 (void){. const
b4d0: 63 68 61 72 20 2a 7a 4c 6f 67 6f 4d 74 69 6d 65 char *zLogoMtime
b4e0: 20 3d 20 64 62 5f 67 65 74 5f 6d 74 69 6d 65 28 = db_get_mtime(
b4f0: 22 6c 6f 67 6f 2d 69 6d 61 67 65 22 2c 20 30 2c "logo-image", 0,
b500: 20 30 29 3b 0a 20 20 63 6f 6e 73 74 20 63 68 61 0);. const cha
b510: 72 20 2a 7a 4c 6f 67 6f 4d 69 6d 65 20 3d 20 64 r *zLogoMime = d
b520: 62 5f 67 65 74 28 22 6c 6f 67 6f 2d 6d 69 6d 65 b_get("logo-mime
b530: 74 79 70 65 22 2c 22 69 6d 61 67 65 2f 67 69 66 type","image/gif
b540: 22 29 3b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 ");. const char
b550: 20 2a 61 4c 6f 67 6f 49 6d 67 20 3d 20 50 28 22 *aLogoImg = P("
b560: 6c 6f 67 6f 69 6d 22 29 3b 0a 20 20 69 6e 74 20 logoim");. int
b570: 73 7a 4c 6f 67 6f 49 6d 67 20 3d 20 61 74 6f 69 szLogoImg = atoi
b580: 28 50 44 28 22 6c 6f 67 6f 69 6d 3a 62 79 74 65 (PD("logoim:byte
b590: 73 22 2c 22 30 22 29 29 3b 0a 20 20 63 6f 6e 73 s","0"));. cons
b5a0: 74 20 63 68 61 72 20 2a 7a 42 67 4d 74 69 6d 65 t char *zBgMtime
b5b0: 20 3d 20 64 62 5f 67 65 74 5f 6d 74 69 6d 65 28 = db_get_mtime(
b5c0: 22 62 61 63 6b 67 72 6f 75 6e 64 2d 69 6d 61 67 "background-imag
b5d0: 65 22 2c 20 30 2c 20 30 29 3b 0a 20 20 63 6f 6e e", 0, 0);. con
b5e0: 73 74 20 63 68 61 72 20 2a 7a 42 67 4d 69 6d 65 st char *zBgMime
b5f0: 20 3d 20 64 62 5f 67 65 74 28 22 62 61 63 6b 67 = db_get("backg
b600: 72 6f 75 6e 64 2d 6d 69 6d 65 74 79 70 65 22 2c round-mimetype",
b610: 22 69 6d 61 67 65 2f 67 69 66 22 29 3b 0a 20 20 "image/gif");.
b620: 63 6f 6e 73 74 20 63 68 61 72 20 2a 61 42 67 49 const char *aBgI
b630: 6d 67 20 3d 20 50 28 22 62 67 69 6d 22 29 3b 0a mg = P("bgim");.
b640: 20 20 69 6e 74 20 73 7a 42 67 49 6d 67 20 3d 20 int szBgImg =
b650: 61 74 6f 69 28 50 44 28 22 62 67 69 6d 3a 62 79 atoi(PD("bgim:by
b660: 74 65 73 22 2c 22 30 22 29 29 3b 0a 20 20 63 6f tes","0"));. co
b670: 6e 73 74 20 63 68 61 72 20 2a 7a 49 63 6f 6e 4d nst char *zIconM
b680: 74 69 6d 65 20 3d 20 64 62 5f 67 65 74 5f 6d 74 time = db_get_mt
b690: 69 6d 65 28 22 69 63 6f 6e 2d 69 6d 61 67 65 22 ime("icon-image"
b6a0: 2c 20 30 2c 20 30 29 3b 0a 20 20 63 6f 6e 73 74 , 0, 0);. const
b6b0: 20 63 68 61 72 20 2a 7a 49 63 6f 6e 4d 69 6d 65 char *zIconMime
b6c0: 20 3d 20 64 62 5f 67 65 74 28 22 69 63 6f 6e 2d = db_get("icon-
b6d0: 6d 69 6d 65 74 79 70 65 22 2c 22 69 6d 61 67 65 mimetype","image
b6e0: 2f 67 69 66 22 29 3b 0a 20 20 63 6f 6e 73 74 20 /gif");. const
b6f0: 63 68 61 72 20 2a 61 49 63 6f 6e 49 6d 67 20 3d char *aIconImg =
b700: 20 50 28 22 69 63 6f 6e 69 6d 22 29 3b 0a 20 20 P("iconim");.
b710: 69 6e 74 20 73 7a 49 63 6f 6e 49 6d 67 20 3d 20 int szIconImg =
b720: 61 74 6f 69 28 50 44 28 22 69 63 6f 6e 69 6d 3a atoi(PD("iconim:
b730: 62 79 74 65 73 22 2c 22 30 22 29 29 3b 0a 20 20 bytes","0"));.
b740: 69 66 28 20 73 7a 4c 6f 67 6f 49 6d 67 3e 30 20 if( szLogoImg>0
b750: 29 7b 0a 20 20 20 20 7a 4c 6f 67 6f 4d 69 6d 65 ){. zLogoMime
b760: 20 3d 20 50 44 28 22 6c 6f 67 6f 69 6d 3a 6d 69 = PD("logoim:mi
b770: 6d 65 74 79 70 65 22 2c 22 69 6d 61 67 65 2f 67 metype","image/g
b780: 69 66 22 29 3b 0a 20 20 7d 0a 20 20 69 66 28 20 if");. }. if(
b790: 73 7a 42 67 49 6d 67 3e 30 20 29 7b 0a 20 20 20 szBgImg>0 ){.
b7a0: 20 7a 42 67 4d 69 6d 65 20 3d 20 50 44 28 22 62 zBgMime = PD("b
b7b0: 67 69 6d 3a 6d 69 6d 65 74 79 70 65 22 2c 22 69 gim:mimetype","i
b7c0: 6d 61 67 65 2f 67 69 66 22 29 3b 0a 20 20 7d 0a mage/gif");. }.
b7d0: 20 20 69 66 28 20 73 7a 49 63 6f 6e 49 6d 67 3e if( szIconImg>
b7e0: 30 20 29 7b 0a 20 20 20 20 7a 49 63 6f 6e 4d 69 0 ){. zIconMi
b7f0: 6d 65 20 3d 20 50 44 28 22 69 63 6f 6e 69 6d 3a me = PD("iconim:
b800: 6d 69 6d 65 74 79 70 65 22 2c 22 69 6d 61 67 65 mimetype","image
b810: 2f 67 69 66 22 29 3b 0a 20 20 7d 0a 20 20 6c 6f /gif");. }. lo
b820: 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e gin_check_creden
b830: 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 tials();. if( !
b840: 67 2e 70 65 72 6d 2e 41 64 6d 69 6e 20 29 7b 0a g.perm.Admin ){.
b850: 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 65 64 login_needed
b860: 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 6e 3b (0);. return;
b870: 0a 20 20 7d 0a 20 20 64 62 5f 62 65 67 69 6e 5f . }. db_begin_
b880: 74 72 61 6e 73 61 63 74 69 6f 6e 28 29 3b 0a 20 transaction();.
b890: 20 69 66 28 20 21 63 67 69 5f 63 73 72 66 5f 73 if( !cgi_csrf_s
b8a0: 61 66 65 28 31 29 20 29 7b 0a 20 20 20 20 2f 2a afe(1) ){. /*
b8b0: 20 41 6c 6c 6f 77 20 6e 6f 20 73 74 61 74 65 20 Allow no state
b8c0: 63 68 61 6e 67 65 73 20 69 66 20 6e 6f 74 20 73 changes if not s
b8d0: 61 66 65 20 66 72 6f 6d 20 43 53 52 46 20 2a 2f afe from CSRF */
b8e0: 0a 20 20 7d 65 6c 73 65 20 69 66 28 20 50 28 22 . }else if( P("
b8f0: 73 65 74 6c 6f 67 6f 22 29 21 3d 30 20 26 26 20 setlogo")!=0 &&
b900: 7a 4c 6f 67 6f 4d 69 6d 65 20 26 26 20 7a 4c 6f zLogoMime && zLo
b910: 67 6f 4d 69 6d 65 5b 30 5d 20 26 26 20 73 7a 4c goMime[0] && szL
b920: 6f 67 6f 49 6d 67 3e 30 20 29 7b 0a 20 20 20 20 ogoImg>0 ){.
b930: 42 6c 6f 62 20 69 6d 67 3b 0a 20 20 20 20 53 74 Blob img;. St
b940: 6d 74 20 69 6e 73 3b 0a 20 20 20 20 62 6c 6f 62 mt ins;. blob
b950: 5f 69 6e 69 74 28 26 69 6d 67 2c 20 61 4c 6f 67 _init(&img, aLog
b960: 6f 49 6d 67 2c 20 73 7a 4c 6f 67 6f 49 6d 67 29 oImg, szLogoImg)
b970: 3b 0a 20 20 20 20 64 62 5f 75 6e 70 72 6f 74 65 ;. db_unprote
b980: 63 74 28 50 52 4f 54 45 43 54 5f 43 4f 4e 46 49 ct(PROTECT_CONFI
b990: 47 29 3b 0a 20 20 20 20 64 62 5f 70 72 65 70 61 G);. db_prepa
b9a0: 72 65 28 26 69 6e 73 2c 0a 20 20 20 20 20 20 20 re(&ins,.
b9b0: 20 22 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 63 "REPLACE INTO c
b9c0: 6f 6e 66 69 67 28 6e 61 6d 65 2c 76 61 6c 75 65 onfig(name,value
b9d0: 2c 6d 74 69 6d 65 29 22 0a 20 20 20 20 20 20 20 ,mtime)".
b9e0: 20 22 20 56 41 4c 55 45 53 28 27 6c 6f 67 6f 2d " VALUES('logo-
b9f0: 69 6d 61 67 65 27 2c 3a 62 79 74 65 73 2c 6e 6f image',:bytes,no
ba00: 77 28 29 29 22 0a 20 20 20 20 29 3b 0a 20 20 20 w())". );.
ba10: 20 64 62 5f 62 69 6e 64 5f 62 6c 6f 62 28 26 69 db_bind_blob(&i
ba20: 6e 73 2c 20 22 3a 62 79 74 65 73 22 2c 20 26 69 ns, ":bytes", &i
ba30: 6d 67 29 3b 0a 20 20 20 20 64 62 5f 73 74 65 70 mg);. db_step
ba40: 28 26 69 6e 73 29 3b 0a 20 20 20 20 64 62 5f 66 (&ins);. db_f
ba50: 69 6e 61 6c 69 7a 65 28 26 69 6e 73 29 3b 0a 20 inalize(&ins);.
ba60: 20 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 db_multi_exec
ba70: 28 0a 20 20 20 20 20 20 20 22 52 45 50 4c 41 43 (. "REPLAC
ba80: 45 20 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 E INTO config(na
ba90: 6d 65 2c 76 61 6c 75 65 2c 6d 74 69 6d 65 29 20 me,value,mtime)
baa0: 56 41 4c 55 45 53 28 27 6c 6f 67 6f 2d 6d 69 6d VALUES('logo-mim
bab0: 65 74 79 70 65 27 2c 25 51 2c 6e 6f 77 28 29 29 etype',%Q,now())
bac0: 22 2c 0a 20 20 20 20 20 20 20 7a 4c 6f 67 6f 4d ",. zLogoM
bad0: 69 6d 65 0a 20 20 20 20 29 3b 0a 20 20 20 20 64 ime. );. d
bae0: 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 28 29 3b b_protect_pop();
baf0: 0a 20 20 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e . db_end_tran
bb00: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 20 20 20 saction(0);.
bb10: 63 67 69 5f 72 65 64 69 72 65 63 74 28 22 73 65 cgi_redirect("se
bb20: 74 75 70 5f 6c 6f 67 6f 22 29 3b 0a 20 20 7d 65 tup_logo");. }e
bb30: 6c 73 65 20 69 66 28 20 50 28 22 63 6c 72 6c 6f lse if( P("clrlo
bb40: 67 6f 22 29 21 3d 30 20 29 7b 0a 20 20 20 20 64 go")!=0 ){. d
bb50: 62 5f 75 6e 70 72 6f 74 65 63 74 28 50 52 4f 54 b_unprotect(PROT
bb60: 45 43 54 5f 43 4f 4e 46 49 47 29 3b 0a 20 20 20 ECT_CONFIG);.
bb70: 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 0a db_multi_exec(.
bb80: 20 20 20 20 20 20 20 22 44 45 4c 45 54 45 20 46 "DELETE F
bb90: 52 4f 4d 20 63 6f 6e 66 69 67 20 57 48 45 52 45 ROM config WHERE
bba0: 20 6e 61 6d 65 20 49 4e 20 22 0a 20 20 20 20 20 name IN ".
bbb0: 20 20 20 20 20 20 22 28 27 6c 6f 67 6f 2d 69 6d "('logo-im
bbc0: 61 67 65 27 2c 27 6c 6f 67 6f 2d 6d 69 6d 65 74 age','logo-mimet
bbd0: 79 70 65 27 29 22 0a 20 20 20 20 29 3b 0a 20 20 ype')". );.
bbe0: 20 20 64 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 db_protect_pop
bbf0: 28 29 3b 0a 20 20 20 20 64 62 5f 65 6e 64 5f 74 ();. db_end_t
bc00: 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 ransaction(0);.
bc10: 20 20 20 63 67 69 5f 72 65 64 69 72 65 63 74 28 cgi_redirect(
bc20: 22 73 65 74 75 70 5f 6c 6f 67 6f 22 29 3b 0a 20 "setup_logo");.
bc30: 20 7d 65 6c 73 65 20 69 66 28 20 50 28 22 73 65 }else if( P("se
bc40: 74 62 67 22 29 21 3d 30 20 26 26 20 7a 42 67 4d tbg")!=0 && zBgM
bc50: 69 6d 65 20 26 26 20 7a 42 67 4d 69 6d 65 5b 30 ime && zBgMime[0
bc60: 5d 20 26 26 20 73 7a 42 67 49 6d 67 3e 30 20 29 ] && szBgImg>0 )
bc70: 7b 0a 20 20 20 20 42 6c 6f 62 20 69 6d 67 3b 0a {. Blob img;.
bc80: 20 20 20 20 53 74 6d 74 20 69 6e 73 3b 0a 20 20 Stmt ins;.
bc90: 20 20 62 6c 6f 62 5f 69 6e 69 74 28 26 69 6d 67 blob_init(&img
bca0: 2c 20 61 42 67 49 6d 67 2c 20 73 7a 42 67 49 6d , aBgImg, szBgIm
bcb0: 67 29 3b 0a 20 20 20 20 64 62 5f 75 6e 70 72 6f g);. db_unpro
bcc0: 74 65 63 74 28 50 52 4f 54 45 43 54 5f 43 4f 4e tect(PROTECT_CON
bcd0: 46 49 47 29 3b 0a 20 20 20 20 64 62 5f 70 72 65 FIG);. db_pre
bce0: 70 61 72 65 28 26 69 6e 73 2c 0a 20 20 20 20 20 pare(&ins,.
bcf0: 20 20 20 22 52 45 50 4c 41 43 45 20 49 4e 54 4f "REPLACE INTO
bd00: 20 63 6f 6e 66 69 67 28 6e 61 6d 65 2c 76 61 6c config(name,val
bd10: 75 65 2c 6d 74 69 6d 65 29 22 0a 20 20 20 20 20 ue,mtime)".
bd20: 20 20 20 22 20 56 41 4c 55 45 53 28 27 62 61 63 " VALUES('bac
bd30: 6b 67 72 6f 75 6e 64 2d 69 6d 61 67 65 27 2c 3a kground-image',:
bd40: 62 79 74 65 73 2c 6e 6f 77 28 29 29 22 0a 20 20 bytes,now())".
bd50: 20 20 29 3b 0a 20 20 20 20 64 62 5f 62 69 6e 64 );. db_bind
bd60: 5f 62 6c 6f 62 28 26 69 6e 73 2c 20 22 3a 62 79 _blob(&ins, ":by
bd70: 74 65 73 22 2c 20 26 69 6d 67 29 3b 0a 20 20 20 tes", &img);.
bd80: 20 64 62 5f 73 74 65 70 28 26 69 6e 73 29 3b 0a db_step(&ins);.
bd90: 20 20 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 db_finalize(
bda0: 26 69 6e 73 29 3b 0a 20 20 20 20 64 62 5f 6d 75 &ins);. db_mu
bdb0: 6c 74 69 5f 65 78 65 63 28 0a 20 20 20 20 20 20 lti_exec(.
bdc0: 20 22 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 63 "REPLACE INTO c
bdd0: 6f 6e 66 69 67 28 6e 61 6d 65 2c 76 61 6c 75 65 onfig(name,value
bde0: 2c 6d 74 69 6d 65 29 22 0a 20 20 20 20 20 20 20 ,mtime)".
bdf0: 22 20 56 41 4c 55 45 53 28 27 62 61 63 6b 67 72 " VALUES('backgr
be00: 6f 75 6e 64 2d 6d 69 6d 65 74 79 70 65 27 2c 25 ound-mimetype',%
be10: 51 2c 6e 6f 77 28 29 29 22 2c 0a 20 20 20 20 20 Q,now())",.
be20: 20 20 7a 42 67 4d 69 6d 65 0a 20 20 20 20 29 3b zBgMime. );
be30: 0a 20 20 20 20 64 62 5f 70 72 6f 74 65 63 74 5f . db_protect_
be40: 70 6f 70 28 29 3b 0a 20 20 20 20 64 62 5f 65 6e pop();. db_en
be50: 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 d_transaction(0)
be60: 3b 0a 20 20 20 20 63 67 69 5f 72 65 64 69 72 65 ;. cgi_redire
be70: 63 74 28 22 73 65 74 75 70 5f 6c 6f 67 6f 22 29 ct("setup_logo")
be80: 3b 0a 20 20 7d 65 6c 73 65 20 69 66 28 20 50 28 ;. }else if( P(
be90: 22 63 6c 72 62 67 22 29 21 3d 30 20 29 7b 0a 20 "clrbg")!=0 ){.
bea0: 20 20 20 64 62 5f 75 6e 70 72 6f 74 65 63 74 28 db_unprotect(
beb0: 50 52 4f 54 45 43 54 5f 43 4f 4e 46 49 47 29 3b PROTECT_CONFIG);
bec0: 0a 20 20 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 . db_multi_ex
bed0: 65 63 28 0a 20 20 20 20 20 20 20 22 44 45 4c 45 ec(. "DELE
bee0: 54 45 20 46 52 4f 4d 20 63 6f 6e 66 69 67 20 57 TE FROM config W
bef0: 48 45 52 45 20 6e 61 6d 65 20 49 4e 20 22 0a 20 HERE name IN ".
bf00: 20 20 20 20 20 20 20 20 20 20 22 28 27 62 61 63 "('bac
bf10: 6b 67 72 6f 75 6e 64 2d 69 6d 61 67 65 27 2c 27 kground-image','
bf20: 62 61 63 6b 67 72 6f 75 6e 64 2d 6d 69 6d 65 74 background-mimet
bf30: 79 70 65 27 29 22 0a 20 20 20 20 29 3b 0a 20 20 ype')". );.
bf40: 20 20 64 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 db_protect_pop
bf50: 28 29 3b 0a 20 20 20 20 64 62 5f 65 6e 64 5f 74 ();. db_end_t
bf60: 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 ransaction(0);.
bf70: 20 20 20 63 67 69 5f 72 65 64 69 72 65 63 74 28 cgi_redirect(
bf80: 22 73 65 74 75 70 5f 6c 6f 67 6f 22 29 3b 0a 20 "setup_logo");.
bf90: 20 7d 65 6c 73 65 20 69 66 28 20 50 28 22 73 65 }else if( P("se
bfa0: 74 69 63 6f 6e 22 29 21 3d 30 20 26 26 20 7a 49 ticon")!=0 && zI
bfb0: 63 6f 6e 4d 69 6d 65 20 26 26 20 7a 49 63 6f 6e conMime && zIcon
bfc0: 4d 69 6d 65 5b 30 5d 20 26 26 20 73 7a 49 63 6f Mime[0] && szIco
bfd0: 6e 49 6d 67 3e 30 20 29 7b 0a 20 20 20 20 42 6c nImg>0 ){. Bl
bfe0: 6f 62 20 69 6d 67 3b 0a 20 20 20 20 53 74 6d 74 ob img;. Stmt
bff0: 20 69 6e 73 3b 0a 20 20 20 20 62 6c 6f 62 5f 69 ins;. blob_i
c000: 6e 69 74 28 26 69 6d 67 2c 20 61 49 63 6f 6e 49 nit(&img, aIconI
c010: 6d 67 2c 20 73 7a 49 63 6f 6e 49 6d 67 29 3b 0a mg, szIconImg);.
c020: 20 20 20 20 64 62 5f 75 6e 70 72 6f 74 65 63 74 db_unprotect
c030: 28 50 52 4f 54 45 43 54 5f 43 4f 4e 46 49 47 29 (PROTECT_CONFIG)
c040: 3b 0a 20 20 20 20 64 62 5f 70 72 65 70 61 72 65 ;. db_prepare
c050: 28 26 69 6e 73 2c 0a 20 20 20 20 20 20 20 20 22 (&ins,. "
c060: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 63 6f 6e REPLACE INTO con
c070: 66 69 67 28 6e 61 6d 65 2c 76 61 6c 75 65 2c 6d fig(name,value,m
c080: 74 69 6d 65 29 22 0a 20 20 20 20 20 20 20 20 22 time)". "
c090: 20 56 41 4c 55 45 53 28 27 69 63 6f 6e 2d 69 6d VALUES('icon-im
c0a0: 61 67 65 27 2c 3a 62 79 74 65 73 2c 6e 6f 77 28 age',:bytes,now(
c0b0: 29 29 22 0a 20 20 20 20 29 3b 0a 20 20 20 20 64 ))". );. d
c0c0: 62 5f 62 69 6e 64 5f 62 6c 6f 62 28 26 69 6e 73 b_bind_blob(&ins
c0d0: 2c 20 22 3a 62 79 74 65 73 22 2c 20 26 69 6d 67 , ":bytes", &img
c0e0: 29 3b 0a 20 20 20 20 64 62 5f 73 74 65 70 28 26 );. db_step(&
c0f0: 69 6e 73 29 3b 0a 20 20 20 20 64 62 5f 66 69 6e ins);. db_fin
c100: 61 6c 69 7a 65 28 26 69 6e 73 29 3b 0a 20 20 20 alize(&ins);.
c110: 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 0a db_multi_exec(.
c120: 20 20 20 20 20 20 20 22 52 45 50 4c 41 43 45 20 "REPLACE
c130: 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 6d 65 INTO config(name
c140: 2c 76 61 6c 75 65 2c 6d 74 69 6d 65 29 22 0a 20 ,value,mtime)".
c150: 20 20 20 20 20 20 22 20 56 41 4c 55 45 53 28 27 " VALUES('
c160: 69 63 6f 6e 2d 6d 69 6d 65 74 79 70 65 27 2c 25 icon-mimetype',%
c170: 51 2c 6e 6f 77 28 29 29 22 2c 0a 20 20 20 20 20 Q,now())",.
c180: 20 20 7a 49 63 6f 6e 4d 69 6d 65 0a 20 20 20 20 zIconMime.
c190: 29 3b 0a 20 20 20 20 64 62 5f 70 72 6f 74 65 63 );. db_protec
c1a0: 74 5f 70 6f 70 28 29 3b 0a 20 20 20 20 64 62 5f t_pop();. db_
c1b0: 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 end_transaction(
c1c0: 30 29 3b 0a 20 20 20 20 63 67 69 5f 72 65 64 69 0);. cgi_redi
c1d0: 72 65 63 74 28 22 73 65 74 75 70 5f 6c 6f 67 6f rect("setup_logo
c1e0: 22 29 3b 0a 20 20 7d 65 6c 73 65 20 69 66 28 20 ");. }else if(
c1f0: 50 28 22 63 6c 72 69 63 6f 6e 22 29 21 3d 30 20 P("clricon")!=0
c200: 29 7b 0a 20 20 20 20 64 62 5f 75 6e 70 72 6f 74 ){. db_unprot
c210: 65 63 74 28 50 52 4f 54 45 43 54 5f 43 4f 4e 46 ect(PROTECT_CONF
c220: 49 47 29 3b 0a 20 20 20 20 64 62 5f 6d 75 6c 74 IG);. db_mult
c230: 69 5f 65 78 65 63 28 0a 20 20 20 20 20 20 20 22 i_exec(. "
c240: 44 45 4c 45 54 45 20 46 52 4f 4d 20 63 6f 6e 66 DELETE FROM conf
c250: 69 67 20 57 48 45 52 45 20 6e 61 6d 65 20 49 4e ig WHERE name IN
c260: 20 22 0a 20 20 20 20 20 20 20 20 20 20 20 22 28 ". "(
c270: 27 69 63 6f 6e 2d 69 6d 61 67 65 27 2c 27 69 63 'icon-image','ic
c280: 6f 6e 2d 6d 69 6d 65 74 79 70 65 27 29 22 0a 20 on-mimetype')".
c290: 20 20 20 29 3b 0a 20 20 20 20 64 62 5f 70 72 6f );. db_pro
c2a0: 74 65 63 74 5f 70 6f 70 28 29 3b 0a 20 20 20 20 tect_pop();.
c2b0: 64 62 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 db_end_transacti
c2c0: 6f 6e 28 30 29 3b 0a 20 20 20 20 63 67 69 5f 72 on(0);. cgi_r
c2d0: 65 64 69 72 65 63 74 28 22 73 65 74 75 70 5f 6c edirect("setup_l
c2e0: 6f 67 6f 22 29 3b 0a 20 20 7d 0a 20 20 73 74 79 ogo");. }. sty
c2f0: 6c 65 5f 68 65 61 64 65 72 28 22 45 64 69 74 20 le_header("Edit
c300: 50 72 6f 6a 65 63 74 20 4c 6f 67 6f 20 41 6e 64 Project Logo And
c310: 20 42 61 63 6b 67 72 6f 75 6e 64 22 29 3b 0a 20 Background");.
c320: 20 40 20 3c 70 3e 54 68 65 20 63 75 72 72 65 6e @ <p>The curren
c330: 74 20 70 72 6f 6a 65 63 74 20 6c 6f 67 6f 20 68 t project logo h
c340: 61 73 20 61 20 4d 49 4d 45 2d 54 79 70 65 20 6f as a MIME-Type o
c350: 66 20 3c 62 3e 25 68 28 7a 4c 6f 67 6f 4d 69 6d f <b>%h(zLogoMim
c360: 65 29 3c 2f 62 3e 0a 20 20 40 20 61 6e 64 20 6c e)</b>. @ and l
c370: 6f 6f 6b 73 20 6c 69 6b 65 20 74 68 69 73 3a 3c ooks like this:<
c380: 2f 70 3e 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 75 /p>. @ <blockqu
c390: 6f 74 65 3e 3c 70 3e 3c 69 6d 67 20 73 72 63 3d ote><p><img src=
c3a0: 22 25 52 2f 6c 6f 67 6f 2f 25 7a 28 7a 4c 6f 67 "%R/logo/%z(zLog
c3b0: 6f 4d 74 69 6d 65 29 22 20 5c 0a 20 20 40 20 61 oMtime)" \. @ a
c3c0: 6c 74 3d 22 6c 6f 67 6f 22 20 62 6f 72 64 65 72 lt="logo" border
c3d0: 3d 22 31 22 20 2f 3e 0a 20 20 40 20 3c 2f 70 3e ="1" />. @ </p>
c3e0: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 </blockquote>.
c3f0: 40 0a 20 20 40 20 3c 66 6f 72 6d 20 61 63 74 69 @. @ <form acti
c400: 6f 6e 3d 22 25 52 2f 73 65 74 75 70 5f 6c 6f 67 on="%R/setup_log
c410: 6f 22 20 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 o" method="post"
c420: 0a 20 20 40 20 20 65 6e 63 74 79 70 65 3d 22 6d . @ enctype="m
c430: 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 ultipart/form-da
c440: 74 61 22 3e 3c 64 69 76 3e 0a 20 20 40 20 3c 70 ta"><div>. @ <p
c450: 3e 54 68 65 20 6c 6f 67 6f 20 69 73 20 61 63 63 >The logo is acc
c460: 65 73 73 69 62 6c 65 20 74 6f 20 61 6c 6c 20 75 essible to all u
c470: 73 65 72 73 20 61 74 20 74 68 69 73 20 55 52 4c sers at this URL
c480: 3a 0a 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 :. @ <a href="%
c490: 73 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 6c 6f s(g.zBaseURL)/lo
c4a0: 67 6f 22 3e 25 73 28 67 2e 7a 42 61 73 65 55 52 go">%s(g.zBaseUR
c4b0: 4c 29 2f 6c 6f 67 6f 3c 2f 61 3e 2e 0a 20 20 40 L)/logo</a>.. @
c4c0: 20 54 68 65 20 6c 6f 67 6f 20 6d 61 79 20 6f 72 The logo may or
c4d0: 20 6d 61 79 20 6e 6f 74 20 61 70 70 65 61 72 20 may not appear
c4e0: 6f 6e 20 65 61 63 68 0a 20 20 40 20 70 61 67 65 on each. @ page
c4f0: 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 depending on th
c500: 65 20 3c 61 20 68 72 65 66 3d 22 73 65 74 75 70 e <a href="setup
c510: 5f 73 6b 69 6e 65 64 69 74 3f 77 3d 30 22 3e 43 _skinedit?w=0">C
c520: 53 53 3c 2f 61 3e 20 61 6e 64 0a 20 20 40 20 3c SS</a> and. @ <
c530: 61 20 68 72 65 66 3d 22 73 65 74 75 70 5f 73 6b a href="setup_sk
c540: 69 6e 65 64 69 74 3f 77 3d 32 22 3e 68 65 61 64 inedit?w=2">head
c550: 65 72 20 73 65 74 75 70 3c 2f 61 3e 2e 0a 20 20 er setup</a>..
c560: 40 20 54 6f 20 63 68 61 6e 67 65 20 74 68 65 20 @ To change the
c570: 6c 6f 67 6f 20 69 6d 61 67 65 2c 20 75 73 65 20 logo image, use
c580: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f the following fo
c590: 72 6d 3a 3c 2f 70 3e 0a 20 20 6c 6f 67 69 6e 5f rm:</p>. login_
c5a0: 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 65 63 72 insert_csrf_secr
c5b0: 65 74 28 29 3b 0a 20 20 40 20 4c 6f 67 6f 20 49 et();. @ Logo I
c5c0: 6d 61 67 65 20 66 69 6c 65 3a 0a 20 20 40 20 3c mage file:. @ <
c5d0: 69 6e 70 75 74 20 74 79 70 65 3d 22 66 69 6c 65 input type="file
c5e0: 22 20 6e 61 6d 65 3d 22 6c 6f 67 6f 69 6d 22 20 " name="logoim"
c5f0: 73 69 7a 65 3d 22 36 30 22 20 61 63 63 65 70 74 size="60" accept
c600: 3d 22 69 6d 61 67 65 2f 2a 22 20 2f 3e 0a 20 20 ="image/*" />.
c610: 40 20 3c 70 20 61 6c 69 67 6e 3d 22 63 65 6e 74 @ <p align="cent
c620: 65 72 22 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 er">. @ <input
c630: 74 79 70 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 type="submit" na
c640: 6d 65 3d 22 73 65 74 6c 6f 67 6f 22 20 76 61 6c me="setlogo" val
c650: 75 65 3d 22 43 68 61 6e 67 65 20 4c 6f 67 6f 22 ue="Change Logo"
c660: 20 2f 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 />. @ <input t
c670: 79 70 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d ype="submit" nam
c680: 65 3d 22 63 6c 72 6c 6f 67 6f 22 20 76 61 6c 75 e="clrlogo" valu
c690: 65 3d 22 52 65 76 65 72 74 20 54 6f 20 44 65 66 e="Revert To Def
c6a0: 61 75 6c 74 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 ault" /></p>. @
c6b0: 20 3c 70 3e 28 50 72 6f 70 65 72 74 69 65 73 3a <p>(Properties:
c6c0: 20 22 6c 6f 67 6f 2d 69 6d 61 67 65 22 20 61 6e "logo-image" an
c6d0: 64 20 22 6c 6f 67 6f 2d 6d 69 6d 65 74 79 70 65 d "logo-mimetype
c6e0: 22 29 0a 20 20 40 20 3c 2f 64 69 76 3e 3c 2f 66 "). @ </div></f
c6f0: 6f 72 6d 3e 0a 20 20 40 20 3c 68 72 20 2f 3e 0a orm>. @ <hr />.
c700: 20 20 40 0a 20 20 40 20 3c 70 3e 54 68 65 20 63 @. @ <p>The c
c710: 75 72 72 65 6e 74 20 62 61 63 6b 67 72 6f 75 6e urrent backgroun
c720: 64 20 69 6d 61 67 65 20 68 61 73 20 61 20 4d 49 d image has a MI
c730: 4d 45 2d 54 79 70 65 20 6f 66 20 3c 62 3e 25 68 ME-Type of <b>%h
c740: 28 7a 42 67 4d 69 6d 65 29 3c 2f 62 3e 0a 20 20 (zBgMime)</b>.
c750: 40 20 61 6e 64 20 6c 6f 6f 6b 73 20 6c 69 6b 65 @ and looks like
c760: 20 74 68 69 73 3a 3c 2f 70 3e 0a 20 20 40 20 3c this:</p>. @ <
c770: 62 6c 6f 63 6b 71 75 6f 74 65 3e 3c 70 3e 3c 69 blockquote><p><i
c780: 6d 67 20 73 72 63 3d 22 25 52 2f 62 61 63 6b 67 mg src="%R/backg
c790: 72 6f 75 6e 64 2f 25 7a 28 7a 42 67 4d 74 69 6d round/%z(zBgMtim
c7a0: 65 29 22 20 5c 0a 20 20 40 20 61 6c 74 3d 22 62 e)" \. @ alt="b
c7b0: 61 63 6b 67 72 6f 75 6e 64 22 20 62 6f 72 64 65 ackground" borde
c7c0: 72 3d 31 20 2f 3e 0a 20 20 40 20 3c 2f 70 3e 3c r=1 />. @ </p><
c7d0: 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 40 /blockquote>. @
c7e0: 0a 20 20 40 20 3c 66 6f 72 6d 20 61 63 74 69 6f . @ <form actio
c7f0: 6e 3d 22 25 52 2f 73 65 74 75 70 5f 6c 6f 67 6f n="%R/setup_logo
c800: 22 20 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 0a " method="post".
c810: 20 20 40 20 20 65 6e 63 74 79 70 65 3d 22 6d 75 @ enctype="mu
c820: 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 ltipart/form-dat
c830: 61 22 3e 3c 64 69 76 3e 0a 20 20 40 20 3c 70 3e a"><div>. @ <p>
c840: 54 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 69 The background i
c850: 6d 61 67 65 20 69 73 20 61 63 63 65 73 73 69 62 mage is accessib
c860: 6c 65 20 74 6f 20 61 6c 6c 20 75 73 65 72 73 20 le to all users
c870: 61 74 20 74 68 69 73 20 55 52 4c 3a 0a 20 20 40 at this URL:. @
c880: 20 3c 61 20 68 72 65 66 3d 22 25 73 28 67 2e 7a <a href="%s(g.z
c890: 42 61 73 65 55 52 4c 29 2f 62 61 63 6b 67 72 6f BaseURL)/backgro
c8a0: 75 6e 64 22 3e 25 73 28 67 2e 7a 42 61 73 65 55 und">%s(g.zBaseU
c8b0: 52 4c 29 2f 62 61 63 6b 67 72 6f 75 6e 64 3c 2f RL)/background</
c8c0: 61 3e 2e 0a 20 20 40 20 54 68 65 20 62 61 63 6b a>.. @ The back
c8d0: 67 72 6f 75 6e 64 20 69 6d 61 67 65 20 6d 61 79 ground image may
c8e0: 20 6f 72 20 6d 61 79 20 6e 6f 74 20 61 70 70 65 or may not appe
c8f0: 61 72 20 6f 6e 20 65 61 63 68 0a 20 20 40 20 70 ar on each. @ p
c900: 61 67 65 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e age depending on
c910: 20 74 68 65 20 3c 61 20 68 72 65 66 3d 22 73 65 the <a href="se
c920: 74 75 70 5f 73 6b 69 6e 65 64 69 74 3f 77 3d 30 tup_skinedit?w=0
c930: 22 3e 43 53 53 3c 2f 61 3e 20 61 6e 64 0a 20 20 ">CSS</a> and.
c940: 40 20 3c 61 20 68 72 65 66 3d 22 73 65 74 75 70 @ <a href="setup
c950: 5f 73 6b 69 6e 65 64 69 74 3f 77 3d 32 22 3e 68 _skinedit?w=2">h
c960: 65 61 64 65 72 20 73 65 74 75 70 3c 2f 61 3e 2e eader setup</a>.
c970: 0a 20 20 40 20 54 6f 20 63 68 61 6e 67 65 20 74 . @ To change t
c980: 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 69 6d he background im
c990: 61 67 65 2c 20 75 73 65 20 74 68 65 20 66 6f 6c age, use the fol
c9a0: 6c 6f 77 69 6e 67 20 66 6f 72 6d 3a 3c 2f 70 3e lowing form:</p>
c9b0: 0a 20 20 6c 6f 67 69 6e 5f 69 6e 73 65 72 74 5f . login_insert_
c9c0: 63 73 72 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 csrf_secret();.
c9d0: 20 40 20 42 61 63 6b 67 72 6f 75 6e 64 20 69 6d @ Background im
c9e0: 61 67 65 20 66 69 6c 65 3a 0a 20 20 40 20 3c 69 age file:. @ <i
c9f0: 6e 70 75 74 20 74 79 70 65 3d 22 66 69 6c 65 22 nput type="file"
ca00: 20 6e 61 6d 65 3d 22 62 67 69 6d 22 20 73 69 7a name="bgim" siz
ca10: 65 3d 22 36 30 22 20 61 63 63 65 70 74 3d 22 69 e="60" accept="i
ca20: 6d 61 67 65 2f 2a 22 20 2f 3e 0a 20 20 40 20 3c mage/*" />. @ <
ca30: 70 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 p align="center"
ca40: 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 >. @ <input typ
ca50: 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d e="submit" name=
ca60: 22 73 65 74 62 67 22 20 76 61 6c 75 65 3d 22 43 "setbg" value="C
ca70: 68 61 6e 67 65 20 42 61 63 6b 67 72 6f 75 6e 64 hange Background
ca80: 22 20 2f 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 " />. @ <input
ca90: 74 79 70 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 type="submit" na
caa0: 6d 65 3d 22 63 6c 72 62 67 22 20 76 61 6c 75 65 me="clrbg" value
cab0: 3d 22 52 65 76 65 72 74 20 54 6f 20 44 65 66 61 ="Revert To Defa
cac0: 75 6c 74 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 20 ult" /></p>. @
cad0: 3c 2f 64 69 76 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 </div></form>.
cae0: 40 20 3c 70 3e 28 50 72 6f 70 65 72 74 69 65 73 @ <p>(Properties
caf0: 3a 20 22 62 61 63 6b 67 72 6f 75 6e 64 2d 69 6d : "background-im
cb00: 61 67 65 22 20 61 6e 64 20 22 62 61 63 6b 67 72 age" and "backgr
cb10: 6f 75 6e 64 2d 6d 69 6d 65 74 79 70 65 22 29 0a ound-mimetype").
cb20: 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 40 0a 20 @ <hr />. @.
cb30: 20 40 20 3c 70 3e 54 68 65 20 63 75 72 72 65 6e @ <p>The curren
cb40: 74 20 69 63 6f 6e 20 69 6d 61 67 65 20 68 61 73 t icon image has
cb50: 20 61 20 4d 49 4d 45 2d 54 79 70 65 20 6f 66 20 a MIME-Type of
cb60: 3c 62 3e 25 68 28 7a 49 63 6f 6e 4d 69 6d 65 29 <b>%h(zIconMime)
cb70: 3c 2f 62 3e 0a 20 20 40 20 61 6e 64 20 6c 6f 6f </b>. @ and loo
cb80: 6b 73 20 6c 69 6b 65 20 74 68 69 73 3a 3c 2f 70 ks like this:</p
cb90: 3e 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 75 6f 74 >. @ <blockquot
cba0: 65 3e 3c 70 3e 3c 69 6d 67 20 73 72 63 3d 22 25 e><p><img src="%
cbb0: 52 2f 66 61 76 69 63 6f 6e 2e 69 63 6f 2f 25 7a R/favicon.ico/%z
cbc0: 28 7a 49 63 6f 6e 4d 74 69 6d 65 29 22 20 5c 0a (zIconMtime)" \.
cbd0: 20 20 40 20 61 6c 74 3d 22 69 63 6f 6e 22 20 62 @ alt="icon" b
cbe0: 6f 72 64 65 72 3d 31 20 2f 3e 0a 20 20 40 20 3c order=1 />. @ <
cbf0: 2f 70 3e 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e /p></blockquote>
cc00: 0a 20 20 40 0a 20 20 40 20 3c 66 6f 72 6d 20 61 . @. @ <form a
cc10: 63 74 69 6f 6e 3d 22 25 52 2f 73 65 74 75 70 5f ction="%R/setup_
cc20: 6c 6f 67 6f 22 20 6d 65 74 68 6f 64 3d 22 70 6f logo" method="po
cc30: 73 74 22 0a 20 20 40 20 20 65 6e 63 74 79 70 65 st". @ enctype
cc40: 3d 22 6d 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d ="multipart/form
cc50: 2d 64 61 74 61 22 3e 3c 64 69 76 3e 0a 20 20 40 -data"><div>. @
cc60: 20 3c 70 3e 54 68 65 20 69 63 6f 6e 20 69 6d 61 <p>The icon ima
cc70: 67 65 20 69 73 20 61 63 63 65 73 73 69 62 6c 65 ge is accessible
cc80: 20 74 6f 20 61 6c 6c 20 75 73 65 72 73 20 61 74 to all users at
cc90: 20 74 68 69 73 20 55 52 4c 3a 0a 20 20 40 20 3c this URL:. @ <
cca0: 61 20 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 a href="%s(g.zBa
ccb0: 73 65 55 52 4c 29 2f 66 61 76 69 63 6f 6e 2e 69 seURL)/favicon.i
ccc0: 63 6f 22 3e 25 73 28 67 2e 7a 42 61 73 65 55 52 co">%s(g.zBaseUR
ccd0: 4c 29 2f 66 61 76 69 63 6f 6e 2e 69 63 6f 3c 2f L)/favicon.ico</
cce0: 61 3e 2e 0a 20 20 40 20 54 68 65 20 69 63 6f 6e a>.. @ The icon
ccf0: 20 69 6d 61 67 65 20 6d 61 79 20 6f 72 20 6d 61 image may or ma
cd00: 79 20 6e 6f 74 20 61 70 70 65 61 72 20 6f 6e 20 y not appear on
cd10: 65 61 63 68 0a 20 20 40 20 70 61 67 65 20 64 65 each. @ page de
cd20: 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 77 pending on the w
cd30: 65 62 20 62 72 6f 77 73 65 72 20 69 6e 20 75 73 eb browser in us
cd40: 65 20 61 6e 64 20 74 68 65 20 4d 49 4d 45 2d 54 e and the MIME-T
cd50: 79 70 65 73 20 74 68 61 74 20 69 74 0a 20 20 40 ypes that it. @
cd60: 20 73 75 70 70 6f 72 74 73 20 66 6f 72 20 69 63 supports for ic
cd70: 6f 6e 20 69 6d 61 67 65 73 2e 0a 20 20 40 20 54 on images.. @ T
cd80: 6f 20 63 68 61 6e 67 65 20 74 68 65 20 69 63 6f o change the ico
cd90: 6e 20 69 6d 61 67 65 2c 20 75 73 65 20 74 68 65 n image, use the
cda0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 3a following form:
cdb0: 3c 2f 70 3e 0a 20 20 6c 6f 67 69 6e 5f 69 6e 73 </p>. login_ins
cdc0: 65 72 74 5f 63 73 72 66 5f 73 65 63 72 65 74 28 ert_csrf_secret(
cdd0: 29 3b 0a 20 20 40 20 49 63 6f 6e 20 69 6d 61 67 );. @ Icon imag
cde0: 65 20 66 69 6c 65 3a 0a 20 20 40 20 3c 69 6e 70 e file:. @ <inp
cdf0: 75 74 20 74 79 70 65 3d 22 66 69 6c 65 22 20 6e ut type="file" n
ce00: 61 6d 65 3d 22 69 63 6f 6e 69 6d 22 20 73 69 7a ame="iconim" siz
ce10: 65 3d 22 36 30 22 20 61 63 63 65 70 74 3d 22 69 e="60" accept="i
ce20: 6d 61 67 65 2f 2a 22 20 2f 3e 0a 20 20 40 20 3c mage/*" />. @ <
ce30: 70 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 p align="center"
ce40: 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 >. @ <input typ
ce50: 65 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d e="submit" name=
ce60: 22 73 65 74 69 63 6f 6e 22 20 76 61 6c 75 65 3d "seticon" value=
ce70: 22 43 68 61 6e 67 65 20 49 63 6f 6e 22 20 2f 3e "Change Icon" />
ce80: 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 65 . @ <input type
ce90: 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d 22 ="submit" name="
cea0: 63 6c 72 69 63 6f 6e 22 20 76 61 6c 75 65 3d 22 clricon" value="
ceb0: 52 65 76 65 72 74 20 54 6f 20 44 65 66 61 75 6c Revert To Defaul
cec0: 74 22 20 2f 3e 3c 2f 70 3e 0a 20 20 40 20 3c 2f t" /></p>. @ </
ced0: 64 69 76 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 40 20 div></form>. @
cee0: 3c 70 3e 28 50 72 6f 70 65 72 74 69 65 73 3a 20 <p>(Properties:
cef0: 22 69 63 6f 6e 2d 69 6d 61 67 65 22 20 61 6e 64 "icon-image" and
cf00: 20 22 69 63 6f 6e 2d 6d 69 6d 65 74 79 70 65 22 "icon-mimetype"
cf10: 29 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 40 ). @ <hr />. @
cf20: 0a 20 20 40 20 3c 70 3e 3c 73 70 61 6e 20 63 6c . @ <p><span cl
cf30: 61 73 73 3d 22 6e 6f 74 65 22 3e 4e 6f 74 65 3a ass="note">Note:
cf40: 3c 2f 73 70 61 6e 3e 20 20 59 6f 75 72 20 62 72 </span> Your br
cf50: 6f 77 73 65 72 20 68 61 73 20 70 72 6f 62 61 62 owser has probab
cf60: 6c 79 20 63 61 63 68 65 64 20 74 68 65 73 65 0a ly cached these.
cf70: 20 20 40 20 69 6d 61 67 65 73 2c 20 73 6f 20 79 @ images, so y
cf80: 6f 75 20 6d 61 79 20 6e 65 65 64 20 74 6f 20 70 ou may need to p
cf90: 72 65 73 73 20 74 68 65 20 52 65 6c 6f 61 64 20 ress the Reload
cfa0: 62 75 74 74 6f 6e 20 62 65 66 6f 72 65 20 63 68 button before ch
cfb0: 61 6e 67 65 73 20 77 69 6c 6c 0a 20 20 40 20 74 anges will. @ t
cfc0: 61 6b 65 20 65 66 66 65 63 74 2e 20 3c 2f 70 3e ake effect. </p>
cfd0: 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 . style_footer(
cfe0: 29 3b 0a 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e );. db_end_tran
cff0: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 7d 0a 0a 2f saction(0);.}../
d000: 2a 0a 2a 2a 20 50 72 65 76 65 6e 74 20 74 68 65 *.** Prevent the
d010: 20 52 41 57 20 53 51 4c 20 66 65 61 74 75 72 65 RAW SQL feature
d020: 20 66 72 6f 6d 20 62 65 69 6e 67 20 75 73 65 64 from being used
d030: 20 74 6f 20 41 54 54 41 43 48 20 61 20 64 69 66 to ATTACH a dif
d040: 66 65 72 65 6e 74 0a 2a 2a 20 64 61 74 61 62 61 ferent.** databa
d050: 73 65 20 61 6e 64 20 71 75 65 72 79 20 69 74 2e se and query it.
d060: 0a 2a 2a 0a 2a 2a 20 41 63 74 75 61 6c 6c 79 2c .**.** Actually,
d070: 20 74 68 65 20 52 41 57 20 53 51 4c 20 66 65 61 the RAW SQL fea
d080: 74 75 72 65 20 6f 6e 6c 79 20 64 6f 65 73 20 61 ture only does a
d090: 20 73 69 6e 67 6c 65 20 73 74 61 74 65 6d 65 6e single statemen
d0a0: 74 20 70 65 72 20 72 65 71 75 65 73 74 2e 0a 2a t per request..*
d0b0: 2a 20 53 6f 20 69 74 20 69 73 20 6e 6f 74 20 70 * So it is not p
d0c0: 6f 73 73 69 62 6c 65 20 74 6f 20 41 54 54 41 43 ossible to ATTAC
d0d0: 48 20 61 6e 64 20 74 68 65 6e 20 64 6f 20 61 20 H and then do a
d0e0: 73 65 70 61 72 61 74 65 20 71 75 65 72 79 2e 20 separate query.
d0f0: 20 54 68 69 73 0a 2a 2a 20 72 6f 75 74 69 6e 65 This.** routine
d100: 20 69 73 20 6e 6f 74 20 73 74 72 69 63 74 6c 79 is not strictly
d110: 20 6e 65 63 65 73 73 61 72 79 2c 20 74 68 65 72 necessary, ther
d120: 65 66 6f 72 65 2e 20 20 42 75 74 20 69 74 20 64 efore. But it d
d130: 6f 65 73 20 6e 6f 74 20 68 75 72 74 0a 2a 2a 20 oes not hurt.**
d140: 74 6f 20 62 65 20 70 61 72 61 6e 6f 69 64 2e 0a to be paranoid..
d150: 2a 2f 0a 69 6e 74 20 72 61 77 5f 73 71 6c 5f 71 */.int raw_sql_q
d160: 75 65 72 79 5f 61 75 74 68 6f 72 69 7a 65 72 28 uery_authorizer(
d170: 0a 20 20 76 6f 69 64 20 2a 70 45 72 72 6f 72 2c . void *pError,
d180: 0a 20 20 69 6e 74 20 63 6f 64 65 2c 0a 20 20 63 . int code,. c
d190: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 41 72 67 31 onst char *zArg1
d1a0: 2c 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a ,. const char *
d1b0: 7a 41 72 67 32 2c 0a 20 20 63 6f 6e 73 74 20 63 zArg2,. const c
d1c0: 68 61 72 20 2a 7a 41 72 67 33 2c 0a 20 20 63 6f har *zArg3,. co
d1d0: 6e 73 74 20 63 68 61 72 20 2a 7a 41 72 67 34 0a nst char *zArg4.
d1e0: 29 7b 0a 20 20 69 66 28 20 63 6f 64 65 3d 3d 53 ){. if( code==S
d1f0: 51 4c 49 54 45 5f 41 54 54 41 43 48 20 29 7b 0a QLITE_ATTACH ){.
d200: 20 20 20 20 72 65 74 75 72 6e 20 53 51 4c 49 54 return SQLIT
d210: 45 5f 44 45 4e 59 3b 0a 20 20 7d 0a 20 20 72 65 E_DENY;. }. re
d220: 74 75 72 6e 20 53 51 4c 49 54 45 5f 4f 4b 3b 0a turn SQLITE_OK;.
d230: 7d 0a 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 }.../*.** WEBPAG
d240: 45 3a 20 61 64 6d 69 6e 5f 73 71 6c 0a 2a 2a 0a E: admin_sql.**.
d250: 2a 2a 20 52 75 6e 20 72 61 77 20 53 51 4c 20 63 ** Run raw SQL c
d260: 6f 6d 6d 61 6e 64 73 20 61 67 61 69 6e 73 74 20 ommands against
d270: 74 68 65 20 64 61 74 61 62 61 73 65 20 66 69 6c the database fil
d280: 65 20 75 73 69 6e 67 20 74 68 65 20 77 65 62 20 e using the web
d290: 69 6e 74 65 72 66 61 63 65 2e 0a 2a 2a 20 52 65 interface..** Re
d2a0: 71 75 69 72 65 73 20 53 65 74 75 70 20 70 72 69 quires Setup pri
d2b0: 76 69 6c 65 67 65 73 2e 0a 2a 2f 0a 76 6f 69 64 vileges..*/.void
d2c0: 20 73 71 6c 5f 70 61 67 65 28 76 6f 69 64 29 7b sql_page(void){
d2d0: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a . const char *z
d2e0: 51 3b 0a 20 20 69 6e 74 20 67 6f 20 3d 20 50 28 Q;. int go = P(
d2f0: 22 67 6f 22 29 21 3d 30 3b 0a 20 20 6c 6f 67 69 "go")!=0;. logi
d300: 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 n_check_credenti
d310: 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 67 2e als();. if( !g.
d320: 70 65 72 6d 2e 53 65 74 75 70 20 29 7b 0a 20 20 perm.Setup ){.
d330: 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 65 64 28 30 login_needed(0
d340: 29 3b 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 );. return;.
d350: 20 7d 0a 20 20 61 64 64 5f 63 6f 6e 74 65 6e 74 }. add_content
d360: 5f 73 71 6c 5f 63 6f 6d 6d 61 6e 64 73 28 67 2e _sql_commands(g.
d370: 64 62 29 3b 0a 20 20 7a 51 20 3d 20 63 67 69 5f db);. zQ = cgi_
d380: 63 73 72 66 5f 73 61 66 65 28 31 29 20 3f 20 50 csrf_safe(1) ? P
d390: 28 22 71 22 29 20 3a 20 30 3b 0a 20 20 73 74 79 ("q") : 0;. sty
d3a0: 6c 65 5f 68 65 61 64 65 72 28 22 52 61 77 20 53 le_header("Raw S
d3b0: 51 4c 20 43 6f 6d 6d 61 6e 64 73 22 29 3b 0a 20 QL Commands");.
d3c0: 20 40 20 3c 70 3e 3c 62 3e 43 61 75 74 69 6f 6e @ <p><b>Caution
d3d0: 3a 3c 2f 62 3e 20 54 68 65 72 65 20 61 72 65 20 :</b> There are
d3e0: 6e 6f 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 no restrictions
d3f0: 6f 6e 20 74 68 65 20 53 51 4c 20 74 68 61 74 20 on the SQL that
d400: 63 61 6e 20 62 65 0a 20 20 40 20 72 75 6e 20 62 can be. @ run b
d410: 79 20 74 68 69 73 20 70 61 67 65 2e 20 20 59 6f y this page. Yo
d420: 75 20 63 61 6e 20 64 6f 20 73 65 72 69 6f 75 73 u can do serious
d430: 20 61 6e 64 20 69 72 72 65 70 61 69 72 61 62 6c and irrepairabl
d440: 65 20 64 61 6d 61 67 65 20 74 6f 20 74 68 65 0a e damage to the.
d450: 20 20 40 20 72 65 70 6f 73 69 74 6f 72 79 2e 20 @ repository.
d460: 20 50 72 6f 63 65 65 64 20 77 69 74 68 20 65 78 Proceed with ex
d470: 74 72 65 6d 65 20 63 61 75 74 69 6f 6e 2e 3c 2f treme caution.</
d480: 70 3e 0a 20 20 40 0a 23 69 66 20 30 0a 20 20 40 p>. @.#if 0. @
d490: 20 3c 70 3e 4f 6e 6c 79 20 74 68 65 20 66 69 72 <p>Only the fir
d4a0: 73 74 20 73 74 61 74 65 6d 65 6e 74 20 69 6e 20 st statement in
d4b0: 74 68 65 20 65 6e 74 72 79 20 62 6f 78 20 77 69 the entry box wi
d4c0: 6c 6c 20 62 65 20 72 75 6e 2e 0a 20 20 40 20 41 ll be run.. @ A
d4d0: 6e 79 20 73 75 62 73 65 71 75 65 6e 74 20 73 74 ny subsequent st
d4e0: 61 74 65 6d 65 6e 74 73 20 77 69 6c 6c 20 62 65 atements will be
d4f0: 20 73 69 6c 65 6e 74 6c 79 20 69 67 6e 6f 72 65 silently ignore
d500: 64 2e 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 20 3c d.</p>. @. @ <
d510: 70 3e 44 61 74 61 62 61 73 65 20 6e 61 6d 65 73 p>Database names
d520: 3a 3c 75 6c 3e 3c 6c 69 3e 72 65 70 6f 73 69 74 :<ul><li>reposit
d530: 6f 72 79 0a 20 20 69 66 28 20 67 2e 7a 43 6f 6e ory. if( g.zCon
d540: 66 69 67 44 62 4e 61 6d 65 20 29 7b 0a 20 20 20 figDbName ){.
d550: 20 40 20 3c 6c 69 3e 63 6f 6e 66 69 67 64 62 0a @ <li>configdb.
d560: 20 20 7d 0a 20 20 69 66 28 20 67 2e 6c 6f 63 61 }. if( g.loca
d570: 6c 4f 70 65 6e 20 29 7b 0a 20 20 20 20 40 20 3c lOpen ){. @ <
d580: 6c 69 3e 6c 6f 63 61 6c 64 62 0a 20 20 7d 0a 20 li>localdb. }.
d590: 20 40 20 3c 2f 75 6c 3e 3c 2f 70 3e 0a 23 65 6e @ </ul></p>.#en
d5a0: 64 69 66 0a 0a 20 20 69 66 28 20 50 28 22 63 6f dif.. if( P("co
d5b0: 6e 66 69 67 74 61 62 22 29 20 29 7b 0a 20 20 20 nfigtab") ){.
d5c0: 20 2f 2a 20 49 66 20 74 68 65 20 75 73 65 72 20 /* If the user
d5d0: 70 72 65 73 73 65 73 20 74 68 65 20 22 43 4f 4e presses the "CON
d5e0: 46 49 47 20 54 61 62 6c 65 20 51 75 65 72 79 22 FIG Table Query"
d5f0: 20 62 75 74 74 6f 6e 2c 20 70 6f 70 75 6c 61 74 button, populat
d600: 65 20 74 68 65 0a 20 20 20 20 2a 2a 20 71 75 65 e the. ** que
d610: 72 79 20 74 65 78 74 20 77 69 74 68 20 61 20 70 ry text with a p
d620: 72 65 2d 70 61 63 6b 61 67 65 64 20 71 75 65 72 re-packaged quer
d630: 79 20 61 67 61 69 6e 73 74 20 74 68 65 20 43 4f y against the CO
d640: 4e 46 49 47 20 74 61 62 6c 65 20 2a 2f 0a 20 20 NFIG table */.
d650: 20 20 7a 51 20 3d 20 22 53 45 4c 45 43 54 5c 6e zQ = "SELECT\n
d660: 22 0a 20 20 20 20 20 20 20 20 20 22 20 43 41 53 ". " CAS
d670: 45 20 57 48 45 4e 20 6c 65 6e 67 74 68 28 6e 61 E WHEN length(na
d680: 6d 65 29 3c 35 30 20 54 48 45 4e 20 6e 61 6d 65 me)<50 THEN name
d690: 20 45 4c 53 45 20 70 72 69 6e 74 66 28 27 25 2e ELSE printf('%.
d6a0: 35 30 73 2e 2e 2e 27 2c 6e 61 6d 65 29 22 0a 20 50s...',name)".
d6b0: 20 20 20 20 20 20 20 20 22 20 20 45 4e 44 20 41 " END A
d6c0: 53 20 6e 61 6d 65 2c 5c 6e 22 0a 20 20 20 20 20 S name,\n".
d6d0: 20 20 20 20 22 20 43 41 53 45 20 57 48 45 4e 20 " CASE WHEN
d6e0: 74 79 70 65 6f 66 28 76 61 6c 75 65 29 3c 3e 27 typeof(value)<>'
d6f0: 62 6c 6f 62 27 20 41 4e 44 20 6c 65 6e 67 74 68 blob' AND length
d700: 28 76 61 6c 75 65 29 3c 38 30 20 54 48 45 4e 20 (value)<80 THEN
d710: 76 61 6c 75 65 5c 6e 22 0a 20 20 20 20 20 20 20 value\n".
d720: 20 20 22 20 20 20 20 20 20 20 20 20 20 20 45 4c " EL
d730: 53 45 20 27 2e 2e 2e 27 20 45 4e 44 20 41 53 20 SE '...' END AS
d740: 76 61 6c 75 65 2c 5c 6e 22 0a 20 20 20 20 20 20 value,\n".
d750: 20 20 20 22 20 64 61 74 65 74 69 6d 65 28 6d 74 " datetime(mt
d760: 69 6d 65 2c 20 27 75 6e 69 78 65 70 6f 63 68 27 ime, 'unixepoch'
d770: 29 20 41 53 20 6d 74 69 6d 65 5c 6e 22 0a 20 20 ) AS mtime\n".
d780: 20 20 20 20 20 20 20 22 46 52 4f 4d 20 63 6f 6e "FROM con
d790: 66 69 67 5c 6e 22 0a 20 20 20 20 20 20 20 20 20 fig\n".
d7a0: 22 2d 2d 20 4f 52 44 45 52 20 42 59 20 6d 74 69 "-- ORDER BY mti
d7b0: 6d 65 20 44 45 53 43 3b 20 2d 2d 20 6f 70 74 69 me DESC; -- opti
d7c0: 6f 6e 61 6c 22 3b 0a 20 20 20 20 20 67 6f 20 3d onal";. go =
d7d0: 20 31 3b 0a 20 20 7d 0a 20 20 40 0a 20 20 40 20 1;. }. @. @
d7e0: 3c 66 6f 72 6d 20 6d 65 74 68 6f 64 3d 22 70 6f <form method="po
d7f0: 73 74 22 20 61 63 74 69 6f 6e 3d 22 25 52 2f 61 st" action="%R/a
d800: 64 6d 69 6e 5f 73 71 6c 22 3e 0a 20 20 6c 6f 67 dmin_sql">. log
d810: 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 in_insert_csrf_s
d820: 65 63 72 65 74 28 29 3b 0a 20 20 40 20 53 51 4c ecret();. @ SQL
d830: 3a 3c 62 72 20 2f 3e 0a 20 20 40 20 3c 74 65 78 :<br />. @ <tex
d840: 74 61 72 65 61 20 6e 61 6d 65 3d 22 71 22 20 72 tarea name="q" r
d850: 6f 77 73 3d 22 38 22 20 63 6f 6c 73 3d 22 38 30 ows="8" cols="80
d860: 22 3e 25 68 28 7a 51 29 3c 2f 74 65 78 74 61 72 ">%h(zQ)</textar
d870: 65 61 3e 3c 62 72 20 2f 3e 0a 20 20 40 20 3c 69 ea><br />. @ <i
d880: 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 nput type="submi
d890: 74 22 20 6e 61 6d 65 3d 22 67 6f 22 20 76 61 6c t" name="go" val
d8a0: 75 65 3d 22 52 75 6e 20 53 51 4c 22 3e 0a 20 20 ue="Run SQL">.
d8b0: 40 20 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 @ <input type="s
d8c0: 75 62 6d 69 74 22 20 6e 61 6d 65 3d 22 73 63 68 ubmit" name="sch
d8d0: 65 6d 61 22 20 76 61 6c 75 65 3d 22 53 68 6f 77 ema" value="Show
d8e0: 20 53 63 68 65 6d 61 22 3e 0a 20 20 40 20 3c 69 Schema">. @ <i
d8f0: 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 nput type="submi
d900: 74 22 20 6e 61 6d 65 3d 22 74 61 62 6c 65 6c 69 t" name="tableli
d910: 73 74 22 20 76 61 6c 75 65 3d 22 4c 69 73 74 20 st" value="List
d920: 54 61 62 6c 65 73 22 3e 0a 20 20 40 20 3c 69 6e Tables">. @ <in
d930: 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 74 put type="submit
d940: 22 20 6e 61 6d 65 3d 22 63 6f 6e 66 69 67 74 61 " name="configta
d950: 62 22 20 76 61 6c 75 65 3d 22 43 4f 4e 46 49 47 b" value="CONFIG
d960: 20 54 61 62 6c 65 20 51 75 65 72 79 22 3e 0a 20 Table Query">.
d970: 20 40 20 3c 2f 66 6f 72 6d 3e 0a 20 20 69 66 28 @ </form>. if(
d980: 20 50 28 22 73 63 68 65 6d 61 22 29 20 29 7b 0a P("schema") ){.
d990: 20 20 20 20 7a 51 20 3d 20 73 71 6c 69 74 65 33 zQ = sqlite3
d9a0: 5f 6d 70 72 69 6e 74 66 28 0a 20 20 20 20 20 20 _mprintf(.
d9b0: 20 20 20 20 20 20 22 53 45 4c 45 43 54 20 73 71 "SELECT sq
d9c0: 6c 20 46 52 4f 4d 20 72 65 70 6f 73 69 74 6f 72 l FROM repositor
d9d0: 79 2e 73 71 6c 69 74 65 5f 73 63 68 65 6d 61 22 y.sqlite_schema"
d9e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 20 57 . " W
d9f0: 48 45 52 45 20 73 71 6c 20 49 53 20 4e 4f 54 20 HERE sql IS NOT
da00: 4e 55 4c 4c 20 4f 52 44 45 52 20 42 59 20 6e 61 NULL ORDER BY na
da10: 6d 65 22 29 3b 0a 20 20 20 20 67 6f 20 3d 20 31 me");. go = 1
da20: 3b 0a 20 20 7d 65 6c 73 65 20 69 66 28 20 50 28 ;. }else if( P(
da30: 22 74 61 62 6c 65 6c 69 73 74 22 29 20 29 7b 0a "tablelist") ){.
da40: 20 20 20 20 7a 51 20 3d 20 73 71 6c 69 74 65 33 zQ = sqlite3
da50: 5f 6d 70 72 69 6e 74 66 28 0a 20 20 20 20 20 20 _mprintf(.
da60: 20 20 20 20 20 20 22 53 45 4c 45 43 54 20 6e 61 "SELECT na
da70: 6d 65 20 46 52 4f 4d 20 72 65 70 6f 73 69 74 6f me FROM reposito
da80: 72 79 2e 73 71 6c 69 74 65 5f 73 63 68 65 6d 61 ry.sqlite_schema
da90: 20 57 48 45 52 45 20 74 79 70 65 3d 27 74 61 62 WHERE type='tab
daa0: 6c 65 27 22 0a 20 20 20 20 20 20 20 20 20 20 20 le'".
dab0: 20 22 20 4f 52 44 45 52 20 42 59 20 6e 61 6d 65 " ORDER BY name
dac0: 22 29 3b 0a 20 20 20 20 67 6f 20 3d 20 31 3b 0a ");. go = 1;.
dad0: 20 20 7d 0a 20 20 69 66 28 20 67 6f 20 29 7b 0a }. if( go ){.
dae0: 20 20 20 20 73 71 6c 69 74 65 33 5f 73 74 6d 74 sqlite3_stmt
daf0: 20 2a 70 53 74 6d 74 3b 0a 20 20 20 20 69 6e 74 *pStmt;. int
db00: 20 72 63 3b 0a 20 20 20 20 63 6f 6e 73 74 20 63 rc;. const c
db10: 68 61 72 20 2a 7a 54 61 69 6c 3b 0a 20 20 20 20 har *zTail;.
db20: 69 6e 74 20 6e 43 6f 6c 3b 0a 20 20 20 20 69 6e int nCol;. in
db30: 74 20 6e 52 6f 77 20 3d 20 30 3b 0a 20 20 20 20 t nRow = 0;.
db40: 69 6e 74 20 69 3b 0a 20 20 20 20 40 20 3c 68 72 int i;. @ <hr
db50: 20 2f 3e 0a 20 20 20 20 6c 6f 67 69 6e 5f 76 65 />. login_ve
db60: 72 69 66 79 5f 63 73 72 66 5f 73 65 63 72 65 74 rify_csrf_secret
db70: 28 29 3b 0a 20 20 20 20 73 71 6c 69 74 65 33 5f ();. sqlite3_
db80: 73 65 74 5f 61 75 74 68 6f 72 69 7a 65 72 28 67 set_authorizer(g
db90: 2e 64 62 2c 20 72 61 77 5f 73 71 6c 5f 71 75 65 .db, raw_sql_que
dba0: 72 79 5f 61 75 74 68 6f 72 69 7a 65 72 2c 20 30 ry_authorizer, 0
dbb0: 29 3b 0a 20 20 20 20 72 63 20 3d 20 73 71 6c 69 );. rc = sqli
dbc0: 74 65 33 5f 70 72 65 70 61 72 65 5f 76 32 28 67 te3_prepare_v2(g
dbd0: 2e 64 62 2c 20 7a 51 2c 20 2d 31 2c 20 26 70 53 .db, zQ, -1, &pS
dbe0: 74 6d 74 2c 20 26 7a 54 61 69 6c 29 3b 0a 20 20 tmt, &zTail);.
dbf0: 20 20 69 66 28 20 72 63 21 3d 53 51 4c 49 54 45 if( rc!=SQLITE
dc00: 5f 4f 4b 20 29 7b 0a 20 20 20 20 20 20 40 20 3c _OK ){. @ <
dc10: 64 69 76 20 63 6c 61 73 73 3d 22 67 65 6e 65 72 div class="gener
dc20: 61 6c 45 72 72 6f 72 22 3e 25 68 28 73 71 6c 69 alError">%h(sqli
dc30: 74 65 33 5f 65 72 72 6d 73 67 28 67 2e 64 62 29 te3_errmsg(g.db)
dc40: 29 3c 2f 64 69 76 3e 0a 20 20 20 20 20 20 73 71 )</div>. sq
dc50: 6c 69 74 65 33 5f 66 69 6e 61 6c 69 7a 65 28 70 lite3_finalize(p
dc60: 53 74 6d 74 29 3b 0a 20 20 20 20 7d 65 6c 73 65 Stmt);. }else
dc70: 20 69 66 28 20 70 53 74 6d 74 3d 3d 30 20 29 7b if( pStmt==0 ){
dc80: 0a 20 20 20 20 20 20 2f 2a 20 4e 6f 2d 6f 70 20 . /* No-op
dc90: 2a 2f 0a 20 20 20 20 7d 65 6c 73 65 20 69 66 28 */. }else if(
dca0: 20 28 6e 43 6f 6c 20 3d 20 73 71 6c 69 74 65 33 (nCol = sqlite3
dcb0: 5f 63 6f 6c 75 6d 6e 5f 63 6f 75 6e 74 28 70 53 _column_count(pS
dcc0: 74 6d 74 29 29 3d 3d 30 20 29 7b 0a 20 20 20 20 tmt))==0 ){.
dcd0: 20 20 73 71 6c 69 74 65 33 5f 73 74 65 70 28 70 sqlite3_step(p
dce0: 53 74 6d 74 29 3b 0a 20 20 20 20 20 20 72 63 20 Stmt);. rc
dcf0: 3d 20 73 71 6c 69 74 65 33 5f 66 69 6e 61 6c 69 = sqlite3_finali
dd00: 7a 65 28 70 53 74 6d 74 29 3b 0a 20 20 20 20 20 ze(pStmt);.
dd10: 20 69 66 28 20 72 63 20 29 7b 0a 20 20 20 20 20 if( rc ){.
dd20: 20 20 20 40 20 3c 64 69 76 20 63 6c 61 73 73 3d @ <div class=
dd30: 22 67 65 6e 65 72 61 6c 45 72 72 6f 72 22 3e 25 "generalError">%
dd40: 68 28 73 71 6c 69 74 65 33 5f 65 72 72 6d 73 67 h(sqlite3_errmsg
dd50: 28 67 2e 64 62 29 29 3c 2f 64 69 76 3e 0a 20 20 (g.db))</div>.
dd60: 20 20 20 20 7d 0a 20 20 20 20 7d 65 6c 73 65 7b }. }else{
dd70: 0a 20 20 20 20 20 20 40 20 3c 74 61 62 6c 65 20 . @ <table
dd80: 62 6f 72 64 65 72 3d 31 3e 0a 20 20 20 20 20 20 border=1>.
dd90: 77 68 69 6c 65 28 20 73 71 6c 69 74 65 33 5f 73 while( sqlite3_s
dda0: 74 65 70 28 70 53 74 6d 74 29 3d 3d 53 51 4c 49 tep(pStmt)==SQLI
ddb0: 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 20 20 TE_ROW ){.
ddc0: 20 20 69 66 28 20 6e 52 6f 77 3d 3d 30 20 29 7b if( nRow==0 ){
ddd0: 0a 20 20 20 20 20 20 20 20 20 20 40 20 3c 74 72 . @ <tr
dde0: 3e 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 28 >. for(
ddf0: 69 3d 30 3b 20 69 3c 6e 43 6f 6c 3b 20 69 2b 2b i=0; i<nCol; i++
de00: 29 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 40 ){. @
de10: 20 3c 74 68 3e 25 68 28 73 71 6c 69 74 65 33 5f <th>%h(sqlite3_
de20: 63 6f 6c 75 6d 6e 5f 6e 61 6d 65 28 70 53 74 6d column_name(pStm
de30: 74 2c 20 69 29 29 3c 2f 74 68 3e 0a 20 20 20 20 t, i))</th>.
de40: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
de50: 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 20 20 @ </tr>.
de60: 20 20 7d 0a 20 20 20 20 20 20 20 20 6e 52 6f 77 }. nRow
de70: 2b 2b 3b 0a 20 20 20 20 20 20 20 20 40 20 3c 74 ++;. @ <t
de80: 72 3e 0a 20 20 20 20 20 20 20 20 66 6f 72 28 69 r>. for(i
de90: 3d 30 3b 20 69 3c 6e 43 6f 6c 3b 20 69 2b 2b 29 =0; i<nCol; i++)
dea0: 7b 0a 20 20 20 20 20 20 20 20 20 20 73 77 69 74 {. swit
deb0: 63 68 28 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 ch( sqlite3_colu
dec0: 6d 6e 5f 74 79 70 65 28 70 53 74 6d 74 2c 20 69 mn_type(pStmt, i
ded0: 29 20 29 7b 0a 20 20 20 20 20 20 20 20 20 20 20 ) ){.
dee0: 20 63 61 73 65 20 53 51 4c 49 54 45 5f 49 4e 54 case SQLITE_INT
def0: 45 47 45 52 3a 0a 20 20 20 20 20 20 20 20 20 20 EGER:.
df00: 20 20 63 61 73 65 20 53 51 4c 49 54 45 5f 46 4c case SQLITE_FL
df10: 4f 41 54 3a 20 7b 0a 20 20 20 20 20 20 20 20 20 OAT: {.
df20: 20 20 20 20 20 20 40 20 3c 74 64 20 61 6c 69 67 @ <td alig
df30: 6e 3d 22 72 69 67 68 74 22 20 76 61 6c 69 67 6e n="right" valign
df40: 3d 22 74 6f 70 22 3e 0a 20 20 20 20 20 20 20 20 ="top">.
df50: 20 20 20 20 20 20 20 40 20 25 73 28 73 71 6c 69 @ %s(sqli
df60: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 te3_column_text(
df70: 70 53 74 6d 74 2c 20 69 29 29 3c 2f 74 64 3e 0a pStmt, i))</td>.
df80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 b
df90: 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 reak;.
dfa0: 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }.
dfb0: 63 61 73 65 20 53 51 4c 49 54 45 5f 4e 55 4c 4c case SQLITE_NULL
dfc0: 3a 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 : {.
dfd0: 20 20 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d @ <td valign=
dfe0: 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 63 65 6e "top" align="cen
dff0: 74 65 72 22 3e 3c 69 3e 4e 55 4c 4c 3c 2f 69 3e ter"><i>NULL</i>
e000: 3c 2f 74 64 3e 0a 20 20 20 20 20 20 20 20 20 20 </td>.
e010: 20 20 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 break;.
e020: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 }.
e030: 20 20 20 20 20 20 63 61 73 65 20 53 51 4c 49 54 case SQLIT
e040: 45 5f 54 45 58 54 3a 20 7b 0a 20 20 20 20 20 20 E_TEXT: {.
e050: 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 const c
e060: 68 61 72 20 2a 7a 54 65 78 74 20 3d 20 28 63 6f har *zText = (co
e070: 6e 73 74 20 63 68 61 72 2a 29 73 71 6c 69 74 65 nst char*)sqlite
e080: 33 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 70 53 3_column_text(pS
e090: 74 6d 74 2c 20 69 29 3b 0a 20 20 20 20 20 20 20 tmt, i);.
e0a0: 20 20 20 20 20 20 20 20 40 20 3c 74 64 20 61 6c @ <td al
e0b0: 69 67 6e 3d 22 6c 65 66 74 22 20 76 61 6c 69 67 ign="left" valig
e0c0: 6e 3d 22 74 6f 70 22 0a 20 20 20 20 20 20 20 20 n="top".
e0d0: 20 20 20 20 20 20 20 40 20 73 74 79 6c 65 3d 22 @ style="
e0e0: 77 68 69 74 65 2d 73 70 61 63 65 3a 70 72 65 3b white-space:pre;
e0f0: 22 3e 25 68 28 7a 54 65 78 74 29 3c 2f 74 64 3e ">%h(zText)</td>
e100: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e110: 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 break;.
e120: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 }.
e130: 20 63 61 73 65 20 53 51 4c 49 54 45 5f 42 4c 4f case SQLITE_BLO
e140: 42 3a 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 B: {.
e150: 20 20 20 20 40 20 3c 74 64 20 76 61 6c 69 67 6e @ <td valign
e160: 3d 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 63 65 ="top" align="ce
e170: 6e 74 65 72 22 3e 0a 20 20 20 20 20 20 20 20 20 nter">.
e180: 20 20 20 20 20 20 40 20 3c 69 3e 25 64 28 73 71 @ <i>%d(sq
e190: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 62 79 74 lite3_column_byt
e1a0: 65 73 28 70 53 74 6d 74 2c 20 69 29 29 2d 62 79 es(pStmt, i))-by
e1b0: 74 65 20 42 4c 4f 42 3c 2f 69 3e 3c 2f 74 64 3e te BLOB</i></td>
e1c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e1d0: 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 break;.
e1e0: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 7d }. }
e1f0: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 . }.
e200: 20 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 20 @ </tr>.
e210: 20 7d 0a 20 20 20 20 20 20 73 71 6c 69 74 65 33 }. sqlite3
e220: 5f 66 69 6e 61 6c 69 7a 65 28 70 53 74 6d 74 29 _finalize(pStmt)
e230: 3b 0a 20 20 20 20 20 20 40 20 3c 2f 74 61 62 6c ;. @ </tabl
e240: 65 3e 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 73 e>. }. }. s
e250: 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d tyle_footer();.}
e260: 0a 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 .../*.** WEBPAGE
e270: 3a 20 61 64 6d 69 6e 5f 74 68 31 0a 2a 2a 0a 2a : admin_th1.**.*
e280: 2a 20 52 75 6e 20 72 61 77 20 54 48 31 20 63 6f * Run raw TH1 co
e290: 6d 6d 61 6e 64 73 20 75 73 69 6e 67 20 74 68 65 mmands using the
e2a0: 20 77 65 62 20 69 6e 74 65 72 66 61 63 65 2e 20 web interface.
e2b0: 20 49 66 20 54 63 6c 20 69 6e 74 65 67 72 61 74 If Tcl integrat
e2c0: 69 6f 6e 20 77 61 73 0a 2a 2a 20 65 6e 61 62 6c ion was.** enabl
e2d0: 65 64 20 61 74 20 63 6f 6d 70 69 6c 65 2d 74 69 ed at compile-ti
e2e0: 6d 65 20 61 6e 64 20 74 68 65 20 22 74 63 6c 22 me and the "tcl"
e2f0: 20 73 65 74 74 69 6e 67 20 69 73 20 65 6e 61 62 setting is enab
e300: 6c 65 64 2c 20 54 63 6c 20 63 6f 6d 6d 61 6e 64 led, Tcl command
e310: 73 0a 2a 2a 20 6d 61 79 20 62 65 20 72 75 6e 20 s.** may be run
e320: 61 73 20 77 65 6c 6c 2e 20 20 52 65 71 75 69 72 as well. Requir
e330: 65 73 20 41 64 6d 69 6e 20 70 72 69 76 69 6c 65 es Admin privile
e340: 67 65 2e 0a 2a 2f 0a 76 6f 69 64 20 74 68 31 5f ge..*/.void th1_
e350: 70 61 67 65 28 76 6f 69 64 29 7b 0a 20 20 63 6f page(void){. co
e360: 6e 73 74 20 63 68 61 72 20 2a 7a 51 20 3d 20 50 nst char *zQ = P
e370: 28 22 71 22 29 3b 0a 20 20 69 6e 74 20 67 6f 20 ("q");. int go
e380: 3d 20 50 28 22 67 6f 22 29 21 3d 30 3b 0a 20 20 = P("go")!=0;.
e390: 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 login_check_cred
e3a0: 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 entials();. if(
e3b0: 20 21 67 2e 70 65 72 6d 2e 53 65 74 75 70 20 29 !g.perm.Setup )
e3c0: 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 {. login_need
e3d0: 65 64 28 30 29 3b 0a 20 20 20 20 72 65 74 75 72 ed(0);. retur
e3e0: 6e 3b 0a 20 20 7d 0a 20 20 73 74 79 6c 65 5f 68 n;. }. style_h
e3f0: 65 61 64 65 72 28 22 52 61 77 20 54 48 31 20 43 eader("Raw TH1 C
e400: 6f 6d 6d 61 6e 64 73 22 29 3b 0a 20 20 40 20 3c ommands");. @ <
e410: 70 3e 3c 62 3e 43 61 75 74 69 6f 6e 3a 3c 2f 62 p><b>Caution:</b
e420: 3e 20 54 68 65 72 65 20 61 72 65 20 6e 6f 20 72 > There are no r
e430: 65 73 74 72 69 63 74 69 6f 6e 73 20 6f 6e 20 74 estrictions on t
e440: 68 65 20 54 48 31 20 74 68 61 74 20 63 61 6e 20 he TH1 that can
e450: 62 65 0a 20 20 40 20 72 75 6e 20 62 79 20 74 68 be. @ run by th
e460: 69 73 20 70 61 67 65 2e 20 20 49 66 20 54 63 6c is page. If Tcl
e470: 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 77 61 73 integration was
e480: 20 65 6e 61 62 6c 65 64 20 61 74 20 63 6f 6d 70 enabled at comp
e490: 69 6c 65 2d 74 69 6d 65 20 61 6e 64 0a 20 20 40 ile-time and. @
e4a0: 20 74 68 65 20 22 74 63 6c 22 20 73 65 74 74 69 the "tcl" setti
e4b0: 6e 67 20 69 73 20 65 6e 61 62 6c 65 64 2c 20 54 ng is enabled, T
e4c0: 63 6c 20 63 6f 6d 6d 61 6e 64 73 20 6d 61 79 20 cl commands may
e4d0: 62 65 20 72 75 6e 20 61 73 20 77 65 6c 6c 2e 3c be run as well.<
e4e0: 2f 70 3e 0a 20 20 40 0a 20 20 40 20 3c 66 6f 72 /p>. @. @ <for
e4f0: 6d 20 6d 65 74 68 6f 64 3d 22 70 6f 73 74 22 20 m method="post"
e500: 61 63 74 69 6f 6e 3d 22 25 52 2f 61 64 6d 69 6e action="%R/admin
e510: 5f 74 68 31 22 3e 0a 20 20 6c 6f 67 69 6e 5f 69 _th1">. login_i
e520: 6e 73 65 72 74 5f 63 73 72 66 5f 73 65 63 72 65 nsert_csrf_secre
e530: 74 28 29 3b 0a 20 20 40 20 54 48 31 3a 3c 62 72 t();. @ TH1:<br
e540: 20 2f 3e 0a 20 20 40 20 3c 74 65 78 74 61 72 65 />. @ <textare
e550: 61 20 6e 61 6d 65 3d 22 71 22 20 72 6f 77 73 3d a name="q" rows=
e560: 22 35 22 20 63 6f 6c 73 3d 22 38 30 22 3e 25 68 "5" cols="80">%h
e570: 28 7a 51 29 3c 2f 74 65 78 74 61 72 65 61 3e 3c (zQ)</textarea><
e580: 62 72 20 2f 3e 0a 20 20 40 20 3c 69 6e 70 75 74 br />. @ <input
e590: 20 74 79 70 65 3d 22 73 75 62 6d 69 74 22 20 6e type="submit" n
e5a0: 61 6d 65 3d 22 67 6f 22 20 76 61 6c 75 65 3d 22 ame="go" value="
e5b0: 52 75 6e 20 54 48 31 22 3e 0a 20 20 40 20 3c 2f Run TH1">. @ </
e5c0: 66 6f 72 6d 3e 0a 20 20 69 66 28 20 67 6f 20 29 form>. if( go )
e5d0: 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 {. const char
e5e0: 20 2a 7a 52 3b 0a 20 20 20 20 69 6e 74 20 72 63 *zR;. int rc
e5f0: 3b 0a 20 20 20 20 69 6e 74 20 6e 3b 0a 20 20 20 ;. int n;.
e600: 20 40 20 3c 68 72 20 2f 3e 0a 20 20 20 20 6c 6f @ <hr />. lo
e610: 67 69 6e 5f 76 65 72 69 66 79 5f 63 73 72 66 5f gin_verify_csrf_
e620: 73 65 63 72 65 74 28 29 3b 0a 20 20 20 20 72 63 secret();. rc
e630: 20 3d 20 54 68 5f 45 76 61 6c 28 67 2e 69 6e 74 = Th_Eval(g.int
e640: 65 72 70 2c 20 30 2c 20 7a 51 2c 20 2d 31 29 3b erp, 0, zQ, -1);
e650: 0a 20 20 20 20 7a 52 20 3d 20 54 68 5f 47 65 74 . zR = Th_Get
e660: 52 65 73 75 6c 74 28 67 2e 69 6e 74 65 72 70 2c Result(g.interp,
e670: 20 26 6e 29 3b 0a 20 20 20 20 69 66 28 20 72 63 &n);. if( rc
e680: 3d 3d 54 48 5f 4f 4b 20 29 7b 0a 20 20 20 20 20 ==TH_OK ){.
e690: 20 40 20 3c 70 72 65 20 63 6c 61 73 73 3d 22 74 @ <pre class="t
e6a0: 68 31 72 65 73 75 6c 74 22 3e 25 68 28 7a 52 29 h1result">%h(zR)
e6b0: 3c 2f 70 72 65 3e 0a 20 20 20 20 7d 65 6c 73 65 </pre>. }else
e6c0: 7b 0a 20 20 20 20 20 20 40 20 3c 70 72 65 20 63 {. @ <pre c
e6d0: 6c 61 73 73 3d 22 74 68 31 65 72 72 6f 72 22 3e lass="th1error">
e6e0: 25 68 28 7a 52 29 3c 2f 70 72 65 3e 0a 20 20 20 %h(zR)</pre>.
e6f0: 20 7d 0a 20 20 7d 0a 20 20 73 74 79 6c 65 5f 66 }. }. style_f
e700: 6f 6f 74 65 72 28 29 3b 0a 7d 0a 0a 2f 2a 0a 2a ooter();.}../*.*
e710: 2a 20 57 45 42 50 41 47 45 3a 20 61 64 6d 69 6e * WEBPAGE: admin
e720: 5f 6c 6f 67 0a 2a 2a 0a 2a 2a 20 53 68 6f 77 73 _log.**.** Shows
e730: 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 the contents of
e740: 20 74 68 65 20 61 64 6d 69 6e 5f 6c 6f 67 20 74 the admin_log t
e750: 61 62 6c 65 2c 20 77 68 69 63 68 20 69 73 20 6f able, which is o
e760: 6e 6c 79 20 63 72 65 61 74 65 64 20 69 66 0a 2a nly created if.*
e770: 2a 20 74 68 65 20 61 64 6d 69 6e 2d 6c 6f 67 20 * the admin-log
e780: 73 65 74 74 69 6e 67 20 69 73 20 65 6e 61 62 6c setting is enabl
e790: 65 64 2e 20 52 65 71 75 69 72 65 73 20 41 64 6d ed. Requires Adm
e7a0: 69 6e 20 6f 72 20 53 65 74 75 70 20 28 27 61 27 in or Setup ('a'
e7b0: 20 6f 72 0a 2a 2a 20 27 73 27 29 20 70 65 72 6d or.** 's') perm
e7c0: 69 73 73 69 6f 6e 73 2e 0a 2a 2f 0a 76 6f 69 64 issions..*/.void
e7d0: 20 70 61 67 65 5f 61 64 6d 69 6e 5f 6c 6f 67 28 page_admin_log(
e7e0: 29 7b 0a 20 20 53 74 6d 74 20 73 74 4c 6f 67 3b ){. Stmt stLog;
e7f0: 0a 20 20 69 6e 74 20 6c 69 6d 69 74 3b 20 20 20 . int limit;
e800: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a /*
e810: 20 48 6f 77 20 6d 61 6e 79 20 65 6e 74 72 69 65 How many entrie
e820: 73 20 74 6f 20 73 68 6f 77 20 2a 2f 0a 20 20 69 s to show */. i
e830: 6e 74 20 6f 66 73 74 3b 20 20 20 20 20 20 20 20 nt ofst;
e840: 20 20 20 20 20 20 20 20 20 20 2f 2a 20 4f 66 66 /* Off
e850: 73 65 74 20 74 6f 20 74 68 65 20 66 69 72 73 74 set to the first
e860: 20 65 6e 74 72 79 20 2a 2f 0a 20 20 69 6e 74 20 entry */. int
e870: 66 4c 6f 67 45 6e 61 62 6c 65 64 3b 0a 20 20 69 fLogEnabled;. i
e880: 6e 74 20 63 6f 75 6e 74 65 72 20 3d 20 30 3b 0a nt counter = 0;.
e890: 20 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72 login_check_cr
e8a0: 65 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69 edentials();. i
e8b0: 66 28 20 21 67 2e 70 65 72 6d 2e 41 64 6d 69 6e f( !g.perm.Admin
e8c0: 20 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 ){. login_ne
e8d0: 65 64 65 64 28 30 29 3b 0a 20 20 20 20 72 65 74 eded(0);. ret
e8e0: 75 72 6e 3b 0a 20 20 7d 0a 20 20 73 74 79 6c 65 urn;. }. style
e8f0: 5f 68 65 61 64 65 72 28 22 41 64 6d 69 6e 20 4c _header("Admin L
e900: 6f 67 22 29 3b 0a 20 20 63 72 65 61 74 65 5f 61 og");. create_a
e910: 64 6d 69 6e 5f 6c 6f 67 5f 74 61 62 6c 65 28 29 dmin_log_table()
e920: 3b 0a 20 20 6c 69 6d 69 74 20 3d 20 61 74 6f 69 ;. limit = atoi
e930: 28 50 44 28 22 6e 22 2c 22 32 30 30 22 29 29 3b (PD("n","200"));
e940: 0a 20 20 6f 66 73 74 20 3d 20 61 74 6f 69 28 50 . ofst = atoi(P
e950: 44 28 22 78 22 2c 22 30 22 29 29 3b 0a 20 20 66 D("x","0"));. f
e960: 4c 6f 67 45 6e 61 62 6c 65 64 20 3d 20 64 62 5f LogEnabled = db_
e970: 67 65 74 5f 62 6f 6f 6c 65 61 6e 28 22 61 64 6d get_boolean("adm
e980: 69 6e 2d 6c 6f 67 22 2c 20 30 29 3b 0a 20 20 40 in-log", 0);. @
e990: 20 3c 64 69 76 3e 41 64 6d 69 6e 20 6c 6f 67 67 <div>Admin logg
e9a0: 69 6e 67 20 69 73 20 25 73 28 66 4c 6f 67 45 6e ing is %s(fLogEn
e9b0: 61 62 6c 65 64 3f 22 6f 6e 22 3a 22 6f 66 66 22 abled?"on":"off"
e9c0: 29 2e 0a 20 20 40 20 28 43 68 61 6e 67 65 20 74 ).. @ (Change t
e9d0: 68 69 73 20 6f 6e 20 74 68 65 20 3c 61 20 68 72 his on the <a hr
e9e0: 65 66 3d 22 73 65 74 75 70 5f 73 65 74 74 69 6e ef="setup_settin
e9f0: 67 73 22 3e 73 65 74 74 69 6e 67 73 3c 2f 61 3e gs">settings</a>
ea00: 20 70 61 67 65 2e 29 3c 2f 64 69 76 3e 0a 0a 20 page.)</div>..
ea10: 20 69 66 28 20 6f 66 73 74 3e 30 20 29 7b 0a 20 if( ofst>0 ){.
ea20: 20 20 20 69 6e 74 20 70 72 65 76 78 20 3d 20 6f int prevx = o
ea30: 66 73 74 20 2d 20 6c 69 6d 69 74 3b 0a 20 20 20 fst - limit;.
ea40: 20 69 66 28 20 70 72 65 76 78 3c 30 20 29 20 70 if( prevx<0 ) p
ea50: 72 65 76 78 20 3d 20 30 3b 0a 20 20 20 20 40 20 revx = 0;. @
ea60: 3c 70 3e 3c 61 20 68 72 65 66 3d 22 61 64 6d 69 <p><a href="admi
ea70: 6e 5f 6c 6f 67 3f 6e 3d 25 64 28 6c 69 6d 69 74 n_log?n=%d(limit
ea80: 29 26 78 3d 25 64 28 70 72 65 76 78 29 22 3e 5b )&x=%d(prevx)">[
ea90: 4e 65 77 65 72 5d 3c 2f 61 3e 3c 2f 70 3e 0a 20 Newer]</a></p>.
eaa0: 20 7d 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 }. db_prepare(
eab0: 26 73 74 4c 6f 67 2c 0a 20 20 20 20 22 53 45 4c &stLog,. "SEL
eac0: 45 43 54 20 64 61 74 65 74 69 6d 65 28 74 69 6d ECT datetime(tim
ead0: 65 2c 27 75 6e 69 78 65 70 6f 63 68 27 29 2c 20 e,'unixepoch'),
eae0: 77 68 6f 2c 20 70 61 67 65 2c 20 77 68 61 74 20 who, page, what
eaf0: 22 0a 20 20 20 20 22 46 52 4f 4d 20 61 64 6d 69 ". "FROM admi
eb00: 6e 5f 6c 6f 67 20 22 0a 20 20 20 20 22 4f 52 44 n_log ". "ORD
eb10: 45 52 20 42 59 20 74 69 6d 65 20 44 45 53 43 22 ER BY time DESC"
eb20: 29 3b 0a 20 20 73 74 79 6c 65 5f 74 61 62 6c 65 );. style_table
eb30: 5f 73 6f 72 74 65 72 28 29 3b 0a 20 20 40 20 3c _sorter();. @ <
eb40: 74 61 62 6c 65 20 63 6c 61 73 73 3d 22 73 6f 72 table class="sor
eb50: 74 61 62 6c 65 20 61 64 6d 69 6e 4c 6f 67 54 61 table adminLogTa
eb60: 62 6c 65 22 20 77 69 64 74 68 3d 22 31 30 30 25 ble" width="100%
eb70: 25 22 20 5c 0a 20 20 40 20 20 64 61 74 61 2d 63 %" \. @ data-c
eb80: 6f 6c 75 6d 6e 2d 74 79 70 65 73 3d 27 54 74 74 olumn-types='Ttt
eb90: 78 27 20 64 61 74 61 2d 69 6e 69 74 2d 73 6f 72 x' data-init-sor
eba0: 74 3d 27 31 27 3e 0a 20 20 40 20 3c 74 68 65 61 t='1'>. @ <thea
ebb0: 64 3e 0a 20 20 40 20 3c 74 68 3e 54 69 6d 65 3c d>. @ <th>Time<
ebc0: 2f 74 68 3e 0a 20 20 40 20 3c 74 68 3e 55 73 65 /th>. @ <th>Use
ebd0: 72 3c 2f 74 68 3e 0a 20 20 40 20 3c 74 68 3e 50 r</th>. @ <th>P
ebe0: 61 67 65 3c 2f 74 68 3e 0a 20 20 40 20 3c 74 68 age</th>. @ <th
ebf0: 20 77 69 64 74 68 3d 22 36 30 25 25 22 3e 4d 65 width="60%%">Me
ec00: 73 73 61 67 65 3c 2f 74 68 3e 0a 20 20 40 20 3c ssage</th>. @ <
ec10: 2f 74 68 65 61 64 3e 3c 74 62 6f 64 79 3e 0a 20 /thead><tbody>.
ec20: 20 77 68 69 6c 65 28 20 53 51 4c 49 54 45 5f 52 while( SQLITE_R
ec30: 4f 57 20 3d 3d 20 64 62 5f 73 74 65 70 28 26 73 OW == db_step(&s
ec40: 74 4c 6f 67 29 20 29 7b 0a 20 20 20 20 63 6f 6e tLog) ){. con
ec50: 73 74 20 63 68 61 72 20 2a 7a 54 69 6d 65 20 3d st char *zTime =
ec60: 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 db_column_text(
ec70: 26 73 74 4c 6f 67 2c 20 30 29 3b 0a 20 20 20 20 &stLog, 0);.
ec80: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 55 73 65 const char *zUse
ec90: 72 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 r = db_column_te
eca0: 78 74 28 26 73 74 4c 6f 67 2c 20 31 29 3b 0a 20 xt(&stLog, 1);.
ecb0: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a const char *z
ecc0: 50 61 67 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e Page = db_column
ecd0: 5f 74 65 78 74 28 26 73 74 4c 6f 67 2c 20 32 29 _text(&stLog, 2)
ece0: 3b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 ;. const char
ecf0: 20 2a 7a 4d 65 73 73 61 67 65 20 3d 20 64 62 5f *zMessage = db_
ed00: 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 73 74 4c column_text(&stL
ed10: 6f 67 2c 20 33 29 3b 0a 20 20 20 20 63 6f 75 6e og, 3);. coun
ed20: 74 65 72 2b 2b 3b 0a 20 20 20 20 69 66 28 20 63 ter++;. if( c
ed30: 6f 75 6e 74 65 72 3c 6f 66 73 74 20 29 20 63 6f ounter<ofst ) co
ed40: 6e 74 69 6e 75 65 3b 0a 20 20 20 20 69 66 28 20 ntinue;. if(
ed50: 63 6f 75 6e 74 65 72 3e 6f 66 73 74 2b 6c 69 6d counter>ofst+lim
ed60: 69 74 20 29 20 62 72 65 61 6b 3b 0a 20 20 20 20 it ) break;.
ed70: 40 20 3c 74 72 20 63 6c 61 73 73 3d 22 72 6f 77 @ <tr class="row
ed80: 25 64 28 63 6f 75 6e 74 65 72 25 32 29 22 3e 0a %d(counter%2)">.
ed90: 20 20 20 20 40 20 3c 74 64 20 63 6c 61 73 73 3d @ <td class=
eda0: 22 61 64 6d 69 6e 54 69 6d 65 22 3e 25 73 28 7a "adminTime">%s(z
edb0: 54 69 6d 65 29 3c 2f 74 64 3e 0a 20 20 20 20 40 Time)</td>. @
edc0: 20 3c 74 64 3e 25 73 28 7a 55 73 65 72 29 3c 2f <td>%s(zUser)</
edd0: 74 64 3e 0a 20 20 20 20 40 20 3c 74 64 3e 25 73 td>. @ <td>%s
ede0: 28 7a 50 61 67 65 29 3c 2f 74 64 3e 0a 20 20 20 (zPage)</td>.
edf0: 20 40 20 3c 74 64 3e 25 68 28 7a 4d 65 73 73 61 @ <td>%h(zMessa
ee00: 67 65 29 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c ge)</td>. @ <
ee10: 2f 74 72 3e 0a 20 20 7d 0a 20 20 64 62 5f 66 69 /tr>. }. db_fi
ee20: 6e 61 6c 69 7a 65 28 26 73 74 4c 6f 67 29 3b 0a nalize(&stLog);.
ee30: 20 20 40 20 3c 2f 74 62 6f 64 79 3e 3c 2f 74 61 @ </tbody></ta
ee40: 62 6c 65 3e 0a 20 20 69 66 28 20 63 6f 75 6e 74 ble>. if( count
ee50: 65 72 3e 6f 66 73 74 2b 6c 69 6d 69 74 20 29 7b er>ofst+limit ){
ee60: 0a 20 20 20 20 40 20 3c 70 3e 3c 61 20 68 72 65 . @ <p><a hre
ee70: 66 3d 22 61 64 6d 69 6e 5f 6c 6f 67 3f 6e 3d 25 f="admin_log?n=%
ee80: 64 28 6c 69 6d 69 74 29 26 78 3d 25 64 28 6c 69 d(limit)&x=%d(li
ee90: 6d 69 74 2b 6f 66 73 74 29 22 3e 5b 4f 6c 64 65 mit+ofst)">[Olde
eea0: 72 5d 3c 2f 61 3e 3c 2f 70 3e 0a 20 20 7d 0a 20 r]</a></p>. }.
eeb0: 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b style_footer();
eec0: 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 .}../*.** WEBPAG
eed0: 45 3a 20 73 72 63 68 73 65 74 75 70 0a 2a 2a 0a E: srchsetup.**.
eee0: 2a 2a 20 43 6f 6e 66 69 67 75 72 65 20 74 68 65 ** Configure the
eef0: 20 73 65 61 72 63 68 20 65 6e 67 69 6e 65 2e 20 search engine.
ef00: 20 52 65 71 75 69 72 65 73 20 41 64 6d 69 6e 20 Requires Admin
ef10: 70 72 69 76 69 6c 65 67 65 2e 0a 2a 2f 0a 76 6f privilege..*/.vo
ef20: 69 64 20 70 61 67 65 5f 73 72 63 68 73 65 74 75 id page_srchsetu
ef30: 70 28 29 7b 0a 20 20 6c 6f 67 69 6e 5f 63 68 65 p(){. login_che
ef40: 63 6b 5f 63 72 65 64 65 6e 74 69 61 6c 73 28 29 ck_credentials()
ef50: 3b 0a 20 20 69 66 28 20 21 67 2e 70 65 72 6d 2e ;. if( !g.perm.
ef60: 41 64 6d 69 6e 20 29 7b 0a 20 20 20 20 6c 6f 67 Admin ){. log
ef70: 69 6e 5f 6e 65 65 64 65 64 28 30 29 3b 0a 20 20 in_needed(0);.
ef80: 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d 0a 20 20 return;. }.
ef90: 73 74 79 6c 65 5f 68 65 61 64 65 72 28 22 53 65 style_header("Se
efa0: 61 72 63 68 20 43 6f 6e 66 69 67 75 72 61 74 69 arch Configurati
efb0: 6f 6e 22 29 3b 0a 20 20 40 20 3c 66 6f 72 6d 20 on");. @ <form
efc0: 61 63 74 69 6f 6e 3d 22 25 52 2f 73 72 63 68 73 action="%R/srchs
efd0: 65 74 75 70 22 20 6d 65 74 68 6f 64 3d 22 70 6f etup" method="po
efe0: 73 74 22 3e 3c 64 69 76 3e 0a 20 20 6c 6f 67 69 st"><div>. logi
eff0: 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 65 n_insert_csrf_se
f000: 63 72 65 74 28 29 3b 0a 20 20 40 20 3c 64 69 76 cret();. @ <div
f010: 20 73 74 79 6c 65 3d 22 74 65 78 74 2d 61 6c 69 style="text-ali
f020: 67 6e 3a 63 65 6e 74 65 72 3b 66 6f 6e 74 2d 77 gn:center;font-w
f030: 65 69 67 68 74 3a 62 6f 6c 64 3b 22 3e 0a 20 20 eight:bold;">.
f040: 40 20 53 65 72 76 65 72 2d 73 70 65 63 69 66 69 @ Server-specifi
f050: 63 20 73 65 74 74 69 6e 67 73 20 74 68 61 74 20 c settings that
f060: 61 66 66 65 63 74 20 74 68 65 0a 20 20 40 20 3c affect the. @ <
f070: 61 20 68 72 65 66 3d 22 25 52 2f 73 65 61 72 63 a href="%R/searc
f080: 68 22 3e 2f 73 65 61 72 63 68 3c 2f 61 3e 20 77 h">/search</a> w
f090: 65 62 70 61 67 65 2e 0a 20 20 40 20 3c 2f 64 69 ebpage.. @ </di
f0a0: 76 3e 0a 20 20 40 20 3c 68 72 20 2f 3e 0a 20 20 v>. @ <hr />.
f0b0: 74 65 78 74 61 72 65 61 5f 61 74 74 72 69 62 75 textarea_attribu
f0c0: 74 65 28 22 44 6f 63 75 6d 65 6e 74 20 47 6c 6f te("Document Glo
f0d0: 62 20 4c 69 73 74 22 2c 20 33 2c 20 33 35 2c 20 b List", 3, 35,
f0e0: 22 64 6f 63 2d 67 6c 6f 62 22 2c 20 22 64 67 22 "doc-glob", "dg"
f0f0: 2c 20 22 22 2c 20 30 29 3b 0a 20 20 40 20 3c 70 , "", 0);. @ <p
f100: 3e 54 68 65 20 22 44 6f 63 75 6d 65 6e 74 20 47 >The "Document G
f110: 6c 6f 62 20 4c 69 73 74 22 20 69 73 20 61 20 63 lob List" is a c
f120: 6f 6d 6d 61 2d 20 6f 72 20 6e 65 77 6c 69 6e 65 omma- or newline
f130: 2d 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 0a -separated list.
f140: 20 20 40 20 6f 66 20 47 4c 4f 42 20 65 78 70 72 @ of GLOB expr
f150: 65 73 73 69 6f 6e 73 20 74 68 61 74 20 69 64 65 essions that ide
f160: 6e 74 69 66 79 20 61 6c 6c 20 64 6f 63 75 6d 65 ntify all docume
f170: 6e 74 73 20 77 69 74 68 69 6e 20 74 68 65 20 73 nts within the s
f180: 6f 75 72 63 65 0a 20 20 40 20 74 72 65 65 20 74 ource. @ tree t
f190: 68 61 74 20 61 72 65 20 74 6f 20 62 65 20 73 65 hat are to be se
f1a0: 61 72 63 68 65 64 20 77 68 65 6e 20 22 44 6f 63 arched when "Doc
f1b0: 75 6d 65 6e 74 20 53 65 61 72 63 68 22 20 69 73 ument Search" is
f1c0: 20 65 6e 61 62 6c 65 64 2e 0a 20 20 40 20 53 6f enabled.. @ So
f1d0: 6d 65 20 65 78 61 6d 70 6c 65 73 3a 0a 20 20 40 me examples:. @
f1e0: 20 3c 74 61 62 6c 65 20 62 6f 72 64 65 72 3d 30 <table border=0
f1f0: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 32 20 61 cellpadding=2 a
f200: 6c 69 67 6e 3d 63 65 6e 74 65 72 3e 0a 20 20 40 lign=center>. @
f210: 20 3c 74 72 3e 3c 74 64 3e 2a 2e 77 69 6b 69 2c <tr><td>*.wiki,
f220: 2a 2e 68 74 6d 6c 2c 2a 2e 6d 64 2c 2a 2e 74 78 *.html,*.md,*.tx
f230: 74 3c 74 64 20 73 74 79 6c 65 3d 22 77 69 64 74 t<td style="widt
f240: 68 3a 20 34 78 3b 22 3e 0a 20 20 40 20 3c 74 64 h: 4x;">. @ <td
f250: 3e 53 65 61 72 63 68 20 61 6c 6c 20 77 69 6b 69 >Search all wiki
f260: 2c 20 48 54 4d 4c 2c 20 4d 61 72 6b 64 6f 77 6e , HTML, Markdown
f270: 2c 20 61 6e 64 20 54 65 78 74 20 66 69 6c 65 73 , and Text files
f280: 3c 2f 74 72 3e 0a 20 20 40 20 3c 74 72 3e 3c 74 </tr>. @ <tr><t
f290: 64 3e 64 6f 63 2f 2a 2e 6d 64 2c 2a 2f 52 45 41 d>doc/*.md,*/REA
f2a0: 44 4d 45 2e 74 78 74 2c 52 45 41 44 4d 45 2e 74 DME.txt,README.t
f2b0: 78 74 3c 74 64 3e 0a 20 20 40 20 3c 74 64 3e 53 xt<td>. @ <td>S
f2c0: 65 61 72 63 68 20 61 6c 6c 20 4d 61 72 6b 64 6f earch all Markdo
f2d0: 77 6e 20 66 69 6c 65 73 20 69 6e 20 74 68 65 20 wn files in the
f2e0: 64 6f 63 2f 20 73 75 62 66 6f 6c 64 65 72 20 61 doc/ subfolder a
f2f0: 6e 64 20 61 6c 6c 20 52 45 41 44 4d 45 2e 74 78 nd all README.tx
f300: 74 0a 20 20 40 20 66 69 6c 65 73 2e 3c 2f 74 72 t. @ files.</tr
f310: 3e 0a 20 20 40 20 3c 74 72 3e 3c 74 64 3e 2a 3c >. @ <tr><td>*<
f320: 74 64 3e 3c 74 64 3e 53 65 61 72 63 68 20 61 6c td><td>Search al
f330: 6c 20 63 68 65 63 6b 65 64 2d 69 6e 20 66 69 6c l checked-in fil
f340: 65 73 3c 2f 74 72 3e 0a 20 20 40 20 3c 74 72 3e es</tr>. @ <tr>
f350: 3c 74 64 3e 3c 69 3e 28 62 6c 61 6e 6b 29 3c 2f <td><i>(blank)</
f360: 69 3e 3c 74 64 3e 0a 20 20 40 20 3c 74 64 3e 53 i><td>. @ <td>S
f370: 65 61 72 63 68 20 6e 6f 74 68 69 6e 67 2e 20 28 earch nothing. (
f380: 44 69 73 61 62 6c 65 73 20 64 6f 63 75 6d 65 6e Disables documen
f390: 74 20 73 65 61 72 63 68 29 2e 3c 2f 74 72 3e 0a t search).</tr>.
f3a0: 20 20 40 20 3c 2f 74 61 62 6c 65 3e 0a 20 20 40 @ </table>. @
f3b0: 20 3c 68 72 20 2f 3e 0a 20 20 65 6e 74 72 79 5f <hr />. entry_
f3c0: 61 74 74 72 69 62 75 74 65 28 22 44 6f 63 75 6d attribute("Docum
f3d0: 65 6e 74 20 42 72 61 6e 63 68 22 2c 20 32 30 2c ent Branch", 20,
f3e0: 20 22 64 6f 63 2d 62 72 61 6e 63 68 22 2c 20 22 "doc-branch", "
f3f0: 64 62 22 2c 20 22 74 72 75 6e 6b 22 2c 20 30 29 db", "trunk", 0)
f400: 3b 0a 20 20 40 20 3c 70 3e 57 68 65 6e 20 73 65 ;. @ <p>When se
f410: 61 72 63 68 69 6e 67 20 64 6f 63 75 6d 65 6e 74 arching document
f420: 73 2c 20 75 73 65 20 74 68 65 20 76 65 72 73 69 s, use the versi
f430: 6f 6e 73 20 6f 66 20 74 68 65 20 66 69 6c 65 73 ons of the files
f440: 20 66 6f 75 6e 64 20 61 74 20 74 68 65 0a 20 20 found at the.
f450: 40 20 74 79 70 65 20 6f 66 20 74 68 65 20 22 44 @ type of the "D
f460: 6f 63 75 6d 65 6e 74 20 42 72 61 6e 63 68 22 20 ocument Branch"
f470: 62 72 61 6e 63 68 2e 20 20 52 65 63 6f 6d 6d 65 branch. Recomme
f480: 6e 64 65 64 20 76 61 6c 75 65 3a 20 22 74 72 75 nded value: "tru
f490: 6e 6b 22 2e 0a 20 20 40 20 44 6f 63 75 6d 65 6e nk".. @ Documen
f4a0: 74 20 73 65 61 72 63 68 20 69 73 20 64 69 73 61 t search is disa
f4b0: 62 6c 65 64 20 69 66 20 62 6c 61 6e 6b 2e 0a 20 bled if blank..
f4c0: 20 40 20 3c 68 72 20 2f 3e 0a 20 20 6f 6e 6f 66 @ <hr />. onof
f4d0: 66 5f 61 74 74 72 69 62 75 74 65 28 22 53 65 61 f_attribute("Sea
f4e0: 72 63 68 20 43 68 65 63 6b 2d 69 6e 20 43 6f 6d rch Check-in Com
f4f0: 6d 65 6e 74 73 22 2c 20 22 73 65 61 72 63 68 2d ments", "search-
f500: 63 69 22 2c 20 22 73 63 22 2c 20 30 2c 20 30 29 ci", "sc", 0, 0)
f510: 3b 0a 20 20 40 20 3c 62 72 20 2f 3e 0a 20 20 6f ;. @ <br />. o
f520: 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 noff_attribute("
f530: 53 65 61 72 63 68 20 44 6f 63 75 6d 65 6e 74 73 Search Documents
f540: 22 2c 20 22 73 65 61 72 63 68 2d 64 6f 63 22 2c ", "search-doc",
f550: 20 22 73 64 22 2c 20 30 2c 20 30 29 3b 0a 20 20 "sd", 0, 0);.
f560: 40 20 3c 62 72 20 2f 3e 0a 20 20 6f 6e 6f 66 66 @ <br />. onoff
f570: 5f 61 74 74 72 69 62 75 74 65 28 22 53 65 61 72 _attribute("Sear
f580: 63 68 20 54 69 63 6b 65 74 73 22 2c 20 22 73 65 ch Tickets", "se
f590: 61 72 63 68 2d 74 6b 74 22 2c 20 22 73 74 22 2c arch-tkt", "st",
f5a0: 20 30 2c 20 30 29 3b 0a 20 20 40 20 3c 62 72 20 0, 0);. @ <br
f5b0: 2f 3e 0a 20 20 6f 6e 6f 66 66 5f 61 74 74 72 69 />. onoff_attri
f5c0: 62 75 74 65 28 22 53 65 61 72 63 68 20 57 69 6b bute("Search Wik
f5d0: 69 22 2c 20 22 73 65 61 72 63 68 2d 77 69 6b 69 i", "search-wiki
f5e0: 22 2c 20 22 73 77 22 2c 20 30 2c 20 30 29 3b 0a ", "sw", 0, 0);.
f5f0: 20 20 40 20 3c 62 72 20 2f 3e 0a 20 20 6f 6e 6f @ <br />. ono
f600: 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 53 65 ff_attribute("Se
f610: 61 72 63 68 20 54 65 63 68 20 4e 6f 74 65 73 22 arch Tech Notes"
f620: 2c 20 22 73 65 61 72 63 68 2d 74 65 63 68 6e 6f , "search-techno
f630: 74 65 22 2c 20 22 73 65 22 2c 20 30 2c 20 30 29 te", "se", 0, 0)
f640: 3b 0a 20 20 40 20 3c 62 72 20 2f 3e 0a 20 20 6f ;. @ <br />. o
f650: 6e 6f 66 66 5f 61 74 74 72 69 62 75 74 65 28 22 noff_attribute("
f660: 53 65 61 72 63 68 20 46 6f 72 75 6d 22 2c 20 22 Search Forum", "
f670: 73 65 61 72 63 68 2d 66 6f 72 75 6d 22 2c 20 22 search-forum", "
f680: 73 66 22 2c 20 30 2c 20 30 29 3b 0a 20 20 40 20 sf", 0, 0);. @
f690: 3c 68 72 20 2f 3e 0a 20 20 40 20 3c 70 3e 3c 69 <hr />. @ <p><i
f6a0: 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 nput type="submi
f6b0: 74 22 20 20 6e 61 6d 65 3d 22 73 75 62 6d 69 74 t" name="submit
f6c0: 22 20 76 61 6c 75 65 3d 22 41 70 70 6c 79 20 43 " value="Apply C
f6d0: 68 61 6e 67 65 73 22 20 2f 3e 3c 2f 70 3e 0a 20 hanges" /></p>.
f6e0: 20 40 20 3c 68 72 20 2f 3e 0a 20 20 69 66 28 20 @ <hr />. if(
f6f0: 50 28 22 66 74 73 30 22 29 20 29 7b 0a 20 20 20 P("fts0") ){.
f700: 20 73 65 61 72 63 68 5f 64 72 6f 70 5f 69 6e 64 search_drop_ind
f710: 65 78 28 29 3b 0a 20 20 7d 65 6c 73 65 20 69 66 ex();. }else if
f720: 28 20 50 28 22 66 74 73 31 22 29 20 29 7b 0a 20 ( P("fts1") ){.
f730: 20 20 20 73 65 61 72 63 68 5f 64 72 6f 70 5f 69 search_drop_i
f740: 6e 64 65 78 28 29 3b 0a 20 20 20 20 73 65 61 72 ndex();. sear
f750: 63 68 5f 63 72 65 61 74 65 5f 69 6e 64 65 78 28 ch_create_index(
f760: 29 3b 0a 20 20 20 20 73 65 61 72 63 68 5f 66 69 );. search_fi
f770: 6c 6c 5f 69 6e 64 65 78 28 29 3b 0a 20 20 20 20 ll_index();.
f780: 73 65 61 72 63 68 5f 75 70 64 61 74 65 5f 69 6e search_update_in
f790: 64 65 78 28 73 65 61 72 63 68 5f 72 65 73 74 72 dex(search_restr
f7a0: 69 63 74 28 53 52 43 48 5f 41 4c 4c 29 29 3b 0a ict(SRCH_ALL));.
f7b0: 20 20 7d 0a 20 20 69 66 28 20 73 65 61 72 63 68 }. if( search
f7c0: 5f 69 6e 64 65 78 5f 65 78 69 73 74 73 28 29 20 _index_exists()
f7d0: 29 7b 0a 20 20 20 20 40 20 3c 70 3e 43 75 72 72 ){. @ <p>Curr
f7e0: 65 6e 74 6c 79 20 75 73 69 6e 67 20 61 6e 20 53 ently using an S
f7f0: 51 4c 69 74 65 20 46 54 53 34 20 73 65 61 72 63 QLite FTS4 searc
f800: 68 20 69 6e 64 65 78 2e 20 54 68 69 73 20 6d 61 h index. This ma
f810: 6b 65 73 20 73 65 61 72 63 68 0a 20 20 20 20 40 kes search. @
f820: 20 72 75 6e 20 66 61 73 74 65 72 2c 20 65 73 70 run faster, esp
f830: 65 63 69 61 6c 6c 79 20 6f 6e 20 6c 61 72 67 65 ecially on large
f840: 20 72 65 70 6f 73 69 74 6f 72 69 65 73 2c 20 62 repositories, b
f850: 75 74 20 74 61 6b 65 73 20 75 70 20 73 70 61 63 ut takes up spac
f860: 65 2e 3c 2f 70 3e 0a 20 20 20 20 6f 6e 6f 66 66 e.</p>. onoff
f870: 5f 61 74 74 72 69 62 75 74 65 28 22 55 73 65 20 _attribute("Use
f880: 50 6f 72 74 65 72 20 53 74 65 6d 6d 65 72 22 2c Porter Stemmer",
f890: 22 73 65 61 72 63 68 2d 73 74 65 6d 6d 65 72 22 "search-stemmer"
f8a0: 2c 22 73 73 22 2c 30 2c 30 29 3b 0a 20 20 20 20 ,"ss",0,0);.
f8b0: 40 20 3c 70 3e 3c 69 6e 70 75 74 20 74 79 70 65 @ <p><input type
f8c0: 3d 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d 22 ="submit" name="
f8d0: 66 74 73 30 22 20 76 61 6c 75 65 3d 22 44 65 6c fts0" value="Del
f8e0: 65 74 65 20 54 68 65 20 46 75 6c 6c 2d 54 65 78 ete The Full-Tex
f8f0: 74 20 49 6e 64 65 78 22 3e 0a 20 20 20 20 40 20 t Index">. @
f900: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 <input type="sub
f910: 6d 69 74 22 20 6e 61 6d 65 3d 22 66 74 73 31 22 mit" name="fts1"
f920: 20 76 61 6c 75 65 3d 22 52 65 62 75 69 6c 64 20 value="Rebuild
f930: 54 68 65 20 46 75 6c 6c 2d 54 65 78 74 20 49 6e The Full-Text In
f940: 64 65 78 22 3e 0a 20 20 20 20 73 74 79 6c 65 5f dex">. style_
f950: 73 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 28 submenu_element(
f960: 22 46 54 53 20 49 6e 64 65 78 20 44 65 62 75 67 "FTS Index Debug
f970: 67 69 6e 67 22 2c 22 25 52 2f 74 65 73 74 2d 66 ging","%R/test-f
f980: 74 73 64 6f 63 73 22 29 3b 0a 20 20 7d 65 6c 73 tsdocs");. }els
f990: 65 7b 0a 20 20 20 20 40 20 3c 70 3e 54 68 65 20 e{. @ <p>The
f9a0: 53 51 4c 69 74 65 20 46 54 53 34 20 73 65 61 72 SQLite FTS4 sear
f9b0: 63 68 20 69 6e 64 65 78 20 69 73 20 64 69 73 61 ch index is disa
f9c0: 62 6c 65 64 2e 20 20 41 6c 6c 20 73 65 61 72 63 bled. All searc
f9d0: 68 69 6e 67 20 77 69 6c 6c 20 62 65 0a 20 20 20 hing will be.
f9e0: 20 40 20 61 20 66 75 6c 6c 2d 74 65 78 74 20 73 @ a full-text s
f9f0: 63 61 6e 2e 20 20 54 68 69 73 20 75 73 75 61 6c can. This usual
fa00: 6c 79 20 77 6f 72 6b 73 20 66 69 6e 65 2c 20 62 ly works fine, b
fa10: 75 74 20 63 61 6e 20 62 65 20 73 6c 6f 77 20 66 ut can be slow f
fa20: 6f 72 0a 20 20 20 20 40 20 6c 61 72 67 65 72 20 or. @ larger
fa30: 72 65 70 6f 73 69 74 6f 72 69 65 73 2e 3c 2f 70 repositories.</p
fa40: 3e 0a 20 20 20 20 6f 6e 6f 66 66 5f 61 74 74 72 >. onoff_attr
fa50: 69 62 75 74 65 28 22 55 73 65 20 50 6f 72 74 65 ibute("Use Porte
fa60: 72 20 53 74 65 6d 6d 65 72 22 2c 22 73 65 61 72 r Stemmer","sear
fa70: 63 68 2d 73 74 65 6d 6d 65 72 22 2c 22 73 73 22 ch-stemmer","ss"
fa80: 2c 30 2c 30 29 3b 0a 20 20 20 20 40 20 3c 70 3e ,0,0);. @ <p>
fa90: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 <input type="sub
faa0: 6d 69 74 22 20 6e 61 6d 65 3d 22 66 74 73 31 22 mit" name="fts1"
fab0: 20 76 61 6c 75 65 3d 22 43 72 65 61 74 65 20 41 value="Create A
fac0: 20 46 75 6c 6c 2d 54 65 78 74 20 49 6e 64 65 78 Full-Text Index
fad0: 22 3e 0a 20 20 7d 0a 20 20 40 20 3c 2f 64 69 76 ">. }. @ </div
fae0: 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 73 74 79 6c 65 ></form>. style
faf0: 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d 0a 0a 2f 2a _footer();.}../*
fb00: 0a 2a 2a 20 41 20 55 52 4c 20 41 6c 69 61 73 20 .** A URL Alias
fb10: 6f 72 69 67 69 6e 61 6c 6c 79 20 63 61 6c 6c 65 originally calle
fb20: 64 20 7a 4f 6c 64 4e 61 6d 65 20 69 73 20 6e 6f d zOldName is no
fb30: 77 20 7a 4e 65 77 4e 61 6d 65 2f 7a 56 61 6c 75 w zNewName/zValu
fb40: 65 2e 0a 2a 2a 20 57 72 69 74 65 20 53 51 4c 20 e..** Write SQL
fb50: 74 6f 20 6d 61 6b 65 20 74 68 69 73 20 63 68 61 to make this cha
fb60: 6e 67 65 20 69 6e 74 6f 20 70 53 71 6c 2e 0a 2a nge into pSql..*
fb70: 2a 0a 2a 2a 20 49 66 20 7a 4e 65 77 4e 61 6d 65 *.** If zNewName
fb80: 20 6f 72 20 7a 56 61 6c 75 65 20 69 73 20 61 6e or zValue is an
fb90: 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2c 20 74 empty string, t
fba0: 68 65 6e 20 64 65 6c 65 74 65 20 74 68 65 20 65 hen delete the e
fbb0: 6e 74 72 79 2e 0a 2a 2a 0a 2a 2a 20 49 66 20 7a ntry..**.** If z
fbc0: 4f 6c 64 4e 61 6d 65 20 69 73 20 61 6e 20 65 6d OldName is an em
fbd0: 70 74 79 20 73 74 72 69 6e 67 2c 20 63 72 65 61 pty string, crea
fbe0: 74 65 20 61 20 6e 65 77 20 65 6e 74 72 79 2e 0a te a new entry..
fbf0: 2a 2f 0a 73 74 61 74 69 63 20 76 6f 69 64 20 73 */.static void s
fc00: 65 74 75 70 5f 75 70 64 61 74 65 5f 75 72 6c 5f etup_update_url_
fc10: 61 6c 69 61 73 28 0a 20 20 42 6c 6f 62 20 2a 70 alias(. Blob *p
fc20: 53 71 6c 2c 0a 20 20 63 6f 6e 73 74 20 63 68 61 Sql,. const cha
fc30: 72 20 2a 7a 4f 6c 64 4e 61 6d 65 2c 0a 20 20 63 r *zOldName,. c
fc40: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e 65 77 4e onst char *zNewN
fc50: 61 6d 65 2c 0a 20 20 63 6f 6e 73 74 20 63 68 61 ame,. const cha
fc60: 72 20 2a 7a 56 61 6c 75 65 0a 29 7b 0a 20 20 69 r *zValue.){. i
fc70: 66 28 20 21 63 67 69 5f 63 73 72 66 5f 73 61 66 f( !cgi_csrf_saf
fc80: 65 28 31 29 20 29 20 72 65 74 75 72 6e 3b 0a 20 e(1) ) return;.
fc90: 20 69 66 28 20 7a 4e 65 77 4e 61 6d 65 5b 30 5d if( zNewName[0]
fca0: 3d 3d 30 20 7c 7c 20 7a 56 61 6c 75 65 5b 30 5d ==0 || zValue[0]
fcb0: 3d 3d 30 20 29 7b 0a 20 20 20 20 69 66 28 20 7a ==0 ){. if( z
fcc0: 4f 6c 64 4e 61 6d 65 5b 30 5d 20 29 7b 0a 20 20 OldName[0] ){.
fcd0: 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 5f blob_append_
fce0: 73 71 6c 28 70 53 71 6c 2c 0a 20 20 20 20 20 20 sql(pSql,.
fcf0: 20 20 22 44 45 4c 45 54 45 20 46 52 4f 4d 20 63 "DELETE FROM c
fd00: 6f 6e 66 69 67 20 57 48 45 52 45 20 6e 61 6d 65 onfig WHERE name
fd10: 3d 27 77 61 6c 69 61 73 3a 25 71 27 3b 5c 6e 22 ='walias:%q';\n"
fd20: 2c 0a 20 20 20 20 20 20 20 20 7a 4f 6c 64 4e 61 ,. zOldNa
fd30: 6d 65 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 72 me);. }. r
fd40: 65 74 75 72 6e 3b 0a 20 20 7d 0a 20 20 69 66 28 eturn;. }. if(
fd50: 20 7a 4f 6c 64 4e 61 6d 65 5b 30 5d 3d 3d 30 20 zOldName[0]==0
fd60: 29 7b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 ){. blob_appe
fd70: 6e 64 5f 73 71 6c 28 70 53 71 6c 2c 0a 20 20 20 nd_sql(pSql,.
fd80: 20 20 20 22 49 4e 53 45 52 54 20 49 4e 54 4f 20 "INSERT INTO
fd90: 63 6f 6e 66 69 67 28 6e 61 6d 65 2c 76 61 6c 75 config(name,valu
fda0: 65 2c 6d 74 69 6d 65 29 20 56 41 4c 55 45 53 28 e,mtime) VALUES(
fdb0: 27 77 61 6c 69 61 73 3a 25 71 27 2c 25 51 2c 6e 'walias:%q',%Q,n
fdc0: 6f 77 28 29 29 3b 5c 6e 22 2c 0a 20 20 20 20 20 ow());\n",.
fdd0: 20 7a 4e 65 77 4e 61 6d 65 2c 20 7a 56 61 6c 75 zNewName, zValu
fde0: 65 29 3b 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a e);. return;.
fdf0: 20 20 7d 0a 20 20 69 66 28 20 73 74 72 63 6d 70 }. if( strcmp
fe00: 28 7a 4f 6c 64 4e 61 6d 65 2c 20 7a 4e 65 77 4e (zOldName, zNewN
fe10: 61 6d 65 29 21 3d 30 20 29 7b 0a 20 20 20 20 62 ame)!=0 ){. b
fe20: 6c 6f 62 5f 61 70 70 65 6e 64 5f 73 71 6c 28 70 lob_append_sql(p
fe30: 53 71 6c 2c 0a 20 20 20 20 20 20 20 22 55 50 44 Sql,. "UPD
fe40: 41 54 45 20 63 6f 6e 66 69 67 20 53 45 54 20 6e ATE config SET n
fe50: 61 6d 65 3d 27 77 61 6c 69 61 73 3a 25 71 27 2c ame='walias:%q',
fe60: 20 76 61 6c 75 65 3d 25 51 2c 20 6d 74 69 6d 65 value=%Q, mtime
fe70: 3d 6e 6f 77 28 29 22 0a 20 20 20 20 20 20 20 22 =now()". "
fe80: 20 57 48 45 52 45 20 6e 61 6d 65 3d 27 77 61 6c WHERE name='wal
fe90: 69 61 73 3a 25 71 27 3b 5c 6e 22 2c 0a 20 20 20 ias:%q';\n",.
fea0: 20 20 20 20 7a 4e 65 77 4e 61 6d 65 2c 20 7a 56 zNewName, zV
feb0: 61 6c 75 65 2c 20 7a 4f 6c 64 4e 61 6d 65 29 3b alue, zOldName);
fec0: 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 62 6c . }else{. bl
fed0: 6f 62 5f 61 70 70 65 6e 64 5f 73 71 6c 28 70 53 ob_append_sql(pS
fee0: 71 6c 2c 0a 20 20 20 20 20 20 20 22 55 50 44 41 ql,. "UPDA
fef0: 54 45 20 63 6f 6e 66 69 67 20 53 45 54 20 76 61 TE config SET va
ff00: 6c 75 65 3d 25 51 2c 20 6d 74 69 6d 65 3d 6e 6f lue=%Q, mtime=no
ff10: 77 28 29 22 0a 20 20 20 20 20 20 20 22 20 57 48 w()". " WH
ff20: 45 52 45 20 6e 61 6d 65 3d 27 77 61 6c 69 61 73 ERE name='walias
ff30: 3a 25 71 27 20 41 4e 44 20 76 61 6c 75 65 3c 3e :%q' AND value<>
ff40: 25 51 3b 5c 6e 22 2c 0a 20 20 20 20 20 20 20 7a %Q;\n",. z
ff50: 56 61 6c 75 65 2c 20 7a 4f 6c 64 4e 61 6d 65 2c Value, zOldName,
ff60: 20 7a 56 61 6c 75 65 29 3b 0a 20 20 7d 0a 7d 0a zValue);. }.}.
ff70: 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 45 3a 20 ./*.** WEBPAGE:
ff80: 77 61 6c 69 61 73 73 65 74 75 70 0a 2a 2a 0a 2a waliassetup.**.*
ff90: 2a 20 43 6f 6e 66 69 67 75 72 65 20 74 68 65 20 * Configure the
ffa0: 55 52 4c 20 61 6c 69 61 73 65 73 0a 2a 2f 0a 76 URL aliases.*/.v
ffb0: 6f 69 64 20 70 61 67 65 5f 77 61 6c 69 61 73 73 oid page_waliass
ffc0: 65 74 75 70 28 29 7b 0a 20 20 53 74 6d 74 20 71 etup(){. Stmt q
ffd0: 3b 0a 20 20 69 6e 74 20 63 6e 74 20 3d 20 30 3b ;. int cnt = 0;
ffe0: 0a 20 20 42 6c 6f 62 20 6e 61 6d 65 6c 69 73 74 . Blob namelist
fff0: 3b 0a 20 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f ;. login_check_
10000 63 72 65 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 credentials();.
10010 20 69 66 28 20 21 67 2e 70 65 72 6d 2e 41 64 6d if( !g.perm.Adm
10020 69 6e 20 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f in ){. login_
10030 6e 65 65 64 65 64 28 30 29 3b 0a 20 20 20 20 72 needed(0);. r
10040 65 74 75 72 6e 3b 0a 20 20 7d 0a 20 20 73 74 79 eturn;. }. sty
10050 6c 65 5f 68 65 61 64 65 72 28 22 55 52 4c 20 41 le_header("URL A
10060 6c 69 61 73 20 43 6f 6e 66 69 67 75 72 61 74 69 lias Configurati
10070 6f 6e 22 29 3b 0a 20 20 69 66 28 20 50 28 22 73 on");. if( P("s
10080 75 62 6d 69 74 22 29 21 3d 30 20 29 7b 0a 20 20 ubmit")!=0 ){.
10090 20 20 42 6c 6f 62 20 74 6f 6b 65 6e 3b 0a 20 20 Blob token;.
100a0 20 20 42 6c 6f 62 20 73 71 6c 3b 0a 20 20 20 20 Blob sql;.
100b0 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e 65 77 const char *zNew
100c0 4e 61 6d 65 3b 0a 20 20 20 20 63 6f 6e 73 74 20 Name;. const
100d0 63 68 61 72 20 2a 7a 56 61 6c 75 65 3b 0a 20 20 char *zValue;.
100e0 20 20 63 68 61 72 20 7a 43 6e 74 5b 31 30 5d 3b char zCnt[10];
100f0 0a 20 20 20 20 6c 6f 67 69 6e 5f 76 65 72 69 66 . login_verif
10100 79 5f 63 73 72 66 5f 73 65 63 72 65 74 28 29 3b y_csrf_secret();
10110 0a 20 20 20 20 62 6c 6f 62 5f 69 6e 69 74 28 26 . blob_init(&
10120 6e 61 6d 65 6c 69 73 74 2c 20 50 44 28 22 6e 61 namelist, PD("na
10130 6d 65 6c 69 73 74 22 2c 22 22 29 2c 20 2d 31 29 melist",""), -1)
10140 3b 0a 20 20 20 20 62 6c 6f 62 5f 69 6e 69 74 28 ;. blob_init(
10150 26 73 71 6c 2c 20 30 2c 20 30 29 3b 0a 20 20 20 &sql, 0, 0);.
10160 20 77 68 69 6c 65 28 20 62 6c 6f 62 5f 74 6f 6b while( blob_tok
10170 65 6e 28 26 6e 61 6d 65 6c 69 73 74 2c 20 26 74 en(&namelist, &t
10180 6f 6b 65 6e 29 20 29 7b 0a 20 20 20 20 20 20 63 oken) ){. c
10190 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4f 6c 64 4e onst char *zOldN
101a0 61 6d 65 20 3d 20 62 6c 6f 62 5f 73 74 72 28 26 ame = blob_str(&
101b0 74 6f 6b 65 6e 29 3b 0a 20 20 20 20 20 20 73 71 token);. sq
101c0 6c 69 74 65 33 5f 73 6e 70 72 69 6e 74 66 28 73 lite3_snprintf(s
101d0 69 7a 65 6f 66 28 7a 43 6e 74 29 2c 20 7a 43 6e izeof(zCnt), zCn
101e0 74 2c 20 22 6e 25 64 22 2c 20 63 6e 74 29 3b 0a t, "n%d", cnt);.
101f0 20 20 20 20 20 20 7a 4e 65 77 4e 61 6d 65 20 3d zNewName =
10200 20 50 44 28 7a 43 6e 74 2c 20 22 22 29 3b 0a 20 PD(zCnt, "");.
10210 20 20 20 20 20 73 71 6c 69 74 65 33 5f 73 6e 70 sqlite3_snp
10220 72 69 6e 74 66 28 73 69 7a 65 6f 66 28 7a 43 6e rintf(sizeof(zCn
10230 74 29 2c 20 7a 43 6e 74 2c 20 22 76 25 64 22 2c t), zCnt, "v%d",
10240 20 63 6e 74 29 3b 0a 20 20 20 20 20 20 7a 56 61 cnt);. zVa
10250 6c 75 65 20 3d 20 50 44 28 7a 43 6e 74 2c 20 22 lue = PD(zCnt, "
10260 22 29 3b 0a 20 20 20 20 20 20 73 65 74 75 70 5f ");. setup_
10270 75 70 64 61 74 65 5f 75 72 6c 5f 61 6c 69 61 73 update_url_alias
10280 28 26 73 71 6c 2c 20 7a 4f 6c 64 4e 61 6d 65 2c (&sql, zOldName,
10290 20 7a 4e 65 77 4e 61 6d 65 2c 20 7a 56 61 6c 75 zNewName, zValu
102a0 65 29 3b 0a 20 20 20 20 20 20 63 6e 74 2b 2b 3b e);. cnt++;
102b0 0a 20 20 20 20 20 20 62 6c 6f 62 5f 72 65 73 65 . blob_rese
102c0 74 28 26 74 6f 6b 65 6e 29 3b 0a 20 20 20 20 7d t(&token);. }
102d0 0a 20 20 20 20 73 71 6c 69 74 65 33 5f 73 6e 70 . sqlite3_snp
102e0 72 69 6e 74 66 28 73 69 7a 65 6f 66 28 7a 43 6e rintf(sizeof(zCn
102f0 74 29 2c 20 7a 43 6e 74 2c 20 22 6e 25 64 22 2c t), zCnt, "n%d",
10300 20 63 6e 74 29 3b 0a 20 20 20 20 7a 4e 65 77 4e cnt);. zNewN
10310 61 6d 65 20 3d 20 50 44 28 7a 43 6e 74 2c 22 22 ame = PD(zCnt,""
10320 29 3b 0a 20 20 20 20 73 71 6c 69 74 65 33 5f 73 );. sqlite3_s
10330 6e 70 72 69 6e 74 66 28 73 69 7a 65 6f 66 28 7a nprintf(sizeof(z
10340 43 6e 74 29 2c 20 7a 43 6e 74 2c 20 22 76 25 64 Cnt), zCnt, "v%d
10350 22 2c 20 63 6e 74 29 3b 0a 20 20 20 20 7a 56 61 ", cnt);. zVa
10360 6c 75 65 20 3d 20 50 44 28 7a 43 6e 74 2c 22 22 lue = PD(zCnt,""
10370 29 3b 0a 20 20 20 20 73 65 74 75 70 5f 75 70 64 );. setup_upd
10380 61 74 65 5f 75 72 6c 5f 61 6c 69 61 73 28 26 73 ate_url_alias(&s
10390 71 6c 2c 20 22 22 2c 20 7a 4e 65 77 4e 61 6d 65 ql, "", zNewName
103a0 2c 20 7a 56 61 6c 75 65 29 3b 0a 20 20 20 20 64 , zValue);. d
103b0 62 5f 75 6e 70 72 6f 74 65 63 74 28 50 52 4f 54 b_unprotect(PROT
103c0 45 43 54 5f 43 4f 4e 46 49 47 29 3b 0a 20 20 20 ECT_CONFIG);.
103d0 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 db_multi_exec("
103e0 25 73 22 2c 20 62 6c 6f 62 5f 73 71 6c 5f 74 65 %s", blob_sql_te
103f0 78 74 28 26 73 71 6c 29 29 3b 0a 20 20 20 20 64 xt(&sql));. d
10400 62 5f 70 72 6f 74 65 63 74 5f 70 6f 70 28 29 3b b_protect_pop();
10410 0a 20 20 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 . blob_reset(
10420 26 73 71 6c 29 3b 0a 20 20 20 20 62 6c 6f 62 5f &sql);. blob_
10430 72 65 73 65 74 28 26 6e 61 6d 65 6c 69 73 74 29 reset(&namelist)
10440 3b 0a 20 20 20 20 63 6e 74 20 3d 20 30 3b 0a 20 ;. cnt = 0;.
10450 20 7d 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 }. db_prepare(
10460 26 71 2c 0a 20 20 20 20 20 20 22 53 45 4c 45 43 &q,. "SELEC
10470 54 20 73 75 62 73 74 72 28 6e 61 6d 65 2c 38 29 T substr(name,8)
10480 2c 20 76 61 6c 75 65 20 46 52 4f 4d 20 63 6f 6e , value FROM con
10490 66 69 67 20 57 48 45 52 45 20 6e 61 6d 65 20 47 fig WHERE name G
104a0 4c 4f 42 20 27 77 61 6c 69 61 73 3a 2f 2a 27 22 LOB 'walias:/*'"
104b0 0a 20 20 20 20 20 20 22 20 55 4e 49 4f 4e 20 41 . " UNION A
104c0 4c 4c 20 53 45 4c 45 43 54 20 27 27 2c 20 27 27 LL SELECT '', ''
104d0 22 0a 20 20 29 3b 0a 20 20 40 20 3c 66 6f 72 6d ". );. @ <form
104e0 20 61 63 74 69 6f 6e 3d 22 25 52 2f 77 61 6c 69 action="%R/wali
104f0 61 73 73 65 74 75 70 22 20 6d 65 74 68 6f 64 3d assetup" method=
10500 22 70 6f 73 74 22 3e 3c 64 69 76 3e 0a 20 20 6c "post"><div>. l
10510 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 ogin_insert_csrf
10520 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 40 20 3c _secret();. @ <
10530 74 61 62 6c 65 20 62 6f 72 64 65 72 3d 30 20 63 table border=0 c
10540 65 6c 6c 70 61 64 64 69 6e 67 3d 35 3e 0a 20 20 ellpadding=5>.
10550 40 20 3c 74 72 3e 3c 74 68 3e 41 6c 69 61 73 3c @ <tr><th>Alias<
10560 74 68 3e 55 52 49 20 54 68 61 74 20 54 68 65 20 th>URI That The
10570 41 6c 69 61 73 20 4d 61 70 73 20 49 6e 74 6f 0a Alias Maps Into.
10580 20 20 62 6c 6f 62 5f 69 6e 69 74 28 26 6e 61 6d blob_init(&nam
10590 65 6c 69 73 74 2c 20 30 2c 20 30 29 3b 0a 20 20 elist, 0, 0);.
105a0 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70 28 26 while( db_step(&
105b0 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29 q)==SQLITE_ROW )
105c0 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 {. const char
105d0 20 2a 7a 4e 61 6d 65 20 3d 20 64 62 5f 63 6f 6c *zName = db_col
105e0 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 30 29 3b umn_text(&q, 0);
105f0 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 . const char
10600 2a 7a 56 61 6c 75 65 20 3d 20 64 62 5f 63 6f 6c *zValue = db_col
10610 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 31 29 3b umn_text(&q, 1);
10620 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 3e 0a . @ <tr><td>.
10630 20 20 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 @ <input typ
10640 65 3d 27 74 65 78 74 27 20 73 69 7a 65 3d 27 32 e='text' size='2
10650 30 27 20 76 61 6c 75 65 3d 27 25 68 28 7a 4e 61 0' value='%h(zNa
10660 6d 65 29 27 20 6e 61 6d 65 3d 27 6e 25 64 28 63 me)' name='n%d(c
10670 6e 74 29 27 3e 0a 20 20 20 20 40 20 3c 2f 74 64 nt)'>. @ </td
10680 3e 3c 74 64 3e 0a 20 20 20 20 40 20 3c 69 6e 70 ><td>. @ <inp
10690 75 74 20 74 79 70 65 3d 27 74 65 78 74 27 20 73 ut type='text' s
106a0 69 7a 65 3d 27 38 30 27 20 76 61 6c 75 65 3d 27 ize='80' value='
106b0 25 68 28 7a 56 61 6c 75 65 29 27 20 6e 61 6d 65 %h(zValue)' name
106c0 3d 27 76 25 64 28 63 6e 74 29 27 3e 0a 20 20 20 ='v%d(cnt)'>.
106d0 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 @ </td></tr>.
106e0 20 20 63 6e 74 2b 2b 3b 0a 20 20 20 20 69 66 28 cnt++;. if(
106f0 20 62 6c 6f 62 5f 73 69 7a 65 28 26 6e 61 6d 65 blob_size(&name
10700 6c 69 73 74 29 3e 30 20 29 20 62 6c 6f 62 5f 61 list)>0 ) blob_a
10710 70 70 65 6e 64 28 26 6e 61 6d 65 6c 69 73 74 2c ppend(&namelist,
10720 20 22 20 22 2c 20 31 29 3b 0a 20 20 20 20 62 6c " ", 1);. bl
10730 6f 62 5f 61 70 70 65 6e 64 28 26 6e 61 6d 65 6c ob_append(&namel
10740 69 73 74 2c 20 7a 4e 61 6d 65 2c 20 2d 31 29 3b ist, zName, -1);
10750 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 . }. db_finali
10760 7a 65 28 26 71 29 3b 0a 20 20 40 20 3c 74 72 3e ze(&q);. @ <tr>
10770 3c 74 64 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 <td>. @ <input
10780 74 79 70 65 3d 27 68 69 64 64 65 6e 27 20 6e 61 type='hidden' na
10790 6d 65 3d 27 6e 61 6d 65 6c 69 73 74 27 20 76 61 me='namelist' va
107a0 6c 75 65 3d 27 25 68 28 62 6c 6f 62 5f 73 74 72 lue='%h(blob_str
107b0 28 26 6e 61 6d 65 6c 69 73 74 29 29 27 3e 0a 20 (&namelist))'>.
107c0 20 40 20 3c 69 6e 70 75 74 20 74 79 70 65 3d 27 @ <input type='
107d0 73 75 62 6d 69 74 27 20 6e 61 6d 65 3d 27 73 75 submit' name='su
107e0 62 6d 69 74 27 20 76 61 6c 75 65 3d 22 41 70 70 bmit' value="App
107f0 6c 79 20 43 68 61 6e 67 65 73 22 3e 0a 20 20 40 ly Changes">. @
10800 20 3c 2f 74 64 3e 3c 74 64 3e 3c 2f 74 64 3e 3c </td><td></td><
10810 2f 74 72 3e 0a 20 20 40 20 3c 2f 74 61 62 6c 65 /tr>. @ </table
10820 3e 3c 2f 66 6f 72 6d 3e 0a 20 20 40 20 3c 68 72 ></form>. @ <hr
10830 3e 0a 20 20 40 20 3c 70 3e 57 68 65 6e 20 74 68 >. @ <p>When th
10840 65 20 66 69 72 73 74 20 74 65 72 6d 20 6f 66 20 e first term of
10850 61 6e 20 69 6e 63 6f 6d 69 6e 67 20 55 52 4c 20 an incoming URL
10860 65 78 61 63 74 6c 79 20 6d 61 74 63 68 65 73 20 exactly matches
10870 6f 6e 65 20 6f 66 0a 20 20 40 20 74 68 65 20 22 one of. @ the "
10880 41 6c 69 61 73 65 73 22 20 6f 6e 20 74 68 65 20 Aliases" on the
10890 6c 65 66 74 2d 68 61 6e 64 20 73 69 64 65 20 28 left-hand side (
108a0 4c 48 53 29 20 61 62 6f 76 65 2c 20 74 68 65 20 LHS) above, the
108b0 55 52 4c 20 69 73 0a 20 20 40 20 63 6f 6e 76 65 URL is. @ conve
108c0 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20 63 6f rted into the co
108d0 72 72 65 73 70 6f 6e 64 69 6e 67 20 66 6f 72 6d rresponding form
108e0 20 6f 6e 20 74 68 65 20 72 69 67 68 74 2d 68 61 on the right-ha
108f0 6e 64 20 73 69 64 65 20 28 52 48 53 29 2e 0a 20 nd side (RHS)..
10900 20 40 20 3c 75 6c 3e 0a 20 20 40 20 3c 6c 69 3e @ <ul>. @ <li>
10910 3c 70 3e 0a 20 20 40 20 54 68 65 20 4c 48 53 20 <p>. @ The LHS
10920 69 73 20 63 6f 6d 70 61 72 65 64 20 61 67 61 69 is compared agai
10930 6e 73 74 20 6f 6e 6c 79 20 74 68 65 20 66 69 72 nst only the fir
10940 73 74 20 74 65 72 6d 20 6f 66 20 74 68 65 20 69 st term of the i
10950 6e 63 6f 6d 69 6e 67 20 55 52 4c 2e 0a 20 20 40 ncoming URL.. @
10960 20 41 6c 6c 20 4c 48 53 20 65 6e 74 72 69 65 73 All LHS entries
10970 20 69 6e 20 74 68 65 20 61 6c 69 61 73 20 74 61 in the alias ta
10980 62 6c 65 20 73 68 6f 75 6c 64 20 74 68 65 72 65 ble should there
10990 66 6f 72 65 20 62 65 67 69 6e 20 77 69 74 68 20 fore begin with
109a0 61 0a 20 20 40 20 73 69 6e 67 6c 65 20 22 2f 22 a. @ single "/"
109b0 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 73 followed by a s
109c0 69 6e 67 6c 65 20 70 61 74 68 20 65 6c 65 6d 65 ingle path eleme
109d0 6e 74 2e 0a 20 20 40 20 3c 6c 69 3e 3c 70 3e 0a nt.. @ <li><p>.
109e0 20 20 40 20 54 68 65 20 52 48 53 20 65 6e 74 72 @ The RHS entr
109f0 69 65 73 20 69 6e 20 74 68 65 20 61 6c 69 61 73 ies in the alias
10a00 20 74 61 62 6c 65 20 73 68 6f 75 6c 64 20 62 65 table should be
10a10 67 69 6e 20 77 69 74 68 20 61 20 73 69 6e 67 6c gin with a singl
10a20 65 20 22 2f 22 0a 20 20 40 20 66 6f 6c 6c 6f 77 e "/". @ follow
10a30 65 64 20 62 79 20 61 20 70 61 74 68 20 65 6c 65 ed by a path ele
10a40 6d 65 6e 74 2c 20 61 6e 64 20 6f 70 74 69 6f 6e ment, and option
10a50 61 6c 6c 79 20 66 6f 6c 6c 6f 77 65 64 20 62 79 ally followed by
10a60 20 22 3f 22 20 61 6e 64 20 61 0a 20 20 40 20 6c "?" and a. @ l
10a70 69 73 74 20 6f 66 20 71 75 65 72 79 20 70 61 72 ist of query par
10a80 61 6d 65 74 65 72 73 2e 0a 20 20 40 20 3c 6c 69 ameters.. @ <li
10a90 3e 3c 70 3e 0a 20 20 40 20 51 75 65 72 79 20 70 ><p>. @ Query p
10aa0 61 72 61 6d 65 74 65 72 73 20 6f 6e 20 74 68 65 arameters on the
10ab0 20 52 48 53 20 61 72 65 20 61 64 64 65 64 20 74 RHS are added t
10ac0 6f 20 74 68 65 20 73 65 74 20 6f 66 20 71 75 65 o the set of que
10ad0 72 79 20 70 61 72 61 6d 65 74 65 72 73 0a 20 20 ry parameters.
10ae0 40 20 69 6e 20 74 68 65 20 69 6e 63 6f 6d 69 6e @ in the incomin
10af0 67 20 55 52 4c 2e 0a 20 20 40 20 3c 6c 69 3e 3c g URL.. @ <li><
10b00 70 3e 0a 20 20 40 20 49 66 20 74 68 65 20 73 61 p>. @ If the sa
10b10 6d 65 20 71 75 65 72 79 20 70 61 72 61 6d 65 74 me query paramet
10b20 65 72 20 61 70 70 65 61 72 73 20 69 6e 20 62 6f er appears in bo
10b30 74 68 20 74 68 65 20 69 6e 63 6f 6d 69 6e 67 20 th the incoming
10b40 55 52 4c 20 61 6e 64 0a 20 20 40 20 6f 6e 20 74 URL and. @ on t
10b50 68 65 20 52 48 53 20 6f 66 20 74 68 65 20 61 6c he RHS of the al
10b60 69 61 73 2c 20 74 68 65 20 52 48 53 20 71 75 65 ias, the RHS que
10b70 72 79 20 70 61 72 61 6d 65 74 65 72 20 76 61 6c ry parameter val
10b80 75 65 20 6f 76 65 72 77 72 69 74 65 73 0a 20 20 ue overwrites.
10b90 40 20 74 68 65 20 76 61 6c 75 65 20 6f 6e 20 74 @ the value on t
10ba0 68 65 20 69 6e 63 6f 6d 69 6e 67 20 55 52 4c 2e he incoming URL.
10bb0 0a 20 20 40 20 3c 6c 69 3e 3c 70 3e 0a 20 20 40 . @ <li><p>. @
10bc0 20 49 66 20 61 20 71 75 65 72 79 20 70 61 72 61 If a query para
10bd0 6d 65 74 65 72 20 6f 6e 20 74 68 65 20 52 48 53 meter on the RHS
10be0 20 6f 66 20 74 68 65 20 61 6c 69 61 73 20 69 73 of the alias is
10bf0 20 6f 66 20 74 68 65 20 66 6f 72 6d 20 22 58 21 of the form "X!
10c00 22 0a 20 20 40 20 28 61 20 6e 61 6d 65 20 66 6f ". @ (a name fo
10c10 6c 6c 6f 77 65 64 20 62 79 20 22 21 22 29 20 74 llowed by "!") t
10c20 68 65 6e 20 74 68 65 20 58 20 71 75 65 72 79 20 hen the X query
10c30 70 61 72 61 6d 65 74 65 72 20 69 73 20 72 65 6d parameter is rem
10c40 6f 76 65 64 0a 20 20 40 20 66 72 6f 6d 20 74 68 oved. @ from th
10c50 65 20 69 6e 63 6f 6d 69 6e 67 20 55 52 4c 20 69 e incoming URL i
10c60 66 0a 20 20 40 20 69 74 20 65 78 69 73 74 73 2e f. @ it exists.
10c70 0a 20 20 40 20 3c 6c 69 3e 3c 70 3e 0a 20 20 40 . @ <li><p>. @
10c80 20 4f 6e 6c 79 20 61 20 73 69 6e 67 6c 65 20 61 Only a single a
10c90 6c 69 61 73 20 6f 70 65 72 61 74 69 6f 6e 20 6f lias operation o
10ca0 63 63 75 72 73 2e 20 20 49 74 20 69 73 20 6e 6f ccurs. It is no
10cb0 74 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 6e 65 t possible to ne
10cc0 73 74 20 61 6c 69 61 73 65 73 2e 0a 20 20 40 20 st aliases.. @
10cd0 54 68 65 20 52 48 53 20 65 6e 74 72 69 65 73 20 The RHS entries
10ce0 6d 75 73 74 20 62 65 20 62 75 69 6c 74 2d 69 6e must be built-in
10cf0 20 77 65 62 70 61 67 65 20 6e 61 6d 65 73 2e 0a webpage names..
10d00 20 20 40 20 3c 6c 69 3e 3c 70 3e 0a 20 20 40 20 @ <li><p>. @
10d10 54 68 65 20 61 6c 69 61 73 20 74 61 62 6c 65 20 The alias table
10d20 69 73 20 6f 6e 6c 79 20 63 68 65 63 6b 65 64 20 is only checked
10d30 69 66 20 6e 6f 20 62 75 69 6c 74 2d 69 6e 20 77 if no built-in w
10d40 65 62 70 61 67 65 20 6d 61 74 63 68 65 73 0a 20 ebpage matches.
10d50 20 40 20 74 68 65 20 69 6e 63 6f 6d 69 6e 67 20 @ the incoming
10d60 55 52 4c 2e 0a 20 20 40 20 48 65 6e 63 65 2c 20 URL.. @ Hence,
10d70 69 74 20 69 73 20 6e 6f 74 20 70 6f 73 73 69 62 it is not possib
10d80 6c 65 20 74 6f 20 6f 76 65 72 72 69 64 65 20 61 le to override a
10d90 20 62 75 69 6c 74 2d 69 6e 20 77 65 62 70 61 67 built-in webpag
10da0 65 20 75 73 69 6e 67 20 61 6c 69 61 73 65 73 2e e using aliases.
10db0 0a 20 20 40 20 54 68 69 73 20 69 73 20 62 79 20 . @ This is by
10dc0 64 65 73 69 67 6e 2e 0a 20 20 40 20 3c 2f 75 6c design.. @ </ul
10dd0 3e 0a 20 20 40 0a 20 20 40 20 3c 70 3e 54 6f 20 >. @. @ <p>To
10de0 64 65 6c 65 74 65 20 61 6e 20 65 6e 74 72 79 20 delete an entry
10df0 66 72 6f 6d 20 74 68 65 20 61 6c 69 61 73 20 74 from the alias t
10e00 61 62 6c 65 2c 20 63 68 61 6e 67 65 20 69 74 73 able, change its
10e10 20 6e 61 6d 65 20 6f 72 20 76 61 6c 75 65 20 74 name or value t
10e20 6f 20 61 6e 0a 20 20 40 20 65 6d 70 74 79 20 73 o an. @ empty s
10e30 74 72 69 6e 67 20 61 6e 64 20 70 72 65 73 73 20 tring and press
10e40 22 41 70 70 6c 79 20 43 68 61 6e 67 65 73 22 2e "Apply Changes".
10e50 0a 20 20 40 0a 20 20 40 20 3c 70 3e 54 6f 20 61 . @. @ <p>To a
10e60 64 64 20 61 20 6e 65 77 20 61 6c 69 61 73 2c 20 dd a new alias,
10e70 66 69 6c 6c 20 69 6e 20 74 68 65 20 6e 61 6d 65 fill in the name
10e80 20 61 6e 64 20 76 61 6c 75 65 20 69 6e 20 74 68 and value in th
10e90 65 20 62 6f 74 74 6f 6d 20 72 6f 77 0a 20 20 40 e bottom row. @
10ea0 20 6f 66 20 74 68 65 20 74 61 62 6c 65 20 61 62 of the table ab
10eb0 6f 76 65 20 61 6e 64 20 70 72 65 73 73 20 22 41 ove and press "A
10ec0 70 70 6c 79 20 43 68 61 6e 67 65 73 22 2e 0a 20 pply Changes"..
10ed0 20 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b style_footer();
10ee0 0a 7d 0a .}.