Jump to content

SPAW2 WYSIWYG help : show specific images in file manager


danlew

Recommended Posts

I am using php/mysql/apache linux server hosting for my site and testing the site on firefox 3.0+

 

I am creating a travel blog so I want to give my users a facility to uploaded images. I let them upload all images in a single folder "spaw2/uploads/images" and giving names of the files little dynamically using following code in spawfm.class.php

 

spawfm.class.php (line no 514)

 

I change from

if (!@move_uploaded_file($uplfile['tmp_name'], $this->getCurrentFsDir().$uplfile_name)) {

to

$uplfile_name = $_SESSION['user_id_session']."-".$uplfile['name']; // i added this line

if (!@move_uploaded_file($uplfile['tmp_name'], $this->getCurrentFsDir().$uplfile_name)) {

 

where $_SESSION['user_id_session'] is the unique ID of a "loggedin user" who is uploading the file. so this way I upload images. for example if a user's unique ID is "007" then his uploaded files names will be like >

 

007-myfirstimage.jpg

007-mysecondimage.jpg

007-mysecondimage_1.jpg

 

and so on.. it works fine till now :) . oh yes, and to make it successful i place session_start(); in the few php files to get value of $_SESSION variables. well this is not my problem.

 

my problem now is I want to show a user only his own uploaded images in "SPAW file manager 's file list"

 

I used a dirty trick in line no 276 in spawfm.class.php where I converted from >

 

foreach ($directories as $key=>$file) {

$directories[$key] = array(

'name' => $file,

'date' => $this->getFileDate($file),

'size' => $this->getFileSize($file),

'descr' => $lang->m('file_folder', 'file_details'),

'icon' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon'),

'icon_big' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon_big'),

'thumb' => $this->getFileThumbnail($file),

'other' => ''

);

}

 

 

to >

 

foreach ($directories as $key=>$file) {

$bravo_target=$_SESSION['user_id_session']."-"; // i added this line

$bravo_img=substr($file,0,strlen($bravo_target)); // i added this line

if($bravo_img==$bravo_target){ // i added this line

$directories[$key] = array(

'name' => $file,

'date' => $this->getFileDate($file),

'size' => $this->getFileSize($file),

'descr' => $lang->m('file_folder', 'file_details'),

'icon' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon'),

'icon_big' => '../plugins/spawfm/img/'.$config->getConfigValueElement('PG_SPAWFM_FILETYPES_ICON_FOLDER', 'icon_big'),

'thumb' => $this->getFileThumbnail($file),

'other' => ''

);

 

} // i added this line

}

 

 

but strange .. its still showing all images resided in "images" folder :( where as I only want to show list of the files which are only his own uploaded by a user.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.