3 // This file defines settingpages and externalpages under the "server" category
5 if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
8 // "systempaths" settingpage
9 $temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
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'),
12 '2' => get_string('gd2'))));
13 $temp->add(new admin_setting_configexecutable('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), ''));
14 $temp->add(new admin_setting_configexecutable('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), ''));
15 $temp->add(new admin_setting_configexecutable('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), ''));
16 $temp->add(new admin_setting_configexecutable('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), ''));
17 $ADMIN->add('server', $temp, 0);
21 // "email" settingpage
22 $temp = new admin_settingpage('mail', get_string('mail','admin'));
23 $temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW
));
24 $temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS
));
25 $temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), ''));
26 $temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT
));
27 $temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS
));
28 $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
52 $charsets = get_list_of_charsets();
53 unset($charsets['UTF-8']); // not needed here
55 $options['0'] = 'UTF-8';
56 $options = array_merge($options, $charsets);
57 $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options));
58 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
59 $options = array('LF'=>'LF', 'CRLF'=>'CRLF');
60 $temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
63 $primaryadminemail = $USER->email
;
64 $primaryadminname = fullname($USER, true);
67 // no defaults during installation - admin user must be created first
68 $primaryadminemail = NULL;
69 $primaryadminname = NULL;
71 $temp->add(new admin_setting_configtext('supportname', get_string('supportname', 'admin'), get_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS
));
72 $temp->add(new admin_setting_configtext('supportemail', get_string('supportemail', 'admin'), get_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS
));
73 $temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', 'admin'), get_string('configsupportpage', 'admin'), '', PARAM_URL
));
74 $ADMIN->add('server', $temp, 100);
78 // "sessionhandling" settingpage
79 $temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin'));
80 $temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 0));
81 $temp->add(new admin_setting_configselect('sessiontimeout', get_string('sessiontimeout', 'admin'), get_string('configsessiontimeout', 'admin'), 7200, array(14400 => get_string('numhours', '', 4),
82 10800 => get_string('numhours', '', 3),
83 7200 => get_string('numhours', '', 2),
84 5400 => get_string('numhours', '', '1.5'),
85 3600 => get_string('numminutes', '', 60),
86 2700 => get_string('numminutes', '', 45),
87 1800 => get_string('numminutes', '', 30),
88 900 => get_string('numminutes', '', 15),
89 300 => get_string('numminutes', '', 5))));
90 $temp->add(new admin_setting_configtext('sessioncookie', get_string('sessioncookie', 'admin'), get_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM
));
91 $temp->add(new admin_setting_configtext('sessioncookiepath', get_string('sessioncookiepath', 'admin'), get_string('configsessioncookiepath', 'admin'), '/', PARAM_LOCALURL
));
92 $ADMIN->add('server', $temp, 50);
97 $temp = new admin_settingpage('rss', get_string('rss'));
98 $temp->add(new admin_setting_configcheckbox('enablerssfeeds', get_string('enablerssfeeds', 'admin'), get_string('configenablerssfeeds', 'admin'), 0));
99 $ADMIN->add('server', $temp);
102 // "debugging" settingpage
103 $temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
104 $temp->add(new admin_setting_special_debug());
105 $temp->add(new admin_setting_configcheckbox('debugdisplay', get_string('debugdisplay', 'admin'), get_string('configdebugdisplay', 'admin'), ini_get_bool('display_errors')));
106 $temp->add(new admin_setting_configcheckbox('xmlstrictheaders', get_string('xmlstrictheaders', 'admin'), get_string('configxmlstrictheaders', 'admin'), 0));
107 $temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
108 $temp->add(new admin_setting_configcheckbox('perfdebug', get_string('perfdebug', 'admin'), get_string('configperfdebug', 'admin'), '7', '15', '7'));
109 $ADMIN->add('server', $temp);
112 // "stats" settingpage
113 $temp = new admin_settingpage('stats', get_string('stats'));
114 $temp->add(new admin_setting_configcheckbox('enablestats', get_string('enablestats', 'admin'), get_string('configenablestats', 'admin'), 0));
115 $temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirstrun', 'admin'), get_string('configstatsfirstrun', 'admin'), 'none', array('none' => get_string('none'),
116 60*60*24*7 => get_string('numweeks','moodle',1),
117 60*60*24*14 => get_string('numweeks','moodle',2),
118 60*60*24*21 => get_string('numweeks','moodle',3),
119 60*60*24*28 => get_string('nummonths','moodle',1),
120 60*60*24*56 => get_string('nummonths','moodle',2),
121 60*60*24*84 => get_string('nummonths','moodle',3),
122 60*60*24*112 => get_string('nummonths','moodle',4),
123 60*60*24*140 => get_string('nummonths','moodle',5),
124 60*60*24*168 => get_string('nummonths','moodle',6),
125 'all' => get_string('all') )));
126 $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime2', 'admin'), 0, array(0 => get_string('untilcomplete'),
127 60*30 => '10 '.get_string('minutes'),
128 60*30 => '30 '.get_string('minutes'),
129 60*60 => '1 '.get_string('hour'),
130 60*60*2 => '2 '.get_string('hours'),
131 60*60*3 => '3 '.get_string('hours'),
132 60*60*4 => '4 '.get_string('hours'),
133 60*60*5 => '5 '.get_string('hours'),
134 60*60*6 => '6 '.get_string('hours'),
135 60*60*7 => '7 '.get_string('hours'),
136 60*60*8 => '8 '.get_string('hours') )));
137 $temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
138 $temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT
));
140 $options = array(0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6);
141 $temp->add(new admin_setting_configselect('statscatdepth', get_string('statscatdepth', 'admin'), get_string('configstatscatdepth', 'admin'), 1, $options));
142 $ADMIN->add('server', $temp);
145 // "http" settingpage
146 $temp = new admin_settingpage('http', get_string('http', 'admin'));
147 $temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT
));
148 $temp->add(new admin_setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
149 $temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
150 $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST
));
151 $temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT
));
152 $options = array('HTTP'=>'HTTP');
153 if (defined('CURLPROXY_SOCKS5')) {
154 $options['SOCKS5'] = 'SOCKS5';
156 $temp->add(new admin_setting_configselect('proxytype', get_string('proxytype', 'admin'), get_string('configproxytype','admin'), 'HTTP', $options));
157 $temp->add(new admin_setting_configtext('proxyuser', get_string('proxyuser', 'admin'), get_string('configproxyuser', 'admin'), ''));
158 $temp->add(new admin_setting_configpasswordunmask('proxypassword', get_string('proxypassword', 'admin'), get_string('configproxypassword', 'admin'), ''));
159 $ADMIN->add('server', $temp);
161 $ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
164 $temp = new admin_settingpage('cleanup', get_string('cleanup', 'admin'));
165 $temp->add(new admin_setting_configselect('longtimenosee', get_string('longtimenosee', 'admin'), get_string('configlongtimenosee', 'admin'), 120, array(0 => get_string('never'),
166 1000 => get_string('numdays', '', 1000),
167 365 => get_string('numdays', '', 365),
168 180 => get_string('numdays', '', 180),
169 150 => get_string('numdays', '', 150),
170 120 => get_string('numdays', '', 120),
171 90 => get_string('numdays', '', 90),
172 60 => get_string('numdays', '', 60),
173 30 => get_string('numdays', '', 30),
174 21 => get_string('numdays', '', 21),
175 14 => get_string('numdays', '', 14),
176 7 => get_string('numdays', '', 7) )));
177 $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('deleteunconfirmed', 'admin'), get_string('configdeleteunconfirmed', 'admin'), 168, array(0 => get_string('never'),
178 168 => get_string('numdays', '', 7),
179 144 => get_string('numdays', '', 6),
180 120 => get_string('numdays', '', 5),
181 96 => get_string('numdays', '', 4),
182 72 => get_string('numdays', '', 3),
183 48 => get_string('numdays', '', 2),
184 24 => get_string('numdays', '', 1),
185 12 => get_string('numhours', '', 12),
186 6 => get_string('numhours', '', 6),
187 1 => get_string('numhours', '', 1))));
189 $temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'),
190 168 => get_string('numdays', '', 7),
191 144 => get_string('numdays', '', 6),
192 120 => get_string('numdays', '', 5),
193 96 => get_string('numdays', '', 4),
194 72 => get_string('numdays', '', 3),
195 48 => get_string('numdays', '', 2),
196 24 => get_string('numdays', '', 1))));
198 $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
199 1000 => get_string('numdays', '', 1000),
200 365 => get_string('numdays', '', 365),
201 180 => get_string('numdays', '', 180),
202 150 => get_string('numdays', '', 150),
203 120 => get_string('numdays', '', 120),
204 90 => get_string('numdays', '', 90),
205 60 => get_string('numdays', '', 60),
206 35 => get_string('numdays', '', 35))));
209 $temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
210 get_string('configdisablegradehistory', 'grades'), 0, PARAM_INT
));
212 $temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
213 get_string('configgradehistorylifetime', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
214 1000 => get_string('numdays', '', 1000),
215 365 => get_string('numdays', '', 365),
216 180 => get_string('numdays', '', 180),
217 150 => get_string('numdays', '', 150),
218 120 => get_string('numdays', '', 120),
219 90 => get_string('numdays', '', 90),
220 60 => get_string('numdays', '', 60),
221 30 => get_string('numdays', '', 30))));
223 $ADMIN->add('server', $temp);
227 $ADMIN->add('server', new admin_externalpage('environment', get_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
228 $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
231 // "performance" settingpage
232 $temp = new admin_settingpage('performance', get_string('performance', 'admin'));
233 $temp->add(new admin_setting_special_selectsetup('cachetype', get_string('cachetype', 'admin'),
234 get_string('configcachetype', 'admin'), '',
235 array( '' => get_string('none'),
236 'internal' => 'internal',
237 'memcached' => 'memcached',
238 'eaccelerator' => 'eaccelerator')));
239 // NOTE: $CFG->rcache is forced to bool in lib/setup.php
240 $temp->add(new admin_setting_special_selectsetup('rcache', get_string('rcache', 'admin'),
241 get_string('configrcache', 'admin'), 0,
242 array( '0' => get_string('no'),
243 '1' => get_string('yes'))));
244 $temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
245 get_string('configrcachettl', 'admin'), 10));
246 $temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
247 get_string('configintcachemax', 'admin'), 10));
248 $temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
249 get_string('configmemcachedhosts', 'admin'), ''));
250 $temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
251 get_string('configmemcachedpconn', 'admin'), 0,
252 array( '0' => get_string('no'),
253 '1' => get_string('yes'))));
254 $ADMIN->add('server', $temp);
256 if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
257 $ADMIN->add('server', new admin_externalpage('database', get_string('managedatabase'), "$CFG->wwwroot/$CFG->admin/mysql/frame.php"));