From: cajus Date: Tue, 18 Apr 2006 05:30:30 +0000 (+0000) Subject: Sorry for the huge commit: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1f56f14cf6e1b6cac9f04e167201814a4795bcb6;p=gosa.git Sorry for the huge commit: * 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 --- diff --git a/TODO b/TODO index d59fd2ee6..cb68e5efa 100644 --- 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: =============== diff --git a/doc/guide/user/en/lyx-source/applications.lyx b/doc/guide/user/en/lyx-source/applications.lyx index e61b3d4ad..d3b3293a0 100644 --- a/doc/guide/user/en/lyx-source/applications.lyx +++ b/doc/guide/user/en/lyx-source/applications.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/blocklists.lyx b/doc/guide/user/en/lyx-source/blocklists.lyx index 7016000fa..e16ef2cf5 100644 --- a/doc/guide/user/en/lyx-source/blocklists.lyx +++ b/doc/guide/user/en/lyx-source/blocklists.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/conference.lyx b/doc/guide/user/en/lyx-source/conference.lyx index 19ef7bddb..6200ab172 100644 --- a/doc/guide/user/en/lyx-source/conference.lyx +++ b/doc/guide/user/en/lyx-source/conference.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/departments.lyx b/doc/guide/user/en/lyx-source/departments.lyx index 8367f642f..c43e769c2 100644 --- a/doc/guide/user/en/lyx-source/departments.lyx +++ b/doc/guide/user/en/lyx-source/departments.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/groups.lyx b/doc/guide/user/en/lyx-source/groups.lyx index 5f34cd074..ddbcb9374 100644 --- a/doc/guide/user/en/lyx-source/groups.lyx +++ b/doc/guide/user/en/lyx-source/groups.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/macro.lyx b/doc/guide/user/en/lyx-source/macro.lyx index 087f942ce..fb9056bc7 100644 --- a/doc/guide/user/en/lyx-source/macro.lyx +++ b/doc/guide/user/en/lyx-source/macro.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/ogroups.lyx b/doc/guide/user/en/lyx-source/ogroups.lyx index fb55a882e..a25802f81 100644 --- a/doc/guide/user/en/lyx-source/ogroups.lyx +++ b/doc/guide/user/en/lyx-source/ogroups.lyx @@ -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 diff --git a/doc/guide/user/en/lyx-source/systems.lyx b/doc/guide/user/en/lyx-source/systems.lyx index 5afef635b..fdb07847c 100644 --- a/doc/guide/user/en/lyx-source/systems.lyx +++ b/doc/guide/user/en/lyx-source/systems.lyx @@ -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 diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 37e9a2e95..996407c30 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -1,4 +1,5 @@ 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= "  "; + if($this->isCurrentObjectPastAble()){ + if($this->isCurrentCutted()){ + $img= "images/cutpaste.png"; + }else{ + $img= "images/copypaste.png"; + } + $Copy_Paste.= " "; + }else{ + $Copy_Paste.= ""._("Can "; + } + + return ($Copy_Paste); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/include/class_config.inc b/include/class_config.inc index 0a8e35a42..c571906d6 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -1,7 +1,7 @@ * * 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.=" "; - } - $ret[$entries['ENTRY']]=$a." ".$name; - } - /* For debugging - if(isset($entries['ENTRY'])){ - $a = ""; - for($i = 0 ; $i < $depth ; $i ++){ - $a.=" |"; - } - - if(!isset($entries['SUB'])){ - $ret[$entries['ENTRY']]=$a."- ".$name; - }else{ - $ret[$entries['ENTRY']]=$a."#"." ".$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.=" "; + } + $ret[$entries['ENTRY']]=$a." ".$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: ?> diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 5448a8782..52eaecce8 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -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.= ""; + $s_return.= "
"; $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"; } - $s_return .= "\n"; + $s_return.= "\n"; 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: ?> diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 8f64c9a8d..a098b15f5 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -2,7 +2,7 @@ /***************************************************************************** newldap.inc - version 1.0 Copyright (C) 2003 Alejandro Escanero Blanco - Copyright (C) 2004 Cajus Pollmeier + Copyright (C) 2004-2006 Cajus Pollmeier Based in code of ldap.inc of Copyright (C) 1998 Eric Kilfoil @@ -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'
"; - #} - 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'
"; - #} - return ($res); + if (SPECIALS_OVERRIDE == TRUE){ + return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"), + array("\,", "(", ")", "/"), + $dn)); } else { return ($dn); } diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 81c8a1c6a..76bf6e7d4 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -807,13 +807,16 @@ class plugin } } + function saveCopyDialog(){ } + function getCopyDialog(){ return(array("string"=>"","status"=>"")); } + function PrepareForCopyPaste($source){ $todo = $this->attributes; if(isset($this->CopyPasteVars)){ diff --git a/include/functions.inc b/include/functions.inc index 807fbb636..7ea01bb5e 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -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: ?> diff --git a/locale/de/LC_MESSAGES/messages.mo b/locale/de/LC_MESSAGES/messages.mo index 318b26cd3..6c50979cc 100644 Binary files a/locale/de/LC_MESSAGES/messages.mo and b/locale/de/LC_MESSAGES/messages.mo differ diff --git a/locale/de/LC_MESSAGES/messages.po b/locale/de/LC_MESSAGES/messages.po index f91507400..5951054da 100644 --- a/locale/de/LC_MESSAGES/messages.po +++ b/locale/de/LC_MESSAGES/messages.po @@ -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" diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index 9e47fbbd4..8cd0d4d9e 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -551,7 +551,7 @@ class applicationManagement extends plugin } foreach($this->applications as $key => $val){ - $title = "title='dn : ".$val['dn']."'"; + $title = "title='dn: ".@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]; } } diff --git a/plugins/admin/applications/main.inc b/plugins/admin/applications/main.inc index 7a3823c92..aaa0fc7f1 100644 --- a/plugins/admin/applications/main.inc +++ b/plugins/admin/applications/main.inc @@ -35,7 +35,7 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/application.png'), _("Application management"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/application.png'), _("Application management"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/application.png'), _("Application management")); } diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index b1e1d7b93..b3eb93bc3 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -366,7 +366,7 @@ class departmentManagement extends plugin $display= $this->deptabs->execute(); $display.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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); diff --git a/plugins/admin/departments/main.inc b/plugins/admin/departments/main.inc index e0ec1e3a3..ac2b3e9f1 100644 --- a/plugins/admin/departments/main.inc +++ b/plugins/admin/departments/main.inc @@ -35,7 +35,7 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/department.png'), _("Department management"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/department.png'), _("Department management"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/department.png'), _("Department management")); } diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc index afae3ad90..a06c77e6d 100644 --- a/plugins/admin/fai/class_askClassName.inc +++ b/plugins/admin/fai/class_askClassName.inc @@ -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 */ diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 050a7db06..2d3a7fc21 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -603,7 +603,7 @@ class faiManagement extends plugin }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){ $display.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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']); diff --git a/plugins/admin/fai/main.inc b/plugins/admin/fai/main.inc index 1e71cbcf3..4095b7438 100644 --- a/plugins/admin/fai/main.inc +++ b/plugins/admin/fai/main.inc @@ -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"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation")); } diff --git a/plugins/admin/groups/application.tpl b/plugins/admin/groups/application.tpl index 096334317..368ef147c 100644 --- a/plugins/admin/groups/application.tpl +++ b/plugins/admin/groups/application.tpl @@ -15,7 +15,7 @@
"; + $s_return.= "\n"; + $s_return.= "\n"; + $s_return.= "\n
"; } - $s_return .= "\n"; + $s_return.= "\n"; 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"; - $s_return .= "\n
 
 
{$UsedApps} - +   diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index ebcaf46f8..f255c697e 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -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 = "\"\" %s"; $catremove = " "; @@ -712,7 +716,7 @@ class appgroup extends plugin $image = "\"\" "; } - $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;'"))); } diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index e3430eaaf..eb103aac3 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -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); diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 250621df8..047bb76aa 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -571,7 +573,7 @@ class groupManagement extends plugin $posix=$mail=$samba=$appl=$phone=$empty; } - $title = "title='gid : ".$key." - dn : ".$val['dn']."'"; + $title = "title='dn: ".@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; diff --git a/plugins/admin/groups/generic.tpl b/plugins/admin/groups/generic.tpl index 3ee42bea3..d9b3d71c7 100644 --- a/plugins/admin/groups/generic.tpl +++ b/plugins/admin/groups/generic.tpl @@ -96,7 +96,7 @@

