From bee4702d107774c94893d91ca3dcf652506b80eb Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 3 Sep 2006 14:45:57 +0000 Subject: [PATCH] Various tidying up of the admin pages. Reports now don't need mod.php but they should include the admin headers/footers. There are undoubtedly bugs in this but this framework should be more sane --- admin/environment.php | 5 - admin/modules.php | 8 +- admin/report/courseoverview/index.php | 16 +- admin/report/courseoverview/mod.php | 57 ------- admin/report/log/mod.php | 23 --- admin/report/simpletest/index.php | 23 +-- admin/report/simpletest/mod.php | 21 --- admin/report/stats/index.php | 44 +++-- admin/report/stats/mod.php | 16 -- admin/settings.php | 2 +- admin/settings/advancedconfiguration.php | 135 ---------------- admin/settings/courses.php | 41 ++++- admin/settings/devel.php | 10 -- admin/settings/misc.php | 32 +--- admin/settings/settings.php | 196 ----------------------- admin/settings/top.php | 32 ++-- admin/settings/users.php | 22 ++- admin/stickyblocks.php | 4 +- admin/user.php | 59 +++---- 19 files changed, 153 insertions(+), 593 deletions(-) delete mode 100644 admin/report/courseoverview/mod.php delete mode 100644 admin/report/log/mod.php delete mode 100644 admin/report/simpletest/mod.php delete mode 100644 admin/report/stats/mod.php delete mode 100644 admin/settings/advancedconfiguration.php delete mode 100644 admin/settings/devel.php delete mode 100644 admin/settings/settings.php diff --git a/admin/environment.php b/admin/environment.php index 95f4c1ed152..af4c565e8f2 100644 --- a/admin/environment.php +++ b/admin/environment.php @@ -132,11 +132,6 @@ /// Gather and show results $status = check_moodle_environment($version, $environment_results); -/// Other links - echo '
'; - print_single_button('phpinfo.php', NULL, get_string('phpinfo')); - echo '
'; - /// Print footer admin_externalpage_print_footer($adminroot); ?> diff --git a/admin/modules.php b/admin/modules.php index f383073b85c..0e90f09e74b 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -17,7 +17,7 @@ $stradministration = get_string("administration"); $strconfiguration = get_string("configuration"); - $strmanagemodules = get_string("managemodules"); + $stractivities = get_string("activities"); $strdelete = get_string("delete"); $strversion = get_string("version"); $strhide = get_string("hide"); @@ -26,13 +26,9 @@ $stractivities = get_string("activities"); $stractivitymodule = get_string("activitymodule"); -// print_header("$site->shortname: $strmanagemodules", "$site->fullname", -// "$stradministration -> ". -// "$strconfiguration -> $strmanagemodules"); - admin_externalpage_print_header($adminroot); - print_heading($strmanagemodules); + print_heading($stractivities); $coursesaffected = false; diff --git a/admin/report/courseoverview/index.php b/admin/report/courseoverview/index.php index 3a9d17da27a..442c42fa1b9 100644 --- a/admin/report/courseoverview/index.php +++ b/admin/report/courseoverview/index.php @@ -2,18 +2,24 @@ require_once('../../../config.php'); require_once($CFG->dirroot.'/lib/statslib.php'); + require_once($CFG->libdir.'/adminlib.php'); + + $adminroot = admin_get_root(); + + admin_externalpage_setup('reportcourseoverview', $adminroot); + + admin_externalpage_print_header($adminroot); $report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT); $time = optional_param('time', 0, PARAM_INT); $numcourses = optional_param('numcourses', 20, PARAM_INT); + require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed? + if (empty($CFG->enablestats)) { - error("Stats is not enabled."); + redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin')); } - require_login(); - - require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); $course = get_site(); stats_check_uptodate($course->id); @@ -104,6 +110,6 @@ print_table($table); } - print_footer(); + admin_externalpage_print_footer($adminroot); ?> diff --git a/admin/report/courseoverview/mod.php b/admin/report/courseoverview/mod.php deleted file mode 100644 index 7d74d21e2b3..00000000000 --- a/admin/report/courseoverview/mod.php +++ /dev/null @@ -1,57 +0,0 @@ -enablestats)) { - - $strreports = get_string('reports'); - $strcourseoverview = get_string('courseoverview'); - - print_heading("$strcourseoverview:"); - - require_once($CFG->dirroot.'/lib/statslib.php'); - - $report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT); - $time = optional_param('time', 0, PARAM_INT); - $numcourses = optional_param('numcourses', 20, PARAM_INT); - - $course = get_site(); - $statsstatus = stats_check_uptodate($course->id); - - $reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED); - - $tableprefix = $CFG->prefix.'stats_'; - - $earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1'); - $earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1'); - $earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1'); - - if (empty($earliestday)) $earliestday = time(); - if (empty($earliestweek)) $earliestweek = time(); - if (empty($earliestmonth)) $earliestmonth = time(); - - $now = stats_get_base_daily(); - $lastweekend = stats_get_base_weekly(); - $lastmonthend = stats_get_base_monthly(); - - $timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth); - - $table->width = '*'; - $table->align = array('left','left','left','left','left','left'); - $table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true), - get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true), - '', - '') ; - - echo '
'."\n"; - print_table($table); - echo '
'; - if ($statsstatus !== NULL) { - notify ($statsstatus); - } - - } -?> - diff --git a/admin/report/log/mod.php b/admin/report/log/mod.php deleted file mode 100644 index ea990b0baa2..00000000000 --- a/admin/report/log/mod.php +++ /dev/null @@ -1,23 +0,0 @@ -dirroot.'/course/lib.php'); - require_once($CFG->dirroot.'/course/report/log/lib.php'); - - $course = get_site(); - - print_heading(get_string('chooselogs') .':'); - - print_log_selector_form($course); - - echo '
'; - print_heading(get_string('chooselivelogs') .':'); - - echo '

