Code

Sorry for the huge commit:
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 18 Apr 2006 05:30:30 +0000 (05:30 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 18 Apr 2006 05:30:30 +0000 (05:30 +0000)
* Reworked get_list* and convert_dn*
* Fixed various design errors
* Started review of class_userManagement.inc
* Moved from "Finish" to "Save" in tab dialogs

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3046 594d385d-05f5-0310-b6e9-bd551577e9d8

62 files changed:
TODO
doc/guide/user/en/lyx-source/applications.lyx
doc/guide/user/en/lyx-source/blocklists.lyx
doc/guide/user/en/lyx-source/conference.lyx
doc/guide/user/en/lyx-source/departments.lyx
doc/guide/user/en/lyx-source/groups.lyx
doc/guide/user/en/lyx-source/macro.lyx
doc/guide/user/en/lyx-source/ogroups.lyx
doc/guide/user/en/lyx-source/systems.lyx
include/class_CopyPasteHandler.inc
include/class_config.inc
include/class_divlist.inc
include/class_ldap.inc
include/class_plugin.inc
include/functions.inc
locale/de/LC_MESSAGES/messages.mo
locale/de/LC_MESSAGES/messages.po
plugins/admin/applications/class_applicationManagement.inc
plugins/admin/applications/main.inc
plugins/admin/departments/class_departmentManagement.inc
plugins/admin/departments/main.inc
plugins/admin/fai/class_askClassName.inc
plugins/admin/fai/class_faiManagement.inc
plugins/admin/fai/main.inc
plugins/admin/groups/application.tpl
plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupMail.inc
plugins/admin/groups/class_groupManagement.inc
plugins/admin/groups/generic.tpl
plugins/admin/groups/main.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_ogroupManagement.inc
plugins/admin/ogroups/main.inc
plugins/admin/systems/class_glpiSelectUser.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/main.inc
plugins/admin/users/class_userManagement.inc
plugins/admin/users/main.inc
plugins/admin/users/template.tpl
plugins/gofax/blocklists/class_blocklistManagement.inc
plugins/gofax/blocklists/generic.tpl
plugins/gofax/blocklists/main.inc
plugins/gofax/faxaccount/class_gofaxAccount.inc
plugins/gofax/faxaccount/main.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc
plugins/gofon/conference/main.inc
plugins/gofon/macro/class_gofonMacroManagement.inc
plugins/gofon/macro/main.inc
plugins/gofon/phoneaccount/main.inc
plugins/personal/connectivity/main.inc
plugins/personal/environment/environment.tpl
plugins/personal/environment/hotplugDialogNew.tpl
plugins/personal/environment/main.inc
plugins/personal/generic/generic_certs.tpl
plugins/personal/generic/main.inc
plugins/personal/mail/class_mailAccount.inc
plugins/personal/mail/main.inc
plugins/personal/nagios/main.inc
plugins/personal/posix/class_posixAccount.inc
plugins/personal/posix/main.inc
plugins/personal/samba/class_sambaAccount.inc
plugins/personal/samba/main.inc

diff --git a/TODO b/TODO
index d59fd2ee65d0d03e825ff8c0bb8076d3add02501..cb68e5efa4754cd7124aba48c07e61897ee2c2f6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,20 @@
 Target for 2.4.1:
 =================
 
-* Sanity check: verteilserver == self?
+* Sanity check for workstations/servers: repository server == self?
+
+* Can't remove phoneAccounts...
+
+* Explaination of several FIXME's. Group removal, etc.
+
+* peopleou, groupou, fai, etc. as department? Please check!
+  Check during login/setup?
+
+* saveFilter added, please use!
+
+* Added functions normalizePreg and normalizeLdap. Please use where needed!
+
+* generatePasteIcon added, please use!
 
 * Create a status-bar/-display for FAI installations 
   (Use notes from 0.5.12.2005)
@@ -21,6 +34,10 @@ Target for 2.4.1:
 
 * Update the french manual ( OpenSides )
 
+* Pimp 1024x768 screen resolutions, it should be the minimum usable resoultion
+
+* Auto-Resize for subdialogs
+
 
 Target for 2.5:
 ===============
index e61b3d4ad11791ec5f24d4237dc659a9b33a19f3..d3b3293a0e8a56ad4fe7b92cf0b167027ac5eb4b 100644 (file)
@@ -191,7 +191,7 @@ You will see tabs.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 7016000fa7d73a6c85f924f8c84e5a9f1d19aeb7..e16ef2cf59b0fdbdca07db2b29bd679f01dbec30 100644 (file)
@@ -190,7 +190,7 @@ The administrator uses tabs to configure the blocklist.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 19ef7bddb40b238bb95f033fe4dfe4fe111840b2..6200ab172304b57580567459ebb42e86ffac06d9 100644 (file)
@@ -197,7 +197,7 @@ You will see tabs.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 8367f642f9c97ccf655831752a0beeaafd9e5164..c43e769c2c42ca514cc481329a79e036be833159 100644 (file)
@@ -193,7 +193,7 @@ You will see tabs.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 5f34cd07483f2ee6fe862cbfcb276346de405b21..ddbcb9374326cba1cd36c383f180e13dd25aeb36 100644 (file)
@@ -217,7 +217,7 @@ You will see tabs.
 \added_space_bottom medskip 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 087f942ceff6a01acae490245955182a906319bf..fb9056bc7056410ef7d7f65d9ed435bb3bf4170b 100644 (file)
@@ -194,7 +194,7 @@ You will see tabs.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index fb55a882ecb6c1c0272a970a2b047e4be1833753..a25802f81d4459bc4719be9d2223cce146a1fb0b 100644 (file)
@@ -201,7 +201,7 @@ You will see tabs.
 \added_space_bottom medskip 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 5afef635b0912ddb67b476b01e9ae84107d28740..fdb07847c1d2e120d4356449318543ee18879190 100644 (file)
@@ -240,7 +240,7 @@ Appear the space of configuration for each systems.
 
 To save changes use the 
 \emph on 
-Finish
+Save
 \emph default 
  button, to come back without saving use the 
 \emph on 
index 37e9a2e951c02c3c9d4acbbfd6295318a2c687e6..996407c3076ae1dacc55f3c458c61ea069dff41b 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+//FIXME: Comments are somewhat off the normal comment usage
 
 class CopyPasteHandler {
 
@@ -161,6 +162,7 @@ class CopyPasteHandler {
           if($displayMessageOnSuccess){
             return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
           }else{
+            //FIXME: Types!!! Either use strings, or use bool. But don't mix it!
             return( false);
           }
         }
@@ -223,6 +225,25 @@ class CopyPasteHandler {
     return($ret);
   }
 
+  
+  function generatePasteIcon()
+  {
+    $Copy_Paste= "&nbsp;<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    if($this->isCurrentObjectPastAble()){
+      if($this->isCurrentCutted()){
+        $img= "images/cutpaste.png";
+      }else{
+        $img= "images/copypaste.png";
+      }
+      $Copy_Paste.= "<input type='image' name='editPaste' class='center'
+        src='".$img."' alt='"._("Paste")."' title='".$this->GetCurrentDn()."'>&nbsp;";
+    }else{
+      $Copy_Paste.= "<img class='center' src='images/cant_editpaste.png' alt='"._("Can't paste")."'>&nbsp;";
+    }
+
+    return ($Copy_Paste);
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 0a8e35a4223b361f24c04604796fbf788fdbc1fd..c571906d60c675fc573d919e43512713dc71c8d0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  * This code is part of GOsa (https://gosa.gonicus.de)
- * Copyright (C) 2003  Cajus Pollmeier
+ * Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,8 +38,8 @@ class config  {
 
   /* Configuration data */
   var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(),
-               'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ),
-               'MENU' => array(), 'SERVICE' => array());
+      'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ),
+      'MENU' => array(), 'SERVICE' => array());
   var $basedir= "";
 
   /* Keep a copy of the current deparment list */
@@ -48,528 +48,515 @@ class config  {
 
   function config($filename, $basedir= "")
   {
-       $this->parser = xml_parser_create();
-       $this->basedir= $basedir;
+    $this->parser = xml_parser_create();
+    $this->basedir= $basedir;
 
-       xml_set_object($this->parser, $this);
-       xml_set_element_handler($this->parser, "tag_open", "tag_close");
+    xml_set_object($this->parser, $this);
+    xml_set_element_handler($this->parser, "tag_open", "tag_close");
 
-       /* Parse config file directly? */
-       if ($filename != ""){
-               $this->parse($filename);
-       }
+    /* Parse config file directly? */
+    if ($filename != ""){
+      $this->parse($filename);
+    }
   }
 
   function parse($filename)
   { 
-       $fh= fopen($filename, "r"); 
-       $xmldata= fread($fh, 100000);
-       fclose($fh); 
-       if(!xml_parse($this->parser, chop($xmldata))){
-               print_red(sprintf(_("XML error in gosa.conf: %s at line %d"),
-                       xml_error_string(xml_get_error_code($this->parser)),
-                       xml_get_current_line_number($this->parser)));
-               echo $_SESSION['errors'];
-               exit;
-       }
+    $fh= fopen($filename, "r"); 
+    $xmldata= fread($fh, 100000);
+    fclose($fh); 
+    if(!xml_parse($this->parser, chop($xmldata))){
+      print_red(sprintf(_("XML error in gosa.conf: %s at line %d"),
+            xml_error_string(xml_get_error_code($this->parser)),
+            xml_get_current_line_number($this->parser)));
+      echo $_SESSION['errors'];
+      exit;
+    }
   }
 
   function tag_open($parser, $tag, $attrs)
   { 
-       /* Save last and current tag for reference */
-       $this->tags[$this->level]= $tag;
-       $this->level++;
-
-       /* Trigger on CONF section */
-       if ($tag == 'CONF'){
-               $this->config_found= TRUE;
-       }
-
-       /* Return if we're not in config section */
-       if (!$this->config_found){
-               return;
-       }
-
-       /* Look through attributes */
-       switch ($this->tags[$this->level-1]){
-
-               /* Handle tab section */
-               case 'TAB':     $name= $this->tags[$this->level-2];
-               
-                               /* Create new array? */
-                               if (!isset($this->data['TABS'][$name])){
-                                       $this->data['TABS'][$name]= array();
-                               }
-
-                               /* Add elements */
-                               $this->data['TABS'][$name][]= $attrs;
-                               break;
-
-               /* Handle location */
-               case 'LOCATION':
-                               if ($this->tags[$this->level-2] == 'MAIN'){
-                                       $name= $attrs['NAME'];
-                                       $this->currentLocation= $name;
-
-                                       /* Add location elements */
-                                       $this->data['LOCATIONS'][$name]= $attrs;
-                               }
-                               break;
-
-               /* Handle referral tags */
-               case 'REFERRAL':
-                               if ($this->tags[$this->level-2] == 'LOCATION'){
-                                       $url= $attrs['URL'];
-                                       $server= preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', $url);
-
-                                       /* Add location elements */
-                                       if (!isset($this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'])){
-                                                $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL']= array();
-                                        }
-
-                                       $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'][$server]= $attrs;
-                               }
-                               break;
-
-               /* Handle language */
-               case 'LANGUAGE':
-                               if ($this->tags[$this->level-2] == 'MAIN'){
-                                       /* Add languages */
-                                       $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]= 
-                                               $attrs['TAG'];
-                               }
-                               break;
-
-               /* Handle faxformat */
-               case 'FAXFORMAT':       
-                               if ($this->tags[$this->level-2] == 'MAIN'){
-                                       /* Add fax formats */
-                                       $this->data['MAIN']['FAXFORMATS'][]= $attrs['TYPE'];
-                               }
-                               break;
-
-               /* Load main parameters */
-               case 'MAIN':
-                               $this->data['MAIN']= array_merge ($this->data['MAIN'], $attrs);
-                               break;
-
-               /* Load menu */
-               case 'SECTION':
-                               if ($this->tags[$this->level-2] == 'MENU'){
-                                       $this->section= $attrs['NAME'];
-                                       $this->data['MENU'][$this->section]= array(); ;
-                               }
-                               break;
-
-               /* Inser plugins */
-               case 'PLUGIN':
-                               if ($this->tags[$this->level-3] == 'MENU' &&
-                                   $this->tags[$this->level-2] == 'SECTION'){
-               
-                                       $this->data['MENU'][$this->section][$this->gpc++]= $attrs;
-                               }
-                               if ($this->tags[$this->level-2] == 'SERVICEMENU'){
-                                       $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
-                               }
-                               break;
-       }
+    /* Save last and current tag for reference */
+    $this->tags[$this->level]= $tag;
+    $this->level++;
+
+    /* Trigger on CONF section */
+    if ($tag == 'CONF'){
+      $this->config_found= TRUE;
+    }
+
+    /* Return if we're not in config section */
+    if (!$this->config_found){
+      return;
+    }
+
+    /* Look through attributes */
+    switch ($this->tags[$this->level-1]){
+
+      /* Handle tab section */
+      case 'TAB':      $name= $this->tags[$this->level-2];
+
+                  /* Create new array? */
+                  if (!isset($this->data['TABS'][$name])){
+                    $this->data['TABS'][$name]= array();
+                  }
+
+                  /* Add elements */
+                  $this->data['TABS'][$name][]= $attrs;
+                  break;
+
+                  /* Handle location */
+      case 'LOCATION':
+                  if ($this->tags[$this->level-2] == 'MAIN'){
+                    $name= $attrs['NAME'];
+                    $this->currentLocation= $name;
+
+                    /* Add location elements */
+                    $this->data['LOCATIONS'][$name]= $attrs;
+                  }
+                  break;
+
+                  /* Handle referral tags */
+      case 'REFERRAL':
+                  if ($this->tags[$this->level-2] == 'LOCATION'){
+                    $url= $attrs['URL'];
+                    $server= preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', $url);
+
+                    /* Add location elements */
+                    if (!isset($this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'])){
+                      $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL']= array();
+                    }
+
+                    $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'][$server]= $attrs;
+                  }
+                  break;
+
+                  /* Handle language */
+      case 'LANGUAGE':
+                  if ($this->tags[$this->level-2] == 'MAIN'){
+                    /* Add languages */
+                    $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]= 
+                      $attrs['TAG'];
+                  }
+                  break;
+
+                  /* Handle faxformat */
+      case 'FAXFORMAT':        
+                  if ($this->tags[$this->level-2] == 'MAIN'){
+                    /* Add fax formats */
+                    $this->data['MAIN']['FAXFORMATS'][]= $attrs['TYPE'];
+                  }
+                  break;
+
+                  /* Load main parameters */
+      case 'MAIN':
+                  $this->data['MAIN']= array_merge ($this->data['MAIN'], $attrs);
+                  break;
+
+                  /* Load menu */
+      case 'SECTION':
+                  if ($this->tags[$this->level-2] == 'MENU'){
+                    $this->section= $attrs['NAME'];
+                    $this->data['MENU'][$this->section]= array(); ;
+                  }
+                  break;
+
+                  /* Inser plugins */
+      case 'PLUGIN':
+                  if ($this->tags[$this->level-3] == 'MENU' &&
+                      $this->tags[$this->level-2] == 'SECTION'){
+
+                    $this->data['MENU'][$this->section][$this->gpc++]= $attrs;
+                  }
+                  if ($this->tags[$this->level-2] == 'SERVICEMENU'){
+                    $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
+                  }
+                  break;
+    }
   }
 
   function tag_close($parser, $tag)
   {
-       /* Close config section */
-       if ($tag == 'CONF'){
-               $this->config_found= FALSE;
-       }
-       $this->level--;
+    /* Close config section */
+    if ($tag == 'CONF'){
+      $this->config_found= FALSE;
+    }
+    $this->level--;
   }
 
   function get_ldap_link($sizelimit= FALSE)
   {
-       /* Build new connection */
-       $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'],
-                       $this->current['ADMIN'], $this->current['PASSWORD']);
-
-       /* Check for connection */
-       if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){
-               print_red (_("Can't bind to LDAP. Please contact the system administrator."));
-               echo $_SESSION['errors'];
-               exit;
-       }
-
-       if (!isset($_SESSION['size_limit'])){
-               $_SESSION['size_limit']= $this->current['SIZELIMIT'];
-               $_SESSION['size_ignore']= $this->current['SIZEIGNORE'];
-       }
-
-       if ($sizelimit){
-               $this->ldap->set_size_limit($_SESSION['size_limit']);
-       } else {
-                $this->ldap->set_size_limit(0);
-        }
+    /* Build new connection */
+    $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'],
+        $this->current['ADMIN'], $this->current['PASSWORD']);
+
+    /* Check for connection */
+    if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){
+      print_red (_("Can't bind to LDAP. Please contact the system administrator."));
+      echo $_SESSION['errors'];
+      exit;
+    }
 
