Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
1 <?php 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 26 defined('MOODLE_INTERNAL') || die(); 27 28 if ($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('pathtopdftoppm', new lang_string('pathtopdftoppm', 'admin'), 42 new lang_string('pathtopdftoppm_help', 'admin'), '')); 43 $temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'), 44 new lang_string('pathtopythondesc', 'admin'), '')); 45 $ADMIN->add('server', $temp); 46 47 // Support contact. 48 $temp = new admin_settingpage('supportcontact', new lang_string('supportcontact', 'admin')); 49 $primaryadmin = get_admin(); 50 if ($primaryadmin) { 51 $primaryadminemail = $primaryadmin->email; 52 $primaryadminname = fullname($primaryadmin, true); 53 } else { 54 // No defaults during installation - admin user must be created first. 55 $primaryadminemail = null; 56 $primaryadminname = null; 57 } 58 $temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'), 59 new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS)); 60 $setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'), 61 new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL); 62 $setting->set_force_ltr(true); 63 $temp->add($setting); 64 $temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), 65 new lang_string('configsupportpage', 'admin'), '', PARAM_URL)); 66 $ADMIN->add('server', $temp); 67 68 // Session handling. 69 $temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin')); 70 if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) { 71 $temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'), 72 new lang_string('configdbsessions', 'admin'), 0)); 73 } 74 75 $temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'), 76 new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60)); 77 78 $sessiontimeoutwarning = new admin_setting_configduration('sessiontimeoutwarning', 79 new lang_string('sessiontimeoutwarning', 'admin'), 80 new lang_string('configsessiontimeoutwarning', 'admin'), 20 * 60); 81 82 $sessiontimeoutwarning->set_validate_function(function(int $value): string { 83 global $CFG; 84 // Check sessiontimeoutwarning is less than sessiontimeout. 85 if ($CFG->sessiontimeout <= $value) { 86 return get_string('configsessiontimeoutwarningcheck', 'admin'); 87 } else { 88 return ''; 89 } 90 }); 91 92 $temp->add($sessiontimeoutwarning); 93 94 $temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'), 95 new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM)); 96 $temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'), 97 new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW)); 98 $temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'), 99 new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50)); 100 $ADMIN->add('server', $temp); 101 102 // Statistics. 103 $temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats)); 104 $temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'), 105 new lang_string('configstatsfirstrun', 'admin'), 'none', 106 [ 107 'none' => new lang_string('none'), 108 60 * 60 * 24 * 7 => new lang_string('numweeks', 'moodle', 1), 109 60 * 60 * 24 * 14 => new lang_string('numweeks', 'moodle', 2), 110 60 * 60 * 24 * 21 => new lang_string('numweeks', 'moodle', 3), 111 60 * 60 * 24 * 28 => new lang_string('nummonths', 'moodle', 1), 112 60 * 60 * 24 * 56 => new lang_string('nummonths', 'moodle', 2), 113 60 * 60 * 24 * 84 => new lang_string('nummonths', 'moodle', 3), 114 60 * 60 * 24 * 112 => new lang_string('nummonths', 'moodle', 4), 115 60 * 60 * 24 * 140 => new lang_string('nummonths', 'moodle', 5), 116 60 * 60 * 24 * 168 => new lang_string('nummonths', 'moodle', 6), 117 'all' => new lang_string('all') 118 ] 119 )); 120 $temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'), 121 new lang_string('configstatsmaxruntime3', 'admin'), 0, 122 [ 123 0 => new lang_string('untilcomplete'), 124 60 * 30 => '10 ' . new lang_string('minutes'), 125 60 * 30 => '30 ' . new lang_string('minutes'), 126 60 * 60 => '1 ' . new lang_string('hour'), 127 60 * 60 * 2 => '2 ' . new lang_string('hours'), 128 60 * 60 * 3 => '3 ' . new lang_string('hours'), 129 60 * 60 * 4 => '4 ' . new lang_string('hours'), 130 60 * 60 * 5 => '5 ' . new lang_string('hours'), 131 60 * 60 * 6 => '6 ' . new lang_string('hours'), 132 60 * 60 * 7 => '7 ' . new lang_string('hours'), 133 60 * 60 * 8 => '8 ' . new lang_string('hours'), 134 ] 135 )); 136 $temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'), 137 new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT)); 138 $temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'), 139 new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT)); 140 $ADMIN->add('server', $temp); 141 142 // HTTP. 143 $temp = new admin_settingpage('http', new lang_string('http', 'admin')); 144 $temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'), 145 new lang_string('configslasharguments', 'admin'), 1)); 146 $temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', '')); 147 $options = [ 148 0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR', 149 GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR', 150 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR', 151 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR' 152 ]; 153 $temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'), 154 new lang_string('configgetremoteaddrconf', 'admin'), 155 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP, $options)); 156 $temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'), 157 new lang_string('configreverseproxyignore', 'admin'), '')); 158 159 $temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'), 160 new lang_string('webproxyinfo', 'admin'))); 161 $temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'), 162 new lang_string('configproxyhost', 'admin'), '', PARAM_HOST)); 163 $temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'), 164 new lang_string('configproxyport', 'admin'), 0, PARAM_INT)); 165 $options = ['HTTP' => 'HTTP']; 166 if (defined('CURLPROXY_SOCKS5')) { 167 $options['SOCKS5'] = 'SOCKS5'; 168 } 169 $temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'), 170 new lang_string('configproxytype', 'admin'), 'HTTP', $options)); 171 $temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'), 172 new lang_string('configproxyuser', 'admin'), '')); 173 $temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'), 174 new lang_string('configproxypassword', 'admin'), '')); 175 $temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'), 176 new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1')); 177 $ADMIN->add('server', $temp); 178 179 $temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin')); 180 $options = [0 => new lang_string('disable'), 1 => new lang_string('enable')]; 181 $temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'), 182 new lang_string('helpsitemaintenance', 'admin'), 0, $options)); 183 $temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'), 184 '', '')); 185 $ADMIN->add('server', $temp); 186 187 // Cleanup. 188 $temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin')); 189 $temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'), 190 new lang_string('configdeleteunconfirmed', 'admin'), 168, 191 [ 192 0 => new lang_string('never'), 193 168 => new lang_string('numdays', '', 7), 194 144 => new lang_string('numdays', '', 6), 195 120 => new lang_string('numdays', '', 5), 196 96 => new lang_string('numdays', '', 4), 197 72 => new lang_string('numdays', '', 3), 198 48 => new lang_string('numdays', '', 2), 199 24 => new lang_string('numdays', '', 1), 200 12 => new lang_string('numhours', '', 12), 201 6 => new lang_string('numhours', '', 6), 202 1 => new lang_string('numhours', '', 1), 203 ] 204 )); 205 206 $temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'), 207 new lang_string('configdeleteincompleteusers', 'admin'), 0, 208 [ 209 0 => new lang_string('never'), 210 168 => new lang_string('numdays', '', 7), 211 144 => new lang_string('numdays', '', 6), 212 120 => new lang_string('numdays', '', 5), 213 96 => new lang_string('numdays', '', 4), 214 72 => new lang_string('numdays', '', 3), 215 48 => new lang_string('numdays', '', 2), 216 24 => new lang_string('numdays', '', 1), 217 ] 218 )); 219 220 $temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'), 221 new lang_string('disablegradehistory_help', 'grades'), 0)); 222 223 $temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'), 224 new lang_string('gradehistorylifetime_help', 'grades'), 0, 225 [ 226 0 => new lang_string('neverdeletehistory', 'grades'), 227 1000 => new lang_string('numdays', '', 1000), 228 365 => new lang_string('numdays', '', 365), 229 180 => new lang_string('numdays', '', 180), 230 150 => new lang_string('numdays', '', 150), 231 120 => new lang_string('numdays', '', 120), 232 90 => new lang_string('numdays', '', 90), 233 60 => new lang_string('numdays', '', 60), 234 30 => new lang_string('numdays', '', 30), 235 ] 236 )); 237 238 $temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'), 239 new lang_string('configtempdatafoldercleanup', 'admin'), 168, 240 [ 241 1 => new lang_string('numhours', '', 1), 242 3 => new lang_string('numhours', '', 3), 243 6 => new lang_string('numhours', '', 6), 244 9 => new lang_string('numhours', '', 9), 245 12 => new lang_string('numhours', '', 12), 246 18 => new lang_string('numhours', '', 18), 247 24 => new lang_string('numhours', '', 24), 248 48 => new lang_string('numdays', '', 2), 249 168 => new lang_string('numdays', '', 7), 250 ] 251 )); 252 253 $ADMIN->add('server', $temp); 254 255 $temp->add(new admin_setting_configduration('filescleanupperiod', 256 new lang_string('filescleanupperiod', 'admin'), 257 new lang_string('filescleanupperiod_help', 'admin'), 258 86400)); 259 260 // Environment. 261 $ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment', 'admin'), 262 "{$CFG->wwwroot}/{$CFG->admin}/environment.php")); 263 264 // PHP info. 265 $ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'), 266 "{$CFG->wwwroot}/{$CFG->admin}/phpinfo.php")); 267 268 // Test outgoing mail configuration (hidden, accessed via direct link from the settings page). 269 $ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'), 270 new moodle_url('/admin/testoutgoingmailconf.php'), 'moodle/site:config', true)); 271 272 // Performance. 273 $temp = new admin_settingpage('performance', new lang_string('performance', 'admin')); 274 275 // Memory limit options for large administration tasks. 276 $memoryoptions = [ 277 '64M' => '64M', 278 '128M' => '128M', 279 '256M' => '256M', 280 '512M' => '512M', 281 '1024M' => '1024M', 282 '2048M' => '2048M', 283 ]; 284 285 // Allow larger memory usage for 64-bit sites only. 286 if (PHP_INT_SIZE === 8) { 287 $memoryoptions['3072M'] = '3072M'; 288 $memoryoptions['4096M'] = '4096M'; 289 } 290 291 $temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'), 292 new lang_string('configextramemorylimit', 'admin'), '512M', $memoryoptions)); 293 294 $temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'), 295 new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT)); 296 297 $temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'), 298 new lang_string('configcurlcache', 'admin'), 120, PARAM_INT)); 299 300 $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'), 301 new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT)); 302 303 $ADMIN->add('server', $temp); 304 305 // Tasks. 306 $ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin'))); 307 308 // Task processing. 309 $temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing', 'admin')); 310 311 $setting = new admin_setting_configcheckbox( 312 'cron_enabled', 313 new lang_string('cron_enabled', 'admin'), 314 new lang_string('cron_enabled_desc', 'admin'), 315 1 316 ); 317 $setting->set_updatedcallback('theme_reset_static_caches'); 318 $temp->add($setting); 319 320 $temp->add( 321 new admin_setting_configtext( 322 'task_scheduled_concurrency_limit', 323 new lang_string('task_scheduled_concurrency_limit', 'admin'), 324 new lang_string('task_scheduled_concurrency_limit_desc', 'admin'), 325 3, 326 PARAM_INT 327 ) 328 ); 329 330 $temp->add( 331 new admin_setting_configduration( 332 'task_scheduled_max_runtime', 333 new lang_string('task_scheduled_max_runtime', 'admin'), 334 new lang_string('task_scheduled_max_runtime_desc', 'admin'), 335 30 * MINSECS 336 ) 337 ); 338 339 $temp->add( 340 new admin_setting_configtext( 341 'task_adhoc_concurrency_limit', 342 new lang_string('task_adhoc_concurrency_limit', 'admin'), 343 new lang_string('task_adhoc_concurrency_limit_desc', 'admin'), 344 3, 345 PARAM_INT 346 ) 347 ); 348 349 $temp->add( 350 new admin_setting_configduration( 351 'task_adhoc_max_runtime', 352 new lang_string('task_adhoc_max_runtime', 'admin'), 353 new lang_string('task_adhoc_max_runtime_desc', 'admin'), 354 30 * MINSECS 355 ) 356 ); 357 $ADMIN->add('taskconfig', $temp); 358 359 // Task log configuration. 360 $temp = new admin_settingpage('tasklogging', new lang_string('tasklogging', 'admin')); 361 $temp->add( 362 new admin_setting_configselect( 363 'task_logmode', 364 new lang_string('task_logmode', 'admin'), 365 new lang_string('task_logmode_desc', 'admin'), 366 \core\task\logmanager::MODE_ALL, 367 [ 368 \core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'), 369 \core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'), 370 \core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'), 371 ] 372 ) 373 ); 374 $temp->add( 375 new admin_setting_configcheckbox( 376 'task_logtostdout', 377 new lang_string('task_logtostdout', 'admin'), 378 new lang_string('task_logtostdout_desc', 'admin'), 379 1 380 ) 381 ); 382 383 if (\core\task\logmanager::uses_standard_settings()) { 384 $temp->add( 385 new admin_setting_configduration( 386 'task_logretention', 387 new \lang_string('task_logretention', 'admin'), 388 new \lang_string('task_logretention_desc', 'admin'), 389 28 * DAYSECS 390 ) 391 ); 392 393 $temp->add( 394 new admin_setting_configtext( 395 'task_logretainruns', 396 new \lang_string('task_logretainruns', 'admin'), 397 new \lang_string('task_logretainruns_desc', 'admin'), 398 20, 399 PARAM_INT 400 ) 401 ); 402 } 403 $ADMIN->add('taskconfig', $temp); 404 405 // Task logs. 406 if (\core\task\logmanager::uses_standard_settings()) { 407 $ADMIN->add('taskconfig', new admin_externalpage( 408 'tasklogs', 409 new lang_string('tasklogs', 'admin'), 410 "{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php" 411 )); 412 } 413 414 // Email. 415 $ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin'))); 416 417 // Outgoing mail configuration. 418 $temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin')); 419 420 $temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'), 421 new lang_string('smtpdetail', 'admin'))); 422 423 $temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'), 424 new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW)); 425 426 $options = [ 427 '' => new lang_string('none', 'admin'), 428 'ssl' => 'SSL', 429 'tls' => 'TLS', 430 ]; 431 432 $temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'), 433 new lang_string('configsmtpsecure', 'admin'), '', $options)); 434 435 $authtypeoptions = [ 436 'LOGIN' => 'LOGIN', 437 'PLAIN' => 'PLAIN', 438 'NTLM' => 'NTLM', 439 'CRAM-MD5' => 'CRAM-MD5', 440 ]; 441 442 $temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'), 443 new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions)); 444 445 $temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'), 446 new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS)); 447 448 $temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'), 449 new lang_string('configsmtpuser', 'admin'), '')); 450 451 $temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'), 452 new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT)); 453 454 $temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'), 455 new lang_string('noreplydomaindetail', 'admin'))); 456 457 $temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'), 458 new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL)); 459 460 $temp->add(new admin_setting_configtextarea('allowedemaildomains', 461 new lang_string('allowedemaildomains', 'admin'), 462 new lang_string('configallowedemaildomains', 'admin'), 463 '')); 464 465 $temp->add(new admin_setting_heading('divertallemailsheading', new lang_string('divertallemails', 'admin'), 466 new lang_string('divertallemailsdetail', 'admin'))); 467 $temp->add(new admin_setting_configtext('divertallemailsto', 468 new lang_string('divertallemailsto', 'admin'), 469 new lang_string('divertallemailsto_desc', 'admin'), 470 '')); 471 $temp->add(new admin_setting_configtextarea('divertallemailsexcept', 472 new lang_string('divertallemailsexcept', 'admin'), 473 new lang_string('divertallemailsexcept_desc', 'admin'), 474 '', PARAM_RAW, '50', '4')); 475 476 $noreplyaddress = isset($CFG->noreplyaddress) ? $CFG->noreplyaddress : 'noreply@example.com'; 477 $dkimdomain = substr(strrchr($noreplyaddress, "@"), 1); 478 $dkimselector = empty($CFG->emaildkimselector) ? '[selector]' : $CFG->emaildkimselector; 479 $pempath = "\$CFG->dataroot/dkim/{$dkimdomain}/{$dkimselector}.private"; 480 $temp->add(new admin_setting_heading('emaildkim', new lang_string('emaildkim', 'admin'), 481 new lang_string('emaildkiminfo', 'admin', ['path' => $pempath, 'docs' => \get_docs_url('Mail_configuration#DKIM')]))); 482 $temp->add(new admin_setting_configtext('emaildkimselector', new lang_string('emaildkimselector', 'admin'), 483 new lang_string('configemaildkimselector', 'admin'), '', PARAM_FILE)); 484 485 $url = new moodle_url('/admin/testoutgoingmailconf.php'); 486 $link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin')); 487 $temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'), 488 new lang_string('testoutgoingmaildetail', 'admin', $link))); 489 490 $temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'), 491 new lang_string('doesnotfitdetail', 'admin'))); 492 493 $charsets = get_list_of_charsets(); 494 unset($charsets['UTF-8']); 495 $options = [ 496 '0' => 'UTF-8', 497 ]; 498 $options = array_merge($options, $charsets); 499 $temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'), 500 new lang_string('configsitemailcharset', 'admin'), '0', $options)); 501 502 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'), 503 new lang_string('configallowusermailcharset', 'admin'), 0)); 504 505 $temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'), 506 new lang_string('configallowattachments', 'admin'), 1)); 507 508 $options = [ 509 'LF' => 'LF', 510 'CRLF' => 'CRLF', 511 ]; 512 $temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'), 513 new lang_string('configmailnewline', 'admin'), 'LF', $options)); 514 515 $choices = [ 516 new lang_string('never', 'admin'), 517 new lang_string('always', 'admin'), 518 new lang_string('onlynoreply', 'admin'), 519 ]; 520 $temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'), 521 new lang_string('configemailfromvia', 'admin'), 1, $choices)); 522 523 $temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'), 524 new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW)); 525 526 $temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'), 527 new lang_string('configemailheaders', 'admin'), '', PARAM_RAW, '50', '3')); 528 529 $ADMIN->add('email', $temp); 530 531 // Update notifications. 532 if (empty($CFG->disableupdatenotifications)) { 533 $temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin')); 534 $temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'), 535 new lang_string('updateautocheck_desc', 'core_admin'), 1)); 536 $temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'), 537 new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE, 538 [ 539 MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'), 540 MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'), 541 MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'), 542 MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'), 543 ] 544 )); 545 $temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'), 546 new lang_string('updatenotifybuilds_desc', 'core_admin'), 0)); 547 $ADMIN->add('server', $temp); 548 } 549 550 // Web services. 551 $ADMIN->add('server', new admin_category('webservicesettings', new lang_string('webservices', 'webservice'))); 552 553 // Web services > Overview. 554 $temp = new admin_settingpage('webservicesoverview', new lang_string('webservicesoverview', 'webservice')); 555 $temp->add(new admin_setting_webservicesoverview()); 556 $ADMIN->add('webservicesettings', $temp); 557 558 // Web services > API documentation. 559 $ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'), 560 "{$CFG->wwwroot}/{$CFG->admin}/webservice/documentation.php", 'moodle/site:config', false)); 561 562 // Web services > External services. 563 $temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice')); 564 565 $temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'), 566 new lang_string('servicehelpexplanation', 'webservice'))); 567 568 $temp->add(new admin_setting_manageexternalservices()); 569 570 $ADMIN->add('webservicesettings', $temp); 571 572 $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', new lang_string('editaservice', 'webservice'), 573 "{$CFG->wwwroot}/{$CFG->admin}/webservice/service.php", 'moodle/site:config', true)); 574 575 $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', 576 new lang_string('externalservicefunctions', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_functions.php", 577 'moodle/site:config', true)); 578 579 $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', 580 new lang_string('externalserviceusers', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_users.php", 581 'moodle/site:config', true)); 582 583 $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusersettings', 584 new lang_string('serviceusersettings', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_user_settings.php", 585 'moodle/site:config', true)); 586 587 // Web services > Manage protocols. 588 $temp = new admin_settingpage('webserviceprotocols', new lang_string('manageprotocols', 'webservice')); 589 $temp->add(new admin_setting_managewebserviceprotocols()); 590 if (empty($CFG->enablewebservices)) { 591 $temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice'))); 592 } 593 594 // We cannot use $OUTPUT->doc_link() this early, we would lose the ability to set the page layout on all admin pages. 595 $url = new moodle_url(get_docs_url('How_to_get_a_security_key')); 596 $wsdoclink = html_writer::link($url, new lang_string('supplyinfo', 'webservice'), ['target' => '_blank']); 597 $temp->add(new admin_setting_configcheckbox('enablewsdocumentation', new lang_string('enablewsdocumentation', 'admin'), 598 new lang_string('configenablewsdocumentation', 'admin', $wsdoclink), false)); 599 600 $ADMIN->add('webservicesettings', $temp); 601 602 $plugins = core_plugin_manager::instance()->get_plugins_of_type('webservice'); 603 core_collator::asort_objects_by_property($plugins, 'displayname'); 604 foreach ($plugins as $plugin) { 605 /** @var \core\plugininfo\webservice $plugin */ 606 $plugin->load_settings($ADMIN, 'webservicesettings', $hassiteconfig); 607 } 608 609 // Web services > Manage tokens. 610 $ADMIN->add('webservicesettings', new admin_externalpage('webservicetokens', new lang_string('managetokens', 'webservice'), 611 new moodle_url('/admin/webservice/tokens.php'))); 612 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body