Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-02-14 19:13:12

AussieFreelancer
Xinha Community Member
From: Waroona, WA, Australia
Registered: 2007-02-07
Posts: 22

dynamic image/file directories

Hi all,

I have come across an issue where I need to allow members to upload, edit and delete photos, but they should only be able to see the images that they have uploaded, otherwise they would be able to see, edit and delete everyone's images.

To get around this, I am wondering if it is possible to dynamically set the root directory for the ExtendedFileManager and ImageManager when the page is loaded, so that it would become their personal folder?

For example, if the user had an id of 6, when they open up a page with the editor on, it will dynamically set the root dir to be www.domain.com/xinha/ExtendedFileManager/6/ or something like that. I see that it is not possible to view files beyond the specified root directory, so I think that if this is possible, it should be the solution to my problems. smile Obviously a folder called 6 would need to exist, but that is outside the scope of Xinha as that would be set up along with registration.

Appreciate any feedback on this.

Thanks

Patrick

Offline

#2 2007-02-15 10:18:41

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: dynamic image/file directories

If you are using PHP for your user management you have the freedom to set the image dir to whichever you like in the config.
see http://xinha.python-hosting.com/wiki/Pl … ileManager

Offline

#3 2007-03-19 22:33:05

AussieFreelancer
Xinha Community Member
From: Waroona, WA, Australia
Registered: 2007-02-07
Posts: 22

Re: dynamic image/file directories

Hi Ray,

Sorry for the delay getting back to you.. So this config stuff, I can put in the head tag?

Thanks

Patrick

Offline

#4 2007-03-20 05:45:31

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: dynamic image/file directories

Step 3 of this

Offline

#5 2007-03-21 05:35:17

bunak
New member
Registered: 2007-03-21
Posts: 1

Re: dynamic image/file directories

ray wrote:

If you are using PHP for your user management you have the freedom to set the image dir to whichever you like in the config.
see http://xinha.python-hosting.com/wiki/Pl … ileManager

Hi Ray,
I tried this, but it doesn't work.
How I must set

            $IMConfig['images_dir'] = '<images dir>';
            $IMConfig['images_url'] = '<images url>';
            $IMConfig['files_dir'] = '<files dir>';
            $IMConfig['files_url'] = '<files url>';

when xinha dir is in root of my web and dir for files and images is the same in web root named FILES?

absolut path to FILES is c:\apache\htdocs\tree\FILES, web is http://localhost/tree

thanks a lot

Bunak

Offline

#6 2007-03-22 07:29:14

AussieFreelancer
Xinha Community Member
From: Waroona, WA, Australia
Registered: 2007-02-07
Posts: 22

Re: dynamic image/file directories

Well, that sort of worked... I get a rich text editor appear and I can click on the image button, but when I do that, the image window pops up and i get the following error:

Warning: dir(/home/.../public/www/images/uploads/member_1) [function.dir]: failed to open dir: No such file or directory in /home/.../public/www/xinha/plugins/ImageManager/Classes/Files.php on line 223

Fatal error: Call to a member function read() on a non-object in /home/.../public/www/xinha/plugins/ImageManager/Classes/Files.php on line 226

But the dir does exist, and is chmod 777... I reckon I must be so close big_smile any more help would be great, thanks for the help so far. big_smile

Offline

#7 2007-03-22 10:09:50

mouloud
Xinha Community Member
Registered: 2007-02-23
Posts: 12

Re: dynamic image/file directories

Well, you must have an error in the path. This is a php error, and it's pretty clear, the directory does not exists.
Did it work with the common upload directory before you changed it ?

Offline

#8 2007-03-22 11:49:48

AussieFreelancer
Xinha Community Member
From: Waroona, WA, Australia
Registered: 2007-02-07
Posts: 22

Re: dynamic image/file directories

maybe there is a spelling error or something then.. this is the first upload i have tried on this site. I will look again in the morning, maybe then it will be clear. Glad to hear that it is probably just a typo though.. Have had some issues with directory browsing stuff, so thats cool. Thanks for the input, will let you know how I get on

Patrick

Offline

#9 2007-03-22 18:40:49

AussieFreelancer
Xinha Community Member
From: Waroona, WA, Australia
Registered: 2007-02-07
Posts: 22

Re: dynamic image/file directories

there was a mistake big_smile I forgot to put a trailing slash on the path name big_smile I put that on and now I am taken to the image upload screen, and I can create and manipulate new folders, but I can't upload images..

Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/tmp/php_upload/phpg5sVXh) is not within the allowed path(s) in /home/.../public/www/xinha/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php on line 458

this is the only error that happens, and I am assuming this now has to do with the host? sad So close, and yet so far big_smile Thanks or the help and advice so far, much appreciated...

actually, not sure what I did, but uploads sort of work now..

I was able to upload both files and images using the relevant plugin buttons, but whn I uploaded an image it wouldn't let me press ok - or cancel for that matter.

Now however, when I click on the FileLink button, nothing happens. When I click on the Image Upload button, a popup window appears, but doesn't resize itself, and I have the same issue as above, being able to upload images but not do anything when I have uploaded it.

On top of all that, it doesnt work at all in Internet Explorer 6 or 7.. sad so it seems a little way off completion at this time, I hope someone is able to help.

Many Thanks

Patrick

Last edited by AussieFreelancer (2007-03-22 20:05:09)

Offline

#10 2007-03-24 18:07:19

wijnand
Xinha Community Member
Registered: 2005-07-13
Posts: 17

Re: dynamic image/file directories

Hello all,

I changed $IMConfig['images_dir'] and $IMConfig['images_url'] in config.inc.php and that works fine. But now I like to set those vars dynamic in the template of a HTML file that is generated bij a perl-script.

What JS-code where to place? I think somewhere in NewbieGuide -> Page Code

Thanks...
Wijnand

Last edited by wijnand (2007-03-25 12:38:29)

Offline

Board footer

Powered by FluxBB