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 350 forks source link

Getting "No way." when loading session-based folder. #535

Closed donsingh closed 7 years ago

donsingh commented 7 years ago

I know this repo is already depracated but seeing as RichFilemanager does not support MVC yet, using codeigniter I am going to choose this wonderful package still.

Here's the weird thing, using $fm->setFileRoot() causes a "no way" error.

config:

        "serverRoot": true,
        "fileRoot": "usc2/uploads/",
        "baseUrl": false,
        "logger": true,
    "logfile": "C:/xampp/htdocs/usc2/filemanager_log.txt",

user.config.php

function auth() {
  return true; //lets say its always ok...
}

$fm = new Filemanager();

if(@$_SESSION['admin'] === false){
        $folderPath = 'usc2/uploads/bravo/';
        $fm->setFileRoot($folderPath, true);
}

If session['admin'] were true, the if statement doesnt trigger and everything runs smoothly.

If admin, basically it would open to: C:\xampp\htdocs\usc2\uploads\

BUT, if not admin, open to a subfolder: C:\xampp\htdocs\usc2\uploads\bravo\

This is the log when admin is on (works fine):

[12/07/2017 03:48:59]#::1#Filemanager::enableLog - Log enabled (in C:/xampp/htdocs/usc2/filemanager_log.txt file)
[12/07/2017 03:48:59]#::1#Filemanager::__construct $this->root value C:\xampp\htdocs\usc2\assets\filemanager\
[12/07/2017 03:48:59]#::1#Filemanager::__construct $this->path_to_files C:/xampp/htdocs/usc2/uploads/
[12/07/2017 03:48:59]#::1#Filemanager::__construct $this->doc_root value C:/xampp/htdocs
[12/07/2017 03:48:59]#::1#Filemanager::__construct $this->separator value uploads
[12/07/2017 03:48:59]#::1#substr path_to_files : C:\xampp\htdocs\usc2\uploads\
[12/07/2017 03:48:59]#::1#path_to_files : C:\xampp\htdocs\usc2\uploads\

This is the log when admin is off (using setFileRoot, getting "No Way"):

[12/07/2017 04:06:45]#::1#Filemanager::enableLog - Log enabled (in C:/xampp/htdocs/usc2/filemanager_log.txt file)
[12/07/2017 04:06:45]#::1#Filemanager::__construct $this->root value C:\xampp\htdocs\usc2\assets\filemanager\
[12/07/2017 04:06:45]#::1#Filemanager::__construct $this->path_to_files C:/xampp/htdocs/usc2/uploads/
[12/07/2017 04:06:45]#::1#Filemanager::__construct $this->doc_root value C:/xampp/htdocs
[12/07/2017 04:06:45]#::1#Filemanager::__construct $this->separator value uploads
[12/07/2017 04:06:45]#::1#Filemanager::setFileRoot $this->doc_root value overwritten : C:/xampp/htdocs/usc2/uploads/bravo/
[12/07/2017 04:06:45]#::1#Filemanager::setFileRoot $this->dynamic_fileroot value /usc2/uploads/bravo/
[12/07/2017 04:06:45]#::1#Filemanager::setFileRoot $this->path_to_files C:/xampp/htdocs/usc2/uploads/bravo/
[12/07/2017 04:06:45]#::1#Filemanager::setFileRoot $this->separator value bravo
[12/07/2017 04:06:45]#::1#substr path_to_files : \
[12/07/2017 04:06:45]#::1#path_to_files : C:\xampp\htdocs\usc2\uploads\bravo\
[12/07/2017 04:06:45]#::1#Filemanager::error - error message : No way.

I noticed that path_to_files is now "\" which could be the problem?

BTW this is a windows system and will be deployed on a windows machine if that's any concern. I hope you can get back to me on this asap. Thank you very much!

psolom commented 7 years ago

Please note, that this package is deprecated and not supported.

You can try out RichFileManager

donsingh commented 7 years ago

@servocoder do I connect RichFileManager the same way as FileManager? Im using CodeIgniter (MVC) btw.

psolom commented 7 years ago

RichFileManager is came out from the simogeo's FileManager however was reworked a lot. The installation steps are differ. For PHP connector the composer tool is used. Follow the Wiki section of RichFileManager and go ahead to learn more.