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_Config3 extends setup_step
24 {
25 var $header_image= "images/ldapserver.png";
26 var $optional = array(
27 "strict_units" => false,
28 "forceglobals" => true,
29 "forcessl" => false,
30 "ldapstats" => false,
31 "warnssl" => true,
32 "ppd_path" => "/var/spool/ppd/",
33 "ppd_path_active" => FALSE,
34 "compile" => "/var/spool/gosa",
35 "debuglevel" => 0,
36 "session_lifetime" => 7200,
37 "max_ldap_query_time" => "5.0",
38 "max_ldap_query_time_active" => FALSE,
40 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
41 "mailQueueScriptPath_active" => FALSE,
43 "auto_network_hook" => "/etc/gosa/net-resolv.sh",
44 "auto_network_hook_active" => FALSE,
46 "notifydir" => "",
47 "notifydir_active" => FALSE,
49 "kioskpath" => "/var/spool/kiosk",
50 "kioskpath_active" => FALSE,
52 "noprimarygroup" => FALSE);
55 function Step_Config3()
56 {
57 $this->update_strings();
58 }
61 function update_strings()
62 {
63 $this->s_title = _("GOsa settings 3/3");
64 $this->s_title_long = _("GOsa settings 3/3");
65 $this->s_info = _("Tweak some GOsa core behaviour");
66 }
69 function execute()
70 {
71 $smarty = get_smarty();
72 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
73 $smarty->assign("optional", $this->optional);
74 foreach($this->attributes as $attr){
75 $smarty->assign($attr,$this->$attr);
76 }
77 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
78 }
81 function save_object()
82 {
83 if(isset($_POST['step6a_posted'])){
85 /* Get attributes */
86 foreach($this->attributes as $attr){
87 if(isset($_POST[$attr])){
88 $this->$attr = validate($_POST[$attr]);
89 }
90 }
92 foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){
93 if(isset($_POST[$name])){
94 $this->optional[$name] = stripslashes($_POST[$name]);
95 }
96 }
98 if(isset($_POST['ppd_path_active'])){
99 $this->optional['ppd_path_active'] = TRUE;
100 if(isset($_POST['ppd_path'])){
101 $this->optional['ppd_path'] = $_POST['ppd_path'];
102 }
103 }else{
104 $this->optional['ppd_path_active'] = FALSE;
105 }
107 if(isset($_POST['max_ldap_query_time_active'])){
108 $this->optional['max_ldap_query_time_active'] = TRUE;
109 if(isset($_POST['max_ldap_query_time'])){
110 $this->optional['max_ldap_query_time'] = $_POST['max_ldap_query_time'];
111 }
112 }else{
113 $this->optional['max_ldap_query_time_active'] = FALSE;
114 }
116 if(isset($_POST['mailQueueScriptPath_active'])){
117 $this->optional['mailQueueScriptPath_active'] = TRUE;
118 if(isset($_POST['mailQueueScriptPath'])){
119 $this->optional['mailQueueScriptPath'] = $_POST['mailQueueScriptPath'];
120 }
121 }else{
122 $this->optional['mailQueueScriptPath_active'] = FALSE;
123 }
125 if(isset($_POST['kioskpath_active'])){
126 $this->optional['kioskpath_active'] = TRUE;
127 if(isset($_POST['kioskpath'])){
128 $this->optional['kioskpath'] = $_POST['kioskpath'];
129 }
130 }else{
131 $this->optional['kioskpath_active'] = FALSE;
132 }
134 if(isset($_POST['auto_network_hook_active'])){
135 $this->optional['auto_network_hook_active'] = TRUE;
136 if(isset($_POST['auto_network_hook'])){
137 $this->optional['auto_network_hook'] = $_POST['auto_network_hook'];
138 }
139 }else{
140 $this->optional['auto_network_hook_active'] = FALSE;
141 }
143 if(isset($_POST['notifydir_active'])){
144 $this->optional['notifydir_active'] = TRUE;
145 if(isset($_POST['notifydir'])){
146 $this->optional['notifydir'] = $_POST['notifydir'];
147 }
148 }else{
149 $this->optional['notifydir_active'] = FALSE;
150 }
151 }
153 $tmp = $this->check();
154 if(count($tmp) == 0){
155 $this->is_completed = TRUE;
156 }else{
157 $this->is_completed = FALSE;
158 }
159 }
162 function check()
163 {
164 $message = array();
166 if(!is_numeric( $this->optional['session_lifetime'])){
167 $message[] = _("Session lifetime must be a numeric value.");
168 }
170 if(!is_numeric( $this->optional['max_ldap_query_time'])){
171 $message[] = _("Maximal ldap query time must be a numeric value. ");
172 }
174 return($message);
175 }
178 /* Attributes that are interesting for configuration generation */
179 function get_attributes()
180 {
181 $tmp = setup_step::get_attributes();
182 foreach(array("optional") as $attr){
183 $tmp[$attr]= $this->$attr;
184 }
185 return($tmp);
186 }
188 }
190 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
191 ?>