开发者

Change elfinder root by user

开发者 https://www.devze.com 2023-03-21 05:58 出处:网络
My problem is almost like that of http://elrte.org/redmine/boards/2/topics/734?r=3250 which didn\'t get any solution.

My problem is almost like that of http://elrte.org/redmine/boards/2/topics/734?r=3250 which didn't get any solution.

I am using elfinder on my wordpress site in which on every user register I create a folder under the files directory on username and when that user comes to the interface where elfinder shows I want elfinder to show that user his user's folder as the root directory instead of the actual root set. I found out through code that the root directory is set in connectors/php/connector.php file that passes it to elFinder.class.php file

I even found out a way to do that hardcoded... which is if you go into elFinder.class.php file and append the username with root in __contruct function everything works fine

public function __construct($options=array()) {
        foreach ($this->_options as $k=>$v) {
            if (isset($options[$k])) {
                $this->_options[$k] = is_array($this->_options[$k]) 
                    ? array_me开发者_运维百科rge($this->_options[$k], $options[$k]) 
                    : $options[$k];
            }
        }
if (substr($this->_options['root'], 1) == DIRECTORY_SEPARATOR) {
            $this>_options['root'] = substr($this->_options['root'], 0, 1);
        } $this>_options['root'] .= 'username';

But the problem is that I am unable to find a way through which I can access username in elFinder way... It feels like there will be some simple way that my mind just ain't clicking to.. any help in this regard will be greatly appreciate. Even if I can't access username in this function and somehow pass the username to this function or connector.php which calls its construct???


Modifying elFinder.class.php is a wrong way, what you need is to get your WordPress instance inside connector.php and generate correct root option for current user, the username/path you should get from WordPress.

0

精彩评论

暂无评论...
验证码 换一张
取 消