[pmwiki-users] File manager -- referring to uploaded files and directorie

chr at home.se chr at home.se
Sun Mar 20 12:05:51 CST 2005


Hi

I'm thinking of installing separate software to manage uploaded files 
(including uploading, renaming, directory creation etc). There seems to be 
a lot of file managers written in PhP, so right now I'm focusing on how to 
interface the wiki. This is just a start to figure out what API I need.

Let's assume that the file manager is invoked by going to a URI such as:

	http://www.pmwiki.org/filemanager.php?...

How can I now make PmWiki interface with it? This post will only touch 
upon on the markup for linking to uploaded files, as well as for links for 
browsing a directory with uploaded files. I'll write more posts on other 
issuse.

!!! Linking to uploaded files and directories

Today we write "Attach:somefile.txt" to create a link to an uploaded file
in the uploads/-directory. Clicking on this link simply gives us the
uploaded file.  I'm thinking of something similar, but using "uploads:"
instead of "Attach:" (this lets Attach: and the existing mechanisms for
uploading files remain intact). I also want to be able to use paths
together with "uploads:". Below are some examples where UPLOADS stand for
the (relative) URI of the uploads/ directive:

	Example	markup		   	   Destination
	uploads:file.txt		-> UPLOADS/{$Group}/file.txt
	uploads:dir1/file.txt		-> UPLOADS/{$Group}/dir1/file.txt
	uploads:/file.txt		-> UPLOADS/file.txt
	uploads:/dir1/file.txt		-> UPLOADS/dir1/file.txt
	uploads:/dir1/dir2/file.txt	-> UPLOADS/dir1/dir2/file.txt

Being able to handle '/../' isn't necessary, but names of directories and
files should be able to contain '.' as well as international characters.

Achieving the functionality above should be relatively easy and not depend
on the actual file manager that you use. In addition, I would also like to
create links to directories so that they can *browsed* using the file
manager. This is slightly more tricky since it means we have to invoke the
file manager with the proper arguments. But if we leave that for now,
here's how I expect it to work:

	Example markup			   Browses directory
	uploads:/			-> UPLOADS/
	uploads:/dir1			-> UPLOADS/dir1
	uploads:/dir1/dir2		-> UPLOADS/dir1/dir2
	uploads:/{$Group}		-> UPLOADS/{$Group}/

In addition, it might be useful to allow this as a shortcut:
	uploads:./			-> UPLOADS/{$Group}

Any thoughts/opinions on the syntax above? As for implementation, please 
wait with those ideas until my next post on what should happen when the 
destination file doesn't already exist...

/Christian

PS. As for preventing files with forbidden extensions, what if we simply
prevent something like uploads:bla/bla.exe from becoming a link?

A malicous person can of course still fake the link using e.g.

  [[Uploads:bla/bla.exe -> http://www.pmwiki.org/pmwiki/uploads/bla.exe]]

but this is already possible if people can link outside the wiki...

  [[Uploads:bla/bla.exe -> http://virus.net/badVirus.exe]]

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list