Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expanded folder and dynamic user folder path #59

Closed
stonino opened this issue Nov 9, 2016 · 7 comments
Closed

expanded folder and dynamic user folder path #59

stonino opened this issue Nov 9, 2016 · 7 comments
Assignees
Labels
Milestone

Comments

@stonino
Copy link

stonino commented Nov 9, 2016

When I set a folderPath in the filemanager.php it seems that calling the index.html with ?expandedFolder=2016/ is being ignored.

It must be something stupid, but I can't find a way to first set a specific folder as root and then open a subfolder within.

@psolom
Copy link
Owner

psolom commented Nov 9, 2016

What is "folderPath" ?
There is no such option neither in config.php nor in filemanager.config.default.json

Please, be more precise.
Specify the file where you set the option and correct option name.
Also you can provide the path which you set for this option, your path to filemanager plugin and path to userfiles folder. It may help to understand your case better.

@stonino
Copy link
Author

stonino commented Nov 10, 2016

Hi Pavel,

Sorry, not at my desk so cannot check, but the Wiki has a page on
dynamically assigning the FileRoot using a session variable in php. This I
use within filemanager.php as instructed to set the FileRoot to for example
/docs/user123/

But then I want to jump to the 2016 subfolder using ?expandedFolder=2016/
but this is ignored - or so it seems.

I'll be at my computer tonight, so could get you the exact pages I used as
a basis.

Thanks in advance

@psolom
Copy link
Owner

psolom commented Nov 10, 2016

Perhaps you mean setFileRoot() method called from filemanager.php file
Anyhow, provide all links (including wiki article) and paths you used, when you will be able.
Hope you use the latest release of RichFilemanager.php (v2.0)

@stonino
Copy link
Author

stonino commented Nov 10, 2016

Yes, I use the latest version and I have bit of code as specified here: https://github.com/servocoder/RichFilemanager/wiki/How-to-allow-users-to-have-their-own-folder

Though that page is different from the current filemanager.php, so this is mine:

require_once('application/Fm.php');
require_once('application/FmHelper.php');

function auth()
{
// IMPORTANT : by default Read and Write access is granted to everyone.
// You can insert your own code over here to check if the user is authorized.
// If you use a session variable, you've got to start the session first (session_start())
return true;
}

$config = array();

// example to override the default config
//$config = array(
// 'upload' => array(
// 'policy' => 'DISALLOW_ALL',
// 'restrictions' => array(
// 'pdf',
// ),
// ),
//);

$fm = Fm::app()->getInstance($config);

// example to setup files root folder
//$fm->setFileRoot('userfiles', true);
$folderPath = '/' . $_SESSION['myfolder'] . '/';
$fm->setFileRoot($folderPath, true);

This code works to get the folder as specified in the session var, but then I cannot use the ?expandedFolder=2016/ on the index.html

Thanks for your help,

Servé

@psolom
Copy link
Owner

psolom commented Nov 10, 2016

Thanks for details. Now it's clear.
I will check it in the coming days.

@psolom
Copy link
Owner

psolom commented Nov 12, 2016

Indeed, there was an error upon expanding specified folder.
I have fixed it, please try it out and post the feedback. The fix will be included in release v2.0.1

One note for $fm->setFileRoot($folderPath, true); method.
Due to changes in v2.0.0, you have to specify the path ralative to server root path. For example if the full path to your user files folder is "/var/www/html/fm/userfiles" and the server root is ""/var/www/html" then it should be set as: $fm->setFileRoot("/fm/userfiles", true); Hope it's clear.

@psolom psolom added this to the 2.0.1 milestone Nov 12, 2016
@psolom psolom added the bug label Nov 12, 2016
@psolom psolom self-assigned this Nov 12, 2016
@stonino
Copy link
Author

stonino commented Nov 12, 2016

thanks, I've tested it and it works like a charm now.

@stonino stonino closed this as completed Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants