simogeo / Filemanager

An open-source file manager released under MIT license. Up-to-date for PHP connector. This package is DEPRECATED. Now, please use RichFileManager available at : https://github.com/servocoder/RichFilemanager.
938 stars 351 forks source link

filemanager userfiles error #379

Closed MonkeyOnKeyboard closed 9 years ago

MonkeyOnKeyboard commented 9 years ago

Hello, ive an error doring setup userfolders. i use filebrowser latest version with ilch 1.1p and ckeditor 4.5.x my Problem is, if i make the setup for user.config.php from the turorial, the user dirs wont be create and the filemanager is loading.....

how can i use the filemanager with my configuration from ilch and so on?

<?php /**

session_start();

$folderPath = '/community/include/images/uploads/userfiles/' . $_SESSION['userfoldername'].'/'; $fm = new Filemanager(); $fm->setFileRoot($folderPath);

/**

// @todo Work on plugins registration // if (isset($config['plugin']) && !empty($config['plugin'])) { // $pluginPath = 'plugins' . DIRECTORY_SEPARATOR . $config['plugin'] . DIRECTORY_SEPARATOR; // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.config.php'); // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.class.php'); // $className = 'Filemanager'.strtoupper($config['plugin']); // $fm = new $className($config); // } else { // $fm = new Filemanager($config); // }

// we instantiate the Filemanager $fm = new Filemanager();

?>

The next is, if its possible:

if an user open the filemanager, that the filmanager looks (if is the userfolder exist -> if not create userfolder)

simogeo commented 9 years ago

1 - download the last version : https://github.com/simogeo/Filemanager/archive/master.zip 2 - change your user.config.php file with the following instructions :

$folderPath = '/community/include/images/uploads/userfiles/' . $_SESSION['userfoldername'].'/';
$fm = new Filemanager();
$fm->setFileRoot($folderPath, true);

Note the new parameter on setFileRoot() method. It will allow you to create folder if it does not exists.

3 - you're done.

simogeo commented 9 years ago

Please re-open if not ok

MonkeyOnKeyboard commented 9 years ago

Ive done the changes but. the filemanager ignores the user.config.php filemanager shows only / but its wrong in user.config.php the path is present. whats going wrong

simogeo commented 9 years ago

filemanager shows only / but its wrong in user.config.php the path is present.

This is normal behaviour. The FM won't display the full path to user folder when using setFileRoot(). But it will work on the given folder. You can have a look to the passed parameter (path) under your explorer to be sure.

By the way, I would give you the advice to get the latest version again - I just fixed a bug (I guess).

MonkeyOnKeyboard commented 9 years ago

ok i will show it in next hour at the moment i put 171 smilys manuel to ckeditor ;-)

MonkeyOnKeyboard commented 9 years ago

what must i insert for paths and variables? should it ok? if i set only the path in user.config.php?

simogeo commented 9 years ago
"serverRoot": false,
"fileRoot": "/",
"logger": true,

For the last instruction, see : https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file#the-options-section. Using, logger, and logfile keys , you will be able to see the full path value in your logfile.

and in your user.config.php file, as said above :

$folderPath = '/community/include/images/uploads/userfiles/' . $_SESSION['userfoldername'].'/';
$fm = new Filemanager();
$fm->setFileRoot($folderPath, true);
MonkeyOnKeyboard commented 9 years ago

So it wont work. he stays in / dir and no in userdir in /include/images/uploads/userfiles/

he ignores the user.config.php

<?php /**

session_start ();

$folderPath = '/include/images/uploads/userfiles/' . $_SESSION['userfoldername'].'/'; $fm = new Filemanager(); $fm->setFileRoot($folderPath, true);

/**

function auth() { // 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 $_SESSION['authright'] <= -3;

}

// @todo Work on plugins registration // if (isset($config['plugin']) && !empty($config['plugin'])) { // $pluginPath = 'plugins' . DIRECTORY_SEPARATOR . $config['plugin'] . DIRECTORY_SEPARATOR; // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.config.php'); // require_once($pluginPath . 'filemanager.' . $config['plugin'] . '.class.php'); // $className = 'Filemanager'.strtoupper($config['plugin']); // $fm = new $className($config); // } else { // $fm = new Filemanager($config); // }

// we instantiate the Filemanager $fm = new Filemanager();

?>

simogeo commented 9 years ago

of course you instantiate it twice.... *Remove your last line+ :

// we instantiate the Filemanager
$fm = new Filemanager();
MonkeyOnKeyboard commented 9 years ago

ok first problem solved, but he didnt create userfolder like username for example

simogeo commented 9 years ago

To see what's happening, enable logging : https://github.com/simogeo/Filemanager/wiki/Enable-log-debug-in-PHP-connector, access your FM from browser and past log content.

MonkeyOnKeyboard commented 9 years ago

[17/08/2015 08:34:37]#217.228.253.185#Filemanager::enableLog - Log enabled (in /tmp/filemanager.log file) [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->root value /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/includes/filemanager/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->path_to_files /var/www/vhosts/caelum-et-infernum.eu/httpdocs// [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->doc_root value /var/www/vhosts/caelum-et-infernum.eu/httpdocs [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->separator value [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->doc_root value overwritten : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->dynamic_fileroot value /include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->path_to_files /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->separator value userfiles [17/08/2015 08:34:37]#217.228.253.185#substr path_to_files : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#path_to_files : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::enableLog - Log enabled (in /tmp/filemanager.log file) [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->root value /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/includes/filemanager/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->path_to_files /var/www/vhosts/caelum-et-infernum.eu/httpdocs// [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->doc_root value /var/www/vhosts/caelum-et-infernum.eu/httpdocs [17/08/2015 08:34:37]#217.228.253.185#Filemanager::construct $this->separator value [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->doc_root value overwritten : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->dynamic_fileroot value /include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->path_to_files /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#Filemanager::setFileRoot $this->separator value userfiles [17/08/2015 08:34:37]#217.228.253.185#substr path_to_files : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/ [17/08/2015 08:34:37]#217.228.253.185#path_to_files : /var/www/vhosts/caelum-et-infernum.eu/httpdocs/include/images/uploads/userfiles/

simogeo commented 9 years ago

it seems that $_SESSION['userfoldername'] is not passed correctly to folder path because it does not appear in log

MonkeyOnKeyboard commented 9 years ago

yes thats it you cancels the $_SESSION['userfoldername'] thats the problem what i have.

btw. in the session there is no userfoldername the system is ilch and the only one is authname authname|s:10:"MagicMoney";authid|s:3:"118";authright|s:2:"-9";

But if i replace $_SESSION['userfoldername'] with $_SESSION['authname']

its the same, the script ignores the $_SESSION['userfolder'] variable

simogeo commented 9 years ago

The script does not cancel / ignore anything .... provide the good variable and it will work correctly.

Refer to ilch support if needed.

MonkeyOnKeyboard commented 9 years ago

Sorry but the $_SESSION['authname'] is the right id. i test it two times with over $_SESSION variables from ilch. the create variable ignores the . $_SESSION so the ticket is not over.

simogeo commented 9 years ago

check your apache logfile or just uncomment lines 3-4 in https://github.com/simogeo/Filemanager/blob/master/connectors/php/filemanager.php#L3

You can even try to echo $_SESSION['authname'] in user.config.php to see that it will probably be undefined or as unexpected format (such as array or serialized content ). Maybe with the help of firebug.

FM is free of charge, user coding support is not. Problem is yours, ticket is over.

I've been fooled a couple of time ... Spending time without even a 'thanks word'

MonkeyOnKeyboard commented 9 years ago

sorry but, ive testet all.

  1. if activate log but no log was seen. in apache log or so on.
  2. its defenetly ... the script ignores the variables aufer /' becouse if testet it with all user variables from ilch... for user auth. and nothing he ignores all. btw. you cant close a ticket if the problem isnt solfed. its our problem, not only my.

so help please....

simogeo commented 9 years ago

if activate log but no log was seen. in apache log or so on.

try again, it works well

its defenetly ... the script ignores the variables aufer /'

Remember, you also said before, the script did not read user.config.php file .... But fault was yours

MonkeyOnKeyboard commented 9 years ago

so i testet the link in user.config.php with 2 other uploading scripts, and they work .... its not my fault.. its a fault from your script, what ignores the ' . $_SESSION[""] . '/' variable

but you go the easy way to say its my foult.. nice support...

simogeo commented 9 years ago

its a fault from your script, what ignores the ' . $_SESSION[""] . '/' variable

I'd be happy you to explain me why and show me how the script would do that ....