-       /* Move referrals */
-       if (!isset($this->current['REFERRAL'])){
-               $this->ldap->referrals= array();
-       } else {
-               $this->ldap->referrals= $this->current['REFERRAL'];
-       }
+    if (!isset($_SESSION['size_limit'])){
+      $_SESSION['size_limit']= $this->current['SIZELIMIT'];
+      $_SESSION['size_ignore']= $this->current['SIZEIGNORE'];
+    }
+
+    if ($sizelimit){
+      $this->ldap->set_size_limit($_SESSION['size_limit']);
+    } else {
+      $this->ldap->set_size_limit(0);
+    }
 
-       return ($this->ldap);
+    /* Move referrals */
+    if (!isset($this->current['REFERRAL'])){
+      $this->ldap->referrals= array();
+    } else {
+      $this->ldap->referrals= $this->current['REFERRAL'];
+    }
+
+    return ($this->ldap);
   }
 
   function set_current($name)
   {
-       $this->current= $this->data['LOCATIONS'][$name];
-       if (!isset($this->current['PEOPLE'])){
-               $this->current['PEOPLE']= "ou=people";
-       }
-       if (!isset($this->current['GROUPS'])){
-               $this->current['GROUPS']= "ou=groups";
-       }
-       if (!isset($this->current['WINSTATIONS'])){
-               $this->current['WINSTATIONS']= "ou=winstations,ou=systems";
-       }
-       if (!isset($this->current['HASH'])){
-               $this->current['HASH']= "crypt";
-       }
-       if (!isset($this->current['DNMODE'])){
-               $this->current['DNMODE']= "cn";
-       }
-       if (!isset($this->current['MINID'])){
-               $this->current['MINID']= 100;
-       }
-       if (!isset($this->current['SIZELIMIT'])){
-               $this->current['SIZELIMIT']= 200;
-       }
-       if (!isset($this->current['SIZEINGORE'])){
-               $this->current['SIZEIGNORE']= TRUE;
-       } else {
-               if (preg_match("/true/i", $this->current['SIZEIGNORE'])){
-                       $this->current['SIZEIGNORE']= TRUE;
-               } else {
-                       $this->current['SIZEIGNORE']= FALSE;
-               }
-       }
-
-       /* Sort referrals, if present */
-       if (isset ($this->current['REFERRAL'])){
-               $bases= array();
-               $servers= array();
-               foreach ($this->current['REFERRAL'] as $ref){
-                       $server= preg_replace('%^(.*)/[^/]+$%', '\\1', $ref['URL']);
-                       $base= preg_replace('%^.*/([^/]+)$%', '\\1', $ref['URL']);
-                       $bases[$base]= strlen($base);
-                       $servers[$base]= $server;
-               }
-               asort($bases);
-               reset($bases);
-       }
-
-       /* SERVER not defined? Load the one with the shortest base */
-       if (!isset($this->current['SERVER'])){
-               $this->current['SERVER']= $servers[key($bases)];
-       }
-
-       /* BASE not defined? Load the one with the shortest base */
-       if (!isset($this->current['BASE'])){
-               $this->current['BASE']= key($bases);
-       }
-
-       /* Parse LDAP referral informations */
-       if (!isset($this->current['ADMIN']) || !isset($this->current['PASSWORD'])){
-               $url= $this->current['SERVER'];
-               $referral= $this->current['REFERRAL'][$url];
-               $this->current['ADMIN']= $referral['ADMIN'];
-               $this->current['PASSWORD']= $referral['PASSWORD'];
-       }
-
-       /* Load server informations */
-       $this->load_servers();
+    $this->current= $this->data['LOCATIONS'][$name];
+    if (!isset($this->current['PEOPLE'])){
+      $this->current['PEOPLE']= "ou=people";
+    }
+    if (!isset($this->current['GROUPS'])){
+      $this->current['GROUPS']= "ou=groups";
+    }
+    if (!isset($this->current['WINSTATIONS'])){
+      $this->current['WINSTATIONS']= "ou=winstations,ou=systems";
+    }
+    if (!isset($this->current['HASH'])){
+      $this->current['HASH']= "crypt";
+    }
+    if (!isset($this->current['DNMODE'])){
+      $this->current['DNMODE']= "cn";
+    }
+    if (!isset($this->current['MINID'])){
+      $this->current['MINID']= 100;
+    }
+    if (!isset($this->current['SIZELIMIT'])){
+      $this->current['SIZELIMIT']= 200;
+    }
+    if (!isset($this->current['SIZEINGORE'])){
+      $this->current['SIZEIGNORE']= TRUE;
+    } else {
+      if (preg_match("/true/i", $this->current['SIZEIGNORE'])){
+        $this->current['SIZEIGNORE']= TRUE;
+      } else {
+        $this->current['SIZEIGNORE']= FALSE;
+      }
+    }
+
+    /* Sort referrals, if present */
+    if (isset ($this->current['REFERRAL'])){
+      $bases= array();
+      $servers= array();
+      foreach ($this->current['REFERRAL'] as $ref){
+        $server= preg_replace('%^(.*)/[^/]+$%', '\\1', $ref['URL']);
+        $base= preg_replace('%^.*/([^/]+)$%', '\\1', $ref['URL']);
+        $bases[$base]= strlen($base);
+        $servers[$base]= $server;
+      }
+      asort($bases);
+      reset($bases);
+    }
+
+    /* SERVER not defined? Load the one with the shortest base */
+    if (!isset($this->current['SERVER'])){
+      $this->current['SERVER']= $servers[key($bases)];
+    }
+
+    /* BASE not defined? Load the one with the shortest base */
+    if (!isset($this->current['BASE'])){
+      $this->current['BASE']= key($bases);
+    }
+
+    /* Parse LDAP referral informations */
+    if (!isset($this->current['ADMIN']) || !isset($this->current['PASSWORD'])){
+      $url= $this->current['SERVER'];
+      $referral= $this->current['REFERRAL'][$url];
+      $this->current['ADMIN']= $referral['ADMIN'];
+      $this->current['PASSWORD']= $referral['PASSWORD'];
+    }
+
+    /* Load server informations */
+    $this->load_servers();
   }
 
   function load_servers ()
   {
-       /* Only perform actions if current is set */
-       if ($this->current == NULL){
-               return;
-       }
-
-       /* Fill imap servers */
-       $ldap= $this->get_ldap_link();
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goImapServer)");
-
-       $this->data['SERVERS']['IMAP']= array();
-       error_reporting(0);
-       while ($attrs= $ldap->fetch()){
-               $name= $attrs['goImapName'][0];
-               $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0],
-                                       "admin" => $attrs['goImapAdmin'][0],
-                                       "password" => $attrs['goImapPassword'][0],
-                                       "sieve_server" => $attrs['goImapSieveServer'][0],
-                                       "sieve_port" => $attrs['goImapSievePort'][0]);
-       }
-       error_reporting(E_ALL);
-
-       /* Get kerberos server. FIXME: only one is supported currently */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goKrbServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['KERBEROS']= array( 'SERVER' => $attrs['cn'][0],
-                                               'REALM' => $attrs['goKrbRealm'][0],
-                                               'ADMIN' => $attrs['goKrbAdmin'][0],
-                                               'PASSWORD' => $attrs['goKrbPassword'][0]);
-       }
-
-       /* Get cups server. FIXME: only one is supported currently */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goCupsServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['CUPS']= $attrs['cn'][0];        
-       }
-
-       /* Get fax server. FIXME: only one is supported currently */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goFaxServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['FAX']= array( 'SERVER' => $attrs['cn'][0],
-                                               'LOGIN' => $attrs['goFaxAdmin'][0],
-                                               'PASSWORD' => $attrs['goFaxPassword'][0]);
-       }
-
-       /* Get asterisk servers */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goFonServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['FON']= array( 
-                                               'SERVER'        => $attrs['cn'][0],
-                                               'LOGIN'         => $attrs['goFonAdmin'][0],
-                                               'PASSWORD'      => $attrs['goFonPassword'][0],
-                                               'DB'            => "gophone",
-                                               'SIP_TABLE'             => "sip_users",
-                                               'EXT_TABLE'     => "extensions",
-                                               'VOICE_TABLE'   => "voicemail_users",
-                                               'QUEUE_TABLE'   => "queues",
-                                               'QUEUE_MEMBER_TABLE'    => "queue_members");
-       }
-       
-       /* Get asterisk servers */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goGlpiServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['GLPI']= array( 
-                                               'SERVER'        => $attrs['cn'][0],
-                                               'LOGIN'         => $attrs['goGlpiAdmin'][0],
-                                               'PASSWORD'      => $attrs['goGlpiPassword'][0],
-                                               'DB'            => $attrs['goGlpiDatabase'][0]);
-       }
-       /* Get logdb server */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goLogDBServer)");
-       if ($ldap->count()){
-               $attrs= $ldap->fetch();
-               $this->data['SERVERS']['LOG']= array( 'SERVER' => $attrs['cn'][0],
-                                               'LOGIN' => $attrs['goLogAdmin'][0],
-                                               'PASSWORD' => $attrs['goLogPassword'][0]);
-       }
-
-       /* Get NFS server lists */
-       $tmp= array("default");
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(&(objectClass=goShareServer)(goExportEntry=*))");
-       while ($attrs= $ldap->fetch()){
-               for ($i= 0; $i<$attrs["goExportEntry"]["count"]; $i++){
-                       $path= preg_replace ("/\s.*$/", "", $attrs["goExportEntry"][$i]);
-                       $tmp[]= $attrs["cn"][0].":$path";
-               }
-       }
-       $this->data['SERVERS']['NFS']= $tmp;
-
-
-       /* Load Terminalservers */
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goTerminalServer)");
-       $this->data['SERVERS']['TERMINAL']= array();
-       $this->data['SERVERS']['TERMINAL'][]= "default";
-
-       $this->data['SERVERS']['FONT']= array();
-       $this->data['SERVERS']['FONT'][]= "default";
-       while ($attrs= $ldap->fetch()){
-               $this->data['SERVERS']['TERMINAL'][]= $attrs["cn"][0];
-               for ($i= 0; $i<$attrs["goFontPath"]["count"]; $i++){
-                       $this->data['SERVERS']['FONT'][]= $attrs["goFontPath"][$i];
-               }
-       }
-
-       /* Ldap Server */
-       $this->data['SERVERS']['LDAP']= array("default");
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goLdapServer)");
-       while ($attrs= $ldap->fetch()){
-               if (isset($attrs["goLdapBase"])){
-                       for ($i= 0; $i<$attrs["goLdapBase"]["count"]; $i++){
-                               $this->data['SERVERS']['LDAP'][]= $attrs["cn"][0].":".$attrs["goLdapBase"][$i];
-                       }
-               }
-       }
-
-       /* Get misc server lists */
-       $this->data['SERVERS']['SYSLOG']= array("default");
-       $this->data['SERVERS']['NTP']= array("default");
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goNtpServer)");
-       while ($attrs= $ldap->fetch()){
-               $this->data['SERVERS']['NTP'][]= $attrs["cn"][0];
-       }
-       $ldap->cd ($this->current['BASE']);
-       $ldap->search ("(objectClass=goSyslogServer)");
-       while ($attrs= $ldap->fetch()){
-               $this->data['SERVERS']['SYSLOG'][]= $attrs["cn"][0];
-       }
-
-       /* Get samba servers from LDAP, in case of samba3 */
-       if ($this->current['SAMBAVERSION'] == 3){
-               $this->data['SERVERS']['SAMBA']= array();
-               $ldap->cd ($this->current['BASE']);
-               $ldap->search ("(objectClass=sambaDomain)");
-               while ($attrs= $ldap->fetch()){
-                       $this->data['SERVERS']['SAMBA'][$attrs['sambaDomainName'][0]]= array(
-                               "SID" => $attrs["sambaSID"][0],
-                               "RIDBASE" => $attrs["sambaAlgorithmicRidBase"][0]);
-               }
-
-               /* If no samba servers are found, look for configured sid/ridbase */
-               if (count($this->data['SERVERS']['SAMBA']) == 0){
-                       if (!isset($this->current["SID"]) || !isset($this->current["RIDBASE"])){
-                               print_red(_("SID and/or RIDBASE missing in your configuration!"));
-                               echo $_SESSION['errors'];
-                               exit;
-                       } else {
-                               $this->data['SERVERS']['SAMBA']['DEFAULT']= array(
-                                       "SID" => $this->current["SID"],
-                                       "RIDBASE" => $this->current["RIDBASE"]);
-                       }
-               }
-       }
+    /* Only perform actions if current is set */
+    if ($this->current == NULL){
+      return;
+    }
+
+    /* Fill imap servers */
+    $ldap= $this->get_ldap_link();
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goImapServer)");
+
+    $this->data['SERVERS']['IMAP']= array();
+    error_reporting(0);
+    while ($attrs= $ldap->fetch()){
+      $name= $attrs['goImapName'][0];
+      $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0],
+          "admin" => $attrs['goImapAdmin'][0],
+          "password" => $attrs['goImapPassword'][0],
+          "sieve_server" => $attrs['goImapSieveServer'][0],
+          "sieve_port" => $attrs['goImapSievePort'][0]);
+    }
+    error_reporting(E_ALL);
+
+    /* Get kerberos server. FIXME: only one is supported currently */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goKrbServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['KERBEROS']= array( 'SERVER' => $attrs['cn'][0],
+          'REALM' => $attrs['goKrbRealm'][0],
+          'ADMIN' => $attrs['goKrbAdmin'][0],
+          'PASSWORD' => $attrs['goKrbPassword'][0]);
+    }
+
+    /* Get cups server. FIXME: only one is supported currently */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goCupsServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['CUPS']= $attrs['cn'][0]; 
+    }
+
+    /* Get fax server. FIXME: only one is supported currently */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goFaxServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['FAX']= array( 'SERVER' => $attrs['cn'][0],
+          'LOGIN' => $attrs['goFaxAdmin'][0],
+          'PASSWORD' => $attrs['goFaxPassword'][0]);
+    }
+
+    /* Get asterisk servers */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goFonServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['FON']= array( 
+          'SERVER'     => $attrs['cn'][0],
+          'LOGIN'      => $attrs['goFonAdmin'][0],
+          'PASSWORD'   => $attrs['goFonPassword'][0],
+          'DB'         => "gophone",
+          'SIP_TABLE'          => "sip_users",
+          'EXT_TABLE'  => "extensions",
+          'VOICE_TABLE'        => "voicemail_users",
+          'QUEUE_TABLE'        => "queues",
+          'QUEUE_MEMBER_TABLE' => "queue_members");
+    }
+
+    /* Get asterisk servers */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goGlpiServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['GLPI']= array( 
+          'SERVER'     => $attrs['cn'][0],
+          'LOGIN'      => $attrs['goGlpiAdmin'][0],
+          'PASSWORD'   => $attrs['goGlpiPassword'][0],
+          'DB'         => $attrs['goGlpiDatabase'][0]);
+    }
+    /* Get logdb server */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goLogDBServer)");
+    if ($ldap->count()){
+      $attrs= $ldap->fetch();
+      $this->data['SERVERS']['LOG']= array( 'SERVER' => $attrs['cn'][0],
+          'LOGIN' => $attrs['goLogAdmin'][0],
+          'PASSWORD' => $attrs['goLogPassword'][0]);
+    }
+
+    /* Get NFS server lists */
+    $tmp= array("default");
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(&(objectClass=goShareServer)(goExportEntry=*))");
+    while ($attrs= $ldap->fetch()){
+      for ($i= 0; $i<$attrs["goExportEntry"]["count"]; $i++){
+        $path= preg_replace ("/\s.*$/", "", $attrs["goExportEntry"][$i]);
+        $tmp[]= $attrs["cn"][0].":$path";
+      }
+    }
+    $this->data['SERVERS']['NFS']= $tmp;
+
+
+    /* Load Terminalservers */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goTerminalServer)");
+    $this->data['SERVERS']['TERMINAL']= array();
+    $this->data['SERVERS']['TERMINAL'][]= "default";
+
+    $this->data['SERVERS']['FONT']= array();
+    $this->data['SERVERS']['FONT'][]= "default";
+    while ($attrs= $ldap->fetch()){
+      $this->data['SERVERS']['TERMINAL'][]= $attrs["cn"][0];
+      for ($i= 0; $i<$attrs["goFontPath"]["count"]; $i++){
+        $this->data['SERVERS']['FONT'][]= $attrs["goFontPath"][$i];
+      }
+    }
+
+    /* Ldap Server */
+    $this->data['SERVERS']['LDAP']= array("default");
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goLdapServer)");
+    while ($attrs= $ldap->fetch()){
+      if (isset($attrs["goLdapBase"])){
+        for ($i= 0; $i<$attrs["goLdapBase"]["count"]; $i++){
+          $this->data['SERVERS']['LDAP'][]= $attrs["cn"][0].":".$attrs["goLdapBase"][$i];
+        }
+      }
+    }
+
+    /* Get misc server lists */
+    $this->data['SERVERS']['SYSLOG']= array("default");
+    $this->data['SERVERS']['NTP']= array("default");
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goNtpServer)");
+    while ($attrs= $ldap->fetch()){
+      $this->data['SERVERS']['NTP'][]= $attrs["cn"][0];
+    }
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=goSyslogServer)");
+    while ($attrs= $ldap->fetch()){
+      $this->data['SERVERS']['SYSLOG'][]= $attrs["cn"][0];
+    }
+
+    /* Get samba servers from LDAP, in case of samba3 */
+    if ($this->current['SAMBAVERSION'] == 3){
+      $this->data['SERVERS']['SAMBA']= array();
+      $ldap->cd ($this->current['BASE']);
+      $ldap->search ("(objectClass=sambaDomain)");
+      while ($attrs= $ldap->fetch()){
+        $this->data['SERVERS']['SAMBA'][$attrs['sambaDomainName'][0]]= array(
+            "SID" => $attrs["sambaSID"][0],
+            "RIDBASE" => $attrs["sambaAlgorithmicRidBase"][0]);
+      }
+
+      /* If no samba servers are found, look for configured sid/ridbase */
+      if (count($this->data['SERVERS']['SAMBA']) == 0){
+        if (!isset($this->current["SID"]) || !isset($this->current["RIDBASE"])){
+          print_red(_("SID and/or RIDBASE missing in your configuration!"));
+          echo $_SESSION['errors'];
+          exit;
+        } else {
+          $this->data['SERVERS']['SAMBA']['DEFAULT']= array(
+              "SID" => $this->current["SID"],
+              "RIDBASE" => $this->current["RIDBASE"]);
+        }
+      }
+    }
   }
 
   function make_idepartments($max_size= 28)
   {
-       global $config;
-       $base = $config->current['BASE'];
-               
-       $arr = array();
-       
-       $this->idepartments= array();
-
-       /* Create multidimensional array, with all departments. */
-       foreach ($this->departments as $key => $val){
-
-               /* remove base from dn */
-               $val2 = str_replace($base,"",$val);
-
-               /* Get every single ou */
-               $str = preg_replace("/ou=/","|ou=",$val2);      
-               $elements = array_reverse(split("\|",$str));            
-
-               /* Save last array position */
-               $last = &$arr;
-
-               /* Get array depth  */
-               $cnt = count($elements);
-
-               /* Add last ou element of current dn to our array */
-               foreach($elements as $key => $ele){
-               
-                       /* skip enpty */
-                       if(empty($ele)) continue;
-
-                       /* Extract department name */           
-                       $elestr = preg_replace("/^ou=/","", $ele);
-                       $elestr = preg_replace("/,$/","",$elestr);      
-
-                       /* Add to array */      
-                       if($key == ($cnt-2)){
-                               $last[$elestr]['ENTRY'] = $val;
-                       }
-
-                       /* Set next array appending position */
-                       $last = &$last[$elestr]['SUB'];
-               }
-       }
-       
-       /* Add base entry */
-       $ret["/"]["ENTRY"]      = $base;
-       $ret["/"]["SUB"]        = $arr;
-       
-       $this->idepartments= $this->generateDepartmentArray($ret,-1,$max_size);
+    global $config;
+    $base = $config->current['BASE'];
+
+    $arr = array();
+
+    $this->idepartments= array();
+
+    /* Create multidimensional array, with all departments. */
+    foreach ($this->departments as $key => $val){
+
+      /* remove base from dn */
+      $val2 = str_replace($base,"",$val);
+
+      /* Get every single ou */
+      $str = preg_replace("/ou=/","|ou=",$val2);       
+      $elements = array_reverse(split("\|",$str));             
+
+      /* Save last array position */
+      $last = &$arr;
+
+      /* Get array depth  */
+      $cnt = count($elements);
+
+      /* Add last ou element of current dn to our array */
+      foreach($elements as $key => $ele){
+
+        /* skip enpty */
+        if(empty($ele)) continue;
+
+        /* Extract department name */          
+        $elestr = preg_replace("/^ou=/","", $ele);
+        $elestr = preg_replace("/,$/","",$elestr);     
+
+        /* Add to array */     
+        if($key == ($cnt-2)){
+          $last[$elestr]['ENTRY'] = $val;
+        }
+
+        /* Set next array appending position */
+        $last = &$last[$elestr]['SUB'];
+      }
+    }
+
+    /* Add base entry */
+    $ret["/"]["ENTRY"]         = $base;
+    $ret["/"]["SUB"]   = $arr;
+
+    $this->idepartments= $this->generateDepartmentArray($ret,-1,$max_size);
   }
 
