Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NextcloudPlugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stud.IP
Plugins
NextcloudPlugin
Commits
7e6bc04e
Commit
7e6bc04e
authored
4 years ago
by
Rasmus Fuhse
Browse files
Options
Downloads
Patches
Plain Diff
bugfixing uploads
parent
eda265f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/OwncloudFile.php
+39
-31
39 additions, 31 deletions
classes/OwncloudFile.php
classes/OwncloudFolder.php
+2
-21
2 additions, 21 deletions
classes/OwncloudFolder.php
with
41 additions
and
52 deletions
classes/OwncloudFile.php
+
39
−
31
View file @
7e6bc04e
...
@@ -98,7 +98,7 @@ class OwncloudFile implements FileType
...
@@ -98,7 +98,7 @@ class OwncloudFile implements FileType
*/
*/
public
function
getDownloads
()
public
function
getDownloads
()
{
{
return
0
;
return
null
;
}
}
...
@@ -178,31 +178,16 @@ class OwncloudFile implements FileType
...
@@ -178,31 +178,16 @@ class OwncloudFile implements FileType
[
'data-dialog'
=>
''
],
[
'data-dialog'
=>
''
],
'file-display-info'
'file-display-info'
);
);
if
(
$current_action
===
'flat'
)
{
if
(
Navigation
::
hasItem
(
'/course/files'
)
&&
Navigation
::
getItem
(
'/course/files'
)
->
isActive
())
{
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/course/files/index/'
.
$this
->
fileref
->
folder_id
),
_
(
'Ordner öffnen'
),
Icon
::
create
(
'folder-empty'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
])
);
}
elseif
(
Navigation
::
hasItem
(
'/files_dashboard/files'
)
&&
Navigation
::
getItem
(
'/files_dashboard/files'
)
->
isActive
())
{
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/files/index/'
.
$this
->
fileref
->
folder_id
),
_
(
'Ordner öffnen'
),
Icon
::
create
(
'folder-empty'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
])
);
}
}
if
(
$this
->
isEditable
(
$GLOBALS
[
'user'
]
->
id
))
{
if
(
$this
->
isEditable
(
$GLOBALS
[
'user'
]
->
id
))
{
$actionMenu
->
addLink
(
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/file/edit/'
.
$this
->
fileref
->
id
),
URLHelper
::
getURL
(
'dispatch.php/file/edit/'
.
$this
->
getId
()
),
_
(
'Datei bearbeiten'
),
_
(
'Datei bearbeiten'
),
Icon
::
create
(
'edit'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
Icon
::
create
(
'edit'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
[
'data-dialog'
=>
''
],
[
'data-dialog'
=>
''
],
'file-edit'
'file-edit'
);
);
$actionMenu
->
addLink
(
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/file/update/'
.
$this
->
fileref
->
id
),
URLHelper
::
getURL
(
'dispatch.php/file/update/'
.
$this
->
getId
()
),
_
(
'Datei aktualisieren'
),
_
(
'Datei aktualisieren'
),
Icon
::
create
(
'refresh'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
Icon
::
create
(
'refresh'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
[
'data-dialog'
=>
''
],
[
'data-dialog'
=>
''
],
...
@@ -211,7 +196,7 @@ class OwncloudFile implements FileType
...
@@ -211,7 +196,7 @@ class OwncloudFile implements FileType
}
}
if
(
$this
->
isWritable
(
$GLOBALS
[
'user'
]
->
id
))
{
if
(
$this
->
isWritable
(
$GLOBALS
[
'user'
]
->
id
))
{
$actionMenu
->
addLink
(
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/file/choose_destination/move/'
.
$this
->
fileref
->
id
),
URLHelper
::
getURL
(
'dispatch.php/file/choose_destination/move/'
.
$this
->
getId
()
),
_
(
'Datei verschieben'
),
_
(
'Datei verschieben'
),
Icon
::
create
(
'file+move_right'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
Icon
::
create
(
'file+move_right'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
[
'data-dialog'
=>
'size=auto'
],
[
'data-dialog'
=>
'size=auto'
],
...
@@ -220,7 +205,7 @@ class OwncloudFile implements FileType
...
@@ -220,7 +205,7 @@ class OwncloudFile implements FileType
}
}
if
(
$this
->
isDownloadable
(
$GLOBALS
[
'user'
]
->
id
)
&&
$GLOBALS
[
'user'
]
->
id
!==
'nobody'
)
{
if
(
$this
->
isDownloadable
(
$GLOBALS
[
'user'
]
->
id
)
&&
$GLOBALS
[
'user'
]
->
id
!==
'nobody'
)
{
$actionMenu
->
addLink
(
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/file/choose_destination/copy/'
.
$this
->
fileref
->
id
),
URLHelper
::
getURL
(
'dispatch.php/file/choose_destination/copy/'
.
$this
->
getId
()
),
_
(
'Datei kopieren'
),
_
(
'Datei kopieren'
),
Icon
::
create
(
'file+add'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
Icon
::
create
(
'file+add'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
[
'data-dialog'
=>
'size=auto'
],
[
'data-dialog'
=>
'size=auto'
],
...
@@ -234,16 +219,6 @@ class OwncloudFile implements FileType
...
@@ -234,16 +219,6 @@ class OwncloudFile implements FileType
'link-to-clipboard'
'link-to-clipboard'
);
);
}
}
if
(
Context
::
isCourse
()
&&
Feedback
::
isActivated
())
{
if
(
Feedback
::
hasCreatePerm
(
Context
::
getId
()))
{
$actionMenu
->
addLink
(
URLHelper
::
getURL
(
'dispatch.php/course/feedback/create_form/'
.
$this
->
fileref
->
id
.
'/FileRef'
),
_
(
'Neues Feedback-Element'
),
Icon
::
create
(
'star+add'
,
Icon
::
ROLE_CLICKABLE
,
[
'size'
=>
20
]),
[
'data-dialog'
=>
'1'
]
);
}
}
if
(
$this
->
isWritable
(
$GLOBALS
[
'user'
]
->
id
))
{
if
(
$this
->
isWritable
(
$GLOBALS
[
'user'
]
->
id
))
{
$actionMenu
->
addButton
(
$actionMenu
->
addButton
(
'delete'
,
'delete'
,
...
@@ -344,7 +319,40 @@ class OwncloudFile implements FileType
...
@@ -344,7 +319,40 @@ class OwncloudFile implements FileType
*/
*/
public
function
convertToStandardFile
()
public
function
convertToStandardFile
()
{
{
//TODO
$url
=
Config
::
get
()
->
OWNCLOUD_ENDPOINT
?:
UserConfig
::
get
(
$GLOBALS
[
'user'
]
->
id
)
->
OWNCLOUD_ENDPOINT_USER
;
if
(
$url
[
strlen
(
$url
)
-
1
]
!==
"/"
)
{
$url
.
=
"/"
;
}
$webdav
=
$url
.
"remote.php/webdav/"
;
$header
=
array
();
$header
[]
=
OwnCloudFolder
::
getAuthHeader
();
$r
=
curl_init
();
curl_setopt
(
$r
,
CURLOPT_CUSTOMREQUEST
,
"GET"
);
curl_setopt
(
$r
,
CURLOPT_URL
,
$webdav
.
$file_id
);
curl_setopt
(
$r
,
CURLOPT_HTTPHEADER
,
(
$header
));
curl_setopt
(
$r
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$r
,
CURLOPT_SSL_VERIFYPEER
,
(
bool
)
Config
::
get
()
->
OWNCLOUD_SSL_VERIFYPEER
);
curl_setopt
(
$r
,
CURLOPT_SSL_VERIFYHOST
,
(
bool
)
Config
::
get
()
->
OWNCLOUD_SSL_VERIFYPEER
);
if
(
$GLOBALS
[
'OWNCLOUD_VERBOSE'
])
{
curl_setopt
(
$r
,
CURLOPT_VERBOSE
,
true
);
}
$content
=
curl_exec
(
$r
);
$info
=
curl_getinfo
(
$r
);
curl_close
(
$r
);
$path
=
$GLOBALS
[
'TMP_PATH'
]
.
"/owncloudplugin_"
.
md5
(
uniqid
());
file_put_contents
(
$path
,
$content
);
return
StandardFile
::
create
([
'name'
=>
$this
->
getFilename
(),
'type'
=>
$this
->
getMimeType
(),
'size'
=>
$this
->
getSize
(),
'tmp_name'
=>
$path
]);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
classes/OwncloudFolder.php
+
2
−
21
View file @
7e6bc04e
...
@@ -125,27 +125,8 @@ class OwncloudFolder extends VirtualFolderType {
...
@@ -125,27 +125,8 @@ class OwncloudFolder extends VirtualFolderType {
$header
=
array
();
$header
=
array
();
$header
[]
=
self
::
getAuthHeader
();
$header
[]
=
self
::
getAuthHeader
();
$url_template
=
"[InternetShortcut]
\n
URL=%s"
;
$data
=
$file
->
getPath
();
//Verlinkungen URLFile extra berücksichtigen? $url_template = "[InternetShortcut]\nURL=%s";
$data
=
$GLOBALS
[
'TMP_PATH'
]
.
"/file_"
.
md5
(
uniqid
());
if
(
is_a
(
$file
,
"URLFile"
))
{
if
(
$filedata
->
getURL
())
{
$data
=
$GLOBALS
[
'TMP_PATH'
]
.
"/file_"
.
md5
(
uniqid
());
file_put_contents
(
$data
,
sprintf
(
$url_template
,
$filedata
->
getURL
()));
$file_ref_id
.
=
".url"
;
}
else
{
$data
=
$filedata
->
getPath
();
}
}
else
{
if
(
$filedata
[
'url'
])
{
$data
=
$GLOBALS
[
'TMP_PATH'
]
.
"/file_"
.
md5
(
uniqid
());
file_put_contents
(
$data
,
sprintf
(
$url_template
,
$filedata
[
'url'
]));
$file_ref_id
.
=
".url"
;
}
else
{
$data
=
$filedata
[
'tmp_name'
];
}
}
$fh_res
=
fopen
(
$data
,
'r'
);
$fh_res
=
fopen
(
$data
,
'r'
);
$r
=
curl_init
();
$r
=
curl_init
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment