cc2307b5cd6953f1db869fd6ce88aea3d6310933
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";
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 "ppd_path" => "/var/spool/ppd/",
41 "ppd_path_active" => FALSE,
42 "compile" => "/var/spool/gosa",
43 "snmpcommunity" => "goto",
44 "debuglevel" => 0,
45 "session_lifetime" => 7200,
46 "max_ldap_query_time" => "5.0",
47 "max_ldap_query_time_active" => FALSE,
49 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
50 "mailQueueScriptPath_active" => FALSE,
52 "auto_network_hook" => "/usr/bin/net-resolver.sh",
53 "auto_network_hook_active" => FALSE,
55 "notifydir" => "",
56 "notifydir_active" => FALSE,
58 "kioskpath" => "/var/spool/kiosk",
59 "kioskpath_active" => FALSE,
61 "gotomasses_file" => "/etc/gosa/gotomasses",
62 "gotomasses_active" => FALSE,
64 "noprimarygroup" => FALSE);
66 var $attributes = array("errorlvl");
68 function Step_Config3()
69 {
70 $this->update_strings();
71 }
74 function update_strings()
75 {
76 $this->s_title = _("GOsa settings 3/3");
77 $this->s_title_long = _("GOsa settings 3/3");
78 $this->s_info = _("Tweak some GOsa core behaviour");
79 }
82 function execute()
83 {
84 $smarty = get_smarty();
85 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
86 $smarty->assign("optional", $this->optional);
87 foreach($this->attributes as $attr){
88 $smarty->assign($attr,$this->$attr);
89 }
90 $smarty->assign("login_attributes",$this->login_attributes);
91 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
92 }
95 function save_object()
96 {
97 if(isset($_POST['step6a_posted'])){
99 /* Get attributes */
100 foreach($this->attributes as $attr){
101 if(isset($_POST[$attr])){
102 $this->$attr = validate(get_post($attr));
103 }
104 }
106 foreach(array("login_attribute","list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","snmpcommunity","compile","debuglevel","session_lifetime") as $name){
107 if(isset($_POST[$name])){
108 $this->optional[$name] = get_post($name);
109 }
110 }
112 if(isset($_POST['ppd_path_active'])){
113 $this->optional['ppd_path_active'] = TRUE;
114 if(isset($_POST['ppd_path'])){
115 $this->optional['ppd_path'] = get_post('ppd_path');
116 }
117 }else{
118 $this->optional['ppd_path_active'] = FALSE;
119 }
121 if(isset($_POST['max_ldap_query_time_active'])){
122 $this->optional['max_ldap_query_time_active'] = TRUE;
123 if(isset($_POST['max_ldap_query_time'])){
124 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
125 }
126 }else{
127 $this->optional['max_ldap_query_time_active'] = FALSE;
128 }
130 if(isset($_POST['mailQueueScriptPath_active'])){
131 $this->optional['mailQueueScriptPath_active'] = TRUE;
132 if(isset($_POST['mailQueueScriptPath'])){
133 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
134 }
135 }else{
136 $this->optional['mailQueueScriptPath_active'] = FALSE;
137 }
139 if(isset($_POST['kioskpath_active'])){
140 $this->optional['kioskpath_active'] = TRUE;
141 if(isset($_POST['kioskpath'])){
142 $this->optional['kioskpath'] = get_post('kioskpath');
143 }
144 }else{
145 $this->optional['kioskpath_active'] = FALSE;
146 }
148 if(isset($_POST['gotomasses_active'])){
149 $this->optional['gotomasses_active'] = TRUE;
150 if(isset($_POST['gotomasses_file'])){
151 $this->optional['gotomasses_file'] = get_post('gotomasses_file');
152 }
153 }else{
154 $this->optional['gotomasses_active'] = FALSE;
155 }
157 if(isset($_POST['auto_network_hook_active'])){
158 $this->optional['auto_network_hook_active'] = TRUE;
159 if(isset($_POST['auto_network_hook'])){
160 $this->optional['auto_network_hook'] = get_post('auto_network_hook');
161 }
162 }else{
163 $this->optional['auto_network_hook_active'] = FALSE;
164 }
166 if(isset($_POST['notifydir_active'])){
167 $this->optional['notifydir_active'] = TRUE;
168 if(isset($_POST['notifydir'])){
169 $this->optional['notifydir'] = get_post('notifydir');
170 }
171 }else{
172 $this->optional['notifydir_active'] = FALSE;
173 }
174 }
176 $tmp = $this->check();
177 if(count($tmp) == 0){
178 $this->is_completed = TRUE;
179 }else{
180 $this->is_completed = FALSE;
181 }
182 }
185 function check()
186 {
187 $message = array();
189 if(!is_numeric( $this->optional['session_lifetime'])){
190 $message[] = _("Session lifetime must be a numeric value.");
191 }
193 if(!is_numeric( $this->optional['max_ldap_query_time'])){
194 $message[] = _("Maximal ldap query time must be a numeric value. ");
195 }
197 return($message);
198 }
201 /* Attributes that are interesting for configuration generation */
202 function get_attributes()
203 {
204 $tmp = setup_step::get_attributes();
205 foreach(array("optional") as $attr){
206 $tmp[$attr]= $this->$attr;
207 }
208 return($tmp);
209 }
211 }
213 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
214 ?>