Skip to content

Commit

Permalink
Item11324: perltidy them all
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@14059 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Feb 23, 2012
1 parent 59e9418 commit 787577d
Show file tree
Hide file tree
Showing 20 changed files with 210 additions and 167 deletions.
1 change: 1 addition & 0 deletions core/lib/Foswiki/Address.pm
Expand Up @@ -259,6 +259,7 @@ sub new {
my $this;

if ( $opts{string} ) {

#ASSERT( not $opts{topic} or ( $opts{webpath} and $opts{topic} ) )
# if DEBUG;

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Checkers/AuthScripts.pm
Expand Up @@ -59,7 +59,7 @@ There are one or more *auth scripts found in $Foswiki::cfg{ScriptDir} that are m
from <tt>{AuthScripts}</tt>. For best security,
any script ending in "auth" should be included in the list of <tt>{AuthScripts}</tt>.
EOF
);
);
}
return $msg;
}
Expand Down
39 changes: 23 additions & 16 deletions core/lib/Foswiki/Configure/Checkers/Htpasswd/FileName.pm
Expand Up @@ -24,22 +24,29 @@ sub check {
Foswiki::Configure::Load::expandValue($f);

unless ( -e $f ) {
# password file does not exist; check it can be created
my $fh;
if (!open($fh, ">", $f) || !close($fh)) {
return $e . $this->ERROR("Password file $f does not exist and could not be created: $!");
} else {
$e .= $this->NOTE("A new password file $f has been created.");
unless (chmod(0600, $f)) {
$e .= $this->WARN("Permissions could not be changed on the new password file $f")
}
}
} elsif ( !( -f $f && -w $f )) {
# password file exists but is not writable
return $e
. $this->ERROR(
"$f is not a writable plain file. "
. "User registration will be disabled until this is corrected.")

# password file does not exist; check it can be created
my $fh;
if ( !open( $fh, ">", $f ) || !close($fh) ) {
return $e
. $this->ERROR(
"Password file $f does not exist and could not be created: $!");
}
else {
$e .= $this->NOTE("A new password file $f has been created.");
unless ( chmod( 0600, $f ) ) {
$e .= $this->WARN(
"Permissions could not be changed on the new password file $f"
);
}
}
}
elsif ( !( -f $f && -w $f ) ) {

# password file exists but is not writable
return $e
. $this->ERROR( "$f is not a writable plain file. "
. "User registration will be disabled until this is corrected." );
}

return $e;
Expand Down
19 changes: 11 additions & 8 deletions core/lib/Foswiki/Configure/Checkers/Htpasswd/LockFileName.pm
Expand Up @@ -24,14 +24,17 @@ sub check {
Foswiki::Configure::Load::expandValue($f);

unless ( -e $f ) {
# lock file does not exist; check it can be created
my $fh;
if (!open($fh, ">", $f) || !close($fh)) {
$e .= $this->ERROR("$f could not be created: $!");
}
} elsif ( ! -f $f || ! -w $f ) {
# lock file exists but is a directory or is not writable
$e .= $this->ERROR( "$f is not a writable plain file. ")

# lock file does not exist; check it can be created
my $fh;
if ( !open( $fh, ">", $f ) || !close($fh) ) {
$e .= $this->ERROR("$f could not be created: $!");
}
}
elsif ( !-f $f || !-w $f ) {

# lock file exists but is a directory or is not writable
$e .= $this->ERROR("$f is not a writable plain file. ");
}
unlink $f;

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Pluggables/LANGUAGES.pm
Expand Up @@ -38,7 +38,7 @@ sub new {
'BOOLEAN',
parent => $this,
keys => '{Languages}{' . $lang . '}{Enabled}',
opts => 'DISPLAY_IF {UserInterfaceInternationalisation}'
opts => 'DISPLAY_IF {UserInterfaceInternationalisation}'
)
);
}
Expand Down
15 changes: 7 additions & 8 deletions core/lib/Foswiki/Configure/UIs/Value.pm
Expand Up @@ -142,14 +142,13 @@ HERE
my %props;
$props{class} = join( ' ', @cssClasses ) if ( scalar @cssClasses );
$props{'data-displayif'} = $displayIf if $displayIf;
$props{'data-enableif'} = $enableIf if $enableIf;

$output .= CGI::Tr(
\%props,
CGI::th( "$index$hiddenTypeOf" )
. CGI::td( "$control&nbsp;$resetToDefaultLinkText$check$helpText" )
. CGI::td( { class => "configureHelp" }, $helpTextLink ) )
. "\n";
$props{'data-enableif'} = $enableIf if $enableIf;

$output .= CGI::Tr( \%props,
CGI::th("$index$hiddenTypeOf")
. CGI::td("$control&nbsp;$resetToDefaultLinkText$check$helpText")
. CGI::td( { class => "configureHelp" }, $helpTextLink ) )
. "\n";

