fixed some small bugs

This commit is contained in:
gustav_delius 2004-12-31 20:02:45 +00:00
parent 84b3c159df
commit 444f6252dd
3 changed files with 16 additions and 11 deletions

View file

@ -17,13 +17,13 @@ function message_print_contacts() {
/// get lists of contacts and unread messages /// get lists of contacts and unread messages
$onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture $onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom
AND mc.blocked='0' AND mc.blocked='0'
ORDER BY u.lastaccess DESC"); ORDER BY u.lastaccess DESC");
$offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom
AND mc.blocked='0' AND mc.blocked='0'
@ -157,7 +157,7 @@ function message_print_contacts() {
/// link to add to contact list /// link to add to contact list
$strcontact .= message_contact_link($messageuser->useridfrom, 'add', true); $strcontact .= message_contact_link($messageuser->useridfrom, 'add', true);
$strblock .= message_contact_link($messageuser->useridfrom, 'block', true); $strblock = message_contact_link($messageuser->useridfrom, 'block', true);
echo '<tr><td class="message_pic">'; echo '<tr><td class="message_pic">';
print_user_picture($messageuser->useridfrom, SITEID, $messageuser->picture, 20, false, false); print_user_picture($messageuser->useridfrom, SITEID, $messageuser->picture, 20, false, false);
@ -197,7 +197,7 @@ function message_count_messages($messagearray, $field='', $value='') {
function message_print_search() { function message_print_search() {
global $USER; global $ME, $USER;
if ($frm = data_submitted()) { if ($frm = data_submitted()) {
@ -307,7 +307,7 @@ function message_get_contact($contactid) {
function message_print_search_results($frm) { function message_print_search_results($frm) {
global $USER; global $ME, $USER;
echo '<div align="center">'; echo '<div align="center">';
@ -591,9 +591,10 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
} }
$select = 'u.deleted = \'0\' AND u.confirmed = \'1\''; $select = 'u.deleted = \'0\' AND u.confirmed = \'1\'';
$fields = 'u.id, u.firstname, u.lastname, u.picture';
if (!$courseid or $courseid == SITEID) { if (!$courseid or $courseid == SITEID) {
return get_records_sql("SELECT u.id, u.firstname, u.lastname return get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u FROM {$CFG->prefix}user u
WHERE $select WHERE $select
AND ($fullname $LIKE '%$searchtext%') AND ($fullname $LIKE '%$searchtext%')
@ -601,7 +602,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
} else { } else {
if (!$teachers = get_records_sql("SELECT u.id, u.firstname, u.lastname if (!$teachers = get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u, FROM {$CFG->prefix}user u,
{$CFG->prefix}user_teachers s {$CFG->prefix}user_teachers s
WHERE $select AND s.course = '$courseid' AND s.userid = u.id WHERE $select AND s.course = '$courseid' AND s.userid = u.id
@ -609,7 +610,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
$except $order")) { $except $order")) {
$teachers = array(); $teachers = array();
} }
if (!$students = get_records_sql("SELECT u.id, u.firstname, u.lastname if (!$students = get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u, FROM {$CFG->prefix}user u,
{$CFG->prefix}user_students s {$CFG->prefix}user_students s
WHERE $select AND s.course = '$courseid' AND s.userid = u.id WHERE $select AND s.course = '$courseid' AND s.userid = u.id

View file

@ -15,7 +15,9 @@
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="2"><input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td> <td colspan="2">
<input type="hidden" name="mycourses" value="0" />
<input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td>
</tr> </tr>
<tr><td colspan="3"><hr /></td></tr> <tr><td colspan="3"><hr /></td></tr>
@ -32,7 +34,9 @@
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="2"><input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td> <td colspan="2">
<input type="hidden" name="includeblocked" value="0" />
<input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td>
</tr> </tr>
<tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlytome', 'message') ?>" value="tome" checked="checked" /><?php print_string('onlytome', 'message') ?></td></tr> <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlytome', 'message') ?>" value="tome" checked="checked" /><?php print_string('onlytome', 'message') ?></td></tr>

View file

@ -116,7 +116,7 @@
case 'edit': /// Print the bottom frame with the text editor case 'edit': /// Print the bottom frame with the text editor
/// Check that the user is not blocking us!! /// Check that the user is not blocking us!!
if ($contact = get_record('message_contacts', 'userid', $user->id, 'contact', $USER->id)) { if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
if ($contact->blocked) { if ($contact->blocked) {
print_heading(get_string('userisblockingyou', 'message')); print_heading(get_string('userisblockingyou', 'message'));
exit; exit;