MDL-28630 prevent session breakage caused by incorrect cookie settings
[moodle.git] / admin / settings / server.php
CommitLineData
11b749ca 1<?php
1ea1bcb3 2
3// This file defines settingpages and externalpages under the "server" category
4
a559f630 5if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
6
7
1ea1bcb3 8// "systempaths" settingpage
9$temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
eef868d1 10$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
11 '1' => get_string('gd1'),
61240489 12 '2' => get_string('gd2'))));
220a90c5 13$temp->add(new admin_setting_configexecutable('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), ''));
14$temp->add(new admin_setting_configexecutable('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), ''));
6af80cae 15$temp->add(new admin_setting_configexecutable('pathtodot', get_string('pathtodot', 'admin'), get_string('pathtodot_help', 'admin'), ''));
1caea91e 16$ADMIN->add('server', $temp);
1ea1bcb3 17
18
19
2f2137fc
RK
20// "supportcontact" settingpage
21$temp = new admin_settingpage('supportcontact', get_string('supportcontact','admin'));
8e5da17a 22if (isloggedin()) {
23 global $USER;
72ce416c 24 $primaryadminemail = $USER->email;
8e5da17a 25 $primaryadminname = fullname($USER, true);
220a90c5 26
8e5da17a 27} else {
28 // no defaults during installation - admin user must be created first
29 $primaryadminemail = NULL;
30 $primaryadminname = NULL;
72ce416c 31}
32$temp->add(new admin_setting_configtext('supportname', get_string('supportname', 'admin'), get_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
33$temp->add(new admin_setting_configtext('supportemail', get_string('supportemail', 'admin'), get_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
3917c07e 34$temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', 'admin'), get_string('configsupportpage', 'admin'), '', PARAM_URL));
1caea91e 35$ADMIN->add('server', $temp);
1ea1bcb3 36
37
1ea1bcb3 38// "sessionhandling" settingpage
39$temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin'));
35d6a2a4 40$temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 1));
1ea1bcb3 41$temp->add(new admin_setting_configselect('sessiontimeout', get_string('sessiontimeout', 'admin'), get_string('configsessiontimeout', 'admin'), 7200, array(14400 => get_string('numhours', '', 4),
42 10800 => get_string('numhours', '', 3),
43 7200 => get_string('numhours', '', 2),
44 5400 => get_string('numhours', '', '1.5'),
45 3600 => get_string('numminutes', '', 60),
46 2700 => get_string('numminutes', '', 45),
47 1800 => get_string('numminutes', '', 30),
48 900 => get_string('numminutes', '', 15),
49 300 => get_string('numminutes', '', 5))));
50$temp->add(new admin_setting_configtext('sessioncookie', get_string('sessioncookie', 'admin'), get_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
988fc20e
PS
51$temp->add(new admin_setting_configtext('sessioncookiepath', get_string('sessioncookiepath', 'admin'), get_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
52$temp->add(new admin_setting_configtext('sessioncookiedomain', get_string('sessioncookiedomain', 'admin'), get_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
1caea91e 53$ADMIN->add('server', $temp);
1ea1bcb3 54
55
1ea1bcb3 56// "stats" settingpage
90658eef 57$temp = new admin_settingpage('stats', get_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
1ea1bcb3 58$temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirstrun', 'admin'), get_string('configstatsfirstrun', 'admin'), 'none', array('none' => get_string('none'),
59 60*60*24*7 => get_string('numweeks','moodle',1),
61240489 60 60*60*24*14 => get_string('numweeks','moodle',2),
61 60*60*24*21 => get_string('numweeks','moodle',3),
62 60*60*24*28 => get_string('nummonths','moodle',1),
63 60*60*24*56 => get_string('nummonths','moodle',2),
64 60*60*24*84 => get_string('nummonths','moodle',3),
65 60*60*24*112 => get_string('nummonths','moodle',4),
66 60*60*24*140 => get_string('nummonths','moodle',5),
67 60*60*24*168 => get_string('nummonths','moodle',6),
68 'all' => get_string('all') )));
5e7206a8 69$temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime3', 'admin'), 0, array(0 => get_string('untilcomplete'),
61460dd6 70 60*30 => '10 '.get_string('minutes'),
71 60*30 => '30 '.get_string('minutes'),
1ea1bcb3 72 60*60 => '1 '.get_string('hour'),
61240489 73 60*60*2 => '2 '.get_string('hours'),
74 60*60*3 => '3 '.get_string('hours'),
75 60*60*4 => '4 '.get_string('hours'),
76 60*60*5 => '5 '.get_string('hours'),
77 60*60*6 => '6 '.get_string('hours'),
78 60*60*7 => '7 '.get_string('hours'),
79 60*60*8 => '8 '.get_string('hours') )));
5e7206a8 80$temp->add(new admin_setting_configtext('statsruntimedays', get_string('statsruntimedays', 'admin'), get_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
1ea1bcb3 81$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
82$temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
eef868d1 83$ADMIN->add('server', $temp);
1ea1bcb3 84
85
86// "http" settingpage
87$temp = new admin_settingpage('http', get_string('http', 'admin'));
afd7b382 88$temp->add(new admin_setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
62ea712f 89$temp->add(new admin_setting_heading('reverseproxy', get_string('reverseproxy', 'admin'), '', ''));
3a4f0a34 90$options = array(
91 0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
92 GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
93 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
94 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
62ea712f 95$temp->add(new admin_setting_configselect('getremoteaddrconf', get_string('getremoteaddrconf', 'admin'), get_string('configgetremoteaddrconf', 'admin'), 0, $options));
5f8bdc17 96$temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
1ea1bcb3 97$temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
421f60f9 98$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
5f8bdc17 99$options = array('HTTP'=>'HTTP');
100if (defined('CURLPROXY_SOCKS5')) {
101 $options['SOCKS5'] = 'SOCKS5';
102}
103$temp->add(new admin_setting_configselect('proxytype', get_string('proxytype', 'admin'), get_string('configproxytype','admin'), 'HTTP', $options));
104$temp->add(new admin_setting_configtext('proxyuser', get_string('proxyuser', 'admin'), get_string('configproxyuser', 'admin'), ''));
eb7f78af 105$temp->add(new admin_setting_configpasswordunmask('proxypassword', get_string('proxypassword', 'admin'), get_string('configproxypassword', 'admin'), ''));
9bc760f2 106$temp->add(new admin_setting_configtext('proxybypass', get_string('proxybypass', 'admin'), get_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
eef868d1 107$ADMIN->add('server', $temp);
1ea1bcb3 108
4fe2250a 109$temp = new admin_settingpage('maintenancemode', get_string('sitemaintenancemode', 'admin'));
110$options = array(0=>get_string('disable'), 1=>get_string('enable'));
111$temp->add(new admin_setting_configselect('maintenance_enabled', get_string('sitemaintenancemode', 'admin'),
112 get_string('helpsitemaintenance', 'admin'), 0, $options));
113$temp->add(new admin_setting_confightmleditor('maintenance_message', get_string('optionalmaintenancemessage', 'admin'),
114 '', ''));
115$ADMIN->add('server', $temp);
1ea1bcb3 116
1ea1bcb3 117$temp = new admin_settingpage('cleanup', get_string('cleanup', 'admin'));
1ea1bcb3 118$temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('deleteunconfirmed', 'admin'), get_string('configdeleteunconfirmed', 'admin'), 168, array(0 => get_string('never'),
119 168 => get_string('numdays', '', 7),
120 144 => get_string('numdays', '', 6),
121 120 => get_string('numdays', '', 5),
122 96 => get_string('numdays', '', 4),
123 72 => get_string('numdays', '', 3),
124 48 => get_string('numdays', '', 2),
125 24 => get_string('numdays', '', 1),
126 12 => get_string('numhours', '', 12),
127 6 => get_string('numhours', '', 6),
128 1 => get_string('numhours', '', 1))));
129
a4a57da9 130$temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'),
131 168 => get_string('numdays', '', 7),
132 144 => get_string('numdays', '', 6),
133 120 => get_string('numdays', '', 5),
134 96 => get_string('numdays', '', 4),
135 72 => get_string('numdays', '', 3),
136 48 => get_string('numdays', '', 2),
137 24 => get_string('numdays', '', 1))));
138
f11f7b41
PS
139$temp->add(new admin_setting_configcheckbox('logguests', get_string('logguests', 'admin'),
140 get_string('logguests_help', 'admin'), 1));
1ea1bcb3 141$temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
142 1000 => get_string('numdays', '', 1000),
143 365 => get_string('numdays', '', 365),
144 180 => get_string('numdays', '', 180),
145 150 => get_string('numdays', '', 150),
146 120 => get_string('numdays', '', 120),
147 90 => get_string('numdays', '', 90),
148 60 => get_string('numdays', '', 60),
cea67da0 149 35 => get_string('numdays', '', 35),
150 10 => get_string('numdays', '', 10),
151 5 => get_string('numdays', '', 5),
152 2 => get_string('numdays', '', 2))));
1ea1bcb3 153
1ee0df06 154
155$temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
f11f7b41 156 get_string('disablegradehistory_help', 'grades'), 0));
1ee0df06 157
158$temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
5cf5cc9b 159 get_string('gradehistorylifetime_help', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
1ee0df06 160 1000 => get_string('numdays', '', 1000),
161 365 => get_string('numdays', '', 365),
162 180 => get_string('numdays', '', 180),
163 150 => get_string('numdays', '', 150),
164 120 => get_string('numdays', '', 120),
165 90 => get_string('numdays', '', 90),
166 60 => get_string('numdays', '', 60),
167 30 => get_string('numdays', '', 30))));
168
1ea1bcb3 169$ADMIN->add('server', $temp);
170
171
172
173$ADMIN->add('server', new admin_externalpage('environment', get_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
174$ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
175
176
4a575a65 177// "performance" settingpage
178$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
7022dd39 179
2848b979
DC
180$temp->add(new admin_setting_configtext('numcoursesincombo', get_string('numcoursesincombo', 'admin'), get_string('numcoursesincombo_help', 'admin'), 500));
181
c6e1d6af 182$temp->add(new admin_setting_configselect('extramemorylimit', get_string('extramemorylimit', 'admin'),
1c980a57 183 get_string('configextramemorylimit', 'admin'), '512M',
c3935adb 184 // if this option is set to 0, default 128M will be used
7022dd39 185 array( '64M' => '64M',
408278ba 186 '128M' => '128M',
7022dd39 187 '256M' => '256M',
44403309 188 '512M' => '512M',
7022dd39 189 '1024M' => '1024M'
190 )));
1c980a57
PS
191$temp->add(new admin_setting_configtext('curlcache', get_string('curlcache', 'admin'),
192 get_string('configcurlcache', 'admin'), 120, PARAM_INT));
193
60b5a2fe 194$temp->add(new admin_setting_configtext('curltimeoutkbitrate', get_string('curltimeoutkbitrate', 'admin'),
5f1c825d 195 get_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
1c980a57 196/* //TODO: we need to fix code instead of relying on slow rcache, enable this once we have some code that is actually using it
134d8a58 197$temp->add(new admin_setting_special_selectsetup('cachetype', get_string('cachetype', 'admin'),
198 get_string('configcachetype', 'admin'), '',
199 array( '' => get_string('none'),
200 'internal' => 'internal',
201 'memcached' => 'memcached',
202 'eaccelerator' => 'eaccelerator')));
bb931a61 203// NOTE: $CFG->rcache is forced to bool in lib/setup.php
392e7363 204$temp->add(new admin_setting_special_selectsetup('rcache', get_string('rcache', 'admin'),
220a90c5 205 get_string('configrcache', 'admin'), 0,
206 array( '0' => get_string('no'),
1bc8aab1 207 '1' => get_string('yes'))));
bb931a61 208$temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
209 get_string('configrcachettl', 'admin'), 10));
210$temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
211 get_string('configintcachemax', 'admin'), 10));
134d8a58 212$temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
213 get_string('configmemcachedhosts', 'admin'), ''));
214$temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
215 get_string('configmemcachedpconn', 'admin'), 0,
216 array( '0' => get_string('no'),
217 '1' => get_string('yes'))));
1c980a57 218*/
4a575a65 219$ADMIN->add('server', $temp);
220
1c980a57
PS
221
222$ADMIN->add('server', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
b3929ae9 223$ADMIN->add('root', new admin_externalpage('bloglevelupgrade', get_string('bloglevelupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/blocklevelupgrade.php', 'moodle/site:config', true));
1c980a57 224
a559f630 225} // end of speedup