'; - link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800); - echo '

'; - -?> diff --git a/admin/report/simpletest/index.php b/admin/report/simpletest/index.php index 1895aea6955..90cb0c0b022 100644 --- a/admin/report/simpletest/index.php +++ b/admin/report/simpletest/index.php @@ -12,16 +12,22 @@ /** */ require_once(dirname(__FILE__) . '/../../../config.php'); require_once($CFG->libdir . '/moodlelib.php'); +require_once($CFG->libdir.'/adminlib.php'); require_once('ex_simple_test.php'); require_once('ex_reporter.php'); +require_login(); +require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + +$adminroot = admin_get_root(); +admin_externalpage_setup('reportsimpletest', $adminroot); + + /* The UNITTEST constant can be checked elsewhere if you need to know * when your code is being run as part of a unit test. */ define('UNITTEST', true); $langfile = 'simpletest'; -require_login(); -require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); // CGI arguments $path = optional_param('path', '', PARAM_PATH); $showpasses = optional_param('showpasses', false, PARAM_BOOL); @@ -41,12 +47,9 @@ $reporter = new ExHtmlReporter($showpasses); // Print the header. $strtitle = get_string('unittests', $langfile); -$stradmin = get_string('administration'); -print_header("$SITE->shortname: $strtitle", $SITE->fullname, - '' . get_string('administration') . ' -> ' . - '' . get_string('miscellaneous') . ' -> ' . - '' . get_string('reports') . ' -> ' . - $strtitle, '', ''); + +admin_externalpage_print_header($adminroot); + if ($showsearch) { print_heading('Searching for test cases'); } @@ -98,6 +101,6 @@ echo ''; print_simple_box_end(); // Footer. -print_footer(); +admin_externalpage_print_footer($adminroot); -?> \ No newline at end of file +?> diff --git a/admin/report/simpletest/mod.php b/admin/report/simpletest/mod.php deleted file mode 100644 index d53d9a716b0..00000000000 --- a/admin/report/simpletest/mod.php +++ /dev/null @@ -1,21 +0,0 @@ -wwwroot.'/admin/report/simpletest/index.php">' . - get_string('rununittests', $langfile) . '', '', 3); -?> \ No newline at end of file diff --git a/admin/report/stats/index.php b/admin/report/stats/index.php index a8cf2eb5e36..bec2210cf24 100644 --- a/admin/report/stats/index.php +++ b/admin/report/stats/index.php @@ -4,11 +4,16 @@ require_once($CFG->dirroot.'/lib/statslib.php'); require_once($CFG->dirroot.'/course/report/stats/lib.php'); - if (empty($CFG->enablestats)) { - error("Stats is not enabled."); - } + require_once($CFG->libdir.'/adminlib.php'); - $courseid = required_param('course', PARAM_INT); + $adminroot = admin_get_root(); + + admin_externalpage_setup('reportcourseoverview', $adminroot); + + admin_externalpage_print_header($adminroot); + + + $courseid = optional_param('course', SITEID, PARAM_INT); $report = optional_param('report', 0, PARAM_INT); $time = optional_param('time', 0, PARAM_INT); $mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT); @@ -33,6 +38,11 @@ } require_login(); + + if (empty($CFG->enablestats)) { + redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin')); + } + if (!isteacher($course->id)) { error("You need to be a teacher to use this page"); } @@ -42,22 +52,22 @@ stats_check_uptodate($course->id); - $strreports = get_string("reports"); - $strstats = get_string('stats'); +// $strreports = get_string("reports"); +// $strstats = get_string('stats'); +// +// $menu = report_stats_mode_menu($course, $mode, $time); +// +// +// $crumb = "wwwroot}/admin\">".get_string('administration')." -> +// wwwroot}/admin/report.php\">$strreports -> +// $strstats"; - $menu = report_stats_mode_menu($course, $mode, $time); - - - $crumb = "wwwroot}/admin\">".get_string('administration')." -> - wwwroot}/admin/report.php\">$strreports -> - $strstats"; - - print_header("$course->shortname: $strstats", "$course->fullname", - $crumb, '', '', true, ' ', $menu); +// print_header("$course->shortname: $strstats", "$course->fullname", +// $crumb, '', '', true, ' ', $menu); require_once($CFG->dirroot.'/course/report/stats/report.php'); - print_footer(); + admin_externalpage_print_footer($adminroot); -?> \ No newline at end of file +?> diff --git a/admin/report/stats/mod.php b/admin/report/stats/mod.php deleted file mode 100644 index bc3133fa875..00000000000 --- a/admin/report/stats/mod.php +++ /dev/null @@ -1,16 +0,0 @@ -enablestats)) { - echo '

