diff -Nur smeserver-dansguardian-panel-2.11-old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/dungogdansguardian.pm smeserver-dansguardian-panel-2.11/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/dungogdansguardian.pm
--- smeserver-dansguardian-panel-2.11-old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/dungogdansguardian.pm 2009-03-13 22:23:20.000000000 -0400
+++ smeserver-dansguardian-panel-2.11/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/dungogdansguardian.pm 1969-12-31 19:00:00.000000000 -0500
@@ -1,1236 +0,0 @@
-#----------------------------------------------------------------------
-# dungogdansguardian.pm
-# support@dungog.net
-#----------------------------------------------------------------------
-
-package esmith::FormMagick::Panel::dungogdansguardian;
-
-use strict;
-use warnings;
-
-use esmith::FormMagick;
-use esmith::ConfigDB;
-use esmith::AccountsDB;
-use esmith::cgi;
-
-use Exporter;
-use Carp qw(verbose);
-
-use HTML::Tabulate;
-
-our @ISA = qw(esmith::FormMagick Exporter);
-
-our @EXPORT = qw();
-
-our $db = esmith::ConfigDB->open();
-our $adb = esmith::AccountsDB->open();
-our $ddb = esmith::ConfigDB->open('dungog') or die "Could not open dungog DB\n";
-our $bdb = esmith::ConfigDB->open('blacklist') or die "Could not open blacklist DB\n";
-our $pdb = esmith::ConfigDB->open('phraselist') or die "Could not open phraselist DB\n";
-
-
-sub new {
- shift;
- my $self = esmith::FormMagick->new();
- $self->{calling_package} = (caller)[0];
- bless $self;
- return $self;
-}
-
-sub get_loglevel
-{
- return $ddb->get_prop('dansguardian', 'loglevel');
-}
-sub get_logfileformat
-{
- return $ddb->get_prop('dansguardian', 'logfileformat');
-}
-sub get_proxyaccess
-{
- return $db->get_prop('squid', 'RequireAuth');
-}
-sub get_portblocking
-{
- return $db->get_prop('dansguardian', 'portblocking');
-}
-sub get_port
-{
- return $ddb->get_prop('dansguardian', 'port');
-}
-sub get_status
-{
- return $db->get_prop('dansguardian', 'status');
-}
-sub get_bypassproxyto
-{
- return $db->get_prop('squid', 'BypassProxyTo');
-}
-sub get_bypassproxyfrom
-{
- return $db->get_prop('squid', 'BypassProxyFrom');
-}
-sub get_TCPBlocks
-{
- return $db->get_prop('masq', 'TCPBlocks');
-}
-sub get_UDPBlocks
-{
- return $db->get_prop('masq', 'UDPBlocks');
-}
-sub get_mode
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'mode');
-}
-sub get_bypass
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'bypass');
-}
-sub get_reportinglevel
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'reportinglevel');
-}
-sub get_deniedpage
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'deniedpage');
-}
-sub get_deniedurl
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'deniedurl');
-}
-sub get_scan
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'scan');
-}
-sub get_weight
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'weight');
-}
-sub get_pics
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g' ||'');
- return $ddb->get_prop("dansguardian$g", 'pics');
-}
-sub get_regexpurl
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'regexpurl');
-}
-sub get_regexpsearch
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'regexpsearch');
-}
-sub get_regexpurlads
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'regexpurlads');
-}
-sub get_regexpurlproxy
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'regexpurlproxy');
-}
-sub get_blanketban
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'blanketban');
-}
-sub get_ipban
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'ipban');
-}
-sub get_https
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'https');
-}
-sub get_file
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- return $ddb->get_prop("dansguardian$g", 'file');
-}
-sub get_criterion
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $key = $q->param('key') ||'';
- return $ddb->get_prop($key, 'criterion') || '';
-}
-
-sub get_status_summary
-{
- my $self = shift;
- my $q = $self->{cgi};
-
- my $status = $db->get_prop('dansguardian', "status");
- my $Auth = $db->get_prop('squid', "RequireAuth");
- my $port = $ddb->get_prop('dansguardian', "port");
- my $block = $db->get_prop('dansguardian', "portblocking");
-
- my $STATUS = $self->localise('STATUS');
- my $PORT = $self->localise('PORT');
- my $PROXYACCESS = $self->localise('PROXYACCESS');
- my $BLOCKING = $self->localise('PORTBLOCKING');
-
- my $status2;
- if ($status eq 'enabled')
- { $status2 = $self->localise('ENABLED'); } else { $status2 = $self->localise('DISABLED'); }
-
- my $block2;
- if ($block eq 'yes')
- { $block2 = $self->localise('ENABLED'); } else { $block2 = $self->localise('DISABLED'); }
-
- return "$STATUS : $status2, $PORT : $port, $PROXYACCESS : $Auth, $BLOCKING : $block2";
-}
-
-sub get_custom_denied
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') ||'';
- my $Ldefault = $self->localise('Ldefault');
-
- my $defaults = $ddb->get_prop("dansguardian", "deniedurl") || 'dansguardian.pl';
-
- my $deniedurl = $ddb->get_prop("dansguardian$g", "deniedurl") || 'nul';
- if (($deniedurl eq 'nul') && (-e "/home/e-smith/files/ibays/Primary/cgi-bin/dansguardian$g.pl"))
- { $deniedurl = "dansguardian$g.pl"; }
-
- my $language = $ddb->get_prop('dansguardian', "language") || 'ukenglish';
- my $customhtml = 'nul';
- if (-e "/etc/dansguardian/languages/$language/template$g.html")
- { $customhtml = "$language/template$g.html"; }
-
- return "$Ldefault = $defaults, html = $customhtml, cgi = $deniedurl";
-}
-
-sub print_global_table
-{
- my $self = shift;
- my $q = $self->{cgi};
-
- my $description = $self->localise('DESCRIPTION');
- my $Lf2 = $self->localise('Lf2');
- my $Lf3 = $self->localise('Lf3');
- my $Lf4 = $self->localise('Lf4');
- my $Lf5 = $self->localise('Lf5');
-
- my @groups = $adb->get_all_by_prop(type => "group");
- my @gnames = '';
- foreach my $g (@groups)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
- print $q->Tr (
- esmith::cgi::genSmallCell($q, $description,"header"),
- esmith::cgi::genSmallCell($q, '',"header")),"\n";
-
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf2),
- esmith::cgi::genSmallCell ($q,
- $q->popup_menu (-name => "f2",
- -values => [ sort @gnames ],
- -default => $ddb->get_prop('dansguardian', "f2") || '')));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf3),
- esmith::cgi::genSmallCell ($q,
- $q->popup_menu (-name => "f3",
- -values => [ sort @gnames ],
- -default => $ddb->get_prop('dansguardian', "f3") || '')));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf4),
- esmith::cgi::genSmallCell ($q,
- $q->popup_menu (-name => "f4",
- -values => [ sort @gnames ],
- -default => $ddb->get_prop('dansguardian', "f4") || '')));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf5),
- esmith::cgi::genSmallCell ($q,
- $q->popup_menu (-name => "f5",
- -values => [ sort @gnames ],
- -default => $ddb->get_prop('dansguardian', "f5") || '')));
-
- print $q->end_table;
-
- return "";
-}
-
-sub print_summary
-{
- my $self = shift;
- my $q = $self->{cgi};
-
- my $description = $self->localise('DESCRIPTION');
- my $LAllow = $self->localise('LAllow');
- my $LClient_IP = $self->localise('LClient_IP');
- my $LDeny = $self->localise('LDeny');
- my $modify = $self->localise('MODIFY');
- my $Lcommon = $self->localise('Lcommon');
- my $Ldefault = $self->localise('Ldefault');
- my $Lf0 = $self->localise('Lf0');
- my $Lf1 = $self->localise('Lf1');
- my $Lf2 = $self->localise('Lf2');
- my $Lf3 = $self->localise('Lf3');
- my $Lf4 = $self->localise('Lf4');
- my $Lf5 = $self->localise('Lf5');
- my $GROUP = $self->localise('GROUP');
- my $Lmode = $self->localise('Lmode');
- my $LURLban = $self->localise('LURLban');
- my $Lscan = $self->localise('Lscan');
- my $Lbypass = $self->localise('Lbypass');
- my $Llists = $self->localise('Llists');
- my $Lsettings = $self->localise('Lsettings');
-
- my @groups = $adb->get_all_by_prop(type => "group");
- my @gnames = '';
- foreach my $g (@groups)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
- print $q->Tr (
- esmith::cgi::genSmallCell($q, $description,"header"),
- esmith::cgi::genSmallCell($q, $GROUP,"header"),
- esmith::cgi::genSmallCell($q, $Lmode,"header"),
- esmith::cgi::genSmallCell($q, $LURLban,"header"),
- esmith::cgi::genSmallCell($q, $Lscan,"header"),
- esmith::cgi::genSmallCell($q, $Lbypass,"header"),
- esmith::cgi::genSmallCell($q, $Lsettings,"header"),
- esmith::cgi::genSmallCell($q, $Llists,"header")),"\n";
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf0),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f0&gname=$Lcommon&wherenext=GroupLists"}, $modify)));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf1),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "mode") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "blanketban") . " / " .
- $ddb->get_prop('dansguardianf1', "https") . " / " .
- $ddb->get_prop('dansguardianf1', "ipban") . " / " .
- $ddb->get_prop('dansguardianf1', "file") . " - " .
- $ddb->get_prop('dansguardianf1', "regexpurl") . " / " .
- $ddb->get_prop('dansguardianf1', "regexpurlads") . " / " .
- $ddb->get_prop('dansguardianf1', "regexpurlproxy")),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "scan") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "bypass") || ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f1&gname=$Ldefault&wherenext=GroupSettings"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f1&gname=$Ldefault&wherenext=GroupLists"}, $modify)));
-
- my $gname = $ddb->get_prop('dansguardian', "f2");
- if ($gname) {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf2),
- esmith::cgi::genSmallCell ($q, $gname ),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "mode") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "blanketban") . " / " .
- $ddb->get_prop('dansguardianf2', "https") . " / " .
- $ddb->get_prop('dansguardianf2', "ipban") . " / " .
- $ddb->get_prop('dansguardianf2', "file") . " - " .
- $ddb->get_prop('dansguardianf2', "regexpurl") . " / " .
- $ddb->get_prop('dansguardianf2', "regexpurlads") . " / " .
- $ddb->get_prop('dansguardianf2', "regexpurlproxy")),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "scan") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "bypass") || ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f2&gname=$gname&wherenext=GroupSettings"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f2&gname=$gname&wherenext=GroupLists"}, $modify)));
- }
-
- $gname = $ddb->get_prop('dansguardian', "f3");
- if ($gname) {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf3),
- esmith::cgi::genSmallCell ($q, $gname ),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "mode") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "blanketban") . " / " .
- $ddb->get_prop('dansguardianf3', "https") . " / " .
- $ddb->get_prop('dansguardianf3', "ipban") . " / " .
- $ddb->get_prop('dansguardianf3', "file") . " - " .
- $ddb->get_prop('dansguardianf3', "regexpurl") . " / " .
- $ddb->get_prop('dansguardianf3', "regexpurlads") . " / " .
- $ddb->get_prop('dansguardianf3', "regexpurlproxy")),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "scan") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "bypass") || ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f3&gname=$gname&wherenext=GroupSettings"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f3&gname=$gname&wherenext=GroupLists"}, $modify)));
- }
-
- $gname = $ddb->get_prop('dansguardian', "f4");
- if ($gname) {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf4),
- esmith::cgi::genSmallCell ($q, $gname ),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "mode") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "blanketban") . " / " .
- $ddb->get_prop('dansguardianf4', "https") . " / " .
- $ddb->get_prop('dansguardianf4', "ipban") . " / " .
- $ddb->get_prop('dansguardianf4', "file") . " - " .
- $ddb->get_prop('dansguardianf4', "regexpurl") . " / " .
- $ddb->get_prop('dansguardianf4', "regexpurlads") . " / " .
- $ddb->get_prop('dansguardianf4', "regexpurlproxy")),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "scan") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "bypass") || ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f4&gname=$gname&wherenext=GroupSettings"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f4&gname=$gname&wherenext=GroupLists"}, $modify)));
- }
-
- $gname = $ddb->get_prop('dansguardian', "f5");
- if ($gname) {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf5),
- esmith::cgi::genSmallCell ($q, $gname ),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "mode") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "blanketban") . " / " .
- $ddb->get_prop('dansguardianf5', "https") . " / " .
- $ddb->get_prop('dansguardianf5', "ipban") . " / " .
- $ddb->get_prop('dansguardianf5', "file") . " - " .
- $ddb->get_prop('dansguardianf5', "regexpurl") . " / " .
- $ddb->get_prop('dansguardianf5', "regexpurlads") . " / " .
- $ddb->get_prop('dansguardianf5', "regexpurlproxy")),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "scan") || ''),
- esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "bypass") || ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f5&gname=$gname&wherenext=GroupSettings"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f5&gname=$gname&wherenext=GroupLists"}, $modify)));
- }
-
- print $q->end_table;
-
- return "";
-}
-
-sub save_reload
-{
- my $self = shift;
- my $q = $self->{cgi};
-
- foreach ('loglevel','logfileformat','f2','f3','f4','f5','deniedurl')
- { $ddb->set_prop('dansguardian', "$_", $q->param("$_")); }
-
- unless ( system ("/sbin/e-smith/signal-event", "dansguardian-reload") == 0 )
- { return $self->error('ERROR'); }
-
- return $self->success("SUCCESS");
-}
-
-sub save_group_settings
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
-
- foreach ('mode','bypass','reportinglevel','scan','weight','pics','deniedpage','deniedurl',
- 'regexpurl','regexpsearch','regexpurlads','regexpurlproxy','blanketban','https','ipban','file')
- { $ddb->set_prop("dansguardian$g", "$_", $q->param("$_")); }
-
- unless ( system ("/sbin/e-smith/signal-event", "dansguardian-reload") == 0 )
- { return $self->error('ERROR'); }
-
- return $self->success("SUCCESS");
-}
-
-sub save_proxy
-{
- my $self = shift;
- my $q = $self->{cgi} ||'';
-
- my $status = $q->param ('status') || '';
- my $proxyaccess = $q->param ('proxyaccess') || '';
- my $portblocking = $q->param ('portblocking') || '';
- my $port = $q->param ('port') || '';
-
- $db->set_prop('squid', "RequireAuth", $proxyaccess);
- $ddb->set_prop('dansguardian', "port", $port);
-
- my $bypassproxyfrom = $q->param ('bypassproxyfrom') || '';
- my $bypassproxyto = $q->param ('bypassproxyto') || '';
- my $TCPBlocks = $q->param ('TCPBlocks') || '';
- my $UDPBlocks = $q->param ('UDPBlocks') || '';
-
- $db->set_prop('squid', "BypassProxyFrom", $bypassproxyfrom);
- $db->set_prop('squid', "BypassProxyTo", $bypassproxyto);
- $db->set_prop('masq', "UDPBlocks", $UDPBlocks);
- $db->set_prop('masq', "TCPBlocks", $TCPBlocks);
-
- if ($status eq 'disabled')
- {
- $db->set_prop('squid', "TransparentPort", '3128');
- $db->set_prop('dansguardian', "status", 'disabled');
- $db->set_prop('dansguardian', "portblocking", 'no');
-
- unless ( system ("/sbin/e-smith/signal-event", "dansguardian-save") == 0 )
- { return $self->error('ERROR'); }
-
- return $self->success("SUCCESS_STOP");
- }
- else
- {
- $db->set_prop('squid', "TransparentPort", $port);
- $db->set_prop('dansguardian', "status", 'enabled');
- $db->set_prop('dansguardian', "portblocking", $portblocking);
- }
-
- unless ( system ("/sbin/e-smith/signal-event", "dansguardian-save") == 0 )
- { return $self->error('ERROR'); }
-
- return $self->success("SUCCESS_PROMPT");
-}
-
-sub portentry
-{
- my ($fm, $port) = @_;
- if (not $port)
- {
- return "FM_NONBLANK";
- }
- elsif ($port =~ /^(\d{4})$/)
- {
- return "OK";
- }
- else
- {
- return "ERROR_PORT";
- }
-}
-
-sub print_list_table
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param('g') || '';
- my $gname = $q->param('gname') || '';
-
- my $description = $self->localise('DESCRIPTION');
- my $Lasite = $self->localise('Lasite');
- my $Laurl = $self->localise('Laurl');
- my $Lphrases = $self->localise('Lphrases');
- my $Lregexp = $self->localise('Lregexp');
- my $Lfileext = $self->localise('Lfileext');
- my $Lmimetype = $self->localise('Lmimetype');
- my $ALLlists = $self->localise('LALLlists');
- my $ENABLED = $self->localise('ENABLED');
-
- my $Lgrey = $self->localise('Lgrey');
- my $Lweighted = $self->localise('Lweighted');
- my $Lmodifyurl = $self->localise('Lmodifyurl');
- my $LAllow = $self->localise('LAllow');
- my $LDeny = $self->localise('LDeny');
- my $LAVexcept = $self->localise('LAVexcept');
- my $Lexception = $self->localise('Lexception');
- my $Lblacklist = $self->localise('Lblacklist');
- my $Lphraselist = $self->localise('Lphraselist');
- my $Lrepcon = $self->localise('Lrepcon');
- my $Lallowurl = $self->localise('Lallowurl');
- my $Lallowsite = $self->localise('Lallowsite');
- my $LClientIP = $self->localise('LClientIP');
- my $Lcommon = $self->localise('Lcommon');
- my $Commonlists = $self->localise('LCommonlists');
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
- print $q->Tr (
- esmith::cgi::genSmallCell($q, $description,"header"),
- esmith::cgi::genSmallCell($q, $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ShowAllLists"}, $ALLlists),"header"),
- esmith::cgi::genSmallCell($q, '',"header"),
- esmith::cgi::genSmallCell($q, '',"header"),
- esmith::cgi::genSmallCell($q, '',"header"),
- esmith::cgi::genSmallCell($q, $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ShowCommonLists"}, $Commonlists),"header"));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lasite),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=greysitelist$g&wherenext=ViewList"}, $Lgrey)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionsitelist$g&wherenext=ViewList"}, $LAllow)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedsitelist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q,''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f0&list=exceptionvirussitelist&wherenext=ViewList"}, $LAVexcept)));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Laurl),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=greyurllist$g&wherenext=ViewList"}, $Lgrey)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionurllist$g&wherenext=ViewList"}, $LAllow)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedurllist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q,''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f0&list=exceptionvirusurllist&wherenext=ViewList"}, $LAVexcept)));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lphrases),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=weightedphraselist$g&wherenext=ViewList"}, $Lweighted)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionphraselist$g&wherenext=ViewList"}, $LAllow)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedphraselist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,''));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lregexp),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=urlregexplist$g&wherenext=ViewList"}, $Lmodifyurl)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionregexpurllist$g&wherenext=ViewList"}, $LAllow)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedregexpurllist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=contentregexplist$g&wherenext=ViewList"}, $Lrepcon)),
- esmith::cgi::genSmallCell ($q, ''));
-
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lfileext),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionextensionlist$g&wherenext=ViewList"}, $Lexception)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedextensionlist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionfileurllist$g&wherenext=ViewList"}, $Lallowurl)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f0&list=exceptionvirusextensionlist&wherenext=ViewList"}, $LAVexcept)));
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $Lmimetype),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionmimetypelist$g&wherenext=ViewList"}, $Lexception)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannedmimetypelist$g&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptionfilesitelist$g&wherenext=ViewList"}, $Lallowsite)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=f0&list=exceptionvirusmimetypelist&wherenext=ViewList"}, $LAVexcept)));
-
- #Client IP
- if ($g eq 'f0')
- {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $LClientIP),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=exceptioniplist&wherenext=ViewList"}, $Lexception)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=bannediplist&wherenext=ViewList"}, $LDeny)),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''));
- }
-
- #prepared lists
- unless ($g eq 'f0')
- {
- print $q->Tr (esmith::cgi::genSmallCell ($q, $ENABLED),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ViewPhraseList"}, $Lphraselist)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ViewBlackList"}, $Lblacklist)),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''));
- }
-
- print $q->end_table;
- return "";
-}
-
-sub print_list_description
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
- my $desc = $self->localise('MODIFY_LIST_SETTINGS');
-
- if ($g eq 'f0')
- {
- $desc = $self->localise('MODIFY_GLOBAL_LIST_SETTINGS');
- }
-
- return "$desc";
-}
-
-sub print_record_table
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
- my $list = $q->param('list') ||'';
-
- my $record = $self->localise('RECORD');
- my $modify = $self->localise('MODIFY');
- my $remove = $self->localise('REMOVE');
- my $new = $self->localise('NEW');
-
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
- print $q->Tr (
- esmith::cgi::genSmallCell($q, $record,"header"),
- esmith::cgi::genSmallCell($q, '',"header"),
- esmith::cgi::genSmallCell($q, '',"header")),"\n";
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q, ''),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=$list&key=new&wherenext=Edit"}, $new)));
-
- foreach my $hash ($ddb->get_all_by_prop(type => $list))
- {
- my $key = $hash->key;
- my $criterion = $hash->prop("criterion") || '';
-
- #allows for three sets of bracketed words
- #$record =~ s/<\;/g; ??
- #$record =~ s/>/>\;/g;
- $criterion =~ s/<\;/;
- $criterion =~ s/>/>\;/;
- $criterion =~ s/<\;/;
- $criterion =~ s/>/>\;/;
- $criterion =~ s/<\;/;
- $criterion =~ s/>/>\;/;
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $criterion),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&list=$list&key=$key&wherenext=Edit"}, $modify)),
- esmith::cgi::genSmallCell ($q,
- $q->a ({href => $q->url (-absolute => 1)
- . "?page=0&page_stack=&g=$g&criterion=$criterion&key=$key&wherenext=Delete"}, $remove)));
- }
-
- print $q->end_table;
-
- return "";
-}
-
-sub print_all_lists
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
- my $all = ();
-
- if ($g =~ /^(f\d{1})$/)
- {
- $g = $1;
- }
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
-
- $all .= "\n";
-
- my @files = ('bannedextensionlist','bannedsitelist','exceptionfilesitelist','exceptionregexpurllist',
- 'greysitelist','weightedphraselist','bannedmimetypelist','bannedurllist','exceptionfileurllist',
- 'exceptionsitelist','greyurllist','bannedphraselist','contentregexplist','exceptionmimetypelist','exceptionurllist','pics',
- 'bannedregexpurllist','exceptionextensionlist','exceptionphraselist','greyregexpurllist','urlregexplist');
-
- foreach (@files)
- {
-
- if ( -e "/etc/dansguardian/lists/$g/$_" )
- {
- open (INF,"/etc/dansguardian/lists/$g/$_")
- or die ("can't open /etc/dansguardian/lists/$g/$_ to read. ");
-
- $all .= "
\n";
- $all .= " /etc/dansguardian/lists/$g/$_
\n";
-
- while ()
- {
- # allow for 4 sets
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
-
- $all .= "$_
\n";
- }
- close INF;
- }
- }
-
- $all .= "<\code>\n";
-
- print $q->end_table;
-
- return "$all";
-}
-
-sub print_common_lists
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
- my $all = ();
-
- if ($g =~ /^(f\d{1})$/)
- {
- $g = $1;
- }
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
-
- $all .= "\n";
-
- my @files = ('exceptioniplist','bannediplist','contentscanners/exceptionvirusextensionlist',
- 'contentscanners/exceptionvirusmimetypelist','contentscanners/exceptionvirussitelist','contentscanners/exceptionvirusurllist');
-
- foreach (@files)
- {
-
- if ( -e "/etc/dansguardian/lists/$_" )
- {
- open (INF,"/etc/dansguardian/lists/$_")
- or die ("can't open /etc/dansguardian/lists/$_ to read. ");
-
- $all .= "
\n";
- $all .= " /etc/dansguardian/lists/$_
\n";
-
- while ()
- {
- # allow for 4 sets
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
-
- $all .= "$_
\n";
- }
- close INF;
- }
- }
-
- $all .= "<\code>\n";
-
- print $q->end_table;
-
- return "$all";
-}
-
-sub print_phraselist_head
-{
- my $self = shift;
- my $q = $self->{cgi} ||'';
- my $all = ();
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
-
- $all .= "\n";
-
- system ("/usr/bin/head /etc/dansguardian/lists/phraselists/*/* > /tmp/lists") == 0
- or die ("Error occurred reading phraselists\n");
-
- if ( -e "/tmp/lists" )
- {
- open (INF,"/tmp/lists")
- or die ("can't open /tmp/lists read. ");
-
- $all .= "
head /etc/dansguardian/lists/phraselists/*
\n";
-
- while ()
- {
- # allow for 4 sets
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
-
- $all .= "$_
\n";
- }
- close INF;
- }
-
- $all .= "<\code>\n";
- print $q->end_table;
- return "$all";
-}
-sub print_blacklist_head
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $all = ();
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
-
- $all .= "\n";
-
- system ("/usr/bin/head /etc/dansguardian/blacklists/*/* > /tmp/lists") == 0
- or die ("Error occurred reading phraselists\n");
-
- if ( -e "/tmp/lists" )
- {
- open (INF,"/tmp/lists")
- or die ("can't open /tmp/lists read. ");
-
- $all .= "
head /etc/dansguardian/blacklists/*
\n";
-
- while ()
- {
- # allow for 4 sets
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
- $_ =~ s/<\;/;
- $_ =~ s/>/>\;/;
-
- $all .= "$_
\n";
- }
- close INF;
- }
-
- $all .= "<\code>\n";
- print $q->end_table;
- return "$all";
-}
-
-sub save_record
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
- my $key = $q->param ('key') ||'';
- my $list = $q->param ('list') ||'';
- my $criterion = $q->param ('criterion');
-
- if ($key eq 'new')
- {
- my $random = int(rand(999999));
- $key = $list.$random;
- $ddb->new_record($key, { type => "$list" });
- }
- $ddb->set_prop($key, 'criterion', $criterion);
-
- return $self->success("SUCCESS_STORED");
-}
-sub delete_record
-{
- my $self = shift;
- my $q = $self->{cgi} ||'';
- my $key = $q->param('key') ||'';
-
- my $rec = $ddb->get($key);
- $rec->delete;
-
- return $self->success("SUCCESS_STORED");
-}
-
-sub print_phraselist_table
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
-
- my $Llist = $self->localise('LIST');
-
- my @lists = $pdb->get_all_by_prop(type => "list");
- my @gnames = '';
- foreach my $g (@lists)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- my @installed = ('badwords','googlesearches');
- foreach (@gnames)
- {
- push (@installed, $_)
- if (-e "/etc/dansguardian/lists/phraselists/$_/weighted");
- }
-
- #hide table if you have no rules
- my $installed = @installed || 'no lists';
- if ($installed eq 'no lists')
- {
- return "$self->localise('ERROR');"
- }
- else
- {
-
- print $q->start_table({-CLASS => "sme-border"}),"\n";
-
- print $q->Tr ( esmith::cgi::genSmallCell($q, $Llist,"header"),
- esmith::cgi::genSmallCell($q, '',"header")),"\n";
-
- #checkboxes
- my ($a, $aa) = '';
- foreach (sort @installed)
- {
- $a = $_;
- $aa = $pdb->get_prop($_, $g) || '';
- if ($aa eq 'on') { $aa = "checked"; }
-
- print $q->Tr (esmith::cgi::genSmallCell ($q, $_),
- esmith::cgi::genSmallCell ($q, ("")));
- }
- }
-
- print $q->end_table;
-
- return "";
-}
-sub save_phrase
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
-
- my @lists = $pdb->get_all_by_prop(type => "list");
- my @gnames = '';
- foreach my $g (@lists)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- my @installed = ();
- foreach (@gnames)
- {
- push (@installed, $_)
- if (-e "/etc/dansguardian/lists/phraselists/$_/weighted");
- }
-
- #skip if you have nothing
- my $installed = @installed || 'no lists';
- unless ($installed eq 'no lists')
- {
- #from checkboxes
- my ($a, $aa) = '';
- foreach (@installed)
- {
- my $a = $_;
- my $aa = $q->param ($a) || '';
- $pdb->set_prop($_, $g, $aa);
- }
- }
-
- return $self->success("SUCCESS_STORED");
-}
-
-
-sub print_blacklist_table
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
-
- my $Llist = $self->localise('LIST');
- my $LWhite = $self->localise('LWhite');
- my $LGrey = $self->localise('Lgrey');
- my $LBlack = $self->localise('LBlack');
-
- my @lists = $bdb->get_all_by_prop(type => "list");
- my @gnames = '';
- foreach my $g (@lists)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- my @installed = ();
- foreach (@gnames)
- {
- push (@installed, $_)
- if (-e "/etc/dansguardian/blacklists/$_/domains");
- }
-
- #hide table if you have no rules
- my $installed = @installed || 'no lists';
- if ($installed eq 'no lists')
- {
- return "$self->localise('NO_BLACK');"
- }
- else
- {
- print $q->start_table({-CLASS => "sme-border"}),"\n";
- print $q->Tr (
- esmith::cgi::genSmallCell($q, $Llist,"header"),
- esmith::cgi::genSmallCell($q, $LWhite,"header"),
- esmith::cgi::genSmallCell($q, $LGrey,"header"),
- esmith::cgi::genSmallCell($q, $LBlack,"header")),"\n";
-
- #checkboxes
- my ($a, $b, $c, $aa, $bb, $cc) = '';
- foreach (sort @installed)
- {
- $a = $_.'white';
- $aa = $bdb->get_prop($_, "white$g") || '';
- if ($aa eq 'on') { $aa = "checked"; }
-
- my $b = $_.'grey';
- $bb = $bdb->get_prop($_, "grey$g") || '';
- if ($bb eq 'on') { $bb = "checked"; }
-
- my $c = $_.'black';
- $cc= $bdb->get_prop($_, "black$g") || '';
- if ($cc eq 'on') { $cc = "checked"; }
-
- #todo
- my $listname = $self->localise($_);
-
- print $q->Tr
- (esmith::cgi::genSmallCell ($q, $listname),
- esmith::cgi::genSmallCell ($q, ("")),
- esmith::cgi::genSmallCell ($q, ("")),
- esmith::cgi::genSmallCell ($q, ("")));
- }
- }
-
- print $q->end_table;
-
- return "";
-}
-sub save_black
-{
- my $self = shift;
- my $q = $self->{cgi};
- my $g = $q->param ('g') ||'';
-
- my @lists = $bdb->get_all_by_prop(type => "list");
- my @gnames = '';
- foreach my $g (@lists)
- {
- my $groupname = $g->key();
- push (@gnames, $groupname)
- }
-
- my @installed = ();
- foreach (@gnames)
- {
- push (@installed, $_)
- if (-e "/etc/dansguardian/blacklists/$_/domains");
- }
-
- #skip if you have nothing
- my $installed = @installed || 'no lists';
- unless ($installed eq 'no lists')
- {
- #from checkboxes
- my ($a, $b, $c, $aa, $bb, $cc,) = '';
- foreach (@installed)
- {
- my $a = $_.'white';
- my $aa = $q->param ("$a") || '';
- $bdb->set_prop($_, "white$g", $aa);
-
- my $b = $_.'grey';
- my $bb = $q->param ("$b") || '';
- $bdb->set_prop($_, "grey$g", $bb);
-
- my $c = $_.'black';
- my $cc = $q->param ("$c") || '';
- $bdb->set_prop($_, "black$g", $cc);
- }
- }
-
- return $self->success("SUCCESS_STORED");
-}
-
-1;
diff -Nur smeserver-dansguardian-panel-2.11-old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/dungogdansguardian.pm smeserver-dansguardian-panel-2.11/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/dungogdansguardian.pm
--- smeserver-dansguardian-panel-2.11-old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/dungogdansguardian.pm 1969-12-31 19:00:00.000000000 -0500
+++ smeserver-dansguardian-panel-2.11/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/dungogdansguardian.pm 2009-03-13 22:23:20.000000000 -0400
@@ -0,0 +1,1236 @@
+#----------------------------------------------------------------------
+# dungogdansguardian.pm
+# support@dungog.net
+#----------------------------------------------------------------------
+
+package esmith::FormMagick::Panel::dungogdansguardian;
+
+use strict;
+use warnings;
+
+use esmith::FormMagick;
+use esmith::ConfigDB;
+use esmith::AccountsDB;
+use esmith::cgi;
+
+use Exporter;
+use Carp qw(verbose);
+
+use HTML::Tabulate;
+
+our @ISA = qw(esmith::FormMagick Exporter);
+
+our @EXPORT = qw();
+
+our $db = esmith::ConfigDB->open();
+our $adb = esmith::AccountsDB->open();
+our $ddb = esmith::ConfigDB->open('dungog') or die "Could not open dungog DB\n";
+our $bdb = esmith::ConfigDB->open('blacklist') or die "Could not open blacklist DB\n";
+our $pdb = esmith::ConfigDB->open('phraselist') or die "Could not open phraselist DB\n";
+
+
+sub new {
+ shift;
+ my $self = esmith::FormMagick->new();
+ $self->{calling_package} = (caller)[0];
+ bless $self;
+ return $self;
+}
+
+sub get_loglevel
+{
+ return $ddb->get_prop('dansguardian', 'loglevel');
+}
+sub get_logfileformat
+{
+ return $ddb->get_prop('dansguardian', 'logfileformat');
+}
+sub get_proxyaccess
+{
+ return $db->get_prop('squid', 'RequireAuth');
+}
+sub get_portblocking
+{
+ return $db->get_prop('dansguardian', 'portblocking');
+}
+sub get_port
+{
+ return $ddb->get_prop('dansguardian', 'port');
+}
+sub get_status
+{
+ return $db->get_prop('dansguardian', 'status');
+}
+sub get_bypassproxyto
+{
+ return $db->get_prop('squid', 'BypassProxyTo');
+}
+sub get_bypassproxyfrom
+{
+ return $db->get_prop('squid', 'BypassProxyFrom');
+}
+sub get_TCPBlocks
+{
+ return $db->get_prop('masq', 'TCPBlocks');
+}
+sub get_UDPBlocks
+{
+ return $db->get_prop('masq', 'UDPBlocks');
+}
+sub get_mode
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'mode');
+}
+sub get_bypass
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'bypass');
+}
+sub get_reportinglevel
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'reportinglevel');
+}
+sub get_deniedpage
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'deniedpage');
+}
+sub get_deniedurl
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'deniedurl');
+}
+sub get_scan
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'scan');
+}
+sub get_weight
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'weight');
+}
+sub get_pics
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g' ||'');
+ return $ddb->get_prop("dansguardian$g", 'pics');
+}
+sub get_regexpurl
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'regexpurl');
+}
+sub get_regexpsearch
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'regexpsearch');
+}
+sub get_regexpurlads
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'regexpurlads');
+}
+sub get_regexpurlproxy
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'regexpurlproxy');
+}
+sub get_blanketban
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'blanketban');
+}
+sub get_ipban
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'ipban');
+}
+sub get_https
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'https');
+}
+sub get_file
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ return $ddb->get_prop("dansguardian$g", 'file');
+}
+sub get_criterion
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $key = $q->param('key') ||'';
+ return $ddb->get_prop($key, 'criterion') || '';
+}
+
+sub get_status_summary
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+
+ my $status = $db->get_prop('dansguardian', "status");
+ my $Auth = $db->get_prop('squid', "RequireAuth");
+ my $port = $ddb->get_prop('dansguardian', "port");
+ my $block = $db->get_prop('dansguardian', "portblocking");
+
+ my $STATUS = $self->localise('STATUS');
+ my $PORT = $self->localise('PORT');
+ my $PROXYACCESS = $self->localise('PROXYACCESS');
+ my $BLOCKING = $self->localise('PORTBLOCKING');
+
+ my $status2;
+ if ($status eq 'enabled')
+ { $status2 = $self->localise('ENABLED'); } else { $status2 = $self->localise('DISABLED'); }
+
+ my $block2;
+ if ($block eq 'yes')
+ { $block2 = $self->localise('ENABLED'); } else { $block2 = $self->localise('DISABLED'); }
+
+ return "$STATUS : $status2, $PORT : $port, $PROXYACCESS : $Auth, $BLOCKING : $block2";
+}
+
+sub get_custom_denied
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') ||'';
+ my $Ldefault = $self->localise('Ldefault');
+
+ my $defaults = $ddb->get_prop("dansguardian", "deniedurl") || 'dansguardian.pl';
+
+ my $deniedurl = $ddb->get_prop("dansguardian$g", "deniedurl") || 'nul';
+ if (($deniedurl eq 'nul') && (-e "/home/e-smith/files/ibays/Primary/cgi-bin/dansguardian$g.pl"))
+ { $deniedurl = "dansguardian$g.pl"; }
+
+ my $language = $ddb->get_prop('dansguardian', "language") || 'ukenglish';
+ my $customhtml = 'nul';
+ if (-e "/etc/dansguardian/languages/$language/template$g.html")
+ { $customhtml = "$language/template$g.html"; }
+
+ return "$Ldefault = $defaults, html = $customhtml, cgi = $deniedurl";
+}
+
+sub print_global_table
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+
+ my $description = $self->localise('DESCRIPTION');
+ my $Lf2 = $self->localise('Lf2');
+ my $Lf3 = $self->localise('Lf3');
+ my $Lf4 = $self->localise('Lf4');
+ my $Lf5 = $self->localise('Lf5');
+
+ my @groups = $adb->get_all_by_prop(type => "group");
+ my @gnames = '';
+ foreach my $g (@groups)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+ print $q->Tr (
+ esmith::cgi::genSmallCell($q, $description,"header"),
+ esmith::cgi::genSmallCell($q, '',"header")),"\n";
+
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf2),
+ esmith::cgi::genSmallCell ($q,
+ $q->popup_menu (-name => "f2",
+ -values => [ sort @gnames ],
+ -default => $ddb->get_prop('dansguardian', "f2") || '')));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf3),
+ esmith::cgi::genSmallCell ($q,
+ $q->popup_menu (-name => "f3",
+ -values => [ sort @gnames ],
+ -default => $ddb->get_prop('dansguardian', "f3") || '')));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf4),
+ esmith::cgi::genSmallCell ($q,
+ $q->popup_menu (-name => "f4",
+ -values => [ sort @gnames ],
+ -default => $ddb->get_prop('dansguardian', "f4") || '')));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf5),
+ esmith::cgi::genSmallCell ($q,
+ $q->popup_menu (-name => "f5",
+ -values => [ sort @gnames ],
+ -default => $ddb->get_prop('dansguardian', "f5") || '')));
+
+ print $q->end_table;
+
+ return "";
+}
+
+sub print_summary
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+
+ my $description = $self->localise('DESCRIPTION');
+ my $LAllow = $self->localise('LAllow');
+ my $LClient_IP = $self->localise('LClient_IP');
+ my $LDeny = $self->localise('LDeny');
+ my $modify = $self->localise('MODIFY');
+ my $Lcommon = $self->localise('Lcommon');
+ my $Ldefault = $self->localise('Ldefault');
+ my $Lf0 = $self->localise('Lf0');
+ my $Lf1 = $self->localise('Lf1');
+ my $Lf2 = $self->localise('Lf2');
+ my $Lf3 = $self->localise('Lf3');
+ my $Lf4 = $self->localise('Lf4');
+ my $Lf5 = $self->localise('Lf5');
+ my $GROUP = $self->localise('GROUP');
+ my $Lmode = $self->localise('Lmode');
+ my $LURLban = $self->localise('LURLban');
+ my $Lscan = $self->localise('Lscan');
+ my $Lbypass = $self->localise('Lbypass');
+ my $Llists = $self->localise('Llists');
+ my $Lsettings = $self->localise('Lsettings');
+
+ my @groups = $adb->get_all_by_prop(type => "group");
+ my @gnames = '';
+ foreach my $g (@groups)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+ print $q->Tr (
+ esmith::cgi::genSmallCell($q, $description,"header"),
+ esmith::cgi::genSmallCell($q, $GROUP,"header"),
+ esmith::cgi::genSmallCell($q, $Lmode,"header"),
+ esmith::cgi::genSmallCell($q, $LURLban,"header"),
+ esmith::cgi::genSmallCell($q, $Lscan,"header"),
+ esmith::cgi::genSmallCell($q, $Lbypass,"header"),
+ esmith::cgi::genSmallCell($q, $Lsettings,"header"),
+ esmith::cgi::genSmallCell($q, $Llists,"header")),"\n";
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf0),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f0&gname=$Lcommon&wherenext=GroupLists"}, $modify)));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf1),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "mode") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "blanketban") . " / " .
+ $ddb->get_prop('dansguardianf1', "https") . " / " .
+ $ddb->get_prop('dansguardianf1', "ipban") . " / " .
+ $ddb->get_prop('dansguardianf1', "file") . " - " .
+ $ddb->get_prop('dansguardianf1', "regexpurl") . " / " .
+ $ddb->get_prop('dansguardianf1', "regexpurlads") . " / " .
+ $ddb->get_prop('dansguardianf1', "regexpurlproxy")),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "scan") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf1', "bypass") || ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f1&gname=$Ldefault&wherenext=GroupSettings"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f1&gname=$Ldefault&wherenext=GroupLists"}, $modify)));
+
+ my $gname = $ddb->get_prop('dansguardian', "f2");
+ if ($gname) {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf2),
+ esmith::cgi::genSmallCell ($q, $gname ),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "mode") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "blanketban") . " / " .
+ $ddb->get_prop('dansguardianf2', "https") . " / " .
+ $ddb->get_prop('dansguardianf2', "ipban") . " / " .
+ $ddb->get_prop('dansguardianf2', "file") . " - " .
+ $ddb->get_prop('dansguardianf2', "regexpurl") . " / " .
+ $ddb->get_prop('dansguardianf2', "regexpurlads") . " / " .
+ $ddb->get_prop('dansguardianf2', "regexpurlproxy")),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "scan") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf2', "bypass") || ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f2&gname=$gname&wherenext=GroupSettings"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f2&gname=$gname&wherenext=GroupLists"}, $modify)));
+ }
+
+ $gname = $ddb->get_prop('dansguardian', "f3");
+ if ($gname) {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf3),
+ esmith::cgi::genSmallCell ($q, $gname ),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "mode") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "blanketban") . " / " .
+ $ddb->get_prop('dansguardianf3', "https") . " / " .
+ $ddb->get_prop('dansguardianf3', "ipban") . " / " .
+ $ddb->get_prop('dansguardianf3', "file") . " - " .
+ $ddb->get_prop('dansguardianf3', "regexpurl") . " / " .
+ $ddb->get_prop('dansguardianf3', "regexpurlads") . " / " .
+ $ddb->get_prop('dansguardianf3', "regexpurlproxy")),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "scan") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf3', "bypass") || ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f3&gname=$gname&wherenext=GroupSettings"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f3&gname=$gname&wherenext=GroupLists"}, $modify)));
+ }
+
+ $gname = $ddb->get_prop('dansguardian', "f4");
+ if ($gname) {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf4),
+ esmith::cgi::genSmallCell ($q, $gname ),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "mode") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "blanketban") . " / " .
+ $ddb->get_prop('dansguardianf4', "https") . " / " .
+ $ddb->get_prop('dansguardianf4', "ipban") . " / " .
+ $ddb->get_prop('dansguardianf4', "file") . " - " .
+ $ddb->get_prop('dansguardianf4', "regexpurl") . " / " .
+ $ddb->get_prop('dansguardianf4', "regexpurlads") . " / " .
+ $ddb->get_prop('dansguardianf4', "regexpurlproxy")),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "scan") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf4', "bypass") || ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f4&gname=$gname&wherenext=GroupSettings"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f4&gname=$gname&wherenext=GroupLists"}, $modify)));
+ }
+
+ $gname = $ddb->get_prop('dansguardian', "f5");
+ if ($gname) {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lf5),
+ esmith::cgi::genSmallCell ($q, $gname ),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "mode") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "blanketban") . " / " .
+ $ddb->get_prop('dansguardianf5', "https") . " / " .
+ $ddb->get_prop('dansguardianf5', "ipban") . " / " .
+ $ddb->get_prop('dansguardianf5', "file") . " - " .
+ $ddb->get_prop('dansguardianf5', "regexpurl") . " / " .
+ $ddb->get_prop('dansguardianf5', "regexpurlads") . " / " .
+ $ddb->get_prop('dansguardianf5', "regexpurlproxy")),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "scan") || ''),
+ esmith::cgi::genSmallCell ($q, $ddb->get_prop('dansguardianf5', "bypass") || ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f5&gname=$gname&wherenext=GroupSettings"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f5&gname=$gname&wherenext=GroupLists"}, $modify)));
+ }
+
+ print $q->end_table;
+
+ return "";
+}
+
+sub save_reload
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+
+ foreach ('loglevel','logfileformat','f2','f3','f4','f5','deniedurl')
+ { $ddb->set_prop('dansguardian', "$_", $q->param("$_")); }
+
+ unless ( system ("/sbin/e-smith/signal-event", "dansguardian-reload") == 0 )
+ { return $self->error('ERROR'); }
+
+ return $self->success("SUCCESS");
+}
+
+sub save_group_settings
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+
+ foreach ('mode','bypass','reportinglevel','scan','weight','pics','deniedpage','deniedurl',
+ 'regexpurl','regexpsearch','regexpurlads','regexpurlproxy','blanketban','https','ipban','file')
+ { $ddb->set_prop("dansguardian$g", "$_", $q->param("$_")); }
+
+ unless ( system ("/sbin/e-smith/signal-event", "dansguardian-reload") == 0 )
+ { return $self->error('ERROR'); }
+
+ return $self->success("SUCCESS");
+}
+
+sub save_proxy
+{
+ my $self = shift;
+ my $q = $self->{cgi} ||'';
+
+ my $status = $q->param ('status') || '';
+ my $proxyaccess = $q->param ('proxyaccess') || '';
+ my $portblocking = $q->param ('portblocking') || '';
+ my $port = $q->param ('port') || '';
+
+ $db->set_prop('squid', "RequireAuth", $proxyaccess);
+ $ddb->set_prop('dansguardian', "port", $port);
+
+ my $bypassproxyfrom = $q->param ('bypassproxyfrom') || '';
+ my $bypassproxyto = $q->param ('bypassproxyto') || '';
+ my $TCPBlocks = $q->param ('TCPBlocks') || '';
+ my $UDPBlocks = $q->param ('UDPBlocks') || '';
+
+ $db->set_prop('squid', "BypassProxyFrom", $bypassproxyfrom);
+ $db->set_prop('squid', "BypassProxyTo", $bypassproxyto);
+ $db->set_prop('masq', "UDPBlocks", $UDPBlocks);
+ $db->set_prop('masq', "TCPBlocks", $TCPBlocks);
+
+ if ($status eq 'disabled')
+ {
+ $db->set_prop('squid', "TransparentPort", '3128');
+ $db->set_prop('dansguardian', "status", 'disabled');
+ $db->set_prop('dansguardian', "portblocking", 'no');
+
+ unless ( system ("/sbin/e-smith/signal-event", "dansguardian-save") == 0 )
+ { return $self->error('ERROR'); }
+
+ return $self->success("SUCCESS_STOP");
+ }
+ else
+ {
+ $db->set_prop('squid', "TransparentPort", $port);
+ $db->set_prop('dansguardian', "status", 'enabled');
+ $db->set_prop('dansguardian', "portblocking", $portblocking);
+ }
+
+ unless ( system ("/sbin/e-smith/signal-event", "dansguardian-save") == 0 )
+ { return $self->error('ERROR'); }
+
+ return $self->success("SUCCESS_PROMPT");
+}
+
+sub portentry
+{
+ my ($fm, $port) = @_;
+ if (not $port)
+ {
+ return "FM_NONBLANK";
+ }
+ elsif ($port =~ /^(\d{4})$/)
+ {
+ return "OK";
+ }
+ else
+ {
+ return "ERROR_PORT";
+ }
+}
+
+sub print_list_table
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param('g') || '';
+ my $gname = $q->param('gname') || '';
+
+ my $description = $self->localise('DESCRIPTION');
+ my $Lasite = $self->localise('Lasite');
+ my $Laurl = $self->localise('Laurl');
+ my $Lphrases = $self->localise('Lphrases');
+ my $Lregexp = $self->localise('Lregexp');
+ my $Lfileext = $self->localise('Lfileext');
+ my $Lmimetype = $self->localise('Lmimetype');
+ my $ALLlists = $self->localise('LALLlists');
+ my $ENABLED = $self->localise('ENABLED');
+
+ my $Lgrey = $self->localise('Lgrey');
+ my $Lweighted = $self->localise('Lweighted');
+ my $Lmodifyurl = $self->localise('Lmodifyurl');
+ my $LAllow = $self->localise('LAllow');
+ my $LDeny = $self->localise('LDeny');
+ my $LAVexcept = $self->localise('LAVexcept');
+ my $Lexception = $self->localise('Lexception');
+ my $Lblacklist = $self->localise('Lblacklist');
+ my $Lphraselist = $self->localise('Lphraselist');
+ my $Lrepcon = $self->localise('Lrepcon');
+ my $Lallowurl = $self->localise('Lallowurl');
+ my $Lallowsite = $self->localise('Lallowsite');
+ my $LClientIP = $self->localise('LClientIP');
+ my $Lcommon = $self->localise('Lcommon');
+ my $Commonlists = $self->localise('LCommonlists');
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+ print $q->Tr (
+ esmith::cgi::genSmallCell($q, $description,"header"),
+ esmith::cgi::genSmallCell($q, $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ShowAllLists"}, $ALLlists),"header"),
+ esmith::cgi::genSmallCell($q, '',"header"),
+ esmith::cgi::genSmallCell($q, '',"header"),
+ esmith::cgi::genSmallCell($q, '',"header"),
+ esmith::cgi::genSmallCell($q, $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ShowCommonLists"}, $Commonlists),"header"));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lasite),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=greysitelist$g&wherenext=ViewList"}, $Lgrey)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionsitelist$g&wherenext=ViewList"}, $LAllow)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedsitelist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q,''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f0&list=exceptionvirussitelist&wherenext=ViewList"}, $LAVexcept)));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Laurl),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=greyurllist$g&wherenext=ViewList"}, $Lgrey)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionurllist$g&wherenext=ViewList"}, $LAllow)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedurllist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q,''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f0&list=exceptionvirusurllist&wherenext=ViewList"}, $LAVexcept)));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lphrases),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=weightedphraselist$g&wherenext=ViewList"}, $Lweighted)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionphraselist$g&wherenext=ViewList"}, $LAllow)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedphraselist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,''));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lregexp),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=urlregexplist$g&wherenext=ViewList"}, $Lmodifyurl)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionregexpurllist$g&wherenext=ViewList"}, $LAllow)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedregexpurllist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=contentregexplist$g&wherenext=ViewList"}, $Lrepcon)),
+ esmith::cgi::genSmallCell ($q, ''));
+
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lfileext),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionextensionlist$g&wherenext=ViewList"}, $Lexception)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedextensionlist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionfileurllist$g&wherenext=ViewList"}, $Lallowurl)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f0&list=exceptionvirusextensionlist&wherenext=ViewList"}, $LAVexcept)));
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $Lmimetype),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionmimetypelist$g&wherenext=ViewList"}, $Lexception)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannedmimetypelist$g&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptionfilesitelist$g&wherenext=ViewList"}, $Lallowsite)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=f0&list=exceptionvirusmimetypelist&wherenext=ViewList"}, $LAVexcept)));
+
+ #Client IP
+ if ($g eq 'f0')
+ {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $LClientIP),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=exceptioniplist&wherenext=ViewList"}, $Lexception)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=bannediplist&wherenext=ViewList"}, $LDeny)),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''));
+ }
+
+ #prepared lists
+ unless ($g eq 'f0')
+ {
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $ENABLED),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ViewPhraseList"}, $Lphraselist)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&gname=$gname&wherenext=ViewBlackList"}, $Lblacklist)),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''));
+ }
+
+ print $q->end_table;
+ return "";
+}
+
+sub print_list_description
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+ my $desc = $self->localise('MODIFY_LIST_SETTINGS');
+
+ if ($g eq 'f0')
+ {
+ $desc = $self->localise('MODIFY_GLOBAL_LIST_SETTINGS');
+ }
+
+ return "$desc";
+}
+
+sub print_record_table
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+ my $list = $q->param('list') ||'';
+
+ my $record = $self->localise('RECORD');
+ my $modify = $self->localise('MODIFY');
+ my $remove = $self->localise('REMOVE');
+ my $new = $self->localise('NEW');
+
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+ print $q->Tr (
+ esmith::cgi::genSmallCell($q, $record,"header"),
+ esmith::cgi::genSmallCell($q, '',"header"),
+ esmith::cgi::genSmallCell($q, '',"header")),"\n";
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q, ''),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=$list&key=new&wherenext=Edit"}, $new)));
+
+ foreach my $hash ($ddb->get_all_by_prop(type => $list))
+ {
+ my $key = $hash->key;
+ my $criterion = $hash->prop("criterion") || '';
+
+ #allows for three sets of bracketed words
+ #$record =~ s/<\;/g; ??
+ #$record =~ s/>/>\;/g;
+ $criterion =~ s/<\;/;
+ $criterion =~ s/>/>\;/;
+ $criterion =~ s/<\;/;
+ $criterion =~ s/>/>\;/;
+ $criterion =~ s/<\;/;
+ $criterion =~ s/>/>\;/;
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $criterion),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&list=$list&key=$key&wherenext=Edit"}, $modify)),
+ esmith::cgi::genSmallCell ($q,
+ $q->a ({href => $q->url (-absolute => 1)
+ . "?page=0&page_stack=&g=$g&criterion=$criterion&key=$key&wherenext=Delete"}, $remove)));
+ }
+
+ print $q->end_table;
+
+ return "";
+}
+
+sub print_all_lists
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+ my $all = ();
+
+ if ($g =~ /^(f\d{1})$/)
+ {
+ $g = $1;
+ }
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+
+ $all .= "\n";
+
+ my @files = ('bannedextensionlist','bannedsitelist','exceptionfilesitelist','exceptionregexpurllist',
+ 'greysitelist','weightedphraselist','bannedmimetypelist','bannedurllist','exceptionfileurllist',
+ 'exceptionsitelist','greyurllist','bannedphraselist','contentregexplist','exceptionmimetypelist','exceptionurllist','pics',
+ 'bannedregexpurllist','exceptionextensionlist','exceptionphraselist','greyregexpurllist','urlregexplist');
+
+ foreach (@files)
+ {
+
+ if ( -e "/etc/dansguardian/lists/$g/$_" )
+ {
+ open (INF,"/etc/dansguardian/lists/$g/$_")
+ or die ("can't open /etc/dansguardian/lists/$g/$_ to read. ");
+
+ $all .= "
\n";
+ $all .= " /etc/dansguardian/lists/$g/$_
\n";
+
+ while ()
+ {
+ # allow for 4 sets
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+
+ $all .= "$_
\n";
+ }
+ close INF;
+ }
+ }
+
+ $all .= "<\code>\n";
+
+ print $q->end_table;
+
+ return "$all";
+}
+
+sub print_common_lists
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+ my $all = ();
+
+ if ($g =~ /^(f\d{1})$/)
+ {
+ $g = $1;
+ }
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+
+ $all .= "\n";
+
+ my @files = ('exceptioniplist','bannediplist','contentscanners/exceptionvirusextensionlist',
+ 'contentscanners/exceptionvirusmimetypelist','contentscanners/exceptionvirussitelist','contentscanners/exceptionvirusurllist');
+
+ foreach (@files)
+ {
+
+ if ( -e "/etc/dansguardian/lists/$_" )
+ {
+ open (INF,"/etc/dansguardian/lists/$_")
+ or die ("can't open /etc/dansguardian/lists/$_ to read. ");
+
+ $all .= "
\n";
+ $all .= " /etc/dansguardian/lists/$_
\n";
+
+ while ()
+ {
+ # allow for 4 sets
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+
+ $all .= "$_
\n";
+ }
+ close INF;
+ }
+ }
+
+ $all .= "<\code>\n";
+
+ print $q->end_table;
+
+ return "$all";
+}
+
+sub print_phraselist_head
+{
+ my $self = shift;
+ my $q = $self->{cgi} ||'';
+ my $all = ();
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+
+ $all .= "\n";
+
+ system ("/usr/bin/head /etc/dansguardian/lists/phraselists/*/* > /tmp/lists") == 0
+ or die ("Error occurred reading phraselists\n");
+
+ if ( -e "/tmp/lists" )
+ {
+ open (INF,"/tmp/lists")
+ or die ("can't open /tmp/lists read. ");
+
+ $all .= "
head /etc/dansguardian/lists/phraselists/*
\n";
+
+ while ()
+ {
+ # allow for 4 sets
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+
+ $all .= "$_
\n";
+ }
+ close INF;
+ }
+
+ $all .= "<\code>\n";
+ print $q->end_table;
+ return "$all";
+}
+sub print_blacklist_head
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $all = ();
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+
+ $all .= "\n";
+
+ system ("/usr/bin/head /etc/dansguardian/blacklists/*/* > /tmp/lists") == 0
+ or die ("Error occurred reading phraselists\n");
+
+ if ( -e "/tmp/lists" )
+ {
+ open (INF,"/tmp/lists")
+ or die ("can't open /tmp/lists read. ");
+
+ $all .= "
head /etc/dansguardian/blacklists/*
\n";
+
+ while ()
+ {
+ # allow for 4 sets
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+ $_ =~ s/<\;/;
+ $_ =~ s/>/>\;/;
+
+ $all .= "$_
\n";
+ }
+ close INF;
+ }
+
+ $all .= "<\code>\n";
+ print $q->end_table;
+ return "$all";
+}
+
+sub save_record
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+ my $key = $q->param ('key') ||'';
+ my $list = $q->param ('list') ||'';
+ my $criterion = $q->param ('criterion');
+
+ if ($key eq 'new')
+ {
+ my $random = int(rand(999999));
+ $key = $list.$random;
+ $ddb->new_record($key, { type => "$list" });
+ }
+ $ddb->set_prop($key, 'criterion', $criterion);
+
+ return $self->success("SUCCESS_STORED");
+}
+sub delete_record
+{
+ my $self = shift;
+ my $q = $self->{cgi} ||'';
+ my $key = $q->param('key') ||'';
+
+ my $rec = $ddb->get($key);
+ $rec->delete;
+
+ return $self->success("SUCCESS_STORED");
+}
+
+sub print_phraselist_table
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+
+ my $Llist = $self->localise('LIST');
+
+ my @lists = $pdb->get_all_by_prop(type => "list");
+ my @gnames = '';
+ foreach my $g (@lists)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ my @installed = ('badwords','googlesearches');
+ foreach (@gnames)
+ {
+ push (@installed, $_)
+ if (-e "/etc/dansguardian/lists/phraselists/$_/weighted");
+ }
+
+ #hide table if you have no rules
+ my $installed = @installed || 'no lists';
+ if ($installed eq 'no lists')
+ {
+ return "$self->localise('ERROR');"
+ }
+ else
+ {
+
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+
+ print $q->Tr ( esmith::cgi::genSmallCell($q, $Llist,"header"),
+ esmith::cgi::genSmallCell($q, '',"header")),"\n";
+
+ #checkboxes
+ my ($a, $aa) = '';
+ foreach (sort @installed)
+ {
+ $a = $_;
+ $aa = $pdb->get_prop($_, $g) || '';
+ if ($aa eq 'on') { $aa = "checked"; }
+
+ print $q->Tr (esmith::cgi::genSmallCell ($q, $_),
+ esmith::cgi::genSmallCell ($q, ("")));
+ }
+ }
+
+ print $q->end_table;
+
+ return "";
+}
+sub save_phrase
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+
+ my @lists = $pdb->get_all_by_prop(type => "list");
+ my @gnames = '';
+ foreach my $g (@lists)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ my @installed = ();
+ foreach (@gnames)
+ {
+ push (@installed, $_)
+ if (-e "/etc/dansguardian/lists/phraselists/$_/weighted");
+ }
+
+ #skip if you have nothing
+ my $installed = @installed || 'no lists';
+ unless ($installed eq 'no lists')
+ {
+ #from checkboxes
+ my ($a, $aa) = '';
+ foreach (@installed)
+ {
+ my $a = $_;
+ my $aa = $q->param ($a) || '';
+ $pdb->set_prop($_, $g, $aa);
+ }
+ }
+
+ return $self->success("SUCCESS_STORED");
+}
+
+
+sub print_blacklist_table
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+
+ my $Llist = $self->localise('LIST');
+ my $LWhite = $self->localise('LWhite');
+ my $LGrey = $self->localise('Lgrey');
+ my $LBlack = $self->localise('LBlack');
+
+ my @lists = $bdb->get_all_by_prop(type => "list");
+ my @gnames = '';
+ foreach my $g (@lists)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ my @installed = ();
+ foreach (@gnames)
+ {
+ push (@installed, $_)
+ if (-e "/etc/dansguardian/blacklists/$_/domains");
+ }
+
+ #hide table if you have no rules
+ my $installed = @installed || 'no lists';
+ if ($installed eq 'no lists')
+ {
+ return "$self->localise('NO_BLACK');"
+ }
+ else
+ {
+ print $q->start_table({-CLASS => "sme-border"}),"\n";
+ print $q->Tr (
+ esmith::cgi::genSmallCell($q, $Llist,"header"),
+ esmith::cgi::genSmallCell($q, $LWhite,"header"),
+ esmith::cgi::genSmallCell($q, $LGrey,"header"),
+ esmith::cgi::genSmallCell($q, $LBlack,"header")),"\n";
+
+ #checkboxes
+ my ($a, $b, $c, $aa, $bb, $cc) = '';
+ foreach (sort @installed)
+ {
+ $a = $_.'white';
+ $aa = $bdb->get_prop($_, "white$g") || '';
+ if ($aa eq 'on') { $aa = "checked"; }
+
+ my $b = $_.'grey';
+ $bb = $bdb->get_prop($_, "grey$g") || '';
+ if ($bb eq 'on') { $bb = "checked"; }
+
+ my $c = $_.'black';
+ $cc= $bdb->get_prop($_, "black$g") || '';
+ if ($cc eq 'on') { $cc = "checked"; }
+
+ #todo
+ my $listname = $self->localise($_);
+
+ print $q->Tr
+ (esmith::cgi::genSmallCell ($q, $listname),
+ esmith::cgi::genSmallCell ($q, ("")),
+ esmith::cgi::genSmallCell ($q, ("")),
+ esmith::cgi::genSmallCell ($q, ("")));
+ }
+ }
+
+ print $q->end_table;
+
+ return "";
+}
+sub save_black
+{
+ my $self = shift;
+ my $q = $self->{cgi};
+ my $g = $q->param ('g') ||'';
+
+ my @lists = $bdb->get_all_by_prop(type => "list");
+ my @gnames = '';
+ foreach my $g (@lists)
+ {
+ my $groupname = $g->key();
+ push (@gnames, $groupname)
+ }
+
+ my @installed = ();
+ foreach (@gnames)
+ {
+ push (@installed, $_)
+ if (-e "/etc/dansguardian/blacklists/$_/domains");
+ }
+
+ #skip if you have nothing
+ my $installed = @installed || 'no lists';
+ unless ($installed eq 'no lists')
+ {
+ #from checkboxes
+ my ($a, $b, $c, $aa, $bb, $cc,) = '';
+ foreach (@installed)
+ {
+ my $a = $_.'white';
+ my $aa = $q->param ("$a") || '';
+ $bdb->set_prop($_, "white$g", $aa);
+
+ my $b = $_.'grey';
+ my $bb = $q->param ("$b") || '';
+ $bdb->set_prop($_, "grey$g", $bb);
+
+ my $c = $_.'black';
+ my $cc = $q->param ("$c") || '';
+ $bdb->set_prop($_, "black$g", $cc);
+ }
+ }
+
+ return $self->success("SUCCESS_STORED");
+}
+
+1;