Fix cloud link PHP warnings BT#16249

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

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -78,7 +79,7 @@ $interbreadcrumb[] = [
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
// 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']];
}
} else {
@ -144,7 +145,7 @@ if ($form->validate()) {
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;
}
}

@ -209,7 +209,7 @@ if (!empty($groupId)) {
}
// 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;
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
@ -604,8 +604,8 @@ if (isset($document_id) && empty($action)) {
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) {
$parent_id = $document_data['parent_id'];
// 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) {
$actionsLeft .= Display::url(
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