Minor - format code, fix php warning

pull/2458/head
jmontoyaa 8 years ago
parent a5ecfd72d9
commit a176d0c7f7
  1. 15
      main/document/add_link.php
  2. 4
      main/document/create_document.php
  3. 2
      main/inc/lib/usergroup.lib.php

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows to add cloud file links to the document structure
* @package chamilo.document
@ -7,23 +8,24 @@
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
$fileLinkEnabled = api_get_configuration_value('enable_add_file_link');
if (!$fileLinkEnabled) {
api_not_allowed(true);
}
api_protect_course_script();
$courseInfo = api_get_course_info();
if (empty($courseInfo)) {
api_not_allowed(true);
}
$documentId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$dir = '/';
$document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id(), true);
$document_data = DocumentManager::get_document_data_by_id($documentId, api_get_course_id(), true);
if (empty($document_data)) {
$document_id = $parent_id = 0;
$document_id = $parent_id = 0;
$path = '/';
} else {
if ($document_data['filetype'] == 'folder') {
@ -35,7 +37,6 @@ if (empty($document_data)) {
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
if ($is_certificate_mode) {
api_not_allowed(true);
}
@ -47,7 +48,7 @@ if (api_get_group_id()) {
// If the group id is set, check if the user has the right to be here
// Get group info
$group_properties = GroupManager::get_group_properties(api_get_group_id());
if ($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'], api_get_group_id())) {
if ($is_allowed_to_edit || GroupManager::is_user_in_group(api_get_user_id(), $group_properties)) {
// Only courseadmin or group members allowed
$groupIid = $group_properties['iid'];
$interbreadcrumb[] = [

@ -67,7 +67,7 @@ if ($is_certificate_mode) {
$nameTools = get_lang('CreateDocument');
}
/* Constants and variables */
/* Constants and variables */
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id();
$courseCode = api_get_course_id();
@ -116,8 +116,6 @@ if (empty($document_data)) {
$dir = $document_data['path'];
}
/* MAIN CODE */
// Please, do not modify this dirname formatting
if (strstr($dir, '..')) {
$dir = '/';

@ -206,7 +206,7 @@ class UserGroup extends Model
/**
* Gets a list of course ids by user group
* @param int $id user group id
* @param array $loadCourseData
* @param bool $loadCourseData
*
* @return array
*/

Loading…
Cancel
Save