Skip to content

Commit

Permalink
make file command configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Prodromou committed Jun 23, 2009
1 parent ccd9cdd commit 7bcaa85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,10 @@ supported: an array of mime types you accept to store and distribute,
setup your server to properly reckognize the types you want to
support.
uploads: false to disable uploading files with notices (true by default).
filecommand: The required MIME_Type library may need to use the 'file'
command. It tries the one in the Web server's path, but if
you're having problems with uploads, try setting this to the
correct value. Note: 'file' must accept '-b' and '-i' options.

For quotas, be sure you've set the upload_max_filesize and post_max_size
in php.ini to be large enough to handle your upload. In httpd.conf
Expand Down
3 changes: 3 additions & 0 deletions actions/newnotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ function handle($args)
function getUploadedFileType() {
require_once 'MIME/Type.php';

$cmd = &PEAR::getStaticProperty('MIME_Type', 'fileCmd');
$cmd = common_config('attachments', 'filecommand');

$filetype = MIME_Type::autoDetect($_FILES['attach']['tmp_name']);
if (in_array($filetype, common_config('attachments', 'supported'))) {
return $filetype;
Expand Down
3 changes: 2 additions & 1 deletion lib/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function _sn_to_path($sn)
array('run' => 'web',
'frequency' => 10000,
'reporturl' => 'http://laconi.ca/stats/report'),
'attachments' =>
'attachments' =>
array('server' => null,
'dir' => INSTALLDIR . '/file/',
'path' => $_path . '/file/',
Expand Down Expand Up @@ -241,6 +241,7 @@ function _sn_to_path($sn)
'user_quota' => 50000000,
'monthly_quota' => 15000000,
'uploads' => true,
'filecommand' => '/usr/bin/file',
),
'group' =>
array('maxaliases' => 3),
Expand Down

0 comments on commit 7bcaa85

Please sign in to comment.