aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/write/network-add
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.gondul.gathering.org>2019-01-03 17:42:03 +0100
committerKristian Lyngstol <kly@kly.gondul.gathering.org>2019-01-03 17:42:03 +0100
commitde584bed994024371f89bce200298139f3615296 (patch)
tree9d06ab4ba5df08739901890f9aef685333db7f69 /web/api/write/network-add
parent27fb87647ee68117f4ea13b470ad31b723bcdc69 (diff)
First step to major cleanup
Fixes #150 Fixe #88 Closes #3 Probably lots of bugs introduced, will fix ASAP.
Diffstat (limited to 'web/api/write/network-add')
-rwxr-xr-xweb/api/write/network-add49
1 files changed, 0 insertions, 49 deletions
diff --git a/web/api/write/network-add b/web/api/write/network-add
deleted file mode 100755
index d1aab4e..0000000
--- a/web/api/write/network-add
+++ /dev/null
@@ -1,49 +0,0 @@
-#! /usr/bin/perl
-# vim:ts=8:sw=8
-
-#use CGI qw(fatalsToBrowser);
-use DBI;
-use lib '/opt/gondul/include';
-use nms;
-use nms::web qw(%get_params %json finalize_output get_input $dbh);
-use nms::util qw(guess_placement);
-use strict;
-use warnings;
-use JSON;
-use Data::Dumper;
-use nms::oplog qw(oplog);
-
-$nms::web::cc{'max-age'} = "0";
-
-my $in = get_input();
-my @tmp = @{JSON::XS::decode_json($in)};
-
-my @added;
-my @dups;
-
-my $sth = $nms::web::dbh->prepare("SELECT name FROM networks WHERE name=?");
-
-foreach my $tmp2 (@tmp) {
- my %network = %{$tmp2};
- my $affected = 0;
- my %template = ();
- if (not defined($network{'name'})) {
- next;
- }
-
- $sth->execute( $network{'name'});
- while ( my @row = $sth->fetchrow_array ) {
- $affected += 1;
- }
-
- if ($affected == 0) {
- $nms::web::dbh->do("INSERT INTO NETWORKS (name) VALUES ('$network{'name'}');");
- push @added, $network{'name'};
- oplog("\"" . $network{'name'} . "\"", "Network added: " . $network{'name'});
- }
-}
-
-$json{'networks_addded'} = \@added;
-
-print "X-ban: /api/.*\n";
-finalize_output();