]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/captive.cgi
85b9c5d19e0c4aeeb7c0282b2d1568896f8aec66
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 ###############################################################################
26 # enable only the following on debugging purpose
28 #use CGI::Carp 'fatalsToBrowser';
30 require '/var/ipfire/general-functions.pl' ;
31 require "${General::swroot}/lang.pl" ;
32 require "${General::swroot}/header.pl" ;
34 my $coupons = "${General::swroot}/captive/coupons" ;
44 my $clients = "${General::swroot}/captive/clients" ;
46 my $settingsfile = "${General::swroot}/captive/settings" ;
47 my $logopath = "/srv/web/ipfire/html/captive/logo" ;
48 unless (- e
$settingsfile ) { system ( "touch $settingsfile " ); }
50 & Header
:: getcgihash
( \
%cgiparams );
52 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
53 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
54 & General
:: readhash
( " $settingsfile " , \
%settings ) if (- f
$settingsfile );
55 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
57 & Header
:: showhttpheaders
();
60 if ( $cgiparams { 'ACTION' } eq " $Lang ::tr{'save'}" ){
61 my $file = $cgiparams { 'uploaded_file' };
63 #Check if extension is png
65 my ( $name , $path , $ext ) = fileparse
( $file , qr/\.[^.]*$/ );
67 $errormessage = $Lang :: tr
{ 'Captive wrong ext' };
71 $settings { 'ENABLE_GREEN' } = $cgiparams { 'ENABLE_GREEN' };
72 $settings { 'ENABLE_BLUE' } = $cgiparams { 'ENABLE_BLUE' };
73 $settings { 'AUTH' } = $cgiparams { 'AUTH' };
74 $settings { 'TITLE' } = $cgiparams { 'TITLE' };
75 $settings { 'UNLIMITED' } = $cgiparams { 'UNLIMITED' };
76 $settings { 'COLOR' } = $cgiparams { 'COLOR' };
79 #Check if we need to upload a new logo
82 my ( $filehandle ) = CGI
:: upload
( 'uploaded_file' );
83 open ( UPLOADFILE
, "> $logopath /logo.png" );
85 while ( < $filehandle > ) {
90 #Open file to check if dimensions are within rang
91 open ( PNG
, "< $logopath /logo.png" );
95 my ( $width , $height )=& pngsize
( $PNG1 );
96 if ( $width > 1920 || $height > 800 || $width < 1280 || $height < 400 ){
97 $errormessage .= " $Lang ::tr{'Captive invalid logosize'} <br>Filedimensions width: $width height: $height " ;
98 unlink ( " $logopath /logo.png" );
102 & General
:: writehash
( " $settingsfile " , \
%settings );
105 if ( $cgiparams { 'TERMS' }){
106 $cgiparams { 'TERMS' } = & Header
:: escape
( $cgiparams { 'TERMS' });
107 open ( FH
, ">:utf8" , "/var/ipfire/captive/terms.txt" ) or die ( "$!" );
108 print FH
$cgiparams { 'TERMS' };
110 $cgiparams { 'TERMS' } = "" ;
113 #execute binary to reload firewall rules
114 system ( "/usr/local/bin/captivectrl" );
116 if ( $cgiparams { 'ENABLE_BLUE' } eq 'on' ){
117 system ( "/usr/local/bin/wirelessctrl" );
122 if ( $cgiparams { 'ACTION' } eq " $Lang ::tr{'Captive generate coupon'}" ){
123 # Generates a new coupon
125 #calculate expiredate
127 if ( $settings { 'UNLIMITED' } eq 'on' ){
128 $expire = $Lang :: tr
{ 'Captive nolimit' };
130 $settings { 'EXPIRE' } = $cgiparams { 'EXP_HOUR' }+ $cgiparams { 'EXP_DAY' }+ $cgiparams { 'EXP_WEEK' }+ $cgiparams { 'EXP_MONTH' };
131 $expire = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( time ()+ $settings { 'EXPIRE' }));
135 if ( $cgiparams { 'EXP_HOUR' }+ $cgiparams { 'EXP_DAY' }+ $cgiparams { 'EXP_WEEK' }+ $cgiparams { 'EXP_MONTH' } == 0 && $cgiparams { 'UNLIMITED' } == '' ){
136 $errormessage = $Lang :: tr
{ 'Captive noexpiretime' };
138 #check if we already have a coupon with same code
139 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
140 foreach my $key ( keys %couponhash ) {
141 if ( $couponhash { $key }[ 1 ] eq $cgiparams { 'CODE' }){
142 $errormessage = $Lang :: tr
{ 'Captive err doublevoucher' };
148 if ( $cgiparams { 'REMARK' } ne '' && !& validremark
( $cgiparams { 'REMARK' })){
149 $errormessage = $Lang :: tr
{ 'fwhost err remark' };
152 #if no error detected, write to disk
154 my $date = time (); #seconds in utc
156 #first get new key from hash
157 my $key =& General
:: findhasharraykey
( \
%couponhash );
158 #initialize all fields with ''
159 foreach my $i ( 0 .. 3 ) { $couponhash { $key }[ $i ] = "" ;}
161 $couponhash { $key }[ 0 ] = $date ;
162 $couponhash { $key }[ 1 ] = $cgiparams { 'CODE' };
163 $couponhash { $key }[ 2 ] = $settings { 'EXPIRE' };
164 $couponhash { $key }[ 3 ] = $cgiparams { 'REMARK' };
165 #write values to disk
166 & General
:: writehasharray
( $coupons , \
%couponhash );
168 #now prepare log entry, get expiring date for voucher and decode remark for logfile
169 my $expdate = localtime ( time ()+ $couponhash { $key }[ 3 ]);
170 my $rem = HTML
:: Entities
:: decode_entities
( $couponhash { $key }[ 4 ]);
173 & General
:: log ( "Captive" , "Generated new coupon $couponhash { $key }[1] $couponhash { $key }[2] hours valid expires on $expdate remark $rem " );
177 if ( $cgiparams { 'ACTION' } eq 'delete-coupon' ) {
178 #deletes an already generated but unused voucher
180 #read all generated vouchers
181 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
182 foreach my $key ( keys %couponhash ) {
183 if ( $cgiparams { 'key' } eq $couponhash { $key }[ 0 ]){
184 #write logenty with decoded remark
185 my $rem = HTML
:: Entities
:: decode_entities
( $couponhash { $key }[ 4 ]);
186 & General
:: log ( "Captive" , "Delete unused coupon $couponhash { $key }[1] $couponhash { $key }[2] hours valid expires on $couponhash { $key }[3] remark $rem " );
187 #delete line from hash
188 delete $couponhash { $key };
193 & General
:: writehasharray
( $coupons , \
%couponhash );
196 if ( $cgiparams { 'ACTION' } eq 'delete-client' ) {
197 #delete voucher and connection in use
199 #read all active clients
200 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
201 foreach my $key ( keys %clientshash ) {
202 if ( $cgiparams { 'key' } eq $clientshash { $key }[ 0 ]){
203 #prepare log entry with decoded remark
204 my $rem = HTML
:: Entities
:: decode_entities
( $clientshash { $key }[ 7 ]);
206 & 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" );
207 #delete line from hash
208 delete $clientshash { $key };
213 & General
:: writehasharray
( " $clients " , \
%clientshash );
214 #reload firewallrules to kill connection of client
215 system ( "/usr/local/bin/captivectrl" );
218 #open webpage, print header and open box
219 & Header
:: openpage
( $Lang :: tr
{ 'Captive menu' }, 1 , '' );
220 & Header
:: openbigbox
();
222 #call error() to see if we have to print an errormessage on website
225 #call config() to display the configuration box
231 open ( FILE
, "<:utf8" , "/var/ipfire/captive/terms.txt" );
233 push ( @ret , HTML
:: Entities
:: decode_entities
( $_ ));
237 return join ( /\n/ , @ret );
241 #prints the config box on the website
242 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive config' });
244 <form method='post' action=' $ENV {'SCRIPT_NAME'}' enctype="multipart/form-data"> \n
245 <table width='100%' border="0">
249 #check which parameters have to be enabled (from settings file)
250 $checked { 'ENABLE_GREEN' }{ 'off' } = '' ;
251 $checked { 'ENABLE_GREEN' }{ 'on' } = '' ;
252 $checked { 'ENABLE_GREEN' }{ $settings { 'ENABLE_GREEN' }} = "checked='checked'" ;
254 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
255 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
256 $checked { 'ENABLE_BLUE' }{ $settings { 'ENABLE_BLUE' }} = "checked='checked'" ;
258 $checked { 'UNLIMITED' }{ 'off' } = '' ;
259 $checked { 'UNLIMITED' }{ 'on' } = '' ;
260 $checked { 'UNLIMITED' }{ $settings { 'UNLIMITED' }} = "checked='checked'" ;
262 if ( $netsettings { 'GREEN_DEV' }){
263 print "<td width='30%'> $Lang ::tr{'Captive active on'} <font color='$Header::colourgreen'>Green</font></td><td><input type='checkbox' name='ENABLE_GREEN' $checked{'ENABLE_GREEN'}{'on'} /></td></tr>" ;
265 if ( $netsettings { 'BLUE_DEV' }){
266 print "<td width='30%'> $Lang ::tr{'Captive active on'} <font color='$Header::colourblue'>Blue</font></td><td><input type='checkbox' name='ENABLE_BLUE' $checked{'ENABLE_BLUE'}{'on'} /></td></tr>" ;
273 $Lang ::tr{'Captive title'}
276 <input type='text' name='TITLE' value=" $settings {'TITLE'}" size='40'>
285 $Lang ::tr{'Captive authentication'}
291 print "<option value='TERMS' " ;
292 print " selected='selected'" if ( $settings { 'AUTH' } eq 'TERMS' );
293 print "> $Lang ::tr{'Captive terms'}</option>" ;
295 print "<option value='COUPON' " ;
296 print " selected='selected'" if ( $settings { 'AUTH' } eq 'COUPON' );
297 print "> $Lang ::tr{'Captive coupon'}</option>" ;
305 if ( $settings { 'AUTH' } eq 'TERMS' ) {
306 my $terms = & getterms
();
311 <textarea cols="50" rows="10" name="TERMS"> $terms </textarea>
318 print "<tr><td><br> $Lang ::tr{'Captive logo_upload'}<br> $Lang ::tr{'Captive logo_upload1'}</td><td><br><INPUT TYPE='file' NAME='uploaded_file' SIZE=30 MAXLENGTH=80></td></tr><tr>" ;
319 #Show Logo in webinterface with 1/2 size if set
320 if (- f
" $logopath /logo.png" ){
321 print "<td> $Lang ::tr{'Captive logo_set'}</td>" ;
322 print "<td><img src='/captive/logo/logo.png' alt=' $logopath /logo.png' width='25%' height='25%' /></td></tr>" ;
324 print "<td> $Lang ::tr{'Captive logo_set'}</td>" ;
325 print "<td><br> $Lang ::tr{'no'}</td></tr>" ;
329 <td> $Lang ::tr{'Captive brand color'}</td>
331 <input type="color" name="COLOR" value=" $settings {'COLOR'}">
339 <input type='submit' name='ACTION' value=" $Lang ::tr{'save'}"/>
350 #if settings is set to use coupons, the coupon part has to be displayed
351 if ( $settings { 'AUTH' } eq 'COUPON' ){
354 #otherwise we show the licensepart
355 & show_license_connections
();
360 #generate a random code only letters from A-Z except 'O' and 0-9
361 my @chars = ( "A" .. "N" , "P" .. "Z" , "0" .. "9" );
363 $randomstring .= $chars [ rand @chars ] for 1 . .8 ;
364 return $randomstring ;
368 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive generate coupon' });
369 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'>" ;
370 print "<table border='0' width='100%'>" ;
371 print "<tr><td width='30%'><br> $Lang ::tr{'Captive vouchervalid'}</td><td width='70%'><br>" ;
373 print "<table class='tbl' border='0' width='100%'>" ;
374 print "<th> $Lang ::tr{'hours'}</th><th> $Lang ::tr{'days'}</th><th> $Lang ::tr{'weeks'}</th><th> $Lang ::tr{'months'}</th><th></th><th></th>" ;
376 #print hour-dropdownbox
378 print "<tr height='40px'><td><select name='EXP_HOUR' style='width:8em;'>" ;
379 print "<option value='0' " ;
380 print " selected='selected'" if ( $settings { 'EXP_HOUR' } eq '0' );
381 print ">--</option>" ;
382 for ( my $i = 1 ; $i < 25 ; $i ++){
383 my $exp_sec = $i * $hrs ;
384 print "<option value=' $exp_sec ' " ;
385 print " selected='selected'" if ( $settings { 'EXP_HOUR' } eq $exp_sec );
386 print "> $i </option>" ;
390 #print day-dropdownbox
392 print "<select name='EXP_DAY' style='width:8em;'>" ;
393 print "<option value='0' " ;
394 print " selected='selected'" if ( $settings { 'EXP_DAY' } eq '0' );
395 print ">--</option>" ;
396 for ( my $i = 1 ; $i < 8 ; $i ++){
397 my $exp_sec = $i * $days ;
398 print "<option value=' $exp_sec ' " ;
399 print " selected='selected'" if ( $settings { 'EXP_DAY' } eq $exp_sec );
400 print "> $i </option>" ;
404 #print week-dropdownbox
406 print "<select name='EXP_WEEK' style='width:8em;'>" ;
407 print "<option value='0' " ;
408 print " selected='selected'" if ( $settings { 'EXP_WEEK' } eq '0' );
409 print ">--</option>" ;
410 for ( my $i = 1 ; $i < 5 ; $i ++){
411 my $exp_sec = $i * $week ;
412 print "<option value=' $exp_sec ' " ;
413 print " selected='selected'" if ( $settings { 'EXP_WEEK' } eq $exp_sec );
414 print "> $i </option>" ;
418 #print month-dropdownbox
419 my $month = 3600 * 24 * 30 ;
420 print "<select name='EXP_MONTH' style='width:8em;'>" ;
421 print "<option value='0' " ;
422 print " selected='selected'" if ( $settings { 'EXP_MONTH' } eq '0' );
423 print ">--</option>" ;
424 for ( my $i = 1 ; $i < 13 ; $i ++){
425 my $exp_sec = $i * $month ;
426 print "<option value=' $exp_sec ' " ;
427 print " selected='selected'" if ( $settings { 'EXP_MONTH' } eq $exp_sec );
428 print "> $i </option>" ;
431 print "<td> <input type='checkbox' name='UNLIMITED' $checked {'UNLIMITED'}{'on'} /></td><td> <b> $Lang ::tr{'Captive nolimit'}</b></td>" ;
432 print "</tr></table>" ;
434 print "<tr><td><br> $Lang ::tr{'remark'}</td><td><br><input type='text' style='width: 98%;' name='REMARK' align='left'></td></tr>" ;
435 print "<tr><td> </td><td></td></tr></table><br><br>" ;
436 $cgiparams { 'CODE' } = & gencode
();
437 print "<div align='right'><input type='submit' name='ACTION' value=' $Lang ::tr{'Captive generate coupon'}'><input type='hidden' name='CODE' value=' $cgiparams {'CODE'}'></form></div>" ;
441 # Show all coupons if exist
451 sub show_license_connections
(){
452 #if there are active clients, show the box with active connections
453 return if ( - z
$clients || ! - f
$clients );
456 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive voactive' });
458 <center><table class='tbl'>
460 <th align='center' width='15%'> $Lang ::tr{'Captive coupon'}</th><th th align='center' width='15%'> $Lang ::tr{'Captive activated'}</th><th th align='center' width='15%'> $Lang ::tr{'Captive expire'}</th><th align='center' width='50%'><font size='1'> $Lang ::tr{'Captive mac'}</th><th th align='center' width='5%'> $Lang ::tr{'delete'}</th></tr>
463 #read all clients from hash and show table
464 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
465 foreach my $key ( keys %clientshash ){
466 my $starttime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]));
468 if ( $clientshash { $key }[ 3 ] eq '0' ){
469 $endtime = $Lang :: tr
{ 'Captive nolimit' };
471 $endtime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]+ $clientshash { $key }[ 3 ]));
476 $col = "bgcolor=' $color {'color20'}'" ;
478 $col = "bgcolor=' $color {'color22'}'" ;
481 print "<td $col ><center> $clientshash { $key }[4]</td><td $col ><center> $starttime " ;
482 print "</center></td><td $col ><center> $endtime " ;
483 print "</td><td $col ><center> $clientshash { $key }[0]</td><td $col ><form method='post'><center><input type='image' src='/images/delete.gif' align='middle' alt=' $Lang ::tr{'delete'}' title=' $Lang ::tr{'delete'}' /><form method='post'><input type='hidden' name='ACTION' value='delete-client' /><input type='hidden' name='key' value=' $clientshash { $key }[0]' /></form></tr>" ;
492 #if there are already generated but unsused coupons, print a table
495 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive vout' });
497 <center><table class='tbl' border='0'>
499 <th align='center' width='15%'> $Lang ::tr{'Captive coupon'}</th><th align='center' width='15%'> $Lang ::tr{'date'}</th><th th align='center' width='15%'> $Lang ::tr{'Captive expire'}</th><th align='center' width='60%'> $Lang ::tr{'remark'}</th><th align='center' width='5%'> $Lang ::tr{'delete'}</th></tr>
502 & General
:: readhasharray
( $coupons , \
%couponhash ) if (- e
$coupons );
503 foreach my $key ( keys %couponhash )
505 my $starttime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $couponhash { $key }[ 0 ]));
507 if ( $couponhash { $key }[ 2 ] eq '0' ){
508 $endtime = $Lang :: tr
{ 'Captive nolimit' };
510 $endtime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( time ()+ $couponhash { $key }[ 2 ]));
515 $col = "bgcolor=' $color {'color20'}'" ;
517 $col = "bgcolor=' $color {'color22'}'" ;
521 print "<td $col ><center><b> $couponhash { $key }[1]</b></td>" ;
522 print "<td $col ><center> $starttime </td>" ;
523 print "<td $col ><center> $endtime </td>" ;
524 print "<td $col align='center'> $couponhash { $key }[3]</td>" ;
525 print "<td $col ><form method='post'><center><input type='image' src='/images/delete.gif' align='middle' alt=' $Lang ::tr{'delete'}' title=' $Lang ::tr{'delete'}' /><form method='post'><input type='hidden' name='ACTION' value='delete-coupon' /><input type='hidden' name='key' value=' $couponhash { $key }[0]' /></form></tr>" ;
534 #if there are active clients which use coupons show table
535 return if ( - z
$clients || ! - f
$clients );
538 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'Captive voactive' });
540 <center><table class='tbl' width='100%'>
542 <th align='center' width='15%'> $Lang ::tr{'Captive coupon'}</th><th th align='center' width='15%'> $Lang ::tr{'Captive activated'}</th><th align='center' width='15%'> $Lang ::tr{'Captive expire'}</th><th align='center' width='10%'> $Lang ::tr{'Captive mac'}</th><th align='center' width='43%'> $Lang ::tr{'remark'}</th><th th align='center' width='5%'> $Lang ::tr{'delete'}</th></tr>
545 & General
:: readhasharray
( $clients , \
%clientshash ) if (- e
$clients );
546 foreach my $key ( keys %clientshash )
548 #calculate time from clientshash (starttime)
549 my $starttime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]));
550 #calculate endtime from clientshash
552 if ( $clientshash { $key }[ 3 ] eq '0' ){
553 $endtime = $Lang :: tr
{ 'Captive nolimit' };
555 $endtime = sub { sprintf ' %02d . %02d . %04d %02d : %02d ' , $_ [ 3 ], $_ [ 4 ]+ 1 , $_ [ 5 ]+ 1900 , $_ [ 2 ], $_ [ 1 ] }->( localtime ( $clientshash { $key }[ 2 ]+ $clientshash { $key }[ 3 ]));
560 $col = "bgcolor=' $color {'color20'}'" ;
562 $col = "bgcolor=' $color {'color22'}'" ;
566 print "<td $col ><center><b> $clientshash { $key }[4]</b></td><td $col ><center> $starttime " ;
567 print "</center></td><td $col ><center> $endtime </center></td><td $col ><center> $clientshash { $key }[0]</td><td $col ><center> $clientshash { $key }[5]</center>" ;
568 print "</td><td $col ><form method='post'><center><input type='image' src='/images/delete.gif' align='middle' alt=' $Lang ::tr{'delete'}' title=' $Lang ::tr{'delete'}' /><form method='post'><input type='hidden' name='ACTION' value='delete-client' /><input type='hidden' name='key' value=' $clientshash { $key }[0]' /></form></tr>" ;
578 # Checks a hostname against RFC1035
580 # Each part should be at least two characters in length
581 # but no more than 63 characters
582 if ( length ( $remark ) < 1 || length ( $remark ) > 255 ) {
584 # Only valid characters are a-z, A-Z, 0-9 and -
585 if ( $remark !~ /^[a-zäöüA-ZÖÄÜ0-9-.:;\|_()\/ \s
]*$/) {
587 # First character can only be a letter or a digit
588 if ( substr ( $remark , 0 , 1 ) !~ /^[a-zäöüA-ZÖÄÜ0-9]*$/ ) {
590 # Last character can only be a letter or a digit
591 if ( substr ( $remark , - 1 , 1 ) !~ /^[a-zöäüA-ZÖÄÜ0-9.:;_)]*$/ ) {
598 my ( $width , $height ) = ( undef , undef );
600 if ( $Buffer =~ /IHDR(.{8})/ ) {
602 ( $width , $height ) = unpack ( "NN" , $PNG );
607 return ( $width , $height );
611 #if an errormessage exits, show a box with errormessage
613 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
614 print "<class name='base'> $errormessage \n " ;
615 print " </class> \n " ;
620 & Header
:: closebigbox
();
621 & Header
:: closepage
();