mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Changes throughout Moodle to remove any reserved words from the
Moodle tables. ie user -> userid in many tables, plus in user_students start -> starttime and end -> endtime I've just done all this as carefully as I could ... I don't think I missed anything but it's pretty intensive work and I'd be fooling myself if I didn't think I'd missed a couple. Note that this version should pretty much be able to bootstrap itself using PostgreSQL now ... but this is untested
This commit is contained in:
parent
1f48942e7d
commit
ebc3bd2b24
68 changed files with 277 additions and 461 deletions
|
@ -50,6 +50,12 @@ function forum_upgrade($oldversion) {
|
|||
execute_sql(" ALTER TABLE `forum_posts` ADD `format` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `message` ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2002122300) {
|
||||
execute_sql("ALTER TABLE `forum_posts` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
execute_sql("ALTER TABLE `forum_ratings` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
execute_sql("ALTER TABLE `forum_subscriptions` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ CREATE TABLE prefix_forum_posts (
|
|||
id int(10) unsigned NOT NULL auto_increment,
|
||||
discussion int(10) unsigned NOT NULL default '0',
|
||||
parent int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
userid int(10) unsigned NOT NULL default '0',
|
||||
created int(10) unsigned NOT NULL default '0',
|
||||
modified int(10) unsigned NOT NULL default '0',
|
||||
mailed tinyint(1) unsigned NOT NULL default '0',
|
||||
|
@ -60,7 +60,7 @@ CREATE TABLE prefix_forum_posts (
|
|||
|
||||
CREATE TABLE prefix_forum_ratings (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
userid int(10) unsigned NOT NULL default '0',
|
||||
post int(10) unsigned NOT NULL default '0',
|
||||
time int(10) unsigned NOT NULL default '0',
|
||||
rating tinyint(4) NOT NULL default '0',
|
||||
|
@ -74,7 +74,7 @@ CREATE TABLE prefix_forum_ratings (
|
|||
|
||||
CREATE TABLE prefix_forum_subscriptions (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
userid int(10) unsigned NOT NULL default '0',
|
||||
forum int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY id (id)
|
||||
|
|
|
@ -4,51 +4,7 @@ function forum_upgrade($oldversion) {
|
|||
// This function does anything necessary to upgrade
|
||||
// older versions to match current functionality
|
||||
|
||||
if ($oldversion < 2002073008) {
|
||||
execute_sql("DELETE FROM modules WHERE name = 'discuss' ");
|
||||
execute_sql("ALTER TABLE `discuss` RENAME `forum_discussions` ");
|
||||
execute_sql("ALTER TABLE `discuss_posts` RENAME `forum_posts` ");
|
||||
execute_sql("ALTER TABLE `discuss_ratings` RENAME `forum_ratings` ");
|
||||
execute_sql("ALTER TABLE `forum` CHANGE `intro` `intro` TEXT NOT NULL ");
|
||||
execute_sql("ALTER TABLE `forum` ADD `forcesubscribe` INTEGER DEFAULT '0' NOT NULL AFTER `assessed`");
|
||||
execute_sql("ALTER TABLE `forum` CHANGE `type` `type` ENUM( 'single', 'news', 'social', 'general',
|
||||
'eachuser', 'teacher' ) DEFAULT 'general' NOT NULL ");
|
||||
execute_sql("ALTER TABLE `forum_posts` CHANGE `discuss` `discussion` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'add', 'forum', 'name') ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'add discussion', 'forum_discussions', 'name') ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'add post', 'forum_posts', 'subject') ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'update post', 'forum_posts', 'subject') ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'view discussion', 'forum_discussions', 'name') ");
|
||||
execute_sql("DELETE FROM log_display WHERE module = 'discuss' ");
|
||||
execute_sql("UPDATE log SET action = 'view discussion' WHERE module = 'discuss' AND action = 'view' ");
|
||||
execute_sql("UPDATE log SET action = 'add discussion' WHERE module = 'discuss' AND action = 'add' ");
|
||||
execute_sql("UPDATE log SET module = 'forum' WHERE module = 'discuss' ");
|
||||
notify("Renamed all the old discuss tables (now part of forum) and created new forum_types");
|
||||
}
|
||||
|
||||
if ($oldversion < 2002080100) {
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'view subscribers', 'forum', 'name') ");
|
||||
execute_sql("INSERT INTO log_display VALUES ('forum', 'update', 'forum', 'name') ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2002082900) {
|
||||
execute_sql(" ALTER TABLE `forum_posts` ADD `attachment` VARCHAR(100) NOT NULL AFTER `message` ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2002091000) {
|
||||
if (! execute_sql(" ALTER TABLE `forum_posts` ADD `attachment` VARCHAR(100) NOT NULL AFTER `message` ")) {
|
||||
echo "<P>Don't worry about this error - your server already had this upgrade applied";
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2002100300) {
|
||||
execute_sql(" ALTER TABLE `forum` CHANGE `open` `open` INTEGER DEFAULT '2' NOT NULL ");
|
||||
execute_sql(" UPDATE `forum` SET `open` = 2 WHERE `open` = 1 ");
|
||||
execute_sql(" UPDATE `forum` SET `open` = 1 WHERE `open` = 0 ");
|
||||
}
|
||||
if ($oldversion < 2002101001) {
|
||||
execute_sql(" ALTER TABLE `forum_posts` ADD `format` INTEGER DEFAULT '0' NOT NULL AFTER `message` ");
|
||||
}
|
||||
global $CFG;
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ CREATE TABLE forum_posts (
|
|||
id SERIAL PRIMARY KEY,
|
||||
discussion integer NOT NULL default '0',
|
||||
parent integer NOT NULL default '0',
|
||||
"user" integer NOT NULL default '0',
|
||||
userid integer NOT NULL default '0',
|
||||
created integer NOT NULL default '0',
|
||||
modified integer NOT NULL default '0',
|
||||
mailed integer NOT NULL default '0',
|
||||
|
@ -56,7 +56,7 @@ CREATE TABLE forum_posts (
|
|||
|
||||
CREATE TABLE forum_ratings (
|
||||
id SERIAL PRIMARY KEY,
|
||||
"user" integer NOT NULL default '0',
|
||||
userid integer NOT NULL default '0',
|
||||
post integer NOT NULL default '0',
|
||||
time integer NOT NULL default '0',
|
||||
rating integer NOT NULL default '0'
|
||||
|
@ -69,7 +69,7 @@ CREATE TABLE forum_ratings (
|
|||
|
||||
CREATE TABLE forum_subscriptions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
"user" integer NOT NULL default '0',
|
||||
userid integer NOT NULL default '0',
|
||||
forum integer NOT NULL default '0'
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
|
|
|
@ -159,8 +159,8 @@ function forum_cron () {
|
|||
print_string("processingpost", "forum", $post->id);
|
||||
echo " ... ";
|
||||
|
||||
if (! $userfrom = get_record("user", "id", "$post->user")) {
|
||||
echo "Could not find user $post->user\n";
|
||||
if (! $userfrom = get_record("user", "id", "$post->userid")) {
|
||||
echo "Could not find user $post->userid\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ function forum_grades($forumid) {
|
|||
}
|
||||
if ($ratings = forum_get_user_grades($forumid)) {
|
||||
foreach ($ratings as $rating) {
|
||||
$u = $rating->user;
|
||||
$u = $rating->userid;
|
||||
$r = $rating->rating;
|
||||
if (!isset($sumrating[$u])) {
|
||||
$sumrating[$u][1] = 0;
|
||||
|
@ -376,34 +376,34 @@ function forum_get_post_full($postid) {
|
|||
/// Gets a post with all info ready for forum_print_post
|
||||
global $CFG;
|
||||
|
||||
return get_record_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture, u.id as userid
|
||||
return get_record_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE p.id = '$postid'
|
||||
AND p.user = u.id");
|
||||
AND p.userid = u.id");
|
||||
}
|
||||
|
||||
function forum_get_discussion_posts($discussion, $sort) {
|
||||
/// Gets posts with all info ready for forum_print_post
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT p.*, u.id as userid, u.firstname, u.lastname, u.email, u.picture
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE p.discussion = $discussion
|
||||
AND p.parent > 0
|
||||
AND p.user = u.id $sort");
|
||||
AND p.userid = u.id $sort");
|
||||
}
|
||||
|
||||
function forum_get_child_posts($parent) {
|
||||
/// Gets posts with all info ready for forum_print_post
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT p.*, u.id as userid, u.firstname, u.lastname, u.email, u.picture
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE p.parent = '$parent'
|
||||
AND p.user = u.id
|
||||
AND p.userid = u.id
|
||||
ORDER BY p.created ASC");
|
||||
}
|
||||
|
||||
|
@ -418,13 +418,13 @@ function forum_search_posts($search, $courseid) {
|
|||
$notteacherforum = "";
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT p.*,u.firstname,u.lastname,u.email,u.picture,u.id as userid
|
||||
return get_records_sql("SELECT p.*,u.firstname,u.lastname,u.email,u.picture
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}forum f
|
||||
WHERE (p.message LIKE '%$search%' OR p.subject LIKE '%$search%')
|
||||
AND p.user = u.id
|
||||
AND p.userid = u.id
|
||||
AND p.discussion = d.id
|
||||
AND d.course = '$courseid'
|
||||
AND d.forum = f.id
|
||||
|
@ -439,7 +439,7 @@ function forum_get_ratings($postid, $sort="u.firstname ASC") {
|
|||
FROM {$CFG->prefix}forum_ratings r,
|
||||
{$CFG->prefix}user u
|
||||
WHERE r.post = '$postid'
|
||||
AND r.user = u.id
|
||||
AND r.userid = u.id
|
||||
ORDER BY $sort");
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ function forum_get_user_posts($forumid, $userid) {
|
|||
/// Get all the posts for a user in a forum suitable for forum_print_post
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT p.*, u.id as userid, u.firstname, u.lastname, u.email, u.picture
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum f,
|
||||
{$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
|
@ -466,8 +466,8 @@ function forum_get_user_posts($forumid, $userid) {
|
|||
WHERE f.id = '$forumid'
|
||||
AND d.forum = f.id
|
||||
AND p.discussion = d.id
|
||||
AND p.user = '$userid'
|
||||
AND p.user = u.id
|
||||
AND p.userid = '$userid'
|
||||
AND p.userid = u.id
|
||||
ORDER BY p.modified ASC");
|
||||
}
|
||||
|
||||
|
@ -477,25 +477,25 @@ function forum_get_post_from_log($log) {
|
|||
|
||||
if ($log->action == "add post") {
|
||||
|
||||
return get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname, u.email, u.picture, u.id as userid
|
||||
return get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE p.id = '$log->info'
|
||||
AND d.id = p.discussion
|
||||
AND p.user = u.id
|
||||
AND p.userid = u.id
|
||||
AND u.deleted <> '1'");
|
||||
|
||||
|
||||
} else if ($log->action == "add discussion") {
|
||||
|
||||
return get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname, u.email, u.picture, u.id as userid
|
||||
return get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE d.id = '$log->info'
|
||||
AND d.firstpost = p.id
|
||||
AND p.user = u.id
|
||||
AND p.userid = u.id
|
||||
AND u.deleted <> '1'");
|
||||
}
|
||||
return NULL;
|
||||
|
@ -506,7 +506,7 @@ function forum_get_user_grades($forumid) {
|
|||
/// Get all user grades for a forum
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT r.id, p.user, r.rating
|
||||
return get_records_sql("SELECT r.id, p.userid, r.rating
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}forum_ratings r
|
||||
|
@ -538,14 +538,14 @@ function forum_count_unrated_posts($discussionid, $userid) {
|
|||
FROM {$CFG->prefix}forum_posts
|
||||
WHERE parent > 0
|
||||
AND discussion = '$discussionid'
|
||||
AND user <> '$userid' ")) {
|
||||
AND userid <> '$userid' ")) {
|
||||
|
||||
if ($rated = get_record_sql("SELECT count(*) as num
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}forum_ratings r
|
||||
WHERE p.discussion = '$discussionid'
|
||||
AND p.id = r.post
|
||||
AND r.user = '$userid'")) {
|
||||
AND r.userid = '$userid'")) {
|
||||
$difference = $posts->num - $rated->num;
|
||||
if ($difference > 0) {
|
||||
return $difference;
|
||||
|
@ -569,14 +569,14 @@ function forum_get_discussions($forum="0", $forum_sort="DESC", $user=0) {
|
|||
} else {
|
||||
$userselect = "";
|
||||
}
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture, u.id as userid
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
WHERE d.forum = '$forum'
|
||||
AND p.discussion = d.id
|
||||
AND p.parent= 0
|
||||
AND p.user = u.id $userselect
|
||||
AND p.userid = u.id $userselect
|
||||
ORDER BY p.created $forum_sort");
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ function forum_get_user_discussions($courseid, $userid) {
|
|||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture,
|
||||
u.id as userid, f.type as forumtype, f.name as forumname, f.id as forumid
|
||||
f.type as forumtype, f.name as forumname, f.id as forumid
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u,
|
||||
|
@ -595,7 +595,7 @@ function forum_get_user_discussions($courseid, $userid) {
|
|||
WHERE d.course = '$courseid'
|
||||
AND p.discussion = d.id
|
||||
AND p.parent = 0
|
||||
AND p.user = u.id
|
||||
AND p.userid = u.id
|
||||
AND u.id = '$userid'
|
||||
AND d.forum = f.id
|
||||
ORDER BY p.created ASC");
|
||||
|
@ -615,7 +615,7 @@ function forum_subscribed_users($course, $forum) {
|
|||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}forum_subscriptions s
|
||||
WHERE s.forum = '$forum->id'
|
||||
AND s.user = u.id
|
||||
AND s.userid = u.id
|
||||
AND u.deleted <> 1");
|
||||
}
|
||||
|
||||
|
@ -997,7 +997,7 @@ function forum_print_ratings($post) {
|
|||
function forum_print_rating($post, $user) {
|
||||
global $FORUM_POST_RATINGS;
|
||||
|
||||
if ($rating = get_record("forum_ratings", "user", $user, "post", $post)) {
|
||||
if ($rating = get_record("forum_ratings", "userid", $user, "post", $post)) {
|
||||
if ($FORUM_POST_RATINGS[$rating->rating]) {
|
||||
echo "<FONT SIZE=-1>".get_string("youratedthis", "forum").": <FONT COLOR=green>";
|
||||
echo $FORUM_POST_RATINGS[$rating->rating];
|
||||
|
@ -1214,7 +1214,7 @@ function forum_add_discussion($discussion) {
|
|||
|
||||
$post->discussion = 0;
|
||||
$post->parent = 0;
|
||||
$post->user = $USER->id;
|
||||
$post->userid = $USER->id;
|
||||
$post->created = $timenow;
|
||||
$post->modified = $timenow;
|
||||
$post->mailed = 0;
|
||||
|
@ -1333,13 +1333,13 @@ function forum_is_subscribed($userid, $forumid) {
|
|||
if (forum_is_forcesubscribed($forumid)) {
|
||||
return true;
|
||||
}
|
||||
return record_exists("forum_subscriptions", "user", $userid, "forum", $forumid);
|
||||
return record_exists("forum_subscriptions", "userid", $userid, "forum", $forumid);
|
||||
}
|
||||
|
||||
function forum_subscribe($userid, $forumid) {
|
||||
/// Adds user to the subscriber list
|
||||
|
||||
$sub->user = $userid;
|
||||
$sub->userid = $userid;
|
||||
$sub->forum = $forumid;
|
||||
|
||||
return insert_record("forum_subscriptions", $sub);
|
||||
|
@ -1347,7 +1347,7 @@ function forum_subscribe($userid, $forumid) {
|
|||
|
||||
function forum_unsubscribe($userid, $forumid) {
|
||||
/// Removes user from the subscriber list
|
||||
return delete_records("forum_subscriptions", "user", $userid, "forum", $forumid);
|
||||
return delete_records("forum_subscriptions", "userid", $userid, "forum", $forumid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1482,7 +1482,7 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
|
|||
|
||||
global $USER;
|
||||
|
||||
$ownpost = ($USER->id == $post->user);
|
||||
$ownpost = ($USER->id == $post->userid);
|
||||
$reply = forum_user_can_post($forum);
|
||||
|
||||
forum_print_post($post, $course->id, $ownpost, $reply, $link=false, $rate=false);
|
||||
|
@ -1541,7 +1541,7 @@ function forum_print_posts_flat($discussion, $course, $direction, $assessed, $re
|
|||
|
||||
if ($posts = forum_get_discussion_posts($discussion, $sort)) {
|
||||
foreach ($posts as $post) {
|
||||
$ownpost = ($USER->id == $post->user);
|
||||
$ownpost = ($USER->id == $post->userid);
|
||||
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed);
|
||||
}
|
||||
} else {
|
||||
|
@ -1559,7 +1559,7 @@ function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply)
|
|||
|
||||
echo "<UL>";
|
||||
if ($depth > 0) {
|
||||
$ownpost = ($USER->id == $post->user);
|
||||
$ownpost = ($USER->id == $post->userid);
|
||||
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed); // link=true?
|
||||
echo "<BR>";
|
||||
} else {
|
||||
|
@ -1586,7 +1586,7 @@ function forum_print_posts_nested($parent, $course, $assessed, $reply) {
|
|||
if ($posts = forum_get_child_posts($parent)) {
|
||||
foreach ($posts as $post) {
|
||||
|
||||
$ownpost = ($USER->id == $post->user);
|
||||
$ownpost = ($USER->id == $post->userid);
|
||||
|
||||
echo "<UL>";
|
||||
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed);
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<input type="hidden" name=forum value="<? p($post->forum) ?>">
|
||||
<input type="hidden" name=discussion value="<? p($post->discussion) ?>">
|
||||
<input type="hidden" name=parent value="<? p($post->parent) ?>">
|
||||
<input type="hidden" name=user value="<? p($post->user) ?>">
|
||||
<input type="hidden" name=user value="<? p($post->userid) ?>">
|
||||
<input type="hidden" name=edit value="<? p($post->edit) ?>">
|
||||
<input type="submit" value="<? print_string("savechanges"); ?>">
|
||||
</td>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
$post->discussion = 0; // ie discussion # not defined yet
|
||||
$post->parent = 0;
|
||||
$post->subject = "";
|
||||
$post->user = $USER->id;
|
||||
$post->userid = $USER->id;
|
||||
$post->message = "";
|
||||
$post->format = $defaultformat;
|
||||
|
||||
|
@ -125,7 +125,7 @@
|
|||
$post->discussion = $parent->discussion;
|
||||
$post->parent = $parent->id;
|
||||
$post->subject = $parent->subject;
|
||||
$post->user = $USER->id;
|
||||
$post->userid = $USER->id;
|
||||
$post->message = "";
|
||||
$post->format = $defaultformat;
|
||||
|
||||
|
@ -141,7 +141,7 @@
|
|||
if (! $post = forum_get_post_full($edit)) {
|
||||
error("Post ID was incorrect");
|
||||
}
|
||||
if ($post->user <> $USER->id) {
|
||||
if ($post->userid <> $USER->id) {
|
||||
error("You can't edit other people's posts!");
|
||||
}
|
||||
if ((time() - $post->created) > $CFG->maxeditingtime) {
|
||||
|
@ -183,7 +183,7 @@
|
|||
if (! $forum = get_record("forum", "id", $discussion->forum)) {
|
||||
error("The forum number was incorrect ($discussion->forum)");
|
||||
}
|
||||
if (($post->user <> $USER->id) and !isteacher($forum->course)) {
|
||||
if (($post->userid <> $USER->id) and !isteacher($forum->course)) {
|
||||
error("You can't delete other people's posts!");
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
continue;
|
||||
}
|
||||
if ($rating) {
|
||||
if (record_exists("forum_ratings", "user", $USER->id, "post", $post)) {
|
||||
if (record_exists("forum_ratings", "userid", $USER->id, "post", $post)) {
|
||||
error("You've rated this question before ($post)");
|
||||
} else {
|
||||
unset($newrating);
|
||||
$newrating->user = $USER->id;
|
||||
$newrating->userid = $USER->id;
|
||||
$newrating->time = time();
|
||||
$newrating->post = $post;
|
||||
$newrating->rating = $rating;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
error("Course ID was incorrect");
|
||||
}
|
||||
|
||||
if (!isteacher($course->id) and $USER->id != $post->user) {
|
||||
if (!isteacher($course->id) and $USER->id != $post->userid) {
|
||||
error("You can only look at results for posts you own");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require("../../config.php");
|
||||
require("lib.php");
|
||||
|
||||
require_variable($id); // course id
|
||||
optional_variable($search, ""); // user id
|
||||
require_variable($id); // course id
|
||||
optional_variable($search, ""); // search string
|
||||
|
||||
$search = strip_tags($search);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2002101001;
|
||||
$module->version = 2002122300;
|
||||
$module->cron = 60;
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue