diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index e4bff6a53d8..5bc4edc8cd3 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -69,7 +69,10 @@ $entryalreadyexist = get_string('entryalreadyexist','glossary'); $entryexported = get_string('entryexported','glossary'); if (!$mainglossary->allowduplicatedentries) { - if ($DB->get_record('glossary_entries', array('glossaryid'=>$mainglossary->id, 'lower(concept)'=>moodle_strtolower($entry->concept)))) { + if ($DB->record_exists_select('glossary_entries', + 'glossaryid = :glossaryid AND LOWER(concept) = :concept', array( + 'glossaryid' => $mainglossary->id, + 'concept' => moodle_strtolower($entry->concept)))) { $PAGE->set_title(format_string($glossary->name)); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); diff --git a/mod/glossary/import.php b/mod/glossary/import.php index 32513063fc8..5b458d4d63e 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -204,9 +204,15 @@ if ($xml = glossary_read_imported_file($result)) { if ( !$glossary->allowduplicatedentries ) { // checking if the entry is valid (checking if it is duplicated when should not be) if ( $newentry->casesensitive ) { - $dupentry = $DB->get_record("glossary_entries", array("concept"=>$newentry->concept, "glossaryid"=>$glossary->id)); + $dupentry = $DB->record_exists_select('glossary_entries', + 'glossaryid = :glossaryid AND concept = :concept', array( + 'glossaryid' => $glossary->id, + 'concept' => $newentry->concept)); } else { - $dupentry = $DB->get_record("glossary_entries", array("lower(concept)"=>moodle_strtolower($newentry->concept), "glossaryid"=>$glossary->id)); + $dupentry = $DB->record_exists_select('glossary_entries', + 'glossaryid = :glossaryid AND LOWER(concept) = :concept', array( + 'glossaryid' => $glossary->id, + 'concept' => moodle_strtolower($newentry->concept))); } if ($dupentry) { $permissiongranted = 0;