f9da9e670f
Replace it at build time so it's easy to change
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
{
|
|
my $access = $dl{'access'} || 'private';
|
|
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
|
|
my $authtype = $dl{'Authentication'} || 'http';
|
|
my $alias = (($dl{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
|
|
'Alias /dl /usr/share/dl' : '';
|
|
my $maxupload = $dl{'MaxUploadSize'} || '1024';
|
|
my $maxpost = $maxupload+1;
|
|
$maxupload .= 'M';
|
|
$maxpost .= 'M';
|
|
my $auth = '';
|
|
if ($authtype eq 'http'){
|
|
$auth =<<'EOF';
|
|
<FilesMatch "^(admin|rest)\.php">
|
|
SSLRequireSSL on
|
|
AuthName "dl"
|
|
AuthType Basic
|
|
AuthBasicProvider external
|
|
AuthExternal pwauth
|
|
Require valid-user
|
|
</FilesMatch>
|
|
EOF
|
|
}
|
|
if ($dl{'status'} eq 'enabled'){
|
|
|
|
my $php =<<_EOF;
|
|
AddType application/x-httpd-php .php
|
|
php_admin_flag file_uploads On
|
|
php_admin_flag magic_quotes Off
|
|
php_admin_flag magic_quotes_gpc Off
|
|
php_admin_value upload_max_filesize $maxupload
|
|
php_admin_value post_max_size $maxpost
|
|
php_admin_value memory_limit 100M
|
|
php_admin_flag output_buffering Off
|
|
php_admin_value max_execution_time 0
|
|
php_admin_value upload_tmp_dir /var/lib/dl/tmp
|
|
php_admin_value session.save_path /var/lib/dl/tmp
|
|
php_admin_value session.gc_maxlifetime 86400
|
|
_EOF
|
|
if ($fastcgi_mod eq 'mod_fastcgi'){
|
|
$php = " AddHandler phpdl-fastcgi .php\n";
|
|
}
|
|
elsif ($fascgi_mod eq 'mod_proxy_fcgi'){
|
|
$php =<<'_EOF';
|
|
<FilesMatch \.php$>
|
|
SetHandler "proxy:unix:/var/run/php-fpm/php__PHP_VERSION__-dl.sock|fcgi://localhost"
|
|
</FilesMatch>
|
|
_EOF
|
|
}
|
|
|
|
$OUT .=<<"END"
|
|
|
|
# dl Configuration
|
|
$alias
|
|
|
|
<Directory /usr/share/dl>
|
|
AllowOverride Limit
|
|
$php
|
|
order deny,allow
|
|
deny from all
|
|
allow from $allow
|
|
$auth
|
|
</Directory>
|
|
<Directory /usr/share/dl/include>
|
|
Deny from all
|
|
</Directory>
|
|
<Directory /usr/share/dl/style/include>
|
|
Deny from all
|
|
</Directory>
|
|
END
|
|
}
|
|
else{
|
|
$OUT .= "# dl is disabled\n";
|
|
}
|
|
}
|