summaryrefslogtreecommitdiffstats
path: root/cgi/exilog_cgi_param.pm
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/exilog_cgi_param.pm')
-rw-r--r--cgi/exilog_cgi_param.pm80
1 files changed, 80 insertions, 0 deletions
diff --git a/cgi/exilog_cgi_param.pm b/cgi/exilog_cgi_param.pm
new file mode 100644
index 0000000..5948530
--- /dev/null
+++ b/cgi/exilog_cgi_param.pm
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+#
+# This file is part of the exilog suite.
+#
+# http://duncanthrax.net/exilog/
+#
+# (c) Tom Kistner 2004
+#
+# See LICENSE for licensing information.
+#
+
+package exilog_cgi_param;
+use strict;
+use exilog_cgi_html;
+use exilog_config;
+
+use Data::Dumper;
+
+BEGIN {
+ use Exporter;
+ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+ $VERSION = 0.1;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(
+ $param
+ );
+
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = qw();
+
+ use vars qw( $param );
+}
+
+$param = _init_cgi_params();
+
+sub _init_cgi_params {
+ my $param = {};
+
+ foreach ($q->param) {
+ my @test = $q->param($_);
+
+ if ((scalar @test) > 1) {
+ $param->{$_} = \@test;
+ }
+ else {
+ $param->{$_} = $test[0];
+ };
+ };
+
+ # defaults
+ my $defaults = {
+ 'tab' => 'messages',
+ 'qw' => [ 'messages',
+ 'errors',
+ 'deliveries',
+ 'deferrals',
+ 'rejects',
+ 'queue' ],
+ 'q_qw' => [ 'frozen',
+ 'deferred',
+ 'bounce' ],
+ 'ss' => '-all',
+ 'q_ss' => '-all',
+ 'tr' => '-10m',
+ 'q_tr' => '-5m',
+ 'qs' => "",
+ 'q_qs' => "",
+ 'sr' => [ keys %{ $config->{servers} } ],
+ 'q_sr' => [ keys %{ $config->{servers} } ]
+ };
+
+ foreach (keys %{ $defaults }) {
+ $param->{$_} = $defaults->{$_} unless exists($param->{$_});
+ };
+ return $param;
+};
+
+
+1;