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
Thanks
15
16
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:
//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
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:
$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.
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
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.
17
14
Quote
Simpleminded
Anonymous
Awesome! Worked perfectly
And I've been looking at your gallery for as long as I've been using Geeklog (3 days
) 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
And I've been looking at your gallery for as long as I've been using Geeklog (3 days
Once again, thanks for your help
14
17
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
12
10
Quote
mach
Anonymous
I'll have a look later today..
12
14
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
my bad... about line 7 in index.php, change
to this:
do the same in funtions.inc with the function plugin_getuseroption_uploads().
Text Formatted Code
if (!SEC_inGroup('Root') || !SEC_hasRights('uploads.admin')){Text Formatted Code
if (!SEC_hasRights('uploads.admin')){
13
14
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
Beautiful work
17
12
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
16
18
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