From c1306df43341135910810919e5ff98113c135ec7 Mon Sep 17 00:00:00 2001 From: Joachim Tingvold Date: Fri, 25 Mar 2016 15:23:47 +0100 Subject: Deleted duplicate /old/-folder (probably when nms.g.o was copied). --- web/nms-public.gathering.org/old/sshow.pl | 258 ------------------------------ 1 file changed, 258 deletions(-) delete mode 100755 web/nms-public.gathering.org/old/sshow.pl (limited to 'web/nms-public.gathering.org/old/sshow.pl') diff --git a/web/nms-public.gathering.org/old/sshow.pl b/web/nms-public.gathering.org/old/sshow.pl deleted file mode 100755 index 64663a2..0000000 --- a/web/nms-public.gathering.org/old/sshow.pl +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/perl -use lib '../../include'; -use nms; - -use warnings; -use strict; -use Switch; -use CGI; -use DBI; -use HTML::Entities; - -# Grab from .htaccess-authentication -my $user = $ENV{'REMOTE_USER'}; - -my $dbh = nms::db_connect(); -$dbh->{AutoCommit} = 0; - -my $sgetdone = $dbh->prepare( -"SELECT * -FROM squeue -WHERE processed = 't' -ORDER BY updated DESC, sysname -LIMIT ?::text::int") - or die "Could not prepare sgetdone"; - -my $sgetdonegid = $dbh->prepare( -"SELECT * -FROM squeue -WHERE processed = 't' AND gid = ?::text::int -ORDER BY updated DESC, sysname") - or die "Could not prepare sgetdonegid"; - -my $slistdonegid = $dbh->prepare( -"SELECT DISTINCT gid, cmd, author, added -FROM squeue -WHERE processed = 't' -ORDER BY gid DESC -LIMIT ?::text::int") - or die "Could not prepare slistdonegid"; - -my $slistprocgid = $dbh->prepare( -"SELECT DISTINCT gid, cmd, author, added -FROM squeue -WHERE processed = 'f' -ORDER BY gid") - or die "Could not prepare slistprocgid"; - -my $sgetgid = $dbh->prepare( -"SELECT * -FROM squeue -WHERE gid = ?") - or die "Could not prepare sgetgid"; - -my $sgetprocessing = $dbh->prepare( -"SELECT * -FROM squeue -WHERE processed = 'f' -ORDER BY updated DESC, gid, sysname") - or die "Could not prepare sgetprocessing"; - -my $sgetnoconnect = $dbh->prepare( -"SELECT * -FROM squeue -WHERE result = 'Could not connect to switch, delaying...'") - or die "Could not prepare sgetnoconnect"; - -my $sdisablegid = $dbh->prepare(" -UPDATE squeue SET disabled = 't' -WHERE gid = ?::text::int") - or die "Could not prepare sdisablegid"; -my $senablegid = $dbh->prepare(" -UPDATE squeue SET disabled = 'f' -WHERE gid = ?::text::int") - or die "Could not prepare sdisablegid"; - - -my $cgi = new CGI; - -print $cgi->header(-type=>'text/html; charset=utf-8'); - -print << "EOF"; - - - Switch managment - - -

Du er logget inn som: $user

-
-

- Vis siste
- Vis: -
-