+
   /* Creates display friendly output from make_idepartments */
   function generateDepartmentArray($arr,$depth = -1,$max_size){
-         $ret = array();
-         $depth ++;
-
-         /* Walk through array */      
-         foreach($arr as $name => $entries){
-
-                 /* If this department is the last in the current tree position 
-                  * remove it, to avoid generating output for it */
-                 if(count($entries['SUB'])==0){
-                         unset($entries['SUB']);
-                 }
-
-                 /* Fix name, if it contains a replace tag */
-                 $name= @ldap::fix($name);
-
-                 /* Check if current name is too long, then cut it */
-                 if(mb_strlen($name, 'UTF-8')> $max_size){
-                         $name = mb_substr($name,0,($max_size-3), 'UTF-8')." ...";
-                 }
-
-                 /* Append the name to the list */     
-                 if(isset($entries['ENTRY'])){
-                         $a = "";
-                         for($i = 0 ; $i < $depth ; $i ++){
-                                 $a.="&nbsp;";
-                         }
-                         $ret[$entries['ENTRY']]=$a."&nbsp;".$name;
-                 }     
-                 /* For debugging      
-                    if(isset($entries['ENTRY'])){
-                    $a = "";
-                    for($i = 0 ; $i < $depth ; $i ++){
-                    $a.="&nbsp;|";
-                    }
-
-                    if(!isset($entries['SUB'])){
-                    $ret[$entries['ENTRY']]=$a."-&nbsp;".$name;
-                    }else{
-                    $ret[$entries['ENTRY']]=$a."#"."&nbsp;".$name;
-                    }
-                    }  
-                  */
-
-                 /* recursive add of subdepartments */
-                 if(isset($entries['SUB'])){
-                         $ret = array_merge($ret,$this->generateDepartmentArray($entries['SUB'],$depth,$max_size));
-                 }
-         }
-
-         return($ret);
+    $ret = array();
+    $depth ++;
+
+    /* Walk through array */   
+    foreach($arr as $name => $entries){
+
+      /* If this department is the last in the current tree position 
+       * remove it, to avoid generating output for it */
+      if(count($entries['SUB'])==0){
+        unset($entries['SUB']);
+      }
+
+      /* Fix name, if it contains a replace tag */
+      $name= @LDAP::fix($name);
+
+      /* Check if current name is too long, then cut it */
+      if(mb_strlen($name, 'UTF-8')> $max_size){
+        $name = mb_substr($name,0,($max_size-3), 'UTF-8')." ...";
+      }
+
+      /* Append the name to the list */        
+      if(isset($entries['ENTRY'])){
+        $a = "";
+        for($i = 0 ; $i < $depth ; $i ++){
+          $a.="&nbsp;";
+        }
+        $ret[$entries['ENTRY']]=$a."&nbsp;".$name;
+      }        
+
+      /* recursive add of subdepartments */
+      if(isset($entries['SUB'])){
+        $ret = array_merge($ret,$this->generateDepartmentArray($entries['SUB'],$depth,$max_size));
+      }
+    }
+
+    return($ret);
   }
 
   /* This function returns all available Shares defined in this ldap
-  * There are two ways to call this function, if listboxEntry is true
-  *  only name and path are attached to the array, in it is false, the whole
-  *  entry will be parsed an atached to the result.
-  */
+   * There are two ways to call this function, if listboxEntry is true
+   *  only name and path are attached to the array, in it is false, the whole
+   *  entry will be parsed an atached to the result.
+   */
   function getShareList($listboxEntry = false)
   {
     $ldap= $this->get_ldap_link();
@@ -595,8 +582,7 @@ class config  {
     return($return);
   }
 
-  /* This function returns all available ShareServer
-  */
+  /* This function returns all available ShareServer */
   function getShareServerList()
   {
     $ldap= $this->get_ldap_link();
@@ -613,6 +599,24 @@ class config  {
     return($return);
   }
 
+  /* Check if there's the specified bool value set in the configuration */
+  function boolValueIsTrue($section, $value)
+  {
+    $section= strtoupper($section);
+    $value= strtoupper($value);
+    if (isset($this->data[$section][$value])){
+    
+      $data= $this->data[$section][$value];
+      if (preg_match("/^true$/i", $data) || preg_match("/yes/i", $data)){
+        return TRUE;
+      }
+
+    }
+
+    return FALSE;
+  }
+
 }
 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 5448a87828cd776193939caa7f2cc7c84668f800..52eaecce87fb642fae430ec7c3afbf368377b0d6 100644 (file)
@@ -5,9 +5,12 @@ class divlist {
        var $a_entries;
        var $a_header;
        var $b_displayPageNums;         
-       var $summary;
+       var $s_summary;
        var $cols;
        var $pageid;
+  //FIXME: Ignoring the fact, that they were missing - height and width are numeric...
+  var $s_height;
+  var $s_width;
   
        // Members for page managment
        var $i_currentPage;
@@ -18,7 +21,7 @@ class divlist {
 
                $this->i_currentPage    = 0;
                $this->i_entriesPerPage = 10;
-    $this->s_height         = "500";
+    $this->s_height         = "450";
     $this->s_width          = "600";
                $this->s_summary        = "";
                $this->a_entries        = array();
@@ -58,7 +61,9 @@ class divlist {
        
        function DrawList(){
                $s_return = "";
-               $s_return.= "<table summary='".$this->s_summary."' style='width:".$this->s_width."px;height:".$this->s_height."px;' cellspacing='0' id='t_scrolltable'>";
+               $s_return.= "<table summary='".$this->s_summary."' style='width:".
+                $this->s_width."px;height:".$this->s_height.
+                "px;' cellspacing='0' id='t_scrolltable'>";
 
     $s_return.= $this->_generateHeader();
     $s_return.=$this->_generatePage();
@@ -71,30 +76,29 @@ class divlist {
        function _numpages(){
                $cnt = count($this->a_entries);
                
-               $tmp    = $cnt % $this->i_entriesPerPage;
                $pages  = (int) ($cnt / $this->i_entriesPerPage);
-               if($tmp) $pages ++;
+               if($cnt % $this->i_entriesPerPage){
+      $pages++;
+    }
                
                return $pages;
        }
        
        function _numentries(){
-               $cnt = count($this->a_entries);
-               return $cnt;
+               return count($this->a_entries);
        }
        
        function _generateHeader(){
-               
                $s_return = "";
                $s_value        = "";
                $s_key          = "";
                
     // Using scrolltable?
     if($this->i_entriesPerPage == 0) {
-      $s_return .= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
+      $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
     }
 
-               $s_return .= "\n<tr>";
+               $s_return.= "\n<tr>";
 
                foreach($this->a_header[0] as $s_key => $s_value ){
                        if(!isset($s_value['attach'])){
@@ -111,11 +115,11 @@ class divlist {
     // Attach a 13px-wide column (used as scrollbar space in body-table),
     // but do this only if we are really using scrolltables.
     if($this->i_entriesPerPage == 0) {
-      $s_return .= "\n<td class='listheader' style='width:13px;border-right:0px;'>&nbsp;</td>";
-      $s_return .= "\n</table></td>";
+      $s_return.= "\n<td class='listheader' style='width:13px;border-right:0px;'>&nbsp;</td>";
+      $s_return.= "\n</table></td>";
     }
 
-       $s_return .= "\n</tr>";
+       $s_return.= "\n</tr>";
                return $s_return;
        }
        
@@ -158,6 +162,7 @@ class divlist {
       return($str);
     } else {
     
+      //FIXME: Ahrg. I'd like to read this code without wasting my time.
       if ($this->i_entriesPerPage > 0) {
                while($start > $this->_numentries()){
                        $start = $start - $this->i_entriesPerPage;
@@ -271,6 +276,7 @@ class divlist {
       }
   
       // if fewer than 22 Entries (list not full), print row to fill empty space
+      //FIXME: Why 22? Isn't the size dynamic
       if($this->_numEntries()<=22){
         $fill= "";
         for ($i= 1; $i <= $this->cols; $i++){
@@ -290,5 +296,6 @@ class divlist {
     }
   }
 }
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 8f64c9a8d0a5302e71d6d83fac044e82eb0623e7..a098b15f5747afd0266c922ed42173805ea34285 100644 (file)
@@ -2,7 +2,7 @@
 /*****************************************************************************
   newldap.inc - version 1.0
   Copyright (C) 2003 Alejandro Escanero Blanco <alex@ofmin.com>
-  Copyright (C) 2004 Cajus Pollmeier <pollmeier@gonicus.de>
+  Copyright (C) 2004-2006 Cajus Pollmeier <pollmeier@gonicus.de>
 
   Based in code of ldap.inc of
   Copyright (C) 1998  Eric Kilfoil <eric@ipass.net>
@@ -12,7 +12,7 @@ define("ALREADY_EXISTING_ENTRY",-10001);
 define("UNKNOWN_TOKEN_IN_LDIF_FILE",-10002);
 define("NO_FILE_UPLOADED",10003);
 define("INSERT_OK",10000);
-define("COLON_OVERRIDE", TRUE);
+define("SPECIALS_OVERRIDE", TRUE);
 
 class LDAP{
 
@@ -31,6 +31,7 @@ class LDAP{
   var $follow_referral = FALSE;
   var $referrals= array();
 
+
   function LDAP($binddn,$bindpw, $hostname, $follow_referral= FALSE, $tls= FALSE)
   {
     $this->follow_referral= $follow_referral;
@@ -43,37 +44,38 @@ class LDAP{
   }
 
 
+  /* Function to replace all problematic characters inside a DN by \001XX, where
+     \001 is decoded to chr(1) [ctrl+a]. It is not impossible, but very unlikely
+     that this character is inside a DN.
+     
+     Currently used codes:
+      ,   => CO
+      \2C => CO
+      (   => OB
+      )   => CB
+      /   => SL                                                                  */
   function convert($dn)
   {
-    if (COLON_OVERRIDE == TRUE){
-      $res= preg_replace("/\\\\,/", '###GOSAREPLACED###', $dn);
-      $res= preg_replace("/\\\\2C/", '###GOSAREPLACED###', $res);
-      $res= preg_replace("/\(/", '###OPENBRACE###', $res);
-      $res= preg_replace("/\)/", '###CLOSEBRACE###', $res);
-      $res= preg_replace("/\//", '###SLASH###', $res);
-
-      #if ($dn != $res){
-      #  echo "Conversation from '$dn' to '$res'<br>";
-      #}
-      return ($res);
+    if (SPECIALS_OVERRIDE == TRUE){
+      return (preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
+                           array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
+                           $dn));
     } else {
       return ($dn);
     }
   }
 
 
+  /* Function to fix all problematic characters inside a DN by replacing \001XX
+     codes to their original values. See "convert" for mor information. 
+     ',' characters are always expanded to \, (not \2C), since all tested LDAP
+     servers seem to take it the correct way.                                  */
   function fix($dn)
   {
-    if (COLON_OVERRIDE == TRUE){
-      $res= preg_replace("/###GOSAREPLACED###/", '\,', $dn);
-      $res= preg_replace("/###OPENBRACE###/", '(', $res);
-      $res= preg_replace("/###CLOSEBRACE###/", ')', $res);
-      $res= preg_replace("/###SLASH###/", '/', $res);
-
-      #if ($dn != $res){
-      #  echo "Fix from '$dn' to '$res'<br>";
-      #}
-      return ($res);
+    if (SPECIALS_OVERRIDE == TRUE){
+      return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"),
+                           array("\,", "(", ")", "/"),
+                           $dn));
     } else {
       return ($dn);
     }
index 81c8a1c6aff2aba86e8f75066e7c43080f88e959..76bf6e7d4bd577c8bf82dd821a714d337f8bc8e2 100644 (file)
@@ -807,13 +807,16 @@ class plugin
     }
   }
 
+
   function saveCopyDialog(){
   }
 
+
   function getCopyDialog(){
     return(array("string"=>"","status"=>""));
   }
 
+
   function PrepareForCopyPaste($source){
     $todo = $this->attributes;
     if(isset($this->CopyPasteVars)){
index 807fbb63643b06dd9d7fea8fba6b3d5e11b9c10a..7ea01bb5e694cc9cbb8ad125a158074467f5cf36 100644 (file)
@@ -23,6 +23,12 @@ define ("CONFIG_DIR", "/etc/gosa");
 define ("CONFIG_TEMPLATE_DIR", "../contrib/");
 define ("HELP_BASEDIR", "/var/www/doc/");
 
+/* Define get_list flags */
+define("GL_NONE",      0);
+define("GL_SUBSEARCH", 1);
+define("GL_SIZELIMIT", 2);
+define("GL_CONVERT"  , 4);
+
 /* Define globals for revision comparing */
 $svn_path = '$HeadURL$';
 $svn_revision = '$Revision$';
@@ -484,54 +490,14 @@ function get_lock ($object)
 }
 
 
-function get_list2($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= array(), $flag= FALSE)
+function get_list($filter, $subtreeACL, $base= "", $attributes= array(), $flags= GL_SUBSEARCH)
 {
   global $config;
 
-  /* Base the search on default base if not set */
-  $ldap= $config->get_ldap_link($flag);
-  if ($base == ""){
-    $ldap->cd ($config->current['BASE']);
-  } else {
-    $ldap->cd ($base);
-  }
-
-  /* Perform ONE or SUB scope searches? */
-  $ldap->ls ($filter);
-
-  /* Check for size limit exceeded messages for GUI feedback */
-  if (preg_match("/size limit/i", $ldap->error)){
-    $_SESSION['limit_exceeded']= TRUE;
-  } else {
-    $_SESSION['limit_exceeded']= FALSE;
-  }
-  $result= array();
-
-
-  /* Crawl through reslut entries and perform the migration to the
-     result array */
-  while($attrs = $ldap->fetch()) {
-    $dn= $ldap->getDN();
-    foreach ($subtreeACL as $key => $value){
-      if (preg_match("/$key/", $dn)){
-        $attrs["dn"]= convert_department_dn($dn);
-        $result[]= $attrs;
-        break;
-      }
-    }
-  }
-
-
-  return ($result);
-
-}
-
-function get_list($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= array(), $flag= FALSE)
-{
-  global $config;
+  /* Get LDAP link */
+  $ldap= $config->get_ldap_link($flags & GL_SIZELIMIT);
 
-  /* Base the search on default base if not set */
-  $ldap= $config->get_ldap_link($flag);
+  /* Set search base to configured base if $base is empty */
   if ($base == ""){
     $ldap->cd ($config->current['BASE']);
   } else {
@@ -539,8 +505,8 @@ function get_list($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= arra
   }
 
   /* Perform ONE or SUB scope searches? */
-  if ($subsearch) {
-    $ldap->search ($filter, $attrs);
+  if ($flags & GL_SUBSEARCH) {
+    $ldap->search ($filter, $attributes);
   } else {
     $ldap->ls ($filter);
   }
@@ -557,9 +523,17 @@ function get_list($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= arra
   $result= array();
   while($attrs = $ldap->fetch()) {
     $dn= $ldap->getDN();
+
     foreach ($subtreeACL as $key => $value){
       if (preg_match("/$key/", $dn)){
-        $attrs["dn"]= $dn;
+
+        if ($flags & GL_CONVERT){
+          $attrs["dn"]= convert_department_dn($dn);
+        } else {
+          $attrs["dn"]= $dn;
+        }
+
+        /* We found what we were looking for, break speeds things up */
         $result[]= $attrs;
         break;
       }
@@ -768,16 +742,16 @@ function convert_department_dn($dn)
 
   /* Build a sub-directory style list of the tree level
      specified in $dn */
-  foreach (split (',', $dn) as $val){
+  foreach (ldap_explode_dn($dn, false) as $rdn){
 
     /* We're only interested in organizational units... */
-    if (preg_match ("/ou=/", $val)){
-      $dep= substr($val,3)."/$dep";
+    if (substr($rdn,0,3) == 'ou='){
+      $dep= substr($rdn,3)."/$dep";
     }
 
     /* ... and location objects */
-    if (preg_match ("/l=/", $val)){
-      $dep= substr($val,2)."/$dep";
+    if (substr($rdn,0,2) == 'l='){
+      $dep= substr($rdn,2)."/$dep";
     }
   }
 
@@ -785,24 +759,12 @@ function convert_department_dn($dn)
   return rtrim($dep, "/");
 }
 
-function convert_department_dn2($dn)
-{
-  $dep= "";
-
-  /* Build a sub-directory style list of the tree level
-     specified in $dn */
-  $deps = array_flip($_SESSION['config']->idepartments);
-
-  if(isset($deps[$dn])){
-    $dn= $deps[$dn];
-    $dep = preg_replace("/^.*=/","",$dn);
-  }else{
-    $dep= preg_replace("%^.*/([^/]+)$%", "\\1", $dn);
-  }
 
-  /* Return and remove accidently trailing slashes */
-  $tmp = rtrim($dep, "/");
-  return @ldap::fix($tmp);
+/* Strip off the last sub department part of a '/level1/level2/.../'
+ * style value. It removes the trailing '/', too. */
+function get_sub_department($value)
+{
+  return (@LDAP::fix(preg_replace("%^.*/([^/]+)/?$%", "\\1", $value)));
 }
 
 
@@ -813,9 +775,9 @@ function get_ou($name)
   $ou= $config->current[$name];
   if ($ou != ""){
     if (!preg_match('/^[^=]+=[^=]+/', $ou)){
-      return "ou=$ou,";
+      return @LDAP::convert("ou=$ou,");
     } else {
-      return "$ou,";
+      return @LDAP::convert("$ou,");
     }
   } else {
     return "";
@@ -1944,5 +1906,46 @@ function array_differs($src, $dst)
 }
 
 
+function saveFilter($a_filter, $values)
+{
+  if (isset($_POST['regexit'])){
+    $a_filter["regex"]= $_POST['regexit'];
+
+    foreach($values as $type){
+      if (isset($_POST[$type])) {
+        $a_filter[$type]= "checked";
+      } else {
+        $a_filter[$type]= "";
+      }
+    }
+  }
+
+  /* React on alphabet links if needed */
+  if (isset($_GET['search'])){
+    $s= mb_substr(validate($_GET['search']), 0, 1, "UTF8")."*";
+    if ($s == "**"){
+      $s= "*";
+    }
+    $a_filter['regex']= $s;
+  }
+
+  return ($a_filter);
+}
+
+
+/* Escape all preg_* relevant characters */
+function normalizePreg($input)
+{
+  return (addcslashes($input, '[]()|/.*+-'));
+}
+
+
+/* Escape all LDAP filter relevant characters */
+function normalizeLdap($input)
+{
+  return (addcslashes($input, '()|'));
+}
+
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 318b26cd3e5ade58860f3934dfe123e2cbfa4123..6c50979cc75a62fbd32d6f40e85cc743ca9a42df 100644 (file)
Binary files a/locale/de/LC_MESSAGES/messages.mo and b/locale/de/LC_MESSAGES/messages.mo differ
index f91507400c647b96d2df343144cb0effcb38cf6f..5951054da96920698cdd4c2f0af8f0cfe5384d54 100644 (file)
@@ -2290,7 +2290,7 @@ msgstr "Ger
 
 #: plugins/personal/environment/hotplugDialogNew.tpl:38
 msgid "save"
-msgstr "Sichern"
+msgstr "Speichern"
 
 #: plugins/personal/environment/kioskManagement.tpl:1
 #: plugins/personal/environment/kioskManagement.tpl:5
@@ -2356,7 +2356,7 @@ msgstr "Bild entfernen"
 #: include/class_MultiSelectWindow.inc:44
 #: ihtml/themes/default/copyPasteDialog.tpl:14
 msgid "Save"
-msgstr "Sichern"
+msgstr "Speichern"
 
 #: plugins/personal/generic/generic.tpl:6
 msgid "Personal information"
index 9e47fbbd4120d387ae48d225a3d7aa250e360a52..8cd0d4d9e0d7c2d9665822e6435ec0e585498c08 100644 (file)
@@ -376,7 +376,7 @@ class applicationManagement extends plugin
         /* Lock the current entry, so nobody will edit it during deletion */
         add_lock ($this->dn, $this->ui->dn);
         $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), LDAP::fix($this->dn)));
+        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), @LDAP::fix($this->dn)));
         return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
       } else {
 
@@ -430,7 +430,7 @@ class applicationManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -551,7 +551,7 @@ class applicationManagement extends plugin
     }
 
     foreach($this->applications as $key => $val){
-      $title = "title='dn : ".$val['dn']."'";
+      $title = "title='dn:&nbsp;".@LDAP::fix($val['dn'])."'";
 
       if(!isset($val['description'][0])){
         $desc = "";
@@ -608,7 +608,9 @@ class applicationManagement extends plugin
     }
 
     /* Generate application list */
-    $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=gosaApplication))", FALSE, $base, array("*"), FALSE);
+    //FIXME: No GL_SIZELIMIT?
+    $res= get_list("(&(cn=$regex)(objectClass=gosaApplication))", $this->ui->subtreeACL,
+                   $base, array("*"), GL_NONE);
     $this->applications= array();
     foreach ($res as $value){
       $this->applications[]= $value;
@@ -624,9 +626,8 @@ class applicationManagement extends plugin
     $peopleOU = get_people_ou();
 
     $base2 = $_SESSION['CurrentMainBase'];
-
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-        TRUE, $base2, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL,
+                    $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -636,9 +637,9 @@ class applicationManagement extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
 
index 7a3823c92b5d77e6b0de2b13cad48176e4ce5215..aaa0fc7f1ee954939f32db6424a7244c11bb52cf 100644 (file)
@@ -35,7 +35,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/application.png'), _("Application management"));
        }
index b1e1d7b93bd16f4830ece91b1fc4006fa1c4e481..b3eb93bc3ffb9e2f68ea6e477617b4dbb4529ff1 100644 (file)
@@ -366,7 +366,7 @@ class departmentManagement extends plugin
                $display= $this->deptabs->execute();
 
                $display.= "<p style=\"text-align:right\">\n";
-               $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+               $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
                $display.= "&nbsp;\n";
                $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
                $display.= "</p>";
@@ -415,23 +415,15 @@ class departmentManagement extends plugin
                        $result[$tmp[$base_back]]=$tmp2;
                }
 
-               $res= get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", 
-                               TRUE, $base, array("ou", "description"), TRUE);
-
-               //hickert Replaced Block
-               //    $this->departments= array();
-               //    foreach ($res as $value){
-               //           $title= convert_department_dn($value["dn"]);
-               //           $this->departments[$title]= "$title [".$value["description"][0]."]";
-               //           $this->departments[$value['dn']]= "[".$value["description"][0]."]";
-               //    }
+               $res= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+                              $this->ui->subtreeACL, $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
                $this->departments= array();
                foreach ($res as $value){
                        if(isset($value["description"][0])){
-                               $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+                               $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
                        }else{
-                               $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+                               $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
                        }
                }
                natcasesort ($this->departments);
index e0ec1e3a35b57acf70bcc6095e79a1bbaf4742af..ac2b3e9f18e72130836b8bb781bb7bf5f0d63bb1 100644 (file)
@@ -35,7 +35,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/department.png'), _("Department management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/department.png'), _("Department management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/department.png'), _("Department management"));
        }
index afae3ad9047ef83199c6ac052835b0875cd8abf9..a06c77e6d27da0afc3a1de69d5fe2fe5fa46561d 100644 (file)
@@ -29,8 +29,8 @@ class askClassName extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* Fill templating stuff */
     $smarty = get_smarty();
@@ -50,13 +50,14 @@ class askClassName extends plugin
       $base = $faifilter['branch'];
     }
     $ldap = $this->config->get_ldap_link();
-    $res  = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $base, array("cn","description","objectClass"),TRUE);
+    $res= get_list("(objectClass=organizationalUnit)", $this->ui->subtreeACL, $base,
+                   array("cn","description","objectClass"), GL_SIZELIMIT);
     $used = array();
 
     $delete = array();
     foreach($res as $objecttypes){
-      $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)",
-          FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
+      $res2= get_list("(objectClass=*)", $this->ui->subtreeACL, $objecttypes['dn'],
+                      array("cn","description","objectClass","FAIclass"), GL_SIZELIMIT | GL_CONVERT);
 
       foreach($res2 as $object){
         /* skip class names with this name */ 
index 050a7db0644e4d907c794fce958415f02a6e3488..2d3a7fc21172614816d8b9480722da35a2a5879d 100644 (file)
@@ -603,7 +603,7 @@ class faiManagement extends plugin
                                
                        }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
                                $display.= "<p style=\"text-align:right\">\n";
-                               $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
+                               $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
                                $display.= "&nbsp;\n";
                                $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
                                $display.= "</p>";
@@ -902,8 +902,8 @@ class faiManagement extends plugin
                 */
                $base2 = $_SESSION['CurrentMainBase'];
 
-               $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-                               TRUE, $base2, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+                    $this->ui->subtreeACL, $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
                $this->departments= array();
                $tmp = array();
@@ -913,9 +913,9 @@ class faiManagement extends plugin
                ksort($tmp);
                foreach($tmp as $value){
                        if(isset($value["description"][0])){
-                               $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+                               $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
                        }else{
-                               $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+                               $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
                        }
                }
 
@@ -923,14 +923,14 @@ class faiManagement extends plugin
                 */
 
        
-               $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)", 
-                               FALSE, $base, array("cn","description","objectClass"),TRUE);
+    $res= get_list("(objectClass=organizationalUnit)", $this->ui->subtreeACL, $base,
+                   array("cn","description","objectClass"), GL_SIZELIMIT);
 
     $str = "";
 
                foreach($res as $objecttypes){
-                       $res2 = get_list($this->ui->subtreeACL, "(&(objectClass=*)(cn=".$regex."))",
-                                       FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass","FAIstate"),TRUE);
+      $res2= get_list("(&(objectClass=*)(cn=$regex))", $this->ui->subtreeACL, $objecttypes['dn'],
+                      array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT);
                        foreach($res2 as $object){
                                $type= "";      
                                unset($object['objectClass']['count']);
index 1e71cbcf3bc7f0e358bd98b617871834e3a0c95f..4095b74382798b24b985492d2a32a7f5509a8d15 100644 (file)
@@ -35,7 +35,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"));
        }
index 096334317dfb830e7039151dcbab9d7b1928200d..368ef147c2bbb213edbc0bb62cecb4b78c6c85bd 100644 (file)
@@ -15,7 +15,7 @@
   <td style="width:48%; vertical-align:top;">
    <b><LABEL for="used_apps">{t}Used applications{/t}</LABEL></b>
        {$UsedApps} 
-       <input type="text" value="" size="35" name='CatName'>
+       <input type="text" value="" size="30" name='CatName'>
        <input type="submit" value="{t}Add category{/t}" name='AddCat'>
   </td>
   <td>&nbsp;
index ebcaf46f89d37e862753e8434a95db0aaefae04a..f255c697e4e5ad8b03eca82dc83e3c59872e27f1 100644 (file)
@@ -512,7 +512,9 @@ class appgroup extends plugin
         }
       }
     }
+
     $this->reload();
+
     /* Add group with post */
     if((isset($_GET['act']))&&($_GET['act']=="add")){
       $this->used_apps[$_GET['id']]= $_GET['id'];
@@ -560,13 +562,14 @@ class appgroup extends plugin
 
     $div = new DivSelectBox("appgroup");    
 
-    $div->SetHeight(400);
+    $div->SetHeight(300);
 
     /* NEW LIST MANAGMENT
      * We also need to search for the departments
      * So we are able to navigate like in konquerer
      */
 
+    //FIXME: Why do we not use get_list here? It's the same code all over the time...
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->curbase) ;
     $ldap->ls("(objectClass=gosaDepartment)"); 
@@ -577,10 +580,11 @@ class appgroup extends plugin
     }
     ksort($tmp);
     foreach($tmp as $value){
+      $fdn= @LDAP::fix($value['dn']);
       if($value["description"][0]!=".."){
-        $departments[$value['dn']]=convert_department_dn($value['dn'])." - [".$value["description"][0]."]";
+        $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]";
       }else{
-        $departments[$value['dn']]=convert_department_dn($value['dn']);
+        $departments[$value['dn']]=convert_department_dn($fdn);
       }
     }
 
@@ -635,7 +639,7 @@ class appgroup extends plugin
     }
 
     $div2 = new DivSelectBox("appgroup");
-    $div2->SetHeight(400);
+    $div2->SetHeight(300);
 
     $linkopen       = "<img class='center' src='images/folder.png' alt=\"\">&nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
     $catremove      = "&nbsp;<input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelCat_%s' value='%s'>";
@@ -712,7 +716,7 @@ class appgroup extends plugin
             $image = "<img class='center' src='images/select_application.png' alt=\"\">&nbsp;"; 
           }
           
