Merged resource->type checks from stable
authormoodler <moodler>
Wed, 29 Sep 2004 03:12:31 +0000 (03:12 +0000)
committermoodler <moodler>
Wed, 29 Sep 2004 03:12:31 +0000 (03:12 +0000)
mod/resource/lib.php

index 00373342bebeead94ac9c7059f0677720c9f0e95..867ce4d668fb70d515dd58ee31e71029d2981cdb 100644 (file)
@@ -242,6 +242,8 @@ function delete_instance($id) {
 function resource_add_instance($resource) {
     global $CFG;
     
+    $resource->type = clean_filename($resource->type);   // Just to be safe
+
     require_once("$CFG->dirroot/mod/resource/type/$resource->type/resource.class.php");
     $resourceclass = "resource_$resource->type";
     $res = new $resourceclass();
@@ -252,6 +254,8 @@ function resource_add_instance($resource) {
 function resource_update_instance($resource) {
     global $CFG;
     
+    $resource->type = clean_filename($resource->type);   // Just to be safe
+
     require_once("$CFG->dirroot/mod/resource/type/$resource->type/resource.class.php");
     $resourceclass = "resource_$resource->type";
     $res = new $resourceclass();
@@ -265,6 +269,8 @@ function resource_delete_instance($id) {
     if (! $resource = get_record("resource", "id", "$id")) {
         return false;
     }
+
+    $resource->type = clean_filename($resource->type);   // Just to be safe
     
     require_once("$CFG->dirroot/mod/resource/type/$resource->type/resource.class.php");
     $resourceclass = "resource_$resource->type";