Fixes and cleanup in shares template

This commit is contained in:
Daniel Berteaud 2017-07-08 11:44:16 +02:00
parent 9ac0ec6917
commit c793cdef93
1 changed files with 12 additions and 10 deletions

View File

@ -6,23 +6,25 @@ my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database"
foreach my $share ($a->get_all_by_prop(type => 'share')){
my $pool_name = $share->key;
next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled');
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';
my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30';
my $allow_url_fopen = $share->prop('PHPAllowUrlFopen') || 'disabled';
my $post_max_size = $share->prop('PHPPostMaxSize') || '10M';
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';
my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30';
my $allow_url_fopen = $share->prop('PHPAllowUrlFopen') || 'disabled';
my $post_max_size = $share->prop('PHPPostMaxSize') || '10M';
my $upload_max_filesize = $share->prop('PHPUploadMaxFilesize') || '10M';
my $file_upload = $share->prop('PHPFileUpload') || 'enabled';
my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key . ':/var/lib/php/' . $pool_name;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
my $file_upload = $share->prop('PHPFileUpload') || 'enabled';
my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $$pool_name .
':/var/lib/php/' . $pool_name;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' .
'escapeshellarg,escapeshellcmd';
# Format vars
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$disabled_functions = join(', ', split /[,;:]/, $disabled_functions);
my $version = $share->prop('PHPVersion') || 'default';
$OUT .=<<"_EOF" if ($version == $PHP_VERSION or ($PHP_VERSION eq '' && $version == 'default'));
$OUT .=<<"_EOF" if ($version eq $PHP_VERSION or ($PHP_VERSION eq '' && $version eq 'default'));
[$pool_name]
user = www