From 1519cdeb39074c74a92d68e90f9387d2896c92d0 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 16 Sep 2007 21:48:47 +0000 Subject: [PATCH] MDL-10820 Fixed double quotes in SQL statements --- notes/lib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/notes/lib.php b/notes/lib.php index 4a93842746d..9d5a8877265 100644 --- a/notes/lib.php +++ b/notes/lib.php @@ -44,9 +44,9 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las $selects[] = 'usermodified=' . $author; } if($state) { - $selects[] = 'publishstate="' . $state . '"'; + $selects[] = "publishstate='$state'"; } - $selects[] = 'module="notes"'; + $selects[] = "module='notes'"; $select = implode(' AND ', $selects); $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate'; // retrieve data @@ -62,11 +62,11 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las */ function note_load($note_id) { $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate'; - return get_record_select('post', 'id=' . $note_id . ' AND module="notes"', $fields); + return get_record_select('post', "id=$note_id AND module='notes'", $fields); } /** - * Saves a note object. The note object is passed by reference and its fields (i.e. id) + * Saves a note object. The note object is passed by reference and its fields (i.e. id) * might change during the save. * * @param note $note object to save @@ -109,7 +109,7 @@ function note_save(&$note) { * @return boolean true if the object was deleted; false otherwise */ function note_delete($noteid) { - return delete_records_select('post', 'id=' . $noteid . ' AND module="notes"'); + return delete_records_select('post', "id=$noteid AND module='notes'"); } /** @@ -164,7 +164,7 @@ function note_print($note, $detail = NOTES_SHOW_FULL) { $authoring->name = ''.fullname($author).''; $authoring->date = userdate($note->lastmodified); - echo '
publishstate . 'notepost' . ($note->usermodified == $USER->id ? ' ownnotepost' : '') . '" id="note-'. $note->id .'">'; @@ -174,22 +174,22 @@ function note_print($note, $detail = NOTES_SHOW_FULL) { echo '
'; print_user_picture($user->id, $note->courseid, $user->picture); echo fullname($user) . '
'; - echo '
' . - get_string('bynameondate', 'notes', $authoring) . + echo '
' . + get_string('bynameondate', 'notes', $authoring) . ' (' . get_string('created', 'notes') . ': ' . userdate($note->created) . ')
'; echo '
'; } - + // print note content if($detail & NOTES_SHOW_BODY) { echo '
'; echo format_text($note->content, $note->format); echo '
'; } - + // print note options (e.g. delete, edit) if($detail & NOTES_SHOW_FOOT) { - if (has_capability('moodle/notes:manage', $sitecontext) && $note->publishstate == NOTES_STATE_SITE || + if (has_capability('moodle/notes:manage', $sitecontext) && $note->publishstate == NOTES_STATE_SITE || has_capability('moodle/notes:manage', $context) && ($note->publishstate == NOTES_STATE_PUBLIC || $note->usermodified == $USER->id)) { echo '