]>
Commit | Line | Data |
---|---|---|
9d386698 AM |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> # | |
6 | # # | |
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. # | |
11 | # # | |
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. # | |
16 | # # | |
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/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | # enable only the following on debugging purpose | |
24 | #use warnings; | |
25 | #use CGI::Carp 'fatalsToBrowser'; | |
26 | ||
27 | require '/var/ipfire/general-functions.pl'; | |
28 | require "${General::swroot}/lang.pl"; | |
29 | require "${General::swroot}/header.pl"; | |
30 | require "/opt/pakfire/lib/functions.pl"; | |
31 | ||
91dd042b | 32 | # If the license has already been accepted. |
9d386698 | 33 | if ( -e "/var/ipfire/main/gpl_accepted" ) { |
91dd042b | 34 | &redirect(); |
9d386698 | 35 | } |
9d386698 | 36 | |
91dd042b | 37 | my %cgiparams; |
9d386698 | 38 | $cgiparams{'ACTION'} = ''; |
91dd042b | 39 | |
9d386698 AM |
40 | &Header::getcgihash(\%cgiparams); |
41 | ||
91dd042b MT |
42 | # Check if the license agreement has been accepted. |
43 | if ($cgiparams{'ACTION'} eq "$Lang::tr{'yes'}" && $cgiparams{'gpl_accepted'} eq '1') { | |
44 | open(FILE, ">/var/ipfire/main/gpl_accepted"); | |
45 | close(FILE); | |
9d386698 | 46 | |
91dd042b | 47 | &redirect(); |
9d386698 AM |
48 | } |
49 | ||
91dd042b MT |
50 | &Header::showhttpheaders(); |
51 | ||
52 | &Header::openpage($Lang::tr{'main page'}, 1); | |
53 | &Header::openbigbox('', 'center'); | |
54 | ||
9d386698 AM |
55 | &Header::openbox('100%', 'left', $Lang::tr{'gpl license agreement'}); |
56 | print <<END; | |
57 | $Lang::tr{'gpl please read carefully the general public license and accept it below'}. | |
58 | <br /><br /> | |
59 | END | |
60 | ; | |
61 | if ( -e "/usr/share/doc/licenses/GPLv3" ) { | |
153cf640 | 62 | print '<textarea rows=\'25\' cols=\'75\' readonly=\'readonly\'>'; |
2a4b9f0e SS |
63 | |
64 | # Open and read-in GPL file content. | |
65 | open(FILE, "/usr/share/doc/licenses/GPLv3"); | |
66 | ||
67 | # Grab license. | |
68 | my @license = <FILE>; | |
69 | ||
70 | # Close filehandle. | |
71 | close(FILE); | |
72 | ||
73 | # Print license to textarea. | |
74 | print "@license"; | |
75 | ||
9d386698 AM |
76 | print '</textarea>'; |
77 | } | |
78 | else { | |
79 | print '<br /><a href=\'http://www.gnu.org/licenses/gpl-3.0.txt\' target=\'_blank\'>GNU GENERAL PUBLIC LICENSE</a><br />'; | |
80 | } | |
81 | print <<END; | |
82 | <p> | |
83 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
84 | <input type='checkbox' name='gpl_accepted' value='1'/> $Lang::tr{'gpl i accept these terms and conditions'}. | |
85 | <br/ > | |
1d55fccd | 86 | <input type='submit' name='ACTION' value='$Lang::tr{'yes'}' /> |
9d386698 AM |
87 | </form> |
88 | </p> | |
89 | <a href='http://www.gnu.org/licenses/translations.html' target='_blank'>$Lang::tr{'gpl unofficial translation of the general public license v3'}</a> | |
90 | ||
91 | END | |
92 | ||
93 | &Header::closebox(); | |
94 | &Header::closebigbox(); | |
95 | &Header::closepage(); | |
91dd042b MT |
96 | |
97 | sub redirect { | |
98 | print "Status: 302 Moved Temporarily\n"; | |
99 | print "Location: index.cgi\n\n"; | |
100 | exit (0); | |
101 | } |