-          $div2 ->AddEntry(array(array("string"=>sprintf($image."%s",$entry['App'])),
+          $div2->AddEntry(array(array("string"=>sprintf($image."%s",$entry['App'])),
                 array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$sep.$edit.$upudown),
                       "attach"=>"align='right' style='width:100px;border-right:0px;'")));
         }
index e3430eaaf8967cf9b217c5c5a56c7043f91059fe..eb103aac3ca6cf1adb98d46ae18add46de035f4a 100644 (file)
@@ -465,7 +465,8 @@ class mailgroup extends plugin
       }
 
       $acl= array($this->config->current['BASE'] => ":all");
-      $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $gmailfilter['depselect'], array("sn", "mail", "givenName"), TRUE);
+      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", $acl, $gmailfilter['depselect'],
+                     array("sn", "mail", "givenName"), GL_SUBSEARCH | GL_SIZELIMIT);
       $ldap->cd($gmailfilter['depselect']);
       $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
       error_reporting (0);
index 250621df8b1c4ebd1acfa99eae6fab86d4b11926..047bb76aaafccf008b9a2b616e8ba21a47ca0e2b 100644 (file)
@@ -169,6 +169,8 @@ class groupManagement extends plugin
 
     /* Homebutton is posted */
     if($s_action=="home"){
+      //FIXME: This will not work if we've no subdirs (like i.e. ou=people)? See
+      //       class_userManagement.inc for a fix.
       $_SESSION['CurrentMainBase']= (preg_replace("/^[^,]+,/","",$this->ui->dn));
       $_SESSION['CurrentMainBase']= (preg_replace("/^[^,]+,/","",$_SESSION['CurrentMainBase']));
     }
