$countparticipants = count_enrolled_users($context);
$participants = get_enrolled_users($context, '', 0, 'u.*', '', $page*MESSAGE_CONTACTS_PER_PAGE, MESSAGE_CONTACTS_PER_PAGE);
-
+
$pagingbar = new paging_bar($countparticipants, $page, MESSAGE_CONTACTS_PER_PAGE, $PAGE->url, 'page');
echo $OUTPUT->render($pagingbar);
GROUP BY $userfields
ORDER BY u.firstname ASC";
- if ($rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id))){
- foreach($rs as $rd){
-
- if($rd->lastaccess >= $timefrom){
- // they have been active recently, so are counted online
- $onlinecontacts[] = $rd;
-
- }else{
- $offlinecontacts[] = $rd;
- }
+ $rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id));
+ foreach ($rs as $rd) {
+ if ($rd->lastaccess >= $timefrom) {
+ // they have been active recently, so are counted online
+ $onlinecontacts[] = $rd;
+
+ } else {
+ $offlinecontacts[] = $rd;
+ }
- if (!empty($user2) && $user2->id==$rd->id) {
- $user2->iscontact = true;
- }
+ if (!empty($user2) && $user2->id==$rd->id) {
+ $user2->iscontact = true;
}
- unset($rd);
- $rs->close();
}
+ $rs->close();
// get messages from anyone who isn't in our contact list and count the number
// of messages we have from each of them
GROUP BY $userfields
ORDER BY u.firstname ASC";
- if($rs = $DB->get_recordset_sql($strangersql, array($USER->id))){
- foreach($rs as $rd){
- $strangers[] = $rd;
- }
- unset($rd);
- $rs->close();
+ $rs = $DB->get_recordset_sql($strangersql, array($USER->id));
+ foreach ($rs as $rd) {
+ $strangers[] = $rd;
}
+ $rs->close();
return array($onlinecontacts, $offlinecontacts, $strangers);
}
$doingsearch = false;
if ($frm) {
- $doingsearch = !empty($frm->combinedsubmit) || !empty($frm->keywords) || (!empty($frm->personsubmit) and !empty($frm->name));
+ if (confirm_sesskey()) {
+ $doingsearch = !empty($frm->combinedsubmit) || !empty($frm->keywords) || (!empty($frm->personsubmit) and !empty($frm->name));
+ } else {
+ $frm = false;
+ }
}
if (!empty($frm->combinedsearch)) {
$eventdata->fullmessage = $message;
$eventdata->fullmessagehtml = '';
}
-
+
$eventdata->fullmessageformat = $format;
$eventdata->smallmessage = strip_tags($message);//strip just in case there are is any html that would break the popup notification
if (!empty($eventdata->fullmessagehtml)) {
$eventdata->fullmessagehtml .= "<br /><br />---------------------------------------------------------------------<br />".$emailtagline;
}
-
+
$eventdata->timecreated = time();
return message_send($eventdata);
}
*/
function message_mark_message_read($message, $timeread, $messageworkingempty=false) {
global $DB;
-
+
$message->timeread = $timeread;
$messageid = $message->id;
$withrelativelinks = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/x-shockwave-flash');
// note: pdf doc and other types may contain links too, but we do not support relative links there
- if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0))) {
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0));
+ if (!$candidates->valid()) {
+ $candidates->close(); // Not going to iterate (but exit), close rs
return;
}
$siteid = get_site()->id;
$fs = get_file_storage();
- if (strpos($path, 'LOCALPATH') === 0) {
+ if (empty($candidate->cmid)) {
+ // skip borked records
+ continue;
+
+ } else if (strpos($path, 'LOCALPATH') === 0) {
// ignore not maintained local files - sorry
continue;