-
-
-EOF - -my $limit = $cgi->param('count'); -if (!defined($limit)) { - $limit = 10; -} -my $action = $cgi->param('action'); -if (!defined($action)) { - $action = 'listgid'; -} - -if (defined($cgi->param('agid'))) { - my $gid = $cgi->param('gid'); - if (!defined($gid)) { - print "Du har ikke valgt en gid å slette.\n"; - print "

gid: ".$cgi->param('gid')." har blitt disablet.\n"; - } - else { - $senablegid->execute($gid); - print "

gid: ".$cgi->param('gid')." har blitt enablet.\n"; - } - $dbh->commit(); -} - -if ($action eq 'noconnect') { - print "

Kunne ikke koble til disse switchene:

\n"; - $sgetnoconnect->execute(); - print "
\n";
-	while ((my $row = $sgetnoconnect->fetchrow_hashref())) {
-		print "$row->{'sysname'} : $row->{'cmd'} : Added: $row->{'added'} : Updated: $row->{'updated'}\n";
-	}
-	print "
\n"; -} - -if ($action eq 'listgid') { - print "
\n";
-	print "Kunne ikke koble til\n\n\n";
-	print "Ferdige:\n";
-	$slistdonegid->execute($limit);
-	my ($gid, $author);
-	$gid = -1;
-	while ((my $row = $slistdonegid->fetchrow_hashref())) {
-		$author = $row->{author};
-		if ($gid != $row->{gid}) {
-			$gid = $row->{gid};
-			print "GID: $gid\n";
-			print "Author: $author\n";
-			print "Added: ".$row->{added}."\n";
-		}
-		my $cmd = $row->{cmd};
-		print "$cmd\n\n";
-	}
-	print "\n\n";
-	print "I kø:\n";
-	$slistprocgid->execute();
-	$gid = -1;
-	while ((my $row = $slistprocgid->fetchrow_hashref())) {
-		$author = $row->{author};
-		if ($gid != $row->{gid}) {
-			$gid = $row->{gid};
-			print "GID: $gid\n";
-			print "Author: $author\n";
-			print "Added: ".$row->{added}."\n";
-		}
-		my $cmd = $row->{cmd};
-		print "$cmd\n\n";
-	}
-	$dbh->commit();
-	print "
\n"; -} - -if ($action eq 'showgid') { - print "
\n";
-	$sgetgid->execute($cgi->param('gid'));
-	my $row = $sgetgid->fetchrow_hashref();
-	print "GID: ".$row->{gid}."\n";
-	print "Author: ".$row->{author}."\n";
-	do {
-		print "    Name: ".$row->{sysname}." Addr: ".$row->{addr}."\n";
-		print "    `".$row->{cmd}."`\n";
-		print "    Added: ".$row->{added}." executed ".$row->{updated}."\n";
-		my $data = $row->{result};
-		if (!defined($data)) {
-			$data = "Not executed yet!";
-		}
-		my @lines = split(/[\n\r]+/, $data);
-		foreach my $line (@lines) {
-			print "\t", encode_entities($line), "\n";
-		}
-	} while (($row = $sgetgid->fetchrow_hashref()));
-	print "
\n"; -} - -if ($action eq 'done') { - print "

Done

\n"; - print "
\n";
-
-	my $squery;
-	if (defined($cgi->param('gid'))) {
-		my $gid = $cgi->param('gid');
-		$sgetdonegid->execute($gid);
-		$squery = $sgetdonegid;
-	} else {
-		$sgetdone->execute($limit);
-		$squery = $sgetdone;
-	}
-	my $sysname = '';
-	while (my $row = $squery->fetchrow_hashref()) {
-		if ($sysname ne $row->{'sysname'}) {
-			$sysname = $row->{'sysname'};
-			print "$sysname (".$row->{addr}."):\n";
-		}
-		print "   Author: ".$row->{author}."\n";
-		print "   Cmd: ".$row->{cmd}."\n";
-		print "   Added: ".$row->{added}." Updated: ".$row->{updated}."\n";
-		print "   GID: ".$row->{gid}."\n";
-		my @result = split(/[\n\r]+/, $row->{result});
-		foreach (@result) {
-			print "\t", encode_entities($_), "\n";
-		}
-		print "\n";
-	}
-	$dbh->commit();
-	print "
\n"; -} -elsif ($action eq 'processing') { - print "

Processing

\n"; - print "
\n";
-	$sgetprocessing->execute();
-	while (my $row = $sgetprocessing->fetchrow_hashref()) {
-		my $sysname = $row->{'sysname'};
-		print "$sysname (".$row->{addr}."):\n";
-		print "   Author: ".$row->{author}."\n";
-		print "   Cmd: ".$row->{cmd}."\n";
-		my $updated;
-		if (defined($row->{updated})) { $updated = $row->{updated}; }
-		else { $updated = 'never'; }
-		print "   Added: ".$row->{added}." Updated: ".$updated."\n";
-		print "   Disabled: ".$row->{disabled}."\n";
-		print "   Locked: ".$row->{locked}."\n";
-		print "   gID: ".$row->{gid};
-		print "   
"; - print "{gid}."\">"; - print ""; - if ($row->{disabled} == 0) { - print "\n"; - } - else { - print "\n"; - } - } - $dbh->commit(); - print "
\n"; -} - -print << "EOF"; - - -EOF -- cgit v1.2.3