Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
c69e480c
Commit
c69e480c
authored
2 years ago
by
David Siegfried
Browse files
Options
Downloads
Patches
Plain Diff
prevent php-warnings, closes #2292
Closes #2292 Merge request
studip/studip!1516
parent
3e722420
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/sendfile.php
+10
-5
10 additions, 5 deletions
public/sendfile.php
with
10 additions
and
5 deletions
public/sendfile.php
+
10
−
5
View file @
c69e480c
...
@@ -45,7 +45,7 @@ page_open(["sess" => "Seminar_Session",
...
@@ -45,7 +45,7 @@ page_open(["sess" => "Seminar_Session",
"user"
=>
"Seminar_User"
]);
"user"
=>
"Seminar_User"
]);
//Load plugins, unless they are disabled via an URL parameter.
//Load plugins, unless they are disabled via an URL parameter.
if
(
Request
::
int
(
'disable_plugins'
)
!==
null
&&
(
$user
->
id
===
'nobody'
||
$perm
->
have_perm
(
'root'
)))
{
if
(
Request
::
int
(
'disable_plugins'
)
!==
null
&&
(
$
GLOBALS
[
'
user
'
]
->
id
===
'nobody'
||
$
GLOBALS
[
'
perm
'
]
->
have_perm
(
'root'
)))
{
// deactivate non-core plugins
// deactivate non-core plugins
PluginManager
::
getInstance
()
->
setPluginsDisabled
(
Request
::
int
(
'disable_plugins'
));
PluginManager
::
getInstance
()
->
setPluginsDisabled
(
Request
::
int
(
'disable_plugins'
));
}
}
...
@@ -65,6 +65,8 @@ if ($type < 0 || $type > 7) {
...
@@ -65,6 +65,8 @@ if ($type < 0 || $type > 7) {
$no_access
=
true
;
$no_access
=
true
;
$file_missing
=
false
;
$file_missing
=
false
;
$file
=
null
;
$file_ref
=
null
;
switch
(
$type
)
{
switch
(
$type
)
{
//download from course or institute or document is a message attachment
//download from course or institute or document is a message attachment
...
@@ -114,13 +116,13 @@ if ($file_missing) {
...
@@ -114,13 +116,13 @@ if ($file_missing) {
//if download not allowed throw exception to terminate script
//if download not allowed throw exception to terminate script
if
(
$no_access
)
{
if
(
$no_access
)
{
// redirect to login page if user is not logged in
// redirect to login page if user is not logged in
$auth
->
login_if
(
$auth
->
auth
[
'uid'
]
==
'nobody'
);
$
GLOBALS
[
'
auth
'
]
->
login_if
(
$
GLOBALS
[
'
auth
'
]
->
auth
[
'uid'
]
==
=
'nobody'
);
throw
new
AccessDeniedException
(
_
(
"Sie haben keine Zugriffsberechtigung für diesen Download!"
));
throw
new
AccessDeniedException
(
_
(
"Sie haben keine Zugriffsberechtigung für diesen Download!"
));
}
}
//replace bad charakters to avoid problems when saving the file
//replace bad charakters to avoid problems when saving the file
$file_name
=
FileManager
::
cleanFileName
(
Request
::
get
(
'file_name'
));
$file_name
=
FileManager
::
cleanFileName
(
Request
::
get
(
'file_name'
));
$path_file
=
''
;
switch
(
$type
)
{
switch
(
$type
)
{
//We want to download from the archive (this mode performs perm checks)
//We want to download from the archive (this mode performs perm checks)
case
1
:
case
1
:
...
@@ -151,7 +153,10 @@ switch ($type) {
...
@@ -151,7 +153,10 @@ switch ($type) {
// check if linked file is obtainable
// check if linked file is obtainable
$filesize
=
0
;
$filesize
=
0
;
if
(
isset
(
$file_ref
)
&&
$file_ref
->
file
->
metadata
[
'access_type'
]
==
'proxy'
)
{
if
(
isset
(
$file_ref
,
$file_ref
->
file
,
$file_ref
->
file
->
metadata
[
'access_type'
])
&&
$file_ref
->
file
->
metadata
[
'access_type'
]
===
'proxy'
)
{
$link_data
=
FileManager
::
fetchURLMetadata
(
$file_ref
->
file
->
metadata
[
'url'
]);
$link_data
=
FileManager
::
fetchURLMetadata
(
$file_ref
->
file
->
metadata
[
'url'
]);
if
(
$link_data
[
'response_code'
]
!=
200
)
{
if
(
$link_data
[
'response_code'
]
!=
200
)
{
throw
new
Exception
(
_
(
"Diese Datei wird von einem externen Server geladen und ist dort momentan nicht erreichbar!"
));
throw
new
Exception
(
_
(
"Diese Datei wird von einem externen Server geladen und ist dort momentan nicht erreichbar!"
));
...
@@ -258,6 +263,6 @@ if (isset($file_ref) && !$start) {
...
@@ -258,6 +263,6 @@ if (isset($file_ref) && !$start) {
}
}
//remove temporary file
//remove temporary file
if
(
$type
==
4
)
{
if
(
$type
==
=
4
)
{
@
unlink
(
$path_file
);
@
unlink
(
$path_file
);
}
}
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