|
|
|
@ -5395,7 +5395,7 @@ class DocumentManager |
|
|
|
|
$ext = strtolower($ext[sizeof($ext) - 1]); |
|
|
|
|
|
|
|
|
|
// HTML-files an some other types are shown in a frameset by default. |
|
|
|
|
$is_browser_viewable_file = self::is_browser_viewable($ext); |
|
|
|
|
$is_browser_viewable_file = self::isBrowserViewable($ext); |
|
|
|
|
|
|
|
|
|
if ($is_browser_viewable_file) { |
|
|
|
|
if ($ext == 'pdf' || in_array($ext, $webODFList)) { |
|
|
|
@ -6340,7 +6340,7 @@ class DocumentManager |
|
|
|
|
* @param string $file_extension The filename extension of the document (it must be in lower case). |
|
|
|
|
* @return bool Returns TRUE or FALSE. |
|
|
|
|
*/ |
|
|
|
|
public static function is_browser_viewable($file_extension) |
|
|
|
|
public static function isBrowserViewable($file_extension) |
|
|
|
|
{ |
|
|
|
|
static $allowed_extensions = array( |
|
|
|
|
'htm', 'html', 'xhtml', |
|
|
|
@ -6352,7 +6352,7 @@ class DocumentManager |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
//TODO: make a admin swich to strict mode |
|
|
|
|
//TODO: make a admin switch to strict mode |
|
|
|
|
1. global default $allowed_extensions only: 'htm', 'html', 'xhtml', 'gif', 'jpg', 'jpeg', 'png', 'bmp', 'txt', 'log' |
|
|
|
|
if (in_array($file_extension, $allowed_extensions)) { // Assignment + a logical check. |
|
|
|
|
return true; |
|
|
|
@ -6523,9 +6523,6 @@ class DocumentManager |
|
|
|
|
*/ |
|
|
|
|
public static function downloadAllDeletedDocument($courseInfo, $sessionId) |
|
|
|
|
{ |
|
|
|
|
// Zip library for creation of the zip file. |
|
|
|
|
require api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; |
|
|
|
|
|
|
|
|
|
$files = self::getDeletedDocuments($courseInfo, $sessionId); |
|
|
|
|
|
|
|
|
|
if (empty($files)) { |
|
|
|
@ -6631,9 +6628,9 @@ class DocumentManager |
|
|
|
|
{ |
|
|
|
|
$dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$old_path = Database::escape_string($old_path); |
|
|
|
|
switch ($action) { |
|
|
|
|
case 'delete': |
|
|
|
|
$old_path = Database::escape_string($old_path); |
|
|
|
|
$query = "DELETE FROM $dbTable |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|