Skip to content

Preview images and direct links not working for user specific directories #724

@ThomasMarkas

Description

@ThomasMarkas

I am using small file manager and have it xcopy relocatable across multiple instance on different O/S and hardware.

The following example specification does not work as far as popup previews, light box and direct links go. You can browser list and download only.

At bottom you will see the one line correction I have used.

$auth_users = array(
'admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123
'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
);
$readonly_users = array(
'user'
);
$root_path = dirname(FILE).'/Data';

$root_url = '/files/Data';

$directories_users = array(
'user'=>dirname(FILE).'/Data/user'
);

The following code corrected this. It clears what I see as a confusion between URL, which can be remapped and the actual file path.

// update $root_url based on user specific directories
if (isset($_SESSION[FM_SESSION_ID]['logged']) && !empty($directories_users[$_SESSION[FM_SESSION_ID]['logged']])) {
// $wd = fm_clean_path(dirname($_SERVER['PHP_SELF']));
// $root_url = $root_url.$wd.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];
$root_url= $root_url.DIRECTORY_SEPARATOR.str_replace($root_path, '', $directories_users[$_SESSION[FM_SESSION_ID]['logged']]);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions