Fix cloud link PHP warnings BT#16249

pull/3090/head
Julio Montoya 6 years ago
parent 3f10294a0f
commit 75e4e20119
  1. 7
      main/document/add_link.php
  2. 6
      main/document/document.php

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -78,7 +79,7 @@ $interbreadcrumb[] = [
// Interbreadcrumb for the current directory root path // Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) { if (empty($document_data['parents'])) {
// Hack in order to not add the document to the breadcrumb in case it is a link // Hack in order to not add the document to the breadcrumb in case it is a link
if ($document_data['filetype'] != 'link') { if ($document_data && $document_data['filetype'] != 'link') {
$interbreadcrumb[] = ['url' => '#', 'name' => $document_data['title']]; $interbreadcrumb[] = ['url' => '#', 'name' => $document_data['title']];
} }
} else { } else {
@ -144,7 +145,7 @@ if ($form->validate()) {
Display::addFlash(Display::return_message(get_lang('ErrorAddCloudLink'), 'warning', false)); Display::addFlash(Display::return_message(get_lang('ErrorAddCloudLink'), 'warning', false));
} }
} }
header('Location: document.php?'.api_get_cidreq()); header('Location: document.php?'.api_get_cidreq().'&id='.$documentId);
exit; exit;
} }
} }
@ -177,7 +178,7 @@ echo DocumentManager::build_directory_selector(
echo '<script> echo '<script>
$(function() { $(function() {
$("[data-toggle=\'tooltip\']").tooltip({ $("[data-toggle=\'tooltip\']").tooltip({
content: content:
function() { function() {
return $(this).attr("title"); return $(this).attr("title");
} }

@ -209,7 +209,7 @@ if (!empty($groupId)) {
} }
// Actions. // Actions.
$document_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; $documentIdFromGet = $document_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
$currentUrl = api_get_self().'?'.api_get_cidreq().'&id='.$document_id; $currentUrl = api_get_self().'?'.api_get_cidreq().'&id='.$document_id;
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null; $curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
@ -604,8 +604,8 @@ if (isset($document_id) && empty($action)) {
0 0
); );
} }
// If the document is not a folder we show the document.
// If the document is not a folder we show the document.
if ($document_data) { if ($document_data) {
$parent_id = $document_data['parent_id']; $parent_id = $document_data['parent_id'];
// Hack in order to clean the document id in case of false positive from links // Hack in order to clean the document id in case of false positive from links
@ -1771,7 +1771,7 @@ if ($isAllowedToEdit ||
if ($fileLinkEnabled && !$is_certificate_mode) { if ($fileLinkEnabled && !$is_certificate_mode) {
$actionsLeft .= Display::url( $actionsLeft .= Display::url(
Display::return_icon('clouddoc_new.png', get_lang('AddCloudLink'), '', ICON_SIZE_MEDIUM), Display::return_icon('clouddoc_new.png', get_lang('AddCloudLink'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/add_link.php?'.api_get_cidreq().'&id='.$document_id api_get_path(WEB_CODE_PATH).'document/add_link.php?'.api_get_cidreq().'&id='.$documentIdFromGet
); );
} }
} }

Loading…
Cancel
Save