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