reduce use of CGI.pm
This commit is contained in:
@@ -322,9 +322,6 @@ sub delete_image {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#print $cgi->header();
|
||||
#print "Content-type:text/html; charset=UTF-8;\n\n";
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
my $dbh = db::connect($config);
|
||||
my $image = {
|
||||
@@ -334,15 +331,11 @@ sub delete_image {
|
||||
};
|
||||
my $result = images::delete( $dbh, $image );
|
||||
|
||||
#print STDERR "delete result=" . Dumper($result);
|
||||
|
||||
return;
|
||||
my $action_result = '';
|
||||
my $errors = '';
|
||||
$result = images::delete_files( $config, $local_media_dir, $params->{delete_image}, $action_result, $errors );
|
||||
|
||||
#use Data::Dumper;print STDERR "delete\n".Dumper($params);
|
||||
print "deleted<br />$action_result<br />$errors\n";
|
||||
#my $action_result = '';
|
||||
#my $errors = '';
|
||||
#$result = images::delete_files( $config, $local_media_dir, $params->{delete_image}, $action_result, $errors );
|
||||
#print "deleted<br />$action_result<br />$errors\n";
|
||||
}
|
||||
|
||||
sub check_permission {
|
||||
|
||||
@@ -61,8 +61,6 @@ if ( defined $r ) {
|
||||
} else {
|
||||
$upload = $apr->upload('image') if ( defined $params->{image} );
|
||||
}
|
||||
|
||||
$cgi = new CGI();
|
||||
} else {
|
||||
|
||||
#CGI fallback
|
||||
@@ -129,7 +127,7 @@ print STDERR "upload error: $params->{error}\n" if $params->{error} ne '';
|
||||
my $out = '';
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
|
||||
print $cgi->cgi_error() if (defined $cgi) && (defined $cgi->cgi_error());
|
||||
print $cgi->cgi_error() if ( defined $cgi ) && ( defined $cgi->cgi_error() );
|
||||
return if $params->{action} eq '';
|
||||
|
||||
$params->{action_result} ||= '';
|
||||
@@ -171,6 +169,7 @@ sub upload_file {
|
||||
my $filename = $result->{filename};
|
||||
|
||||
$result = check_filename($filename);
|
||||
|
||||
#print STDERR $result . "\n";
|
||||
return $result if ( $result->{error} ne '' );
|
||||
|
||||
@@ -179,6 +178,7 @@ sub upload_file {
|
||||
#read file from handle
|
||||
my $data;
|
||||
my $content = '';
|
||||
|
||||
#print STDERR $file . "\n";
|
||||
|
||||
binmode $file;
|
||||
|
||||
Reference in New Issue
Block a user