our @ISA = qw/Exporter/;
our @EXPORT = qw/parseMarkup min max
- alliances intelquery html_escape
- comma_value/;
+ intelquery html_escape
+ comma_value array_expand/;
sub html_escape($) {
return CGI::escapeHTML @_;
return ($x < $y ? $y : $x);
}
-
-sub alliances {
- my ($alliance) = @_;
- my @alliances;
- $alliance = -1 unless defined $alliance;
- push @alliances,{Id => -1, Name => '', Selected => not $alliance};
- my $query = $ND::DBH->prepare(q{SELECT id,name FROM alliances ORDER BY LOWER(name)});
- $query->execute;
- while (my $ally = $query->fetchrow_hashref){
- push @alliances,{Id => $ally->{id}, Name => $ally->{name}, Selected => $alliance == $ally->{id}};
- }
- return @alliances;
-}
-
sub intelquery {
my ($columns,$where) = @_;
return qq{
ORDER BY i.tick DESC, i.mission};
}
+sub array_expand ($) {
+ my ($array) = @_;
+
+ my @arrays;
+ for my $string (@{$array}){
+ $string =~ s/^\((.*)\)$/$1/;
+ $string =~ s/"//g;
+ my @array = split /,/, $string;
+ push @arrays,\@array;
+ }
+ return \@arrays;
+}
+
1;