9db2031f739271aecabcddac05fc13a3a5384c8e
1 <?php
3 class environment extends plugin
4 {
5 var $plIcon = "plugins/goto/images/plugin.png";
7 /* attribute list for save action */
8 var $ignore_account = FALSE;
9 var $plHeadline = "Environment";
10 var $plDescription = "This does something";
11 var $dialog = false; // Indicates that we are currently editing in an seperate dialog
13 var $in_dialog = false;
14 var $uid = "";
16 var $is_group = false;
17 var $view_logged = FALSE;
19 /* Attribute definition
20 */
22 /* profile management */
23 var $useProfile = false; // Specifies if we want to use a Server
24 var $gotoProfileServer = ""; // Specifies the selected profile server
25 var $gotoProfileServers = array();// Specifies all available and selectable servers
26 var $gotoProfileFlags = ""; // Flags enabled ? only used to set ACL and save
27 var $gotoProfileFlagC = ""; // Flag is set to C if we have the profile caching fucntion enabled
29 var $gotoXResolution = "auto"; // The selected resolution eg: 1024x768
30 var $gotoXResolutions = array();// Contains all available resolutions for this account
31 var $gotoProfileFlagL = ""; // Flag is set to L to enable runtime resolution change
32 var $gotoProfileQuota = ""; // User Quota Settings
34 /* Logon script section*/
35 var $gotoLogonScripts = array();// Contains all available Logon Scripts
36 var $gotoLogonScript = ""; // The selected Logon Script
38 /* Printer */
39 var $gotoPrinter = array();// All available Printer, with their configurations
40 var $gotoPrinterSel = ""; // The selected Printer
41 var $gosaDefaultPrinter = ""; // Default printer
43 /* Share */
44 var $gotoShares = array();// Current Share Options
45 var $gotoShare = ""; // currently selected Share Option
46 var $gotoShareSelections= array();// Available Shares for this account in Listbox format
47 var $gotoAvailableShares= array();// Available Shares for this account
49 /* Kiosk profile */
50 var $kiosk_enabled = FALSE;
51 var $gotoKioskProfile = ""; // The selected Kiosk Profile
52 var $gotoKioskProfile_Server = ""; // The selected Kiosk Profile
53 var $gotoKioskProfile_Profile = ""; // The selected Kiosk Profile
54 var $gotoKioskProfiles = array();// All available Kiosk profiles
56 /* Hotplug Devices */
57 var $gotoHotplugDevice = array(); // Selected hotplug
58 var $gotoHotplugDevices = array();// Already configured hotplug devices
59 var $gotoHotplugDeviceDN= array();
61 var $NewAddedPrinters = array();
62 var $NewDeletedPrinters = array();
64 /* general settings */
65 // Sets the attributes which will kept on page reload, which will be saved, ...
67 var $CopyPasteVars = array(
68 "gotoProfileServer",
69 "gotoProfileFlags",
70 "gotoProfileFlagC",
71 "gotoProfileFlagL",
72 "useProfile",
73 "gotoHotplugDeviceDN",
74 "gotoXResolution",
75 "gotoProfileQuota",
76 "gotoLogonScripts",
77 "gotoLogonScript",
78 "gotoPrinter",
79 "gotoPrinterSel",
80 "gosaDefaultPrinter",
81 "gotoHotplugDevices",
82 "gotoShares",
83 "gotoShare",
84 "gotoShareSelections",
85 "gotoAvailableShares",
86 "gotoKioskProfile",
87 "gotoKioskProfile_Server",
88 "gotoKioskProfile_Profile",
89 "is_group",
90 "in_dialog",
91 );
93 var $attributes = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
94 "gotoXResolution","gotoProfileQuota",
95 "gotoLogonScripts","gotoLogonScript",
96 "gotoPrinter", "gosaDefaultPrinter",
97 "gotoShares","gotoShare",
98 "gotoKioskProfile");
99 var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here
100 var $cn;
101 var $OrigCn;
102 var $add_del_printer_member_was_called = false;
104 var $multiple_support =TRUE;
106 var $use_gotoPrinter;
108 function environment (&$config, $dn= NULL)
109 {
110 plugin::plugin ($config, $dn);
112 /* Setting uid to default */
113 if(isset($this->attrs['uid'][0])){
114 $this->uid = $this->attrs['uid'][0];
115 }
117 /* Check : Are we currently editing a group or user dialog */
118 if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
119 $suffix="Group";
120 $this->uid = $this->attrs['cn'][0];
121 $this->attrs['uid'] = $this->attrs['cn'][0];
122 $this->OrigCn = $this->attrs['cn'][0];
123 }else{
124 $suffix="User";
125 }
127 /* Get all Printer assignments */
128 $ldap = $this->config->get_ldap_link();
129 $ldap->cd($this->config->current['BASE']);
130 $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
131 while($printer = $ldap->fetch()){
132 $this->gotoPrinter[$printer['cn'][0]]=$printer;
133 $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
134 }
135 $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
136 while($printer = $ldap->fetch()){
137 $this->gotoPrinter[$printer['cn'][0]]=$printer;
138 $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
139 }
142 /* Prepare hotplugs */
143 if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
144 $ldap = $this->config->get_ldap_link();
145 $ldap->cd($this->config->current['BASE']);
146 for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
147 $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
148 if($ldap->count()){
149 $attrs = $ldap->fetch();
151 if(isset($attrs['gotoHotplugDevice'][0])){
152 $tmp = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
153 $tmp2 = array();
154 $tmp2['name'] = $attrs['cn'][0];
155 $tmp2['description'] = $tmp[0];
156 $tmp2['id'] = $tmp[1];
157 $tmp2['produkt'] = $tmp[2];
158 $tmp2['vendor'] = $tmp[3];
159 $tmp2['dn'] = $attrs['dn'];
160 $this->gotoHotplugDevices[] = $tmp2;
161 }
162 }else{
163 msg_dialog::display(_("Warning"), sprintf(_("Device '%s' is not available anymore. It will be removed!"), $this->attrs['gotoHotplugDeviceDN'][$i]), WARNING_DIALOG);
164 }
165 }
166 }
169 /* prepare LogonScripts */
170 if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
171 unset($this->attrs['gotoLogonScript']['count']);
172 foreach($this->attrs['gotoLogonScript'] as $device){
173 $tmp = $tmp2 = array();
174 $tmp = split("\|",$device);
175 $tmp2['LogonName'] = $tmp[0];
176 $tmp2['LogonPriority'] = $tmp[2];
177 if(preg_match("/O/i",$tmp[1])){
178 $tmp2['LogonOverload'] = "O";
179 }else{
180 $tmp2['LogonOverload'] = "";
181 }
182 if(preg_match("/L/i",$tmp[1])){
183 $tmp2['LogonLast'] = "L";
184 }else{
185 $tmp2['LogonLast'] = "";
186 }
187 $tmp2['LogonData'] = base64_decode($tmp[3]);
188 $tmp2['LogonDescription'] = $tmp[4];
189 $this->gotoLogonScripts[$tmp[0]]=$tmp2;
190 }
191 }
193 /* Prepare Shares */
194 if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
195 unset($this->attrs['gotoShare']['count']);
196 foreach($this->attrs['gotoShare'] as $share){
197 $tmp = $tmp2 = array();
198 $tmp = split("\|",$share);
199 $tmp2['server'] =$tmp[0];
200 $tmp2['name'] =$tmp[1];
202 /* Decode base64 if needed */
203 if (!preg_match('%/%', $tmp[2])){
204 $tmp2['mountPoint'] =base64_decode($tmp[2]);
205 } else {
206 $tmp2['mountPoint'] =$tmp[2];
207 }
209 if(isset($tmp[3])){
210 $tmp2['PwdHash'] =$tmp[3];
211 }else{
212 $tmp2['PwdHash'] ="";
213 }
214 if(isset($tmp[4])){
215 $tmp2['Username'] =$tmp[4];
216 }else{
217 $tmp2['Username'] ="";
218 }
219 $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
220 }
221 }
223 for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
224 $chr = $this->gotoProfileFlags[$i];
225 $name = "gotoProfileFlag".$chr;
226 $this->$name=$chr;
227 }
229 if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
230 $this->useProfile = true;
231 }else{
232 $this->useProfile = false;
233 }
235 /* Set resolutions */
236 $this->gotoXResolutions = array("auto"=>_("auto"),
237 "640x480" => "640x480",
238 "800x600" => "800x600",
239 "1024x768" => "1024x768",
240 "1152x864" => "1152x864",
241 "1280x768" => "1280x768",
242 "1280x1024" => "1280x1024");
244 if($this->config->get_cfg_value("resolutions") != ""){
245 $file = $this->config->get_cfg_value("resolutions");
247 if(is_readable($file)){
248 $str = file_get_contents($file);
249 $lines = split("\n",$str);
250 foreach($lines as $line){
251 $line = trim($line);
252 if(!empty($line)){
253 $this->gotoXResolutions[$line]=$line;
254 }
255 }
256 //natcasesort($this->gotoXResolutions);
257 }else{
258 msg_dialog::display(_("Configuration error"), sprintf(_("Cannot open file '%s'!"), $file), WARNING_DIALOG);
259 }
260 }
262 $this->gotoProfileServers= $config->getShareServerList() ;
263 $this->gotoShareSelections= $config->getShareList(true);
264 $this->gotoAvailableShares= $config->getShareList(false);
266 /* Ensure that a currently selected server will stay selected, even if the list of profile servers
267 is empty due to insufficient permissions.
268 */
269 if(count($this->gotoProfileServers) && !empty($this->gotoProfileServer)){
271 /* The currently selected profile server is outdated/no longer available */
272 if(!isset($this->gotoProfileServers[$this->gotoProfileServer])){
274 }else{
275 $c = $this->gotoProfileServers[$this->gotoProfileServer];
276 if(!preg_match("/r/",$c['ACL'])){
278 /* We are not allowed to read to currently selected server.
279 But to ensure that the selection will be kept after saving the account, we
280 override the current ACL tag.
281 */
282 $this->gotoProfileServers[$this->gotoProfileServer]['ACL'] .= "r";
283 }
284 }
285 }
286 $this->update_kiosk_profiles();
287 }
290 function update_kiosk_profiles()
291 {
292 $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
293 $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
295 $tmp1 = array("none" => array(_("disabled")));
296 $tmp2 = array("none" => _("disabled"));
297 $tmp3 = array();
298 $ldap = $this->config->get_ldap_link();
299 $ldap->cd($this->config->current['BASE']);
300 $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
301 $cnt = 0;
302 $ui = get_userinfo();
303 while($attrs = $ldap->fetch()){
304 $acl = $ui->get_permissions($attrs['dn'],"server/goKioskService","");
305 for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
306 if(preg_match("/r/",$acl) || $this->gotoKioskProfile_Server == $attrs['cn'][0]){
307 $name = preg_replace("/^.*\//","",$attrs['gotoKioskProfile'][$i]);
308 $tmp1[$attrs['cn'][0]][] = $name;
309 $tmp3[$attrs['cn'][0]][$name] = $attrs['gotoKioskProfile'][$i];
310 $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
311 $cnt ++;
312 }
313 }
314 }
316 if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
317 $this->kiosk_enabled = TRUE;
318 }
320 $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
321 $this->gotoKioskProfiles['SERVERS'] = $tmp2;
322 $this->gotoKioskProfiles['MAP'] = $tmp3;
324 $error = false;
325 if(!isset($this->gotoKioskProfiles['SERVERS'][$this->gotoKioskProfile_Server])){
326 $error = true;
327 }elseif(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
328 $error = true;
329 }
330 if($error && !empty($this->gotoKioskProfile)){
331 msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG);
332 $this->gotoKioskProfile_Server ="none";
333 $this->gotoKioskProfile_Profile="";
334 }elseif(empty($this->gotoKioskProfile)){
335 $this->gotoKioskProfile_Server ="none";
336 $this->gotoKioskProfile_Profile="";
337 }
338 }
341 /* Detect type of edited object (user|group)*/
342 function detect_grouptype()
343 {
344 if((!isset($this->parent))&&(!$this->is_account)){
345 $this->is_group = false;
346 }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
347 $this->is_group = true;
348 }else{
349 $this->is_group = false;
350 }
351 }
354 function execute()
355 {
357 /* Call parent execute */
358 plugin::execute();
359 /* Log view */
360 if($this->is_account && !$this->view_logged){
361 $this->view_logged = TRUE;
362 if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
363 new log("view","users/".get_class($this),$this->dn);
364 }else{
365 new log("view","groups/".get_class($this),$this->dn);
366 }
367 }
369 /* Are we editing from MyAccount and not editing a user */
370 $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
372 /* Check profile server */
373 if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
375 if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
378 if(count($this->gotoProfileServers)){
380 /* Get First Profile */
381 $new = key($this->gotoProfileServers);
383 /* Another profile server found */
384 msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Switched to server '%s'."), $this->gotoProfileServer, $new), WARNING_DIALOG);
385 }else{
387 /* No other profile servers found */
388 msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Kiosk profile will be disabled."), $this->gotoProfileServer), WARNING_DIALOG);
389 $this->gotoProfileServer = "none";
390 }
391 }
392 }
394 $this->detect_grouptype();
396 /* Fill templating stuff */
397 $smarty= get_smarty();
398 $smarty->assign("kiosk_enabled",$this->kiosk_enabled);
399 $display= "";
401 $smarty->assign("is_group",$this->is_group);
403 /* Prepare all variables for smarty */
404 foreach($this->attributes as $s_attr){
405 /* Set value*/
406 $smarty->assign($s_attr,$this->$s_attr);
408 /* Set checkbox state*/
409 if(empty($this->$s_attr)){
410 $smarty->assign($s_attr."CHK","");
411 }else{
412 $smarty->assign($s_attr."CHK"," checked ");
413 }
415 /* Prepare ACL settings*/
416 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
417 }
419 /* Is accout enabled | are we editing from usermenu or admin menu
420 All these tab management is done here
421 */
424 /* Working from Usermenu an the Account is currently disbled
425 * this->parent : is only set if we are working in a list of tabs
426 * is_account : is only true if the needed objectClass is given
427 */
428 if((!isset($this->parent))&&(!$this->is_account)){
429 /* We are currently editing this tab from usermenu, but this account is not enabled */
430 $smarty->assign("is_account",$this->is_account);
431 /* Load template */
432 $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
433 /* Avoid the "You are currently editing ...." message when you leave this tab */
434 $display .= back_to_main();
435 /* Display our message to the user */
436 return $display;
439 /* We are currently editing from group tabs, because
440 * $this->parent is set
441 * posixAccount is not set, so we are not in usertabs.
442 */
443 }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
444 $smarty->assign("is_account","true");
445 $this->uid = $this->cn;
446 $this->attrs['uid'] = $this->cn;
448 /* Change state if needed */
449 if (isset($_POST['modify_state'])){
450 if(($this->acl_is_createable() && !$this->is_account) ||
451 ($this->acl_is_removeable() && $this->is_account)){
452 $this->is_account= !$this->is_account;
453 }
454 }
455 /* Group Dialog with enabled environment options */
456 if ($this->is_account){
457 $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
458 msgPool::featuresEnabled(_("Environment")));
459 } else {
461 /* Environment is disabled
462 If theres is no posixAccount enabled, you won't be able to enable
463 environment extensions
464 */
465 if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
466 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
467 msgPool::featuresDisabled(_("Environment")));
468 return $display;
469 }elseif((isset($this->parent->by_object['ogroup']))){
470 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
471 msgPool::featuresDisabled(_("Environment")));
472 return $display;
473 }else{
474 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
475 msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
476 return $display;
477 }
478 }
479 }else{
480 /* Editing from Usermenu
481 * Tell smarty that this accoutn is enabled
482 */
483 $smarty->assign("is_account","true");
485 /* Change state if needed */
486 if (isset($_POST['modify_state'])){
487 if(($this->acl_is_createable() && !$this->is_account) ||
488 ($this->acl_is_removeable() && $this->is_account)){
489 $this->is_account= !$this->is_account;
490 }
491 }
493 if(isset($this->parent)){
495 // 3. Account enabled . Editing from adminmenu
496 if ($this->is_account){
497 $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
498 msgPool::featuresEnabled(_("Environment")));
499 } else {
501 if($this->parent->by_object['posixAccount']->is_account==true){
502 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
503 msgPool::featuresDisabled(_("Environment")));
504 return $display;
505 }else{
506 $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
507 msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
508 return $display;
509 }
510 }
511 }
512 }
514 /* Reset header toggle */
515 if($this->multiple_support_active){
516 $display = "";
517 }
519 /* Account is Account : is_accounbt=true.
520 * Else we won't reach this.
521 */
523 /* Prepare all variables for smarty */
524 foreach($this->attributes as $s_attr){
525 /* Set value*/
526 $smarty->assign($s_attr,$this->$s_attr);
528 /* Set checkbox state*/
529 if(empty($this->$s_attr)){
530 $smarty->assign($s_attr."CHK","");
531 }else{
532 $smarty->assign($s_attr."CHK"," checked ");
533 }
535 /* Prepare ACL settings*/
536 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
537 }
539 foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
540 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
541 }
543 if($WriteOnly) {
544 $smarty->assign("gotoPrinterACL","r");
545 }else{
546 $smarty->assign("gotoPrinterACL","rw");
547 }
550 $smarty->assign("useProfile",$this->useProfile);
551 if(empty($this->useProfile) && !$this->multiple_support_active){
552 $smarty->assign("useProfileCHK","");
553 $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
554 $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
555 $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
556 }else{
557 $smarty->assign("useProfileCHK"," checked ");
558 }
560 $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
561 $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
563 /* HANDLE Profile Settings here
564 * Assign available Quota and resolution settings
565 * Get all available profile server
566 * Get cache checkbox
567 * Assign this all to Smarty
568 */
570 if(empty($this->gotoProfileFlagL)){
571 $smarty->assign("gotoProfileFlagLCHK"," ");
572 }else{
573 $smarty->assign("gotoProfileFlagLCHK"," checked ");
574 }
576 if(empty($this->gotoProfileFlagC)){
577 $smarty->assign("gotoProfileFlagCCHK"," ");
578 }else{
579 $smarty->assign("gotoProfileFlagCCHK"," checked ");
580 }
583 $smarty->assign("gotoXResolutions" , $this->gotoXResolutions);
584 $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
586 $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
587 if(!is_array($this->gotoProfileServers)){
588 $this->gotoProfileServers =array();
589 }
591 /* Handle kiosk profiles*/
592 $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
593 $smarty->assign("kiosk_server" , $this->gotoKioskProfile_Server);
594 $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
595 $smarty->assign("kiosk_profile" , $this->gotoKioskProfile_Profile);
598 /* Logonscript Management
599 * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group)
600 * Perform add Delete edit Posts
601 */
603 /* Dialog Save */
604 if(isset($_POST['LogonSave'])){
606 if(!$this->acl_is_writeable("gotoLogonScript")){
607 msg_dialog::display(_("Permission error"), msgPool::permModify(_("Logon scripts")), ERROR_DIALOG);
608 unset($this->dialog);
609 $this->dialog=FALSE;
610 $this->is_dialog=false;
611 }else{
612 $this->dialog->save_object();
613 if(count($this->dialog->check())!=0){
614 foreach($this->dialog->check() as $msg){
615 msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
616 }
617 }else{
618 $tmp = $this->dialog->save();
619 unset($this->dialog);
620 $this->dialog=FALSE;
621 $this->is_dialog=false;
623 if($this->multiple_support_active){
624 $tmp['UsedByAllUsers'] = TRUE;
625 }
626 $this->gotoLogonScripts[$tmp['LogonName']]=$tmp;
627 }
628 }
629 }
632 /* Dialog Quit without saving */
633 if(isset($_POST['LogonCancel'])){
634 $this->is_dialog= false;
635 unset($this->dialog);
636 $this->dialog= FALSE;
637 }
639 /* Check Edit Del New Posts for a selected LogonScript */
640 if($this->acl_is_writeable("gotoLogonScript") &&
641 (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
643 /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
644 * In this case we create a new Logon Script.
645 */
646 if(isset($_POST['gotoLogonScriptNew'])){
647 $this->is_dialog = true;
648 $this->dialog = new logonManagementDialog($this->config,$this->dn);
649 }
651 /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
652 * We only can delete if there is an entry selected.
653 */
654 if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
655 unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
656 }
658 /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
659 * There must be an entry selected to perform edit request.
660 */
661 if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
662 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
663 $this->is_dialog = true;
664 $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
665 }
666 }
668 /* Append List to smarty*/
669 if($this->multiple_support_active){
670 $smarty->assign("gotoLogonScripts", $this->gotoLogonScripts);
671 $smarty->assign("gotoLogonScriptKeysCnt",count($this->gotoLogonScripts));
672 }else{
673 $ls = $this->printOutLogonScripts();
674 $smarty->assign("gotoLogonScripts", $ls);
675 $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
676 $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
677 }
679 /* In this section server shares will be defined
680 * A user can select one of the given shares and a mount point
681 * and attach this combination to his setup.
682 */
684 $smarty->assign("gotoShareSelections", $this->gotoShareSelections);
685 if(!is_array($this->gotoShareSelections)){
686 $this->gotoShareSelections = array();
687 }
688 $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
690 /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
691 * This entry will be, a combination of mountPoint and sharedefinitions
692 */
693 if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
695 /* We assign a share to this user, if we don't know where to mount the share */
696 if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){
697 msg_dialog::display(_("Error"), msgPool::invalid(_("Share")), ERROR_DIALOG);
698 }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
699 msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), ERROR_DIALOG);
700 }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
701 msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point"), "/[^\s]/"), ERROR_DIALOG);
702 }elseif(!(
703 preg_match("/^\//",$_POST['gotoShareMountPoint']) ||
704 preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
705 preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
706 preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
707 preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
708 preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
709 preg_match("/^%/",$_POST['gotoShareMountPoint'])
710 )
711 ){
712 msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), ERROR_DIALOG);
713 }else{
714 $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
715 $s_mount = $_POST['gotoShareMountPoint'];
716 $s_user = $_POST['ShareUser'];
717 /* Preparing the new assignment */
718 $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
719 $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
720 $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
721 $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
723 if($this->multiple_support_active){
724 $this->gotoShares[$a_share['name']."|".$a_share['server']]['UsedByAllUsers']= TRUE;
725 }
726 }
727 }
729 /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
730 * If there is no defined share selected, we will abort the deletion without any message
731 */
732 $once = true;
733 if($this->acl_is_writeable("gotoShare")){
734 foreach($_POST as $name => $value){
735 if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
736 $once = false;
737 $key = preg_replace("/^gotoShareDel_/","",$name);
738 $key = preg_replace("/_+[xy]$/","",$key);
739 $key = base64_decode($key);
740 if(isset($this->gotoShares[$key])) {
741 unset($this->gotoShares[$key]);
742 }
744 /* Remove corresponding password entry, too. This is a workaround
745 to get rid of old-style entries. */
746 $key= preg_replace("/\|/", "|!", $key);
747 if(isset($this->gotoShares[$key])) {
748 unset($this->gotoShares[$key]);
749 }
750 }
751 if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
752 $once = false;
753 $key = preg_replace("/^gotoShareResetPwd_/","",$name);
754 $key = preg_replace("/_+[xy]$/","",$key);
755 $key = base64_decode($key);
756 $this->gotoShares[$key]['PwdHash'] = "";
757 if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
758 unset($this->gotoShares[$key]);
759 }
760 }
761 }
762 }
763 $divlistShares = new divSelectBox("gotoShares");
764 $divlistShares->SetHeight(100);
767 $tmp = array();
768 if($this->acl_is_readable("gotoShare")){
769 $tmp = $this->printOutAssignedShares();
770 }
773 foreach($tmp as $key => $value){
774 $img = "";
776 /* Skip apssword only entries */
777 if( empty($this->gotoShares[$key]['server']) &&
778 empty($this->gotoShares[$key]['name']) &&
779 empty($this->gotoShares[$key]['mountPoint']) &&
780 empty($this->gotoShares[$key]['Username'])){
781 continue;
782 }
784 $color = "";
785 if($this->multiple_support_active){
786 if($this->gotoShares[$key]['UsedByAllUsers']){
787 $value .= " (<b>"._("Used by all users")."</b>)";
788 }else{
789 $color = "color: #999999;";
790 $value .= " (<b>"._("Used by some users")."</b>)";
791 }
792 }
794 /* Check if entry starts with an ! */
795 if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
797 /* If we are currently editing groups environment, skip those ! entries */
798 if($this->is_group) continue;
800 /* Create pwd reset images */
801 if($this->gotoShares[$key]['PwdHash'] != ""){
802 $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)."
803 'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."'
804 title='"._("Reset password hash")."'>";
805 }
806 $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
807 $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
808 }else{
810 /* Create pwd reset img && delete image */
811 if($this->gotoShares[$key]['PwdHash'] != ""){
812 $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)."
813 'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."'
814 title='"._("Reset password hash")."'>";
815 $img.= " ";
816 }
817 $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/lists/trash.png' alt='".msgPool::delButton()."'
818 title='"._("Delete share entry")."'>";
819 $field1 = array("string" => $value , "attach" => "style='".$color."'");
820 $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
821 }
822 $divlistShares->AddEntry(array($field1,$field2));
823 }
824 $smarty->assign("divlistShares",$divlistShares->DrawList());
826 /* Hotplug devices will be handled here
827 * There are 3 possible methods for this feature
828 * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
829 * Delete will erase an entry, the entry must be selcted in the ListBox first
830 * Editing an entry will open a dialog where the informations about the selcted entry can be changed
831 */
833 /* We have to delete the selected hotplug from the list*/
834 if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
835 if($this->acl_is_writeable("gotoHotplugDevice")){
836 foreach($_POST['gotoHotplugDevice_post'] as $name){
837 unset($this->gotoHotplugDevices[$name]);
838 }
839 }
840 }
842 /* There are already defined hotplugs from other users we could use */
843 if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
844 $tmp =array();
845 foreach($this->gotoHotplugDevices as $plugs){
846 $tmp[] = $plugs['name'];
847 }
848 $this->dialog = new hotplugDialog($this->config,$tmp);
849 $this->is_dialog = true;
850 }
852 /* Dialog Aborted */
853 if(isset($_POST['HotPlugCancel'])){
854 unset($this->dialog);
855 $this->dialog= FALSE;
856 $this->is_dialog = false;
857 }
859 /* Dialod saved */
860 if(isset($_POST['HotPlugSave'])){
862 $this->dialog->save_object();
863 if(count($this->dialog->check())!=0){
864 foreach($this->dialog->check() as $msg){
865 msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
866 }
867 }else{
868 $this->dialog->save_object();
869 $a_tmp = $this->dialog->save();
871 if(is_array($a_tmp)){
872 foreach($a_tmp as $name => $hotplug){
873 if($this->multiple_support_active){
874 $hotplug['UsedByAllUsers'] = TRUE;
875 }
876 $this->gotoHotplugDevices[$name]= $hotplug;
877 }
878 }
879 unset($this->dialog);
880 $this->dialog= FALSE;
881 $this->is_dialog = false;
882 }
883 }
885 if($this->multiple_support_active){
886 $smarty->assign("gotoHotplugDevices",$this->gotoHotplugDevices);
887 }else{
888 $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
889 $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
890 }
892 /* Printer Assignment will managed below
893 * A printer can be assigned in two different ways and two different types
894 * There are 2 types of users assigned to a printer : user and admin
895 * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
896 * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
897 */
899 /* First handle Add Post. Open a dialog that allows us to select a printer or two */
900 if(isset($_POST['gotoPrinterAdd'])){
902 $this->is_dialog=true;
903 $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
904 }
906 if(isset($_POST['PrinterCancel'])){
907 $this->is_dialog=false;
908 unset($this->dialog);
909 $this->dialog=FALSE;
910 }
912 if(isset($_POST['PrinterSave'])){
913 if(count($this->dialog->check())!=0){
914 $tmp = $this->dialog->check();
915 foreach($tmp as $msg){
916 msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
917 }
918 }else{
919 $this->dialog->save_object();
920 $tmp = $this->dialog->save();
921 $tmp2= $this->dialog->getPrinter(true);
923 foreach($tmp as $pname){
924 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
925 $printerObj->set_acl_base($tmp2[$pname]['dn']);
927 $type = false;
929 if($this->is_group){
930 if($this->dn == "new"){
931 $type = "AddGroup";
932 }elseif(isset($this->NewDeletedPrinters[$pname])){
933 $type = "AddGroup";
934 }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
935 $type = "AddGroup";
936 }
937 }else{
938 if($this->multiple_support_active){
939 $type = "AddUser";
940 }elseif(isset($this->NewDeletedPrinters[$pname])){
941 $type = "AddUser";
942 }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
943 $type = "AddUser";
944 }
945 }
947 if($type){
948 $this->gotoPrinter[$pname]=$tmp2[$pname];
949 $this->gotoPrinter[$pname]['mode']="user";
950 $this->add_del_printer_member_was_called = true;
952 $this->NewAddedPrinters[$pname] = $pname;
953 if(isset($this->NewDeletedPrinters[$pname])){
954 unset($this->NewDeletedPrinters[$pname]);
955 }
956 }
957 }
959 $this->is_dialog=false;
960 unset($this->dialog);
961 $this->dialog =FALSE;
962 }
963 }
965 if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
966 $printer = $_POST['gotoPrinterSel'];
967 foreach($printer as $pname){
969 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
970 $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
972 $type = false;
973 if($this->is_group){
974 if(isset($this->NewAddedPrinters[$pname])){
975 $type = "Group";
976 }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
977 $type = "Group";
978 }
979 }else{
980 if(isset($this->NewAddedPrinters[$pname])){
981 $type = "User";
982 }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
983 $type = "User";
984 }
985 }
986 if($type){
987 $this->add_del_printer_member_was_called = true;
988 unset($this->gotoPrinter[$pname]);
990 $this->NewDeletedPrinters[$pname] = $pname;
991 if(isset($this->NewAddedPrinters[$pname])){
992 UNSET($this->NewAddedPrinters[$pname]);
993 }
994 }
995 }
996 }
998 if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
999 $printers = $_POST['gotoPrinterSel'];
1000 $this->add_del_printer_member_was_called = true;
1001 foreach($printers as $printer){
1002 if($this->gotoPrinter[$printer]['mode']=="user"){
1003 $this->gotoPrinter[$printer]['mode']="admin";
1004 }else{
1005 $this->gotoPrinter[$printer]['mode']="user";
1006 }
1007 }
1008 }
1010 if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
1011 if($this->is_group){
1012 msg_dialog::display(_("Error"), _("Cannot set default printer flag for groups!"), ERROR_DIALOG);
1013 }else{
1014 if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
1015 $this->gosaDefaultPrinter= "";
1016 } else {
1017 $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
1018 }
1019 }
1020 }
1022 $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
1024 /* General behavior */
1025 if(is_object($this->dialog)){
1026 $this->dialog->save_object();
1027 $disp =$this->dialog->execute();
1028 return($disp);
1029 }
1031 /* Assign used attributes for multiple edit */
1032 foreach(array("gotoPrinter","kiosk_server","gotoProfileFlagL","gotoXResolution",
1033 "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $box){
1034 $ubox ="use_".$box;
1035 if(in_array($box,$this->multi_boxes)){
1036 $smarty->assign($ubox,TRUE);
1037 }else{
1038 $smarty->assign($ubox,FALSE);
1039 }
1040 }
1042 /* Als smarty vars are set. Get smarty template and generate output */
1043 $smarty->assign("multiple_support",$this->multiple_support_active);
1044 $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
1045 return($display);
1046 }
1048 function remove_from_parent()
1049 {
1050 /* only if it was an account*/
1051 if (!$this->initially_was_account){
1052 return;
1053 }
1055 /* include global link_info */
1056 $ldap= $this->config->get_ldap_link();
1058 /* Remove and write to LDAP */
1059 plugin::remove_from_parent();
1061 /* Don't save our template variables */
1062 $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoHotplugDevices" );
1064 /* Skip all these attributes */
1065 foreach($skip as $del){
1066 unset($this->attrs[$del]);
1067 }
1069 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
1071 $ldap->cd($this->dn);
1072 $this->cleanup();
1073 $ldap->modify ($this->attrs);
1075 if($this->is_group){
1076 new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1077 }else{
1078 new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1079 }
1081 if (!$ldap->success()){
1082 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
1083 }
1085 /* Optionally execute a command after we're done */
1086 $this->handle_post_events("remove",array("uid" => $this->uid));
1087 }
1090 /* Save data to object */
1091 function save_object()
1092 {
1093 /* Get all Posted vars
1094 * Setup checkboxes
1095 */
1096 $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
1097 if(isset($_POST['iamposted'])){
1099 $PACL = $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
1101 if(isset($_POST['kiosk_server'])){
1102 $tmp = $_POST['kiosk_server'];
1103 if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
1104 $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
1105 }
1106 }
1107 if(isset($_POST['kiosk_profile'])){
1108 $tmp = $_POST['kiosk_profile'];
1109 if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
1110 $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
1111 }
1112 }
1114 if(preg_match("/w/",$PACL)){
1115 if(isset($_POST['useProfile'])){
1116 $this->useProfile = true;
1117 }else{
1118 $this->useProfile = false;
1119 }
1120 }
1122 if($this->acl_is_writeable("gotoProfileFlagC")){
1123 if(isset($_POST['gotoProfileFlagC'])){
1124 $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
1125 }else{
1126 $this->gotoProfileFlagC = false;
1127 }
1128 }
1130 if($this->acl_is_writeable("gotoProfileFlagL")){
1131 if(isset($_POST['gotoProfileFlagL'])){
1132 $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
1133 }else{
1134 $this->gotoProfileFlagL = false;
1135 }
1136 }
1138 plugin::save_object();
1139 foreach($this->attributes as $s_attr){
1140 if((!isset($_POST[$s_attr])) ||
1141 in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
1142 if(!$this->acl_is_writeable($s_attr)){
1143 continue;
1144 }else{
1145 if(isset($_POST[$s_attr])){
1146 $this->$s_attr = $_POST[$s_attr];
1147 }else{
1148 $this->$s_attr = false;
1149 }
1150 }
1151 }
1152 }
1153 }
1156 /* Check supplied data */
1157 function check()
1158 {
1159 /* Call common method to give check the hook */
1160 $message= plugin::check();
1162 $this->detect_grouptype();
1164 if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
1165 $message[] = msgPool::invalid(_("Profile quota"),$this->gotoProfileQuota,"/[0-9]/") ;
1166 }
1167 if(!isset($this->attrs['objectClass'])){
1168 $this->attrs['objectClass']=array();
1169 }
1170 if(!$this->is_group){
1171 if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
1172 $message[]= msgPool::featuresDisabled(_("environment"),_("POSIX"));
1173 }
1174 }
1175 return ($message);
1176 }
1179 /* Save to LDAP */
1180 function save()
1181 {
1182 /* If group was renamed, all printer settings get lost
1183 */
1184 /* only save changed variables ....*/
1185 if ($this->gotoKioskProfile_Server != "none"){
1186 $method = $this->gotoKioskProfiles['MAP'][$this->gotoKioskProfile_Server][$this->gotoKioskProfile_Profile];
1187 $this->gotoKioskProfile= $method;
1188 }else{
1189 $this->gotoKioskProfile= array();
1190 }
1192 plugin::save();
1193 $ldap= $this->config->get_ldap_link();
1195 $realyUsedAttrs= array();
1197 /* Save already used objectClasses */
1198 $ocs = $this->attrs['objectClass'];
1199 unset($ocs['count']);
1200 $this->attrs = array();
1201 $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
1203 /* 1. Search all printers that have our uid/cn as member
1204 * 2. Delete this uid/cn from every single entry and save it again.
1205 * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
1206 * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal
1207 */
1209 $this->detect_grouptype();
1211 if($this->add_del_printer_member_was_called){
1213 $types = array( "gotoUserPrinter" => "AddUser",
1214 "gotoGroupPrinter" => "AddGroup",
1215 "gotoUserAdminPrinter" => "AddAdminUser",
1216 "gotoGroupAdminPrinter" => "AddAdminGroup");
1218 if($this->is_group){
1219 $s_suffix = "Group";
1220 $useVar = "cn";
1221 }else{
1222 $useVar = "uid";
1223 $s_suffix = "User";
1224 }
1226 /* Remove old entries */
1227 $ldap->cd($this->config->current['BASE']);;
1228 $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
1229 while($attr = $ldap->fetch()){
1230 $printerObj = NULL;
1231 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1232 $printerObj->set_acl_base($attr['dn']);
1233 $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
1234 $printerObj->by_object['printgeneric']->save();
1235 }
1237 $ldap->cd($this->config->current['BASE']);;
1238 $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
1239 while($attr = $ldap->fetch()){
1240 $printerObj = NULL;
1241 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1242 $printerObj->set_acl_base($attr['dn']);
1243 $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
1244 $printerObj->by_object['printgeneric']->save();
1245 }
1247 foreach($this->gotoPrinter as $printer){
1248 $printerObj = NULL;
1249 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
1250 $printerObj->set_acl_base($printer['dn']);
1253 if($printer['mode'] == "admin") {
1254 $attribute = "goto".$s_suffix."AdminPrinter";
1255 }else{
1256 $attribute = "goto".$s_suffix."Printer";
1257 }
1259 $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
1260 $printerObj->by_object['printgeneric']->save();
1261 }
1262 }
1264 /* Prepare HotPlug devices */
1265 $this->attrs['gotoHotplugDeviceDN'] = array();
1266 foreach($this->gotoHotplugDevices as $name => $device){
1267 $this->attrs['gotoHotplugDeviceDN'][]= LDAP::fix($device['dn']);
1268 }
1270 /* Prepare LogonScripts */
1271 $this->attrs['gotoLogonScript'] = array();
1272 foreach($this->gotoLogonScripts as $name => $script){
1273 $this->attrs['gotoLogonScript'][] = $script['LogonName']."|".
1274 $script['LogonOverload'].$script['LogonLast']."|".
1275 $script['LogonPriority']."|".
1276 base64_encode($script['LogonData'])."|".
1277 $script['LogonDescription'];
1278 }
1280 /* Prepare Shares */
1281 $this->attrs['gotoShare']=array();
1282 foreach($this->gotoShares as $name => $share){
1283 $mntp= $share['mountPoint'];
1284 if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
1285 $mntp= base64_encode($mntp);
1286 }
1287 $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
1288 }
1291 if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
1292 $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
1294 foreach($saveThis as $tosave){
1295 if(!empty($this->$tosave)){
1296 $this->attrs[$tosave]=$this->$tosave;
1297 }else{
1298 $this->attrs[$tosave]=array();
1299 }
1300 }
1302 /* Prepare Flags */
1303 $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
1304 if(empty($this->attrs['gotoProfileFlags'][0])){
1305 $this->attrs['gotoProfileFlags']=array();
1306 }
1308 if($this->useProfile == false){
1309 $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
1310 $this->attrs['gotoProfileServer']= array();
1311 }
1313 $ldap->cat ($this->dn, array('dn'));
1314 if ($ldap->fetch()){
1315 $mode= "modify";
1316 } else {
1317 $mode= "add";
1318 $ldap->cd($this->config->current['BASE']);
1319 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
1320 }
1322 $ldap->cd($this->dn);
1323 $this->cleanup();
1324 $ldap->$mode($this->attrs);
1326 $cat = "users";
1327 if($this->is_group){
1328 $cat = "groups";
1329 }
1331 /* Log last action */
1332 if($this->initially_was_account){
1333 new log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1334 }else{
1335 new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
1336 }
1338 if (!$ldap->success()){
1339 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
1340 }
1341 $this->handle_post_events($mode,array("uid"=>$this->uid));
1342 }
1344 /* Generate ListBox frindly output for the defined shares
1345 * Possibly Add or remove an attribute here,
1346 */
1347 function printOutAssignedShares()
1348 {
1349 $a_return = array();
1350 if(is_array($this->gotoShares)){
1351 foreach($this->gotoShares as $share){
1352 if(preg_match("/^!/",$share['server'])){
1353 $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share");
1354 }else{
1355 $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
1356 }
1357 }
1358 natcasesort($a_return);
1359 }
1360 return($a_return);
1361 }
1363 /* Generate ListBox frindly output for the definedhotplugs
1364 * Possibly Add or remove an attribute here,
1365 */
1366 function printOutHotPlugDevices()
1367 {
1368 $a_return= array();
1369 if(is_array($this->gotoHotplugDevices)){
1370 foreach($this->gotoHotplugDevices as $key=>$device){
1371 $a_return[$key] = $device['name']." - ".$device['id'];
1372 }
1373 }
1374 return($a_return);
1375 }
1377 /* Generates ListBox frienly output of used printer devices
1378 * Append ' - admin' if printer is used in admin mode
1379 */
1380 function printOutPrinterDevices()
1381 {
1382 $a_return = array();
1384 if(is_array($this->gotoPrinter)){
1385 foreach($this->gotoPrinter as $printer){
1386 if($printer['mode'] == 'admin'){
1387 $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
1388 }else{
1389 $a_return[$printer['cn'][0]]= $printer['cn'][0];
1390 }
1391 if ($printer['cn'][0] == $this->gosaDefaultPrinter){
1392 $a_return[$printer['cn'][0]].=" - "._("Default printer");
1393 }
1394 }
1395 }
1396 asort($a_return);
1397 return($a_return);
1398 }
1401 function PrepareForCopyPaste($source)
1402 {
1403 plugin::PrepareForCopyPaste($source);
1405 $class= get_class($this);
1406 $o_source = new $class($this->config,$source['dn']);
1407 foreach($this->CopyPasteVars as $attr){
1408 $this->$attr = $o_source->$attr;
1409 }
1411 /* Force adding the new object to eventually
1412 * existing printer objects */
1413 $this->add_del_printer_member_was_called = TRUE;
1415 }
1418 function saveCopyDialog()
1419 {
1420 if(isset($_POST['cn'])){
1421 $this->cn = $_POST['cn'];
1422 $this->uid = $_POST['cn'];
1423 }
1424 }
1427 /* Generates ListBox frienly output of used logonscripts
1428 */
1429 function printOutLogonScripts()
1430 {
1431 $a_return = array();
1432 if(is_array($this->gotoLogonScripts)){
1433 foreach($this->gotoLogonScripts as $script){
1434 $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName'];
1435 }
1436 }
1437 return($a_return);
1438 }
1441 function multiple_execute()
1442 {
1443 /* Reset header toggle */
1444 $this->is_account = TRUE;
1445 return($this->execute());
1446 }
1449 /* Initialize plugin with given atribute arrays
1450 */
1451 function init_multiple_support($attrs,$all)
1452 {
1453 plugin::init_multiple_support($attrs,$all);
1455 /* Prepare Shares */
1456 if((isset($this->multi_attrs_all['gotoShare']))&&(is_array($this->multi_attrs_all['gotoShare']))){
1457 unset($this->multi_attrs_all['gotoShare']['count']);
1458 foreach($this->multi_attrs_all['gotoShare'] as $share){
1459 $tmp = $tmp2 = array();
1460 $tmp = split("\|",$share);
1461 $tmp2['server'] =$tmp[0];
1462 $tmp2['name'] =$tmp[1];
1464 /* Decode base64 if needed */
1465 if (!preg_match('%/%', $tmp[2])){
1466 $tmp2['mountPoint'] =base64_decode($tmp[2]);
1467 } else {
1468 $tmp2['mountPoint'] =$tmp[2];
1469 }
1471 if(isset($tmp[3])){
1472 $tmp2['PwdHash'] =$tmp[3];
1473 }else{
1474 $tmp2['PwdHash'] ="";
1475 }
1476 if(isset($tmp[4])){
1477 $tmp2['Username'] =$tmp[4];
1478 }else{
1479 $tmp2['Username'] ="";
1480 }
1481 $tmp2['UsedByAllUsers'] = FALSE;
1482 $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
1483 }
1484 }
1486 /* Prepare Shares */
1487 if((isset($this->multi_attrs['gotoShare']))&&(is_array($this->multi_attrs['gotoShare']))){
1488 unset($this->multi_attrs['gotoShare']['count']);
1489 foreach($this->multi_attrs['gotoShare'] as $share){
1490 $tmp = $tmp2 = array();
1491 $tmp = split("\|",$share);
1492 $tmp2['server'] =$tmp[0];
1493 $tmp2['name'] =$tmp[1];
1495 /* Decode base64 if needed */
1496 if (!preg_match('%/%', $tmp[2])){
1497 $tmp2['mountPoint'] =base64_decode($tmp[2]);
1498 } else {
1499 $tmp2['mountPoint'] =$tmp[2];
1500 }
1502 if(isset($tmp[3])){
1503 $tmp2['PwdHash'] =$tmp[3];
1504 }else{
1505 $tmp2['PwdHash'] ="";
1506 }
1507 if(isset($tmp[4])){
1508 $tmp2['Username'] =$tmp[4];
1509 }else{
1510 $tmp2['Username'] ="";
1511 }
1512 $tmp2['UsedByAllUsers'] = TRUE;
1513 $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
1514 }
1515 }
1518 /* prepare LogonScripts */
1519 if((isset($this->multi_attrs_all['gotoLogonScript']))&&(is_array($this->multi_attrs_all['gotoLogonScript']))){
1520 unset($this->multi_attrs_all['gotoLogonScript']['count']);
1521 foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
1522 $tmp = $tmp2 = array();
1523 $tmp = split("\|",$device);
1524 $tmp2['LogonName'] = $tmp[0];
1525 $tmp2['LogonPriority'] = $tmp[2];
1526 if(preg_match("/O/i",$tmp[1])){
1527 $tmp2['LogonOverload'] = "O";
1528 }else{
1529 $tmp2['LogonOverload'] = "";
1530 }
1531 if(preg_match("/L/i",$tmp[1])){
1532 $tmp2['LogonLast'] = "L";
1533 }else{
1534 $tmp2['LogonLast'] = "";
1535 }
1536 $tmp2['LogonData'] = base64_decode($tmp[3]);
1537 $tmp2['LogonDescription'] = $tmp[4];
1538 $tmp2['UsedByAllUsers'] = FALSE;
1539 $this->gotoLogonScripts[$tmp[0]]=$tmp2;
1540 }
1541 }
1543 /* prepare LogonScripts */
1544 if((isset($this->multi_attrs['gotoLogonScript']))&&(is_array($this->multi_attrs['gotoLogonScript']))){
1545 unset($this->multi_attrs['gotoLogonScript']['count']);
1546 foreach($this->multi_attrs['gotoLogonScript'] as $device){
1547 $tmp = $tmp2 = array();
1548 $tmp = split("\|",$device);
1549 $tmp2['LogonName'] = $tmp[0];
1550 $tmp2['LogonPriority'] = $tmp[2];
1551 if(preg_match("/O/i",$tmp[1])){
1552 $tmp2['LogonOverload'] = "O";
1553 }else{
1554 $tmp2['LogonOverload'] = "";
1555 }
1556 if(preg_match("/L/i",$tmp[1])){
1557 $tmp2['LogonLast'] = "L";
1558 }else{
1559 $tmp2['LogonLast'] = "";
1560 }
1561 $tmp2['LogonData'] = base64_decode($tmp[3]);
1562 $tmp2['LogonDescription'] = $tmp[4];
1563 $tmp2['UsedByAllUsers'] = TRUE;
1564 $this->gotoLogonScripts[$tmp[0]]=$tmp2;
1565 }
1566 }
1568 /* Prepare hotplugs */
1569 if(isset($this->multi_attrs_all['gotoHotplugDeviceDN']) && is_array($this->multi_attrs_all['gotoHotplugDeviceDN'])){
1570 $ldap = $this->config->get_ldap_link();
1571 $ldap->cd($this->config->current['BASE']);
1572 for($i = 0 ; $i < $this->multi_attrs_all['gotoHotplugDeviceDN']['count'] ; $i ++){
1573 $ldap->cat($this->multi_attrs_all['gotoHotplugDeviceDN'][$i]);
1574 if($ldap->count()){
1575 $multi_attrs_all = $ldap->fetch();
1577 if(isset($multi_attrs_all['gotoHotplugDevice'][0])){
1578 $tmp = preg_split("/\|/",$multi_attrs_all['gotoHotplugDevice'][0]);
1579 $tmp2 = array();
1580 $tmp2['name'] = $multi_attrs_all['cn'][0];
1581 $tmp2['description'] = $tmp[0];
1582 $tmp2['id'] = $tmp[1];
1583 $tmp2['produkt'] = $tmp[2];
1584 $tmp2['vendor'] = $tmp[3];
1585 $tmp2['dn'] = $multi_attrs_all['dn'];
1586 $tmp2['UsedByAllUsers'] = FALSE;
1587 $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
1588 }
1589 }
1590 }
1591 }
1593 /* Prepare hotplugs */
1594 if(isset($this->multi_attrs['gotoHotplugDeviceDN']) && is_array($this->multi_attrs['gotoHotplugDeviceDN'])){
1595 $ldap = $this->config->get_ldap_link();
1596 $ldap->cd($this->config->current['BASE']);
1597 for($i = 0 ; $i < $this->multi_attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
1598 $ldap->cat($this->multi_attrs['gotoHotplugDeviceDN'][$i]);
1599 if($ldap->count()){
1600 $multi_attrs = $ldap->fetch();
1602 if(isset($multi_attrs['gotoHotplugDevice'][0])){
1603 $tmp = preg_split("/\|/",$multi_attrs['gotoHotplugDevice'][0]);
1604 $tmp2 = array();
1605 $tmp2['name'] = $multi_attrs['cn'][0];
1606 $tmp2['description'] = $tmp[0];
1607 $tmp2['id'] = $tmp[1];
1608 $tmp2['produkt'] = $tmp[2];
1609 $tmp2['vendor'] = $tmp[3];
1610 $tmp2['dn'] = $multi_attrs['dn'];
1611 $tmp2['UsedByAllUsers'] = TRUE;
1612 $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
1613 }
1614 }
1615 }
1616 }
1617 $this->gotoHotplugDevices = array_values($this->gotoHotplugDevices);
1618 for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
1619 $chr = $this->gotoProfileFlags[$i];
1620 $name = "gotoProfileFlag".$chr;
1621 $this->$name=$chr;
1622 }
1623 $this->update_kiosk_profiles();
1624 $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
1626 if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
1627 $this->useProfile = true;
1628 }else{
1629 $this->useProfile = false;
1630 }
1632 }
1635 function set_multi_edit_values($attrs)
1636 {
1637 $shares = $this->gotoShares;
1638 $scripts= $this->gotoLogonScripts;
1639 $plugs= $this->gotoHotplugDevices;
1640 plugin::set_multi_edit_values($attrs);
1642 $this->gotoShares = $shares;
1643 $this->gotoLogonScripts = $scripts;
1644 $this->gotoHotplugDevices = $plugs;
1646 foreach($attrs['gotoShares'] as $name => $share){
1647 if($share['UsedByAllUsers'] == TRUE){
1648 $this->gotoShares[$name] = $share;
1649 }
1650 }
1651 foreach($this->gotoShares as $name => $share){
1652 if(!isset($attrs['gotoShares'][$name])){
1653 unset($this->gotoShares[$name]);
1654 }
1655 }
1656 foreach($attrs['gotoLogonScripts'] as $name => $script){
1657 if($script['UsedByAllUsers'] == TRUE){
1658 $this->gotoLogonScripts[$name] = $script;
1659 }
1660 }
1661 foreach($this->gotoLogonScripts as $name => $script){
1662 if(!isset($attrs['gotoLogonScripts'][$name])){
1663 unset($this->gotoLogonScripts[$name]);
1664 }
1665 }
1666 $tmp = array();
1667 foreach($this->gotoHotplugDevices as $entry){
1668 $tmp[$entry['dn']] = $entry;
1669 }
1671 foreach($attrs['gotoHotplugDevices'] as $name => $plug){
1672 if($plug['UsedByAllUsers'] == TRUE){
1673 $tmp[$plug['dn']] = $plug;
1674 }
1675 }
1676 foreach($tmp as $name => $plug){
1677 $found = false;
1678 foreach($attrs['gotoHotplugDevices'] as $test){
1679 if($test['dn'] == $name){
1680 $found = true;
1681 }
1682 }
1683 if(!$found){
1684 unset($tmp[$name]);
1685 }
1686 }
1687 }
1690 /* Return selected values for multiple edit */
1691 function get_multi_edit_values()
1692 {
1693 $ret = plugin::get_multi_edit_values();
1694 $ret['gotoShares'] = $this->gotoShares;
1695 $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
1696 $ret['gotoHotplugDevices'] = $this->gotoHotplugDevices;
1698 if(in_array("gotoPrinter",$this->multi_boxes)){
1699 $ret['gotoPrinter'] = $this->gotoPrinter;
1700 $ret['gotoPrinterSel'] = $this->gotoPrinterSel;
1701 $ret['gosaDefaultPrinter'] = $this->gosaDefaultPrinter;
1703 /* Force printer reset */
1704 $ret['add_del_printer_member_was_called'] = TRUE;
1705 }
1707 if(in_array("gotoProfileFlagL",$this->multi_boxes)){
1708 $ret['gotoProfileFlagL'] = $this->gotoProfileFlagL;
1709 }
1711 if(in_array("useProfile",$this->multi_boxes)){
1712 $ret['useProfile']=$this->useProfile;
1713 if(in_array("gotoProfileServer",$this->multi_boxes)){
1714 $ret['gotoProfileServer']=$this->gotoProfileServer;
1715 }
1716 if(in_array("gotoProfileQuota",$this->multi_boxes)){
1717 $ret['gotoProfileQuota']=$this->gotoProfileQuota;
1718 }
1719 if(in_array("gotoProfileFlagC",$this->multi_boxes)){
1720 $ret['gotoProfileFlagC'] = $this->gotoProfileFlagC;
1721 }
1722 }
1723 if(in_array("gotoXResolution",$this->multi_boxes)){
1724 $ret['gotoXResolution'] = $this->gotoXResolution;
1725 }
1726 if(in_array("kiosk_server",$this->multi_boxes)){
1727 $ret['gotoKioskProfile_Server'] = $this->gotoKioskProfile_Server;
1728 $ret['gotoKioskProfile_Profile'] = $this->gotoKioskProfile_Profile;
1729 }
1730 return($ret);
1731 }
1734 function multiple_check()
1735 {
1736 $message = plugin::multiple_check();
1737 $this->detect_grouptype();
1739 if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array("gotoProfileQuota",$this->multi_boxes)) {
1740 $message[] = msgPool::invalid(_("Profile quota"),$this->gotoProfileQuota,"/[0-9]/") ;
1741 }
1742 return($message);
1743 }
1746 function multiple_save_object()
1747 {
1748 if(isset($_POST['environment_multiple_posted'])){
1749 plugin::multiple_save_object();
1751 if(isset($_POST['useProfile'])){
1752 $this->useProfile = true;
1753 }else{
1754 $this->useProfile = false;
1755 }
1756 if(isset($_POST['gotoProfileFlagC'])){
1757 $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
1758 }else{
1759 $this->gotoProfileFlagC = false;
1760 }
1762 if(isset($_POST['gotoProfileFlagL'])){
1763 $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
1764 }else{
1765 $this->gotoProfileFlagL = false;
1766 }
1768 foreach(array("gotoProfileFlagL","gotoPrinter","kiosk_server","gotoXResolution",
1769 "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $attr){
1770 $uattr = "use_".$attr;
1771 if(isset($_POST[$uattr])){
1772 $this->multi_boxes[] = $attr;
1773 }
1774 }
1775 if(isset($_POST['kiosk_server'])){
1776 $tmp = $_POST['kiosk_server'];
1777 if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
1778 $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
1779 }
1780 }
1781 if(isset($_POST['kiosk_profile'])){
1782 $tmp = $_POST['kiosk_profile'];
1783 if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
1784 $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
1785 }
1786 }
1788 }
1789 }
1791 /* Return plugin informations for acl handling
1792 #FIXME these ACLs should work for groups too */
1793 static function plInfo()
1794 {
1795 return (array("plShortName" => _("Environment"),
1796 "plDescription" => _("Environment settings"), // Description
1797 "plSelfModify" => TRUE,
1798 "plDepends" => array("user", "posixAccount"), // This plugin depends on
1799 "plPriority" => 3, // Position in tabs
1800 "plSection" => array("personal" => _("My account")),
1801 "plCategory" => array("users",
1802 "groups"),
1803 "plOptions" => array("resolution_hook" => array("type" => "string",
1804 "description" => _("Command to extend the list of possible screen resolutions"))),
1806 "plProvidedAcls" => array(
1808 "gotoProfileServer" => _("Profile server") ,
1809 "gotoProfileQuota" => _("Profile quota") ,
1810 "gotoProfileFlagC" => _("Cache profile localy") ,
1811 "gotoShare" => _("Shares"),
1812 "gotoHotplugDevice" => _("Hotplug devices"),
1813 "gotoKioskProfile" => _("Kiosk profile") ,
1814 "gotoProfileFlagL" => _("Resolution changeable during session") ,
1815 "gotoXResolution" => _("Resolution") ,
1816 "gotoLogonScript" => _("Logon script"))
1817 ));
1818 }
1819 }
1821 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1822 ?>