Welcome to Geeklog, Anonymous Saturday, December 06 2025 @ 10:56 am EST

Geeklog Forums

Uploads


Simpleminded

Anonymous
Is there a way to display the contents of the "media" folder within this plugins index?

Thanks
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
yup, pretty simple. feel like editing?
add this to your functions.inc file:
Text Formatted Code

//scans media dir and returns extant files
function ups_scanDir(){
    global $_CONF;

    $mediadir = $_CONF['path_html'] . 'media/';
    if (is_dir($mediadir)){
        if ($dh = @opendir($mediadir)){
            $retval = '<p>This is a list of all files currently residing in the Uploads media directory.</p>';
            $retval .= '<ul style="list-style-position:inside;">';
           //loop thru dir for files only
           $i = 0;
           while (($file = @readdir($dh)) !== false) {
               if (filetype($mediadir . $file) == 'file' && $file != '.' && $file != '..'){
                   $filesize = ups_readbytes(filesize($mediadir . $file));
                   $retval .= '<li><b>Filename</b>:' . $file . '   <b>size</b>:' . $filesize . '</li>';
                   $i++;
               }
           }
           $retval .= '</ul>';
           clearstatcache();
           closedir($dh);
           if ($i <= 0){
               $retval = 'No files exist in ' . $mediadir;
           }
        } else $retval = $mediadir . ' is not available.';
    } else $retval = $mediadir . ' is not available.';
    return $retval;
}



 

not done yet Laughing need to add a call to that function in index.php.
edit the last code block in your public_html/uploads/index.php to look like the following:
Text Formatted Code

$display = COM_endBlock();
$display .= COM_startBlock('Current Media');
$display .= ups_scanDir();
$display .= COM_endblock();
$display .= COM_siteFooter(true);
echo $display;


 

that should do it--worked for me.
I needed a break from the gallery anyway. Wink
 Quote

Simpleminded

Anonymous
Awesome! Worked perfectly Mr. Green Mr. Green

And I've been looking at your gallery for as long as I've been using Geeklog (3 days Laughing ) and can't wait to have it running when it's released, my site needs a gallery like no other - guild site for an online game = tonnes of screenshots - so I'm using your uploads plugin to atleast give the users the ability to put up screens they can display in the forums.

Once again, thanks for your help Chest-Slam Celebration
 Quote

Simpleminded

Anonymous
Hmm.. I seem to be having trouble with permissions. I've set a group with the uploads.admin access but they still can't get into the page. They're hit with the access denied instead. I've looked at the group list and it says they're all users of it so I'm really confused Neutral
 Quote

mach

Anonymous
I'll have a look later today..
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
my bad... about line 7 in index.php, change
Text Formatted Code
if (!SEC_inGroup('Root') || !SEC_hasRights('uploads.admin')){

 
to this:
Text Formatted Code
if (!SEC_hasRights('uploads.admin')){

 
do the same in funtions.inc with the function plugin_getuseroption_uploads().
 Quote

Simpleminded

Anonymous
Thanks, I just ended up changing 'Root' to 'User Group' after staring at it for a while and that kicked in.

Beautiful work Mr. Green
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
i threw an updated version in the download section that includes these changes--thanks for the heads up
 Quote

All times are EST. The time is now 10:56 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content