9667e254bc559c886d05181d8c5ed6de07f57f91
1 <?php
3 /*
4 This code is part of GOsa (https://gosa.gonicus.de)
5 Copyright (C) 2007 Fabian Hickert
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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
23 class Step_License extends setup_step
24 {
25 var $license_found = false;
26 var $License = "";
27 var $header_image = "images/setup/license.png";
28 var $accepted = FALSE;
29 var $attributes = array("accepted");
32 function Step_License()
33 {
34 $this->update_strings();
35 }
38 function load_license()
39 {
40 if(!file_exists("../setup/license.txt")){
41 $this->License = "<font color='red'>License not found. Setup stops here.</font>";
42 $this->license_found = false;
43 }else{
44 $fp = fopen("../setup/license.txt","r");
45 $this->License = "";
46 while (!feof($fp)){
47 $this->License .= fread($fp, 255);
48 }
49 $this->license_found = true;
50 }
51 }
54 function update_strings()
55 {
56 $this->s_title = _("License");
57 $this->s_title_long = _("License");
58 $this->s_info = _("Terms and conditions for usage");
59 }
62 function execute()
63 {
64 $this->load_license();
66 $smarty = get_smarty();
67 $smarty -> assign("License",nl2br($this->License));
68 $smarty -> assign("license_found",$this->license_found);
69 $smarty -> assign("accepted",$this->accepted);
71 return($smarty -> fetch (get_template_path("../setup/setup_license.tpl")));
72 }
75 function save_object()
76 {
77 if(isset($_POST['step_license'])){
78 if(isset($_POST['accepted'])){
79 $this->accepted = TRUE;
80 }else{
81 $this->accepted = FALSE;
82 }
83 }
85 if($this->license_found && $this->accepted){
86 $this->is_completed = true;
87 }else{
88 $this->is_completed = false;
89 }
90 }
91 }
93 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
94 ?>