@@ -360,7 +362,7 @@ class groupManagement extends plugin
 
         /* Lock the current entry, so nobody will edit it during deletion */
         add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), LDAP::fix($this->dn)));
+        $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       } else {
 
@@ -415,7 +417,7 @@ class groupManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -571,7 +573,7 @@ class groupManagement extends plugin
         $posix=$mail=$samba=$appl=$phone=$empty;
       }
 
-      $title = "title='gid : ".$key." - dn : ".$val['dn']."'";
+      $title = "title='dn:&nbsp;".@LDAP::fix($val['dn'])."'";
 
       if(!isset($val['description'][0])){
         $desc = "";
@@ -677,8 +679,8 @@ class groupManagement extends plugin
      * So we are able to navigate like in konquerer
      */
 
-      $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-          FALSE, $base, array("ou", "description"), TRUE);
+      $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+                      $this->ui->subtreeACL, $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
       $this->departments= array();
       $tmp = array();
       foreach ($res3 as $value){
@@ -687,9 +689,9 @@ class groupManagement extends plugin
       ksort($tmp);
       foreach($tmp as $value){
         if(isset($value["description"][0])){
-          $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+          $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
         }else{
-          $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+          $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
         }
       }
     /*  Ende department generation
@@ -706,10 +708,12 @@ class groupManagement extends plugin
     /* Depending on $CreatePosixsList we have to create different lists */
 
     if ($groupfilter['subsearch'] == "checked"){
-      $res= get_list($this->ui->subtreeACL, "$filter", FALSE, $base, array("cn", "description", "gidNumber"), TRUE);
+      $res= get_list($filter, $this->ui->subtreeACL, $base, array("cn", "description", "gidNumber"),
+                     GL_SIZELIMIT);
     } else {
       $base= get_groups_ou().$base;
-      $res= get_list($this->ui->subtreeACL, "$filter", FALSE, $base, array("cn", "description", "gidNumber"), TRUE);
+      $res= get_list($filter, $this->ui->subtreeACL, $base, array("cn", "description", "gidNumber"),
+                     GL_SIZELIMIT);
     }
     if (preg_match("/size limit/i", $error) || preg_match("/size limit/i", $error2)){
       $_SESSION['limit_exceeded']= TRUE;
index 3ee42bea3e4143826d2a9744cbf3c4cf5d35a9a3..d9b3d71c767591168db30fbbc12071577f4d5941 100644 (file)
@@ -96,7 +96,7 @@
      <td style="vertical-align:top; width:50%">
       <b><LABEL for="members">{t}Group members{/t}</LABEL></b>
       <br>
-      <select style="width:100%; height:450px;" id="members" name="members[]" size=15 multiple>
+      <select style="width:100%; height:380px;" id="members" name="members[]" size=15 multiple>
        {html_options options=$members}
                <option disabled>&nbsp;</option>
       </select>
index 1cd235453171f62fcf38bfb636f36fefbc5dea1a..3c8306b19780556749eac9e98ffe2f1a1c6bf9a7 100644 (file)
@@ -38,7 +38,7 @@ if ($remove_lock){
     $display= print_header(get_template_path('images/group.png'),
                            _("Group administration"), "<img alt=\"\" align=\"middle\" src=\"".
                             get_template_path('images/closedlock.png')."\"> ".
-                            @ldap::fix($_SESSION['objectinfo']));
+                            @LDAP::fix($_SESSION['objectinfo']));
   } else {
     $display= print_header(get_template_path('images/group.png'), _("Group administration"));
   }
index f92b573b4f9a1c1553677f6ceaf8afd05df10a11..81afff4e310d2e66395062b99044d229b509355e 100644 (file)
@@ -505,7 +505,7 @@ class ogroup extends plugin
 
         /* It has failed, add entry with type flag I (Invalid)*/
         if ($ldap->error != "success"){
-          $this->memberList[$dn]= array('text' => _("Non existing dn: ")."$dn","type" => "I");
+          $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I");
 
         } else {
           
index 67b66457780588165115602c201ed15ef08632b1..4980494a06b82adb0109aaa5c35ddff3ceafda41 100644 (file)
@@ -284,7 +284,7 @@ class ogroupManagement extends plugin
 
         /* Lock the current entry, so nobody will edit it during deletion */
         add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), LDAP::fix($this->dn)));
+        $smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), @LDAP::fix($this->dn)));
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       } else {
 
@@ -405,7 +405,7 @@ class ogroupManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -540,7 +540,7 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
         $mail = $empty;
       }
 
-      $title = "title='dn : ".$val['dn']."'";
+      $title = "title='dn:&nbsp;".@LDAP::fix($val['dn'])."'";
 
       if(!isset($val['description'][0])){
         $desc = "";
@@ -688,9 +688,7 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
       $filter= "(&(cn=$regex)(objectClass=gosaGroupOfNames))";
     }
     
-   $groups = ($this->config->current['GROUPS']);
-
-    $res= get_list($this->ui->subtreeACL, "$filter",FALSE, $groups.",".$base, array("*"), TRUE);
+    $res= get_list($filter, $this->ui->subtreeACL, get_groups_ou().$base, array("*"), GL_SIZELIMIT );
     $this->ogrouplist= $res;
     ksort ($this->ogrouplist);
     reset ($this->ogrouplist);
@@ -708,10 +706,8 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
       $base2 = preg_replace("/".$peopleOU."/i","",$base);
     }
 
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-                              TRUE, $base2, array("ou", "description"), TRUE);
-
-   
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+                    $this->ui->subtreeACL, $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -721,9 +717,9 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
     /* END NEW LIST MANAGMENT
index bbe03d5e903cadee1b17383cdadc5f18b54e1fcb..61950a40489bf35ce8e310004138adf6f0dae327 100644 (file)
@@ -34,7 +34,7 @@ if (!$remove_lock){
                           _("Object groups"),
                           "<img alt=\"\" align=\"middle\" src=\"".
                           get_template_path('images/closedlock.png').
-                          "\"> ".@ldap::fix($_SESSION['objectinfo']));
+                          "\"> ".@LDAP::fix($_SESSION['objectinfo']));
   } else {
     $display= print_header(get_template_path('images/ogroup.png'), _("Object groups"));
   }
index 053bc0d13e45552c91c2bb576fa40866bd58d902..4d8e2d41adace1e64f0001e4a7f824e612066022 100644 (file)
@@ -208,8 +208,8 @@ class glpiSelectUser extends plugin
      * So we are able to navigate like in konquerer
      */
 
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",
-        TRUE, $base, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",
+                    $this->ui->subtreeACL, $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -219,17 +219,18 @@ class glpiSelectUser extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
 
     /* END NEW LIST MANAGMENT
      */
     $ou = get_people_ou();
-    $res2 = get_list($this->ui->subtreeACL, "(&(|(cn=$regex)(sn=$regex))(objectClass=person))",
-        TRUE,$ou.$base, array("cn","sn","uid","givenName", "description"), TRUE);
+    $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", $this->ui->subtreeACL,
+                    $ou.$base, array("cn", "sn", "uid", "givenName", "description"),
+                    GL_SUBSEARCH | GL_SIZELIMIT);
 
     $tmp = array();
 
index f91cd51cb2aaa20477e2b5d99af5332ad425b928..6b59c1d7afd8d434b2f896ea8e5257936ef9df83 100644 (file)
@@ -723,7 +723,7 @@ class systems extends plugin
       /* Don't show buttons if tab dialog requests this */
       if ((isset($this->systab->by_object))&&(!$this->systab->by_object[$this->systab->current]->dialog)){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -887,7 +887,7 @@ class systems extends plugin
       $img=$this->convert_list($val);
 
       $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".$val['dn']."'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".@LDAP::fix($val['dn'])."'");
       $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
       $divlist->AddEntry( array($field1,$field2,$field3));
     }
@@ -1056,35 +1056,37 @@ class systems extends plugin
     /* Get all gotoTerminal's */
     $this->terminals= array();
 
-    $res= get_list($this->ui->subtreeACL, "(|$termfilter)", FALSE, "ou=terminals,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE);
+    //FIXME: All get_list calls are called without GL_SIZELIMIT? All contain sambaDomainName???
+    $res= get_list("(|$termfilter)", $this->ui->subtreeACL, "ou=terminals,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE);
 
-    $res= array_merge($res,get_list($this->ui->subtreeACL, "(|$termfilter)", FALSE, "ou=incoming,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+    $res= array_merge($res,
+          get_list("(|$termfilter)", $this->ui->subtreeACL, "ou=incoming,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$serverfilter)", FALSE, "ou=servers,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$serverfilter)", $this->ui->subtreeACL, "ou=servers,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$phonefilter)", FALSE, "ou=phones,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$phonefilter)", $this->ui->subtreeACL, "ou=phones,ou=systems,".$base,
+                    array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$netfilter)", FALSE, "ou=netdevices,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$netfilter)", $this->ui->subtreeACL, "ou=netdevices,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$printfilter)", FALSE, "ou=printers,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$printfilter)", $this->ui->subtreeACL, "ou=printers,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$workfilter)", FALSE, "ou=workstations,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$workfilter)", $this->ui->subtreeACL, "ou=workstations,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
     $res= array_merge($res,
-          get_list($this->ui->subtreeACL, "(|$winfilter)", FALSE, "ou=winstations,ou=systems,".$base, 
-        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+          get_list("(|$winfilter)", $this->ui->subtreeACL, "ou=winstations,ou=systems,".$base,
+                   array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), GL_NONE));
 
 /* NEW LIST MANAGMENT
      * We also need to search for the departments
@@ -1099,9 +1101,8 @@ class systems extends plugin
       $base2 = preg_replace("/".$peopleOU."/i","",$base);
     }
 
-
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-                              TRUE, $base2, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, 
+                    $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -1111,9 +1112,9 @@ class systems extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
 
index 9061edceab3ba2d76fd21a5b137aa67b86606bdd..f9bd8fb9c6ba5e0fc779713e838958338a94123b 100644 (file)
@@ -42,7 +42,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/system.png'), _("System management"));
        }
index beab32aa7d4ad2ff418c19baa343a1a1e83f9707..2866f43af69f13698b7ccceee59a9a6ebd6ddaab 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
    This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
+   Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+/* Include user tab class */
 require "tabs_user.inc";
 
