Indefero

Indefero Commit Details


Date:2009-02-16 11:04:03 (15 years 10 months ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:75ec32765c1624901f73479807e0fcddff5778ee
Parents: 9cd2d1c4ef627cdad28f1336c1a3618506bcf290
Message:Added the ability to add download extension and control the download size.

Changes:

File differences

src/IDF/Form/Upload.php
4848
4949
5050
51
5152
5253
5354
......
6869
6970
7071
71
72
73
74
7275
7376
7477
array('required' => true,
'label' => __('File'),
'initial' => '',
'max_size' => Pluf::f('max_upload_size', 2097152),
'move_function_params' => array('upload_path' => Pluf::f('upload_path').'/'.$this->project->shortname.'/files',
'upload_path_create' => true,
'upload_overwrite' => false),
public function clean_file()
{
if (!preg_match('/\.(png|jpg|jpeg|gif|bmp|psd|tif|aiff|asf|avi|bz2|css|doc|eps|gz|mdtext|mid|mov|mp3|mpg|ogg|pdf|ppt|ps|qt|ra|ram|rm|rtf|sdd|sdw|sit|sxi|sxw|swf|tgz|txt|wav|xls|xml|wmv|zip)$/i', $this->cleaned_data['file'])) {
$extra = strtolower(implode('|', explode(' ', Pluf::f('idf_extra_upload_ext'))));
if (strlen($extra)) $extra .= '|';
if (!preg_match('/\.('.$extra.'png|jpg|jpeg|gif|bmp|psd|tif|aiff|asf|avi|bz2|css|doc|eps|gz|mdtext|mid|mov|mp3|mpg|ogg|pdf|ppt|ps|qt|ra|ram|rm|rtf|sdd|sdw|sit|sxi|sxw|swf|tgz|txt|wav|xls|xml|wmv|zip)$/i', $this->cleaned_data['file'])) {
throw new Pluf_Form_Invalid(__('For security reason, you cannot upload a file with this extension.'));
}
return $this->cleaned_data['file'];
src/IDF/conf/idf.php-dist
159159
160160
161161
162
163
164
165
166
167
168
162169
163170
164171
$cfg['db_engine'] = 'PostgreSQL'; # SQLite is also well tested or MySQL
$cfg['db_database'] = 'website'; # put absolute path to the db if you
# are using SQLite.
#
# The extension of the downloads are limited. You can add extra
# extensions here.
# $cfg['idf_extra_upload_ext'] = 'ext1 ext2';
#
# By default, the size of the downloads is limited to 2MB.
# $cfg['max_upload_size'] = 2097152; // Size in bytes
# -- From this point you should not need to update anything. --
$cfg['pear_path'] = '/usr/share/php';

Archive Download the corresponding diff file

Page rendered in 0.08326s using 13 queries.