1 <?php
3 class environment extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary = "Manage server basic objects";
7 var $cli_description = "Some longer text\nfor help";
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10 /* attribute list for save action */
11 var $ignore_account = FALSE;
12 var $plHeadline = "Environment";
13 var $plDescription = "This does something";
14 var $dialog = false; // Indicates that we are currently editing in an seperate dialog
16 var $in_dialog = false;
17 var $uid = "";
19 var $is_group = false;
21 /* Attribute definition
22 */
24 /* profile management */
25 var $useProfile = false; // Specifies if we want to use a Server
26 var $gotoProfileServer = ""; // Specifies the selected profile server
27 var $gotoProfileServers = array();// Specifies all available and selectable servers
28 var $gotoProfileFlags = ""; // Flags enabled ? only used to set ACL and save
29 var $gotoProfileFlagC = ""; // Flag is set to C if we have the profile caching fucntion enabled
31 var $gotoXResolution = "auto"; // The selected resolution eg: 1024x768
32 var $gotoXResolutions = array();// Contains all available resolutions for this account
33 var $gotoProfileFlagL = ""; // Flag is set to L to enable runtime resolution change
34 var $gotoProfileQuota = ""; // User Quota Settings
36 /* Logon script section*/
37 var $gotoLogonScripts = array();// Contains all available Logon Scripts
38 var $gotoLogonScript = ""; // The selected Logon Script
40 /* Printer */
41 var $gotoPrinter = array();// All available Printer, with their configurations
42 var $gotoPrinterSel = ""; // The selected Printer
43 var $gosaDefaultPrinter = ""; // Default printer
45 /* Share */
46 var $gotoShares = array();// Current Share Options
47 var $gotoShare = ""; // currently selected Share Option
48 var $gotoShareSelections= array();// Available Shares for this account in Listbox format
49 var $gotoAvailableShares= array();// Available Shares for this account
51 /* Kiosk profile */
52 var $gotoKioskProfile = "none"; // The selected Kiosk Profile
53 var $gotoKioskProfiles = array();// All available Kiosk profiles
54 var $newKioskProfiles = array();
56 /* Hotplug Devices */
57 var $gotoHotplugDevice = array(); // Selected hotplug
58 var $gotoHotplugDevices = array();// Already configured hotplug devices
60 var $NewAddedPrinters = array();
61 var $NewDeletedPrinters = array();
63 /* general settings */
64 // Sets the attributes which will kept on page reload, which will be saved, ...
66 var $CopyPasteVars = array("gotoHotplugDevices","newKioskProfiles","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn");
68 var $attributes = array("uid","gotoProfileServer","gotoProfileFlags",
69 "gotoXResolution","gotoProfileQuota",
70 "gotoLogonScripts","gotoLogonScript",
71 "gotoPrinter", "gosaDefaultPrinter",
72 "gotoShares","gotoShare",
73 "gotoKioskProfile","gotoKioskProfiles"
74 );
75 var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here
76 var $cn;
77 var $OrigCn;
78 var $add_del_printer_member_was_called = false;
80 function environment ($config, $dn= NULL)
81 {
82 plugin::plugin ($config, $dn);
84 /* Setting uid to default */
85 if(isset($this->attrs['uid'][0])){
86 $this->uid = $this->attrs['uid'][0];
87 }
89 /* Check : Are we currently editing a group or user dialog */
90 if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
91 $suffix="Group";
92 $this->uid = $this->attrs['cn'][0];
93 $this->attrs['uid'] = $this->attrs['cn'][0];
94 $this->OrigCn = $this->attrs['cn'][0];
95 }else{
96 $suffix="User";
97 }
99 $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
101 /* Get all Printer assignments */
102 $ldap = $this->config->get_ldap_link();
103 $ldap->cd($this->config->current['BASE']);
104 $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
105 while($printer = $ldap->fetch()){
106 $this->gotoPrinter[$printer['cn'][0]]=$printer;
107 $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
108 }
109 $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
110 while($printer = $ldap->fetch()){
111 $this->gotoPrinter[$printer['cn'][0]]=$printer;
112 $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
113 }
115 /* prepare hotplugs */
116 if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
117 unset($this->attrs['gotoHotplugDevice']['count']);
118 foreach($this->attrs['gotoHotplugDevice'] as $device){
119 $tmp = $tmp2 = array();
120 $tmp = split("\|",$device);
121 $tmp2['name'] = $tmp[0];
122 $tmp2['description'] = $tmp[1];
123 $tmp2['id'] = $tmp[2];
125 /* Produkt ID */
126 if(!isset($tmp[3])){
127 $tmp[3] = "";
128 }
129 /* Vendor ID */
130 if(!isset($tmp[4])){
131 $tmp[4] = "";
132 }
134 $tmp2['produkt'] = $tmp[3];
135 $tmp2['vendor'] = $tmp[4];
137 $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
138 }
139 }
141 /* prepare LogonScripts */
142 if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
143 unset($this->attrs['gotoLogonScript']['count']);
144 foreach($this->attrs['gotoLogonScript'] as $device){
145 $tmp = $tmp2 = array();
146 $tmp = split("\|",$device);
147 $tmp2['LogonName'] = $tmp[0];
148 $tmp2['LogonPriority'] = $tmp[2];
149 if(preg_match("/O/i",$tmp[1])){
150 $tmp2['LogonOverload'] = "O";
151 }else{
152 $tmp2['LogonOverload'] = "";
153 }
154 if(preg_match("/L/i",$tmp[1])){
155 $tmp2['LogonLast'] = "L";
156 }else{
157 $tmp2['LogonLast'] = "";
158 }
159 $tmp2['LogonData'] = base64_decode($tmp[3]);
160 $tmp2['LogonDescription'] = $tmp[4];
161 $this->gotoLogonScripts[$tmp[0]]=$tmp2;
162 }
163 }
165 /* Prepare Shares */
166 if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
167 unset($this->attrs['gotoShare']['count']);
168 foreach($this->attrs['gotoShare'] as $share){
169 $tmp = $tmp2 = array();
170 $tmp = split("\|",$share);
171 $tmp2['server'] =$tmp[0];
172 $tmp2['name'] =$tmp[1];
174 /* Decode base64 if needed */
175 if (!preg_match('%/%', $tmp[2])){
176 $tmp2['mountPoint'] =base64_decode($tmp[2]);
177 } else {
178 $tmp2['mountPoint'] =$tmp[2];
179 }
181 if(isset($tmp[3])){
182 $tmp2['PwdHash'] =$tmp[3];
183 }else{
184 $tmp2['PwdHash'] ="";
185 }
186 if(isset($tmp[4])){
187 $tmp2['Username'] =$tmp[4];
188 }else{
189 $tmp2['Username'] ="";
190 }
191 $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
192 }
193 }
195 for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
196 $chr = $this->gotoProfileFlags[$i];
197 $name = "gotoProfileFlag".$chr;
198 $this->$name=$chr;
199 }
201 if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
202 $this->useProfile = true;
203 }else{
204 $this->useProfile = false;
205 }
207 /* Set resolutions */
208 $this->gotoXResolutions = array("auto"=>_("auto"),
209 "640x480" => "640x480",
210 "800x600" => "800x600",
211 "1024x768" => "1024x768",
212 "1152x864" => "1152x864",
213 "1280x768" => "1280x768",
214 "1280x1024" => "1280x1024");
216 if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
217 $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
219 if(is_readable($file)){
220 $str = file_get_contents($file);
221 $lines = split("\n",$str);
222 foreach($lines as $line){
223 $line = trim($line);
224 if(!empty($line)){
225 $this->gotoXResolutions[$line]=$line;
226 }
227 }
228 //natcasesort($this->gotoXResolutions);
229 }else{
230 print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
231 }
232 }
234 $this->gotoProfileServers= $config->getShareServerList() ;
235 $this->gotoShareSelections= $config->getShareList(true);
236 $this->gotoAvailableShares= $config->getShareList(false);
238 }
241 /* Detect type of edited object (user|group)*/
242 function detect_grouptype()
243 {
244 if((!isset($this->parent))&&(!$this->is_account)){
245 $this->is_group = false;
246 }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
247 $this->is_group = true;
248 }else{
249 $this->is_group = false;
250 }
251 }
254 function execute()
255 {
256 /* Call parent execute */
257 plugin::execute();
259 /* Are we editing from MyAccount and not editing a user */
260 $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
262 /* Check profile server */
263 if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
264 if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
265 if(count($this->gotoProfileServers)){
267 /* Get First Profile */
268 $new = key($this->gotoProfileServers);
270 /* Another profile server found */
271 print_red(sprintf(_("Your selected profile server '%s' is no longer available. Setting profile server to '%s'."),
272 $this->gotoProfileServer,$new));
273 }else{
275 /* No other profile servers found */
276 print_red(sprintf(_("Your selected profile server '%s' is no longer available. Profile server configuration is resetted."),
277 $this->gotoProfileServer));
278 $this->gotoProfileServer = "";
279 }
280 }
281 }
283 $this->detect_grouptype();
285 /* Fill templating stuff */
286 $smarty= get_smarty();
287 $display= "";
289 $smarty->assign("is_group",$this->is_group);
291 /* Prepare all variables for smarty */
292 foreach($this->attributes as $s_attr){
293 /* Set value*/
294 $smarty->assign($s_attr,$this->$s_attr);
296 /* Set checkbox state*/
297 if(empty($this->$s_attr)){
298 $smarty->assign($s_attr."CHK","");
299 }else{
300 $smarty->assign($s_attr."CHK"," checked ");
301 }
303 /* Prepare ACL settings*/
304 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
305 }
307 /* Is accout enabled | are we editing from usermenu or admin menu
308 All these tab management is done here
309 */
312 /* Working from Usermenu an the Account is currently disbled
313 * this->parent : is only set if we are working in a list of tabs
314 * is_account : is only true if the needed objectClass is given
315 */
316 if((!isset($this->parent))&&(!$this->is_account)){
317 /* We are currently editing this tab from usermenu, but this account is not enabled */
318 $smarty->assign("is_account",$this->is_account);
319 /* Load template */
320 $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
321 /* Avoid the "You are currently editing ...." message when you leave this tab */
322 $display .= back_to_main();
323 /* Display our message to the user */
324 return $display;
327 /* We are currently editing from group tabs, because
328 * $this->parent is set
329 * posixAccount is not set, so we are not in usertabs.
330 */
331 }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
332 $smarty->assign("is_account","true");
333 $this->uid = $this->cn;
334 $this->attrs['uid'] = $this->cn;
336 /* Change state if needed */
337 if (isset($_POST['modify_state'])){
338 if(($this->acl_is_createable() && !$this->is_account) ||
339 ($this->acl_is_removeable() && $this->is_account)){
340 $this->is_account= !$this->is_account;
341 }
342 }
343 /* Group Dialog with enabled environment options */
344 if ($this->is_account){
345 $display= $this->show_enable_header(_("Remove environment extension"),
346 _("Environment extension enabled. You can disable it by clicking below."));
347 } else {
349 /* Environment is disabled
350 If theres is no posixAccount enabled, you won't be able to enable
351 environment extensions
352 */
353 if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
354 // 4. There is a PosixAccount
355 $display= $this->show_enable_header(_("Add environment extension"),
356 _("Environment extension disabled. You can enable it by clicking below."));
357 return $display;
358 }else{
359 // 4. There is no PosixAccount
360 $display= $this->show_enable_header(_("Add environment extension"),
361 _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
362 return $display;
363 }
364 }
365 }else{
366 /* Editing from Usermenu
367 * Tell smarty that this accoutn is enabled
368 */
369 $smarty->assign("is_account","true");
371 /* Change state if needed */
372 if (isset($_POST['modify_state'])){
373 if(($this->acl_is_createable() && !$this->is_account) ||
374 ($this->acl_is_removeable() && $this->is_account)){
375 $this->is_account= !$this->is_account;
376 }
377 }
379 if(isset($this->parent)){
381 // 3. Account enabled . Editing from adminmenu
382 if ($this->is_account){
383 $display= $this->show_disable_header(_("Remove environment extension"),
384 _("Environment extension enabled. You can disable it by clicking below."));
385 } else {
387 if($this->parent->by_object['posixAccount']->is_account==true){
388 // 4. There is a PosixAccount
389 $display= $this->show_disable_header(_("Add environment extension"),
390 _("Environment extension disabled. You can enable it by clicking below."));
391 return $display;
392 }else{
393 // 4. There is a PosixAccount
394 $display= $this->show_disable_header(_("Add environment extension"),
395 _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
396 return $display;
397 }
398 }
399 }
400 }
401 /* Account is Account : is_accounbt=true.
402 * Else we won't reach this.
403 */
405 /* Prepare all variables for smarty */
406 foreach($this->attributes as $s_attr){
407 /* Set value*/
408 $smarty->assign($s_attr,$this->$s_attr);
410 /* Set checkbox state*/
411 if(empty($this->$s_attr)){
412 $smarty->assign($s_attr."CHK","");
413 }else{
414 $smarty->assign($s_attr."CHK"," checked ");
415 }
417 /* Prepare ACL settings*/
418 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
419 }
421 foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
422 $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
423 }
425 if($WriteOnly) {
426 $smarty->assign("gotoPrinterACL","r");
427 }else{
428 $smarty->assign("gotoPrinterACL","rw");
429 }
431 if(empty($this->useProfile)){
432 $smarty->assign("useProfileCHK","");
433 $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
434 $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
435 $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
436 }else{
437 $smarty->assign("useProfileCHK"," checked ");
438 }
440 $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
441 $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
443 /* HANDLE Profile Settings here
444 * Assign available Quota and resolution settings
445 * Get all available profile server
446 * Get cache checkbox
447 * Assign this all to Smarty
448 */
450 if(empty($this->gotoProfileFlagL)){
451 $smarty->assign("gotoProfileFlagLCHK"," ");
452 }else{
453 $smarty->assign("gotoProfileFlagLCHK"," checked ");
454 }
456 if(empty($this->gotoProfileFlagC)){
457 $smarty->assign("gotoProfileFlagCCHK"," ");
458 }else{
459 $smarty->assign("gotoProfileFlagCCHK"," checked ");
460 }
463 $smarty->assign("gotoXResolutions" , $this->gotoXResolutions);
464 $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
466 $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
467 if(!is_array($this->gotoProfileServers)){
468 $this->gotoProfileServers =array();
469 }
470 $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
472 /* Handle kiosk profiles
473 * Read available from filesystem
474 * Open management if post is transmitted
475 */
477 /* Save */
478 if(isset($_POST['KioskClose'])){
479 $this->newKioskProfiles = array_merge($this->newKioskProfiles,$this->dialog->save());
481 unset($this->dialog);
482 $this->dialog=NULL;
483 $this->is_dialog = false;
484 }
486 /* Reassign help class */
487 $_SESSION['current_class_for_help'] = get_class($this);
489 /* Open Management Dialog */
490 if(isset($_POST['KioskManagementDialog'])){
491 $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles);
492 $this->dialog->parent= $this;
493 $this->dialog->acl = $this->acl;
494 $this->is_dialog = true;
495 }
496 $tmp = new kioskManagementDialog($this->config,$this->dn);
497 $list = $tmp->getKioskProfiles($this->newKioskProfiles);
498 $list['none']=_("None");
499 $list = array_reverse($list);
500 $smarty->assign("gotoKioskProfiles",$list);
501 $smarty->assign("gotoKioskProfileKeys",array_flip($list));
503 /* Logonscript Management
504 * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group)
505 * Perform add Delete edit Posts
506 */
508 /* Dialog Save */
509 if(isset($_POST['LogonSave'])){
511 if(!$this->acl_is_writeable("gotoLogonScript")){
512 print_red(_("You are not allowed to write Logon scripts."));
513 unset($this->dialog);
514 $this->dialog=NULL;
515 $this->is_dialog=false;
516 }else{
517 $this->dialog->save_object();
518 if(count($this->dialog->check())!=0){
519 foreach($this->dialog->check() as $msg){
520 print_red($msg);
521 }
522 }else{
523 $tmp = $this->dialog->save();
524 unset($this->dialog);
525 $this->dialog=NULL;
526 $this->is_dialog=false;
527 $this->gotoLogonScripts[$tmp['LogonName']]=$tmp;
528 }
529 }
530 }
533 /* Dialog Quit without saving */
534 if(isset($_POST['LogonCancel'])){
535 $this->is_dialog= false;
536 unset($this->dialog);
537 $this->dialog= NULL;
538 }
540 /* Check Edit Del New Posts for a selected LogonScript */
541 if($this->acl_is_writeable("gotoLogonScript") &&
542 (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
544 /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
545 * In this case we create a new Logon Script.
546 */
547 if(isset($_POST['gotoLogonScriptNew'])){
548 $this->is_dialog = true;
549 $this->dialog = new logonManagementDialog($this->config,$this->dn);
550 }
552 /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
553 * We only can delete if there is an entry selected.
554 */
555 if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
556 unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
557 }
559 /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
560 * There must be an entry selected to perform edit request.
561 */
562 if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
563 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
564 $this->is_dialog = true;
565 $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
566 }
567 }
569 /* Append List to smarty*/
570 $smarty->assign("gotoLogonScripts", $this->printOutLogonScripts());
571 $smarty->assign("gotoLogonScriptKeys",array_flip($this->printOutLogonScripts()));
573 /* In this section server shares will be defined
574 * A user can select one of the given shares and a mount point
575 * and attach this combination to his setup.
576 */
578 $smarty->assign("gotoShareSelections", $this->gotoShareSelections);
579 if(!is_array($this->gotoShareSelections)){
580 print $this->gotoShareSelections;
581 $this->gotoShareSelections = array();
582 }
583 $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
585 /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
586 * This entry will be, a combination of mountPoint and sharedefinitions
587 */
588 if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
589 /* We assign a share to this user, if we don't know where to mount the share */
590 if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
591 print_red(_("You must specify a valid mount point."));
592 }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
593 print_red(_("Spaces are not allowed in the mount path!"));
594 }elseif(!(
595 preg_match("/^\//",$_POST['gotoShareMountPoint']) ||
596 preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
597 preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
598 preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
599 preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
600 preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
601 preg_match("/^%/",$_POST['gotoShareMountPoint'])
602 )
603 ){
604 print_red(_("You must specify a valid mount point."));
605 }else{
606 $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
607 $s_mount = $_POST['gotoShareMountPoint'];
608 $s_user = $_POST['ShareUser'];
609 /* Preparing the new assignment */
610 $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
611 $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
612 $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
613 $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
614 }
615 }
617 /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
618 * If there is no defined share selected, we will abort the deletion without any message
619 */
620 $once = true;
621 if($this->acl_is_writeable("gotoShare")){
622 foreach($_POST as $name => $value){
623 if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
624 $once = false;
625 $key = preg_replace("/^gotoShareDel_/","",$name);
626 $key = preg_replace("/_+[xy]$/","",$key);
627 $key = base64_decode($key);
628 if(isset($this->gotoShares[$key])) {
629 unset($this->gotoShares[$key]);
630 }
632 /* Remove corresponding password entry, too. This is a workaround
633 to get rid of old-style entries. */
634 $key= preg_replace("/\|/", "|!", $key);
635 if(isset($this->gotoShares[$key])) {
636 unset($this->gotoShares[$key]);
637 }
638 }
639 if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
640 $once = false;
641 $key = preg_replace("/^gotoShareResetPwd_/","",$name);
642 $key = preg_replace("/_+[xy]$/","",$key);
643 $key = base64_decode($key);
644 $this->gotoShares[$key]['PwdHash'] = "";
645 if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
646 unset($this->gotoShares[$key]);
647 }
648 }
649 }
650 }
651 $divlistShares = new divSelectBox("gotoShares");
652 $divlistShares->SetHeight(100);
655 $tmp = array();
656 if($this->acl_is_readable("gotoShares")){
657 $tmp = $this->printOutAssignedShares();
658 }
661 foreach($tmp as $key => $value){
662 $img = "";
664 /* Check if entry starts with an ! */
665 if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
667 /* If we are currently editing groups environment, skip those ! entries */
668 if($this->is_group) continue;
670 /* Create pwd reset images */
671 if($this->gotoShares[$key]['PwdHash'] != ""){
672 $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."'
673 title='"._("Reset password hash")."'>";
674 }
675 $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
676 $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
677 }else{
679 /* Create pwd reset img && delete image */
680 if($this->gotoShares[$key]['PwdHash'] != ""){
681 $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."'
682 title='"._("Reset password hash")."'>";
683 $img.= " ";
684 }
685 $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."'
686 title='"._("Delete share entry")."'>";
687 $field1 = array("string" => $value);
688 $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
689 }
690 $divlistShares->AddEntry(array($field1,$field2));
691 }
692 $smarty->assign("divlistShares",$divlistShares->DrawList());
694 /* Hotplug devices will be handled here
695 * There are 3 possible methods for this feature
696 * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
697 * Delete will erase an entry, the entry must be selcted in the ListBox first
698 * Editing an entry will open a dialog where the informations about the selcted entry can be changed
699 */
701 /* If there is a new entry wanted, open a new entry by initilising the dialog */
702 if((isset($_POST['gotoHotplugDeviceNew'])) && ($this->acl_is_writeable("gotoHotplugDevice"))){
703 $this->dialog = new hotplugDialog($this->config,$this->dn);
704 $this->is_dialog = true;
705 }
707 /* We have to delete the selected hotplug from the list*/
708 if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice'])) && $this->acl_is_writeable("gotoHotplugDevice")){
709 if($this->acl_is_writeable("gotoHotplugDevice")){
710 foreach($_POST['gotoHotplugDevice'] as $name){
711 unset($this->gotoHotplugDevices[$name]);
712 }
713 }
714 }
716 /* There are already defined hotplugs from other users we could use */
717 if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
718 $tmp =array();
719 foreach($this->gotoHotplugDevices as $plugs){
720 $tmp[] = $plugs['name'];
721 }
722 $this->dialog = new hotplugDialog($this->config,$this->dn,true,$tmp);
723 $this->is_dialog = true;
724 }
726 /* Dialog Aborted */
727 if(isset($_POST['HotPlugCancel'])){
728 unset($this->dialog);
729 $this->dialog= NULL;
730 $this->is_dialog = false;
731 }
733 /* Dialod saved */
734 if(isset($_POST['HotPlugSave'])){
736 $this->dialog->save_object();
737 if(count($this->dialog->check())!=0){
738 foreach($this->dialog->check() as $msg){
739 print_red($msg);
740 }
741 }else{
742 $this->dialog->save_object();
743 $a_tmp = $this->dialog->save();
745 if(is_array($a_tmp)){
746 foreach($a_tmp as $name => $hotplug){
747 $this->gotoHotplugDevices[$name]= $hotplug;
748 }
749 }
750 unset($this->dialog);
751 $this->dialog= NULL;
752 $this->is_dialog = false;
753 }
754 }
755 $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
756 $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
758 /* Printer Assignment will managed below
759 * A printer can be assigned in two different ways and two different types
760 * There are 2 types of users assigned to a printer : user and admin
761 * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
762 * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
763 */
765 /* First handle Add Post. Open a dialog that allows us to select a printer or two */
766 if(isset($_POST['gotoPrinterAdd'])){
768 $this->is_dialog=true;
769 $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
770 }
772 if(isset($_POST['PrinterCancel'])){
773 $this->is_dialog=false;
774 unset($this->dialog);
775 $this->dialog=NULL;
776 }
778 if(isset($_POST['PrinterSave'])){
779 if(count($this->dialog->check())!=0){
780 $tmp = $this->dialog->check();
781 foreach($tmp as $msg){
782 print_red($msg);
783 }
784 }else{
785 $this->dialog->save_object();
786 $tmp = $this->dialog->save();
787 $tmp2= $this->dialog->getPrinter(true);
789 foreach($tmp as $pname){
790 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
791 $printerObj->set_acl_base($tmp2[$pname]['dn']);
793 $type = false;
795 if($this->is_group){
797 if(isset($this->NewDeletedPrinters[$pname])){
798 $type = "AddGroup";
799 }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
800 $type = "AddGroup";
801 }
802 }else{
803 if(isset($this->NewDeletedPrinters[$pname])){
804 $type = "AddUser";
805 }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
806 $type = "AddUser";
807 }
808 }
810 if($type){
811 $this->gotoPrinter[$pname]=$tmp2[$pname];
812 $this->gotoPrinter[$pname]['mode']="user";
813 $this->add_del_printer_member_was_called = true;
815 $this->NewAddedPrinters[$pname] = $pname;
816 if(isset($this->NewDeletedPrinters[$pname])){
817 unset($this->NewDeletedPrinters[$pname]);
818 }
819 }
820 }
822 $this->is_dialog=false;
823 unset($this->dialog);
824 $this->dialog =NULL;
825 }
826 }
828 if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
829 $printer = $_POST['gotoPrinterSel'];
830 foreach($printer as $pname){
832 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
833 $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
835 $type = false;
836 if($this->is_group){
837 if(isset($this->NewAddedPrinters[$pname])){
838 $type = "Group";
839 }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
840 $type = "Group";
841 }
842 }else{
843 if(isset($this->NewAddedPrinters[$pname])){
844 $type = "User";
845 }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
846 $type = "User";
847 }
848 }
849 if($type){
850 $this->add_del_printer_member_was_called = true;
851 unset($this->gotoPrinter[$pname]);
853 $this->NewDeletedPrinters[$pname] = $pname;
854 if(isset($this->NewAddedPrinters[$pname])){
855 UNSET($this->NewAddedPrinters[$pname]);
856 }
857 }
858 }
859 }
861 if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
862 $printers = $_POST['gotoPrinterSel'];
863 $this->add_del_printer_member_was_called = true;
864 foreach($printers as $printer){
865 if($this->gotoPrinter[$printer]['mode']=="user"){
866 $this->gotoPrinter[$printer]['mode']="admin";
867 }else{
868 $this->gotoPrinter[$printer]['mode']="user";
869 }
870 }
871 }
873 if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
874 if($this->is_group){
875 print_red(_("GOsa default printer flag is not allowed within groups."));
876 }else{
877 if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
878 $this->gosaDefaultPrinter= "";
879 } else {
880 $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
881 }
882 }
883 }
885 $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
886 $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
888 /* General behavior */
889 if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
890 $this->dialog->save_object();
891 $disp =$this->dialog->execute();
893 $tmp = new kioskManagementDialog($this->config,$this->dn);
894 $list = $tmp->getKioskProfiles($this->newKioskProfiles);
895 $list['none']=_("None");
896 $list = array_reverse($list);
897 if(!isset($list[$this->gotoKioskProfile])){
898 print_red(sprintf(_("The selected kiosk profile '%s' is no longer available, setting current profile to 'none'."),$this->gotoKioskProfile));
899 $this->gotoKioskProfile = 'none';
900 }
901 return($disp);
902 }
904 /* Als smarty vars are set. Get smarty template and generate output */
905 $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
906 return($display);
907 }
909 function remove_from_parent()
910 {
911 /* only if it was an account*/
912 if (!$this->initially_was_account){
913 return;
914 }
916 /* include global link_info */
917 $ldap= $this->config->get_ldap_link();
919 /* Remove and write to LDAP */
920 plugin::remove_from_parent();
922 /* Don't save our template variables */
923 $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoKioskProfiles","gotoHotplugDevices" );
925 /* Skip all these attributes */
926 foreach($skip as $del){
927 unset($this->attrs[$del]);
928 }
930 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
932 $ldap->cd($this->dn);
933 $this->cleanup();
934 $ldap->modify ($this->attrs);
936 show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
938 /* Optionally execute a command after we're done */
939 $this->handle_post_events("remove",array("uid" => $this->uid));
940 }
943 /* Save data to object */
944 function save_object()
945 {
946 /* Get all Posted vars
947 * Setup checkboxes
948 */
949 $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
950 if(isset($_POST['iamposted'])){
952 $PACL = $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
954 if(preg_match("/w/",$PACL)){
955 if(isset($_POST['useProfile'])){
956 $this->useProfile = true;
957 }else{
958 $this->useProfile = false;
959 }
960 }
962 if($this->acl_is_writeable("gotoProfileFlagC")){
963 if(isset($_POST['gotoProfileFlagC'])){
964 $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
965 }else{
966 $this->gotoProfileFlagC = false;
967 }
968 }
970 if($this->acl_is_writeable("gotoProfileFlagL")){
971 if(isset($_POST['gotoProfileFlagL'])){
972 $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
973 }else{
974 $this->gotoProfileFlagL = false;
975 }
976 }
978 plugin::save_object();
979 foreach($this->attributes as $s_attr){
980 if((!isset($_POST[$s_attr])) ||
981 in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
982 if(!$this->acl_is_writeable($s_attr)){
983 continue;
984 }else{
985 if(isset($_POST[$s_attr])){
986 $this->$s_attr = $_POST[$s_attr];
987 }else{
988 $this->$s_attr = false;
989 }
990 }
991 }
992 }
993 }
996 /* Check supplied data */
997 function check()
998 {
999 /* Call common method to give check the hook */
1000 $message= plugin::check();
1002 $this->detect_grouptype();
1004 if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
1005 $message[]=_("Please set a valid profile quota size.");
1006 }
1007 if(!isset($this->attrs['objectClass'])){
1008 $this->attrs['objectClass']=array();
1009 }
1010 if(!$this->is_group){
1011 if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
1012 $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));
1013 }
1014 }
1015 return ($message);
1016 }
1019 /* Save to LDAP */
1020 function save()
1021 {
1022 /* If group was renamed, all printer settings get lost
1023 */
1024 /* only save changed variables ....*/
1025 if ($this->gotoKioskProfile =="none") $this->gotoKioskProfile ="";
1026 if((!empty($this->gotoKioskProfile))&&($this->gotoKioskProfile != "none")){
1027 if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
1028 $method="https://";
1029 }else{
1030 $method="http://";
1031 }
1033 $str = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/kiosk/");
1034 $this->gotoKioskProfile= $str.$this->gotoKioskProfile;
1035 }else{
1036 $this->gotoKioskProfile= array();
1037 }
1039 plugin::save();
1040 $ldap= $this->config->get_ldap_link();
1042 $realyUsedAttrs= array();
1044 $path = search_config($this->config->data,"environment", "KIOSKPATH");
1045 /* Creating Kiosk Profiles */
1046 foreach($this->newKioskProfiles as $file){
1047 $contents = $file['contents'];
1048 $fp = @fopen($path."/".$file['name'],"w");
1049 if(!$fp){
1050 print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
1051 }else{
1052 fwrite($fp,$contents,strlen($contents));
1053 }
1054 @unlink($file['tmp_name']);
1055 }
1057 /* Save already used objectClasses */
1058 $ocs = $this->attrs['objectClass'];
1059 unset($ocs['count']);
1060 $this->attrs = array();
1061 $this->attrs['objectClass']= $ocs;
1062 foreach($this->objectclasses as $objc){
1063 if(!in_array($objc,$this->attrs['objectClass'])){
1064 $this->attrs['objectClass'][]=$objc;
1065 }
1066 }
1068 /* 1. Search all printers that have our uid/cn as member
1069 * 2. Delete this uid/cn from every single entry and save it again.
1070 * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
1071 * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal
1072 */
1074 $this->detect_grouptype();
1076 if($this->add_del_printer_member_was_called){
1078 $types = array( "gotoUserPrinter" => "AddUser",
1079 "gotoGroupPrinter" => "AddGroup",
1080 "gotoUserAdminPrinter" => "AddAdminUser",
1081 "gotoGroupAdminPrinter" => "AddAdminGroup");
1083 if($this->is_group){
1084 $s_suffix = "Group";
1085 $useVar = "cn";
1086 }else{
1087 $useVar = "uid";
1088 $s_suffix = "User";
1089 }
1091 /* Remove old entries */
1092 $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
1093 while($attr = $ldap->fetch()){
1094 $printerObj = NULL;
1095 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1096 $printerObj->set_acl_base($attr['dn']);
1097 $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
1098 $printerObj->by_object['printgeneric']->save();
1099 }
1101 $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
1102 while($attr = $ldap->fetch()){
1103 $printerObj = NULL;
1104 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1105 $printerObj->set_acl_base($attr['dn']);
1106 $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
1107 $printerObj->by_object['printgeneric']->save();
1108 }
1110 foreach($this->gotoPrinter as $printer){
1111 $printerObj = NULL;
1112 $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
1113 $printerObj->set_acl_base($printer['dn']);
1116 if($printer['mode'] == "admin") {
1117 $attribute = "goto".$s_suffix."AdminPrinter";
1118 }else{
1119 $attribute = "goto".$s_suffix."Printer";
1120 }
1122 $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
1123 $printerObj->by_object['printgeneric']->save();
1124 }
1125 }
1127 /* Prepare HotPlug devices */
1128 $this->attrs['gotoHotplugDevice'] = array();
1129 foreach($this->gotoHotplugDevices as $name => $device){
1130 $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'].
1131 "|".$device['produkt']."|".$device['vendor'];
1132 }
1134 /* Prepare LogonScripts */
1135 $this->attrs['gotoLogonScript'] = array();
1136 foreach($this->gotoLogonScripts as $name => $script){
1137 $this->attrs['gotoLogonScript'][] = $script['LogonName']."|".
1138 $script['LogonOverload'].$script['LogonLast']."|".
1139 $script['LogonPriority']."|".
1140 base64_encode($script['LogonData'])."|".
1141 $script['LogonDescription'];
1142 }
1144 /* Prepare Shares */
1145 $this->attrs['gotoShare']=array();
1146 foreach($this->gotoShares as $name => $share){
1147 $mntp= $share['mountPoint'];
1148 if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
1149 $mntp= base64_encode($mntp);
1150 }
1151 $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
1152 }
1155 if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
1156 $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
1158 foreach($saveThis as $tosave){
1159 if(!empty($this->$tosave)){
1160 $this->attrs[$tosave]=$this->$tosave;
1161 }else{
1162 $this->attrs[$tosave]=array();
1163 }
1164 }
1166 /* Prepare Flags */
1167 $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
1168 if(empty($this->attrs['gotoProfileFlags'][0])){
1169 $this->attrs['gotoProfileFlags']=array();
1170 }
1172 if($this->useProfile == false){
1173 $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
1174 $this->attrs['gotoProfileServer']= array();
1175 }
1177 $ldap->cat ($this->dn, array('dn'));
1178 if ($ldap->fetch()){
1179 $mode= "modify";
1180 } else {
1181 $mode= "add";
1182 $ldap->cd($this->config->current['BASE']);
1183 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
1184 }
1186 $ldap->cd($this->dn);
1187 $this->cleanup();
1188 $ldap->$mode($this->attrs);
1189 show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
1190 $this->handle_post_events($mode,array("uid"=>$this->uid));
1191 }
1193 /* Generate ListBox frindly output for the defined shares
1194 * Possibly Add or remove an attribute here,
1195 */
1196 function printOutAssignedShares()
1197 {
1198 $a_return = array();
1199 if(is_array($this->gotoShares)){
1200 foreach($this->gotoShares as $share){
1201 if(preg_match("/^!/",$share['server'])){
1202 $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share");
1203 }else{
1204 $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
1205 }
1206 }
1207 natcasesort($a_return);
1208 }
1209 return($a_return);
1210 }
1212 /* Generate ListBox frindly output for the definedhotplugs
1213 * Possibly Add or remove an attribute here,
1214 */
1215 function printOutHotPlugDevices()
1216 {
1217 $a_return= array();
1218 if(is_array($this->gotoHotplugDevices)){
1219 foreach($this->gotoHotplugDevices as $key=>$device){
1220 $a_return[$key] = $device['name']." - ".$device['id'];
1221 }
1222 }
1223 return($a_return);
1224 }
1226 /* Generates ListBox frienly output of used printer devices
1227 * Append ' - admin' if printer is used in admin mode
1228 */
1229 function printOutPrinterDevices()
1230 {
1231 $a_return = array();
1233 if($this->acl_is_readable("gotoPrinter")){
1235 if(is_array($this->gotoPrinter)){
1236 foreach($this->gotoPrinter as $printer){
1237 if($printer['mode'] == "admin"){
1238 $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
1239 }else{
1240 $a_return[$printer['cn'][0]]= $printer['cn'][0];
1241 }
1242 if ($printer['cn'][0] == $this->gosaDefaultPrinter){
1243 $a_return[$printer['cn'][0]].=" - "._("Default printer");
1244 }
1245 }
1246 }
1247 }
1248 return($a_return);
1249 }
1251 /* Generates ListBox frienly output of used logonscripts
1252 */
1253 function printOutLogonScripts()
1254 {
1255 $a_return = array();
1256 if(is_array($this->gotoLogonScripts)){
1257 foreach($this->gotoLogonScripts as $script){
1258 $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName'];
1259 }
1260 }
1261 return($a_return);
1262 }
1265 /* Return plugin informations for acl handling
1266 #FIXME these ACLs should work for groups too */
1267 function plInfo()
1268 {
1269 return (array("plShortName" => _("Environment"),
1270 "plDescription" => _("Environment settings"), // Description
1271 "plSelfModify" => TRUE,
1272 "plDepends" => array("user", "posixAccount"), // This plugin depends on
1273 "plPriority" => 3, // Position in tabs
1274 "plSection" => "personal", // This belongs to personal
1275 "plCategory" => array("users", "groups"), // Add to following categories
1276 "plOptions" => array("resolution_hook" => array("type" => "string",
1277 "description" => _("Command to extend the list of possible screen resolutions"))),
1279 "plProvidedAcls" => array(
1281 "gotoProfileFlagL" => _("Resolution changeable during session") ,
1282 "gotoProfileFlagC" => _("Cache profile localy") ,
1284 "gotoProfileQuota" => _("Profile quota") ,
1285 "gotoProfileServer" => _("Profile server") ,
1287 "gotoXResolution" => _("Resolution") ,
1288 "gotoKioskProfile" => _("Kiosk profile") ,
1290 "gosaDefaultPrinter" => _("Default printer") ,
1291 "gotoLogonScript" => _("Logon script") ,
1292 "gotoHotplugDevice" => _("Hotplug devices"),
1293 "gotoShare" => _("Shares"))
1294 ));
1295 }
1296 }
1298 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1299 ?>