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 a54350cdb9d56691644486a49b7e5b7594d8d504 (commit) via ebfb8996930ec1e3b4f7d09208d2ab60a8f30603 (commit) from c484679bb3ea4672bf34ba3fd1d5d7596f00a11a (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 a54350cdb9d56691644486a49b7e5b7594d8d504 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Oct 16 16:36:24 2017 +0200
captive: Allow PDF export of coupons
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit ebfb8996930ec1e3b4f7d09208d2ab60a8f30603 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Oct 16 15:03:39 2017 +0200
captive: Add headline to T&C box
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
-----------------------------------------------------------------------
Summary of changes: doc/language_issues.es | 8 +++ doc/language_issues.fr | 8 ++- doc/language_issues.it | 8 +++ doc/language_issues.nl | 8 +++ doc/language_issues.pl | 8 +++ doc/language_issues.ru | 8 +++ doc/language_issues.tr | 8 +++ doc/language_missings | 29 ++++++++- html/cgi-bin/captive.cgi | 160 ++++++++++++++++++++++++++++++++++++++++++++++- langs/de/cgi-bin/de.pl | 5 ++ langs/en/cgi-bin/en.pl | 5 ++ 11 files changed, 252 insertions(+), 3 deletions(-)
Difference in files: diff --git a/doc/language_issues.es b/doc/language_issues.es index a701010..38cf210 100644 --- a/doc/language_issues.es +++ b/doc/language_issues.es @@ -613,6 +613,7 @@ WARNING: translation string unused: web proxy configuration WARNING: translation string unused: week-graph WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -621,6 +622,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -632,6 +634,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -640,11 +643,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: ConnSched dial @@ -1243,4 +1249,6 @@ WARNING: untranslated string: wlan client wpa mode ccmp ccmp WARNING: untranslated string: wlan client wpa mode ccmp tkip WARNING: untranslated string: wlan client wpa mode tkip tkip WARNING: untranslated string: wlan clients +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration WARNING: untranslated string: wlanap country diff --git a/doc/language_issues.fr b/doc/language_issues.fr index 1389cbb..351d8a2 100644 --- a/doc/language_issues.fr +++ b/doc/language_issues.fr @@ -631,6 +631,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -642,6 +643,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -650,11 +652,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: ConnSched dial @@ -1260,8 +1265,9 @@ WARNING: untranslated string: wlan client wpa mode ccmp ccmp WARNING: untranslated string: wlan client wpa mode ccmp tkip WARNING: untranslated string: wlan client wpa mode tkip tkip WARNING: untranslated string: wlan clients -WARNING: untranslated string: wlanap access point +WARNING: untranslated string: wlanap WARNING: untranslated string: wlanap channel +WARNING: untranslated string: wlanap configuration WARNING: untranslated string: wlanap country WARNING: untranslated string: wlanap debugging WARNING: untranslated string: wlanap del interface diff --git a/doc/language_issues.it b/doc/language_issues.it index 5b921a8..36af273 100644 --- a/doc/language_issues.it +++ b/doc/language_issues.it @@ -690,6 +690,7 @@ WARNING: translation string unused: web proxy configuration WARNING: translation string unused: week-graph WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -698,6 +699,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -709,6 +711,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -717,11 +720,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: MTU settings @@ -887,3 +893,5 @@ WARNING: untranslated string: wlan client method WARNING: untranslated string: wlan client password WARNING: untranslated string: wlan client tls cipher WARNING: untranslated string: wlan client tls version +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration diff --git a/doc/language_issues.nl b/doc/language_issues.nl index 16f6c0d..91fca78 100644 --- a/doc/language_issues.nl +++ b/doc/language_issues.nl @@ -686,6 +686,7 @@ WARNING: translation string unused: web proxy configuration WARNING: translation string unused: week-graph WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -694,6 +695,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -705,6 +707,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -713,11 +716,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: MTU settings @@ -935,3 +941,5 @@ WARNING: untranslated string: wlan client method WARNING: untranslated string: wlan client password WARNING: untranslated string: wlan client tls cipher WARNING: untranslated string: wlan client tls version +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration diff --git a/doc/language_issues.pl b/doc/language_issues.pl index a701010..38cf210 100644 --- a/doc/language_issues.pl +++ b/doc/language_issues.pl @@ -613,6 +613,7 @@ WARNING: translation string unused: web proxy configuration WARNING: translation string unused: week-graph WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -621,6 +622,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -632,6 +634,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -640,11 +643,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: ConnSched dial @@ -1243,4 +1249,6 @@ WARNING: untranslated string: wlan client wpa mode ccmp ccmp WARNING: untranslated string: wlan client wpa mode ccmp tkip WARNING: untranslated string: wlan client wpa mode tkip tkip WARNING: untranslated string: wlan clients +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration WARNING: untranslated string: wlanap country diff --git a/doc/language_issues.ru b/doc/language_issues.ru index a2a771e..25227c4 100644 --- a/doc/language_issues.ru +++ b/doc/language_issues.ru @@ -615,6 +615,7 @@ WARNING: translation string unused: warn when traffic reaches WARNING: translation string unused: web proxy configuration WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -623,6 +624,7 @@ WARNING: untranslated string: 24 hours WARNING: untranslated string: Add a route WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -634,6 +636,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -642,11 +645,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: ConnSched dial @@ -1238,4 +1244,6 @@ WARNING: untranslated string: wlan client wpa mode ccmp ccmp WARNING: untranslated string: wlan client wpa mode ccmp tkip WARNING: untranslated string: wlan client wpa mode tkip tkip WARNING: untranslated string: wlan clients +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration WARNING: untranslated string: wlanap country diff --git a/doc/language_issues.tr b/doc/language_issues.tr index 96849cd..733c664 100644 --- a/doc/language_issues.tr +++ b/doc/language_issues.tr @@ -698,6 +698,7 @@ WARNING: translation string unused: web proxy configuration WARNING: translation string unused: week-graph WARNING: translation string unused: weekly firewallhits WARNING: translation string unused: wildcards +WARNING: translation string unused: wlanap access point WARNING: translation string unused: wlanap wlan services WARNING: translation string unused: xtaccess all error WARNING: translation string unused: xtaccess bad transfert @@ -706,6 +707,7 @@ WARNING: translation string unused: yearly firewallhits WARNING: untranslated string: 24 hours WARNING: untranslated string: Captive ACTIVATE WARNING: untranslated string: Captive GAIN ACCESS +WARNING: untranslated string: Captive WiFi coupon WARNING: untranslated string: Captive activated WARNING: untranslated string: Captive active on WARNING: untranslated string: Captive agree tac @@ -717,6 +719,7 @@ WARNING: untranslated string: Captive clients WARNING: untranslated string: Captive config WARNING: untranslated string: Captive coupon WARNING: untranslated string: Captive expiry time +WARNING: untranslated string: Captive export coupons WARNING: untranslated string: Captive generate coupon WARNING: untranslated string: Captive issued coupons WARNING: untranslated string: Captive logo uploaded @@ -725,11 +728,14 @@ WARNING: untranslated string: Captive menu WARNING: untranslated string: Captive noexpiretime WARNING: untranslated string: Captive nolimit WARNING: untranslated string: Captive please accept the terms and conditions +WARNING: untranslated string: Captive portal +WARNING: untranslated string: Captive portal coupons WARNING: untranslated string: Captive terms WARNING: untranslated string: Captive terms short WARNING: untranslated string: Captive title WARNING: untranslated string: Captive upload logo WARNING: untranslated string: Captive upload logo recommendations +WARNING: untranslated string: Captive valid for WARNING: untranslated string: Captive vouchervalid WARNING: untranslated string: Captive wrong ext WARNING: untranslated string: Scan for Songs @@ -818,3 +824,5 @@ WARNING: untranslated string: wlan client method WARNING: untranslated string: wlan client password WARNING: untranslated string: wlan client tls cipher WARNING: untranslated string: wlan client tls version +WARNING: untranslated string: wlanap +WARNING: untranslated string: wlanap configuration diff --git a/doc/language_missings b/doc/language_missings index 46f6d69..64c184d 100644 --- a/doc/language_missings +++ b/doc/language_missings @@ -56,6 +56,7 @@ < Captive err doublevoucher < Captive expire < Captive expiry time +< Captive export coupons < Captive GAIN ACCESS < Captive generate coupon < Captive genvoucher @@ -73,16 +74,20 @@ < Captive nolimit < Captive nr < Captive please accept the terms and conditions +< Captive portal +< Captive portal coupons < Captive terms < Captive terms short < Captive time < Captive title < Captive upload logo < Captive upload logo recommendations +< Captive valid for < Captive voactive < Captive voucher < Captive vouchervalid < Captive vout +< Captive WiFi coupon < Captive wrong ext < ccd add < ccd choose net @@ -632,8 +637,9 @@ < vpn statistic rw < vpn weak < wireless network -< wlanap access point +< wlanap < wlanap channel +< wlanap configuration < wlanap country < wlanap debugging < wlanap del interface @@ -747,6 +753,7 @@ < Captive err doublevoucher < Captive expire < Captive expiry time +< Captive export coupons < Captive GAIN ACCESS < Captive generate coupon < Captive genvoucher @@ -764,16 +771,20 @@ < Captive nolimit < Captive nr < Captive please accept the terms and conditions +< Captive portal +< Captive portal coupons < Captive terms < Captive terms short < Captive time < Captive title < Captive upload logo < Captive upload logo recommendations +< Captive valid for < Captive voactive < Captive voucher < Captive vouchervalid < Captive vout +< Captive WiFi coupon < Captive wrong ext < ccd add < ccd choose net @@ -1325,6 +1336,8 @@ < vpn statistic rw < vpn weak < wireless network +< wlanap +< wlanap configuration < wlanap country < wlan client < wlan client advanced settings @@ -1419,6 +1432,7 @@ < Captive err doublevoucher < Captive expire < Captive expiry time +< Captive export coupons < Captive GAIN ACCESS < Captive generate coupon < Captive genvoucher @@ -1436,16 +1450,20 @@ < Captive nolimit < Captive nr < Captive please accept the terms and conditions +< Captive portal +< Captive portal coupons < Captive terms < Captive terms short < Captive time < Captive title < Captive upload logo < Captive upload logo recommendations +< Captive valid for < Captive voactive < Captive voucher < Captive vouchervalid < Captive vout +< Captive WiFi coupon < Captive wrong ext < ccd add < ccd choose net @@ -1983,6 +2001,8 @@ < vpn statistic rw < vpn weak < wireless network +< wlanap +< wlanap configuration < wlanap country < wlan client < wlan client advanced settings @@ -2078,6 +2098,7 @@ < Captive err doublevoucher < Captive expire < Captive expiry time +< Captive export coupons < Captive GAIN ACCESS < Captive generate coupon < Captive genvoucher @@ -2095,16 +2116,20 @@ < Captive nolimit < Captive nr < Captive please accept the terms and conditions +< Captive portal +< Captive portal coupons < Captive terms < Captive terms short < Captive time < Captive title < Captive upload logo < Captive upload logo recommendations +< Captive valid for < Captive voactive < Captive voucher < Captive vouchervalid < Captive vout +< Captive WiFi coupon < Captive wrong ext < ccd add < ccd choose net @@ -2647,6 +2672,8 @@ < vpn weak < week-graph < wireless network +< wlanap +< wlanap configuration < wlanap country < wlan client < wlan client advanced settings diff --git a/html/cgi-bin/captive.cgi b/html/cgi-bin/captive.cgi index 501bd87..c595c0e 100755 --- a/html/cgi-bin/captive.cgi +++ b/html/cgi-bin/captive.cgi @@ -20,8 +20,11 @@ ###############################################################################
#use strict; +use Encode; use HTML::Entities(); use File::Basename; +use PDF::API2; +use constant mm => 25.4 / 72;
# enable only the following on debugging purpose #use warnings; @@ -57,6 +60,20 @@ unless (-e $settingsfile) { system("touch $settingsfile"); } &General::readhash("$settingsfile", %settings) if(-f $settingsfile); &General::readhash("${General::swroot}/ethernet/settings", %netsettings);
+if ($cgiparams{'ACTION'} eq "export-coupons") { + my $pdf = &generate_pdf(); + + print "Content-Type: application/pdf\n"; + print "Content-Disposition: attachment; filename=captive-portal-coupons.pdf\n"; + print "\n"; # end headers + + # Send PDF + print $pdf; + + exit(0); +} + + &Header::showhttpheaders();
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) { @@ -350,7 +367,7 @@ END my $terms = &getterms(); print <<END; <tr> - <td></td> + <td>$Lang::tr{'Captive terms'}</td> <td> <textarea cols="50" rows="10" name="TERMS">$terms</textarea> </td> @@ -572,6 +589,16 @@ END
print "</table>";
+ # Download PDF + print <<END; + <div align="right"> + <form method="POST"> + <input type="hidden" name="ACTION" value="export-coupons"> + <input type="submit" value="$Lang::tr{'Captive export coupons'}"> + </form> + </div> +END + &Header::closebox(); }
@@ -660,5 +687,136 @@ sub validremark return 1; }
+sub generate_pdf() { + my $pdf = PDF::API2->new(); + + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime(time); + my $timestamp = sprintf("D:%04d%02d%02d%02d%02d%02d+00;00", $year+1900, $mon+1, $mday, $hour, $min, $sec); + + $pdf->info( + "Creator" => $Lang::tr{'Captive portal'}, + "Title" => $Lang::tr{'Captive portal coupons'}, + "CreationDate" => $timestamp, + "ModDate" => $timestamp, + ); + + # Set page size + $pdf->mediabox("A4"); + $pdf->trimbox(28/mm, 27/mm, 182/mm, 270/mm); + + # Set font + my $font = $pdf->ttfont("/usr/share/fonts/Ubuntu-R.ttf"); + + my $page_h_margin = 27/mm; + my $page_v_margin = 28/mm; + + my $height = 68/mm; + my $width = 91/mm; + my $margin = 2/mm; + + # Tux Image + my $tux_image = $pdf->image_png("/srv/web/ipfire/html/captive/assets/ipfire.png"); + my $logo_height = 12/mm; + my $logo_width = 12/mm; + + my @coupons = (); + my %coupon_expiry_times = (); + + # Read coupons + &General::readhasharray($coupons, %couponhash) if (-e $coupons); + foreach my $key (keys %couponhash) { + $coupon_expiry_times{$couponhash{$key}[1]} = $couponhash{$key}[2]; + push @coupons, $couponhash{$key}[1]; + } + + while (@coupons) { + # Make a new page + my $page = $pdf->page(); + + # Graphics + $gfx = $page->gfx(); + + # Headline font + my $f_headline = $page->text(); + $f_headline->font($font, 20); + + # Subheadline font + my $f_subheadline = $page->text(); + $f_subheadline->font($font, 14); + + # Coupon font + my $f_coupon = $page->text(); + $f_coupon->font($font, 36); + + # Lifetime + my $f_lifetime = $page->text(); + $f_lifetime->font($font, 14); + + # Watermark font + my $f_watermark = $page->text(); + $f_watermark->fillcolor("#666666"); + $f_watermark->font($font, 10); + + my $i = 0; + while (@coupons && $i < 8) { + my $coupon = shift @coupons; + + # Box corners + my $x = ($page_v_margin / 2) + (($i % 2) ? $width : 0); + my $y = ($page_h_margin / 2) + (int($i / 2) * $height); + + # Weidth and height of the box + my $w = $width - $margin; + my $h = $height - $margin; + + # Center + my $cx = $x + ($w / 2); + my $cy = $y + ($h / 2); + + # Draw border box + $gfx->strokecolor("#333333"); + $gfx->linedash(1/mm, 1/mm); + $gfx->rect($x, $y, $w, $h); + $gfx->stroke(); + $gfx->endpath(); + + # Headline + $f_headline->translate($cx, ($y + $h - $cy) / 1.7 + $cy); + $f_subheadline->translate($cx, ($y + $h - $cy) / 2.4 + $cy); + + if ($settings{'TITLE'}) { + $f_headline->text_center($settings{'TITLE'}); + $f_subheadline->text_center(decode("utf8", $Lang::tr{'Captive WiFi coupon'})); + } else { + $f_headline->text_center(decode("utf8", $Lang::tr{'Captive WiFi coupon'})); + } + + # Coupon + $f_coupon->translate($cx, $cy); + $f_coupon->text_center(decode("utf8", $coupon)); + + # Show lifetime + my $expiry_time = $coupon_expiry_times{$coupon}; + $f_lifetime->translate($cx, $cy - ($y + $h - $cy) / 4); + if ($expiry_time > 0) { + my $lifetime = &General::format_time($expiry_time); + $f_lifetime->text_center(decode("utf8", $Lang::tr{'Captive valid for'} . " " . $lifetime)); + } else { + $f_lifetime->text_center(decode("utf8", $Lang::tr{'Captive nolimit'})); + } + + # Add watermark + $gfx->image($tux_image, $x + $w - $logo_width - $margin, $y + $margin, $logo_width, $logo_height); + $f_watermark->translate($x + $w - ($margin * 2) - $logo_width, $y + ($logo_height / 2)); + $f_watermark->text_right("Powered by IPFire"); + + $i++; + } + } + + # Write out the PDF document + return $pdf->stringify(); +} + &Header::closebigbox(); &Header::closepage(); diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index af96a64..1398329 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -12,6 +12,7 @@ 'Captive 1week' => '1 Woche', 'Captive ACTIVATE' => 'AKTIVIEREN', 'Captive GAIN ACCESS' => 'ZUGANG', +'Captive WiFi coupon' => 'WLAN-Coupon', 'Captive activate' => 'Aktivieren', 'Captive activated' => 'Aktiviert', 'Captive active on' => 'Aktiviert auf', @@ -28,6 +29,7 @@ 'Captive err doublevoucher' => 'Ein Gutschein mit diesem Code ist bereits im Umlauf', 'Captive expire' => 'Ablauf', 'Captive expiry time' => 'Ablaufzeit', +'Captive export coupons' => 'Coupons exportieren', 'Captive generate coupon' => 'Coupon generieren', 'Captive genvoucher' => 'Gutschein generieren', 'Captive invalid logosize' => 'Die hochgeladene Datei entspricht nicht der vorgegeben Auflösung von mindestens 1280x400 und maximal 1920x800 Pixeln', @@ -44,12 +46,15 @@ 'Captive nolimit' => 'Unbegrenzt', 'Captive nr' => 'Nummer', 'Captive please accept the terms and conditions' => 'Bitte akzeptieren Sie die Bedingungen', +'Captive portal' => 'IPFire Captive-Portal', +'Captive portal coupons' => 'Captive-Portal-Coupons', 'Captive terms' => 'Bedingungen', 'Captive terms short' => 'Bedingungen', 'Captive time' => 'Erlaubter Nutzungszeitraum nach Aktivierung (Stunden)', 'Captive title' => 'Titel der Anmeldeseite', 'Captive upload logo' => 'Logo hochladen', 'Captive upload logo recommendations' => '(PNG oder JPEG, 1280x720 Pixel empfohlen)', +'Captive valid for' => 'Gültig für', 'Captive voactive' => 'Aktive Gutscheine', 'Captive voucher' => 'Gutschein', 'Captive vouchervalid' => 'Erlaubter Zeitraum für Gutschein', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 7e4f95c..29c87db 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -13,6 +13,7 @@ 'Captive 1week' => '1 week', 'Captive ACTIVATE' => 'ACTIVATE', 'Captive GAIN ACCESS' => 'GAIN ACCESS', +'Captive WiFi coupon' => 'WiFi Coupon', 'Captive activate' => 'Activate', 'Captive activated' => 'Activated', 'Captive active on' => 'Activated on', @@ -28,6 +29,7 @@ 'Captive err doublevoucher' => 'A voucher with this code already exists', 'Captive expire' => 'Expire', 'Captive expiry time' => 'Expiry Time', +'Captive export coupons' => 'Export Coupons', 'Captive generate coupon' => 'Generate Coupon', 'Captive heading terms' => 'Terms & Conditions', 'Captive heading voucher' => 'Voucher or Access Code', @@ -45,12 +47,15 @@ 'Captive nr' => 'Number', 'Captive please accept the terms and conditions' => 'Please accept the terms & conditions', 'Captive please enter a coupon code' => 'Please enter a coupon code', +'Captive portal' => 'IPFire Captive Portal', +'Captive portal coupons' => 'Captive Portal Coupons', 'Captive terms' => 'Terms & Conditions', 'Captive terms short' => 'T&Cs', 'Captive time' => 'Access time post activation (hours)', 'Captive title' => 'Title of Login Page', 'Captive upload logo' => 'Upload Logo', 'Captive upload logo recommendations' => '(PNG or JPEG, recommended 1280x720 pixels)', +'Captive valid for' => 'Valid for', 'Captive voactive' => 'Active Vouchers', 'Captive voucher' => 'Voucher', 'Captive vouchervalid' => 'Allowed time for this voucher',
hooks/post-receive -- IPFire 2.x development tree