Some checks are now done. SC#18.
This commit is contained in:
+11
-1
@@ -75,7 +75,11 @@ function glossary_add_instance($glossary) {
|
||||
$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);
|
||||
}
|
||||
@@ -110,6 +114,12 @@ global $CFG;
|
||||
$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);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
/// 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;
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
/// 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;
|
||||
|
||||
Reference in New Issue
Block a user