Merge branch 'MDL-69513-dkim-settings' of https://github.com/brendanheywood/moodle
[moodle.git] / admin / settings / server.php
CommitLineData
11b749ca 1<?php
082313fc
DM
2// This file is part of Moodle - https://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * Defines settingpages and externalpages under the "server" category.
19 *
20 * @package core
21 * @category admin
22 * @copyright 2006 Martin Dougiamas
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
26defined('MOODLE_INTERNAL') || die();
27
28if ($hassiteconfig) {
29 // System paths.
30 $temp = new admin_settingpage('systempaths', new lang_string('systempaths', 'admin'));
31 $temp->add(new admin_setting_configexecutable('pathtophp', new lang_string('pathtophp', 'admin'),
32 new lang_string('configpathtophp', 'admin'), ''));
33 $temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'),
34 new lang_string('configpathtodu', 'admin'), ''));
35 $temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'),
36 new lang_string('edhelpaspellpath'), ''));
37 $temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'),
38 new lang_string('pathtodot_help', 'admin'), ''));
39 $temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'),
40 new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
41 $temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'),
42 new lang_string('pathtopythondesc', 'admin'), ''));
43 $ADMIN->add('server', $temp);
1ea1bcb3 44
082313fc
DM
45 // Support contact.
46 $temp = new admin_settingpage('supportcontact', new lang_string('supportcontact', 'admin'));
47 $primaryadmin = get_admin();
48 if ($primaryadmin) {
49 $primaryadminemail = $primaryadmin->email;
50 $primaryadminname = fullname($primaryadmin, true);
51 } else {
52 // No defaults during installation - admin user must be created first.
53 $primaryadminemail = null;
54 $primaryadminname = null;
55 }
56 $temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
57 new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
58 $setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
59 new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL);
60 $setting->set_force_ltr(true);
61 $temp->add($setting);
62 $temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'),
63 new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
64 $ADMIN->add('server', $temp);
859ed92f 65
082313fc
DM
66 // Session handling.
67 $temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin'));
68 if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
69 $temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'),
70 new lang_string('configdbsessions', 'admin'), 0));
71 }
72
73 $temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'),
74 new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60));
75
76 $temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'),
77 new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
78 $temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'),
79 new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
80 $temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'),
81 new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
82 $ADMIN->add('server', $temp);
83
84 // Statistics.
85 $temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
86 $temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'),
87 new lang_string('configstatsfirstrun', 'admin'), 'none',
88 [
89 'none' => new lang_string('none'),
90 60 * 60 * 24 * 7 => new lang_string('numweeks', 'moodle', 1),
91 60 * 60 * 24 * 14 => new lang_string('numweeks', 'moodle', 2),
92 60 * 60 * 24 * 21 => new lang_string('numweeks', 'moodle', 3),
93 60 * 60 * 24 * 28 => new lang_string('nummonths', 'moodle', 1),
94 60 * 60 * 24 * 56 => new lang_string('nummonths', 'moodle', 2),
95 60 * 60 * 24 * 84 => new lang_string('nummonths', 'moodle', 3),
96 60 * 60 * 24 * 112 => new lang_string('nummonths', 'moodle', 4),
97 60 * 60 * 24 * 140 => new lang_string('nummonths', 'moodle', 5),
98 60 * 60 * 24 * 168 => new lang_string('nummonths', 'moodle', 6),
99 'all' => new lang_string('all')
100 ]
101 ));
102 $temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'),
103 new lang_string('configstatsmaxruntime3', 'admin'), 0,
104 [
105 0 => new lang_string('untilcomplete'),
106 60 * 30 => '10 ' . new lang_string('minutes'),
107 60 * 30 => '30 ' . new lang_string('minutes'),
108 60 * 60 => '1 ' . new lang_string('hour'),
109 60 * 60 * 2 => '2 ' . new lang_string('hours'),
110 60 * 60 * 3 => '3 ' . new lang_string('hours'),
111 60 * 60 * 4 => '4 ' . new lang_string('hours'),
112 60 * 60 * 5 => '5 ' . new lang_string('hours'),
113 60 * 60 * 6 => '6 ' . new lang_string('hours'),
114 60 * 60 * 7 => '7 ' . new lang_string('hours'),
115 60 * 60 * 8 => '8 ' . new lang_string('hours'),
116 ]
117 ));
118 $temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'),
119 new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
120 $temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'),
121 new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
122 $ADMIN->add('server', $temp);
123
124 // HTTP.
125 $temp = new admin_settingpage('http', new lang_string('http', 'admin'));
126 $temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'),
127 new lang_string('configslasharguments', 'admin'), 1));
128 $temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', ''));
129 $options = [
130 0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
131 GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
132 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
133 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR'
134 ];
135 $temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'),
136 new lang_string('configgetremoteaddrconf', 'admin'),
137 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP, $options));
138 $temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'),
139 new lang_string('configreverseproxyignore', 'admin'), ''));
140
141 $temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'),
142 new lang_string('webproxyinfo', 'admin')));
143 $temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'),
144 new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
145 $temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'),
146 new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
147 $options = ['HTTP' => 'HTTP'];
148 if (defined('CURLPROXY_SOCKS5')) {
149 $options['SOCKS5'] = 'SOCKS5';
150 }
151 $temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'),
152 new lang_string('configproxytype', 'admin'), 'HTTP', $options));
153 $temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'),
154 new lang_string('configproxyuser', 'admin'), ''));
155 $temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'),
156 new lang_string('configproxypassword', 'admin'), ''));
157 $temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'),
158 new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
159 $ADMIN->add('server', $temp);
160
161 $temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin'));
162 $options = [0 => new lang_string('disable'), 1 => new lang_string('enable')];
163 $temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'),
164 new lang_string('helpsitemaintenance', 'admin'), 0, $options));
165 $temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'),
166 '', ''));
167 $ADMIN->add('server', $temp);
168
169 // Cleanup.
170 $temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin'));
171 $temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'),
172 new lang_string('configdeleteunconfirmed', 'admin'), 168,
173 [
174 0 => new lang_string('never'),
175 168 => new lang_string('numdays', '', 7),
176 144 => new lang_string('numdays', '', 6),
177 120 => new lang_string('numdays', '', 5),
178 96 => new lang_string('numdays', '', 4),
179 72 => new lang_string('numdays', '', 3),
180 48 => new lang_string('numdays', '', 2),
181 24 => new lang_string('numdays', '', 1),
182 12 => new lang_string('numhours', '', 12),
183 6 => new lang_string('numhours', '', 6),
184 1 => new lang_string('numhours', '', 1),
185 ]
186 ));
187
188 $temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'),
189 new lang_string('configdeleteincompleteusers', 'admin'), 0,
190 [
191 0 => new lang_string('never'),
192 168 => new lang_string('numdays', '', 7),
193 144 => new lang_string('numdays', '', 6),
194 120 => new lang_string('numdays', '', 5),
195 96 => new lang_string('numdays', '', 4),
196 72 => new lang_string('numdays', '', 3),
197 48 => new lang_string('numdays', '', 2),
198 24 => new lang_string('numdays', '', 1),
199 ]
200 ));
201
202 $temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
203 new lang_string('disablegradehistory_help', 'grades'), 0));
204
205 $temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'),
206 new lang_string('gradehistorylifetime_help', 'grades'), 0,
207 [
208 0 => new lang_string('neverdeletehistory', 'grades'),
209 1000 => new lang_string('numdays', '', 1000),
210 365 => new lang_string('numdays', '', 365),
211 180 => new lang_string('numdays', '', 180),
212 150 => new lang_string('numdays', '', 150),
213 120 => new lang_string('numdays', '', 120),
214 90 => new lang_string('numdays', '', 90),
215 60 => new lang_string('numdays', '', 60),
216 30 => new lang_string('numdays', '', 30),
217 ]
218 ));
219
220 $temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
221 new lang_string('configtempdatafoldercleanup', 'admin'), 168,
222 [
c35d736a
AG
223 1 => new lang_string('numhours', '', 1),
224 3 => new lang_string('numhours', '', 3),
225 6 => new lang_string('numhours', '', 6),
226 9 => new lang_string('numhours', '', 9),
227 12 => new lang_string('numhours', '', 12),
228 18 => new lang_string('numhours', '', 18),
229 24 => new lang_string('numhours', '', 24),
230 48 => new lang_string('numdays', '', 2),
231 168 => new lang_string('numdays', '', 7),
082313fc
DM
232 ]
233 ));
c35d736a 234
082313fc 235 $ADMIN->add('server', $temp);
1ea1bcb3 236
d7e4481e
MP
237 $temp->add(new admin_setting_configduration('filescleanupperiod',
238 new lang_string('filescleanupperiod', 'admin'),
239 new lang_string('filescleanupperiod_help', 'admin'),
240 86400));
1ea1bcb3 241
082313fc
DM
242 // Environment.
243 $ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment', 'admin'),
244 "{$CFG->wwwroot}/{$CFG->admin}/environment.php"));
245
246 // PHP info.
247 $ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'),
248 "{$CFG->wwwroot}/{$CFG->admin}/phpinfo.php"));
249
250 // Test outgoing mail configuration (hidden, accessed via direct link from the settings page).
251 $ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'),
252 new moodle_url('/admin/testoutgoingmailconf.php'), 'moodle/site:config', true));
253
254 // Performance.
255 $temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
256
257 // Memory limit options for large administration tasks.
258 $memoryoptions = [
259 '64M' => '64M',
260 '128M' => '128M',
261 '256M' => '256M',
262 '512M' => '512M',
263 '1024M' => '1024M',
264 '2048M' => '2048M',
265 ];
266
267 // Allow larger memory usage for 64-bit sites only.
268 if (PHP_INT_SIZE === 8) {
269 $memoryoptions['3072M'] = '3072M';
270 $memoryoptions['4096M'] = '4096M';
271 }
272
273 $temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
274 new lang_string('configextramemorylimit', 'admin'), '512M', $memoryoptions));
275
276 $temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
277 new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT));
1ea1bcb3 278
082313fc
DM
279 $temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
280 new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
1ea1bcb3 281
082313fc
DM
282 $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'),
283 new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
7022dd39 284
082313fc 285 $ADMIN->add('server', $temp);
975f8442 286
082313fc
DM
287 // Tasks.
288 $ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
975f8442 289
082313fc
DM
290 // Task processing.
291 $temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing', 'admin'));
975f8442 292
082313fc
DM
293 $setting = new admin_setting_configcheckbox(
294 'cron_enabled',
295 new lang_string('cron_enabled', 'admin'),
296 new lang_string('cron_enabled_desc', 'admin'),
e044c3de 297 1
082313fc
DM
298 );
299 $setting->set_updatedcallback('theme_reset_static_caches');
300 $temp->add($setting);
301
302 $temp->add(
303 new admin_setting_configtext(
304 'task_scheduled_concurrency_limit',
305 new lang_string('task_scheduled_concurrency_limit', 'admin'),
306 new lang_string('task_scheduled_concurrency_limit_desc', 'admin'),
307 3,
308 PARAM_INT
309 )
310 );
4b71596f 311
4b71596f
AN
312 $temp->add(
313 new admin_setting_configduration(
082313fc
DM
314 'task_scheduled_max_runtime',
315 new lang_string('task_scheduled_max_runtime', 'admin'),
316 new lang_string('task_scheduled_max_runtime_desc', 'admin'),
317 30 * MINSECS
4b71596f
AN
318 )
319 );
320
321 $temp->add(
322 new admin_setting_configtext(
082313fc
DM
323 'task_adhoc_concurrency_limit',
324 new lang_string('task_adhoc_concurrency_limit', 'admin'),
325 new lang_string('task_adhoc_concurrency_limit_desc', 'admin'),
326 3,
4b71596f
AN
327 PARAM_INT
328 )
329 );
4b71596f 330
082313fc
DM
331 $temp->add(
332 new admin_setting_configduration(
333 'task_adhoc_max_runtime',
334 new lang_string('task_adhoc_max_runtime', 'admin'),
335 new lang_string('task_adhoc_max_runtime_desc', 'admin'),
336 30 * MINSECS
337 )
338 );
339 $ADMIN->add('taskconfig', $temp);
8c69e86c 340
082313fc
DM
341 // Task log configuration.
342 $temp = new admin_settingpage('tasklogging', new lang_string('tasklogging', 'admin'));
343 $temp->add(
344 new admin_setting_configselect(
345 'task_logmode',
346 new lang_string('task_logmode', 'admin'),
347 new lang_string('task_logmode_desc', 'admin'),
348 \core\task\logmanager::MODE_ALL,
349 [
350 \core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'),
351 \core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'),
352 \core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'),
353 ]
354 )
355 );
356 $temp->add(
357 new admin_setting_configcheckbox(
358 'task_logtostdout',
359 new lang_string('task_logtostdout', 'admin'),
360 new lang_string('task_logtostdout_desc', 'admin'),
361 1
362 )
363 );
364
365 if (\core\task\logmanager::uses_standard_settings()) {
366 $temp->add(
367 new admin_setting_configduration(
368 'task_logretention',
369 new \lang_string('task_logretention', 'admin'),
370 new \lang_string('task_logretention_desc', 'admin'),
371 28 * DAYSECS
372 )
373 );
374
375 $temp->add(
376 new admin_setting_configtext(
377 'task_logretainruns',
378 new \lang_string('task_logretainruns', 'admin'),
379 new \lang_string('task_logretainruns_desc', 'admin'),
380 20,
381 PARAM_INT
382 )
383 );
384 }
385 $ADMIN->add('taskconfig', $temp);
386
387 // Task logs.
388 if (\core\task\logmanager::uses_standard_settings()) {
389 $ADMIN->add('taskconfig', new admin_externalpage(
390 'tasklogs',
391 new lang_string('tasklogs', 'admin'),
392 "{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php"
393 ));
394 }
395
396 // Email.
397 $ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
398
399 // Outgoing mail configuration.
400 $temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
401
402 $temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
403 new lang_string('smtpdetail', 'admin')));
404
405 $temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
406 new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
407
408 $options = [
409 '' => new lang_string('none', 'admin'),
410 'ssl' => 'SSL',
411 'tls' => 'TLS',
412 ];
413
414 $temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
415 new lang_string('configsmtpsecure', 'admin'), '', $options));
416
417 $authtypeoptions = [
418 'LOGIN' => 'LOGIN',
419 'PLAIN' => 'PLAIN',
420 'NTLM' => 'NTLM',
421 'CRAM-MD5' => 'CRAM-MD5',
422 ];
423
424 $temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
425 new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
426
427 $temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
428 new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
429
430 $temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
431 new lang_string('configsmtpuser', 'admin'), ''));
432
433 $temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
434 new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
435
436 $temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
9715f61a 437 new lang_string('noreplydomaindetail', 'admin')));
082313fc
DM
438
439 $temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
440 new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL));
441
442 $temp->add(new admin_setting_configtextarea('allowedemaildomains',
9715f61a
AG
443 new lang_string('allowedemaildomains', 'admin'),
444 new lang_string('configallowedemaildomains', 'admin'),
445 ''));
082313fc 446
0983a1c3
BH
447 $temp->add(new admin_setting_heading('divertallemailsheading', new lang_string('divertallemails', 'admin'),
448 new lang_string('divertallemailsdetail', 'admin')));
449 $temp->add(new admin_setting_configtext('divertallemailsto',
450 new lang_string('divertallemailsto', 'admin'),
451 new lang_string('divertallemailsto_desc', 'admin'),
452 ''));
453 $temp->add(new admin_setting_configtextarea('divertallemailsexcept',
454 new lang_string('divertallemailsexcept', 'admin'),
455 new lang_string('divertallemailsexcept_desc', 'admin'),
456 '', PARAM_RAW, '50', '4'));
457
1b47d4bc
BH
458 $noreplyaddress = isset($CFG->noreplyaddress) ? $CFG->noreplyaddress : 'noreply@example.com';
459 $dkimdomain = substr(strrchr($noreplyaddress, "@"), 1);
460 $dkimselector = empty($CFG->emaildkimselector) ? '[selector]' : $CFG->emaildkimselector;
3e6892af 461 $pempath = "\$CFG->dataroot/dkim/{$dkimdomain}/{$dkimselector}.private";
1b47d4bc
BH
462 $temp->add(new admin_setting_heading('emaildkim', new lang_string('emaildkim', 'admin'),
463 new lang_string('emaildkiminfo', 'admin', ['path' => $pempath, 'docs' => \get_docs_url('Mail_configuration#DKIM')])));
464 $temp->add(new admin_setting_configtext('emaildkimselector', new lang_string('emaildkimselector', 'admin'),
465 new lang_string('configemaildkimselector', 'admin'), '', PARAM_FILE));
466
082313fc
DM
467 $url = new moodle_url('/admin/testoutgoingmailconf.php');
468 $link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin'));
469 $temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'),
2bf67a74 470 new lang_string('testoutgoingmaildetail', 'admin', $link)));
082313fc
DM
471
472 $temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
9715f61a 473 new lang_string('doesnotfitdetail', 'admin')));
082313fc
DM
474
475 $charsets = get_list_of_charsets();
476 unset($charsets['UTF-8']);
477 $options = [
478 '0' => 'UTF-8',
479 ];
480 $options = array_merge($options, $charsets);
481 $temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
482 new lang_string('configsitemailcharset', 'admin'), '0', $options));
483
484 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
485 new lang_string('configallowusermailcharset', 'admin'), 0));
486
487 $temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
488 new lang_string('configallowattachments', 'admin'), 1));
489
490 $options = [
491 'LF' => 'LF',
492 'CRLF' => 'CRLF',
493 ];
494 $temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
495 new lang_string('configmailnewline', 'admin'), 'LF', $options));
496
497 $choices = [
498 new lang_string('never', 'admin'),
499 new lang_string('always', 'admin'),
500 new lang_string('onlynoreply', 'admin'),
501 ];
502 $temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
503 new lang_string('configemailfromvia', 'admin'), 1, $choices));
504
505 $temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
9ffbb786 506 new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW));
082313fc
DM
507
508 $temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'),
0f898849 509 new lang_string('configemailheaders', 'admin'), '', PARAM_RAW, '50', '3'));
9715f61a 510
082313fc
DM
511 $ADMIN->add('email', $temp);
512
513 // Update notifications.
514 if (empty($CFG->disableupdatenotifications)) {
515 $temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
516 $temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
517 new lang_string('updateautocheck_desc', 'core_admin'), 1));
518 $temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
519 new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
520 [
521 MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
522 MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
523 MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
524 MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
525 ]
526 ));
527 $temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
528 new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
529 $ADMIN->add('server', $temp);
530 }
4fb3a068 531}