Browse Source

Update 'locallib.php'

function view_files_ilm ($iassign_ilm_class, $extension): avoid error whenever file has no extension: 6789/7237
leo 4 years ago
parent
commit
9c8f1cb3b6
1 changed files with 7 additions and 1 deletions
  1. 7 1
      locallib.php

+ 7 - 1
locallib.php

@@ -4,6 +4,9 @@
  * This class provides all the functionality for an ia (interactive activities).
  * 
  * Release Notes:
+ * - v 4.9.4 2020/05/28
+ *   + Detail fixed in old line 6789/7240, avoid error with file without extension ($filetype = $tmp[1];)
+ *
  * - v 4.9.3 2020/01/16
  *   + Several fixes to allow to move activities in a block and improvements in repository and to appear comment submission button
  *
@@ -6786,7 +6789,10 @@ class ilm_manager {
       $pathname = $pathname[count($pathname) - 1];
       $fileid = $value->get_id();
       $tmp = explode(".", $filename);
-      $filetype = $tmp[1];
+      if (count($tmp)>1) // avoid error if the file has no extension
+        $filetype = $tmp[1];
+      else // probably error...
+        $filetype = '';
       $author = $value->get_author();
       $timemodified = date("d/m/Y H:i:s", $value->get_timemodified());
       $timecreated = date("d/m/Y H:i:s", $value->get_timecreated());