Summary: Talk page for DirList.
Maintainer: Petko
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Ccox - September 28, 2016

For the line in dirlst.php for handling listwrap, I added (to my own copy) an extra parm for Ddir which is just the path supplied as "dir" via GET, thus not revealing base:

$wrap = sprintf($DirList['listwrap'], $html, $dir, $Ddir); 

Things I have set in my config.php:

$DirList['Base'] = '/var/www/base';
$DirList['Root'] = '';
$DirList['dirline'] = '<tr><td class="d"><a href="{$PageUrl}?dir=%4$s">%1$s/</a></td><td class="s">%2$s</td><td class="t">%3$s</td></tr>';
$DirList['defaultfilter'] = "-*~,-*.bak,-cache";
$DirList['listwrap'] = '<h3>%3$s</h3><table class="dirlist sortable" id="mydirlist" border="0"><tr><th align="left">Name</th><th align="left">Size</th><th align="left">Date</th></tr>%1$s</table>';

$HTMLStylesFmt['dirlist'] = "table.dirlist td.s, table.dirlist td.t { text-align: right; }
table.dirlist { border: 1px none #dddddd; }
table.dirlist td { border: 1px none #dddddd; padding: 0px 2px; margin:2px; } ";

Thanks, and sorry for the delayed reply. All this sounds reasonable. I'll try to find some time to review your changes and add them. UpdateMe --Petko September 28, 2016, at 06:21 PM

Ccox - June 6, 2016

I added (in my own copy) a secret var called Base (settable only via config.php) that is the root of all. Thus "Root" in the recipe is always off of Base. This is so the recipe can be somewhat "controlled" rather than exposing every directory on the system. If somebody wants access to a DirList, they have to notify the administrator to symlink it in under Base.

(you would also want to strip redirection elements like /../ etc out of the "Root" so the Base could not be easily circumvented.)

I think we also need more control over caption (reveals too much). I simply remove it from the HTMLStylesFmt. So in addition of adding Base to the recipe, this is what I have in my config.php. Would be nice if caption was relative to base and ideally more configurable, that is, possible giving a way to change the page title to match the Base relative path:

$DirList['dirline'] = '<tr><td class="d"><a href="{$PageUrl}?dir=%4$s">%1$s/</a></td><td class="s">%2$s</td><td class="t">%3$s</td></tr>';
$DirList['defaultfilter'] = "-*~,-*.bak,-cache";
$DirList['Root'] = "";
$DirList['listwrap'] = '<table class="dirlist" border="0">%1$s</table>';

$HTMLStylesFmt['dirlist'] = "table.dirlist td.s, table.dirlist td.t { text-align: right; }
table.dirlist { border: 1px none #dddddd; }
table.dirlist td { border: 1px none #dddddd; padding: 0px 2px; margin:2px; } ";

Michael - March 11, 2013

Great recipe!!!

Is there any way you can get the directory listing to sort alphabetically?


It is supposed to sort them alphabetically, first subdirectories, then files. --Petko March 11, 2013, at 01:45 PM

jeffg - July 14, 2011 Is there anyway to use NTLM (windows passthrough) with DirList?

Hi Petko, Great recipe! I'm wondering if there is a way to pass the user's windows credentials through to the file server rather than have the WIKI server needing to have read permissions. In my intranet, I have various network shares which are assigned per department. I'd really like to be able to give them access via the wiki to those shares, but can't open up permissions for the whole file server.


I don't know of any such way, sorry. In order to show directory listings and serve the files, dirlist needs read permissions for the "Root" directory. --Petko July 14, 2011, at 06:20 PM

yd, May 29, 2011: works fine, however is it possible not to open a link, but follow it (.url)?

No, the program doesn't read or manipulate the contents of the files it serves. --Petko May 29, 2011, at 03:49 AM

Davide, July 13, 2011: This recipe is extremely useful! The only thing that does not work for me is listing directories on our LAN. For example, if I specify:

$DirList['Root'] = "";

It fails to open that directory. I would be extremely grateful for any help!! Thank you so much for your work!

- Davide

Dirlist does not connect to the remote server via HTTP, it connects via the filesystem. On a Windows server, I have a Dirlist that shows files from another Windows server on the LAN. The Root string starts with "\\\\Server-Name/directory" or "\\\\". On a GNU/Linux server, I would mount/link via NFS or SMB the remote directory to a local directory where the dirlist script can access it. --Petko July 13, 2011, at 07:54 PM

If your wiki users are on the same LAN, you could just link to the remote http server with [[]] like regular links. Same for the InterMap prefix. --Petko July 13, 2011, at 07:57 PM

Davide, July 14 2011. Ok Petko, thank you so much for your prompt reply and thanks again very much for your work!

Talk page for the DirList recipe (users?).