From 1a448d0d7c53d25c87d31bd3b175f5b75644f618 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Sun, 21 Feb 2016 18:59:40 +0000 Subject: 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. --- web/nms.gathering.org/comment-change.pl | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'web/nms.gathering.org/comment-change.pl') 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(); -- cgit v1.2.3