diff --git a/admin/index.php b/admin/index.php
index 711753e8266..bef0699778e 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -9,7 +9,7 @@
// Check databases and modules and install as needed.
if (! $db->Metatables() ) {
- print_header("Setting up database", "Setting up database", "Setting up databases for the first time", "");
+ print_header("Setting up database", "Setting up database", "Setting up databases for the first time");
if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
$db->debug = true;
@@ -34,6 +34,7 @@
if ($dversion = get_field("config", "value", "name", "version")) {
if ($version > $dversion) { // upgrade
+ print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
notify("Upgrading databases from version $dversion to $version...");
$db->debug=true;
if (upgrade_moodle($dversion)) {
@@ -56,6 +57,7 @@
} else {
$dversion->name = "version";
$dversion->value = $version;
+ print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
if (insert_record("config", $dversion)) {
notify("You are currently using Moodle version $version");
print_heading("Continue");
@@ -125,7 +127,9 @@
print_header("Setting up database", "Setting up database", "Setting up module tables", "");
}
$updated_modules = true;
+ $db->debug = true;
if (modify_database("$fullmod/db/$CFG->dbtype.sql")) {
+ $db->debug = false;
if ($module->id = insert_record("modules", $module)) {
notify("$module->name tables have been set up correctly");
} else {
diff --git a/admin/user.php b/admin/user.php
index 56853008b44..996e687e2d4 100644
--- a/admin/user.php
+++ b/admin/user.php
@@ -149,6 +149,11 @@
$usernew->timemodified = time();
if (update_record("user", $usernew)) {
+ if ($usernew->id == $USER->id) { // Reload admin
+ $USER = get_user_info_from_db("id", $usernew->id);
+ $USER->loggedin = true;
+ set_moodle_cookie($USER->username);
+ }
redirect("index.php", "Changes saved");
} else {
error("Could not update the user record ($user->id)");
diff --git a/course/edit.html b/course/edit.html
index 8cc7758afb9..9ed0f07e58c 100644
--- a/course/edit.html
+++ b/course/edit.html
@@ -43,7 +43,7 @@
print_string("format") ?>: |
- choose_from_menu ($FORMATS, "format", "$form->format");
+ choose_from_menu ($COURSE_FORMATS, "format", "$form->format");
formerr($err["format"]);
?>
|
diff --git a/course/editsection.php b/course/editsection.php
index b06a24e7138..a4649c6f942 100644
--- a/course/editsection.php
+++ b/course/editsection.php
@@ -42,7 +42,7 @@
$form = $section;
}
- $sectionname = $SECTION[$course->format];
+ $sectionname = $COURSE_SECTION[$course->format];
print_header("Edit $sectionname $section->section", "Edit $sectionname $section->section", "", "form.summary");
diff --git a/course/lib.php b/course/lib.php
index 97e160fc2de..b3d3e3a4013 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -1,19 +1,19 @@
// $Id$
-$MAXNEWSDISPLAY = 4;
-
-$FORMATS = array (
+$COURSE_FORMATS = array (
"weeks" => "Weekly layout",
"social" => "Social layout",
"topics" => "Topics layout"
);
-$SECTION = array (
+$COURSE_SECTION = array (
"weeks" => "week",
"social" => "section",
"topics" => "topic"
);
+$COURSE_MAX_LOG_DISPLAY = 150; // days
+
function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
diff --git a/course/loggraph.php b/course/loggraph.php
index 8913d3d41bd..6b375c28960 100644
--- a/course/loggraph.php
+++ b/course/loggraph.php
@@ -31,9 +31,12 @@
$timenow = time();
switch ($type) {
-
case "usercourse.png":
+ $COURSE_MAX_LOG_DISPLAY = $COURSE_MAX_LOG_DISPLAY * 3600 * 24; // seconds
+ if ($timenow - $course->startdate > $COURSE_MAX_LOG_DISPLAY) {
+ $course->startdate = $timenow - $COURSE_MAX_LOG_DISPLAY;
+ }
$timestart = usergetmidnight($course->startdate);
$i = 0;
while ($timestart < $timenow) {
diff --git a/course/mod.php b/course/mod.php
index d392d1f4c8a..929e987bc38 100644
--- a/course/mod.php
+++ b/course/mod.php
@@ -147,7 +147,7 @@
error("This module doesn't exist");
}
- $sectionname = $SECTION[$course->format];
+ $sectionname = $COURSE_SECTION[$course->format];
if (! $form = get_record($module->name, "id", $cm->instance)) {
error("The required instance of this module doesn't exist");
@@ -182,7 +182,7 @@
error("This course doesn't exist");
}
- $sectionname = $SECTION[$course->format];
+ $sectionname = $COURSE_SECTION[$course->format];
if (! $module = get_record("modules", "name", $add)) {
error("This module type doesn't exist");
diff --git a/mod/forum/db/mysql.sql b/mod/forum/db/mysql.sql
index 0eec2429e0f..6f01478163c 100644
--- a/mod/forum/db/mysql.sql
+++ b/mod/forum/db/mysql.sql
@@ -5,11 +5,12 @@
CREATE TABLE forum (
id int(10) unsigned NOT NULL auto_increment,
course int(10) unsigned NOT NULL default '0',
- type enum('discussion','news','general','social','eachuser','teacher') NOT NULL default 'general',
+ type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general',
name varchar(255) NOT NULL default '',
- intro mediumtext NOT NULL,
+ intro text NOT NULL,
open tinyint(1) unsigned NOT NULL default '0',
assessed tinyint(1) unsigned NOT NULL default '0',
+ forcesubscribe tinyint(1) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY id (id)
@@ -38,7 +39,7 @@ CREATE TABLE forum_discussions (
CREATE TABLE forum_posts (
id int(10) unsigned NOT NULL auto_increment,
- discuss int(10) unsigned NOT NULL default '0',
+ discussion int(10) unsigned NOT NULL default '0',
parent int(10) unsigned NOT NULL default '0',
user int(10) unsigned NOT NULL default '0',
created int(10) unsigned NOT NULL default '0',