Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Howto 16 Session for JFU
https://www.tinywebgallery.com/forum/viewtopic.php?f=13&t=3451
Page 1 of 1

Author:  Dada34 [ 12. Nov 2012, 09:34 ]
Post subject:  Howto 16 Session for JFU

Hello and thanks a lot for JFU!

I would like to set the upload-dir different in each joomla-article. I tried Howto16, but it did not work. I got the message, that the upload dir is not set or deleated. I guess it works different within Joomla. Do you have any idea how I can do this?

The easiest way would be, if I could set the upload-dir right in the plug-in code (e.g. {jfuploader type=0 id=2 mydir=images/camps/tt2 securitytoken=xy}

David

PS: I use Joomla 2.5.7 and JFU 2.17

Author:  TinyWebGallery [ 12. Nov 2012, 10:36 ]
Post subject:  Re: Howto 16 Session for JFU

currently you have to use a different profile for each article.

The problem with allowing the url at the plugin code is that everyone who can change the page can get access to other folders as well. So it should only be an option that has to be allowed explicitly.

Best,
Michael

Author:  Dada34 [ 12. Nov 2012, 10:47 ]
Post subject:  Re: Howto 16 Session for JFU

Okay, then I'll do it with the profiles. Thanks for the answer!

Do you see a chance, that the dir in den plug-in code will be available anytime?

For our project only co-workers have access to change the articles, so that wouldn't be a problem. For security-reasons it might be an idea to set a folder in the plug-in as the main upload-folder (e.g. "images/upload/"). And then I can only choose folders within that main-folder in the plug-in code (e.g. mydir=aa that would be "images/upload/aa"). So no one can get himself access to the whole page dir.

Author:  TinyWebGallery [ 12. Nov 2012, 11:20 ]
Post subject:  Re: Howto 16 Session for JFU

The problem is not the code. this is easy to do.

but even when you assign one aa and the other one bb the one from aa can, if he has the rights change aa to bb and gets access this way.
An option could be added that the parameter is read but then this should only be used in an environment where everyone trusts each other...

Best, Michael

Author:  Dada34 [ 12. Nov 2012, 13:04 ]
Post subject:  Re: Howto 16 Session for JFU

Yes, sure. In our project no user has editor rights - only the administrators, who have full access anyway.

Author:  TinyWebGallery [ 12. Nov 2012, 13:07 ]
Post subject:  Re: Howto 16 Session for JFU

Then this would be possible to implement. You could do the changes directly in the plugin.

Best,
Michael

Author:  Dada34 [ 12. Nov 2012, 16:38 ]
Post subject:  Re: Howto 16 Session for JFU

Can you give me a hint, how to implement this?

I allready insert on line 80:
Code:
       preg_match ( '/{jfuploader.*dir=([\w_-]+).*}/', $row->text, $treffer );
        if (isset($treffer[1])) {
           $dir = $treffer[1];
         } else {
           $dir = '';

And changed line 90 to.
Code:
      echo '<!-- JFU type: \'' . $selector . '\' id: \'' .  $id . '\' dir: \'' .  $dir . '\' -->';   

Now, where can I set $dir as my uploadfolder?

Author:  TinyWebGallery [ 12. Nov 2012, 16:42 ]
Post subject:  Re: Howto 16 Session for JFU

look for
$uploadfolder = $row->folder;

below of that is a lot of done that is done when using a master profile! If you don't have enabled that you can simply add this there.

I would add a little bit more logic that the folders are automatically created like I do for the master profiles.
If the dirs do exist simply add the folder at the line I have written.

Best, Michael

Author:  Dada34 [ 12. Nov 2012, 18:24 ]
Post subject:  Re: Howto 16 Session for JFU

I tried ... and failed. Guess I'm still a rookie.

My plug-in code looks like that: {jfuploader type=0 id=2 dir=images/aa/bb/cc securitytoken=xy}

How can I get the dir parameters from the code to $uploadfolder?

Thanks for your help!

Author:  TinyWebGallery [ 12. Nov 2012, 20:33 ]
Post subject:  Re: Howto 16 Session for JFU

/ is not part of the regular expression.
I would actually not allow a full path here but only a relative one to the one of the profile.

Use echo that you see an output at different steps.

Best, Michael

Author:  Dada34 [ 12. Nov 2012, 22:45 ]
Post subject:  Re: Howto 16 Session for JFU

It works now perfectly. Thank you for encouraging me to try it myself.
David

Author:  TinyWebGallery [ 12. Nov 2012, 23:06 ]
Post subject:  Re: Howto 16 Session for JFU

;). You are welcome.

Best,
Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/