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/setup/server.png";
27 var $errorlvl = TRUE;
29 var $login_attributes = array("uid" => "uid",
30 "mail" => "mail",
31 "uid,mail" => "both");
32 var $optional = array(
33 "login_attribute" => "uid",
34 "strict_units" => false,
35 "list_summary" => false,
36 "forceglobals" => true,
37 "forcessl" => false,
38 "ldapstats" => false,
39 "warnssl" => true,
40 "user_filter_cookie" => true,
41 "ppd_path" => "/var/spool/ppd/",
42 "ppd_path_active" => FALSE,
43 "compile" => "/var/spool/gosa",
44 "snmpcommunity" => "goto",
45 "debuglevel" => 0,
46 "session_lifetime" => 7200,
47 "max_ldap_query_time" => "5.0",
48 "max_ldap_query_time_active" => FALSE,
50 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
51 "mailQueueScriptPath_active" => FALSE,
53 "notifydir" => "",
54 "notifydir_active" => FALSE,
56 "gosaSupportURI" => "gosa-si-secret@server:20081",
57 "gosaSupportTimeout" => 15,
58 "gosaSupportURI_active" => FALSE,
60 "uniq_identifier" => "entryCSN",
61 "uniq_identifier_active" => TRUE,
63 "kioskpath" => "/var/spool/kiosk",
64 "kioskpath_active" => FALSE,
66 "sudoou" => "ou=sudoers",
67 "sudoou_active" => FALSE,
69 "noprimarygroup" => FALSE);
71 var $attributes = array("errorlvl");
73 function Step_Config3()
74 {
75 $this->update_strings();
76 }
79 function update_strings()
80 {
81 $this->s_title = _("GOsa settings 3/3");
82 $this->s_title_long = _("GOsa settings 3/3");
83 $this->s_info = _("Tweak some GOsa core behaviour");
84 }
87 function execute()
88 {
90 $cv = $this->parent->captured_values;
91 $this->optional['sudoou'] = preg_replace("/%BASE%/",$cv['base'],$this->optional['sudoou']);
92 $smarty = get_smarty();
93 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
94 $smarty->assign("uniq_identifiers",array( "entryCSN" => "entryCSN",
95 "contextCSN"=>"contextCSN" ));
98 $smarty->assign("optional", reverse_html_entities($this->optional));
99 foreach($this->attributes as $attr){
100 $smarty->assign($attr,reverse_html_entities($this->$attr));
101 }
102 $smarty->assign("login_attributes",$this->login_attributes);
103 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
104 }
107 function save_object()
108 {
109 if(isset($_POST['step6a_posted'])){
111 /* Get attributes */
112 foreach($this->attributes as $attr){
113 if(isset($_POST[$attr])){
114 $this->$attr = validate(get_post($attr));
115 }
116 }
118 foreach(array("login_attribute","list_summary","strict_units","snmpcommunity","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
119 if(isset($_POST[$name])){
120 $this->optional[$name] = get_post($name);
121 }
122 }
124 if(isset($_POST['ppd_path_active'])){
125 $this->optional['ppd_path_active'] = TRUE;
126 if(isset($_POST['ppd_path'])){
127 $this->optional['ppd_path'] = get_post('ppd_path');
128 }
129 }else{
130 $this->optional['ppd_path_active'] = FALSE;
131 }
133 if(isset($_POST['max_ldap_query_time_active'])){
134 $this->optional['max_ldap_query_time_active'] = TRUE;
135 if(isset($_POST['max_ldap_query_time'])){
136 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
137 }
138 }else{
139 $this->optional['max_ldap_query_time_active'] = FALSE;
140 }
142 if(isset($_POST['mailQueueScriptPath_active'])){
143 $this->optional['mailQueueScriptPath_active'] = TRUE;
144 if(isset($_POST['mailQueueScriptPath'])){
145 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
146 }
147 }else{
148 $this->optional['mailQueueScriptPath_active'] = FALSE;
149 }
151 if(isset($_POST['kioskpath_active'])){
152 $this->optional['kioskpath_active'] = TRUE;
153 if(isset($_POST['kioskpath'])){
154 $this->optional['kioskpath'] = get_post('kioskpath');
155 }
156 }else{
157 $this->optional['kioskpath_active'] = FALSE;
158 }
160 if(isset($_POST['sudoou_active'])){
161 $this->optional['sudoou_active'] = TRUE;
162 if(isset($_POST['sudoou'])){
163 $this->optional['sudoou'] = get_post('sudoou');
164 }
165 }else{
166 $this->optional['sudoou_active'] = FALSE;
167 }
169 if(isset($_POST['notifydir_active'])){
170 $this->optional['notifydir_active'] = TRUE;
171 if(isset($_POST['notifydir'])){
172 $this->optional['notifydir'] = get_post('notifydir');
173 }
174 }else{
175 $this->optional['notifydir_active'] = FALSE;
176 }
178 if(isset($_POST['gosaSupportURI_active'])){
179 $this->optional['gosaSupportURI_active'] = TRUE;
180 if(isset($_POST['gosaSupportURI'])){
181 $this->optional['gosaSupportURI'] = get_post('gosaSupportURI');
182 $this->optional['gosaSupportTimeout'] = get_post('gosaSupportTimeout');
183 }
184 }else{
185 $this->optional['gosaSupportURI_active'] = FALSE;
186 }
188 if(isset($_POST['uniq_identifier_active'])){
189 $this->optional['uniq_identifier_active'] = TRUE;
190 if(isset($_POST['uniq_identifier'])){
191 $this->optional['uniq_identifier'] = get_post('uniq_identifier');
192 }
193 }else{
194 $this->optional['uniq_identifier_active'] = FALSE;
195 }
196 }
198 $tmp = $this->check();
199 if(count($tmp) == 0){
200 $this->is_completed = TRUE;
201 }else{
202 $this->is_completed = FALSE;
203 }
204 }
207 function check()
208 {
209 $message = array();
211 if(!is_numeric( $this->optional['session_lifetime'])){
212 $message[] = _("Session lifetime must be a numeric value!");
213 }
215 if(!is_numeric( $this->optional['max_ldap_query_time'])){
216 $message[] = _("Maximum LDAP query time must be a numeric value!");
217 }
219 return($message);
220 }
223 /* Attributes that are interesting for configuration generation */
224 function get_attributes()
225 {
226 $tmp = setup_step::get_attributes();
227 foreach(array("optional") as $attr){
228 $tmp[$attr]= $this->$attr;
229 }
230 return($tmp);
231 }
233 }
235 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
236 ?>