- {html_options options=$members} diff --git a/plugins/admin/groups/main.inc b/plugins/admin/groups/main.inc index 1cd235453..3c8306b19 100644 --- a/plugins/admin/groups/main.inc +++ b/plugins/admin/groups/main.inc @@ -38,7 +38,7 @@ if ($remove_lock){ $display= print_header(get_template_path('images/group.png'), _("Group administration"), "\"\" ". - @ldap::fix($_SESSION['objectinfo'])); + @LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/group.png'), _("Group administration")); } diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index f92b573b4..81afff4e3 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -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 { diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index 67b664577..4980494a0 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -540,7 +540,7 @@ name='dep_root' alt='"._("Root")."'> ". $mail = $empty; } - $title = "title='dn : ".$val['dn']."'"; + $title = "title='dn: ".@LDAP::fix($val['dn'])."'"; if(!isset($val['description'][0])){ $desc = ""; @@ -688,9 +688,7 @@ name='dep_root' alt='"._("Root")."'> ". $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")."'> ". $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")."'> ". 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 diff --git a/plugins/admin/ogroups/main.inc b/plugins/admin/ogroups/main.inc index bbe03d5e9..61950a404 100644 --- a/plugins/admin/ogroups/main.inc +++ b/plugins/admin/ogroups/main.inc @@ -34,7 +34,7 @@ if (!$remove_lock){ _("Object groups"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + "\"> ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/ogroup.png'), _("Object groups")); } diff --git a/plugins/admin/systems/class_glpiSelectUser.inc b/plugins/admin/systems/class_glpiSelectUser.inc index 053bc0d13..4d8e2d41a 100644 --- a/plugins/admin/systems/class_glpiSelectUser.inc +++ b/plugins/admin/systems/class_glpiSelectUser.inc @@ -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(); diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index f91cd51cb..6b59c1d7a 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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]; } } diff --git a/plugins/admin/systems/main.inc b/plugins/admin/systems/main.inc index 9061edcea..f9bd8fb9c 100644 --- a/plugins/admin/systems/main.inc +++ b/plugins/admin/systems/main.inc @@ -42,7 +42,7 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/system.png'), _("System management"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/system.png'), _("System management"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/system.png'), _("System management")); } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index beab32aa7..2866f43af 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -1,7 +1,7 @@ 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 @@ -17,196 +17,211 @@ 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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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 = "  "; - if($this->CopyPasteHandler->isCurrentObjectPastAble()){ - if($this->CopyPasteHandler->isCurrentCutted()){ - $img = "images/cutpaste.png"; - }else{ - $img = "images/copypaste.png"; - } - $Copy_Paste .= " "; - }else{ - $Copy_Paste .= ""._("Can "; - } + /* 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 = "
". "  ". "  ". @@ -791,11 +776,8 @@ class userManagement extends plugin _("Base")." ". "  ". "
"; - - - - if($this->enableCopyPaste){ + if($this->CopyPasteHandler){ $action = " "; $action.= ""; } - - $divlist = new divlist("userstab"); $divlist->SetHeader(array( array("string" => " ", "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 = "%s"; + /* Defining Links */ + $linkopen = "%s"; /* 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" => " ", "attach" => "style='width:152px;'"); $field4 = array("string" => " ", "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 = ""; - $empty = ""; // User and Template Images $userimg = "User"; $tplimg = "Template"; - $editlink = "%s"; + $editlink = "%s"; // 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." ".$posix." ".$enviro." ".$maila." ".$fonac." ".$faxac." ".$samba." ".$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: ".@LDAP::fix($val['dn'])."'"); + $field3 = array("string" => $usrimg2." ".$posix." ".$enviro." ".$maila." ".$fonac." ".$faxac." ".$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: ?> diff --git a/plugins/admin/users/main.inc b/plugins/admin/users/main.inc index db1e9e4a3..38276c9b2 100644 --- a/plugins/admin/users/main.inc +++ b/plugins/admin/users/main.inc @@ -40,7 +40,7 @@ if ($remove_lock){ _("User administration"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + "\"> ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/user.png'), _("User administration")); diff --git a/plugins/admin/users/template.tpl b/plugins/admin/users/template.tpl index 065914bd2..64cbe5475 100644 --- a/plugins/admin/users/template.tpl +++ b/plugins/admin/users/template.tpl @@ -3,9 +3,13 @@

- {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}

+

 

+ +
+ diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index 7bc7dc193..0a713a327 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -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: ".@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]; } } diff --git a/plugins/gofax/blocklists/generic.tpl b/plugins/gofax/blocklists/generic.tpl index a1c60b371..d34a84df2 100644 --- a/plugins/gofax/blocklists/generic.tpl +++ b/plugins/gofax/blocklists/generic.tpl @@ -77,7 +77,7 @@

- +  

diff --git a/plugins/gofax/blocklists/main.inc b/plugins/gofax/blocklists/main.inc index 24d1b8999..7202169d3 100644 --- a/plugins/gofax/blocklists/main.inc +++ b/plugins/gofax/blocklists/main.inc @@ -17,7 +17,7 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "\"\"align=\"middle\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "\"\"align=\"middle\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management")); } diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index 1f7080bb8..961dc6dcd 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -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]]= diff --git a/plugins/gofax/faxaccount/main.inc b/plugins/gofax/faxaccount/main.inc index 3ed1eaf7e..24e0550b0 100644 --- a/plugins/gofax/faxaccount/main.inc +++ b/plugins/gofax/faxaccount/main.inc @@ -86,7 +86,7 @@ if (!$remove_lock){ /* Are we in edit mode? */ if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $info= " ".$ui->dn." "; diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index dafcf2323..2dd80d88d 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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]; } } } diff --git a/plugins/gofon/conference/main.inc b/plugins/gofon/conference/main.inc index 2fe8ade4f..04ab46f78 100644 --- a/plugins/gofon/conference/main.inc +++ b/plugins/gofon/conference/main.inc @@ -35,7 +35,7 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/conference.png'), _("Conference management")); } diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc index 6ea4e3649..131ae83c6 100755 --- a/plugins/gofon/macro/class_gofonMacroManagement.inc +++ b/plugins/gofon/macro/class_gofonMacroManagement.inc @@ -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.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; @@ -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: ".@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]; } } diff --git a/plugins/gofon/macro/main.inc b/plugins/gofon/macro/main.inc index ba3307e72..a5d88b776 100755 --- a/plugins/gofon/macro/main.inc +++ b/plugins/gofon/macro/main.inc @@ -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"), "\"\" ".@ldap::fix($_SESSION['objectinfo'])); + $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"), "\"\" ".@LDAP::fix($_SESSION['objectinfo'])); } else { $display= print_header(get_template_path('images/macros.png'), _("Phone macro management")); } diff --git a/plugins/gofon/phoneaccount/main.inc b/plugins/gofon/phoneaccount/main.inc index cc27bee55..c81fbea4c 100644 --- a/plugins/gofon/phoneaccount/main.inc +++ b/plugins/gofon/phoneaccount/main.inc @@ -102,7 +102,7 @@ if (!$remove_lock){ /* Are we in edit mode? */ if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $info= "\"\" ".$ui->dn." "; diff --git a/plugins/personal/connectivity/main.inc b/plugins/personal/connectivity/main.inc index e6cbf0e0b..644bd9839 100644 --- a/plugins/personal/connectivity/main.inc +++ b/plugins/personal/connectivity/main.inc @@ -115,7 +115,7 @@ if (!$remove_lock){ if ($in_edit_mode){ $display.="
"; if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $info= "\"\"
diff --git a/plugins/personal/environment/hotplugDialogNew.tpl b/plugins/personal/environment/hotplugDialogNew.tpl index 4c3f6fca1..040f87dc6 100644 --- a/plugins/personal/environment/hotplugDialogNew.tpl +++ b/plugins/personal/environment/hotplugDialogNew.tpl @@ -35,7 +35,7 @@
+
- +

 

- +