'; - echo ''.get_string('stats').''; - echo '

'; - $statsstatus = stats_check_uptodate($course->id); - if ($statsstatus !== NULL) { - notify ($statsstatus); - } - } -?> \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php index 4fc8d87885d..07b4bc1c8b5 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -101,4 +101,4 @@ echo ''; print_footer(); -?> \ No newline at end of file +?> diff --git a/admin/settings/advancedconfiguration.php b/admin/settings/advancedconfiguration.php deleted file mode 100644 index ec4301b5a50..00000000000 --- a/admin/settings/advancedconfiguration.php +++ /dev/null @@ -1,135 +0,0 @@ -add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'), - '1' => get_string('gd1'), - '2' => get_string('gd2')))); -$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '')); -$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '')); -$temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '')); -$temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '')); -$ADMIN->add('advancedconfiguration', $temp); - -// "htmleditor" settingpage -$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin')); -$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1)); -$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS)); -$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS)); -$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_special_editorfontlist()); -$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1)); -if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set - $temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0)); - $temp->add(new admin_setting_special_editordictionary()); -} -$temp->add(new admin_setting_special_editorhidebuttons()); -$ADMIN->add('advancedconfiguration', $temp); - - - -// "antivirus" settingpage -$temp = new admin_settingpage('antivirus', get_string('antivirus', 'admin')); -$temp->add(new admin_setting_configcheckbox('runclamavonupload', get_string('runclamavonupload', 'admin'), get_string('configrunclamavonupload', 'admin'), 0)); -$temp->add(new admin_setting_configtext('pathtoclam', get_string('pathtoclam', 'admin'), get_string('configpathtoclam', 'admin'), '', PARAM_PATH)); -$temp->add(new admin_setting_configtext('quarantinedir', get_string('quarantinedir', 'admin'), get_string('configquarantinedir', 'admin'), '', PARAM_PATH)); -$temp->add(new admin_setting_configselect('clamfailureonupload', get_string('clamfailureonupload', 'admin'), get_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => get_string('configclamdonothing', 'admin'), - 'actlikevirus' => get_string('configclamactlikevirus', 'admin')))); -$ADMIN->add('advancedconfiguration', $temp); - - -// "sessionhandling" settingpage -$temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin')); -$temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 0)); -$temp->add(new admin_setting_configselect('sessiontimeout', get_string('sessiontimeout', 'admin'), get_string('configsessiontimeout', 'admin'), 7200, array(14400 => get_string('numhours', '', 4), - 10800 => get_string('numhours', '', 3), - 7200 => get_string('numhours', '', 2), - 5400 => get_string('numhours', '', '1.5'), - 3600 => get_string('numminutes', '', 60), - 2700 => get_string('numminutes', '', 45), - 1800 => get_string('numminutes', '', 30), - 900 => get_string('numminutes', '', 15), - 300 => get_string('numminutes', '', 5)))); -$temp->add(new admin_setting_configtext('sessioncookie', get_string('sessioncookie', 'admin'), get_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM)); -$temp->add(new admin_setting_configtext('sessioncookiepath', get_string('sessioncookiepath', 'admin'), get_string('configsessioncookiepath', 'admin'), '/', PARAM_LOCALURL)); -$ADMIN->add('advancedconfiguration', $temp); - - - -// "rss" settingpage -$temp = new admin_settingpage('rss', get_string('rss')); -$temp->add(new admin_setting_configcheckbox('enablerssfeeds', get_string('enablerssfeeds', 'admin'), get_string('configenablerssfeeds', 'admin'), 0)); -$ADMIN->add('advancedconfiguration', $temp); - - - -// "http" settingpage -$temp = new admin_settingpage('http', get_string('http', 'admin')); -$temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT)); -$temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1)); -$temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST)); -$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), '', PARAM_INT)); -$ADMIN->add('advancedconfiguration', $temp); - -// filters -$ADMIN->add('advancedconfiguration', new admin_externalpage('managefilters', get_string('managefilters'), $CFG->wwwroot . '/admin/filters.php')); -$temp = new admin_settingpage('filtersettings', get_string('filtersettings', 'admin')); -$temp->add(new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7), - 86400 => get_string('numdays','',1), - 43200 => get_string('numhours','',12), - 10800 => get_string('numhours','',3), - 7200 => get_string('numhours','',2), - 3600 => get_string('numhours','',1), - 2700 => get_string('numminutes','',45), - 1800 => get_string('numminutes','',30), - 900 => get_string('numminutes','',15), - 600 => get_string('numminutes','',10), - 540 => get_string('numminutes','',9), - 480 => get_string('numminutes','',8), - 420 => get_string('numminutes','',7), - 360 => get_string('numminutes','',6), - 300 => get_string('numminutes','',5), - 240 => get_string('numminutes','',4), - 180 => get_string('numminutes','',3), - 120 => get_string('numminutes','',2), - 60 => get_string('numminutes','',1), - 30 => get_string('numseconds','',30), - 0 => get_string('no')))); -$temp->add(new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'), - '1' => get_string('allfiles'), - '2' => get_string('htmlfilesonly')))); -$temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0)); -$ADMIN->add('advancedconfiguration', $temp); - -// blocks -$ADMIN->add('advancedconfiguration', new admin_externalpage('manageblocks', get_string('manageblocks'), $CFG->wwwroot . '/admin/blocks.php')); -$ADMIN->add('advancedconfiguration', new admin_externalpage('stickyblocks', get_string('stickyblocks','admin'), $CFG->wwwroot . '/admin/stickyblocks.php')); - -// modules -$ADMIN->add('advancedconfiguration', new admin_externalpage('managemodules', get_string('managemodules'), $CFG->wwwroot . '/admin/modules.php')); -$temp = new admin_settingpage('modulerestrictions', get_string('modulerestrictions', 'admin')); -$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses', - 'all' => 'All courses', - 'requested' => 'Requested courses'))); -$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0)); -if (!$options = get_records("modules")) { - $options = array(); -} -$options2 = array(); -foreach ($options as $option) { - $options2[$option->id] = $option->name; -} -$temp->add(new admin_setting_configmultiselect('defaultallowedmodules', get_string('defaultallowedmodules', 'admin'), get_string('configdefaultallowedmodules', 'admin'), array(), $options2)); -$ADMIN->add('advancedconfiguration', $temp); - -$ADMIN->add('advancedconfiguration', new admin_externalpage('langedit', get_string('langedit', 'admin'), $CFG->wwwroot . '/admin/lang.php')); -$ADMIN->add('advancedconfiguration', new admin_externalpage('langimport', get_string('langimport', 'admin'), $CFG->wwwroot . '/admin/langimport.php')); - - - - -?> \ No newline at end of file diff --git a/admin/settings/courses.php b/admin/settings/courses.php index ed40f920e42..ab338bcf0ae 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -2,6 +2,11 @@ // This file defines settingpages and externalpages under the "courses" category + +$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on')); + +$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/admin/enrol.php')); + // "courserequests" settingpage $temp = new admin_settingpage('courserequest', get_string('courserequest')); $temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0)); @@ -15,9 +20,35 @@ $ADMIN->add('courses', $temp); -$ADMIN->add('courses', new admin_externalpage('managecourses', get_string('managecourses'), $CFG->wwwroot . '/course/index.php?categoryedit=on')); -$ADMIN->add('courses', new admin_externalpage('enrolmentplugins', get_string('enrolmentplugins'), $CFG->wwwroot . '/admin/enrol.php')); +// "backups" settingpage +$temp = new admin_settingpage('backups', get_string('backups','admin')); +$temp->add(new admin_setting_backupcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0)); +$temp->add(new admin_setting_backupcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0)); +$temp->add(new admin_setting_backupcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0)); +$temp->add(new admin_setting_backupselect('backup_sche_users', get_string('users'), get_string('backupusershelp'), 0, array(0 => get_string('all'), + 1 => get_string('course')))); +$temp->add(new admin_setting_backupcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0)); +$temp->add(new admin_setting_backupcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0)); +$temp->add(new admin_setting_backupcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0)); +$temp->add(new admin_setting_backupcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0)); +$temp->add(new admin_setting_backupselect('backup_sche_keep', get_string('keep'), get_string('backupkeephelp'), 1, array(0 => get_string('all'), + 1 => '1', + 2 => '2', + 5 => '5', + 10 => '10', + 20 => '20', + 30 => '30', + 40 => '40', + 50 => '50', + 100 => '100', + 200 => '200', + 300 => '300', + 400 => '400', + 500 => '500'))); +$temp->add(new admin_setting_backupcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0)); +$temp->add(new admin_setting_special_backupdays()); +$temp->add(new admin_setting_special_backuptime()); +$temp->add(new admin_setting_special_backupsaveto()); +$ADMIN->add('courses', $temp); - - -?> \ No newline at end of file +?> diff --git a/admin/settings/devel.php b/admin/settings/devel.php deleted file mode 100644 index 958cce2d8e1..00000000000 --- a/admin/settings/devel.php +++ /dev/null @@ -1,10 +0,0 @@ -debug > 7) { - - if (file_exists($CFG->dirroot . '/admin/mysql/frame.php')) { - $ADMIN->add('devel', new admin_externalpage('database', get_string('managedatabase'), $CFG->wwwroot . '/' . $CFG->admin . '/mysql/frame.php')); - } - $ADMIN->add('devel', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), $CFG->wwwroot . '/' . $CFG->admin . '/xmldb/')); - -} -?> diff --git a/admin/settings/misc.php b/admin/settings/misc.php index 01a5e0dcbd6..f638540e761 100644 --- a/admin/settings/misc.php +++ b/admin/settings/misc.php @@ -1,35 +1,9 @@ add(new admin_setting_configcheckbox('teacherassignteachers', get_string('teacherassignteachers', 'admin'), get_string('configteacherassignteachers', 'admin'), 1)); -$temp->add(new admin_setting_sitesettext('teacher', get_string('wordforteacher'), get_string('wordforteachereg'), '')); -$temp->add(new admin_setting_sitesettext('teachers', get_string('wordforteachers'), get_string('wordforteacherseg'), '')); -$temp->add(new admin_setting_sitesettext('student', get_string('wordforstudent'), get_string('wordforstudenteg'), '')); -$temp->add(new admin_setting_sitesettext('students', get_string('wordforstudents'), get_string('wordforstudentseg'), '')); -$ADMIN->add('misc', $temp); -$temp = new admin_settingpage('unsorted', get_string('unsorted', 'admin')); -$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL)); -$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0)); -$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'), - 4 => get_string('siteblogs','blog'), - 3 => get_string('courseblogs','blog'), - 2 => get_string('groupblogs','blog'), - 1 => get_string('personalblogs','blog'), - 0 => get_string('disableblogs','blog')))); -$temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'), - 1000 => get_string('numdays', '', 1000), - 365 => get_string('numdays', '', 365), - 180 => get_string('numdays', '', 180), - 150 => get_string('numdays', '', 150), - 120 => get_string('numdays', '', 120), - 90 => get_string('numdays', '', 90), - 60 => get_string('numdays', '', 60), - 30 => get_string('numdays', '', 30)))); -$ADMIN->add('misc', $temp); +$ADMIN->add('misc', new admin_externalpage('stickyblocks', get_string('stickyblocks'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php")); -$ADMIN->add('misc', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID)); +$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/")); - -?> \ No newline at end of file +?> diff --git a/admin/settings/settings.php b/admin/settings/settings.php deleted file mode 100644 index da5b2adbf3a..00000000000 --- a/admin/settings/settings.php +++ /dev/null @@ -1,196 +0,0 @@ -add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), get_string('fullsitenamehelp'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), get_string('shortsitenamehelp'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_special_frontpagedesc()); -$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp'), 1)); -$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), get_string('newsitemsnumberhelp'), 3, array('0' => '0 ' . get_string('newsitems'), - '1' => '1 ' . get_string('newsitem'), - '2' => '2 ' . get_string('newsitems'), - '3' => '3 ' . get_string('newsitems'), - '4' => '4 ' . get_string('newsitems'), - '5' => '5 ' . get_string('newsitems'), - '6' => '6 ' . get_string('newsitems'), - '7' => '7 ' . get_string('newsitems'), - '8' => '8 ' . get_string('newsitems'), - '9' => '9 ' . get_string('newsitems'), - '10' => '10 ' . get_string('newsitems')))); -$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) ) -$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting -$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1)); -$temp->add(new admin_setting_configselect('showsiteparticipantslist', get_string('showsiteparticipantslist', 'admin'), get_string('configshowsiteparticipantslist', 'admin'), 0, array(0 => get_string('siteteachers'), 1 => get_string('allteachers'), 2 => get_string('studentsandteachers')))); -$ADMIN->add('settings', $temp); - - -// user settings -$temp = new admin_settingpage('usersettings', get_string('usersettings','admin')); -$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0)); -$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'), get_string('confighiddenuserfields', 'admin'), array(), array('none' => get_string('none'), - 'description' => get_string('description'), - 'city' => get_string('city'), - 'country' => get_string('country'), - 'webpage' => get_string('webpage'), - 'icqnumber' => get_string('icqnumber'), - 'skypeid' => get_string('skypeid'), - 'yahooid' => get_string('yahooid'), - 'aimid' => get_string('aimid'), - 'msnid' => get_string('msnid'), - 'lastaccess' => get_string('lastaccess')))); -$temp->add(new admin_setting_configcheckbox('allowunenroll', get_string('allowunenroll', 'admin'), get_string('configallowunenroll', 'admin'), 1)); -$temp->add(new admin_setting_configtext('maxbytes', get_string('maxbytes', 'admin'), get_string('configmaxbytes', 'admin'), 0, PARAM_INT)); -$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1)); -$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800, array(60 => get_string('numminutes', '', 1), - 300 => get_string('numminutes', '', 5), - 900 => get_string('numminutes', '', 15), - 1800 => get_string('numminutes', '', 30), - 2700 => get_string('numminutes', '', 45), - 3600 => get_string('numminutes', '', 60)))); -$temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('deleteunconfirmed', 'admin'), get_string('configdeleteunconfirmed', 'admin'), 168, array(0 => get_string('never'), - 168 => get_string('numdays', '', 7), - 144 => get_string('numdays', '', 6), - 120 => get_string('numdays', '', 5), - 96 => get_string('numdays', '', 4), - 72 => get_string('numdays', '', 3), - 48 => get_string('numdays', '', 2), - 24 => get_string('numdays', '', 1), - 12 => get_string('numhours', '', 12), - 6 => get_string('numhours', '', 6), - 1 => get_string('numhours', '', 1)))); -$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'), 'firstname lastname', array('language' => get_string('language'), - 'firstname lastname' => get_string('firstname') . ' + ' . get_string('lastname'), - 'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'), - 'firstname' => get_string('firstname')))); -$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0)); -$ADMIN->add('settings', $temp); - - - -// "themesettings" settingpage -$temp = new admin_settingpage('themesettings', get_string('themesettings')); -$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1)); -$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('tabselectedtofront', get_string('tabselectedtofronttext', 'admin'), get_string('tabselectedtofront', 'admin'), 0)); -$ADMIN->add('settings', $temp); -$ADMIN->add('settings', new admin_externalpage('themeselector', get_string('defaulttheme','admin'), $CFG->wwwroot . '/theme/index.php')); - - - - -// calendar settingpage -$temp = new admin_settingpage('calendar', get_string('calendar', 'calendar')); -$temp->add(new admin_setting_special_adminseesall()); -$temp->add(new admin_setting_configselect('startwday', get_string('startwday', 'admin'), get_string('helpstartofweek', 'admin'), 1, array(0 => get_string('sunday', 'calendar'), - 1 => get_string('monday', 'calendar'), - 2 => get_string('tuesday', 'calendar'), - 3 => get_string('wednesday', 'calendar'), - 4 => get_string('thursday', 'calendar'), - 5 => get_string('friday', 'calendar'), - 6 => get_string('saturday', 'calendar')))); -$temp->add(new admin_setting_configtext('calendar_lookahead', get_string('calendar_lookahead', 'admin'), get_string('helpupcominglookahead', 'admin'), 10, PARAM_INT)); -$temp->add(new admin_setting_configtext('calendar_maxevents', get_string('calendar_maxevents', 'admin'), get_string('helpupcomingmaxevents', 'admin'), 5, PARAM_INT)); -$temp->add(new admin_setting_special_calendar_weekend()); - -$ADMIN->add('settings', $temp); - - -// "languageandlocation" settingpage -$temp = new admin_settingpage('languageandlocation', get_string('languageandlocation', 'admin')); -$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), $CFG->lang, get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php -$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1)); -$temp->add(new admin_setting_configtext('langlist', get_string('langlist', 'admin'), get_string('configlanglist', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1)); -$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE)); -$options = get_list_of_timezones(); -$options[99] = get_string('serverlocaltime'); -$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options)); -$options = get_list_of_timezones(); -$options[0] = get_string('choose') .'...'; -$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options)); -$options = get_list_of_timezones(); -$options[99] = get_string('timezonenotforced', 'admin'); -$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options)); -$ADMIN->add('settings', $temp); - - - -$ADMIN->add('settings', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), $CFG->wwwroot . '/admin/timezoneimport.php')); - -// "email" settingpage -$temp = new admin_settingpage('emailsettings', get_string('emailsettings','admin')); -$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST)); -$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configtext('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW)); -$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS)); -$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00', - '01' => '01', - '02' => '02', - '03' => '03', - '04' => '04', - '05' => '05', - '06' => '06', - '07' => '07', - '08' => '08', - '09' => '09', - '10' => '10', - '11' => '11', - '12' => '12', - '13' => '13', - '14' => '14', - '15' => '15', - '16' => '16', - '17' => '17', - '18' => '18', - '19' => '19', - '20' => '20', - '21' => '21', - '22' => '22', - '23' => '23'))); -if (!empty($CFG->unicodedb)) { // These options are only available if running under unicodedb - unset($options); - unset($charsets); - $charsets = get_list_of_charsets(); - $options['0'] = get_string('none'); - $options = array_merge($options, $charsets); - $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options)); - $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0)); -} -$ADMIN->add('settings', $temp); - -// security related settings -$temp = new admin_settingpage('security', get_string('security','admin')); -$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0)); -$temp->add(new admin_setting_configselect('displayloginfailures', get_string('displayloginfailures', 'admin'), get_string('configdisplayloginfailures', 'admin'), '', array('' => get_string('nobody'), - 'admin' => get_string('administrators'), - 'teacher' => get_string('administratorsandteachers'), - 'everybody' => get_string('everybody')))); -$temp->add(new admin_setting_configselect('notifyloginfailures', get_string('notifyloginfailures', 'admin'), get_string('confignotifyloginfailures', 'admin'), '', array('' => get_string('nobody'), - 'mainadmin' => get_string('administrator'), - 'alladmins' => get_string('administratorsall')))); -$options = array(); -for ($i = 1; $i <= 100; $i++) { - $options[$i] = $i; -} -$temp->add(new admin_setting_configselect('notifyloginthreshold', get_string('notifyloginthreshold', 'admin'), get_string('confignotifyloginthreshold', 'admin'), '10', $options)); - -$temp->add(new admin_setting_configcheckbox('loginhttps', get_string('loginhttps', 'admin'), get_string('configloginhttps', 'admin'), 0)); -$temp->add(new admin_setting_configcheckbox('secureforms', get_string('secureforms', 'admin'), get_string('configsecureforms', 'admin'), 0)); -$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_URL)); - - -$ADMIN->add('settings', $temp); - -?> \ No newline at end of file diff --git a/admin/settings/top.php b/admin/settings/top.php index c2bf6fad5ce..e8cffbbd829 100644 --- a/admin/settings/top.php +++ b/admin/settings/top.php @@ -4,15 +4,27 @@ // We use it to create the categories, since they need to exist *before* settingpages and externalpages // are added to them -$ADMIN->add('root', new admin_externalpage('adminnotifications', get_string('notifications'), $CFG->wwwroot . '/admin/index.php')); -$ADMIN->add('root', new admin_category('settings', get_string('sitesettings'))); -$ADMIN->add('root', new admin_category('advancedconfiguration', get_string('advancedconfiguration','admin'))); -$ADMIN->add('root', new admin_category('users', get_string('users'))); -$ADMIN->add('root', new admin_category('courses', get_string('courses'))); -$ADMIN->add('root', new admin_category('maintenance', get_string('maintenance','admin'))); -$ADMIN->add('root', new admin_category('misc', get_string('miscellaneous'))); -if ($CFG->debug > 7) { - $ADMIN->add('root', new admin_category('devel', get_string('developers','admin'))); +$ADMIN->add('root', new admin_externalpage('adminnotifications', get_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php")); +$ADMIN->add('root', new admin_category('users', get_string('users','admin'))); +$ADMIN->add('root', new admin_category('courses', get_string('courses','admin'))); +$ADMIN->add('root', new admin_category('location', get_string('location','admin'))); +$ADMIN->add('root', new admin_category('language', get_string('language'))); + +$ADMIN->add('root', new admin_category('modules', get_string('plugins', 'admin'))); +$ADMIN->add('modules', new admin_externalpage('modulemanagement', get_string('activities'), "$CFG->wwwroot/$CFG->admin/modules.php")); +$ADMIN->add('modules', new admin_externalpage('blockmanagement', get_string('blocks'), "$CFG->wwwroot/$CFG->admin/blocks.php")); +$ADMIN->add('modules', new admin_externalpage('filtermanagement', get_string('managefilters'), "$CFG->wwwroot/$CFG->admin/filters.php")); + +$ADMIN->add('root', new admin_category('security', get_string('security','admin'))); +$ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin'))); +$ADMIN->add('root', new admin_category('server', get_string('server','admin'))); + +$ADMIN->add('root', new admin_category('reports', get_string('reports'))); +foreach(get_list_of_plugins('admin/report') as $plugin) { + $ADMIN->add('reports', new admin_externalpage('report' . $plugin, get_string($plugin, 'admin'), "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php")); } -?> \ No newline at end of file +$ADMIN->add('root', new admin_category('misc', get_string('miscellaneous'), 999)); + + +?> diff --git a/admin/settings/users.php b/admin/settings/users.php index fd44c50d0ef..7f43961e119 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -2,14 +2,20 @@ // This file defines settingpages and externalpages under the "users" category -global $USER; + +$ADMIN->add('users', new admin_externalpage('userauthentication', get_string('authentication','admin'), "$CFG->wwwroot/$CFG->admin/auth.php")); + +// stuff under the "accounts" subcategory +$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin'))); +$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php")); +$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$CFG->wwwroot/$CFG->admin/user.php?newuser=true")); +$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php")); -$ADMIN->add('users', new admin_externalpage('authentication', get_string('authentication'), $CFG->wwwroot . '/admin/auth.php')); -$ADMIN->add('users', new admin_externalpage('edituser', get_string('edituser'), $CFG->wwwroot . '/admin/user.php')); -$ADMIN->add('users', new admin_externalpage('addnewuser', get_string('addnewuser'), $CFG->wwwroot . '/admin/user.php?newuser=true&sesskey='. (isset($USER->sesskey) ? $USER->sesskey : ''))); -$ADMIN->add('users', new admin_externalpage('uploadusers', get_string('uploadusers'), $CFG->wwwroot . '/admin/uploaduser.php')); -$ADMIN->add('users', new admin_externalpage('manageroles', get_string('manageroles'), $CFG->wwwroot . '/admin/roles/manage.php')); -$ADMIN->add('users', new admin_externalpage('assignsitewideroles', get_string('assignsiteroles'), $CFG->wwwroot . '/admin/roles/assign.php?contextid=' . SITEID)); +// stuff under the "roles" subcategory +$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role'))); +$ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php")); +$ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . SITEID)); -?> \ No newline at end of file + +?> diff --git a/admin/stickyblocks.php b/admin/stickyblocks.php index b9a5b8ade70..fc3693500b8 100644 --- a/admin/stickyblocks.php +++ b/admin/stickyblocks.php @@ -9,7 +9,7 @@ $pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE, 'lib' => '/my/pagelib.php', - 'name' => get_string('stickyblocksmymoodle','admin')), + 'name' => get_string('mymoodle','admin')), PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW, 'lib' => '/lib/pagelib.php', 'name' => get_string('stickyblockscourseview','admin')) @@ -82,4 +82,4 @@ print_footer(); -?> \ No newline at end of file +?> diff --git a/admin/user.php b/admin/user.php index 0714fdec8fe..593a76e5994 100644 --- a/admin/user.php +++ b/admin/user.php @@ -20,10 +20,10 @@ $admin = new object(); $teacher = new object(); - $context = get_context_instance(CONTEXT_SYSTEM, SITEID); + if (!$context = get_context_instance(CONTEXT_SYSTEM, SITEID)) { // Should never happen + redirect('index.php'); + } - - //if (! record_exists("user_admins")) { // No admin user yet if (!$CFG->rolesactive) { // No admin user yet. $user->firstname = get_string("admin"); @@ -43,12 +43,6 @@ $admin->userid = $user->id; - /* - if (! insert_record("user_admins", $admin)) { - error("Could not make user $user->id an admin !!!"); - } - */ - if (! $user = get_record("user", "id", $user->id)) { // Double check. error("User ID was incorrect (can't find it)"); } @@ -68,18 +62,6 @@ error("Could not find site-level course"); } - - /* - // Assign as a teacher in the site-level course. - $teacher->userid = $user->id; - $teacher->course = $site->id; - $teacher->authority = 1; - if (! insert_record("user_teachers", $teacher)) { - error("Could not make user $id a teacher of site-level course !!!"); - } - */ - - // Log the user in. $USER = $user; $USER->loggedin = true; @@ -88,11 +70,12 @@ $USER->admin = true; //$USER->teacher["$site->id"] = true; $USER->newadminuser = true; + sesskey(); // For added security, used to check script parameters + load_user_capability(); - - redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id"); + redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id"); // Edit thyself exit; } else { @@ -104,25 +87,27 @@ require_login(); - if ($newuser && confirm_sesskey()) { // Create a new user + if ($newuser) { // Create a new user if (!has_capability('moodle/user:create', $context)) { error('You do not have the required permission to create new users.'); } - - $user->auth = "manual"; - $user->firstname = ""; - $user->lastname = ""; - $user->username = "changeme"; - $user->password = ""; - $user->email = ""; - $user->lang = $CFG->lang; - $user->confirmed = 1; - $user->timemodified = time(); - if (! $user->id = insert_record("user", $user)) { - if (!$user = get_record("user", "username", "changeme")) { // half finished user from another time - error("Could not start a new user!"); + if (!$user = get_record('user', 'username', 'changeme')) { // half finished user from another time + + $user = new object; + $user->auth = 'manual'; + $user->firstname = ''; + $user->lastname = ''; + $user->username = 'changeme'; + $user->password = ''; + $user->email = ''; + $user->lang = $CFG->lang; + $user->confirmed = 1; + $user->timemodified = time(); + + if (! $user->id = insert_record('user', $user)) { + error('Could not start a new user!'); } }