2004-10-03 15:28:35 +00:00
|
|
|
<?php // $Id$
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-08-16 15:41:57 +00:00
|
|
|
/// Check that config.php exists, if not then call the install script
|
2006-03-06 13:22:37 +00:00
|
|
|
if (!file_exists('../config.php')) {
|
2004-08-16 15:41:57 +00:00
|
|
|
header('Location: ../install.php');
|
2003-01-13 14:05:29 +00:00
|
|
|
die;
|
|
|
|
}
|
2006-07-20 06:39:48 +00:00
|
|
|
|
|
|
|
/// Check that PHP is of a sufficient version
|
|
|
|
/// Moved here because older versions do not allow while(@ob_end_clean());
|
2008-08-01 09:44:37 +00:00
|
|
|
if (version_compare(phpversion(), "5.2.4") < 0) {
|
2006-07-20 06:39:48 +00:00
|
|
|
$phpversion = phpversion();
|
2008-08-01 09:44:37 +00:00
|
|
|
echo "Sorry, Moodle requires PHP 5.2.4 or later (currently using version $phpversion)";
|
2006-07-20 06:39:48 +00:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
2008-08-16 12:16:01 +00:00
|
|
|
/// try to flush everything all the time
|
2006-07-20 06:39:48 +00:00
|
|
|
@ob_implicit_flush(true);
|
|
|
|
while(@ob_end_clean()); // ob_end_flush prevents sending of headers
|
|
|
|
|
|
|
|
|
2008-08-16 12:16:01 +00:00
|
|
|
require('../config.php');
|
|
|
|
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
|
2006-08-17 16:59:39 +00:00
|
|
|
|
2007-11-15 02:39:43 +00:00
|
|
|
$id = optional_param('id', '', PARAM_TEXT);
|
2006-03-06 13:22:37 +00:00
|
|
|
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
2007-01-22 20:15:12 +00:00
|
|
|
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
2008-08-16 12:16:01 +00:00
|
|
|
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
2007-01-22 20:15:12 +00:00
|
|
|
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
|
|
|
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
2006-08-01 07:46:19 +00:00
|
|
|
|
2007-01-22 20:15:12 +00:00
|
|
|
/// set install/upgrade autocontinue session flag
|
|
|
|
if ($autopilot) {
|
2008-06-20 09:11:08 +00:00
|
|
|
$SESSION->installautopilot = $autopilot;
|
2007-01-22 20:15:12 +00:00
|
|
|
}
|
|
|
|
|
2003-01-28 02:52:13 +00:00
|
|
|
/// Check some PHP server settings
|
|
|
|
|
2006-10-06 06:26:06 +00:00
|
|
|
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
2003-01-28 02:52:13 +00:00
|
|
|
|
2003-05-17 02:05:10 +00:00
|
|
|
if (ini_get_bool('session.auto_start')) {
|
2008-08-16 12:16:01 +00:00
|
|
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
|
2003-01-28 02:52:13 +00:00
|
|
|
}
|
2003-05-17 02:05:10 +00:00
|
|
|
|
|
|
|
if (ini_get_bool('magic_quotes_runtime')) {
|
2008-08-16 12:16:01 +00:00
|
|
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
|
2003-01-28 02:52:13 +00:00
|
|
|
}
|
|
|
|
|
2003-05-17 02:05:10 +00:00
|
|
|
if (!ini_get_bool('file_uploads')) {
|
2008-08-16 12:16:01 +00:00
|
|
|
print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
|
2003-01-28 02:52:13 +00:00
|
|
|
}
|
|
|
|
|
2002-09-19 12:01:55 +00:00
|
|
|
/// Check that config.php has been edited
|
|
|
|
|
2002-05-27 13:02:48 +00:00
|
|
|
if ($CFG->wwwroot == "http://example.com/moodle") {
|
2008-04-09 08:21:51 +00:00
|
|
|
print_error('configmoodle', 'debug');
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2003-01-13 14:05:29 +00:00
|
|
|
|
|
|
|
/// Check settings in config.php
|
|
|
|
|
2003-12-05 03:10:45 +00:00
|
|
|
$dirroot = dirname(realpath("../index.php"));
|
2003-06-03 03:00:37 +00:00
|
|
|
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
2008-08-16 12:16:01 +00:00
|
|
|
print_error('fixsetting', 'debug', '', (object)array('current'=>$CFG->dirroot, 'found'=>$dirroot));
|
2003-01-13 14:05:29 +00:00
|
|
|
}
|
|
|
|
|
2003-05-26 14:38:41 +00:00
|
|
|
/// Set some necessary variables during set-up to avoid PHP warnings later on this page
|
|
|
|
if (!isset($CFG->framename)) {
|
|
|
|
$CFG->framename = "_top";
|
|
|
|
}
|
|
|
|
if (!isset($CFG->release)) {
|
|
|
|
$CFG->release = "";
|
|
|
|
}
|
|
|
|
if (!isset($CFG->version)) {
|
|
|
|
$CFG->version = "";
|
|
|
|
}
|
|
|
|
|
2008-08-16 12:16:01 +00:00
|
|
|
$version = null;
|
|
|
|
$release = null;
|
|
|
|
include("$CFG->dirroot/version.php"); // defines $version and $release
|
2007-01-22 22:32:00 +00:00
|
|
|
|
|
|
|
if (!$version or !$release) {
|
2008-04-09 08:21:51 +00:00
|
|
|
print_error('withoutversion', 'debug'); // without version, stop
|
2007-01-22 22:32:00 +00:00
|
|
|
}
|
|
|
|
|
2008-09-16 12:19:43 +00:00
|
|
|
upgrade_db($version, $release);
|
2006-09-10 21:10:48 +00:00
|
|
|
|
2002-10-25 02:02:02 +00:00
|
|
|
|
2007-12-22 18:17:15 +00:00
|
|
|
/// Check for valid admin user - no guest autologin
|
|
|
|
require_login(0, false);
|
2004-03-22 01:58:40 +00:00
|
|
|
|
2008-05-02 04:37:02 +00:00
|
|
|
$context = get_context_instance(CONTEXT_SYSTEM);
|
2006-08-08 05:13:06 +00:00
|
|
|
|
2006-08-14 06:03:30 +00:00
|
|
|
require_capability('moodle/site:config', $context);
|
|
|
|
|
2006-09-02 15:29:52 +00:00
|
|
|
/// check that site is properly customized
|
2007-10-02 21:38:53 +00:00
|
|
|
if (empty($site->shortname)) {
|
|
|
|
// probably new installation - lets return to frontpage after this step
|
2008-07-04 23:53:13 +00:00
|
|
|
// remove settings that we want uninitialised
|
|
|
|
unset_config('registerauth');
|
2007-10-02 21:38:53 +00:00
|
|
|
redirect('upgradesettings.php?return=site');
|
2006-09-02 15:29:52 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2005-05-26 14:46:28 +00:00
|
|
|
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
|
|
|
|
2005-06-15 12:31:09 +00:00
|
|
|
if (!empty($id)) {
|
|
|
|
if ($id == $CFG->siteidentifier) {
|
2005-05-26 14:46:28 +00:00
|
|
|
set_config('registered', time());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-21 15:29:42 +00:00
|
|
|
/// setup critical warnings before printing admin tree block
|
|
|
|
$insecuredataroot = is_dataroot_insecure(true);
|
2008-09-16 12:19:43 +00:00
|
|
|
$register_globals_enabled = ini_get_bool('register_globals');
|
2008-08-21 15:29:42 +00:00
|
|
|
|
2008-09-16 12:19:43 +00:00
|
|
|
$SESSION->admin_critical_warning = ($register_globals_enabled || $insecuredataroot==INSECURE_DATAROOT_ERROR);
|
2008-08-21 15:29:42 +00:00
|
|
|
|
2007-12-19 17:35:20 +00:00
|
|
|
$adminroot =& admin_get_root();
|
2007-04-18 09:39:49 +00:00
|
|
|
|
|
|
|
/// Check if there are any new admin settings which have still yet to be set
|
2007-12-19 17:35:20 +00:00
|
|
|
if (any_new_admin_settings($adminroot)){
|
2007-04-18 09:39:49 +00:00
|
|
|
redirect('upgradesettings.php');
|
|
|
|
}
|
|
|
|
|
2006-08-19 02:46:46 +00:00
|
|
|
/// Everything should now be set up, and the user is an admin
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2006-08-19 02:46:46 +00:00
|
|
|
/// Print default admin page with notifications.
|
2006-08-18 07:25:17 +00:00
|
|
|
|
2007-04-30 17:08:34 +00:00
|
|
|
admin_externalpage_setup('adminnotifications');
|
|
|
|
admin_externalpage_print_header();
|
2006-08-19 02:46:46 +00:00
|
|
|
|
2006-03-10 03:43:33 +00:00
|
|
|
/// Deprecated database! Warning!!
|
|
|
|
if (!empty($CFG->migrated_to_new_db)) {
|
2007-03-02 20:46:45 +00:00
|
|
|
print_box(print_string('dbmigrationdeprecateddb', 'admin'), 'generalbox adminwarning');
|
2006-03-10 03:43:33 +00:00
|
|
|
}
|
|
|
|
|
2006-08-19 02:46:46 +00:00
|
|
|
/// Check for any special upgrades that might need to be run
|
2006-09-20 21:00:45 +00:00
|
|
|
if (!empty($CFG->upgrade)) {
|
2007-01-09 12:32:12 +00:00
|
|
|
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
|
2004-02-05 09:55:50 +00:00
|
|
|
}
|
|
|
|
|
2008-08-21 15:29:42 +00:00
|
|
|
if ($register_globals_enabled) {
|
|
|
|
print_box(get_string('globalswarning', 'admin'), 'generalbox adminerror');
|
2006-01-05 06:28:57 +00:00
|
|
|
}
|
|
|
|
|
2008-08-21 15:29:42 +00:00
|
|
|
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
|
2007-03-02 20:46:45 +00:00
|
|
|
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
2008-08-21 15:29:42 +00:00
|
|
|
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
|
|
|
|
print_box(get_string('datarootsecurityerror', 'admin', $CFG->dataroot), 'generalbox adminerror');
|
2008-09-16 12:19:43 +00:00
|
|
|
|
2006-08-28 20:11:24 +00:00
|
|
|
}
|
|
|
|
|
2008-07-07 14:34:40 +00:00
|
|
|
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
|
|
|
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
|
|
|
|
}
|
|
|
|
|
2007-10-17 20:21:16 +00:00
|
|
|
if (substr($CFG->wwwroot, -1) == '/') {
|
|
|
|
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
|
|
|
|
}
|
|
|
|
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
|
|
|
|
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
|
|
|
|
}
|
|
|
|
|
2005-01-17 20:59:17 +00:00
|
|
|
/// If no recently cron run
|
2008-06-02 21:39:23 +00:00
|
|
|
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
|
2005-01-17 20:59:17 +00:00
|
|
|
if (time() - $lastcron > 3600 * 24) {
|
2006-03-12 07:51:53 +00:00
|
|
|
$strinstallation = get_string('installation', 'install');
|
|
|
|
$helpbutton = helpbutton('install', $strinstallation, 'moodle', true, false, '', true);
|
2007-03-02 20:46:45 +00:00
|
|
|
print_box(get_string('cronwarning', 'admin')." ".$helpbutton, 'generalbox adminwarning');
|
2005-01-17 20:59:17 +00:00
|
|
|
}
|
|
|
|
|
2006-12-12 10:39:17 +00:00
|
|
|
/// Print multilang upgrade notice if needed
|
|
|
|
if (empty($CFG->filter_multilang_converted)) {
|
2007-03-02 20:46:45 +00:00
|
|
|
print_box(get_string('multilangupgradenotice', 'admin'), 'generalbox adminwarning');
|
2006-12-12 10:39:17 +00:00
|
|
|
}
|
|
|
|
|
2005-02-10 05:11:34 +00:00
|
|
|
/// Alert if we are currently in maintenance mode
|
|
|
|
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
|
2007-03-02 20:46:45 +00:00
|
|
|
print_box(get_string('sitemaintenancewarning', 'admin'), 'generalbox adminwarning');
|
2006-01-31 08:21:04 +00:00
|
|
|
}
|
|
|
|
|
2005-02-10 05:11:34 +00:00
|
|
|
|
2007-11-15 02:39:43 +00:00
|
|
|
/// Print slightly annoying registration button
|
|
|
|
$options = array();
|
|
|
|
$options['sesskey'] = $USER->sesskey;
|
|
|
|
print_box_start('generalbox adminwarning');
|
|
|
|
if(!isset($CFG->registered)) {
|
|
|
|
print_string('pleaseregister', 'admin');
|
2005-05-26 14:46:28 +00:00
|
|
|
}
|
2007-11-15 02:39:43 +00:00
|
|
|
else { /* if (isset($CFG->registered) && $CFG->registered < (time() - 3600*24*30*6)) { */
|
|
|
|
print_string('pleaserefreshregistration', 'admin', userdate($CFG->registered));
|
|
|
|
}
|
|
|
|
print_single_button('register.php', $options, get_string('registration'));
|
|
|
|
print_box_end();
|
|
|
|
|
2005-05-26 14:46:28 +00:00
|
|
|
|
2003-08-10 09:12:17 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
2006-09-12 09:30:05 +00:00
|
|
|
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
2006-01-13 15:30:24 +00:00
|
|
|
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
2008-03-05 05:36:49 +00:00
|
|
|
'<a href="http://docs.moodle.org/en/Release" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
2006-03-10 08:28:59 +00:00
|
|
|
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
2006-09-12 09:30:05 +00:00
|
|
|
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
2006-03-10 08:28:59 +00:00
|
|
|
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
2007-01-09 12:32:12 +00:00
|
|
|
print_box($copyrighttext, 'copyright');
|
2003-08-10 09:12:17 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
2003-08-10 08:01:14 +00:00
|
|
|
|
2007-04-30 17:08:34 +00:00
|
|
|
admin_externalpage_print_footer();
|
2002-09-19 12:01:55 +00:00
|
|
|
|
2008-01-08 23:27:45 +00:00
|
|
|
?>
|