xref: /dokuwiki/lib/plugins/config/settings/config.metadata.php (revision 177d6836e2f75d0e404be9c566e61725852a1e07)
1<?php
2/**
3 * Metadata for configuration manager plugin
4 *
5 * Note: This file is loaded in Loader::loadMeta().
6 *
7 * Format:
8 *   $meta[<setting name>] = array(<handler class id>,<param name> => <param value>);
9 *
10 *   <handler class id>  is the handler class name without the "setting_" prefix
11 *
12 * Defined classes (see core/Setting/*):
13 *   Generic
14 *   -------------------------------------------
15 *   ''             - default class ('setting'), textarea, minimal input validation, setting output in quotes
16 *   'string'       - single line text input, minimal input validation, setting output in quotes
17 *   'numeric'      - text input, accepts numbers and arithmetic operators, setting output without quotes
18 *                    if given the '_min' and '_max' parameters are used for validation
19 *   'numericopt'   - like above, but accepts empty values
20 *   'onoff'        - checkbox input, setting output  0|1
21 *   'multichoice'  - select input (single choice), setting output with quotes, required _choices parameter
22 *   'email'        - text input, input must conform to email address format, supports optional '_multiple'
23 *                    parameter for multiple comma separated email addresses
24 *   'password'     - password input, minimal input validation, setting output text in quotes, maybe encoded
25 *                    according to the _code parameter
26 *   'dirchoice'    - as multichoice, selection choices based on folders found at location specified in _dir
27 *                    parameter (required). A pattern can be used to restrict the folders to only those which
28 *                    match the pattern.
29 *   'multicheckbox'- a checkbox for each choice plus an "other" string input, config file setting is a comma
30 *                    separated list of checked choices
31 *   'fieldset'     - used to group configuration settings, but is not itself a setting. To make this clear in
32 *                    the language files the keys for this type should start with '_'.
33 *   'array'        - a simple (one dimensional) array of string values, shown as comma separated list in the
34 *                    config manager but saved as PHP array(). Values may not contain commas themselves.
35 *                    _pattern matching on the array values supported.
36 *   'regex'        - regular expression string, normally without delimiters; as for string, in addition tested
37 *                    to see if will compile & run as a regex.  in addition to _pattern, also accepts _delimiter
38 *                    (default '/') and _pregflags (default 'ui')
39 *
40 *  Single Setting
41 *  -------------------------------------------------
42 *   'savedir'     - as 'setting', input tested against initpath() (inc/init.php)
43 *   'sepchar'     - as multichoice, selection constructed from string of valid values
44 *   'authtype'    - as 'setting', input validated against a valid php file at expected location for auth files
45 *   'im_convert'  - as 'setting', input must exist and be an im_convert module
46 *   'disableactions' - as 'setting'
47 *   'compression' - no additional parameters. checks php installation supports possible compression alternatives
48 *   'licence'     - as multichoice, selection constructed from licence strings in language files
49 *   'renderer'    - as multichoice, selection constructed from enabled renderer plugins which canRender()
50 *   'authtype'    - as multichoice, selection constructed from the enabled auth plugins
51 *
52 *  Any setting commented or missing will use 'setting' class - text input, minimal validation, quoted output
53 *
54 * Defined parameters:
55 *   '_caution'    - no value (default) or 'warning', 'danger', 'security'. display an alert along with the setting
56 *   '_pattern'    - string, a preg pattern. input is tested against this pattern before being accepted
57 *                   optional all classes, except onoff & multichoice which ignore it
58 *   '_choices'    - array of choices. used to populate a selection box. choice will be replaced by a localised
59 *                   language string, indexed by  <setting name>_o_<choice>, if one exists
60 *                   required by 'multichoice' & 'multicheckbox' classes, ignored by others
61 *   '_dir'        - location of directory to be used to populate choice list
62 *                   required by 'dirchoice' class, ignored by other classes
63 *   '_combine'    - complimentary output setting values which can be combined into a single display checkbox
64 *                   optional for 'multicheckbox', ignored by other classes
65 *   '_code'       - encoding method to use, accepted values: 'base64','uuencode','plain'.  defaults to plain.
66 *   '_min'        - minimum numeric value, optional for 'numeric' and 'numericopt', ignored by others
67 *   '_max'        - maximum numeric value, optional for 'numeric' and 'numericopt', ignored by others
68 *   '_delimiter'  - string, default '/', a single character used as a delimiter for testing regex input values
69 *   '_pregflags'  - string, default 'ui', valid preg pattern modifiers used when testing regex input values, for more
70 *                   information see http://php.net/manual/en/reference.pcre.pattern.modifiers.php
71 *   '_multiple'   - bool, allow multiple comma separated email values; optional for 'email', ignored by others
72 *   '_other'      - how to handle other values (not listed in _choices). accepted values: 'always','exists','never'
73 *                   default value 'always'. 'exists' only shows 'other' input field when the setting contains value(s)
74 *                   not listed in choices (e.g. due to manual editing or update changing _choices).  This is safer than
75 *                   'never' as it will not discard unknown/other values.
76 *                   optional for 'multicheckbox', ignored by others
77 *
78 * The order of the settings influences the order in which they apppear in the config manager
79 *
80 * @author    Chris Smith <chris@jalakai.co.uk>
81 */
82
83$meta['_basic'] = ['fieldset'];
84$meta['title'] = ['string'];
85$meta['start'] = ['string', '_caution' => 'warning', '_pattern' => '!^[^:;/]+$!']; // don't accept namespaces
86$meta['lang'] = ['dirchoice', '_dir' => DOKU_INC . 'inc/lang/'];
87$meta['template'] = ['dirchoice', '_dir' => DOKU_INC . 'lib/tpl/', '_pattern' => '/^[\w-]+$/'];
88$meta['tagline'] = ['string'];
89$meta['sidebar'] = ['string'];
90$meta['license'] = ['license'];
91$meta['savedir'] = ['savedir', '_caution' => 'danger'];
92$meta['basedir'] = ['string', '_caution' => 'danger'];
93$meta['baseurl'] = ['string', '_caution' => 'danger'];
94$meta['cookiedir'] = ['string', '_caution' => 'danger'];
95$meta['dmode'] = ['numeric', '_pattern' => '/0[0-7]{3,4}/']; // only accept octal representation
96$meta['fmode'] = ['numeric', '_pattern' => '/0[0-7]{3,4}/']; // only accept octal representation
97$meta['allowdebug'] = ['onoff', '_caution' => 'security'];
98
99$meta['_display'] = ['fieldset'];
100$meta['recent'] = ['numeric'];
101$meta['recent_days'] = ['numeric'];
102$meta['breadcrumbs'] = ['numeric', '_min' => 0];
103$meta['youarehere'] = ['onoff'];
104$meta['fullpath'] = ['onoff', '_caution' => 'security'];
105$meta['typography'] = ['multichoice', '_choices' => [0, 1, 2]];
106$meta['dformat'] = ['string'];
107$meta['signature'] = ['string'];
108$meta['showuseras'] = ['multichoice', '_choices' => ['loginname', 'username', 'username_link', 'email', 'email_link']];
109$meta['toptoclevel'] = ['multichoice', '_choices' => [1, 2, 3, 4, 5]];   // 5 toc levels
110$meta['tocminheads'] = ['multichoice', '_choices' => [0, 1, 2, 3, 4, 5, 10, 15, 20]];
111$meta['maxtoclevel'] = ['multichoice', '_choices' => [0, 1, 2, 3, 4, 5]];
112$meta['maxseclevel'] = ['multichoice', '_choices' => [0, 1, 2, 3, 4, 5]]; // 0 for no sec edit buttons
113$meta['camelcase'] = ['onoff', '_caution' => 'warning'];
114$meta['deaccent'] = ['multichoice', '_choices' => [0, 1, 2], '_caution' => 'warning'];
115$meta['useheading'] = ['multichoice', '_choices' => [0, 'navigation', 'content', 1]];
116$meta['sneaky_index'] = ['onoff'];
117$meta['hidepages'] = ['regex'];
118
119$meta['_authentication'] = ['fieldset'];
120$meta['useacl'] = ['onoff', '_caution' => 'danger'];
121$meta['autopasswd'] = ['onoff'];
122$meta['authtype'] = ['authtype', '_caution' => 'danger'];
123$meta['passcrypt'] = ['multichoice',
124    '_choices' => [
125        'smd5',
126        'md5',
127        'apr1',
128        'sha1',
129        'ssha',
130        'lsmd5',
131        'crypt',
132        'mysql',
133        'my411',
134        'kmd5',
135        'pmd5',
136        'hmd5',
137        'mediawiki',
138        'bcrypt',
139        'djangomd5',
140        'djangosha1',
141        'djangopbkdf2_sha1',
142        'djangopbkdf2_sha256',
143        'sha512',
144        'argon2i',
145        'argon2id']
146];
147$meta['defaultgroup'] = ['string'];
148$meta['superuser'] = ['string', '_caution' => 'danger'];
149$meta['manager'] = ['string'];
150$meta['profileconfirm'] = ['onoff'];
151$meta['rememberme'] = ['onoff'];
152$meta['disableactions'] = ['disableactions',
153    '_choices' => [
154        'backlink',
155        'index',
156        'recent',
157        'revisions',
158        'search',
159        'subscription',
160        'register',
161        'resendpwd',
162        'profile',
163        'profile_delete',
164        'edit',
165        'wikicode',
166        'check',
167        'rss'
168    ],
169    '_combine' => [
170        'subscription' => ['subscribe', 'unsubscribe'],
171        'wikicode' => ['source', 'export_raw']
172    ]
173];
174$meta['auth_security_timeout'] = ['numeric'];
175$meta['securecookie'] = ['onoff'];
176$meta['samesitecookie'] = ['multichoice', '_choices' => ['', 'Lax', 'Strict', 'None']];
177$meta['remote'] = ['onoff', '_caution' => 'security'];
178$meta['remoteuser'] = ['string'];
179$meta['remotecors'] = ['string', '_caution' => 'security'];
180
181$meta['_anti_spam'] = ['fieldset'];
182$meta['usewordblock'] = ['onoff'];
183$meta['relnofollow'] = ['onoff'];
184$meta['indexdelay'] = ['numeric'];
185$meta['mailguard'] = ['multichoice', '_choices' => ['visible', 'hex', 'none']];
186$meta['iexssprotect'] = ['onoff', '_caution' => 'security'];
187
188$meta['_editing'] = ['fieldset'];
189$meta['usedraft'] = ['onoff'];
190$meta['locktime'] = ['numeric'];
191$meta['cachetime'] = ['numeric'];
192
193$meta['_links'] = ['fieldset'];
194$meta['target____wiki'] = ['string'];
195$meta['target____interwiki'] = ['string'];
196$meta['target____extern'] = ['string'];
197$meta['target____media'] = ['string'];
198$meta['target____windows'] = ['string'];
199
200$meta['_media'] = ['fieldset'];
201$meta['mediarevisions'] = ['onoff'];
202$meta['gdlib'] = ['multichoice', '_choices' => [0, 1, 2]];
203$meta['im_convert'] = ['im_convert'];
204$meta['jpg_quality'] = ['numeric', '_pattern' => '/^100$|^[1-9]?\d$/'];  //(0-100)
205$meta['fetchsize'] = ['numeric'];
206$meta['refcheck'] = ['onoff'];
207
208$meta['_notifications'] = ['fieldset'];
209$meta['subscribers'] = ['onoff'];
210$meta['subscribe_time'] = ['numeric'];
211$meta['notify'] = ['email', '_multiple' => true];
212$meta['registernotify'] = ['email', '_multiple' => true];
213$meta['mailfrom'] = ['email', '_placeholders' => true];
214$meta['mailreturnpath'] = ['email', '_placeholders' => true];
215$meta['mailprefix'] = ['string'];
216$meta['htmlmail'] = ['onoff'];
217$meta['dontlog'] = ['disableactions', '_choices' => ['error', 'debug', 'deprecated']];
218
219$meta['_syndication'] = ['fieldset'];
220$meta['sitemap'] = ['numeric'];
221$meta['rss_type'] = ['multichoice', '_choices' => ['rss', 'rss1', 'rss2', 'atom', 'atom1']];
222$meta['rss_linkto'] = ['multichoice', '_choices' => ['diff', 'page', 'rev', 'current']];
223$meta['rss_content'] = ['multichoice', '_choices' => ['abstract', 'diff', 'htmldiff', 'html']];
224$meta['rss_media'] = ['multichoice', '_choices' => ['both', 'pages', 'media']];
225$meta['rss_update'] = ['numeric'];
226$meta['rss_show_summary'] = ['onoff'];
227$meta['rss_show_deleted'] = ['onoff'];
228
229$meta['_advanced'] = ['fieldset'];
230$meta['updatecheck'] = ['onoff'];
231$meta['userewrite'] = ['multichoice', '_choices' => [0, 1, 2], '_caution' => 'danger'];
232$meta['useslash'] = ['onoff'];
233$meta['sepchar'] = ['sepchar', '_caution' => 'warning'];
234$meta['canonical'] = ['onoff'];
235$meta['fnencode'] = ['multichoice', '_choices' => ['url', 'safe', 'utf-8'], '_caution' => 'warning'];
236$meta['autoplural'] = ['onoff'];
237$meta['compress'] = ['onoff'];
238$meta['cssdatauri'] = ['numeric', '_pattern' => '/^\d+$/'];
239$meta['gzip_output'] = ['onoff'];
240$meta['send404'] = ['onoff'];
241$meta['compression'] = ['compression', '_caution' => 'warning'];
242$meta['broken_iua'] = ['onoff'];
243$meta['xsendfile'] = ['multichoice', '_choices' => [0, 1, 2, 3], '_caution' => 'warning'];
244$meta['renderer_xhtml'] = ['renderer', '_format' => 'xhtml', '_choices' => ['xhtml'], '_caution' => 'warning'];
245$meta['readdircache'] = ['numeric'];
246$meta['search_nslimit'] = ['numeric', '_min' => 0];
247$meta['search_fragment'] = ['multichoice', '_choices' => ['exact', 'starts_with', 'ends_with', 'contains']];
248$meta['trustedproxy'] = ['regex'];
249
250$meta['_feature_flags'] = ['fieldset'];
251$meta['defer_js'] = ['onoff'];
252$meta['hidewarnings'] = ['onoff'];
253
254$meta['_network'] = ['fieldset'];
255$meta['dnslookups'] = ['onoff'];
256$meta['jquerycdn'] = ['multichoice', '_choices' => [0, 'jquery', 'cdnjs']];
257$meta['proxy____host'] = ['string', '_pattern' => '#^(|[a-z0-9\-\.+]+)$#i'];
258$meta['proxy____port'] = ['numericopt'];
259$meta['proxy____user'] = ['string'];
260$meta['proxy____pass'] = ['password', '_code' => 'base64'];
261$meta['proxy____ssl'] = ['onoff'];
262$meta['proxy____except'] = ['string'];
263