+
 class userManagement extends plugin
 {
-  /* Definitions */
+  /* Plugin definitions */
   var $plHeadline= "Users";
   var $plDescription= "This does something";
 
   /* Dialog attributes */
   var $usertab= NULL;
-  var $userlist= array();
   var $ui= NULL;
   var $acl= "";
   var $templates= array();
   var $got_uid= false;
-  var $departments=array();
+  var $departments= array();
+  var $CopyPasteHandler= NULL;
 
-  var $CopyPasteHandler ;
-  var $enableCopyPaste = false;
 
-  function userManagement ($config, $ui)
+  function userManagement($config, $ui)
   {
+  
     /* Save configuration for internal use */
     $this->config= $config;
     $this->ui= $ui;
 
     /* Copy & Paste handler */
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->enableCopyPaste = true;
+    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
     }
-    $this->CopyPasteHandler = new CopyPasteHandler($this->config);
 
     /* Get global filter config */
     if (!isset($_SESSION["userfilter"])){
       $base= get_base_from_people($ui->dn);
       $userfilter= array( "mailusers"       => "checked",
-          "unixusers"       => "checked",
-          "templates"       => "",
-          "subsearch"       => "",
-          "proxyusers"      => "checked",
-          "sambausers"      => "checked",
-          "faxusers"        => "checked",
-          "functionalusers" => "checked",
-          "regex"           => "*");
-      $_SESSION["userfilter"] = $userfilter;
+                          "unixusers"       => "checked",
+                          "templates"       => "",
+                          "subsearch"       => "",
+                          "proxyusers"      => "checked",
+                          "sambausers"      => "checked",
+                          "faxusers"        => "checked",
+                          "functionalusers" => "checked",
+                          "regex"           => "*");
+      $_SESSION["userfilter"]= $userfilter;
     }
-    if(!isset($_SESSION['CurrentMainBase']))  {
+    
+    /* Transfer global base to dialogs people base */
+    if(!isset($_SESSION['CurrentMainBase'])){
       $base= get_base_from_people($ui->dn);
-      $_SESSION['CurrentMainBase'] = $base;
+      $_SESSION['CurrentMainBase']= $base;
     }
+
+    /* LOCK MESSAGE Vars */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
   }
 
+
   function execute()
   {
+    //FIXME: This function lacks structure! It's dammn spaghetti code.
+  
     /* Call parent execute */
     plugin::execute();
 
-    /* LOCK  MESSAGE Vars */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
-
+    $smarty= get_smarty();                  // Smarty instance
+    $userfilter= get_global("userfilter");  // contains Filter Settings
+    $s_action= "";                          // Contains the action to be taken
+    $s_entry= "";                           // The value for s_action
+    $base_back= "";                         // The Link for Backbutton
 
-    $smarty       = get_smarty();             // Smarty instance
-    $userfilter   = get_global("userfilter"); // contains Filter Settings
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
+    /* Department folder change requested? */
+    if( isset($_GET['act']) && $_GET['act'] == "dep_open" ){
+      $s_action= "open";
+      $s_entry= base64_decode($_GET['dep_id']);
 
-    /* Start for New List Managment */
-    if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
-      $s_action="open";
-      $s_entry = base64_decode($_GET['dep_id']);
+      /* Set current main base to the requested department DN */
       $_SESSION['CurrentMainBase']= $this->config->departments[trim($s_entry)];
     }
 
-    /* Test Posts */  
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/user_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/user_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/user_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/user_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/user_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/dep_home.*/i",$key)){
-        $s_action="home";
-      }elseif(preg_match("/user_tplnew.*/i",$key)){
-        $s_action="new_tpl";
-      }elseif(preg_match("/user_chgpw.*/i",$key)){
-        $s_action="change_pw";
-        $s_entry  = preg_replace("/user_chgpw_/i","",$key);
-      }elseif(preg_match("/dep_root.*/i",$key)){
-        $s_action="root";
-      }elseif(preg_match("/userfrom_tpl.*/i",$key)){
-        $s_action="create_user_from_tpl";
-        $s_entry  = preg_replace("/userfrom_tpl_/i","",$key);
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }
+    /* Edit entry button pressed? */
+    if( isset($_GET['act']) && $_GET['act'] == "edit_entry" ){
+      $s_action= "edit";
+      $s_entry= validate($_GET['id']);
     }
 
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action = "edit";
-      $s_entry  = $_GET['id'];
-    }
+    /* Test relevant POST values */  
+    foreach($_POST as $key => $val){
 
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
+      /* Get every possible POST combination and set s_action/s_entry accordingly */
+      foreach(array("del"       => "user_del",    "edit"      => "user_edit",
+                    "back"      => "dep_back",    "new"       => "user_new",
+                    "home"      => "dep_home",    "new_tpl"   => "user_tplnew",
+                    "change_pw" => "user_chgpw",  "root"      => "dep_root",
+                    "editpaste" => "editpaste",   "copy"      => "copy",
+                    "cut"       => "cut") as $act => $name){
+
+        if (preg_match("/".$name.".*/", $key)){
+          $s_action= $act;
+          $s_entry= preg_replace("/".$name."_/i", "", $key);
+          break;
+        }
+      }
+      
+    } /* ...Test POST */
+
+    //FIXME: Remove trailing _what_? There seems to be something encoded in
+    //       the string right now, but it would be helpful to have informations
+    //       about it. I'd like to see quick code reading by other developers.
+    $s_entry= preg_replace("/_.$/", "", $s_entry);
 
-    if(preg_match("/.*-.*/",$s_entry)){
-      $s_tab   = preg_replace("/^.*-/i","",$s_entry);
-      $s_entry = preg_replace("/-.*$/i","",$s_entry);
+    /* Seperate possibly encoded tab and entry, default to tab "user" */
+    if(preg_match("/.*-.*/", $s_entry)){
+      $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry);
+      $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry);
     }else{
-      $s_tab   = "user";
-    };
+      $s_tab= "user";
+    }
 
-    /* Department changed? */
-    if(isset($_POST['CurrentMainBase']) && $_POST['CurrentMainBase']){
-      $_SESSION['CurrentMainBase']= $_POST['CurrentMainBase'];
+    /* Department has changed? */
+    if(isset($_POST['CurrentMainBase'])){
+      $_SESSION['CurrentMainBase']= validate($_POST['CurrentMainBase']);
     }
 
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $_SESSION['CurrentMainBase']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
-      $_SESSION['CurrentMainBase']=(preg_replace("/^[^,]+,/","",$_SESSION['CurrentMainBase']));
+    /* Home-button is pressed, move to users home DN */
+    if($s_action == "home"){
+      $_SESSION['CurrentMainBase']= preg_replace('/^[^,]+,'.normalizePreg(get_people_ou()).'/', "", $this->ui->dn);
     }
 
-    if($s_action=="root"){
-      $_SESSION['CurrentMainBase']=($this->config->current['BASE']);
+    /* Root-button is pressed, move to root DN */
+    if($s_action == "root"){
+      $_SESSION['CurrentMainBase']= $this->config->current['BASE'];
     }
 
+    /* If Back-button is pressed, move back one step in DN */
+    if($s_action == "back"){
+      //FIXME: This is not 100% correct. We'll only display ou's, but there may be
+      //       a step between. You'll stumble in a "hidden" department in this case.
+      $base_back= preg_replace("/^[^,]+,/", "", $_SESSION['CurrentMainBase']);
 
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","", $_SESSION['CurrentMainBase']);
-      $base_back          = convert_department_dn($base_back);
+      /* The department array keeps non DN entries as index. We need to convert
+         it before checking the existance. */
+      $base_back= trim(convert_department_dn($base_back));
 
-      if(isset($this->config->departments[trim($base_back)])){
-        $_SESSION['CurrentMainBase']= $this->config->departments[trim($base_back)];
+      /* Check if the department exists, otherwise revert to the configure base DN */
+      if(isset($this->config->departments[$base_back])){
+        $_SESSION['CurrentMainBase']= $this->config->departments[$base_back];
       }else{
-        $_SESSION['CurrentMainBase']= $this->config->departments["/"];
+        $_SESSION['CurrentMainBase']= $this->config->departments['/'];
       }
     }
 
+# |||| ----------------------- copy and paste - move it into a seperate function
+//FIXME: I've mostly skipped reviewing this. Just a few comments have been
+//       added. Fact is, that we've an execute() function with more than 800
+//       lines. I personally tend to make this shorter. Even the complete new
+//       list management is a huge copy'n paste factor which can be sourced out
+//       to another function.
 
-    /* Only perform copy / paste if it is enabled
-     */
-    if($this->enableCopyPaste){
+    /* Only perform copy/paste if it is enabled */
+    if($this->CopyPasteHandler){
 
-      /* Paste copied/cutted object in here
-       */
-      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+      /* Paste copied/cutted object in here */
+      //FIXME: Sure? Does this comment describe what happens below?
+      if( $s_action == "editPaste" || $this->CopyPasteHandler->stillOpen()){
         $this->CopyPasteHandler->save_object();
-        $this->CopyPasteHandler->SetVar("base",$_SESSION['CurrentMainBase']);
-        $ret    = $this->CopyPasteHandler->execute(false);
-        if($ret) return($ret);
-        $this->reload();
-        $dn = $this->CopyPasteHandler->lastdn;
+        $this->CopyPasteHandler->SetVar("base", $_SESSION['CurrentMainBase']);
+
+        /* Execute copy and paste without showing message on success. */
+        //FIXME: It is not clear what really happens, or why we're stopping
+        //       to process data here. See the FIXME in class_CopyAndPasteHandler.
+        //       Normally we don't have something in $ret, because we've fired
+        //       up with (false) <=> which seems to mean "no messages".
+        if( ($ret= $this->CopyPasteHandler->execute(false))){
+          return ($ret);
+        }
 
+        /* Reload to have freshly copied entries in the list */
+        $this->reload();
+        
+        /* Use the last dn to search for it's ID in the newly generated list. */
+        $dn= $this->CopyPasteHandler->lastdn;
         foreach($this->list as $id => $entry){
           if($entry['dn'] == $dn){
-            $s_entry = $id;
+            $s_entry= $id;
+            break;
           }
         }
+       
+        /* Change action to "change_pw" if user has requested to do so. */
         if($_POST['passwordTodo'] == "new"){
-          $s_action = "change_pw";
+          $s_action= "change_pw";
         }
       }
 
-
-      /* Copy current object to CopyHandler
-       */
+      /* Copy current object to CopyHandler */
       if($s_action == "copy"){
         $this->CopyPasteHandler->Clear();
 
-        $dn     = $this->list[trim($s_entry)]['dn'];
-        $acl    = get_permissions ($dn, $this->ui->subtreeACL);
+        $dn= $this->list[trim($s_entry)]['dn'];
+        $acl= get_permissions ($dn, $this->ui->subtreeACL);
 
-        $obj    = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
-        $objNew = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], "new");
+        $obj= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
+        $objNew= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], "new");
 
         $obj->set_acl($acl);
         $objNew->set_acl($acl);
@@ -221,58 +236,37 @@ class userManagement extends plugin
         $this->CopyPasteHandler->Copy($obj,$objNew);
       }
 
-
-      /* Copy current object to CopyHandler
-       */
+      /* Copy current object to CopyHandler */
+      //FIXME: Again? This is cut. Hopefully it works without touching the special
+      //       attributes from above.
       if($s_action == "cut"){
         $this->CopyPasteHandler->Clear();
-        $dn     = $this->list[trim($s_entry)]['dn'];
+        $dn= $this->list[trim($s_entry)]['dn'];
         $acl= get_permissions ($dn, $this->ui->subtreeACL);
 
-        $obj    = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
+        $obj= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
         $obj->set_acl($acl);
 
         $this->CopyPasteHandler->Cut($obj);
       }
     }
-
-    /* End for new List Managment */
+# ^^^^^ ----------------------- copy and paste - move it into a seperate function
 
     /* Save filter data if we are in the headpage */
-    if (!isset($this->usertab)){
-      if (isset($_POST['regexit'])){
-        $userfilter["regex"]= $_POST['regexit'];
-      }
+    if(!isset($this->usertab)){
+      $values= array("functionalusers", "unixusers", "mailusers", "sambausers",
+                     "proxyusers", "faxusers", "templates", "subsearch");
+      $userfilter= saveFilter($userfilter, $values);
+      register_global("userfilter", $userfilter);
     }
-    if(isset($_POST['regexit'])){
-      foreach( array("functionalusers", "unixusers", "mailusers","sambausers", "proxyusers", "faxusers", "templates", "subsearch") as $type){
-        if (isset($_POST[$type])) {
-          $userfilter[$type]= "checked";
-        } else {
-          $userfilter[$type]= "";
-        }
-      }
-    }
-    if (isset($_GET['search'])){
-      $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-      if ($s == "**"){
-        $s= "*";
-      }
-      $userfilter['regex']= $s;
-    }
-    register_global("userfilter", $userfilter);
-
 
     /* React on user interaction here */
     if (($_SERVER["REQUEST_METHOD"] == "POST")||($_SERVER["REQUEST_METHOD"]== "GET")){
 
       /* User wants to edit data? */
-      
-      /* Check for config to ensure that there is currently no user open */
       if (($s_action=="edit") && (!isset($this->usertab->config))){
 
         /* Get 'dn' from posted 'uid', must be unique */
-
         $this->dn= $this->list[trim($s_entry)]['dn'];
 
         /* Check locking, save current plugin in 'back_plugin', so
@@ -290,18 +284,18 @@ class userManagement extends plugin
 
         /* Register usertab to trigger edit dialog */
         $this->usertab= new usertabs($this->config, 
-            $this->config->data['TABS']['USERTABS'], $this->dn);
-        //        $_POST[$s_tab]=$s_tab;
+                                     $this->config->data['TABS']['USERTABS'], $this->dn);
 
-        // This would be better
+        /* Switch tab, in case that was requested by the user */
         $this->usertab->current = $s_tab;
+        
+        /* Set ACL and move DN to the headline */
         $this->usertab->set_acl($acl);
-
         $_SESSION['objectinfo']= $this->dn;
       }
     }
 
-    /* Reset requested? */
+    /* Reset all relevant data, if we get a _cancel request */
     if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
       if (isset($this->usertab)){
         del_lock ($this->usertab->dn);
@@ -316,7 +310,7 @@ class userManagement extends plugin
     }
 
     /* Password change requested */
-    if ($s_action=="change_pw"){
+    if ($s_action == "change_pw"){
 
       /* Get 'dn' from posted 'uid' */
       $this->dn= $this->list[trim($s_entry)]['dn'];
@@ -361,7 +355,7 @@ class userManagement extends plugin
           }
         }
 
-        /* Errors, or change password? */
+        /* Errors, or password change? */
         if (count($message) != 0){
 
           /* Show error message and continue editing */
@@ -420,7 +414,6 @@ class userManagement extends plugin
       unset ($_SESSION['objectinfo']);
     }
 
-
     /* Remove user was requested */
     if ($s_action=="del"){
 
@@ -441,7 +434,7 @@ class userManagement extends plugin
 
         /* Lock the current entry, so nobody will edit it during deletion */
         add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the user %s."), LDAP::fix($this->dn)));
+        $smarty->assign("info", sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)));
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       } else {
 
@@ -451,8 +444,6 @@ class userManagement extends plugin
       }
     }
 
