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
/// Gather and show results
$status = check_moodle_environment($version, $environment_results);
-/// Other links
- echo '<div align="center">';
- print_single_button('phpinfo.php', NULL, get_string('phpinfo'));
- echo '</div>';
-
/// Print footer
admin_externalpage_print_footer($adminroot);
?>
$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");
$stractivities = get_string("activities");
$stractivitymodule = get_string("activitymodule");
-// print_header("$site->shortname: $strmanagemodules", "$site->fullname",
-// "<a href=\"index.php\">$stradministration</a> -> ".
-// "<a href=\"configure.php\">$strconfiguration</a> -> $strmanagemodules");
-
admin_externalpage_print_header($adminroot);
- print_heading($strmanagemodules);
+ print_heading($stractivities);
$coursesaffected = false;
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);
print_table($table);
}
- print_footer();
+ admin_externalpage_print_footer($adminroot);
?>
+++ /dev/null
-<?php
-
- if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
- }
-
- if (!empty($CFG->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),
- '<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
- '<input type="submit" value="'.get_string('view').'" />') ;
-
- echo '<form action="report/courseoverview/index.php" method="post">'."\n";
- print_table($table);
- echo '</form>';
- if ($statsstatus !== NULL) {
- notify ($statsstatus);
- }
-
- }
-?>
-
+++ /dev/null
-<?php
-
- if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
- }
-
- require_once($CFG->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 '<br />';
- print_heading(get_string('chooselivelogs') .':');
-
- echo '<center><h3>';
- link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
- echo '</h3></center>';
-
-?>
/** */
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);
// Print the header.
$strtitle = get_string('unittests', $langfile);
-$stradmin = get_string('administration');
-print_header("$SITE->shortname: $strtitle", $SITE->fullname,
- '<a href="../../index.php">' . get_string('administration') . '</a> -> ' .
- '<a href="../../misc.php">' . get_string('miscellaneous') . '</a> -> ' .
- '<a href="../../report.php">' . get_string('reports') . '</a> -> ' .
- $strtitle, '', '<style type="text/css">' . $reporter->_getCss() . '</style>');
+
+admin_externalpage_print_header($adminroot);
+
if ($showsearch) {
print_heading('Searching for test cases');
}
print_simple_box_end();
// Footer.
-print_footer();
+admin_externalpage_print_footer($adminroot);
-?>
\ No newline at end of file
+?>
+++ /dev/null
-<?php
-/**
- * This file is used to include a link to the unit tests on the report page
- * /admin/report.php.
- *
- * @copyright © 2006 The Open University
- * @author T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @version $Id$
- * @package SimpleTestEx
- */
-
-if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); // It must be included from a Moodle page
-}
-$langfile = 'simpletest';
-
-print_heading(get_string('unittests', $langfile));
-print_heading('<a href="'.$CFG->wwwroot.'/admin/report/simpletest/index.php">' .
- get_string('rununittests', $langfile) . '</a>', '', 3);
-?>
\ No newline at end of file
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');
+
+ $adminroot = admin_get_root();
+
+ admin_externalpage_setup('reportcourseoverview', $adminroot);
- $courseid = required_param('course', PARAM_INT);
+ 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);
}
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");
}
stats_check_uptodate($course->id);
- $strreports = get_string("reports");
- $strstats = get_string('stats');
-
- $menu = report_stats_mode_menu($course, $mode, $time);
-
-
- $crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
- <a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
- $strstats";
+// $strreports = get_string("reports");
+// $strstats = get_string('stats');
+//
+// $menu = report_stats_mode_menu($course, $mode, $time);
+//
+//
+// $crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
+// <a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
+// $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
+?>
+++ /dev/null
-<?php //$Id$
-
- if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
- }
-
- if (!empty($CFG->enablestats)) {
- echo '<p style="text-align:center;">';
- echo '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
- echo '</p>';
- $statsstatus = stats_check_uptodate($course->id);
- if ($statsstatus !== NULL) {
- notify ($statsstatus);
- }
- }
-?>
\ No newline at end of file
print_footer();
-?>
\ No newline at end of file
+?>
+++ /dev/null
-<?php // $Id$
-
-// This file defines settingpages and externalpages under the "advancedconfiguration" category
-
-// "systempaths" settingpage
-$temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
-$temp->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
// 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));
-$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
+?>
+++ /dev/null
-<?php
-if ($CFG->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/'));
-
-}
-?>
<?php // $Id$
// * Miscellaneous settings (still to be sorted)
-$temp = new admin_settingpage('legacy', get_string('legacy','admin'));
-$temp->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
+?>
+++ /dev/null
-<?php // $Id$
-
-// This file defines settingpages and externalpages under the "settings" category
-
-// "frontpage" settingpage
-$temp = new admin_settingpage('frontpage', get_string('frontpage','admin'));
-$temp->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
// 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));
+
+
+?>
// 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"));
-$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 "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"));
-?>
\ No newline at end of file
+
+// 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));
+
+
+?>
$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'))
print_footer();
-?>
\ No newline at end of file
+?>
$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");
$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)");
}
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;
$USER->admin = true;
//$USER->teacher["$site->id"] = true;
$USER->newadminuser = true;
+
sesskey(); // For added security, used to check script parameters
- load_user_capability();
+ 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 {
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!');
}
}