$glossary->timecreated = time();
$glossary->timemodified = $glossary->timecreated;
- # May have to add extra stuff in here #
+ //Check displayformat is a valid one
+ $formats = get_list_of_plugins('mod/glossary/formats','TEMPLATE');
+ if (!in_array($glossary->displayformat, $formats)) {
+ error("This format doesn't exist!");
+ }
return insert_record("glossary", $glossary);
}
$glossary->assesstimefinish = 0;
}
+ //Check displayformat is a valid one
+ $formats = get_list_of_plugins('mod/glossary/formats','TEMPLATE');
+ if (!in_array($glossary->displayformat, $formats)) {
+ error("This format doesn't exist!");
+ }
+
$return = update_record("glossary", $glossary);
if ($return and $glossary->defaultapproval) {
execute_sql("update {$CFG->prefix}glossary_entries SET approved = 1 where approved != 1 and glossaryid = " . $glossary->id,false);
/// setting the default values for the display mode of the current glossary
/// only if the glossary is viewed by the first time
- if ( $dp = get_record('glossary_formats','name', $glossary->displayformat) ) {
+ if ( $dp = get_record('glossary_formats','name', addslashes($glossary->displayformat)) ) {
$printpivot = $dp->showgroup;
if ( $mode == '' and $hook == '' and $show == '') {
$mode = $dp->defaultmode;
/// setting the default values for the display mode of the current glossary
/// only if the glossary is viewed by the first time
- if ( $dp = get_record('glossary_formats','name', $glossary->displayformat) ) {
+ if ( $dp = get_record('glossary_formats','name', addslashes($glossary->displayformat)) ) {
$printpivot = $dp->showgroup;
if ( $mode == '' and $hook == '' and $show == '') {
$mode = $dp->defaultmode;