return (
$output,
Expand Down
3 changes: 2 additions & 1 deletion core/lib/Foswiki/Configure/Value.pm
Expand Up @@ -71,7 +71,8 @@ sub new {
$this->{expertsOnly} = 1
if ( $this->{opts} =~ s/(\b|^)EXPERT(\b|$)// );
$this->{displayIf} = $1
if ( $this->{opts} =~ s/(?:\b|^)DISPLAY_IF\s+(.*?)(\/DISPLAY_IF|$)// );
if (
$this->{opts} =~ s/(?:\b|^)DISPLAY_IF\s+(.*?)(\/DISPLAY_IF|$)// );
$this->{enableIf} = $1
if ( $this->{opts} =~ s/(?:\b|^)ENABLE_IF\s+(.*?)(\/ENABLE_IF|$)// );
}
Expand Down
41 changes: 22 additions & 19 deletions core/lib/Foswiki/Form/Checkbox.pm
Expand Up @@ -41,9 +41,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*?[^\\])=(.*)$/ ) {
$str = TAINT($1);
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand All @@ -70,16 +70,17 @@ sub renderForDisplay {

$this->getOptions();

if ($this->isValueMapped()) {
my @vals = ();
foreach my $val (split(/\s*,\s*/, $value)) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
} else {
push @vals, $val;
if ( $this->isValueMapped() ) {
my @vals = ();
foreach my $val ( split( /\s*,\s*/, $value ) ) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
}
else {
push @vals, $val;
}
}
}
$value = join(", ", @vals);
$value = join( ", ", @vals );
}

return $this->SUPER::renderForDisplay( $format, $value, $attrs );
Expand Down Expand Up @@ -122,12 +123,14 @@ sub renderForEdit {
};

if ( $isSelected{$item} ) {
# One or the other; not both, or CGI generates two checked="checked"
if ($this->isValueMapped()) {
$attrs{$item}{checked} = 'checked';
} else {
push( @defaults, $item );
}

# One or the other; not both, or CGI generates two checked="checked"
if ( $this->isValueMapped() ) {
$attrs{$item}{checked} = 'checked';
}
else {
push( @defaults, $item );
}
}
}
my %params = (
Expand All @@ -137,8 +140,8 @@ sub renderForEdit {
-columns => $this->{size},
-attributes => \%attrs
);
if (defined $this->{valueMap}) {
$params{-labels} = $this->{valueMap};
if ( defined $this->{valueMap} ) {
$params{-labels} = $this->{valueMap};
}
$value = CGI::checkbox_group(%params);

Expand Down
12 changes: 6 additions & 6 deletions core/lib/Foswiki/Form/ListFieldDefinition.pm
Expand Up @@ -44,7 +44,7 @@ sub getOptions {

return $this->{_options} if $this->{_options};

my @vals = ();
my @vals = ();
my %descr = ();

@vals = split( /,/, $this->{value} );
Expand Down Expand Up @@ -75,10 +75,10 @@ sub getOptions {
$inBlock = 1;
}
elsif (/^\s*\|\s*([^|]*?)\s*\|(?:\s*([^|]*?)\s*\|)?/) {
if ($inBlock) {
push( @vals, TAINT($1) );
$descr{$1} = $2 if defined $2;
}
if ($inBlock) {
push( @vals, TAINT($1) );
$descr{$1} = $2 if defined $2;
}
}
else {
$inBlock = 0;
Expand All @@ -88,7 +88,7 @@ sub getOptions {
}
@vals = map { $_ =~ s/^\s*(.*)\s*$/$1/; $_; } @vals;

$this->{_options} = \@vals;
$this->{_options} = \@vals;
$this->{_descriptions} = \%descr;

return $this->{_options};
Expand Down
20 changes: 10 additions & 10 deletions core/lib/Foswiki/Form/Radio.pm
Expand Up @@ -44,9 +44,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*?[^\\])=(.*)$/ ) {
$str = TAINT($1);
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand Down Expand Up @@ -89,17 +89,17 @@ sub renderForEdit {
}

my %params = (
-name => $this->{name},
-values => $this->getOptions(),
-default => $selected,
-columns => $this->{size},
-attributes => \%attrs,
-name => $this->{name},
-values => $this->getOptions(),
-default => $selected,
-columns => $this->{size},
-attributes => \%attrs,
);
if (defined $this->{valueMap}) {
$params{-labels} = $this->{valueMap};
if ( defined $this->{valueMap} ) {
$params{-labels} = $this->{valueMap};
}

return ('', CGI::radio_group(%params));
return ( '', CGI::radio_group(%params) );
}

1;
Expand Down
27 changes: 14 additions & 13 deletions core/lib/Foswiki/Form/Select.pm
Expand Up @@ -59,9 +59,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*[^\\])*=(.*)$/ ) {
$str = TAINT( $1 || '' );
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand Down Expand Up @@ -104,16 +104,17 @@ sub renderForDisplay {

$this->getOptions();

if ($this->isValueMapped()) {
my @vals = ();
foreach my $val (split(/\s*,\s*/, $value)) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
} else {
push @vals, $val;
if ( $this->isValueMapped() ) {
my @vals = ();
foreach my $val ( split( /\s*,\s*/, $value ) ) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
}
else {
push @vals, $val;
}
}
}
$value = join(", ", @vals);
$value = join( ", ", @vals );
}

return $this->SUPER::renderForDisplay( $format, $value, $attrs );
Expand All @@ -129,8 +130,8 @@ sub renderForEdit {
my $option = $item;
my %params = ( class => 'foswikiOption', );
$params{selected} = 'selected' if $isSelected{$option};
if ($this->{_descriptions}{$option}) {
$params{title} = $this->{_descriptions}{$option};
if ( $this->{_descriptions}{$option} ) {
$params{title} = $this->{_descriptions}{$option};
}
if ( defined( $this->{valueMap}{$option} ) ) {
$params{value} = $option;
Expand Down
3 changes: 2 additions & 1 deletion core/lib/Foswiki/Func.pm
Expand Up @@ -2504,8 +2504,9 @@ See also: expandVariablesOnTopicCreation
sub expandCommonVariables {
my ( $text, $topic, $web, $meta ) = @_;
ASSERT($Foswiki::Plugins::SESSION) if DEBUG;

#ASSERT(!Foswiki::Func::webExists($topic)) if DEBUG;

( $web, $topic ) = _validateWTA(
$web || $Foswiki::Plugins::SESSION->{webName},
$topic || $Foswiki::Plugins::SESSION->{topicName}
Expand Down

0 comments on commit 787577d

Please sign in to comment.