-
-
     /* Confirmation for deletion has been passed. User should be deleted. */
     if (isset($_POST['delete_user_confirm'])){
 
@@ -574,7 +565,7 @@ class userManagement extends plugin
           if ($ldap->count() != 0){
             while ($attrs= $ldap->fetch()){
               $this->templates[$ldap->getDN()]=
-                $attrs['uid'][0]." - $key";
+                $attrs['uid'][0]." - ".@LDAP::fix($key);
             }
             $this->templates['none']= _("none");
           }
@@ -612,7 +603,6 @@ class userManagement extends plugin
       }
 
       /* Use template if there are any of them */
-  
       if ((count($this->templates) && ($s_action!='new_tpl'))||($s_action=="create_user_from_tpl")){
         foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
           $smarty->assign("$attr", $this->$attr);
@@ -645,7 +635,7 @@ class userManagement extends plugin
       $dn= preg_replace("/^[^,]+,/i", "", $_POST['template']);
       $ldap= $this->config->get_ldap_link();
       $ldap->cd ($dn);
-      $ldap->search ("(&(sn=".$this->sn.")(givenName=".$this->givenName."))", array("givenName"));
+      $ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName"));
       if ($ldap->count () != 0){
         $message[]= _("A person with the choosen name is already used in this tree.");
       }
@@ -702,7 +692,7 @@ class userManagement extends plugin
       $this->usertab->givenName = $this->givenName;
       $template_dn              = $_POST['template'];
       $this->usertab->adapt_from_template($template_dn);
-      $template_base            = preg_replace("/^[^,]+,".get_people_ou()."/", '', $template_dn);
+      $template_base            = preg_replace("/^[^,]+,".normalizePreg(get_people_ou())."/", '', $template_dn);
       $this->usertab->by_object['user']->base= $template_base;
 
       /* Set up the users ACL's for this 'dn' */
@@ -721,7 +711,7 @@ class userManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->usertab->by_object[$this->usertab->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -729,9 +719,7 @@ class userManagement extends plugin
       return ($display);
     }
 
-    $smarty= get_smarty();
-
-    /* Check sorting variable */
+    /* Reload if we need a reload... */
     if (!isset($this->usertab) &&
         !isset($_POST['new_user']) &&
         !isset($_POST['new_template']) &&
@@ -756,28 +744,25 @@ class userManagement extends plugin
       }
     }
 
-
-    /* Create paste icon
-     */
-    if($this->enableCopyPaste){
-      $Copy_Paste = " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
-      if($this->CopyPasteHandler->isCurrentObjectPastAble()){
-        if($this->CopyPasteHandler->isCurrentCutted()){
-          $img = "images/cutpaste.png";
-        }else{
-          $img = "images/copypaste.png";
-        }
-        $Copy_Paste .= "<input type='image' name='editPaste' class='center'
-          src='".$img."' alt='"._("Paste")."' title='".$this->CopyPasteHandler->GetCurrentDn()."'>&nbsp;";
-      }else{
-        $Copy_Paste .= "<img class='center' src='images/cant_editpaste.png' alt='"._("Can't paste")."'>&nbsp;";
-      }
+    /* Choose correct paste icon */
+    if($this->CopyPasteHandler){
+      $Copy_Paste= $this->CopyPasteHandler->generatePasteIcon();
     }else{
-      $Copy_Paste ="";
+      $Copy_Paste"";
     }
 
+#------------------------------------------------------------------------ Review mark
+    //FIXME: Hmm. I spent some hours in the past to get rid of HTML inside the
+    //       PHP code. The section from here until the end of the execute() function
+    //       is not what I'd call a good solution. It works, but its somewhat ugly.
+    //       Currently I've no idea to make it better. HERE docs can help to make
+    //       the code more readable. Smarty templates would be the best solution.
+    //       Just not sure how to do it right now.
 
     /* NEW LIST MANAGMENT */
+    //FIXME: Who cares? The old one is not present, and the big letters don't
+    //       make clear that it's still spaghetti code...
+    //FIXME: Variable naming - field1....
     $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
       " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
@@ -791,11 +776,8 @@ class userManagement extends plugin
       _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
-
-
-
     
-    if($this->enableCopyPaste){
+    if($this->CopyPasteHandler){
       $action = "<input class='center' type='image'
         src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       $action.= "<input class='center' type='image'
@@ -815,33 +797,29 @@ class userManagement extends plugin
         name='user_del_%KEY%' title='"._("Delete user")."'>";
     }
 
-
-
     $divlist = new divlist("userstab");
     $divlist->SetHeader(array(
           array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
           array("string" => _("Username")." / "._("Department"), "attach" => "style=''"),
           array("string" => _("Properties"), "attach" => "style='width:152px;'"),
-          array("string" => _("Actions"), "attach" => "style='width:90px;border-right:0px;text-align:right;'")));
-
+          array("string" => _("Actions"), "attach" => "style='width:102px;border-right:0px;text-align:right;'")));
 
     $divlist->SetSummary(_("This table displays all users, in the selected tree."));
     $divlist->SetEntriesPerPage(0);
 
-    // Defining Links 
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    /* Defining Links */
+    $linkopen = "<a href='?plug=".validate($_GET['plug'])."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
     /* Insert departments in divlist*/
-    foreach($this->departments as $key=> $val){
+    foreach($this->departments as $key => $val){
 
       if(!isset($this->config->departments[trim($key)])){
         $this->config->departments[trim($key)]="";
       }
 
       $non_empty="";
-      $keys= str_replace("/","\/",$key);
-      foreach($this->config->departments as $keyd=>$vald ){
-        if(preg_match("/".$keys."\/.*/",$keyd)){
+      foreach($this->config->departments as $keyd => $vald ){
+        if(preg_match("/".normalizePreg($key)."\/.*/", $keyd)){
           $non_empty="full";
         }
       }
@@ -851,7 +829,6 @@ class userManagement extends plugin
       $field3 = array("string" => "&nbsp;", "attach" => "style='width:152px;'");
       $field4 = array("string" => "&nbsp;", "attach" => "style='width:90px;border-right:0px;text-align:right;'");
 
-
       $divlist->AddEntry(array($field1,$field2,$field3,$field4));
     }
 
@@ -872,14 +849,13 @@ class userManagement extends plugin
                     name='user_edit_%KEY%-sambaAccount' title='"._("Edit samba properties")."'>"; 
     $tplcreateuserimg  = "<input type='image' class='center' src='images/list_new.png' alt='"._("Create user from template")."'
                     name='userfrom_tpl_%KEY%' title='"._("Create user with this template")."'>";   
-    
 
     $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>"; 
 
     // User and Template  Images  
     $userimg  = "<img class='center' src='images/select_user.png' alt='User' title='%s'>";   
     $tplimg   = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";   
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $editlink = "<a href='?plug=".validate($_GET['plug'])."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     // Defines Arrays to save User and Templates
     $tpls = array();
@@ -950,7 +926,8 @@ class userManagement extends plugin
 
     
 
-      // Specify Pics for Extensions  
+      /* Specify Pics for Extensions */ 
+      //FIXME: Spaghetti code. Please replace by a simple loop.
       if(in_array("posixAccount"    ,$val['objectClass'])){ 
         $posix = preg_replace("/%KEY%/", "$key", $posiximg);
       }else{ 
@@ -1000,9 +977,9 @@ class userManagement extends plugin
 
       /* Create each field */
       $field1 = array("string" => sprintf($tpl,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port, "attach" => "style='' title='".$val['dn']."'");
-      $field3 = array("string" => $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$s_img_create_from_template, "attach" => "style='width:152px;'");
-      $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='width:90px;border-right:0px;text-align:right;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port, "attach" => "style='' title='dn:&nbsp;".@LDAP::fix($val['dn'])."'");
+      $field3 = array("string" => $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba, "attach" => "style='width:152px;'");
+      $field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),"attach" => "style='width:102px;border-right:0px;text-align:right;'");
 
       $add = array($field1,$field2,$field3,$field4);
 
@@ -1026,27 +1003,25 @@ class userManagement extends plugin
     foreach($users as $key => $val){
       $divlist->AddEntry( $val, array(""));
     }
-    /* Show main page */
-    //$smarty->assign("userlist",   nl2br(htmlentities($divlist->DrawList())));
     $smarty->assign("userlist",   $divlist->DrawList());
     $smarty->assign("userlisthead", $listhead);
-
-    /* END NEW LIST MANAGMENT
-     */  
+    
     $smarty->assign("search_image", get_template_path('images/search.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("infoimage", get_template_path('images/info.png'));
     $smarty->assign("launchimage", get_template_path('images/launch.png'));
     $smarty->assign("deplist", $this->config->idepartments);
+
     foreach( array("functionalusers", "unixusers",
           "mailusers", "sambausers", "proxyusers", 
           "faxusers", "templates", "subsearch") as $type){
 
       $smarty->assign("$type", $userfilter[$type]);
     }
-    $smarty->assign("CurrentMainBase",$_SESSION['CurrentMainBase']);
 
+    $smarty->assign("CurrentMainBase",$_SESSION['CurrentMainBase']);
     $smarty->assign("regex", $userfilter["regex"]);
+
     /* Extend if we are not using javascript */
     $smarty->assign("apply", apply_filter());
     $smarty->assign("alphabet", generate_alphabet());
@@ -1055,8 +1030,11 @@ class userManagement extends plugin
     if((is_callable("mysql_close"))&&($r_con)){
       @mysql_close($r_con);
     }
+
+    /* Return rendered main page */
     return ($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
   }
+#----------------------------------------------------------------- Reviewed after this mark
 
 
   function reload()
@@ -1074,36 +1052,17 @@ class userManagement extends plugin
       $regex= "*";
     }
 
-    /* Set filter depending on selection */
+    /* Setup filter depending on selection */
+    $filter="";
     if ($this->config->current['SAMBAVERSION'] == 3){
       $samba= "sambaSamAccount";
     } else {
       $samba= "sambaAccount";
     }
-
-
-    /* Sometimes not all users were displayed in the users list.
-       The problem was, that we search for an objectClass
-        which isn't used in every ldap-schema configuration.
-       Here we remove this class, if there is no result returned from 
-        our test search.
-    */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    $ldap->search("(objectClass=goFaxAccount)",array("cn","uid"));
-    if($ldap->fetch()){
-      $useFaxInFilter = true;
-      $FaxFilter = "(objectClass=goFaxAccount)";
-    } else {
-      $useFaxInFilter = false;
-      $FaxFilter = "";
-    }
-   
-    $filter="";
     if ($userfilter['functionalusers'] == "checked"){
-      $filter.= "(&(objectClass=gosaAccount)(!(|(objectClass=posixAccount)(objectClass=gosaMailAccount)(objectClass=$samba)".$FaxFilter."(objectClass=gosaProxyAccount))))";
+      $filter.= "(&(objectClass=gosaAccount)(!(|(objectClass=posixAccount)".
+                "(objectClass=gosaMailAccount)(objectClass=$samba)".
+                "(objectClass=gosaProxyAccount))))";
     }
     if ($userfilter['unixusers'] == "checked"){
       $filter.= "(objectClass=posixAccount)";
@@ -1117,125 +1076,93 @@ class userManagement extends plugin
     if ($userfilter['proxyusers'] == "checked"){
       $filter.= "(objectClass=gosaProxyAccount)";
     }
-    if (($userfilter['faxusers'] == "checked") && ($useFaxInFilter)){
-      $filter.= "(objectClass=goFaxAccount)";
-    }
     if ($userfilter['templates'] == "checked"){
       $filter= "(|(objectClass=gosaUserTemplate)(&(objectClass=gosaAccount)(|$filter)))";
     } else {
       $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|$filter))";
     }
+    //FIXME: Search filter will fail, if 'regex' contains filter special characters.
     $filter= "(&(|(uid=$regex)(sn=$regex)(givenName=$regex))$filter)";
 
     /* Generate userlist */
     $ldap= $this->config->get_ldap_link(TRUE);
     if ($userfilter['subsearch'] == "checked"){
-      $this->list= get_list($this->ui->subtreeACL, "$filter", TRUE, $base, array("uid", "givenName", "sn", "objectClass"), TRUE);
+      $this->list= get_list($filter, $this->ui->subtreeACL, $base,
+                            array("uid", "givenName", "sn", "objectClass"), GL_SUBSEARCH | GL_SIZELIMIT);
     } else {
       $base= get_people_ou().$base;
-      $this->list= get_list($this->ui->subtreeACL, "$filter", FALSE, $base, array("uid", "givenName", "sn", "objectClass"), TRUE);
+      $this->list= get_list($filter, $this->ui->subtreeACL, $base, 
+                            array("uid", "givenName", "sn", "objectClass"), GL_SIZELIMIT);
     }
 
-
     /* NEW LIST MANAGMENT
      * We also need to search for the departments
-     * So we are able to navigate like in konquerer 
-     */
+     * So we are able to navigate like in konquerer */
+     //FIXME: Same here - who cares? We need comments that make code reading
+     //       more easy. No prosa for things that are not important - or even
+     //       not readable below.
+     //FIXME: Repeatedly I see things like res1, res3, base2, etc. This is no
+     //       good coding style at all.
 
     /* Create base to search in */
-
-    $peopleOU = get_people_ou();
-    if(empty($peopleOU))  {
-      $base2 = $base;
+    if(get_people_ou() == ""){
+      $dep_base= $base;
     }else{
-      $base2 = preg_replace("/".$peopleOU."/i","",$base);
+      $dep_base= preg_replace("/".normalizePreg(get_people_ou())."/i", "", $base);
     }
 
     /* Get all departments within this subtree */
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-        TRUE, $base2, array("ou", "description"), TRUE);
-
-    $this->departments= array();
+    $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL,
+                    $dep_base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     /* Create array with results */
-    $tmp = array();
-    foreach ($res3 as $value){
-      $tmp[strtolower($value['dn']).$value['dn']]=$value;
+    //FIXME: Sure. Interesting. What the heck is happening here? Why do we
+    //       need so many loops to perform one action? $tmp is used below
+    //       maybe this is integratable? Why are lowercase and normal variants
+    //       perpended? Concepts other than "Create array with results"?
+    $tmp= array();
+    foreach ($deps as $value){
+      $tmp[strtolower($value['dn']).$value['dn']]= $value;
     }
 
     /* Sort array */
+    //FIXME: Which is implied by ksort, I guess.
     ksort($tmp);
 
     /* Create result array */
+    //FIXME: Didn't we do that above?
+    $this->departments= array();
     foreach($tmp as $value){
       if(isset($value['description'][0])){
-        $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]=convert_department_dn2($value['dn']);
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);
       }
     }
-    /* END NEW LIST MANAGMENT 
-     */
 
-
-    $this->userlist= array();
-
-    foreach ($this->list as $value){
-      if (isset($value["uid"][0]) && !preg_match('/\$$/', $value["uid"][0])){
-        if (in_array_ics('gosaUserTemplate', $value['objectClass'])){
-          $this->userlist[$value["dn"]]= "* ".$value["uid"][0]." ("._("Template").")";
-          continue;
-        }
-        if (isset($value["givenName"][0]) && isset($value["sn"][0])){
-          $this->userlist[$value["dn"]]= $value["sn"][0].", ".
-            $value["givenName"][0].
-            " [".$value["uid"][0]."]";
-        } else {
-          $this->userlist[$value["dn"]]= "[".$value["uid"][0]."]";
-        }
-      }
-    }
-
-    natcasesort ($this->userlist);
-    reset ($this->userlist);
-  }
-
-  function remove_from_parent()
-  {
   }
 
 
-  /* Check values */
-  function check()
-  {
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-  function adapt_from_template($dn)
-  {
-  }
-
-  function password_change_needed()
-  {
-  }
-
-  function show_header($button_text, $text, $disabled= FALSE)
-  {
-  }
-
   function remove_lock()
   {
+    /* Remove user lock if a DN is marked as "currently edited" */
     if (isset($this->usertab->dn)){
       del_lock ($this->usertab->dn);
     }
   }
 
-}
+
+  /* A set of disabled and therefore overloaded functions. They are
+     not needed in this class. */
+  function remove_from_parent() { } 
+  function check() { } 
+  function save() { } 
+  function adapt_from_template($dn) { } 
+  function password_change_needed() { } 
+  function show_header($button_text, $text, $disabled= FALSE) { }
+
+} /* ... class userManagement */
+
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index db1e9e4a32690a36f86dfe20e015cbc80b34093e..38276c9b24c21157ea3bbdf05f1bc48834934cec 100644 (file)
@@ -40,7 +40,7 @@ if ($remove_lock){
                            _("User administration"),
                            "<img alt=\"\" class=\"center\" src=\"".
                            get_template_path('images/closedlock.png').
-                           "\"> ".@ldap::fix($_SESSION['objectinfo']));
+                           "\"> ".@LDAP::fix($_SESSION['objectinfo']));
   } else {
     $display= print_header(get_template_path('images/user.png'),
                           _("User administration"));
index 065914bd2532c5d4b4a3d5fb09df1586b67e20d4..64cbe547594fbdc3ab1f05bb45ee1f55119e15da 100644 (file)
@@ -3,9 +3,13 @@
 </div>
 
 <p>
 {t}Creating a new user can be assisted by using templates. Many database records will be filled automatically. Choose 'none' to skip the usage of templates.{/t}
+ {t}Creating a new user can be assisted by using templates. Many database records will be filled automatically. Choose 'none' to skip the usage of templates.{/t}
 </p>
 
+<p class="seperator">&nbsp;</p>
+
+<br>
+
 <table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
   <tr>
     <td><b><LABEL for="template">{t}Template{/t}</LABEL></b></td>
index 7bc7dc193c71a835b7e5d522dd3be1900b326d96..0a713a327aa0d116f167c69c7a2465b78f0c9fa6 100644 (file)
@@ -363,7 +363,7 @@ class blocklist extends plugin
         // Generate Array to Add
         $display= "[".$val["cn"][0]."]";
         $field1 = array("string" => sprintf($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-        $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".$val['dn']."'");
+        $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='dn:&nbsp;".@LDAP::fix($val['dn'])."'");
         $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
         $divlist->AddEntry( array($field1,$field2,$field3));
       }
@@ -463,7 +463,9 @@ class blocklist extends plugin
     }
 
     /* Generate blocklists */
-    $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)$filter)", FALSE, "ou=gofax,ou=systems,".$base, array("*"));
+    //FIXME: No GL_SIZELIMIT?
+    $res= get_list("(&(cn=$regex)$filter)", $this->ui->subtreeACL, "ou=gofax,ou=systems,".$base, 
+                   array("*"), GL_NONE);
 
     $this->blocklists=$res;
 
