Artifact
c31e072527f2485f0205f5daa861caeef9174c8b:
- Executable file
extroot/config
— part of check-in
[105698b631]
at
2021-10-19 15:43:53
on branch trunk
— Enable saving
(user:
mario
size: 4559)
0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 70 68 70 2d 63 #!/usr/bin/php-c
0010: 67 69 20 2d 64 63 67 69 2e 66 6f 72 63 65 5f 72 gi -dcgi.force_r
0020: 65 64 69 72 65 63 74 3d 30 0a 3c 3f 70 68 70 0a edirect=0.<?php.
0030: 23 20 65 6e 63 6f 64 69 6e 67 3a 20 75 74 66 2d # encoding: utf-
0040: 38 0a 23 20 61 70 69 3a 20 63 67 69 0a 23 20 74 8.# api: cgi.# t
0050: 79 70 65 3a 20 63 6f 6e 66 69 67 0a 23 20 63 61 ype: config.# ca
0060: 74 65 67 6f 72 79 3a 20 61 64 6d 69 6e 0a 23 20 tegory: admin.#
0070: 74 69 74 6c 65 3a 20 45 78 74 72 61 20 63 6f 6e title: Extra con
0080: 66 69 67 0a 23 20 64 65 73 63 72 69 70 74 69 6f fig.# descriptio
0090: 6e 3a 20 41 64 64 69 74 69 6f 6e 61 6c 20 6c 69 n: Additional li
00a0: 73 74 20 6f 66 20 6f 70 74 69 6f 6e 73 20 74 6f st of options to
00b0: 20 63 6f 6e 66 69 67 75 72 65 2c 20 72 65 61 64 configure, read
00c0: 20 66 72 6f 6d 20 65 78 74 2f 2a 20 50 4d 44 0a from ext/* PMD.
00d0: 23 20 76 65 72 73 69 6f 6e 3a 20 30 2e 32 0a 23 # version: 0.2.#
00e0: 20 73 74 61 74 65 3a 20 62 65 74 61 0a 23 20 63 state: beta.# c
00f0: 6f 6e 66 69 67 3a 0a 23 20 20 20 20 7b 20 6e 61 onfig:.# { na
0100: 6d 65 3a 20 70 72 6f 6a 65 63 74 2d 6c 69 63 65 me: project-lice
0110: 6e 73 65 2c 20 74 79 70 65 3a 20 73 65 6c 65 63 nse, type: selec
0120: 74 2c 20 73 65 6c 65 63 74 3a 20 22 30 42 53 44 t, select: "0BSD
0130: 7c 41 41 4c 7c 41 44 53 4c 7c 41 46 4c 2d 33 2e |AAL|ADSL|AFL-3.
0140: 30 7c 41 47 50 4c 2d 31 2e 30 7c 41 47 50 4c 2d 0|AGPL-1.0|AGPL-
0150: 33 2e 30 7c 41 47 50 4c 2d 33 2e 30 2d 6f 72 2d 3.0|AGPL-3.0-or-
0160: 6c 61 74 65 72 7c 41 70 61 63 68 65 2d 32 2e 30 later|Apache-2.0
0170: 7c 41 50 53 4c 2d 32 2e 30 7c 41 72 74 69 73 74 |APSL-2.0|Artist
0180: 69 63 2d 31 2e 30 7c 41 72 74 69 73 74 69 63 2d ic-1.0|Artistic-
0190: 32 2e 30 7c 42 53 44 2d 31 2d 43 6c 61 75 73 65 2.0|BSD-1-Clause
01a0: 7c 42 53 44 2d 32 2d 43 6c 61 75 73 65 7c 42 53 |BSD-2-Clause|BS
01b0: 44 2d 32 2d 43 6c 61 75 73 65 2d 46 72 65 65 42 D-2-Clause-FreeB
01c0: 53 44 7c 42 53 44 2d 32 2d 43 6c 61 75 73 65 2d SD|BSD-2-Clause-
01d0: 4e 65 74 42 53 44 7c 42 53 44 2d 32 2d 43 6c 61 NetBSD|BSD-2-Cla
01e0: 75 73 65 2d 50 61 74 65 6e 74 7c 42 53 44 2d 33 use-Patent|BSD-3
01f0: 2d 43 6c 61 75 73 65 7c 42 53 44 2d 33 2d 43 6c -Clause|BSD-3-Cl
0200: 61 75 73 65 2d 41 74 74 72 69 62 75 74 69 6f 6e ause-Attribution
0210: 7c 42 53 44 2d 33 2d 43 6c 61 75 73 65 2d 43 6c |BSD-3-Clause-Cl
0220: 65 61 72 7c 42 53 44 2d 33 2d 43 6c 61 75 73 65 ear|BSD-3-Clause
0230: 2d 4d 6f 64 69 66 69 63 61 74 69 6f 6e 7c 42 53 -Modification|BS
0240: 44 2d 34 2d 43 6c 61 75 73 65 7c 42 53 44 2d 34 D-4-Clause|BSD-4
0250: 2d 43 6c 61 75 73 65 2d 53 68 6f 72 74 65 6e 65 -Clause-Shortene
0260: 64 7c 42 53 4c 2d 31 2e 30 7c 43 41 4c 2d 31 2e d|BSL-1.0|CAL-1.
0270: 30 7c 43 43 30 2d 31 2e 30 7c 43 43 2d 42 59 2d 0|CC0-1.0|CC-BY-
0280: 32 2e 30 7c 43 43 2d 42 59 2d 33 2e 30 7c 43 43 2.0|CC-BY-3.0|CC
0290: 2d 42 59 2d 34 2e 30 7c 43 43 2d 42 59 2d 4e 43 -BY-4.0|CC-BY-NC
02a0: 2d 32 2e 30 7c 43 43 2d 42 59 2d 4e 43 2d 34 2e -2.0|CC-BY-NC-4.
02b0: 30 7c 43 43 2d 42 59 2d 4e 43 2d 4e 44 2d 32 2e 0|CC-BY-NC-ND-2.
02c0: 30 7c 43 43 2d 42 59 2d 4e 43 2d 4e 44 2d 33 2e 0|CC-BY-NC-ND-3.
02d0: 30 7c 43 43 2d 42 59 2d 4e 43 2d 4e 44 2d 34 2e 0|CC-BY-NC-ND-4.
02e0: 30 7c 43 43 2d 42 59 2d 4e 43 2d 53 41 2d 32 2e 0|CC-BY-NC-SA-2.
02f0: 30 7c 43 43 2d 42 59 2d 4e 43 2d 53 41 2d 33 2e 0|CC-BY-NC-SA-3.
0300: 30 7c 43 43 2d 42 59 2d 4e 43 2d 53 41 2d 34 2e 0|CC-BY-NC-SA-4.
0310: 30 7c 43 43 2d 42 59 2d 4e 44 2d 34 2e 30 7c 43 0|CC-BY-ND-4.0|C
0320: 43 2d 42 59 2d 53 41 2d 32 2e 30 7c 43 43 2d 42 C-BY-SA-2.0|CC-B
0330: 59 2d 53 41 2d 34 2e 30 7c 43 44 44 4c 2d 31 2e Y-SA-4.0|CDDL-1.
0340: 31 7c 43 50 4c 2d 31 2e 30 7c 45 43 4c 2d 32 2e 1|CPL-1.0|ECL-2.
0350: 30 7c 45 46 4c 2d 32 2e 30 7c 45 50 4c 2d 32 2e 0|EFL-2.0|EPL-2.
0360: 30 7c 45 55 50 4c 2d 31 2e 32 7c 47 46 44 4c 2d 0|EUPL-1.2|GFDL-
0370: 31 2e 31 7c 47 46 44 4c 2d 31 2e 33 2d 6f 6e 6c 1.1|GFDL-1.3-onl
0380: 79 7c 47 46 44 4c 2d 31 2e 33 2d 6f 72 2d 6c 61 y|GFDL-1.3-or-la
0390: 74 65 72 7c 47 50 4c 2d 31 2e 30 7c 47 50 4c 2d ter|GPL-1.0|GPL-
03a0: 31 2e 30 2b 7c 47 50 4c 2d 32 2e 30 7c 47 50 4c 1.0+|GPL-2.0|GPL
03b0: 2d 32 2e 30 2b 7c 47 50 4c 2d 32 2e 30 2d 6f 6e -2.0+|GPL-2.0-on
03c0: 6c 79 7c 47 50 4c 2d 33 2e 30 7c 47 50 4c 2d 33 ly|GPL-3.0|GPL-3
03d0: 2e 30 2b 7c 49 50 4c 2d 31 2e 30 7c 49 53 43 7c .0+|IPL-1.0|ISC|
03e0: 4c 47 50 4c 2d 32 2e 30 7c 4c 47 50 4c 2d 32 2e LGPL-2.0|LGPL-2.
03f0: 31 7c 4c 47 50 4c 2d 32 2e 31 2b 7c 4c 47 50 4c 1|LGPL-2.1+|LGPL
0400: 2d 33 2e 30 7c 4c 47 50 4c 2d 33 2e 30 2b 7c 4d -3.0|LGPL-3.0+|M
0410: 49 54 7c 4d 49 54 2d 30 7c 4d 49 54 2d 4d 6f 64 IT|MIT-0|MIT-Mod
0420: 65 72 6e 2d 56 61 72 69 61 6e 74 7c 4d 50 4c 2d ern-Variant|MPL-
0430: 31 2e 30 7c 4d 50 4c 2d 31 2e 31 7c 4d 50 4c 2d 1.0|MPL-1.1|MPL-
0440: 32 2e 30 7c 4d 53 2d 50 4c 7c 4d 53 2d 52 4c 7c 2.0|MS-PL|MS-RL|
0450: 4e 50 4c 2d 31 2e 31 7c 4f 46 4c 2d 31 2e 30 7c NPL-1.1|OFL-1.0|
0460: 4f 53 4c 2d 32 2e 30 7c 4f 53 4c 2d 33 2e 30 7c OSL-2.0|OSL-3.0|
0470: 50 53 46 2d 32 2e 30 7c 50 79 74 68 6f 6e 2d 32 PSF-2.0|Python-2
0480: 2e 30 7c 53 50 4c 2d 31 2e 30 7c 54 43 4c 7c 55 .0|SPL-1.0|TCL|U
0490: 6e 6c 69 63 65 6e 73 65 7c 57 33 43 7c 57 54 46 nlicense|W3C|WTF
04a0: 50 4c 7c 58 31 31 7c 5a 65 6e 64 2d 32 2e 30 7c PL|X11|Zend-2.0|
04b0: 5a 50 4c 2d 32 2e 31 22 2c 20 76 61 6c 75 65 3a ZPL-2.1", value:
04c0: 20 22 22 2c 20 64 65 73 63 72 69 70 74 69 6f 6e "", description
04d0: 3a 20 22 53 6f 75 72 63 65 20 63 6f 64 65 20 6c : "Source code l
04e0: 69 63 65 6e 73 65 20 28 53 50 44 58 20 69 64 65 icense (SPDX ide
04f0: 6e 74 69 66 69 65 72 29 22 20 7d 0a 23 20 20 20 ntifier)" }.#
0500: 20 7b 20 6e 61 6d 65 3a 20 70 72 6f 6a 65 63 74 { name: project
0510: 2d 74 61 67 73 2c 20 20 20 20 74 79 70 65 3a 20 -tags, type:
0520: 73 74 72 2c 20 76 61 6c 75 65 3a 20 22 22 2c 20 str, value: "",
0530: 64 65 73 63 72 69 70 74 69 6f 6e 3a 20 41 64 64 description: Add
0540: 69 74 69 6f 6e 61 6c 20 74 61 67 73 20 66 6f 72 itional tags for
0550: 20 70 72 6f 6a 65 63 74 2e 6a 73 6f 6e 20 6c 69 project.json li
0560: 73 74 69 6e 67 2c 20 63 6f 6d 6d 61 2d 73 65 70 sting, comma-sep
0570: 61 72 61 74 65 64 20 6c 69 73 74 20 7d 0a 23 20 arated list }.#
0580: 20 20 20 7b 20 6e 61 6d 65 3a 20 70 72 6f 6a 65 { name: proje
0590: 63 74 2d 68 6f 6d 65 70 61 67 65 2c 20 74 79 70 ct-homepage, typ
05a0: 65 3a 20 73 74 72 2c 20 76 61 6c 75 65 3a 20 22 e: str, value: "
05b0: 22 2c 20 64 65 73 63 72 69 70 74 69 6f 6e 3a 20 ", description:
05c0: 41 6c 74 65 72 6e 61 74 69 76 65 20 70 72 6f 6a Alternative proj
05d0: 65 63 74 20 68 6f 6d 65 70 61 67 65 20 7d 0a 23 ect homepage }.#
05e0: 20 20 20 20 7b 20 6e 61 6d 65 3a 20 70 72 6f 6a { name: proj
05f0: 65 63 74 2d 64 65 73 63 72 69 70 74 69 6f 6e 2c ect-description,
0600: 20 74 79 70 65 3a 20 74 65 78 74 2c 20 76 61 6c type: text, val
0610: 75 65 3a 20 22 22 2c 20 64 65 73 63 72 69 70 74 ue: "", descript
0620: 69 6f 6e 3a 20 22 46 6f 73 73 69 6c 20 72 65 70 ion: "Fossil rep
0630: 6f 73 69 74 6f 72 79 20 61 6e 64 20 70 72 6f 6a ository and proj
0640: 65 63 74 20 64 65 73 63 72 69 70 74 69 6f 6e 22 ect description"
0650: 20 7d 0a 23 0a 23 20 52 65 61 64 73 20 74 68 65 }.#.# Reads the
0660: 20 23 63 6f 6e 66 69 67 3a 7b 7d 20 66 69 65 6c #config:{} fiel
0670: 64 73 2c 20 61 6e 64 20 75 70 64 61 74 65 73 20 ds, and updates
0680: 66 6f 73 73 69 6c 73 e2 80 99 20 63 6f 6e 66 69 fossils’ confi
0690: 67 20 74 61 62 6c 65 2e 0a 23 20 41 6c 6c 6f 77 g table..# Allow
06a0: 73 20 65 78 74 72 6f 6f 74 20 73 63 72 69 70 74 s extroot script
06b0: 73 20 74 6f 20 70 72 6f 76 69 64 65 20 61 64 64 s to provide add
06c0: 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 2c itional options,
06d0: 20 6f 72 20 6a 75 73 74 0a 23 20 61 6e 20 61 6c or just.# an al
06e0: 74 65 72 6e 61 74 69 76 65 20 74 6f 20 74 68 65 ternative to the
06f0: 20 62 75 69 6c 74 69 6e 20 73 65 74 74 69 6e 67 builtin setting
0700: 73 2e 0a 23 0a 0a 23 2d 2d 20 69 6e 69 74 0a 69 s..#..#-- init.i
0710: 6e 63 6c 75 64 65 28 22 2e 2f 66 6f 73 73 69 6c nclude("./fossil
0720: 5f 63 6f 6d 6d 6f 6e 2e 70 68 70 22 29 3b 20 20 _common.php");
0730: 20 23 20 64 62 28 29 20 65 74 63 2e 0a 69 66 20 # db() etc..if
0740: 28 21 69 73 5f 61 64 6d 69 6e 28 29 29 20 7b 0a (!is_admin()) {.
0750: 20 20 20 20 64 69 65 28 22 41 64 6d 69 6e 2d 6f die("Admin-o
0760: 6e 6c 79 22 29 3b 0a 7d 0a 65 72 72 6f 72 5f 72 nly");.}.error_r
0770: 65 70 6f 72 74 69 6e 67 28 45 5f 41 4c 4c 29 3b eporting(E_ALL);
0780: 0a 0a 23 2d 2d 20 66 6f 73 73 69 6c 20 48 54 4d ..#-- fossil HTM
0790: 4c 20 6f 75 74 70 75 74 0a 66 75 6e 63 74 69 6f L output.functio
07a0: 6e 20 70 61 67 65 5f 6d 64 28 24 74 65 78 74 29 n page_md($text)
07b0: 20 7b 0a 20 20 20 20 68 65 61 64 65 72 28 22 43 {. header("C
07c0: 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 ontent-Type: tex
07d0: 74 2f 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d t/html; charset=
07e0: 75 74 66 2d 38 22 29 3b 0a 20 20 20 20 70 72 69 utf-8");. pri
07f0: 6e 74 20 3c 3c 3c 45 4f 46 0a 3c 64 69 76 20 63 nt <<<EOF.<div c
0800: 6c 61 73 73 3d 27 66 6f 73 73 69 6c 2d 64 6f 63 lass='fossil-doc
0810: 27 20 64 61 74 61 2d 74 69 74 6c 65 3d 27 45 78 ' data-title='Ex
0820: 74 72 61 20 63 6f 6e 66 69 67 75 72 61 74 69 6f tra configuratio
0830: 6e 27 3e 0a 3c 73 74 79 6c 65 3e 0a 20 2e 63 6f n'>.<style>. .co
0840: 6e 66 69 67 2d 6c 69 73 74 20 6c 61 62 65 6c 20 nfig-list label
0850: 7b 0a 20 20 20 20 64 69 73 70 6c 61 79 3a 20 62 {. display: b
0860: 6c 6f 63 6b 3b 0a 20 20 20 20 6d 61 72 67 69 6e lock;. margin
0870: 2d 62 6f 74 74 6f 6d 3a 20 31 30 70 74 3b 0a 20 -bottom: 10pt;.
0880: 20 20 20 62 6f 72 64 65 72 2d 6c 65 66 74 3a 20 border-left:
0890: 33 70 74 20 23 64 64 64 20 73 6f 6c 69 64 3b 0a 3pt #ddd solid;.
08a0: 20 20 20 20 62 6f 72 64 65 72 2d 72 61 64 69 75 border-radiu
08b0: 73 3a 20 35 70 74 20 30 20 30 20 35 70 74 3b 0a s: 5pt 0 0 5pt;.
08c0: 20 20 20 20 70 61 64 64 69 6e 67 2d 6c 65 66 74 padding-left
08d0: 3a 20 31 30 70 74 3b 0a 20 7d 0a 3c 2f 73 74 79 : 10pt;. }.</sty
08e0: 6c 65 3e 0a 24 74 65 78 74 0a 45 4f 46 3b 0a 7d le>.$text.EOF;.}
08f0: 0a 0a 0a 23 2d 2d 20 66 69 6c 74 65 72 65 64 20 ...#-- filtered
0900: 66 69 6c 65 20 6c 69 73 74 0a 66 75 6e 63 74 69 file list.functi
0910: 6f 6e 20 6c 73 28 24 64 69 72 29 20 7b 0a 20 20 on ls($dir) {.
0920: 20 20 24 6c 73 20 3d 20 5b 5d 3b 0a 20 20 20 20 $ls = [];.
0930: 66 6f 72 65 61 63 68 20 28 67 6c 6f 62 28 22 24 foreach (glob("$
0940: 64 69 72 2f 2a 22 29 20 61 73 20 24 66 6e 29 20 dir/*") as $fn)
0950: 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 69 73 {. if (is
0960: 5f 66 69 6c 65 28 24 66 6e 29 20 61 6e 64 20 69 _file($fn) and i
0970: 73 5f 65 78 65 63 75 74 61 62 6c 65 28 24 66 6e s_executable($fn
0980: 29 20 61 6e 64 20 69 73 5f 72 65 61 64 61 62 6c ) and is_readabl
0990: 65 28 24 66 6e 29 29 20 7b 0a 20 20 20 20 20 20 e($fn)) {.
09a0: 20 20 20 20 20 20 24 6c 73 5b 5d 20 3d 20 62 61 $ls[] = ba
09b0: 73 65 6e 61 6d 65 28 24 66 6e 29 3b 0a 20 20 20 sename($fn);.
09c0: 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 }. }.
09d0: 20 72 65 74 75 72 6e 20 24 6c 73 3b 0a 7d 0a 0a return $ls;.}..
09e0: 23 2d 2d 20 73 74 6f 72 65 20 72 65 63 65 69 76 #-- store receiv
09f0: 65 64 20 62 6c 6f 62 73 20 62 61 63 6b 0a 69 66 ed blobs back.if
0a00: 20 28 63 6f 75 6e 74 28 24 5f 50 4f 53 54 29 29 (count($_POST))
0a10: 20 7b 0a 20 20 20 20 66 6f 72 65 61 63 68 20 28 {. foreach (
0a20: 24 5f 50 4f 53 54 20 61 73 20 24 6b 65 79 3d 3e $_POST as $key=>
0a30: 24 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 $value) {.
0a40: 20 20 69 66 20 28 67 65 74 5f 63 6f 6e 66 69 67 if (get_config
0a50: 28 24 6b 65 79 2c 20 22 22 29 20 21 3d 20 24 76 ($key, "") != $v
0a60: 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 alue) {.
0a70: 20 20 20 20 64 62 28 22 52 45 50 4c 41 43 45 20 db("REPLACE
0a80: 49 4e 54 4f 20 63 6f 6e 66 69 67 20 28 6e 61 6d INTO config (nam
0a90: 65 2c 6d 74 69 6d 65 2c 76 61 6c 75 65 29 20 56 e,mtime,value) V
0aa0: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 29 22 2c 20 ALUES (?,?,?)",
0ab0: 5b 24 6b 65 79 2c 20 74 69 6d 65 28 29 2c 20 24 [$key, time(), $
0ac0: 76 61 6c 75 65 5d 29 3b 0a 20 20 20 20 20 20 20 value]);.
0ad0: 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 2d 2d 20 }. }.}..#--
0ae0: 69 74 65 72 61 74 65 20 6f 76 65 72 20 73 63 72 iterate over scr
0af0: 69 70 74 73 20 66 6f 72 20 64 69 73 70 6c 61 79 ipts for display
0b00: 0a 70 61 67 65 5f 6d 64 28 22 3c 64 69 76 20 63 .page_md("<div c
0b10: 6c 61 73 73 3d 63 6f 6e 66 69 67 2d 6c 69 73 74 lass=config-list
0b20: 3e 5c 6e 3c 66 6f 72 6d 20 6d 65 74 68 6f 64 3d >\n<form method=
0b30: 50 4f 53 54 20 65 6e 63 74 79 70 65 3d 27 6d 75 POST enctype='mu
0b40: 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 ltipart/form-dat
0b50: 61 27 3e 22 29 3b 0a 66 6f 72 65 61 63 68 20 28 a'>");.foreach (
0b60: 6c 73 28 5f 5f 44 49 52 5f 5f 29 20 61 73 20 24 ls(__DIR__) as $
0b70: 66 6e 29 20 7b 0a 20 20 20 20 24 6d 65 74 61 20 fn) {. $meta
0b80: 3d 20 6d 65 74 61 28 24 66 6e 29 3b 0a 20 20 20 = meta($fn);.
0b90: 20 24 68 20 3d 20 22 68 22 3b 0a 20 20 20 20 23 $h = "h";. #
0ba0: 20 6c 6f 6f 6b 20 66 6f 72 20 63 6f 6e 66 69 67 look for config
0bb0: 3a 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 69 66 : options. if
0bc0: 20 28 24 63 6f 6e 66 69 67 20 3d 20 63 6f 6e 66 ($config = conf
0bd0: 69 67 28 24 6d 65 74 61 29 29 20 7b 0a 20 20 20 ig($meta)) {.
0be0: 20 20 20 20 20 24 74 69 74 6c 65 20 3d 20 24 6d $title = $m
0bf0: 65 74 61 5b 22 74 69 74 6c 65 22 5d 20 3f 3a 20 eta["title"] ?:
0c00: 24 66 6e 3b 0a 20 20 20 20 20 20 20 20 70 72 69 $fn;. pri
0c10: 6e 74 20 22 3c 68 33 3e 24 74 69 74 6c 65 3c 2f nt "<h3>$title</
0c20: 68 33 3e 5c 6e 22 3b 20 20 23 20 74 69 74 6c 65 h3>\n"; # title
0c30: 3d 27 7b 24 68 28 24 6d 65 74 61 5b 27 5f 5f 64 ='{$h($meta['__d
0c40: 6f 63 5f 5f 27 5d 29 7d 27 0a 20 20 20 20 20 20 oc__'])}'.
0c50: 20 20 66 6f 72 65 61 63 68 20 28 24 63 6f 6e 66 foreach ($conf
0c60: 69 67 20 61 73 20 24 6f 70 74 29 20 7b 0a 20 20 ig as $opt) {.
0c70: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 65 6d if (em
0c80: 70 74 79 28 24 6f 70 74 5b 22 6e 61 6d 65 22 5d pty($opt["name"]
0c90: 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 )) {.
0ca0: 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 3b 0a 20 continue;.
0cb0: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 }.
0cc0: 20 20 20 20 20 20 20 20 20 24 6e 61 6d 65 20 3d $name =
0cd0: 20 24 6f 70 74 5b 22 6e 61 6d 65 22 5d 3b 0a 20 $opt["name"];.
0ce0: 20 20 20 20 20 20 20 20 20 20 20 24 76 61 6c 75 $valu
0cf0: 65 20 3d 20 67 65 74 5f 63 6f 6e 66 69 67 28 24 e = get_config($
0d00: 6e 61 6d 65 2c 20 24 6f 70 74 5b 22 76 61 6c 75 name, $opt["valu
0d10: 65 22 5d 29 3b 0a 20 20 20 20 20 20 20 20 20 20 e"]);.
0d20: 20 20 70 72 69 6e 74 20 22 3c 6c 61 62 65 6c 3e print "<label>
0d30: 3c 62 3e 7b 24 68 28 24 6e 61 6d 65 29 7d 3c 2f <b>{$h($name)}</
0d40: 62 3e 3c 62 72 3e 5c 6e 22 3b 0a 20 20 20 20 20 b><br>\n";.
0d50: 20 20 20 20 20 20 20 23 20 68 61 6e 64 6c 65 20 # handle
0d60: 6f 6e 6c 79 20 73 74 72 2c 20 74 65 78 74 20 6f only str, text o
0d70: 72 20 73 65 6c 65 63 74 20 66 69 65 6c 64 73 0a r select fields.
0d80: 20 20 20 20 20 20 20 20 20 20 20 20 73 77 69 74 swit
0d90: 63 68 20 28 24 6f 70 74 5b 22 74 79 70 65 22 5d ch ($opt["type"]
0da0: 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 ) {.
0db0: 20 20 20 20 63 61 73 65 20 22 6c 6f 6e 67 22 3a case "long":
0dc0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
0dd0: 20 63 61 73 65 20 22 74 65 78 74 22 3a 0a 20 20 case "text":.
0de0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0df0: 20 20 70 72 69 6e 74 20 22 3c 74 65 78 74 61 72 print "<textar
0e00: 65 61 20 6e 61 6d 65 3d 7b 24 68 28 24 6e 61 6d ea name={$h($nam
0e10: 65 29 7d 20 72 6f 77 73 3d 34 20 63 6f 6c 73 3d e)} rows=4 cols=
0e20: 37 30 3e 7b 24 68 28 24 76 61 6c 75 65 29 7d 3c 70>{$h($value)}<
0e30: 2f 74 65 78 74 61 72 65 61 3e 22 3b 0a 20 20 20 /textarea>";.
0e40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0e50: 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 break;.
0e60: 20 20 20 20 20 20 20 20 63 61 73 65 20 22 63 68 case "ch
0e70: 6f 6f 73 65 22 3a 0a 20 20 20 20 20 20 20 20 20 oose":.
0e80: 20 20 20 20 20 20 20 63 61 73 65 20 22 73 65 6c case "sel
0e90: 65 63 74 22 3a 0a 20 20 20 20 20 20 20 20 20 20 ect":.
0ea0: 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 20 print
0eb0: 22 3c 73 65 6c 65 63 74 20 6e 61 6d 65 3d 7b 24 "<select name={$
0ec0: 68 28 24 6e 61 6d 65 29 7d 3e 5c 6e 22 3b 0a 20 h($name)}>\n";.
0ed0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ee0: 20 20 20 24 6f 70 74 73 20 3d 20 70 72 65 67 5f $opts = preg_
0ef0: 73 70 6c 69 74 28 22 7e 5b 7c 3b 2c 5d 7e 22 2c split("~[|;,]~",
0f00: 20 24 6f 70 74 5b 22 73 65 6c 65 63 74 22 5d 29 $opt["select"])
0f10: 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;.
0f20: 20 20 20 20 20 20 69 66 20 28 21 69 6e 5f 61 72 if (!in_ar
0f30: 72 61 79 28 24 76 61 6c 75 65 2c 20 24 6f 70 74 ray($value, $opt
0f40: 73 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 s)) {.
0f50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 6f $o
0f60: 70 74 73 5b 2d 31 5d 20 3d 20 24 76 61 6c 75 65 pts[-1] = $value
0f70: 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;.
0f80: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
0f90: 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
0fa0: 61 63 68 20 28 24 6f 70 74 73 20 61 73 20 24 6f ach ($opts as $o
0fb0: 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 ) {.
0fc0: 20 20 20 20 20 20 20 20 20 20 20 20 24 73 65 6c $sel
0fd0: 65 63 74 65 64 20 3d 20 24 6f 20 3d 3d 20 24 76 ected = $o == $v
0fe0: 61 6c 75 65 20 3f 20 22 20 73 65 6c 65 63 74 65 alue ? " selecte
0ff0: 64 22 20 3a 20 22 22 3b 0a 20 20 20 20 20 20 20 d" : "";.
1000: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1010: 20 70 72 69 6e 74 20 22 3c 6f 70 74 69 6f 6e 20 print "<option
1020: 76 61 6c 75 65 3d 5c 22 7b 24 68 28 24 6f 29 7d value=\"{$h($o)}
1030: 5c 22 24 73 65 6c 65 63 74 65 64 3e 7b 24 68 28 \"$selected>{$h(
1040: 24 6f 29 7d 3c 2f 6f 70 74 69 6f 6e 3e 5c 6e 22 $o)}</option>\n"
1050: 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;.
1060: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
1070: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e prin
1080: 74 20 22 3c 2f 73 65 6c 65 63 74 3e 22 3b 0a 20 t "</select>";.
1090: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10a0: 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 break;.
10b0: 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c defaul
10c0: 74 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 t:.
10d0: 20 20 20 20 20 20 20 70 72 69 6e 74 20 22 3c 69 print "<i
10e0: 6e 70 75 74 20 74 79 70 65 3d 5c 22 24 6f 70 74 nput type=\"$opt
10f0: 5b 74 79 70 65 5d 5c 22 20 6e 61 6d 65 3d 7b 24 [type]\" name={$
1100: 68 28 24 6e 61 6d 65 29 7d 20 76 61 6c 75 65 3d h($name)} value=
1110: 5c 22 7b 24 68 28 24 76 61 6c 75 65 29 7d 5c 22 \"{$h($value)}\"
1120: 20 73 69 7a 65 3d 36 30 3e 22 3b 0a 20 20 20 20 size=60>";.
1130: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 }.
1140: 20 20 20 20 20 20 70 72 69 6e 74 20 22 3c 62 72 print "<br
1150: 3e 5c 6e 3c 73 6d 61 6c 6c 3e 7b 24 68 28 24 6f >\n<small>{$h($o
1160: 70 74 5b 27 64 65 73 63 72 69 70 74 69 6f 6e 27 pt['description'
1170: 5d 29 7d 3c 2f 73 6d 61 6c 6c 3e 3c 2f 6c 61 62 ])}</small></lab
1180: 65 6c 3e 5c 6e 5c 6e 22 3b 0a 20 20 20 20 20 20 el>\n\n";.
1190: 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 3f 3e 0a 3c }. }.}.?>.<
11a0: 69 6e 70 75 74 20 74 79 70 65 3d 73 75 62 6d 69 input type=submi
11b0: 74 20 76 61 6c 75 65 3d 22 53 61 76 65 22 3e 0a t value="Save">.
11c0: 3c 2f 66 6f 72 6d 3e 0a 3c 2f 64 69 76 3e 0a </form>.</div>.