MDL-23692 forgotpw: Move redirection logic to fn.
[moodle.git] / admin / settings / security.php
CommitLineData
11b749ca 1<?php
1ea1bcb3 2
a559f630 3if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
1ea1bcb3 4
5035228f 5 // "ip blocker" settingpage
e106013f
SH
6 $temp = new admin_settingpage('ipblocker', new lang_string('ipblocker', 'admin'));
7 $temp->add(new admin_setting_configcheckbox('allowbeforeblock', new lang_string('allowbeforeblock', 'admin'), new lang_string('allowbeforeblockdesc', 'admin'), 0));
8 $temp->add(new admin_setting_configiplist('allowedip', new lang_string('allowediplist', 'admin'),
9 new lang_string('ipblockersyntax', 'admin'), ''));
10 $temp->add(new admin_setting_configiplist('blockedip', new lang_string('blockediplist', 'admin'),
11 new lang_string('ipblockersyntax', 'admin'), ''));
5035228f 12 $ADMIN->add('security', $temp);
24350e06 13
220a90c5 14 // "sitepolicies" settingpage
e106013f
SH
15 $temp = new admin_settingpage('sitepolicies', new lang_string('sitepolicies', 'admin'));
16 $temp->add(new admin_setting_configcheckbox('protectusernames', new lang_string('protectusernames', 'admin'), new lang_string('configprotectusernames', 'admin'), 1));
17 $temp->add(new admin_setting_configcheckbox('forcelogin', new lang_string('forcelogin', 'admin'), new lang_string('configforcelogin', 'admin'), 0));
18 $temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
bb2308a3 19 $temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
e106013f 20 $temp->add(new admin_setting_configcheckbox('opentogoogle', new lang_string('opentogoogle', 'admin'), new lang_string('configopentogoogle', 'admin'), 0));
4f0c2d00 21 $temp->add(new admin_setting_pickroles('profileroles',
e106013f
SH
22 new lang_string('profileroles','admin'),
23 new lang_string('configprofileroles', 'admin'),
4f0c2d00 24 array('student', 'teacher', 'editingteacher')));
ea1780ad 25
c9c01f75
DW
26 $maxbytes = 0;
27 if (!empty($CFG->maxbytes)) {
28 $maxbytes = $CFG->maxbytes;
29 }
30 $max_upload_choices = get_max_upload_sizes(0, 0, 0, $maxbytes);
eab8ed9f 31 // maxbytes set to 0 will allow the maximum server limit for uploads
e106013f 32 $temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
ea1780ad
DC
33 // 100MB
34 $defaultuserquota = 104857600;
6bdfef5d 35 $params = new stdClass();
ea1780ad
DC
36 $params->bytes = $defaultuserquota;
37 $params->displaysize = display_size($defaultuserquota);
e106013f
SH
38 $temp->add(new admin_setting_configtext('userquota', new lang_string('userquota', 'admin'), new lang_string('configuserquota', 'admin', $params), $defaultuserquota));
39
40 $temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
41 $temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
42 $temp->add(new admin_setting_configselect('maxeditingtime', new lang_string('maxeditingtime','admin'), new lang_string('configmaxeditingtime','admin'), 1800,
43 array(60 => new lang_string('numminutes', '', 1),
44 300 => new lang_string('numminutes', '', 5),
45 900 => new lang_string('numminutes', '', 15),
46 1800 => new lang_string('numminutes', '', 30),
47 2700 => new lang_string('numminutes', '', 45),
48 3600 => new lang_string('numminutes', '', 60))));
a327f25e 49
e106013f
SH
50 $temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
51 $temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'admin'), new lang_string('sitepolicy_help', 'admin'), '', PARAM_RAW));
52 $temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'admin'), new lang_string('sitepolicyguest_help', 'admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW));
53 $temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
54 $temp->add(new admin_setting_configcheckbox('keeptagnamecase', new lang_string('keeptagnamecase','admin'),new lang_string('configkeeptagnamecase', 'admin'),'1'));
55
56 $temp->add(new admin_setting_configcheckbox('profilesforenrolledusersonly', new lang_string('profilesforenrolledusersonly','admin'),new lang_string('configprofilesforenrolledusersonly', 'admin'),'1'));
57
58 $temp->add(new admin_setting_configcheckbox('cronclionly', new lang_string('cronclionly', 'admin'), new lang_string('configcronclionly', 'admin'), 0));
59 $temp->add(new admin_setting_configpasswordunmask('cronremotepassword', new lang_string('cronremotepassword', 'admin'), new lang_string('configcronremotepassword', 'admin'), ''));
60
b28247fe
PS
61 $options = array(0=>get_string('no'), 3=>3, 5=>5, 7=>7, 10=>10, 20=>20, 30=>30, 50=>50, 100=>100);
62 $temp->add(new admin_setting_configselect('lockoutthreshold', new lang_string('lockoutthreshold', 'admin'), new lang_string('lockoutthreshold_desc', 'admin'), 0, $options));
63 $temp->add(new admin_setting_configduration('lockoutwindow', new lang_string('lockoutwindow', 'admin'), new lang_string('lockoutwindow_desc', 'admin'), 60*30));
64 $temp->add(new admin_setting_configduration('lockoutduration', new lang_string('lockoutduration', 'admin'), new lang_string('lockoutduration_desc', 'admin'), 60*30));
65
e106013f
SH
66 $temp->add(new admin_setting_configcheckbox('passwordpolicy', new lang_string('passwordpolicy', 'admin'), new lang_string('configpasswordpolicy', 'admin'), 1));
67 $temp->add(new admin_setting_configtext('minpasswordlength', new lang_string('minpasswordlength', 'admin'), new lang_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
68 $temp->add(new admin_setting_configtext('minpassworddigits', new lang_string('minpassworddigits', 'admin'), new lang_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
69 $temp->add(new admin_setting_configtext('minpasswordlower', new lang_string('minpasswordlower', 'admin'), new lang_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
70 $temp->add(new admin_setting_configtext('minpasswordupper', new lang_string('minpasswordupper', 'admin'), new lang_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
71 $temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
72 $temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
73 $temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
74 $temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
75 $temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
76 $temp->add(new admin_setting_configselect('rememberusername', new lang_string('rememberusername','admin'), new lang_string('rememberusername_desc','admin'), 2, array(1=>new lang_string('yes'), 0=>new lang_string('no'), 2=>new lang_string('optional'))));
77 $temp->add(new admin_setting_configcheckbox('strictformsrequired', new lang_string('strictformsrequired', 'admin'), new lang_string('configstrictformsrequired', 'admin'), 0));
220a90c5 78 $ADMIN->add('security', $temp);
79
80
81
82
83 // "httpsecurity" settingpage
e106013f
SH
84 $temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
85 $temp->add(new admin_setting_configcheckbox('loginhttps', new lang_string('loginhttps', 'admin'), new lang_string('configloginhttps', 'admin'), 0));
86 $temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 0));
87 $temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0));
88 $temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
89 $temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', new lang_string('loginpasswordautocomplete', 'admin'), new lang_string('loginpasswordautocomplete_help', 'admin'), 0));
220a90c5 90 $ADMIN->add('security', $temp);
91
92
220a90c5 93 // "notifications" settingpage
e106013f
SH
94 $temp = new admin_settingpage('notifications', new lang_string('notifications', 'admin'));
95 $temp->add(new admin_setting_configselect('displayloginfailures', new lang_string('displayloginfailures', 'admin'), new lang_string('configdisplayloginfailures', 'admin'), '', array('' => new lang_string('nobody'),
96 'admin' => new lang_string('administrators'),
97 'teacher' => new lang_string('administratorsandteachers'),
98 'everybody' => new lang_string('everybody'))));
99 $temp->add(new admin_setting_users_with_capability('notifyloginfailures', new lang_string('notifyloginfailures', 'admin'), new lang_string('confignotifyloginfailures', 'admin'), array(), 'moodle/site:config'));
ccbdfdc7 100 $options = array();
220a90c5 101 for ($i = 1; $i <= 100; $i++) {
102 $options[$i] = $i;
103 }
e106013f 104 $temp->add(new admin_setting_configselect('notifyloginthreshold', new lang_string('notifyloginthreshold', 'admin'), new lang_string('confignotifyloginthreshold', 'admin'), '10', $options));
220a90c5 105 $ADMIN->add('security', $temp);
ccbdfdc7 106
107
108
ccbdfdc7 109
110
111
220a90c5 112 // "antivirus" settingpage
e106013f
SH
113 $temp = new admin_settingpage('antivirus', new lang_string('antivirus', 'admin'));
114 $temp->add(new admin_setting_configcheckbox('runclamonupload', new lang_string('runclamavonupload', 'admin'), new lang_string('configrunclamavonupload', 'admin'), 0));
115 $temp->add(new admin_setting_configexecutable('pathtoclam', new lang_string('pathtoclam', 'admin'), new lang_string('configpathtoclam', 'admin'), ''));
116 $temp->add(new admin_setting_configdirectory('quarantinedir', new lang_string('quarantinedir', 'admin'), new lang_string('configquarantinedir', 'admin'), ''));
117 $temp->add(new admin_setting_configselect('clamfailureonupload', new lang_string('clamfailureonupload', 'admin'), new lang_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => new lang_string('configclamdonothing', 'admin'),
118 'actlikevirus' => new lang_string('configclamactlikevirus', 'admin'))));
220a90c5 119 $ADMIN->add('security', $temp);
1ea1bcb3 120
a559f630 121} // end of speedup