smeserver-xt_geoip/source/root/etc/e-smith/web/functions/xt_geoip

313 lines
8.5 KiB
Plaintext
Raw Normal View History

2023-02-06 20:04:43 +01:00
#!/usr/bin/perl -wT
# vim: set ft=xml:
#----------------------------------------------------------------------
# heading : Security
# description : GeoIP IP filtering
# navigation : 5000 5610
#----------------------------------------------------------------------
# copyright (C) 2007 Mitel Networks Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Technical support for this program is available from Mitel Networks
# Please visit our web site www.mitel.com/sme/ for details.
#----------------------------------------------------------------------
use strict;
use warnings;
use esmith::FormMagick::Panel::xt_geoip;
my $f = esmith::FormMagick::Panel::xt_geoip->new();
$f->display();
=head1
=cut
=begin testing
use esmith::FormMagick::Tester;
use esmith::TestUtils;
use esmith::ConfigDB;
use esmith::AccountsDB;
my $panel = $Original_File;
my $ua = esmith::FormMagick::Tester->new();
my $c = esmith::ConfigDB->open();
my $a = esmith::AccountsDB->open();
is (mode($panel), '4750', "Check permissions on script");
ok ($ua->get_panel($panel), "ABOUT TO RUN L10N TESTS");
is ($ua->{status}, 200, "200 OK");
#like($ua->{content}, qr/FORM_TITLE/, "Saw untranslated form title");
ok ($ua->set_language("en-us"), "Set language to U.S. English");
ok ($ua->get_panel($panel), "Get panel");
is ($ua->{status}, 200, "200 OK");
like($ua->{content}, qr/xt_geoip Admin/, "Saw translated form title");
=end testing
=cut
__DATA__
<form
title="FORM_TITLE"
header="/etc/e-smith/web/common/head.tmpl"
footer="/etc/e-smith/web/common/foot.tmpl">
<page name="First" pre-event="print_status_message()">
# post-event="wherenext('Second')"
<description>XT_GEOIP_STATUS_DESCRIPTION</description>
<field
type="literal"
id="geoip"
value="get_geoip()">
<label>LABEL_GEOIP_STATUS</label>
</field>
<field
type="literal"
id="badcountries"
value="get_badcountries(1)">
<label>LABEL_BADCOUNTRIES_STATUS</label>
</field>
<field
type="literal"
id="date_update"
value="get_date_update()">
<label>LABEL_DATE_UPDATE_STATUS</label>
</field>
<field
type="literal"
id="stat_geoip"
value="get_stat_geoip()">
<label> </label>
</field>
<field
type="literal"
id="stat_license"
value="get_stat_license_key()">
<label> </label>
</field>
<field type="literal" id="country_list_label" value="">
<description>COUNTRY_LIST_DESCRIPTION</description>
</field>
<subroutine src="print_custom_button('CNTRY_LIST', 'Codes', '')"/>
<subroutine src="print_button('NEXT')" />
<field type="literal" id="service_label" value="">
<description>SERVICE_DESCRIPTION</description>
</field>
<subroutine src="print_service_table()" />
<field type="literal" id="service_list_label" value="">
<description>SERVICE_LIST_DESCRIPTION</description>
</field>
<subroutine src="print_custom_button('SERV_LIST', 'Services', '')"/>
<field type="literal" id="stats_label" value="">
<description>STATS_DESCRIPTION</description>
</field>
<field type="literal" id="ipt_list_label" value="">
<description>IPT_LIST_DESCRIPTION</description>
</field>
<subroutine src="print_custom_button('IPT_LIST', 'Stats', 'ipt')"/>
<field type="literal" id="ssh_list_label" value="">
<description>SSH_LIST_DESCRIPTION</description>
</field>
<subroutine src="print_custom_button('SSH_LIST', 'Stats', 'ssh')"/>
<field type="literal" id="f2b_list_label" value="">
<description>F2B_LIST_DESCRIPTION</description>
</field>
<subroutine src="print_custom_button('F2B_LIST', 'Stats', 'f2b')"/>
</page>
<page name="Second" pre-event="turn_off_buttons" post-event="change_settings()">
<field
type="select"
id="masq_geoip"
options="'enabled' => 'YES', 'disabled' => 'NO'"
value="get_geoip()">
<label>LABEL_GEOIP</label>
<description>DESC_GEOIP</description>
</field>
<field
type="select"
id="masq_reverse"
options="'enabled' => '!=', 'disabled' => '=='"
value="get_reverse('masq','XTGeoipRev')">
<label>LABEL_REVERSE_MATCH</label>
<description>DESC_REVERSE_MATCH</description>
</field>
<field
type="text"
id="masq_badcountries"
size="64"
value="get_badcountries(0)"
validation="must_exist()">
<label>LABEL_BADCOUNTRIES</label>
<description>DESC_BADCOUNTRIES</description>
</field>
<field
type="literal"
id="badcountries"
value="get_badcountries(1)">
<label>LABEL_BADCOUNTRIES_STATUS</label>
</field>
<field
type="select"
id="masq_others"
options="'enabled' => 'enabled', 'disabled' => 'disabled'"
value="get_reverse('masq','XTGeoipOther')">
<label>LABEL_OTHERS</label>
<description>DESC_OTHERS</description>
</field>
<field
type="select"
id="update_geoip"
options="'NO', 'YES'"
value="'NO'">
<label>LABEL_UPDATE</label>
<description>DESC_UPDATE</description>
</field>
<subroutine src="print_button('SAVE')" />
</page>
<page name="SrvModify" pre-event="turn_off_buttons()" post-event="modify_serv()">
<title>ADD_SERVICE</title>
<description>ADD_DESC</description>
<field
type="literal"
id="service"
value="get_srv_name()">
<label>LABEL_SERVICE</label>
</field>
<field
type="literal"
id="badcountries"
value="get_badcountries(1)">
<label>LABEL_BADCOUNTRIES_STATUS</label>
</field>
<field
type="select"
id="masq_srv_reverse"
options="'enabled' => '!=', 'disabled' => '=='"
value="get_reverse('','XTGeoipRev')">
<label>LABEL_REVERSE_MATCH</label>
<description>DESC_REVERSE_MATCH</description>
</field>
<field
type="text"
id="masq_srv_badcountries"
size="64"
value="get_srv_badcountries(0)"
validation="srv_must_exist()">
<label>LABEL_BADCOUNTRIES</label>
<description>DESC_BADCOUNTRIES</description>
</field>
<field
type="literal"
id="srv_badcountries"
value="get_srv_badcountries(1)">
<label>LABEL_SERV_BADCOUNTRIES_STATUS</label>
</field>
<subroutine src="print_button('SAVE')" />
</page>
<page name="SrvRemove" pre-event="turn_off_buttons()" post-event="remove_serv()">
<title>REMOVE_SERVICE</title>
<description>REMOVE_DESC</description>
<field
type="literal"
id="service"
value="get_srv_name()">
<label>LABEL_SERVICE</label>
</field>
<field
type="literal"
id="badcountries"
value="get_srv_badcountries()">
<label>LABEL_SERV_BADCOUNTRIES_STATUS</label>
</field>
<subroutine src="print_button('REMOVE')" />
</page>
<page name="Stats" pre-event="generateStats" post-event="wherenext('First')">
<subroutine src="print_button('NEXT')"/>
</page>
<page name="Codes" pre-event="generateCodes" post-event="wherenext('First')">
<subroutine src="print_button('NEXT')"/>
</page>
<page name="Services" pre-event="turn_off_buttons()" post-event="do_otherServices()">
<field
type="select" multiple="1"
id="SelectedServices"
value="otherServices('sel')"
options="otherServices('all')">
<label>LABEL_AVAILABLE_SERVICES</label>
<description>DESC_AVAILABLE_SERVICES</description>
</field>
<subroutine src="print_button('NEXT')"/>
</page>
</form>