Some checks are now done. SC#18.

This commit is contained in:
stronk7
2004-12-15 09:01:12 +00:00
parent 4a01c21c53
commit 01988ca33f
3 changed files with 13 additions and 3 deletions
+11 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;