This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree".
The branch, next has been updated via e4d79ba496c7d5203e04df34bf59b827b79a2e0c (commit) via 7c61607944e12a02366244dc1c03da5df832a8ce (commit) via 87e33a423fa7a85affc2cfd4f066fceb953f7163 (commit) via e157791fe963a98323ac88bec665624525bf809f (commit) via d31127446c9a7749921d05401f0eda97ce76ca3b (commit) from e3c1704453af2ec96e9c99f5f3ed8a2e0979d072 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit e4d79ba496c7d5203e04df34bf59b827b79a2e0c Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Aug 21 17:19:05 2013 +0200
core73: Add HTML::Template.
commit 7c61607944e12a02366244dc1c03da5df832a8ce Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Aug 21 17:14:42 2013 +0200
core73: Add redirection template engine.
commit 87e33a423fa7a85affc2cfd4f066fceb953f7163 Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Aug 21 17:08:57 2013 +0200
urlfilter: Make redirect.cgi template selectable.
commit e157791fe963a98323ac88bec665624525bf809f Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Aug 21 16:11:55 2013 +0200
redirect.cgi: Introduce a small template engine for the error pages.
commit d31127446c9a7749921d05401f0eda97ce76ca3b Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Aug 21 16:10:49 2013 +0200
HTML-Template: New package.
-----------------------------------------------------------------------
Summary of changes: config/rootfiles/common/HTML-Template | 7 + config/rootfiles/core/73/filelists/HTML-Template | 1 + config/rootfiles/core/73/filelists/files | 2 + doc/language_issues.es | 1 + doc/language_issues.fr | 1 + doc/language_issues.nl | 1 + doc/language_issues.pl | 1 + doc/language_issues.ru | 1 + doc/language_issues.tr | 1 + doc/language_missings | 4 + html/cgi-bin/urlfilter.cgi | 22 ++++ html/html/redirect-templates/legacy/template.html | 55 ++++++++ html/html/redirect.cgi | 148 ++++++++-------------- langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 1 + lfs/{Locale-Country => HTML-Template} | 7 +- make.sh | 1 + 17 files changed, 159 insertions(+), 96 deletions(-) create mode 100644 config/rootfiles/common/HTML-Template create mode 120000 config/rootfiles/core/73/filelists/HTML-Template create mode 100644 html/html/redirect-templates/legacy/template.html copy lfs/{Locale-Country => HTML-Template} (96%)
Difference in files: diff --git a/config/rootfiles/common/HTML-Template b/config/rootfiles/common/HTML-Template new file mode 100644 index 0000000..4b486d9 --- /dev/null +++ b/config/rootfiles/common/HTML-Template @@ -0,0 +1,7 @@ +usr/lib/perl5/site_perl/5.12.3/HTML/Template +usr/lib/perl5/site_perl/5.12.3/HTML/Template.pm +usr/lib/perl5/site_perl/5.12.3/HTML/Template/FAQ.pm +#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/HTML/Template +#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/HTML/Template/.packlist +#usr/share/man/man3/HTML::Template.3 +#usr/share/man/man3/HTML::Template::FAQ.3 diff --git a/config/rootfiles/core/73/filelists/HTML-Template b/config/rootfiles/core/73/filelists/HTML-Template new file mode 120000 index 0000000..f17c1da --- /dev/null +++ b/config/rootfiles/core/73/filelists/HTML-Template @@ -0,0 +1 @@ +../../../common/HTML-Template \ No newline at end of file diff --git a/config/rootfiles/core/73/filelists/files b/config/rootfiles/core/73/filelists/files index d0fe965..6a58766 100644 --- a/config/rootfiles/core/73/filelists/files +++ b/config/rootfiles/core/73/filelists/files @@ -1,4 +1,6 @@ etc/system-release etc/issue +srv/web/ipfire/html/redirect.cgi +srv/web/ipfire/html/redirect-templates/ var/ipfire/langs var/ipfire/proxy/advanced/useragents diff --git a/doc/language_issues.es b/doc/language_issues.es index fe46355..88666b6 100644 --- a/doc/language_issues.es +++ b/doc/language_issues.es @@ -672,6 +672,7 @@ WARNING: untranslated string: tor traffic limit soft WARNING: untranslated string: tor traffic read written WARNING: untranslated string: tor use exit nodes WARNING: untranslated string: uptime load average +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: visit us at WARNING: untranslated string: vpn keyexchange WARNING: untranslated string: wlan client diff --git a/doc/language_issues.fr b/doc/language_issues.fr index d5a1057..6c963ae 100644 --- a/doc/language_issues.fr +++ b/doc/language_issues.fr @@ -660,6 +660,7 @@ WARNING: untranslated string: upload new ruleset WARNING: untranslated string: uptime load average WARNING: untranslated string: urlfilter file ext block WARNING: untranslated string: urlfilter mode block +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: visit us at WARNING: untranslated string: vpn keyexchange WARNING: untranslated string: wlan client diff --git a/doc/language_issues.nl b/doc/language_issues.nl index c8249ff..8999404 100644 --- a/doc/language_issues.nl +++ b/doc/language_issues.nl @@ -574,6 +574,7 @@ WARNING: untranslated string: tor traffic limit soft WARNING: untranslated string: tor traffic read written WARNING: untranslated string: tor use exit nodes WARNING: untranslated string: uptime load average +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: wlan client WARNING: untranslated string: wlan client advanced settings WARNING: untranslated string: wlan client and diff --git a/doc/language_issues.pl b/doc/language_issues.pl index fe46355..88666b6 100644 --- a/doc/language_issues.pl +++ b/doc/language_issues.pl @@ -672,6 +672,7 @@ WARNING: untranslated string: tor traffic limit soft WARNING: untranslated string: tor traffic read written WARNING: untranslated string: tor use exit nodes WARNING: untranslated string: uptime load average +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: visit us at WARNING: untranslated string: vpn keyexchange WARNING: untranslated string: wlan client diff --git a/doc/language_issues.ru b/doc/language_issues.ru index ef7b31c..768bc12 100644 --- a/doc/language_issues.ru +++ b/doc/language_issues.ru @@ -637,6 +637,7 @@ WARNING: untranslated string: tor traffic limit soft WARNING: untranslated string: tor traffic read written WARNING: untranslated string: tor use exit nodes WARNING: untranslated string: uptime load average +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: visit us at WARNING: untranslated string: vpn keyexchange WARNING: untranslated string: wlan client diff --git a/doc/language_issues.tr b/doc/language_issues.tr index 1821fb4..af1af7b 100644 --- a/doc/language_issues.tr +++ b/doc/language_issues.tr @@ -569,6 +569,7 @@ WARNING: untranslated string: tor traffic limit hard WARNING: untranslated string: tor traffic limit soft WARNING: untranslated string: tor traffic read written WARNING: untranslated string: tor use exit nodes +WARNING: untranslated string: urlfilter redirect template WARNING: untranslated string: wlan client WARNING: untranslated string: wlan client advanced settings WARNING: untranslated string: wlan client and diff --git a/doc/language_missings b/doc/language_missings index 865a42a..1550f47 100644 --- a/doc/language_missings +++ b/doc/language_missings @@ -173,6 +173,7 @@ < uptime load average < urlfilter file ext block < urlfilter mode block +< urlfilter redirect template < visit us at < vpn keyexchange < wlanap access point @@ -407,6 +408,7 @@ < updxlrtr standard view < uptime < uptime load average +< urlfilter redirect template < visit us at < vpn keyexchange < wlanap country @@ -596,6 +598,7 @@ < updxlrtr standard view < uptime < uptime load average +< urlfilter redirect template < visit us at < vpn keyexchange < wlanap country @@ -790,6 +793,7 @@ < updxlrtr standard view < uptime < uptime load average +< urlfilter redirect template < visit us at < vpn keyexchange < week-graph diff --git a/html/cgi-bin/urlfilter.cgi b/html/cgi-bin/urlfilter.cgi index 1bfc039..1b40a3c 100644 --- a/html/cgi-bin/urlfilter.cgi +++ b/html/cgi-bin/urlfilter.cgi @@ -59,6 +59,7 @@ my $tcfile = "${General::swroot}/urlfilter/timeconst"; my $uqfile = "${General::swroot}/urlfilter/userquota"; my $dbdir = "${General::swroot}/urlfilter/blacklists"; my $editdir = "${General::swroot}/urlfilter/editor"; +my $templatedir = "/srv/web/ipfire/html/redirect-templates"; my $repository = "/var/urlrepo"; my $hintcolour = '#FFFFCC';
@@ -142,6 +143,7 @@ $filtersettings{'ENABLE_LOG'} = 'off'; $filtersettings{'ENABLE_USERNAME_LOG'} = 'off'; $filtersettings{'ENABLE_CATEGORY_LOG'} = 'off'; $filtersettings{'ENABLE_AUTOUPDATE'} = 'off'; +$filtersettings{'REDIRECT_TEMPLATE'} = 'legacy';
$filtersettings{'ACTION'} = ''; $filtersettings{'VALID'} = ''; @@ -1074,6 +1076,8 @@ foreach $category (@filtergroups) { $checked{$category}{$filtersettings{$category}} = "checked='checked'"; }
+$selected{'REDIRECT_TEMPLATE'}{$filtersettings{'REDIRECT_TEMPLATE'}} = "selected='selected'"; + $selected{'DEFINITION'}{$tcsettings{'DEFINITION'}} = "selected='selected'"; $selected{'FROM_HOUR'}{$tcsettings{'FROM_HOUR'}} = "selected='selected'"; $selected{'FROM_MINUTE'}{$tcsettings{'FROM_MINUTE'}} = "selected='selected'"; @@ -1416,6 +1420,24 @@ print <<END <td colspan='4'><b>$Lang::tr{'urlfilter block settings'}</b></td> </tr> <tr> + <td width='25%' class='base'>$Lang::tr{'urlfilter redirect template'}</td> + <td width='75%' colspan='2'> + <select name='REDIRECT_TEMPLATE'> +END +; + + foreach (<$templatedir/*>) { + if ((-d "$_") && (-e "$_/template.html")) { + my $template = substr($_,rindex($_,"/")+1); + print "<option value='$template' $selected{'REDIRECT_TEMPLATE'}{$template}>$template</option>\n"; + } + } + +print <<END + </select> + </td> +</tr> +<tr> <td width='25%' class='base'>$Lang::tr{'urlfilter show category'}:</td> <td width='12%'><input type='checkbox' name='SHOW_CATEGORY' $checked{'SHOW_CATEGORY'}{'on'} /></td> <td width='25%' class='base'>$Lang::tr{'urlfilter redirectpage'}: <img src='/blob.gif' alt='*' /></td> diff --git a/html/html/redirect-templates/legacy/template.html b/html/html/redirect-templates/legacy/template.html new file mode 100644 index 0000000..b5fb61e --- /dev/null +++ b/html/html/redirect-templates/legacy/template.html @@ -0,0 +1,55 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>ACCESS MESSAGE</title> + </head> + <body> + <table width="100%" height='100%' border="0"> + <tr> + <td colspan='3' width='100%' height='130' align="center" background="<TMPL_VAR NAME="ADDRESS">/images/background.gif"> + <tr> + <td width='10%'> + <td align='center' bgcolor='#CC000000' width='80%'> + <font face="verdana, arial, sans serif" color="#FFFFFF" size="5"> + <b><TMPL_VAR NAME="MSG_TEXT_1"></b> + </font> + <td width='10%'> + + <TMPL_IF NAME="CATEGORY"> + <tr> + <td colspan='3' align='center'> + <font face="verdana, arial, sans serif" color="#CC000000" size="1"> + <b>[<TMPL_VAR NAME="CATEGORY">]</b> + </font> + </TMPL_IF> + + <tr> + <td colspan='3' align="center"> + <font face="verdana, arial, sans serif" color="#000000" size="4"> + <b><TMPL_VAR NAME="MSG_TEXT_2"></b> + </font> + <font face="verdana,arial,sans serif" color="#000000" size="2"> + <TMPL_IF NAME="URL"> + <p>URL: <a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="URL"></a> + </TMPL_IF> + + <TMPL_IF NAME="IP_ADDRESS"> + <p>Client IP address: <i><TMPL_VAR NAME="IP_ADDRESS"></i> + </TMPL_IF> + + <br><p><TMPL_VAR NAME="MSG_TEXT_3"> + </font> + + <tr> + <td colspan='3' height='60%' valign="bottom" align="right"> + <font face="verdana,arial,sans serif" color="#656565" size="1"> + Web Filtering by + </font> + <a href="http://www.ipfire.org" target="_blank"> + <font face="verdana,arial,sans serif" color="#656565" size="1"><b>IPFire</b></font> + </a> + + </table> + </body> +</html> diff --git a/html/html/redirect.cgi b/html/html/redirect.cgi index 93f1ea4..4f9d227 100644 --- a/html/html/redirect.cgi +++ b/html/html/redirect.cgi @@ -19,9 +19,12 @@ # # ###############################################################################
-use CGI qw(param); +use CGI; +use HTML::Entities; +use HTML::Template;
-$swroot="/var/ipfire"; +my $swroot="/var/ipfire"; +my $templateroot = "/srv/web/ipfire/html/redirect-templates";
my %netsettings; my %filtersettings; @@ -29,117 +32,75 @@ my %filtersettings; &readhash("$swroot/ethernet/settings", %netsettings); &readhash("$swroot/urlfilter/settings", %filtersettings);
-$category=param("category"); -$url=param("url"); -$ip=param("ip"); +# Read the template file. +my $template = $filtersettings{'REDIRECT_TEMPLATE'}; +if (($template eq '') || (! -e "$templateroot/$template")) { + $template = "legacy"; +} +my $tmpl = HTML::Template->new( + filename => "$templateroot/$template/template.html", + die_on_bad_params => 0 +); + +# Address where to load more resources from. +$tmpl->param(ADDRESS => "http://$netsettings%7B%27GREEN_ADDRESS%27%7D:81");
-if ($filtersettings{'MSG_TEXT_1'} eq '') { +# Message text 1 +my $msgtext1 = $filtersettings{'MSG_TEXT_1'}; +if ($msgtext1 eq '') { $msgtext1 = "A C C E S S D E N I E D"; -} else { $msgtext1 = $filtersettings{'MSG_TEXT_1'}; } -if ($filtersettings{'MSG_TEXT_2'} eq '') { +} +$tmpl->param(MSG_TEXT_1 => $msgtext1); + +# Message text 2 +my $msgtext2 = $filtersettings{'MSG_TEXT_2'}; +if ($msgtext2 eq '') { $msgtext2 = "Access to the requested page has been denied"; -} else { $msgtext2 = $filtersettings{'MSG_TEXT_2'}; } -if ($filtersettings{'MSG_TEXT_3'} eq '') { +} +$tmpl->param(MSG_TEXT_2 => $msgtext2); + +# Message text 3 +my $msgtext3 = $filtersettings{'MSG_TEXT_3'}; +if ($msgtext3 eq '') { $msgtext3 = "Please contact the Network Administrator if you think there has been an error"; -} else { $msgtext3 = $filtersettings{'MSG_TEXT_3'}; } +} +$tmpl->param(MSG_TEXT_3 => $msgtext3); + +# Category +my $category = CGI::param("category"); +$tmpl->param(CATEGORY => &escape($category)); + +# URL +my $url = CGI::param("url"); +$tmpl->param(URL => &escape($url));
-if ($category eq '') { $category = ' '; } else { $category = '['.$category.']'; } +# IP address +my $ip_address = CGI::param("ip"); +$tmpl->param(IP_ADDRESS => &escape($ip_address));
+# Print header print "Pragma: no-cache\n"; print "Cache-control: no-cache\n"; print "Connection: close\n"; print "Content-type: text/html\n\n"; +print $tmpl->output;
-print <<END - -<html> -<head> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>ACCESS MESSAGE</title> -</head> - -<body> -<table width="100%" height='100%' border="0"> -<tr> - <td colspan='3' width='100%' height='130' align="center" background="http://$netsettings{'GREEN_ADDRESS'}:81/images/background.gif"> -<tr> <td width='10%'><td align='center' bgcolor='#CC000000' width='80%'><font face="verdana, arial, sans serif" color="#FFFFFF" size="5"> - <b>$msgtext1</b> - </font> - <td width='10%'> -END -; - -if (!($category eq "")) -{ - print <<END - <tr> <td colspan='3' align='center'> - <font face="verdana, arial, sans serif" color="#CC000000" size="1"> - <b>$category</b> - </font> -END -; +sub escape($) { + my $s = shift; + return HTML::Entities::encode_entities($s); } -print <<END -<tr> - <td colspan='3' align="center"> - <font face="verdana, arial, sans serif" color="#000000" size="4"> - <b>$msgtext2</b> - </font> - <font face="verdana,arial,sans serif" color="#000000" size="2"> -END -; - -if (!($url eq "")) -{ -print <<END - <p>URL: <a href="$url">$url</a> -END -; -} - -if (!($ip eq "")) -{ -print <<END - <p>Client IP address: <i>$ip</i> -END -; -} - -print <<END - <br><p>$msgtext3 - </font>
-<tr> - <td colspan='3' height='60%' valign="bottom" align="right"> - <font face="verdana,arial,sans serif" color="#656565" size="1">Web Filtering by - </font> - <a href="http://www.ipfire.org" target="_blank"><b> - <font face="verdana,arial,sans serif" color="#656565" size="1">IPFire</b></a> - </font> - -</table> -</body> - -</html> -END -; - -sub readhash -{ +sub readhash { my $filename = $_[0]; my $hash = $_[1]; my ($var, $val);
- if (-e $filename) - { + if (-e $filename) { open(FILE, $filename) or die "Unable to read file $filename"; - while (<FILE>) - { + while (<FILE>) { chop; ($var, $val) = split /=/, $_, 2; - if ($var) - { + if ($var) { $val =~ s/^'//g; $val =~ s/'$//g; @@ -149,6 +110,7 @@ sub readhash $hash->{$var} = $val; } } + close FILE; } } diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index b55179f..4e005e1 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -2118,6 +2118,7 @@ 'urlfilter quota restart message' => 'Hinweis: Beim Neustart des URL-Filters werden die Zähler für alle Benutzer zurückgesetzt', 'urlfilter quota time error' => 'Ungültiger Wert für Zeitkontingent', 'urlfilter quota user error' => 'Mindestens ein Benutzername erforderlich', +'urlfilter redirect template' => 'Sperrseitenvorlage', 'urlfilter redirectpage' => 'Leite zu dieser URL um', 'urlfilter remove file' => 'Datei aus der Ablage entfernen', 'urlfilter renewal' => 'Erneuerung', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 43bd03d..ba80985 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -2156,6 +2156,7 @@ 'urlfilter quota restart message' => 'Note: The counters will be reset for all users when restarting the URL filter', 'urlfilter quota time error' => 'Invalid value for time quota', 'urlfilter quota user error' => 'At least one username is required', +'urlfilter redirect template' => 'Redirect page template', 'urlfilter redirectpage' => 'Redirect to this URL', 'urlfilter remove file' => 'Remove file from repository', 'urlfilter renewal' => 'Renewal', diff --git a/lfs/HTML-Template b/lfs/HTML-Template new file mode 100644 index 0000000..fb837ba --- /dev/null +++ b/lfs/HTML-Template @@ -0,0 +1,78 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# 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 3 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, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 2.94 + +THISAPP = HTML-Template-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 7b7683c3672d55fb922734ea1e9ba7e8 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && perl Makefile.PL + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) + diff --git a/make.sh b/make.sh index bf00b5f..814b14a 100755 --- a/make.sh +++ b/make.sh @@ -529,6 +529,7 @@ buildipfire() { ipfiremake URI ipfiremake HTML-Tagset ipfiremake HTML-Parser + ipfiremake HTML-Template ipfiremake Compress-Zlib ipfiremake Digest ipfiremake Digest-SHA1
hooks/post-receive -- IPFire 2.x development tree