mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 19:05:54 +03:00
[GH-ISSUE #218] Open / Direct link wrong if directories_users is used #154
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @neilf-qmul on GitHub (Sep 3, 2019).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/218
if tinyfilemanager content is in a subfolder (/var/www/html/tinyfilemanager-master) of the document root (/var/www/html) and I specify a folder for a user neil (/var/www/html/test)
$directories_users = array(
'neil' => '../test',
);
The href / Direct link for any files in the users folder (/var/www/html/test) are always relative to where the tinyfilemanager is executing rather than the document root
so for host manage-test.ac.uk and file /var/www/html/test/test.html
the href or direct link is: http://manage-test.ac.uk/tinyfilemanager-master/test/test.html
I have tried changing $http_host = $_SERVER['SERVER_NAME']; but this didn't fix the problem!
@neilf-qmul commented on GitHub (Sep 3, 2019):
think I have a solution, removed $wd from line 189 so it becomes:
$root_url = $root_url.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];
and all works fine, not sure why it was there in the first place!, this also means you can remove line 188 as wd is not referenced anywhere else.
@neilf-qmul commented on GitHub (Sep 3, 2019):
ok slight change, but this works for all cases:
if (isset($_SESSION[FM_SESSION_ID]['logged']) && !empty($directories_users[$_SESSION[FM_SESSION_ID]['logged']])) {
$root_url = $root_url.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];
}else{
$wd = fm_clean_path(dirname($_SERVER['PHP_SELF']));
$root_url = $root_url.$wd;
}