]> ruin.nu Git - ndwebbie.git/blobdiff - lib/NDWeb/Include.pm
Converted editRaid page
[ndwebbie.git] / lib / NDWeb / Include.pm
index 4b94597e79c7857d63e92e6b4fbc3f317dd3d69e..5bea31bec699e2ee55594cd271935118ac824116 100644 (file)
@@ -27,8 +27,8 @@ use CGI qw/:standard/;
 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 @_;
@@ -71,20 +71,6 @@ sub max {
     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{
@@ -97,6 +83,19 @@ GROUP BY i.tick,i.mission,t.x,t.y,t.z,o.x,o.y,o.z,i.amount,i.ingal,u.username,t.
 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;