Recent Topics

1 Sep 17, 2008 09:33    

HI all,

I've gallery2_plugin installed and FCKeditor install. I need to set the default upload directory to point to the Gallery2 album directory such as
"/www/bj/gallery2/album/john", and i wanna to replace the "john" to some global value such as $USER from b2.

How can I do that?

Thanks.
Max.

2 Sep 18, 2008 03:46

I'm kind of assuming you mean the b2evolution media directory when you say upload directory.

You can find where the upload directory is set and use the global $current_User to set the directory path.
something like:

global $current_User, $Plugins;
$gallery2sso = $Plugins->get_by_code('evo_gallery2_auth');

if (!empty($gallery2sso)) {
  $gallerypath = $gallery2sso->Settings->get('gallery2path');
  $uploadpath = $gallerypath.'albums/'.$current_User->get('login').'/';
} else {
  //Gallery2 not installed. Use the previous value for upload directory?
}

As a side note, usually you don't put your gallery2 data under your web server root. Normally /www/whatever/gallery2/ would contain php files but no album/image data. Would having your album directory as your upload/media directory really work?

3 Sep 22, 2008 17:01

ya, i understand what you mean about the media directory location, i'll take care that later.

I put the code into the ".../FCKeditor/editor/filemanager/upload/php/config.php" but it doesn't seems to work. When i wanna upload the file, it doesn't give any successful message, even i hard code the path and just add $current_User->get('login') also fail. here is the code of ".../FCKeditor/editor/filemanager/upload/php/config.php"


global $Config, $current_User;

// SECURITY: You must explicitelly enable this "uploader".
$Config['Enabled'] = true ;

// Path to uploaded files relative to the document root.
$Config['UserFilesPath'] = '/home/okucommy/public_html/bj/gallery2/g2data/albums/'.$current_User->get('login').'/';

$Config['AllowedExtensions']['File'] = array() ;
$Config['DeniedExtensions']['File'] = array('php','php3','php5','phtml','asp','aspx','ascx','jsp','cfm','cfc','pl','bat','exe','dll','reg','cgi') ;

$Config['AllowedExtensions']['Image'] = array('jpg','gif','jpeg','png') ;
$Config['DeniedExtensions']['Image'] = array() ;

$Config['AllowedExtensions']['Flash'] = array('swf','fla') ;
$Config['DeniedExtensions']['Flash'] = array() ;


Am i doing something wrong here? what is the variable to retrive user login?

THanks & regards,

Max.

IanLewis wrote:

I'm kind of assuming you mean the b2evolution media directory when you say upload directory.

You can find where the upload directory is set and use the global $current_User to set the directory path.
something like:

global $current_User, $Plugins;
$gallery2sso = $Plugins->get_by_code('evo_gallery2_auth');

if (!empty($gallery2sso)) {
  $gallerypath = $gallery2sso->Settings->get('gallery2path');
  $uploadpath = $gallerypath.'albums/'.$current_User->get('login').'/';
} else {
  //Gallery2 not installed. Use the previous value for upload directory?
}

As a side note, usually you don't put your gallery2 data under your web server root. Normally /www/whatever/gallery2/ would contain php files but no album/image data. Would having your album directory as your upload/media directory really work?


Form is loading...