Skip to content
Snippets Groups Projects
Commit 1573e402 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

fixed errors and compatibility problems with Stud.IP 5.3 and PHP 8.0

parent 605cbbb0
No related branches found
Tags v2.1.0
No related merge requests found
...@@ -20,7 +20,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin { ...@@ -20,7 +20,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
} elseif (Navigation::hasItem('/contents/files/my_files')) { } elseif (Navigation::hasItem('/contents/files/my_files')) {
Navigation::activateItem('/contents/files/my_files'); Navigation::activateItem('/contents/files/my_files');
} }
if ($folder_id[0] === "/") { if ($folder_id && $folder_id[0] === "/") {
$folder_id = substr($folder_id, 1); $folder_id = substr($folder_id, 1);
} }
if ($folder_id && !$this->isFolder($folder_id)) { if ($folder_id && !$this->isFolder($folder_id)) {
...@@ -78,7 +78,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin { ...@@ -78,7 +78,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
/** /**
* @param $file_id : this is a path to the file. Remind that the chunks of this path need to be rawurlencoded! * @param $file_id : this is a path to the file. Remind that the chunks of this path need to be rawurlencoded!
* @param bool $with_blob : should OwnCloudPlugin retrieve the blib of the file as well? * @param bool $with_blob : should OwnCloudPlugin retrieve the blob of the file as well?
* @return FileRef|null : Returns the FileRef on success and null if the file doesn't exist. * @return FileRef|null : Returns the FileRef on success and null if the file doesn't exist.
*/ */
public function getPreparedFile($file_id, $with_blob = false) public function getPreparedFile($file_id, $with_blob = false)
...@@ -162,7 +162,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin { ...@@ -162,7 +162,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
curl_setopt($r, CURLOPT_RETURNTRANSFER, 1); curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER); curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER); curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
if ($GLOBALS['OWNCLOUD_VERBOSE']) { if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
curl_setopt($r, CURLOPT_VERBOSE, true); curl_setopt($r, CURLOPT_VERBOSE, true);
} }
$xml = curl_exec($r); $xml = curl_exec($r);
......
...@@ -225,7 +225,7 @@ class OwncloudFile implements FileType ...@@ -225,7 +225,7 @@ class OwncloudFile implements FileType
_('Datei löschen'), _('Datei löschen'),
Icon::create('trash', Icon::ROLE_CLICKABLE, ['size' => 20]), Icon::create('trash', Icon::ROLE_CLICKABLE, ['size' => 20]),
[ [
'formaction' => URLHelper::getURL("dispatch.php/file/delete/{$this->getId()}", $flat_view ? ['from_flat_view' => 1] : []), 'formaction' => URLHelper::getURL("dispatch.php/file/delete/{$this->getId()}"),
'data-confirm' => sprintf(_('Soll die Datei "%s" wirklich gelöscht werden?'), $this->getFilename()), 'data-confirm' => sprintf(_('Soll die Datei "%s" wirklich gelöscht werden?'), $this->getFilename()),
] ]
); );
...@@ -444,4 +444,10 @@ class OwncloudFile implements FileType ...@@ -444,4 +444,10 @@ class OwncloudFile implements FileType
return $this; return $this;
} }
public function getAccessibility(): bool
{
//This information is not available for Nextcloud/Owncloud files.
return false;
}
} }
...@@ -363,7 +363,7 @@ class OwncloudFolder extends VirtualFolderType { ...@@ -363,7 +363,7 @@ class OwncloudFolder extends VirtualFolderType {
curl_setopt($r, CURLOPT_RETURNTRANSFER, 1); curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER); curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER); curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
if ($GLOBALS['OWNCLOUD_VERBOSE']) { if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
curl_setopt($r, CURLOPT_VERBOSE, true); curl_setopt($r, CURLOPT_VERBOSE, true);
} }
...@@ -431,6 +431,10 @@ class OwncloudFolder extends VirtualFolderType { ...@@ -431,6 +431,10 @@ class OwncloudFolder extends VirtualFolderType {
foreach ($node->childNodes as $prop) { foreach ($node->childNodes as $prop) {
if ($prop->childNodes) { if ($prop->childNodes) {
foreach ($prop->childNodes as $attr) { foreach ($prop->childNodes as $attr) {
if (!($attr instanceof DOMElement)) {
//DOMText or another DOM class that doesn't fit in here.
continue;
}
if (strtolower($attr->tagName) === "d:resourcetype") { if (strtolower($attr->tagName) === "d:resourcetype") {
$file_attributes['type'] = $attr->childNodes->item(0) && strtolower($attr->childNodes->item(0)->tagName) === "d:collection" ? "folder" : "file"; $file_attributes['type'] = $attr->childNodes->item(0) && strtolower($attr->childNodes->item(0)->tagName) === "d:collection" ? "folder" : "file";
} }
......
...@@ -42,7 +42,7 @@ class FileController extends PluginController ...@@ -42,7 +42,7 @@ class FileController extends PluginController
$this->name $this->name
); );
if (!$result instanceof FileRef) { if (!($result instanceof FileType)) {
$this->errors = array_merge($this->errors, $result); $this->errors = array_merge($this->errors, $result);
} }
......
pluginname=OwnCloudPlugin pluginname=OwnCloudPlugin
pluginclassname=OwnCloudPlugin pluginclassname=OwnCloudPlugin
version=2.0.3 version=2.1.0
origin=data-quest origin=data-quest
studipMinVersion=4.6 studipMinVersion=5.0
studipMaxVersion=5.2.99 studipMaxVersion=5.3.99
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment