diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-02-21 18:59:40 +0000 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-02-21 18:59:40 +0000 |
commit | 1a448d0d7c53d25c87d31bd3b175f5b75644f618 (patch) | |
tree | ac91a62ff0928ede012c0c114eeacdc2f43dbbc8 /web/nms.gathering.org/comment-change.pl | |
parent | 47e4039f8fae192f268a13b08e64424d835edb83 (diff) |
nms: Refactoring work
Moving SNMP into a separate module reduces startup time for all the stuff
that doesn't need it.
Currently comments are broken because the js hasn't been updated.
Diffstat (limited to 'web/nms.gathering.org/comment-change.pl')
-rwxr-xr-x | web/nms.gathering.org/comment-change.pl | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/web/nms.gathering.org/comment-change.pl b/web/nms.gathering.org/comment-change.pl index 13ed058..d860777 100755 --- a/web/nms.gathering.org/comment-change.pl +++ b/web/nms.gathering.org/comment-change.pl @@ -1,24 +1,20 @@ #! /usr/bin/perl -use CGI qw(fatalsToBrowser); -use DBI; +# vim:ts=8:sw=8 use lib '../../include'; use utf8; use nms; +use nms::web; use strict; use warnings; -use Data::Dumper; -my $cgi = CGI->new; +my $id = db_safe_quote('comment'); +my $state = db_safe_quote('state'); -my $dbh = nms::db_connect(); - -my $id = $dbh->quote($cgi->param('comment') || die ); -my $state= $dbh->quote($cgi->param('state') || die); - - -my $q = $dbh->prepare("UPDATE switch_comments SET state = " . $state . " WHERE id = " . $id . ";"); +my $q = $nms::web::dbh->prepare("UPDATE switch_comments SET state = " . $state . " WHERE id = " . $id . ";"); $q->execute(); -print $cgi->header(-type=>'text/json; charset=utf-8'); -print "{ 'state': 'ok' }"; +$nms::web::cc{'max-age'} = '0'; +$nms::web::cc{'stale-while-revalidate'} = '0'; +$nms::web::json{'state'} = 'ok'; +finalize_output(); |