@@ -478,8 +480,8 @@ class blocklist extends plugin
       $base2 = preg_replace("/".$peopleBase.",/i","",$base);
     }
    
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-        TRUE, $base2, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL,
+                    $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -489,9 +491,9 @@ class blocklist extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
 
index a1c60b3718b773e6243a55e7e874597c7c4631a4..d34a84df20f2f99b96d594924189812c242519a8 100644 (file)
@@ -77,7 +77,7 @@
 
 
 <p class="plugbottom">
-  <input type=submit name="edit_finish" value="{t}Finish{/t}">
+  <input type=submit name="edit_finish" value="{t}Save{/t}">
   &nbsp;
   <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
 </p>
index 24d1b89999ff122ae8c67f37aad47249c5e584c2..7202169d3a454e55e4626c6e787346ff8217cafe 100644 (file)
@@ -17,7 +17,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "<img alt=\"\"align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "<img alt=\"\"align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"));
        }
index 1f7080bb8e237b29ca28e9c782802651f46b49a1..961dc6dcd7beca10406a37d106506e8a631492d6 100644 (file)
@@ -350,7 +350,8 @@ class gofaxAccount extends plugin
       $base= $faxfilter['depselect'];
       $acl= array($this->config->current['BASE'] => ":all");
       print "(&(objectClass=goFaxAccount)$filter)";
-      $res= get_list($acl, "(&(objectClass=goFaxAccount)$filter)", TRUE, $base, array("sn", "givenName", "facsimileTelephoneNumber"), TRUE);
+      $res= get_list("(&(objectClass=goFaxAccount)$filter)", $acl, $base, 
+                     array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
 
       foreach ($res as $attrs){
         $list[$attrs['facsimileTelephoneNumber'][0]]=
index 3ed1eaf7e6a2fbea469bdc814e7e0cb3dce7f70d..24e0550b06c31f28ad2f611ee438d900a4a7e864 100644 (file)
@@ -86,7 +86,7 @@ if (!$remove_lock){
 
                /* Are we in edit mode? */
                if (isset($_SESSION['edit'])){
-                       $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+                       $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
                        $display.= "&nbsp;\n";
                        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
                        $info= "<img alt='' align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
index dafcf232354fda8473c2538eb6b09d0f4b5a9daf..2dd80d88de4556dab2d08b43a661dd2a6dbba5e9 100644 (file)
@@ -262,7 +262,7 @@ class phoneConferenceManagment extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->conftab->by_object[$this->conftab->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -410,8 +410,10 @@ class phoneConferenceManagment extends plugin
     $base             = $_SESSION['CurrentMainBase'];
     $regex            = $conferencefilter['regex'];
 
-    $this->conferences=get_list($this->ui->subtreeACL, "(&(|(cn=$regex)(description=$regex))(objectClass=goFonConference))",FALSE, $base, array("*"), TRUE);
-    $res3=get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",TRUE, $base, array("ou", "description"), TRUE);
+    $this->confgerences= get_list("(&(|(cn=$regex)(description=$regex))(objectClass=goFonConference))",
+                                  $this->ui->subtreeACL, $base, array("*"), GL_SIZELIMIT);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL,
+                    $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
 
@@ -422,9 +424,9 @@ class phoneConferenceManagment extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
   }
index 2fe8ade4f7a6793a0f29b305f9d46d7661b8f74a..04ab46f7863aabd5b4d66800680ac72c744a77f0 100644 (file)
@@ -35,7 +35,7 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+               $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
        } else {
                $display= print_header(get_template_path('images/conference.png'), _("Conference management"));
        }
index 6ea4e3649796721e42d60793da3b01dbd0269fb0..131ae83c6dff7602831b48ee3f8615cbfcb1d390 100755 (executable)
@@ -302,7 +302,7 @@ class gofonMacro extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
         $display.= "&nbsp;\n";
         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
@@ -401,7 +401,7 @@ class gofonMacro extends plugin
       }
 
       $field1 = array("string" => sprintf($macroimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".$val['dn']."'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='dn:&nbsp;".@LDAP::fix($val['dn'])."'");
       $field3 = array("string" => $pic1, "attach" => "style='width:50px;'");
       $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
 
@@ -447,7 +447,8 @@ class gofonMacro extends plugin
     }
 
     /* Generate macro list */
-    $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=goFonMacro))", FALSE, "ou=macros,ou=asterisk,ou=configs,ou=systems,".$base, array("*"), TRUE);
+    $res= get_list("(&(cn=$regex)(objectClass=goFonMacro))", $this->ui->subtreeACL,
+                   "ou=macros,ou=asterisk,ou=configs,ou=systems,".$base, array("*"), GL_SIZELIMIT);
     $this->macros= $res;
 
     /* NEW LIST MANAGMENT
@@ -462,8 +463,8 @@ class gofonMacro extends plugin
       $base2 = preg_replace("/".$peopleOU."/i","",$base);
     }
 
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-        TRUE, $base2, array("ou", "description"), TRUE);
+    $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+                    $this->ui->subtreeACL, $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
     $tmp = array();
@@ -473,9 +474,9 @@ class gofonMacro extends plugin
     ksort($tmp);
     foreach($tmp as $value){
       if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
       }
     }
 
index ba3307e72806f8ab677a22a6765f875a27f5df33..a5d88b776defab9a89b2870d132a3c4fdbc4ae02 100755 (executable)
@@ -35,7 +35,7 @@ if ($remove_lock){
 
   /* Page header*/
   if (isset($_SESSION['objectinfo'])){
-    $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@ldap::fix($_SESSION['objectinfo']));
+    $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
   } else {
     $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"));
   }
index cc27bee55da540166cdbc2e87aef59b7d35e34ee..c81fbea4c7eeaf3dc63d411c044048b6441ad06d 100644 (file)
@@ -102,7 +102,7 @@ if (!$remove_lock){
 
                /* Are we in edit mode? */
                if (isset($_SESSION['edit'])){
-                       $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+                       $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
                        $display.= "&nbsp;";
                        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
                        $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
index e6cbf0e0bb87df614e9b4920f3c271ffd845d74c..644bd98397bc4aa2447af989626c3ded900c3c8d 100644 (file)
@@ -115,7 +115,7 @@ if (!$remove_lock){
   if ($in_edit_mode){
     $display.="<div align='right'>";
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
index 5b2018ffc3200173ab9ddeba6207f1b1dcc7871e..8adafd25d5a20ed48552a8b17f52611985fba0d2 100644 (file)
                                </tr>
                                <tr>
                                        <td colspan=2>
+                                               <br>
                                                <input type="checkbox" name="gotoProfileFlag_L" id="gotoProfileFlag_L" value="L"  {$gotoProfileFlag_LCHK}
                                                        {if $gotoProfileFlagsACL=="disabled"}
                                                                disabled 
                                                        {/if}>
-                                               <label for="gotoProfileFlag_L">{t}Resolution changeable on runtime{/t}</label>
+                                               <label for="gotoProfileFlag_L">{t}Resolution changeable during session{/t}</label>
                                        </td>
                                </tr>
                                <tr>
index 4c3f6fca1a9be99e0a9ca344dbe6ae3766848a89..040f87dc66721c11e42763ac2dcc08d1e71d50ac 100644 (file)
@@ -35,7 +35,7 @@
 </table>
        <p class="seperator">&nbsp;</p>
        <p align="right">
-       <input type="submit" name="HotPlugSave"         value="{t}save{/t}">
+       <input type="submit" name="HotPlugSave"         value="{t}Save{/t}">
        <input type="submit" name="HotPlugCancel"       value="{t}Cancel{/t}">
        </p>
 <script language="JavaScript" type="text/javascript">
index 22f06d12bd5696333de36faf50de385731164a5d..5fbd38c065a90d7112cf579a3d4e06c69ef0a085 100644 (file)
@@ -101,7 +101,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if ((isset($_SESSION['edit']))&&($environment->dialog==NULL)){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
index 639e082a75cf389129a86cf33a10387518eb51f5..f39a4e174f740aed6ef7e0fe97823b502f316b27 100644 (file)
@@ -73,7 +73,7 @@
 </table>
 
 <p class="plugbottom">
-  <input type=submit name="cert_edit_finish" value="{t}Finish{/t}">
+  <input type=submit name="cert_edit_finish" value="{t}Save{/t}">
   &nbsp;
   <input type=submit name="cert_edit_cancel" value="{t}Cancel{/t}">
 </p>
index fee316db5e7e33626172bcb1e7e6113bc85875b5..bebf8527c3d32023f9c41a6fc3fcb66a75baac37 100644 (file)
@@ -155,7 +155,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $display.="<script language='javascript'>";
index 0d51a29dd464af1eb6bb907d88c5d80cbba71bbc..94bd81e8af98c194572408ced563d60120a70222 100644 (file)
@@ -412,7 +412,8 @@ class mailAccount extends plugin
       }
 
       $acl= array($this->config->current['BASE'] => ":all");
-      $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $mailfilter['depselect'], array("sn", "mail", "givenName"), TRUE);
+      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", $acl, $mailfilter['depselect'], 
+                     array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
       $ldap->cd($mailfilter['depselect']);
       $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
       error_reporting (0);
index 1ad1f1c951731446ee4c4411a3ace8c153380473..fc1e05286a683d9ae8b4897f1d39641d90a12273 100644 (file)
@@ -101,7 +101,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
index f2a158f7bd8732a15e39f6969971dfd9eed75e68..b74cd21b76c5a07eeb5a0add032e61ab947b53ad 100644 (file)
@@ -101,7 +101,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
index dc821827919bd895bdde1c57149192cfe64f8807..64ffe8b39bd0109ea069af3d7c52cc25b85540c9 100644 (file)
@@ -354,7 +354,7 @@ class posixAccount extends plugin
       $acl= array($this->config->current['BASE'] => ":all");
       $regex= $sysfilter['regex'];
       $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
-      $res= get_list($acl, "$filter", TRUE, $sysfilter['depselect'], array("cn"), TRUE);
+      $res= get_list($filter, $acl, $sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
       $wslist= array();
       foreach ($res as $attrs){
         $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
@@ -858,32 +858,17 @@ $ldap->modify ($this->attrs);
  
     /* Take care about groupMembership values: add to groups */
     foreach ($this->groupMembership as $key => $value){
-      $g= new group($this->config, $key);
-      $g->addUser ($this->uid);
+      $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key);
+      $g->by_object['group']->addUser($this->uid);
       $g->save();
-
-      /* May need to save the mail part, too */
-      if ($g->has_mailAccount){
-        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key);
-        $g->by_object['group']->removeUser ($this->uid);
-        $g->save();
-      }
     }
     
     /* Remove from groups not listed in groupMembership */
     foreach ($this->savedGroupMembership as $key => $value){
       if (!isset($this->groupMembership[$key])){
-        
-        $g= new group($this->config, $key);
-        $g->removeUser ($this->uid);
+        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key);
+        $g->by_object['group']->removeUser ($this->uid);
         $g->save();
-
-        /* May need to save the mail part, too */
-        if ($g->has_mailAccount){
-          $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key);
-          $g->by_object['group']->removeUser ($this->uid);
-          $g->save();
-        }
       }
     }
 
@@ -1122,7 +1107,8 @@ $ldap->modify ($this->attrs);
     $ldap = $this->config->get_ldap_link();    
 
     $base= get_groups_ou().$base;
-    $res= get_list($this->ui->subtreeACL, "(objectClass=posixGroup)", FALSE, $base, array("cn", "description", "gidNumber"), TRUE);
+    $res= get_list("(objectClass=posixGroup)", $this->ui->subtreeACL, $base,
+                   array("cn", "description", "gidNumber"), GL_SIZELIMIT);
     if (preg_match("/size limit/i", $error)){
       $_SESSION['limit_exceeded']= TRUE;
     }
index f44f4f1b3baece1873fcf5dc25df6cdb6257a7c0..881eb8c02535cece9eb0c098686e3344d6d39531 100644 (file)
@@ -107,7 +107,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
index 177e6836bc89e5a2b25d21218b8c169a62c8969e..116cb40626a2a444305ec1c498118d03c628c246 100644 (file)
@@ -322,7 +322,7 @@ class sambaAccount extends plugin
       $acl= array($this->config->current['BASE'] => ":all");
       $regex= $sambafilter['regex'];
       $filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
-      $res= get_list($acl, "$filter", TRUE, $sambafilter['depselect'], array("uid"), TRUE);
+      $res= get_list($filter, $acl, $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
       $wslist= array();
       foreach ($res as $attrs){
         $wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
index d794d9aa75aa7a80637b8c30bbc29aa79db634d4..9e6602fd86338fc7ff95028c5e13102c597a8586 100644 (file)
@@ -101,7 +101,7 @@ if (!$remove_lock){
 
     /* Are we in edit mode? */
     if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').