[chora] Chora, Mime Types and File Extensions

Jan Schneider jan at horde.org
Tue Sep 27 00:55:55 PDT 2005


Zitat von Ryan Creasey <rcreasey at ign.com>:

> 1. the file will output entirely blank, without any of the horde 
> templates being parsed and the file is sent plaintext, as if it were 
> passing the GET directly to apache and it parses it as text/plain.

This is the correct behaviour for text files.

> 2. the file will be output in the chora co format (where it includes 
> the templates), but there aren't any line numbers and the font used 
> isn't a fixed-width font (which looks goofy on some files).

Hm, sounds like a broken source highlighter. There are different 
highlighters that you can use and configure in mime_drivers.php. Try 
another one?

> 3. The file will be output, the horde interface is parsed, but none 
> of the file is sourced.  There will be just a blank box where the 
> file contents usually are.

This is unusual, but again maybe an issue with your highlighter.

> I know enough about horde to know that it defines its mime types in 
> horde/config/mime_drivers.php, and there are different drivers for

No, it doesn't. It defines the viewer for the different mime types there.

> mime header types.  What I'm confused about is how it associates 
> files with that mime type.  Does it do it by file extension?  Does it 
> rely on apache to dictate mime type?

Yes, it does it based on the extension. Doing mime magic wouldn't scale 
at all.

> If I had a bash script named 'dnsedit' (withouth a .sh), but the 
> first line of the file is "#!/bin/bash", is it possible to have it 
> detect along this line?  Let's just say I want chora to default to 
> using enscript for all it's source formatting (its output is purty). 
> How would I add support for files like this, or ones with extensions 
> like '.conf', '.spec', etc?

Mime type to extension mapping happens in lib/Horde/MIME/mime_mapping.php.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the chora mailing list