Fixing PHP warnings, adding intval.

1.9.x
Julio Montoya 11 years ago
parent 76b81f8129
commit e0b6729088
  1. 6
      main/document/showinframes.php
  2. 2
      main/inc/lib/display.lib.php
  3. 11
      main/inc/lib/document.lib.php
  4. 2
      main/inc/lib/fileUpload.lib.php

@ -30,7 +30,7 @@ require_once '../inc/global.inc.php';
api_protect_course_script();
$noPHP_SELF = true;
$header_file = Security::remove_XSS($_GET['file']);
$header_file = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
$document_id = intval($_GET['id']);
$course_info = api_get_course_info();
@ -41,7 +41,9 @@ if (empty($course_info)) {
api_not_allowed(true);
}
//Generate path
$show_web_odf = false;
//Generate path
if (!$document_id) {
$document_id = DocumentManager::get_document_id($course_info, $header_file);
}

@ -1558,7 +1558,7 @@ class Display {
/**
* @todo use twig
*/
static function group_button($title, $elements) {
public static function group_button($title, $elements) {
$html = '<div class="btn-toolbar">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">'.$title.' <span class="caret"></span></button>

@ -277,7 +277,7 @@ class DocumentManager
* @param string
* @return true if the user is allowed to see the document, false otherwise
* @author Sergio A Kessler, first version
* @author Roan Embrechts, bugfix *
* @author Roan Embrechts, bugfix
* @todo not only check if a file is visible, but also check if the user is allowed to see the file??
*/
public static function file_visible_to_user($this_course, $doc_url)
@ -679,8 +679,14 @@ class DocumentManager
}
$document_folders[$row['id']] = $row['path'];
}
natsort($document_folders);
//sort($document_folders);
if (!empty($document_folders)) {
natsort($document_folders);
}
//return results
return $document_folders;
} else {
return false;
@ -3247,7 +3253,6 @@ class DocumentManager
//TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0
// now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while
$doc_mime = mime_content_type($doc_path);
//echo $doc_mime;
$allowed_mime_types = self::file_get_mime_type(true);
// mime_content_type does not detect correctly some formats that are going to be supported for index, so an extensions array is used for the moment

@ -906,6 +906,8 @@ function add_document(
$group_id = null,
$session_id = 0
) {
$session_id = intval($session_id);
if (empty($session_id)) {
$session_id = api_get_session_id();
}

Loading…
Cancel
Save