]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/captive.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2016 IPFire Team <alexander.marx@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
27 use constant mm
=> 25.4 / 72 ;
29 # enable only the following on debugging purpose
31 #use CGI::Carp 'fatalsToBrowser';
33 require '/var/ipfire/general-functions.pl' ;
34 require "${General::swroot}/lang.pl" ;
35 require "${General::swroot}/header.pl" ;
38 3600 => $Lang :: tr
{ 'one hour' },
39 14400 => $Lang :: tr
{ 'four hours' },
40 28800 => $Lang :: tr
{ 'eight hours' },
41 43200 => $Lang :: tr
{ 'twelve hours' },
42 86400 => $Lang :: tr
{ '24 hours' },
43 604800 => $Lang :: tr
{ 'one week' },
44 1209600 => $Lang :: tr
{ 'two weeks' },
45 2592000 => $Lang :: tr
{ 'one month' },
46 31536000 => $Lang :: tr
{ 'one year' },
47 0 => "- $Lang ::tr{'unlimited'} -" ,
52 my $coupons = "${General::swroot}/captive/coupons" ;
55 my $logo = "${General::swroot}/captive/logo.dat" ;
64 my $clients = "${General::swroot}/captive/clients" ;
66 my $settingsfile = "${General::swroot}/captive/settings" ;
67 unless (- e
$settingsfile ) { system ( "touch $settingsfile " ); }
69 & Header
:: getcgihash
( \
%cgiparams );
71 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
72 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
73 & General
:: readhash
( " $settingsfile " , \
%settings ) if (- f
$settingsfile );
74 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
76 if ( $cgiparams { 'ACTION' } eq "export-coupons" ) {
77 my $pdf = & generate_pdf
();
79 print "Content-Type: application/pdf \n " ;
80 print "Content-Disposition: attachment; filename=captive-portal-coupons.pdf \n " ;
81 print " \n " ; # end headers
90 & Header
:: showhttpheaders
();
92 if ( $cgiparams { 'ACTION' } eq $Lang :: tr
{ 'save' }) {
93 my $file = $cgiparams { 'logo' };
95 # Check if the file extension is PNG/JPEG
98 my ( $name , $path , $ext ) = fileparse
( $file , qr/\.[^.]*$/ );
99 if ( $ext ne ".png" && $ext ne ".jpg" && $ext ne ".jpeg" ) {
100 $errormessage = $Lang :: tr
{ 'Captive wrong ext' };
104 $settings { 'ENABLE_GREEN' } = $cgiparams { 'ENABLE_GREEN' };
105 $settings { 'ENABLE_BLUE' } = $cgiparams { 'ENABLE_BLUE' };
106 $settings { 'AUTH' } = $cgiparams { 'AUTH' };
107 $settings { 'TITLE' } = & Header
:: escape
( $cgiparams { 'TITLE' });
108 $settings { 'COLOR' } = $cgiparams { 'COLOR' };
109 $settings { 'SESSION_TIME' } = $cgiparams { 'SESSION_TIME' };
112 #Check if we need to upload a new logo
115 my ( $filehandle ) = CGI
:: upload
( "logo" );
119 open ( FILE
, "> $logo " );
121 while (< $filehandle >) {
127 & General
:: writehash
( " $settingsfile " , \
%settings );
130 $cgiparams { 'TERMS' } = & Header
:: escape
( $cgiparams { 'TERMS' });
131 open ( FH
, ">:utf8" , "/var/ipfire/captive/terms.txt" ) or die ( "$!" );
132 print FH
$cgiparams { 'TERMS' };
134 $cgiparams { 'TERMS' } = "" ;
136 #execute binary to reload firewall rules
137 system ( "/usr/local/bin/captivectrl" );
139 if ( $cgiparams { 'ENABLE_BLUE' } eq 'on' ){
140 system ( "/usr/local/bin/wirelessctrl" );
145 if ( $cgiparams { 'ACTION' } eq " $Lang ::tr{'Captive delete logo'}" ) {
149 if ( $cgiparams { 'ACTION' } eq " $Lang ::tr{'Captive generate coupons'}" ) {
151 if ( $cgiparams { 'REMARK' } ne '' && !& validremark
( $cgiparams { 'REMARK' })){
152 $errormessage = $Lang :: tr
{ 'fwhost err remark' };
155 if (! $errormessage ) {
156 # Remember selected values
157 foreach my $val (( "SESSION_TIME" , "COUNT" , "REMARK" )) {
158 $settings { $val } = $cgiparams { $val };
160 & General
:: writehash
( $settingsfile , \
%settings );
162 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
165 # Expiry time in seconds
166 my $expires = $settings { 'SESSION_TIME' };
168 my $count = $settings { 'COUNT' } || 1 ;
169 while ( $count -- > 0 ) {
170 # Generate a new code
171 my $code = & gencode
();
173 # Check if the coupon code already exists
174 foreach my $key ( keys %couponhash ) {
175 if ( $couponhash { $key }[ 1 ] eq $code ) {
176 # Code already exists, so try again
183 next if ( $code eq "" );
185 # Get a new key from hash
186 my $key = & General
:: findhasharraykey
( \
%couponhash );
188 # Initialize all fields
189 foreach my $i ( 0 .. 3 ) { $couponhash { $key }[ $i ] = "" ; }
191 $couponhash { $key }[ 0 ] = $now ;
192 $couponhash { $key }[ 1 ] = $code ;
193 $couponhash { $key }[ 2 ] = $expires ;
194 $couponhash { $key }[ 3 ] = $settings { 'REMARK' };
197 # Save everything to disk
198 & General
:: writehasharray
( $coupons , \
%couponhash );
202 if ( $cgiparams { 'ACTION' } eq 'delete-coupon' ) {
203 #deletes an already generated but unused voucher
205 #read all generated vouchers
206 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
207 foreach my $key ( keys %couponhash ) {
208 if ( $cgiparams { 'key' } eq $couponhash { $key }[ 0 ]){
209 #write logenty with decoded remark
210 my $rem = HTML
:: Entities
:: decode_entities
( $couponhash { $key }[ 4 ]);
211 & General
:: log ( "Captive" , "Delete unused coupon $couponhash { $key }[1] $couponhash { $key }[2] hours valid expires on $couponhash { $key }[3] remark $rem " );
212 #delete line from hash
213 delete $couponhash { $key };
218 & General
:: writehasharray
( $coupons , \
%couponhash );
221 if ( $cgiparams { 'ACTION' } eq 'delete-client' ) {
222 #delete voucher and connection in use
224 #read all active clients
225 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
226 foreach my $key ( keys %clientshash ) {
227 if ( $cgiparams { 'key' } eq $clientshash { $key }[ 0 ]){
228 #prepare log entry with decoded remark
229 my $rem = HTML
:: Entities
:: decode_entities
( $clientshash { $key }[ 7 ]);
231 & General
:: log ( "Captive" , "Deleted client in use $clientshash { $key }[1] $clientshash { $key }[2] hours valid expires on $clientshash { $key }[3] remark $rem - Connection will be terminated" );
232 #delete line from hash
233 delete $clientshash { $key };
238 & General
:: writehasharray
( " $clients " , \
%clientshash );
239 #reload firewallrules to kill connection of client
240 system ( "/usr/local/bin/captivectrl" );
243 #open webpage, print header and open box
244 & Header
:: openpage
( $Lang :: tr
{ 'Captive' }, 1 , '' );
245 & Header
:: openbigbox
();
247 # If an error message exists, show a box with the error message
249 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
254 # Prints the config box on the website
255 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive config' });
257 <form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype="multipart/form-data"> \n
258 <table width='100%' border="0">
262 #check which parameters have to be enabled (from settings file)
263 $checked { 'ENABLE_GREEN' }{ 'off' } = '' ;
264 $checked { 'ENABLE_GREEN' }{ 'on' } = '' ;
265 $checked { 'ENABLE_GREEN' }{ $settings { 'ENABLE_GREEN' }} = "checked='checked'" ;
267 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
268 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
269 $checked { 'ENABLE_BLUE' }{ $settings { 'ENABLE_BLUE' }} = "checked='checked'" ;
271 $checked { 'UNLIMITED' }{ 'off' } = '' ;
272 $checked { 'UNLIMITED' }{ 'on' } = '' ;
273 $checked { 'UNLIMITED' }{ $settings { 'UNLIMITED' }} = "checked='checked'" ;
275 $selected { 'AUTH' } = ();
276 $selected { 'AUTH' }{ 'COUPON' } = "" ;
277 $selected { 'AUTH' }{ 'TERMS' } = "" ;
278 $selected { 'AUTH' }{ $settings { 'AUTH' }} = "selected" ;
280 if ( $netsettings { 'GREEN_DEV' }){
284 $Lang ::tr{'Captive active on'}
285 <font color=' $Header ::colourgreen'> $Lang ::tr{'green'}</font>
288 <input type='checkbox' name='ENABLE_GREEN' $checked {'ENABLE_GREEN'}{'on'} />
294 if ( $netsettings { 'BLUE_DEV' }){
298 $Lang ::tr{'Captive active on'}
299 <font color=' $Header ::colourblue'> $Lang ::tr{'blue'}</font>
302 <input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} />
311 $Lang ::tr{'Captive authentication'}
315 <option value="TERMS" $selected {'AUTH'}{'TERMS'} > $Lang ::tr{'Captive terms'}</option>
316 <option value="COUPON" $selected {'AUTH'}{'COUPON'}> $Lang ::tr{'Captive coupon'}</option>
323 if ( $settings { 'AUTH' } eq 'TERMS' ) {
324 $selected { 'SESSION_TIME' } = ();
325 foreach my $session_time ( keys %session_times ) {
326 $selected { 'SESSION_TIME' }{ $session_time } = "" ;
328 $selected { 'SESSION_TIME' }{ $settings { 'SESSION_TIME' }} = "selected" ;
332 <td> $Lang ::tr{'Captive client session expiry time'}</td>
334 <select name="SESSION_TIME">
337 foreach my $session_time ( sort { $a <=> $b } keys %session_times ) {
339 <option value=" $session_time " $selected {'SESSION_TIME'}{ $session_time }>
340 $session_times { $session_time }
356 <strong> $Lang ::tr{'Captive branding'}</strong>
361 $Lang ::tr{'Captive title'}
364 <input type='text' name='TITLE' value=" $settings {'TITLE'}" size='40'>
368 <td> $Lang ::tr{'Captive brand color'}</td>
370 <input type="color" name="COLOR" value=" $settings {'COLOR'}">
375 $Lang ::tr{'Captive upload logo'}
378 <input type="file" name="logo">
379 <br> $Lang ::tr{'Captive upload logo recommendations'}
387 <td> $Lang ::tr{'Captive logo uploaded'}</td>
389 $Lang ::tr{'yes'}
390 <input type='submit' name='ACTION' value=" $Lang ::tr{'Captive delete logo'}"/>
396 my $terms = & getterms
();
399 <td> $Lang ::tr{'Captive terms'}</td>
401 <textarea cols="50" rows="10" name="TERMS"> $terms </textarea>
407 <input type='submit' name='ACTION' value=" $Lang ::tr{'save'}"/>
415 #if settings is set to use coupons, the coupon part has to be displayed
416 if ( $settings { 'AUTH' } eq 'COUPON' ) {
420 # Show active clients
426 open ( FILE
, "<:utf8" , "/var/ipfire/captive/terms.txt" );
428 push ( @ret , HTML
:: Entities
:: decode_entities
( $_ ));
432 return join ( /\n/ , @ret );
436 #generate a random code only letters from A-Z except 'O' and 0-9
437 my @chars = ( "A" .. "N" , "P" .. "Z" , "0" .. "9" );
439 $randomstring .= $chars [ rand @chars ] for 1 . .8 ;
440 return $randomstring ;
444 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive generate coupons' });
446 $selected { 'SESSION_TIME' } = ();
447 foreach my $session_time ( keys %session_times ) {
448 $selected { 'SESSION_TIME' }{ $session_time } = "" ;
450 $selected { 'SESSION_TIME' }{ $settings { 'SESSION_TIME' }} = "selected" ;
453 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
454 <table border='0' width='100%'>
457 $Lang ::tr{'Captive vouchervalid'}
460 <select name="SESSION_TIME">
463 foreach my $session_time ( sort { $a <=> $b } keys %session_times ) {
465 <option value=" $session_time " $selected {'SESSION_TIME'}{ $session_time }>
466 $session_times { $session_time }
476 <td> $Lang ::tr{'remark'}</td>
478 <input type='text' name='REMARK' size=40>
482 <td> $Lang ::tr{'Captive generated coupon no'}</td>
484 <select name="COUNT">
485 <option value="1">1</option>
486 <option value="2">2</option>
487 <option value="3">3</option>
488 <option value="4">4</option>
489 <option value="5">5</option>
490 <option value="6">6</option>
491 <option value="7">7</option>
492 <option value="8">8</option>
493 <option value="9">9</option>
494 <option value="10">10</option>
495 <option value="20">20</option>
496 <option value="50">50</option>
497 <option value="100">100</option>
504 <input type="submit" name="ACTION" value=" $Lang ::tr{'Captive generate coupons'}">
511 # Show all coupons if exist
517 sub cleanup_expired_coupons
520 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
521 foreach my $key ( keys %clientshash ) {
523 #calculate endtime from clientshash
525 if ( $clientshash { $key }[ 3 ] > '0' ){
526 $endtime = $clientshash { $key }[ 2 ]+ $clientshash { $key }[ 3 ];
527 if ( $acttime > $endtime ) {
528 delete $clientshash { $key };
533 & General
:: writehasharray
( " $clients " , \
%clientshash );
537 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
539 #if there are already generated but unsused coupons, print a table
540 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive issued coupons' });
543 <table class='tbl' border='0'>
545 <th align='center' width='15%'>
546 $Lang ::tr{'Captive coupon'}
548 <th align='center' width='15%'> $Lang ::tr{'Captive expiry time'}</th>
549 <th align='center' width='65%'> $Lang ::tr{'remark'}</th>
550 <th align='center' width='5%'> $Lang ::tr{'delete'}</th>
554 foreach my $key ( keys %couponhash ) {
555 my $expirytime = $Lang :: tr
{ 'Captive nolimit' };
556 if ( $couponhash { $key }[ 2 ] > 0 ) {
557 $expirytime = & General
:: format_time
( $couponhash { $key }[ 2 ]);
561 $col = "bgcolor=' $color {'color20'}'" ;
563 $col = "bgcolor=' $color {'color22'}'" ;
568 <td $col align="center">
569 <b> $couponhash { $key }[1]</b>
571 <td $col align="center">
574 <td $col align="center">
577 <td $col align="center">
579 <input type='image' src='/images/delete.gif' align='middle' alt=' $Lang ::tr{'delete'}' title=' $Lang ::tr{'delete'}' />
580 <input type='hidden' name='ACTION' value='delete-coupon' />
581 <input type='hidden' name='key' value=' $couponhash { $key }[0]' />
594 <input type="hidden" name="ACTION" value="export-coupons">
595 <input type="submit" value=" $Lang ::tr{'Captive export coupons'}">
604 # if there are active clients which use coupons show table
605 return if ( - z
$clients || ! - f
$clients );
610 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive clients' });
613 <table class='tbl' width='100%'>
615 <th align='center' width='15%'> $Lang ::tr{'Captive coupon'}</th>
616 <th align='center' width='15%'> $Lang ::tr{'Captive activated'}</th>
617 <th align='center' width='15%'> $Lang ::tr{'Captive expiry time'}</th>
618 <th align='center' width='10%'> $Lang ::tr{'Captive mac'}</th>
619 <th align='center' width='43%'> $Lang ::tr{'remark'}</th>
620 <th align='center' width='5%'> $Lang ::tr{'delete'}</th>
623 & cleanup_expired_coupons
();
624 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
625 foreach my $key ( sort { $clientshash { $a }[ 2 ] <=> $clientshash { $b }[ 2 ]} keys %clientshash ) {
626 #calculate time from clientshash (starttime)
627 my $starttime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]));
629 #calculate endtime from clientshash
631 if ( $clientshash { $key }[ 3 ] eq '0' ){
632 $endtime = $Lang :: tr
{ 'Captive nolimit' };
634 $endtime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]+ $clientshash { $key }[ 3 ]));
638 $col = "bgcolor=' $color {'color20'}'" ;
640 $col = "bgcolor=' $color {'color22'}'" ;
643 my $coupon = ( $clientshash { $key }[ 4 ] eq "LICENSE" ) ?
$Lang :: tr
{ 'Captive terms short' } : $clientshash { $key }[ 4 ];
647 <td $col align="center"><b> $coupon </b></td>
648 <td $col align="center"> $starttime </td>
649 <td $col align="center"> $endtime </td>
650 <td $col align="center"> $clientshash { $key }[0]</td>
651 <td $col align="center"> $clientshash { $key }[5]</td>
652 <td $col align="center">
654 <input type='image' src='/images/delete.gif' align='middle' alt=' $Lang ::tr{'delete'}' title=' $Lang ::tr{'delete'}' />
655 <input type='hidden' name='ACTION' value='delete-client' />
656 <input type='hidden' name='key' value=' $clientshash { $key }[0]' />
670 # Checks a hostname against RFC1035
672 # Each part should be at least two characters in length
673 # but no more than 63 characters
674 if ( length ( $remark ) < 1 || length ( $remark ) > 255 ) {
676 # Only valid characters are a-z, A-Z, 0-9 and -
677 if ( $remark !~ /^[a-zäöüA-ZÖÄÜ0-9-.:;\|_()\/ \s
]*$/) {
679 # First character can only be a letter or a digit
680 if ( substr ( $remark , 0 , 1 ) !~ /^[a-zäöüA-ZÖÄÜ0-9]*$/ ) {
682 # Last character can only be a letter or a digit
683 if ( substr ( $remark , - 1 , 1 ) !~ /^[a-zöäüA-ZÖÄÜ0-9.:;_)]*$/ ) {
689 my $pdf = PDF
:: API2
-> new ();
691 my ( $sec , $min , $hour , $mday , $mon , $year , $wday , $yday , $isdst ) = gmtime ( time );
692 my $timestamp = sprintf ( "D: %04d %02d %02d %02d %02d %02d +00;00" , $year + 1900 , $mon + 1 , $mday , $hour , $min , $sec );
695 "Creator" => $Lang :: tr
{ 'Captive portal' },
696 "Title" => $Lang :: tr
{ 'Captive portal coupons' },
697 "CreationDate" => $timestamp ,
698 "ModDate" => $timestamp ,
702 $pdf -> mediabox ( "A4" );
703 $pdf -> trimbox ( 28 /mm, 27/mm , 182 /mm, 270/mm );
706 my $font = $pdf -> ttfont ( "/usr/share/fonts/Ubuntu-R.ttf" );
708 my $page_h_margin = 27 / mm
;
709 my $page_v_margin = 28 / mm
;
716 my $tux_image = $pdf -> image_png ( "/srv/web/ipfire/html/captive/assets/ipfire.png" );
717 my $logo_height = 12 / mm
;
718 my $logo_width = 12 / mm
;
721 my %coupon_expiry_times = ();
724 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
725 foreach my $key ( keys %couponhash ) {
726 $coupon_expiry_times { $couponhash { $key }[ 1 ]} = $couponhash { $key }[ 2 ];
727 push @coupons , $couponhash { $key }[ 1 ];
732 my $page = $pdf -> page ();
738 my $f_headline = $page -> text ();
739 $f_headline -> font ( $font , 20 );
742 my $f_subheadline = $page -> text ();
743 $f_subheadline -> font ( $font , 14 );
746 my $f_coupon = $page -> text ();
747 $f_coupon -> font ( $font , 36 );
750 my $f_lifetime = $page -> text ();
751 $f_lifetime -> font ( $font , 14 );
754 my $f_watermark = $page -> text ();
755 $f_watermark -> fillcolor ( "#666666" );
756 $f_watermark -> font ( $font , 10 );
759 while ( @coupons && $i < 8 ) {
760 my $coupon = shift @coupons ;
763 my $x = ( $page_v_margin / 2 ) + (( $i % 2 ) ?
$width : 0 );
764 my $y = ( $page_h_margin / 2) + (int($i / 2 ) * $height );
766 # Weidth and height of the box
767 my $w = $width - $margin ;
768 my $h = $height - $margin ;
771 my $cx = $x + ( $w / 2 );
772 my $cy = $y + ( $h / 2 );
775 $gfx -> strokecolor ( "#333333" );
776 $gfx -> linedash ( 1 /mm, 1/mm );
777 $gfx -> rect ( $x , $y , $w , $h );
782 $f_headline -> translate ( $cx , ( $y + $h - $cy ) / 1.7 + $cy );
783 $f_subheadline -> translate ( $cx , ( $y + $h - $cy ) / 2.4 + $cy );
785 if ( $settings { 'TITLE' }) {
786 $f_headline -> text_center ( decode
( "utf8" , $settings { 'TITLE' }));
787 $f_subheadline -> text_center ( decode
( "utf8" , $Lang :: tr
{ 'Captive WiFi coupon' }));
789 $f_headline -> text_center ( decode
( "utf8" , $Lang :: tr
{ 'Captive WiFi coupon' }));
793 $f_coupon -> translate ( $cx , $cy );
794 $f_coupon -> text_center ( decode
( "utf8" , $coupon ));
797 my $expiry_time = $coupon_expiry_times { $coupon };
798 $f_lifetime -> translate ( $cx , $cy - ( $y + $h - $cy ) / 4 );
799 if ( $expiry_time > 0 ) {
800 my $lifetime = & General
:: format_time
( $expiry_time );
801 $f_lifetime -> text_center ( decode
( "utf8" , $Lang :: tr
{ 'Captive valid for' } . " " . $lifetime ));
803 $f_lifetime -> text_center ( decode
( "utf8" , $Lang :: tr
{ 'Captive nolimit' }));
807 $gfx -> image ( $tux_image , $x + $w - $logo_width - $margin , $y + $margin , $logo_width , $logo_height );
808 $f_watermark -> translate ( $x + $w - ( $margin * 2 ) - $logo_width , $y + ( $logo_height / 2 ));
809 $f_watermark -> text_right ( "Powered by IPFire" );
815 # Write out the PDF document
816 return $pdf -> stringify ();
819 & Header
:: closebigbox
();
820 & Header
:: closepage
();