]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/gpl.cgi
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / gpl.cgi
index 5cfbebd15a995567fa1d6bebe7644adcb5001674..029b048e8c3280797beee969d98dd95603cc989d 100644 (file)
@@ -29,37 +29,50 @@ require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 require "/opt/pakfire/lib/functions.pl";
 
-
-my %cgiparams;
-my $refresh;
-
+# If the license has already been accepted.
 if ( -e "/var/ipfire/main/gpl_accepted" ) {
-       print "Status: 302 Moved Temporarily\n";
-       print "Location: index.cgi\n\n";
-       exit (0);
+       &redirect();
 }
-&Header::showhttpheaders();
 
+my %cgiparams;
 $cgiparams{'ACTION'} = '';
+
 &Header::getcgihash(\%cgiparams);
 
-&Header::openpage($Lang::tr{'main page'}, 1, $refresh);
-&Header::openbigbox('', 'center');
+# Check if the license agreement has been accepted.
+if ($cgiparams{'ACTION'} eq "$Lang::tr{'yes'}" && $cgiparams{'gpl_accepted'} eq '1') {
+       open(FILE, ">/var/ipfire/main/gpl_accepted");
+       close(FILE);
 
-# licence agreement
-if ($cgiparams{'ACTION'} eq $Lang::tr{'yes'} && $cgiparams{'gpl_accepted'} eq '1') {
-       system('touch /var/ipfire/main/gpl_accepted');
+       &redirect();
 }
 
+&Header::showhttpheaders();
+
+&Header::openpage($Lang::tr{'main page'}, 1);
+&Header::openbigbox('', 'center');
+
 &Header::openbox('100%', 'left', $Lang::tr{'gpl license agreement'});
 print <<END;
        $Lang::tr{'gpl please read carefully the general public license and accept it below'}.
        <br /><br />
 END
-;      
+;
 if ( -e "/usr/share/doc/licenses/GPLv3" ) {
        print '<textarea rows=\'25\' cols=\'75\' readonly=\'readonly\'>';
-       print `cat /usr/share/doc/licenses/GPLv3`;
+
+       # Open and read-in GPL file content.
+       open(FILE, "/usr/share/doc/licenses/GPLv3");
+
+       # Grab license.
+       my @license = <FILE>;
+
+       # Close filehandle.
+       close(FILE);
+
+       # Print license to textarea.
+       print "@license";
+
        print '</textarea>';
 }
 else {
@@ -70,7 +83,7 @@ print <<END;
                <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='checkbox' name='gpl_accepted' value='1'/> $Lang::tr{'gpl i accept these terms and conditions'}.
                        <br/ >
-                       <input type='submit' name='ACTION' value=$Lang::tr{'yes'} />
+                       <input type='submit' name='ACTION' value='$Lang::tr{'yes'}' />
                </form>
        </p>
        <a href='http://www.gnu.org/licenses/translations.html' target='_blank'>$Lang::tr{'gpl unofficial translation of the general public license v3'}</a>
@@ -80,3 +93,9 @@ END
 &Header::closebox();
 &Header::closebigbox();
 &Header::closepage();
+
+sub redirect {
+       print "Status: 302 Moved Temporarily\n";
+       print "Location: index.cgi\n\n";
+       exit (0);
+}