phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi inc/class.Template.inc.php inc/class.a...


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi inc/class.Template.inc.php inc/class.a...
Date: Sun, 06 Aug 2006 04:51:26 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/08/06 04:51:26

Modified files:
        inc            : class.Template.inc.php class.acl.inc.php 
                         class.applications.inc.php 
                         class.asyncservice.inc.php class.common.inc.php 
                         class.contacts.inc.php 
                         class.contacts_sql.inc.php class.crypto.inc.php 
                         class.javascript.inc.php 
                         class.object_factory.inc.php 
                         class.preferences.inc.php 
                         class.sessions.inc.php 
                         class.sessions_php4.inc.php class.sql.inc.php 
                         class.sql_builder.inc.php 
                         class.sql_entity.inc.php 
                         class.translation_sql.inc.php 
                         class.xmltool.inc.php 
                         class.xslttemplates.inc.php 
                         common_functions.inc.php footer.inc.php 
                         functions.inc.php 
        inc/accounts   : class.accounts_.inc.php 
                         class.accounts_ldap.inc.php 
                         class.accounts_sql.inc.php 
        templates/idots: css.tpl head.inc.php head.tpl navbar.inc.php 

Log message:
        E_NOTICES, cleanups, general housekeeping as we move to stablize HEAD 
for 18

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.Template.inc.php?cvsroot=phpgwapi&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.acl.inc.php?cvsroot=phpgwapi&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.applications.inc.php?cvsroot=phpgwapi&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.asyncservice.inc.php?cvsroot=phpgwapi&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.common.inc.php?cvsroot=phpgwapi&r1=1.235&r2=1.236
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.contacts.inc.php?cvsroot=phpgwapi&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.contacts_sql.inc.php?cvsroot=phpgwapi&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.crypto.inc.php?cvsroot=phpgwapi&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.javascript.inc.php?cvsroot=phpgwapi&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.object_factory.inc.php?cvsroot=phpgwapi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.preferences.inc.php?cvsroot=phpgwapi&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sessions.inc.php?cvsroot=phpgwapi&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sessions_php4.inc.php?cvsroot=phpgwapi&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sql.inc.php?cvsroot=phpgwapi&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sql_builder.inc.php?cvsroot=phpgwapi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sql_entity.inc.php?cvsroot=phpgwapi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.translation_sql.inc.php?cvsroot=phpgwapi&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.xmltool.inc.php?cvsroot=phpgwapi&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.xslttemplates.inc.php?cvsroot=phpgwapi&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/common_functions.inc.php?cvsroot=phpgwapi&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/footer.inc.php?cvsroot=phpgwapi&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/functions.inc.php?cvsroot=phpgwapi&r1=1.192&r2=1.193
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_.inc.php?cvsroot=phpgwapi&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_ldap.inc.php?cvsroot=phpgwapi&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_sql.inc.php?cvsroot=phpgwapi&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/idots/css.tpl?cvsroot=phpgwapi&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/idots/head.inc.php?cvsroot=phpgwapi&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/idots/head.tpl?cvsroot=phpgwapi&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/idots/navbar.inc.php?cvsroot=phpgwapi&r1=1.11&r2=1.12

Patches:
Index: inc/class.Template.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.Template.inc.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- inc/class.Template.inc.php  28 Jul 2006 14:20:48 -0000      1.40
+++ inc/class.Template.inc.php  6 Aug 2006 04:51:25 -0000       1.41
@@ -8,7 +8,7 @@
  * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General Public 
License
  * @package phpgwapi
  * @subpackage gui
- * @version $Id: class.Template.inc.php,v 1.40 2006/07/28 14:20:48 skwashd Exp 
$
+ * @version $Id: class.Template.inc.php,v 1.41 2006/08/06 04:51:25 skwashd Exp 
$
  * @internal Based on phplib
  *
  */
@@ -70,6 +70,7 @@
         * @access    public
         */
        var $unknown_regexp = "strict";
+       //var $unknown_regexp = "loose";
 
        /**
         * The base directory from which template files are loaded.
@@ -195,7 +196,7 @@
                }
                elseif ( !is_dir($root) )
                {
-                       $this->set_root($new_root = substr($root, 0, (0 - 
strlen($GLOBALS['phpgw_info']['server']['template_set']))) . 'base', 2);
+                       $this->set_root(substr($root, 0, (0 - 
strlen($GLOBALS['phpgw_info']['server']['template_set']))) . 'base', 1);
                }
 
                $this->root = $root;
@@ -840,7 +841,7 @@
         * @return    string
         * @see       set_root
         */
-       function filename($filename, $root='', $attemp = 0)
+       function filename($filename, $root='', $attempt = 0)
        {
                if($root=='')
                {
@@ -864,7 +865,7 @@
                        else
                        {
                                $new_root = substr($root, 0, (0 - 
strlen($GLOBALS['phpgw_info']['server']['template_set']))) . 'base';
-                               $new_filename = 
$this->filename(str_replace($root.'/','',$new_filename),$new_root,2);
+                               $new_filename = 
$this->filename(str_replace($root.'/','',$new_filename), $new_root, 1);
                        }
                }
                return $new_filename;

Index: inc/class.acl.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.acl.inc.php,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- inc/class.acl.inc.php       20 Jul 2006 04:38:11 -0000      1.81
+++ inc/class.acl.inc.php       6 Aug 2006 04:51:25 -0000       1.82
@@ -6,7 +6,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.acl.inc.php,v 1.81 2006/07/20 04:38:11 skwashd 
Exp $
+       * @version $Id: class.acl.inc.php,v 1.82 2006/08/06 04:51:25 skwashd 
Exp $
        */
 
        /**
@@ -62,7 +62,7 @@
                        
                        if (!($this->account_id = intval($account_id)))
                        {
-                               $this->account_id = get_account_id($account_id, 
(int)$GLOBALS['phpgw_info']['user']['account_id']);
+                               $this->account_id = get_account_id($account_id);
                        }
                }
 
@@ -435,10 +435,10 @@
                */
                function check($location, $required, $appname = False)
                {
-                       $rights = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=0,$account_type);
-                       $mask = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=1,$account_type);
+                       $rights = $this->check_brutto($location, $required, 
$appname, false, $type=0);
+                       $mask = $this->check_brutto($location, $required, 
$appname, false, $type=1);
                        
-                       if($mask > 0 && $rights > 0)
+                       if ( $mask > 0 && $rights > 0 )
                        {
                                unset($rights);
                        }
@@ -1008,6 +1008,10 @@
                                {
                                        foreach ( $groups as $key => $value )
                                        {
+                                                       if ( !$value )
+                                                       {
+                                                               continue;
+                                                       }
                                                        $account_list[] = 
$value;
                                        }
                                }

Index: inc/class.applications.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.applications.inc.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- inc/class.applications.inc.php      8 Jul 2006 06:51:27 -0000       1.54
+++ inc/class.applications.inc.php      6 Aug 2006 04:51:25 -0000       1.55
@@ -7,7 +7,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.applications.inc.php,v 1.54 2006/07/08 06:51:27 
skwashd Exp $
+       * @version $Id: class.applications.inc.php,v 1.55 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -250,7 +250,7 @@
                        }
                        $app_list = 
$GLOBALS['phpgw']->acl->get_app_list_for_id('run', 1, $this->account_id);
 
-                       if ( !count($app_list) )
+                       if ( !is_array($app_list) || !count($app_list) )
                        {
                                return $this->data;
                        }

Index: inc/class.asyncservice.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.asyncservice.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.asyncservice.inc.php      30 Dec 2004 06:47:30 -0000      1.7
+++ inc/class.asyncservice.inc.php      6 Aug 2006 04:51:25 -0000       1.8
@@ -6,7 +6,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.asyncservice.inc.php,v 1.7 2004/12/30 06:47:30 
skwashd Exp $
+       * @version $Id: class.asyncservice.inc.php,v 1.8 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -315,7 +315,7 @@
                                $this->db->lock($this->db_table,'write');       
// this will block til we get exclusive access to the table
 
                                @set_time_limit(0);             // dont stop 
for an execution-time-limit
-                               ignore_user_abort(True);
+                               ignore_user_abort(true);
                        }
                        if ($exists = $this->read('##last-check-run##'))
                        {
@@ -334,7 +334,7 @@
                                $this->db->unlock();    // unlock the table 
again
 
                                //echo "<p>An other instance is running 
!!!</p>\n";
-                               return False;
+                               return false;
                        }
                        // no other instance runs ==> we should run
                        //
@@ -346,10 +346,12 @@
                        {
                                $last_run = array(
                                        'id'     => '##last-check-run##',
+                                       'account_id'=> 0,
                                        'next'   => 0,
                                        'times'  => array(),
                                        'method' => 'none',
-                                       'data'   => array(
+                                       'data'          => array
+                                       (
                                                'run_by'=> $run_by,
                                                'start' => time(),
                                                'end'   => 0
@@ -357,9 +359,9 @@
                                );
                        }
                        //echo "last_run=<pre>"; print_r($last_run); echo 
"</pre>\n";
-                       $this->write($last_run,!!$exits);
+                       $this->write($last_run, true);
                        $this->db->unlock();
-                       return True;
+                       return true;
                }
 
                /**

Index: inc/class.common.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.common.inc.php,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -b -r1.235 -r1.236
--- inc/class.common.inc.php    9 Jul 2006 11:46:11 -0000       1.235
+++ inc/class.common.inc.php    6 Aug 2006 04:51:25 -0000       1.236
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: class.common.inc.php,v 1.235 2006/07/09 11:46:11 
skwashd Exp $
+       * @version $Id: class.common.inc.php,v 1.236 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -274,7 +274,7 @@
 
                                // call the asyncservice check_run function if 
it is not explicitly set to cron-only
                                //
-                               if 
(!$GLOBALS['phpgw_info']['server']['asyncservice'])  // is default
+                               if 
(!isset($GLOBALS['phpgw_info']['server']['asyncservice']) || 
!$GLOBALS['phpgw_info']['server']['asyncservice'] )
                                {
                                        
ExecMethod('phpgwapi.asyncservice.check_run','fallback');
                                }
@@ -378,9 +378,9 @@
                {
                        if (! $lid && ! $firstname && ! $lastname)
                        {
-                               $lid       = 
$GLOBALS['phpgw_info']['user']['account_lid'];
-                               $firstname = 
$GLOBALS['phpgw_info']['user']['firstname'];
-                               $lastname  = 
$GLOBALS['phpgw_info']['user']['lastname'];
+                               $lid       = 
isset($GLOBALS['phpgw_info']['user']['account_lid'])       ? 
$GLOBALS['phpgw_info']['user']['account_lid'] : '';
+                               $firstname = 
isset($GLOBALS['phpgw_info']['user']['firstname'])         ? 
$GLOBALS['phpgw_info']['user']['firstname']   : '';
+                               $lastname  = 
isset($GLOBALS['phpgw_info']['user']['lastname'])          ? 
$GLOBALS['phpgw_info']['user']['lastname']    : '';
                        }
 
                        $display = 'firstname';
@@ -1148,39 +1148,34 @@
                function get_css()
                {
                        $all_css = '';
-                       if(@is_object($GLOBALS['phpgw']->css))
+                       if( isset($GLOBALS['phpgw']->css) && 
is_object($GLOBALS['phpgw']->css) )
                        {
                                $all_css .= 
$GLOBALS['phpgw']->css->get_css_links();
                        }
 
-                       if (isset($GLOBALS['phpgw_info']['flags']['css_link']))
+                       if ( isset($GLOBALS['phpgw_info']['flags']['css_link']) 
)
                {
                        $all_css .= $GLOBALS['phpgw_info']['flags']['css_link'] 
. "\n";
                }
 
+                       //FIXME drop app_css, use the new css stuff
                        $app_css = '';
-                       if(@isset($GLOBALS['phpgw_info']['menuaction']))
+                       if ( isset($GLOBALS['phpgw_info']['menuaction']) )
                    {
                        list($app,$class,$method) = 
explode('.',$GLOBALS['phpgw_info']['menuaction']);
                        if(is_array($GLOBALS[$class]->public_functions) 
-                               && $GLOBALS[$class]->public_functions['css'])
+                               && 
isset($GLOBALS[$class]->public_functions['css']) )
                        {
                                $app_css .= $GLOBALS[$class]->css();
                        }
                }
 
-                       if (isset($GLOBALS['phpgw_info']['flags']['css']))
+                       if ( isset($GLOBALS['phpgw_info']['flags']['css']) )
                {
                        $app_css .= $GLOBALS['phpgw_info']['flags']['css'] . 
"\n";
                }
 
-            $tpl = CreateObject('phpgwapi.Template', 
$this->get_tpl_dir('phpgwapi'));
-            $all_css .= $tpl->set_file('css', 'css.tpl');
-
-            $all_css .= $tpl->set_var('app_css', $app_css);
-                       $all_css .= 
$tpl->set_var($GLOBALS['phpgw_info']['theme']);
-                       $all_css .= $tpl->subst('css');
-
+            $all_css .= "\n<!-- NOTE: This will not be supported in the future 
-->\n\t\t<style type=\"text/css\">\n\t\t{$app_css}\n\t\t</style>\n";
                        return $all_css;
                }
 
@@ -1205,27 +1200,28 @@
                */
                function get_javascript()
                {
-                       $java_script = '';
-                       if(@is_object($GLOBALS['phpgw']->js))
+                       $js = '';
+                       if( isset($GLOBALS['phpgw']->js) && 
is_object($GLOBALS['phpgw']->js))
                        {
-                               $java_script .= 
$GLOBALS['phpgw']->js->get_script_links();
+                               $js .= 
$GLOBALS['phpgw']->js->get_script_links();
                        }
                        
-                       if(@isset($GLOBALS['phpgw_info']['menuaction']))
+               if ( isset($GLOBALS['phpgw_info']['menuaction']) )
                        {
-                               list($app,$class,$method) = 
explode('.',$GLOBALS['phpgw_info']['menuaction']);
-                               if(is_array($GLOBALS[$class]->public_functions) 
-                                       && 
$GLOBALS[$class]->public_functions['java_script'])
+                       list($app, $class, $method) = 
explode('.',$GLOBALS['phpgw_info']['menuaction']);
+                               if ( 
is_array($GLOBALS[$class]->public_functions) 
+                                       && 
isset($GLOBALS[$class]->public_functions['java_script'])
+                                       && 
$GLOBALS[$class]->public_functions['java_script'] )
                                {
-                                       $java_script .= 
$GLOBALS[$class]->java_script();
+                                       $js .= $GLOBALS[$class]->java_script();
                                }
                        }
-                       //you never know - best to protect the stupid ;)
+                       
                        if 
(isset($GLOBALS['phpgw_info']['flags']['java_script']))
                        {
-                               $java_script .= 
$GLOBALS['phpgw_info']['flags']['java_script'] . "\n";
+                               $js .= 
$GLOBALS['phpgw_info']['flags']['java_script'] . "\n";
                        }
-                       return $java_script;
+                       return $js;
                }
                
                                /**

Index: inc/class.contacts.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.contacts.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- inc/class.contacts.inc.php  30 Dec 2004 06:47:30 -0000      1.15
+++ inc/class.contacts.inc.php  6 Aug 2006 04:51:25 -0000       1.16
@@ -7,7 +7,7 @@
        * @subpackage contacts
        */
 
-        print_debug('Contact 
Repository:',"'".$GLOBALS['phpgw_info']['server']['contact_repository']."'",'api');
 
+       //print_debug('Contact 
Repository:',"'".$GLOBALS['phpgw_info']['server']['contact_repository']."'",'api');
 
        /**
        * Include SQL handler
        */

Index: inc/class.contacts_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- inc/class.contacts_sql.inc.php      19 Jul 2006 01:40:11 -0000      1.26
+++ inc/class.contacts_sql.inc.php      6 Aug 2006 04:51:25 -0000       1.27
@@ -6,27 +6,47 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage contacts
-       * @version $Id: class.contacts_sql.inc.php,v 1.26 2006/07/19 01:40:11 
skwashd Exp $
+       * @version $Id: class.contacts_sql.inc.php,v 1.27 2006/08/06 04:51:25 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        */
 
        /**
        * Include SQL Builder
+       * @see sql_builder
        */
        include_once(PHPGW_API_INC . '/class.sql_builder.inc.php');
+       
        /**
        * Include SQL criteria
+       * @see sql_criteria
        */
        include_once(PHPGW_API_INC . '/class.sql_criteria.inc.php');
+       
        /**
        * Include SQL entity
+       * @see sql_entity
        */
        include_once(PHPGW_API_INC . '/class.sql_entity.inc.php');
 
-       define(PHPGW_CONTACTS_CATEGORIES_ALL, -3);
-       define(PHPGW_CONTACTS_ALL, 1);
-       define(PHPGW_CONTACTS_MINE, 2);
-       define(PHPGW_CONTACTS_PRIVATE, 3);
+       /**
+       * All categories
+       */
+       define('PHPGW_CONTACTS_CATEGORIES_ALL', -3);
+       
+       /**
+       * All records
+       */
+       define('PHPGW_CONTACTS_ALL', 1);
+       
+       /**
+       * Only current user's records
+       */
+       define('PHPGW_CONTACTS_MINE', 2);
+       
+       /**
+       * Only current user's private records
+       */
+       define('PHPGW_CONTACTS_PRIVATE', 3);
 
        /**
        * Contact Management System
@@ -590,7 +610,8 @@
                                $this->save_sessiondata();
                        }
 
-                       if 
($GLOBALS['phpgw_info']['server']['contact_repository'] == 'ldap')
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['contact_repository'])
+                               && 
$GLOBALS['phpgw_info']['server']['contact_repository'] == 'ldap')
                        {
                                $this->LDAPSyncEnabled = true;
                                $this->LDAPResource = 
$GLOBALS['phpgw']->common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_contact_host'],
 $GLOBALS['phpgw_info']['server']['ldap_contact_dn'], 
$GLOBALS['phpgw_info']['server']['ldap_contact_pw']);
@@ -606,7 +627,13 @@
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi');
 
-                       if ($data['comm_descr_flag']=='cache')
+                       if (!is_array($data) )
+                       {
+                               $data = array();
+                       }
+
+                       if ( isset($data['comm_descr_flag'])
+                               && $data['comm_descr_flag'] == 'cache' )
                        {
                                $this->comm_descr = $data['comm_descr'];
                                $this->comm_descr_flag = 'cache';
@@ -617,7 +644,8 @@
                                $this->comm_descr_flag = 'cache';
                        }
 
-                       if ($data['comm_type_flag']=='cache')
+                       if ( isset($data['comm_type_flag'])
+                               && $data['comm_type_flag'] == 'cache' )
                        {
                                $this->comm_type = $data['comm_type'];
                                $this->comm_type_flag = 'cache';
@@ -628,7 +656,8 @@
                                $this->comm_type_flag = 'cache';
                        }
 
-                       if ($data['addr_type_flag']=='cache')
+                       if ( isset($data['addr_type_flag'])
+                               && $data['addr_type_flag'] == 'cache' )
                        {
                                $this->addr_type = $data['addr_type'];
                                $this->addr_type_flag = 'cache';
@@ -639,7 +668,8 @@
                                $this->addr_type_flag = 'cache';
                        }
 
-                       if ($data['note_type_flag']=='cache')
+                       if ( isset($data['note_type_flag'])
+                               && $data['note_type_flag'] == 'cache' )
                        {
                                $this->note_type = $data['note_type'];
                                $this->note_type_flag = 'cache';
@@ -650,7 +680,8 @@
                                $this->note_type_flag = 'cache';
                        }
 
-                       if ($data['contact_type_flag']=='cache')
+                       if ( isset($data['contact_type_flag'] )
+                               && $data['contact_type_flag'] == 'cache' )
                        {
                                $this->contact_type = $data['contact_type'];
                                $this->contact_type_flag = 'cache';
@@ -671,7 +702,8 @@
                */
                function save_sessiondata()
                {
-                       $data = array(
+                       $data = array
+                       (
                                'comm_descr'=> $this->comm_descr,
                                'comm_type' => $this->comm_type,
                                'addr_type' => $this->addr_type,
@@ -2879,13 +2911,14 @@
                * @return array|string Array with records or string with sql 
query
                * @access private
                */
-               function get_query($action=PHPGW_SQL_RUN_SQL, $line=__LINE__, 
$file=__FILE__)
+               function get_query($action = PHPGW_SQL_RUN_SQL, $line = 
__LINE__, $file = __FILE__)
                {
                        switch($action)
                        {
-                       case RETURN_RECORDS:
+                               case PHPGW_SQL_RETURN_RECORDS:
                        case PHPGW_SQL_RUN_SQL:
                                return $this->get_records($line, $file);
+
                        case PHPGW_SQL_RETURN_SQL:
                                return $this->get_sql();
                        }

Index: inc/class.crypto.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.crypto.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.crypto.inc.php    30 Dec 2004 11:10:47 -0000      1.23
+++ inc/class.crypto.inc.php    6 Aug 2006 04:51:25 -0000       1.24
@@ -6,7 +6,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage network
-       * @version $Id: class.crypto.inc.php,v 1.23 2004/12/30 11:10:47 skwashd 
Exp $
+       * @version $Id: class.crypto.inc.php,v 1.24 2006/08/06 04:51:25 skwashd 
Exp $
        */
 
        /**
@@ -17,13 +17,12 @@
        */
        class crypto
        {
-               var $enabled = False;
-               var $debug = False;
+               var $enabled = false;
+               var $debug = false;
 
-               var $mcrypt_version = '';
-               var $algo = MCRYPT_TRIPLEDES;
-               var $mode = MCRYPT_MODE_CBC;
-               var $td = False; /* Handle for mcrypt */
+               var $algo;
+               var $mode;
+               var $td; /* Handle for mcrypt */
                var $iv = '';
                var $key = '';
 
@@ -44,6 +43,9 @@
 
                        if ($GLOBALS['phpgw_info']['server']['mcrypt_enabled'] 
&& extension_loaded('mcrypt'))
                        {
+                               $this->algo = MCRYPT_TRIPLEDES;
+                               $this->mode = MCRYPT_MODE_CBC;
+
                                
if($GLOBALS['phpgw_info']['server']['mcrypt_algo'])
                                {
                                        $this->algo = 
$GLOBALS['phpgw_info']['server']['mcrypt_algo'];
@@ -60,29 +62,11 @@
                                }
 
                                $this->enabled = True;
-                               $this->mcrypt_version = 
$GLOBALS['phpgw_info']['server']['versions']['mcrypt'];
-                               if ($this->mcrypt_version == 'old')
-                               {
-                                       $this->td = False;
-                                       if (phpversion() > '4.0.2pl1')
-                                       {
-                                               $keysize = 
mcrypt_get_key_size($this->algo);
-                                               $ivsize  = 
mcrypt_get_iv_size($this->algo,$this->mode);
-                                       }
-                                       else
-                                       {
-                                               $keysize = 8;
-                                               $ivsize  = 8;
-                                       }
-                               }
-                               else
-                               {
                                        /* Start up mcrypt */
                                        $this->td = mcrypt_module_open 
($this->algo, '', $this->mode, '');
 
                                        $ivsize  = 
mcrypt_enc_get_iv_size($this->td);
                                        $keysize = 
mcrypt_enc_get_key_size($this->td);
-                               }
 
                                /* Hack IV to be the correct size */
                                $x = strlen($iv);
@@ -106,12 +90,9 @@
                {
                        if ($this->enabled)
                        {
-                               if ($this->mcrypt_version != 'old')
-                               {
                                        mcrypt_generic_deinit($this->td);
                                }
                        }
-               }
 
                function hex2bin($data)
                {
@@ -160,19 +141,11 @@
                                        echo '<br>' . time() . ' 
crypto->encrypt() data: ---->>>>' . $data;
                                }
 
-                               switch ($this->mcrypt_version)
-                               {
-                                       case 'old':
-                                               /* The old code, only works 
with mcrypt <= 2.2.x */
-                                               $encrypteddata = 
mcrypt_cbc($this->algo, $this->key, $data, MCRYPT_ENCRYPT);
-                                               break;
-                                       default:
-                                               /* Handle 2.4 and newer API */
                                                mcrypt_generic_init ($this->td, 
$this->key, $this->iv);
+                               
                                                $encrypteddata = 
mcrypt_generic($this->td, $data);
-                                               break;
-                               }
                                $encrypteddata = bin2hex($encrypteddata);
+                               
                                if($this->debug)
                                {
                                        echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $encrypteddata;
@@ -200,18 +173,8 @@
                        if ($this->enabled)
                        {
                                $data = $this->hex2bin($encrypteddata);
-                               switch ($this->mcrypt_version)
-                               {
-                                       case 'old':
-                                               /* The old code, only works 
with mcrypt <= 2.2.x */
-                                               $data = mcrypt_cbc($this->algo, 
$this->key, $data, MCRYPT_DECRYPT);
-                                               break;
-                                       default:
-                                               /* Handle 2.4 and newer API */
                                                mcrypt_generic_init ($this->td, 
$this->key, $this->iv);
                                                $data = 
mdecrypt_generic($this->td, $data);
-                                               break;
-                               }
 
                                if($this->debug)
                                {

Index: inc/class.javascript.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.javascript.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- inc/class.javascript.inc.php        27 Mar 2006 13:38:10 -0000      1.6
+++ inc/class.javascript.inc.php        6 Aug 2006 04:51:25 -0000       1.7
@@ -6,7 +6,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage gui
-       * @version $Id: class.javascript.inc.php,v 1.6 2006/03/27 13:38:10 
skwashd Exp $
+       * @version $Id: class.javascript.inc.php,v 1.7 2006/08/06 04:51:25 
skwashd Exp $
        * @link http://docs.phpgroupware.org/wiki/classJavaScript
        */
 
@@ -45,7 +45,7 @@
                /**
                * @var array list of validated files to be included in the head 
section of a page
                */
-               var $files;
+               var $files = array();
 
                /**
                * @var object used for holding an instance of the Template class
@@ -109,19 +109,20 @@
                function get_script_links()
                {
                        $links = '';
-                       if(!empty($this->files) && is_array($this->files))
+                       if( is_array($this->files) && count($this->files) )
                        {
                                $links = "<!--JS Imports from phpGW javascript 
class -->\n";
                                foreach($this->files as $app => $packages)
                                {
-                                       if(!empty($packages) && 
is_array($packages))
+                                       if( is_array($packages) && 
count($packages) )
                                        {
                                                foreach($packages as $pkg => 
$files)
                                                {
-                                                       if(!empty($files) && 
is_array($files))
+                                                       if( is_array($files) && 
count($files) )
                                                        {
                                                                foreach($files 
as $file => $ignored)
                                                                {
+                                                                       //echo 
"file: 
{$GLOBALS['phpgw_info']['server']['webserver_url']}/{$app}/js/{$pkg}/{$file}.js 
<br>";
                                                                        $links 
.= '<script type="text/javascript" '
                                                                        . 
"src=\"{$GLOBALS['phpgw_info']['server']['webserver_url']}/{$app}/js/{$pkg}/{$file}.js\">"
                                                                        . 
"</script>\n";
@@ -150,7 +151,7 @@
                */
                function get_win_on_events()
                {
-                       $ret_str = "\n//<![CDATA[\n// start phpGW javascript 
class imported window.on* event handlers\n";
+                       $ret_str = "\n// start phpGW javascript class imported 
window.on* event handlers\n";
                        foreach ( $this->win_events as $win_event => $actions )
                        {
                                if ( is_array($actions) && count($actions) )
@@ -163,7 +164,7 @@
                                        $ret_str .= "}\n";
                                }
                        }
-                       $ret_str .= "\n// end phpGW javascript class imported 
window.on* event handlers\n//]]>\n\n";
+                       $ret_str .= "\n// end phpGW javascript class imported 
window.on* event handlers\n\n";
                        return $ret_str;
                }
 

Index: inc/class.object_factory.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.object_factory.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- inc/class.object_factory.inc.php    8 Apr 2005 08:54:59 -0000       1.1
+++ inc/class.object_factory.inc.php    6 Aug 2006 04:51:25 -0000       1.2
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.object_factory.inc.php,v 1.1 2005/04/08 08:54:59 
fipsfuchs Exp $
+       * @version $Id: class.object_factory.inc.php,v 1.2 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -44,7 +44,7 @@
                {
                        global $phpgw_info, $phpgw;
        
-                       if (is_object(@$GLOBALS['phpgw']->log) && $class != 
'phpgwapi.error' && $class != 'phpgwapi.errorlog')
+                       if ( isset($GLOBALS['phpgw']->log) && 
is_object($GLOBALS['phpgw']->log) && $class != 'phpgwapi.error' && $class != 
'phpgwapi.errorlog')
                        {
                                
//$GLOBALS['phpgw']->log->write(array('text'=>'D-Debug, dbg: %1','p1'=>'This 
class was run: '.$class,'file'=>__FILE__,'line'=>__LINE__));
                        }

Index: inc/class.preferences.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.preferences.inc.php,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- inc/class.preferences.inc.php       14 Feb 2006 10:01:05 -0000      1.59
+++ inc/class.preferences.inc.php       6 Aug 2006 04:51:25 -0000       1.60
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.preferences.inc.php,v 1.59 2006/02/14 10:01:05 
skwashd Exp $
+       * @version $Id: class.preferences.inc.php,v 1.60 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -29,6 +29,12 @@
                var $account_type;
                /*! @var data effectiv user prefs, used by all apps */
                var $data = array();
+               
+               /**
+               * @var bool $debug are we running in debug mode
+               */
+               var $debug = false;
+               
                /*! @var user set user prefs for saveing (no defaults/forced 
prefs merged) */
                var $user = array();
                /*! @var default default prefs */
@@ -117,12 +123,14 @@
                */
                function standard_substitutes()
                {
-                       if ( 
isset($GLOBALS['phpgw_info']['server']['mail_suffix']) )
+                       if ( 
!isset($GLOBALS['phpgw_info']['server']['mail_suffix'])
+                               || 
!$GLOBALS['phpgw_info']['server']['mail_suffix'] )
                        {
                                $GLOBALS['phpgw_info']['server']['mail_suffix'] 
= $_SERVER['HTTP_HOST'];
                        }
                        
-                       if 
(!is_array($GLOBALS['phpgw_info']['user']['preferences']))
+                       if ( 
!isset($GLOBALS['phpgw_info']['user']['preferences'])
+                               || 
!is_array($GLOBALS['phpgw_info']['user']['preferences']) )
                        {
                                $GLOBALS['phpgw_info']['user']['preferences'] = 
$this->data;    // else no lang()
                        }
@@ -814,7 +822,7 @@
                */
                function email_address($account_id='')
                {
-                       if ($this->data['email']['address'])
+                       if ( isset($this->data['email']['address']) )
                        {
                                return $this->data['email']['address'];
                        }

Index: inc/class.sessions.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sessions.inc.php,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- inc/class.sessions.inc.php  30 May 2006 05:50:12 -0000      1.112
+++ inc/class.sessions.inc.php  6 Aug 2006 04:51:25 -0000       1.113
@@ -10,7 +10,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.sessions.inc.php,v 1.112 2006/05/30 05:50:12 
skwashd Exp $
+       * @version $Id: class.sessions.inc.php,v 1.113 2006/08/06 04:51:25 
skwashd Exp $
        * @link http://www.sanisoft.com/phplib/manual/DB_sql.php
        */
 
@@ -256,9 +256,10 @@
                        $this->kp3       = $kp3;
                        
                        $session = $this->read_session($sessionid);
-                       //echo "<p>session::verify(id='$sessionid'): \n"; 
print_r($session); echo "</p>\n";
+                       //echo "<pre>session::verify(id='$sessionid'): \n" . 
print_r($session, true) . "</pre>\n";
                        
-                       if ($session['session_dla'] <= (time() - 
$GLOBALS['phpgw_info']['server']['sessions_timeout']))
+                       if ( !isset($session['session_dla']) 
+                               || $session['session_dla'] <= (time() - 
$GLOBALS['phpgw_info']['server']['sessions_timeout']))
                        {
                                $this->clean_sessions();
                                return False;
@@ -266,12 +267,18 @@
 
                        $this->session_flags = $session['session_flags'];
 
-                       list($this->account_lid,$this->account_domain) = 
explode('@', $session['session_lid']);
+                       $lid_data = explode('@', $session['session_lid']);
+                       $this->account_lid = $lid_data[0];
 
-                       if ($this->account_domain == '')
+                       if ( isset($lid_data[1]) )
+                       {
+                               $this->account_domain = $lid_data[1];
+                       }
+                       else
                        {
                                $this->account_domain = 
$GLOBALS['phpgw_info']['server']['default_domain'];
                        }
+                       unset($lid_data);
 
                        $GLOBALS['phpgw_info']['user']['kp3'] = $this->kp3;
 
@@ -279,7 +286,7 @@
                        $this->account_id = 
$GLOBALS['phpgw']->accounts->name2id($this->account_lid);
                        if (!$this->account_id)
                        {
-                               return False;
+                               return false;
                        }
 
                        $GLOBALS['phpgw_info']['user']['account_id'] = 
$this->account_id;

Index: inc/class.sessions_php4.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sessions_php4.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.sessions_php4.inc.php     26 Apr 2005 10:55:25 -0000      1.23
+++ inc/class.sessions_php4.inc.php     6 Aug 2006 04:51:25 -0000       1.24
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.sessions_php4.inc.php,v 1.23 2005/04/26 10:55:25 
powerstat Exp $
+       * @version $Id: class.sessions_php4.inc.php,v 1.24 2006/08/06 04:51:25 
skwashd Exp $
        */
 
        /**
@@ -43,7 +43,12 @@
                                session_id($sessionid);
                        }
                        session_start();
-                       return $GLOBALS['phpgw_session'] = 
$_SESSION['phpgw_session'];
+                       if ( isset($_SESSION['phpgw_session']) && 
is_array($_SESSION['phpgw_session']) )
+                       {
+                               $GLOBALS['phpgw_session'] = 
$_SESSION['phpgw_session'];
+                               return $GLOBALS['phpgw_session'];
+                       }
+                       return array();
                }
 
                function set_cookie_params($domain)
@@ -148,6 +153,9 @@
                        /* This allows the user to put '' as the value. */
                        if ($data == '##NOTHING##')
                        {
+                               
+                               if ( 
isset($GLOBALS['phpgw_session']['phpgw_app_sessions'][$appname][$location]['content'])
 )
+                               {
                                // I added these into seperate steps for easier 
debugging
                                $data = 
$GLOBALS['phpgw_session']['phpgw_app_sessions'][$appname][$location]['content'];
 
@@ -159,6 +167,8 @@
                                        return $data;
                                }
                        }
+                               return '';
+                       }
                        else
                        {
                                $encrypteddata = 
$GLOBALS['phpgw']->crypto->encrypt($data);

Index: inc/class.sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sql.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- inc/class.sql.inc.php       19 Jul 2006 01:40:11 -0000      1.5
+++ inc/class.sql.inc.php       6 Aug 2006 04:51:25 -0000       1.6
@@ -8,12 +8,53 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.sql.inc.php,v 1.5 2006/07/19 01:40:11 skwashd Exp 
$
+       * @version $Id: class.sql.inc.php,v 1.6 2006/08/06 04:51:25 skwashd Exp 
$
        * @internal Development of this application was funded by 
http://www.sogrp.com
        * @link http://www.sogrp.com/
        */
 
-       if (empty($GLOBALS['phpgw_info']['server']['db_type']))
+       /**
+       * SQL entity name
+       */
+       define('PHPGW_SQL_ENTITY_NAME', 0);
+
+       /**
+       * SQL distance
+       */
+       define('PHPGW_SQL_DISTANCE', 1);
+
+       /**
+       * SQL child fields
+       */
+       define('PHPGW_SQL_CHILD_FIELDS', 2);
+
+       /**
+       * SQL change distance
+       */
+       define('PHPGW_SQL_CHANGE_DISTANCE', 3);
+
+       /**
+       * SQL sql lazy key
+       */
+       define('PHPGW_SQL_LAZY_KEY', 1);
+
+       /**
+       * SQL required key
+       */
+       define('PHPGW_SQL_REQUIRED_KEY', 2);
+
+       /**
+       * SQL all match
+       */
+       define('PHPGW_SQL_ALL_MATCH', 1);
+
+       /**
+       * SQL exclusive match
+       */
+       define('PHPGW_SQL_EXCLUSIVE_MATCH', 2);
+
+       if ( !isset($GLOBALS['phpgw_info']['server']['db_type'])
+               || empty($GLOBALS['phpgw_info']['server']['db_type']) )
        {
                $GLOBALS['phpgw_info']['server']['db_type'] = 'mysql';
        }
@@ -48,7 +89,7 @@
                //what now?                             
        }
        
-       include(PHPGW_API_INC.'/'.$file);
+       include(PHPGW_API_INC . "/{$file}");
 
 
        /**

Index: inc/class.sql_builder.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sql_builder.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- inc/class.sql_builder.inc.php       30 Dec 2004 06:47:31 -0000      1.2
+++ inc/class.sql_builder.inc.php       6 Aug 2006 04:51:25 -0000       1.3
@@ -8,46 +8,12 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.sql_builder.inc.php,v 1.2 2004/12/30 06:47:31 
skwashd Exp $
+       * @version $Id: class.sql_builder.inc.php,v 1.3 2006/08/06 04:51:25 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        * @link http://www.sogrp.com/
        */
 
        /**
-       * SQL entity name
-       */
-       define(PHPGW_SQL_ENTITY_NAME, 0);
-       /**
-       * SQL distance
-       */
-       define(PHPGW_SQL_DISTANCE, 1);
-       /**
-       * SQL child fields
-       */
-       define(PHPGW_SQL_CHILD_FIELDS, 2);
-       /**
-       * SQL change distance
-       */
-       define(PHPGW_SQL_CHANGE_DISTANCE, 3);
-       /**
-       * SQL sql lazy key
-       */
-       define(PHPGW_SQL_LAZY_KEY, 1);
-       /**
-       * SQL required key
-       */
-       define(PHPGW_SQL_REQUIRED_KEY, 2);
-       /**
-       * SQL all match
-       */
-       define(PHPGW_SQL_ALL_MATCH, 1);
-       /**
-       * SQL exclusive match
-       */
-       define(PHPGW_SQL_EXCLUSIVE_MATCH, 2);
-
-
-       /**
        * SQL Generator - helps to construct queries statements
        *
        * This class provide common methods to create transaction sql queries.
@@ -1119,14 +1085,16 @@
                */
                function _request($data)
                {
-                       /**
+                       /*
                        * This is the NEW parent/child fields
                        * implementation, I hope this solve my
                        * problems, but this don't remove that exist a
                        * design problem with the n-n relations and
                        * 1-1.
                        */
-                       if (is_array($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) 
&& count($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) > 0)
+                       if ( isset($this->map[$data][PHPGW_SQL_CHILD_FIELDS])
+                               && 
is_array($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) 
+                               && 
count($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) > 0 )
                        {
                                
foreach($this->map[$data][PHPGW_SQL_CHILD_FIELDS] as $child)
                                {
@@ -1145,7 +1113,8 @@
                        {
                                $this->raise_error($data);
                        }
-                       if(intval($this->map[$data][PHPGW_SQL_CHANGE_DISTANCE]) 
!= 0)
+                       if( isset($this->map[$data][PHPGW_SQL_CHANGE_DISTANCE]) 
+                               && (int) 
$this->map[$data][PHPGW_SQL_CHANGE_DISTANCE] != 0)
                        {
                                $this->distance[$ent] = 
$this->map[$data][PHPGW_SQL_CHANGE_DISTANCE];
                        }

Index: inc/class.sql_entity.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sql_entity.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- inc/class.sql_entity.inc.php        26 Apr 2005 10:55:25 -0000      1.3
+++ inc/class.sql_entity.inc.php        6 Aug 2006 04:51:25 -0000       1.4
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.sql_entity.inc.php,v 1.3 2005/04/26 10:55:25 
powerstat Exp $
+       * @version $Id: class.sql_entity.inc.php,v 1.4 2006/08/06 04:51:25 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        * @link http://www.sogrp.com/
        */
@@ -16,43 +16,27 @@
        /**
        * SQL entity alias substitution string EASS
        */
-       define (PHPGW_SQL_EASS, '|%-');
+       define ('PHPGW_SQL_EASS', '|%-');
+
        /**
        * SQL default method
        */
-       define (PHPGW_SQL_DEFAULT_METHOD, -1);
-       /**
-       * SQL lazy key
-       * @ignore
-       */
-       define (PHPGW_SQL_LAZY_KEY, 1);
-       /**
-       * SQL required key
-       * @ignore
-       */
-       define (PHPGW_SQL_REQUIRED_KEY, 2);
-       /**
-       * SQL all match
-       * @ignore
-       */
-       define (PHPGW_SQL_ALL_MATCH, 1);
-       /**
-       * SQL exclusive match
-       * @ignore
-       */
-       define (PHPGW_SQL_EXCLUSIVE_MATCH, 2);
+       define ('PHPGW_SQL_DEFAULT_METHOD', -1);
+
        /**
        * SQL return records
        */
-       define (PHPGW_SQL_RETURN_RECORDS, 1);
+       define ('PHPGW_SQL_RETURN_RECORDS', 1);
+
        /**
        * SQL run SQL
        */
-       define (PHPGW_SQL_RUN_SQL, 1);
+       define ('PHPGW_SQL_RUN_SQL', 1);
+
        /**
        * SQL return SQL
        */
-       define (PHPGW_SQL_RETURN_SQL, 2);
+       define ('PHPGW_SQL_RETURN_SQL', 2);
 
 
        /**
@@ -305,11 +289,14 @@
                function get_select()
                {
                        $this->run_alias();
-                       $select_value = array($this->fields,
+                       $select_value = array
+                       (
+                               $this->fields,
                                              $this->get_identity(),
                                              $this->alias,
-                                             $this->get_criteria());
-                       $this->ldebug('get_select', array('Criteria' => 
$select_value[4]));
+                               $this->get_criteria() // used below for for 
debug
+                       );
+                       $this->ldebug('get_select', array('Criteria' => 
$select_value[3]));
                        return $select_value;
                }
 
@@ -893,20 +880,26 @@
                        default:
                                $this->dont_exist($action);
                        }
-                       $this->ldebug('add_element', array('Element' => 
$element),
-                                     'dump');
+
+                       $this->ldebug('add_element', array('Element' => 
$element), 'dump');
+
+                       $default = '';//add this to stop E_NOTICE output, no 
idea wtf it is meant to be
                        if($method == PHPGW_SQL_DEFAULT_METHOD)
                        {
-                               $this->ldebug('add_element', 
-                                             array('Method_Default DEF' => 
$method_default,
-                                                   'Method DEF' => $default));
+                               $this->ldebug('add_element', array
+                                                                               
        (
+                                                                               
                'Method_Default DEF' => $method_default,
+                                                                               
                'Method DEF' => $default
+                                                                               
        ));
                                $this->$method_default($element);
                        }
                        elseif ($method)
                        {
-                               $this->ldebug('add_element', 
-                                             array('Method_Default' => 
$method_default,
-                                                   'Method' => $default));
+                               $this->ldebug('add_element', array
+                                                                               
        (
+                                                                               
                'Method_Default' => $method_default,
+                                                                               
                'Method' => $default
+                                                                               
        ));
                                $this->$method($element);
                        }
                        else

Index: inc/class.translation_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.translation_sql.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- inc/class.translation_sql.inc.php   16 Jul 2006 14:37:23 -0000      1.24
+++ inc/class.translation_sql.inc.php   6 Aug 2006 04:51:26 -0000       1.25
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.translation_sql.inc.php,v 1.24 2006/07/16 
14:37:23 skwashd Exp $
+       * @version $Id: class.translation_sql.inc.php,v 1.25 2006/08/06 
04:51:26 skwashd Exp $
        */
 
        /**
@@ -25,11 +25,19 @@
        */
        class translation
        {
+               /**
+               * @var string $userLang user's prefered language
+               */
                var $userlang;
                
+               /**
+               * @var bool $loaded_from_shm was the lang data loaded from 
shared memory?
+               */
+               var $loaded_from_shm;
+               
                function translation($reset = '')
                {
-                       if(!is_object($GLOBALS['phpgw']->shm))
+                       if ( !isset($GLOBALS['phpgw']->shm) || 
!is_object($GLOBALS['phpgw']->shm) )
                        {
                                $GLOBALS['phpgw']->shm = 
CreateObject('phpgwapi.shm');
                        }
@@ -39,7 +47,8 @@
                                $userlang = 'en';
                        }
 
-                       if($GLOBALS['phpgw_info']['server']['shm_lang'] && 
function_exists('sem_get'))
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['shm_lang']) && 
$GLOBALS['phpgw_info']['server']['shm_lang']
+                               && function_exists('sem_get'))
                        {
                                if ( !is_array($GLOBALS['lang']) || $reset) 
//This should avoid problems for php-nuke & postnuke I guess (Caeies)
                                {
@@ -53,7 +62,7 @@
                                        }
                                }
                        }
-                       elseif(!is_array($GLOBALS['lang']))
+                       elseif ( !isset($GLOBALS['lang']) || 
!is_array($GLOBALS['lang']) )
                        {
                                $GLOBALS['lang'] = array();
                        }

Index: inc/class.xmltool.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.xmltool.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- inc/class.xmltool.inc.php   19 Jul 2006 17:48:03 -0000      1.14
+++ inc/class.xmltool.inc.php   6 Aug 2006 04:51:26 -0000       1.15
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage xml
-       * @version $Id: class.xmltool.inc.php,v 1.14 2006/07/19 17:48:03 
sigurdne Exp $
+       * @version $Id: class.xmltool.inc.php,v 1.15 2006/08/06 04:51:26 
skwashd Exp $
        */
 
        /**
@@ -471,6 +471,7 @@
 
                function export_xml($indent = 1)
                {
+                       $type_error = false;
                        if ($this->node_type == 'root')
                        {
                                $result = '<?xml 
version="'.$this->xmlversion.'" encoding="UTF-8"?>'."\n";
@@ -496,6 +497,7 @@
                        }
                        else /* For node objects */
                        {
+                               $indentstring = '';
                                for ($i = 0; $i < $indent; $i++)
                                {
                                        $indentstring .= $this->indentstring;

Index: inc/class.xslttemplates.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.xslttemplates.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- inc/class.xslttemplates.inc.php     19 Jul 2006 17:48:03 -0000      1.27
+++ inc/class.xslttemplates.inc.php     6 Aug 2006 04:51:26 -0000       1.28
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage gui
-       * @version $Id: class.xslttemplates.inc.php,v 1.27 2006/07/19 17:48:03 
sigurdne Exp $
+       * @version $Id: class.xslttemplates.inc.php,v 1.28 2006/08/06 04:51:26 
skwashd Exp $
        */
 
        if( (floor(phpversion()) == 4 && !extension_loaded('xslt') )
@@ -100,12 +100,6 @@
                                        $new_filename = $filename;
                                }
 
-                               //FIXME use CSS for "print mode"
-                               if ($this->print && $time!=2 && $time!=4)
-                               {
-                                       $new_filename = $new_filename.'_print';
-                               }
-
 //                             echo 'Rootdir: 
'.$rootdir.'<br>'."\n".'Filename: '.$filename.'<br>'."\n".'New Filename: 
'.$new_filename.'<br>'."\n";
                                if (!file_exists($new_filename.'.xsl'))
                                {
@@ -114,37 +108,24 @@
                                                case 2:
                                                        $new_root = 
str_replace($GLOBALS['phpgw_info']['server']['template_set'],'base',$rootdir);
                                                        
$this->add_file($filename,$new_root,3);
-                                                       return;
-                                                       break;
+                                                       return true;
                                                case 3:
                                                        $new_root = 
PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . 
$GLOBALS['phpgw_info']['server']['template_set'];
                                                        
$this->add_file($filename,$new_root,4);
-                                                       return;
-                                                       break;
+                                                       return true;
                                                case 4:
                                                        $new_root = 
PHPGW_SERVER_ROOT . '/phpgwapi/templates/base';
                                                        
$this->add_file($filename,$new_root,5);
-                                                       return;
-                                                       break;
+                                                       return true;
                                                case 5:
                                                        
$this->add_file($filename,$rootdir,6);
-                                                       return;
-                                                       break;
+                                                       return true;
                                                case 6:
                                                        $this->halt("filename: 
file $new_filename.xsl does not exist.");
-                                                       break;
+                                                       break true;
                                                default:
-                                                       if (!$this->print)
-                                                       {
-                                                               $new_root = 
str_replace($GLOBALS['phpgw_info']['server']['template_set'],'base',$rootdir);
-                                                               
$this->add_file($filename,$new_root,3);
-                                                               return;
-                                                       }
-                                                       else
-                                                       {
                                                                
$this->add_file($filename,$rootdir,2);
-                                                               return;
-                                                       }
+                                                       return true;
                                        }
                                }
                                else
@@ -279,7 +260,8 @@
 
                function parse($parsexsl = True, $parsexml = True)
                {
-                       
$GLOBALS['phpgw']->common->phpgw_header($GLOBALS['phpgw_info']['flags']['noframework']?False:True);
+                       $output_header = 
!(isset($GLOBALS['phpgw_info']['flags']['noframework']) && 
$GLOBALS['phpgw_info']['flags']['noframework']);
+                       $GLOBALS['phpgw']->common->phpgw_header($output_header);
 
                        if($parsexsl)
                        {

Index: inc/common_functions.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/common_functions.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- inc/common_functions.inc.php        8 Apr 2005 08:56:22 -0000       1.20
+++ inc/common_functions.inc.php        6 Aug 2006 04:51:26 -0000       1.21
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: common_functions.inc.php,v 1.20 2005/04/08 08:56:22 
fipsfuchs Exp $
+       * @version $Id: common_functions.inc.php,v 1.21 2006/08/06 04:51:26 
skwashd Exp $
        */
 
        
/****************************************************************************\
@@ -551,7 +551,7 @@
                if ($partscount == 2)
                {
                        list($appname,$classname,$functionname) = explode(".", 
$method);
-                       if (!is_object($GLOBALS[$classname]))
+                       if ( !isset($GLOBALS[$classname]) || 
!is_object($GLOBALS[$classname]) )
                        {
                                if ($classparams != '_UNDEF_' && ($classparams 
|| $classparams != 'True'))
                                {
@@ -638,7 +638,7 @@
         @param $account_id either a name or an id
         @param $default_id either a name or an id
        */
-       function get_account_id($account_id = '',$default_id = '')
+       function get_account_id($account_id = '', $default_id = '')
        {
                if (gettype($account_id) == 'integer')
                {
@@ -648,13 +648,13 @@
                {
                        if ($default_id == '')
                        {
-                               return 
(isset($GLOBALS['phpgw_info']['user']['account_id'])?$GLOBALS['phpgw_info']['user']['account_id']:0);
+                               return 
isset($GLOBALS['phpgw_info']['user']['account_id']) ? 
$GLOBALS['phpgw_info']['user']['account_id'] : 0;
                        }
                        elseif (is_string($default_id))
                        {
                                return 
$GLOBALS['phpgw']->accounts->name2id($default_id);
                        }
-                       return intval($default_id);
+                       return (int)$default_id;
                }
                elseif (is_string($account_id))
                {

Index: inc/footer.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/footer.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- inc/footer.inc.php  19 Feb 2006 11:21:08 -0000      1.24
+++ inc/footer.inc.php  6 Aug 2006 04:51:26 -0000       1.25
@@ -7,21 +7,14 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: footer.inc.php,v 1.24 2006/02/19 11:21:08 skwashd Exp $
+       * @version $Id: footer.inc.php,v 1.25 2006/08/06 04:51:26 skwashd Exp $
        */
 
        
/**************************************************************************\
        * Include the apps footer files if it exists                            
   *
        
\**************************************************************************/
-       if (PHPGW_APP_INC != PHPGW_API_INC &&   // this prevents an endless 
inclusion on the homepage 
-                                                       // (some apps set 
currentapp in hook_home => it's not releyable)
-               (file_exists (PHPGW_APP_INC . '/footer.inc.php') || 
isset($GLOBALS['phpgw_info']['menuaction'])) &&
-               $GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
-               $GLOBALS['phpgw_info']['flags']['currentapp'] != 'login' &&
-               $GLOBALS['phpgw_info']['flags']['currentapp'] != 'logout' &&
-               address@hidden'phpgw_info']['flags']['noappfooter'])
-       {
-               if ($GLOBALS['phpgw_info']['menuaction'])
+
+       if ( isset($GLOBALS['phpgw_info']['menuaction']) && 
$GLOBALS['phpgw_info']['menuaction'])
                {
                        list($app,$class,$method) = 
explode('.',$GLOBALS['phpgw_info']['menuaction']);
                        if (is_array($GLOBALS[$class]->public_functions) && 
$GLOBALS[$class]->public_functions['footer'])
@@ -30,21 +23,22 @@
                        }
                        elseif(file_exists(PHPGW_APP_INC.'/footer.inc.php'))
                        {
-                               include(PHPGW_APP_INC . '/footer.inc.php');
+                       include_once(PHPGW_APP_INC . '/footer.inc.php');
                        }
                }
                elseif(file_exists(PHPGW_APP_INC.'/footer.inc.php'))
                {
-                       include(PHPGW_APP_INC . '/footer.inc.php');
+               include_once(PHPGW_APP_INC . '/footer.inc.php');
                }
+
+       if (DEBUG_TIMER)
+       {
+               $debug_timer_stop = perfgetmicrotime();
+               echo '<p class="api_timer">' . lang('page prepared in %1 
seconds.', $debug_timer_stop - $GLOBALS['debug_timer_start'] ) . "<p>\n";
        }
+
        if(function_exists('parse_navbar_end'))
        {
                parse_navbar_end();
        }
-       if (DEBUG_TIMER)
-       {
-               $GLOBALS['debug_timer_stop'] = perfgetmicrotime();
-               echo 'Page loaded in ' . ($GLOBALS['debug_timer_stop'] - 
$GLOBALS['debug_timer_start']) . ' seconds.';
-       }
 ?>

Index: inc/functions.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -b -r1.192 -r1.193
--- inc/functions.inc.php       5 Jul 2006 12:40:43 -0000       1.192
+++ inc/functions.inc.php       6 Aug 2006 04:51:26 -0000       1.193
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: functions.inc.php,v 1.192 2006/07/05 12:40:43 sigurdne 
Exp $
+       * @version $Id: functions.inc.php,v 1.193 2006/08/06 04:51:26 skwashd 
Exp $
        */
        
        
@@ -321,7 +321,7 @@
        {
                if (! $GLOBALS['phpgw']->session->verify())
                {
-                       if($_GET['menuaction'])
+                       if( isset($_GET['menuaction']) && $_GET['menuaction'])
                        {
                                unset($_GET['click_history']);
                                unset($_GET['sessionid']);
@@ -329,7 +329,7 @@
                                
$GLOBALS['phpgw']->session->phpgw_setcookie('redirect',serialize($_GET),$cookietime=0);
                        }
                        
-                       $GLOBALS['phpgw']->redirect_link('/login.php','cd=10');
+                       $GLOBALS['phpgw']->redirect_link('/login.php', 
array('cd' => 10) );
                }
 
                
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
@@ -463,7 +463,7 @@
                
\*************************************************************************/
                if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' && 
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
                {
-                       if (!$GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ,$GLOBALS['phpgw_info']['flags']['currentapp']))
+                       if (!$GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ, $GLOBALS['phpgw_info']['flags']['currentapp']))
                        {
                                
$GLOBALS['phpgw']->common->phpgw_header($GLOBALS['phpgw_info']['flags']['nonavbar']?False:True);
                                
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access 
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));

Index: inc/accounts/class.accounts_.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/accounts/class.accounts_.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/accounts/class.accounts_.inc.php        19 Jul 2006 01:40:11 -0000      
1.4
+++ inc/accounts/class.accounts_.inc.php        6 Aug 2006 04:51:26 -0000       
1.5
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.accounts_.inc.php,v 1.4 2006/07/19 01:40:11 
skwashd Exp $
+       * @version $Id: class.accounts_.inc.php,v 1.5 2006/08/06 04:51:26 
skwashd Exp $
        */
        if (empty($GLOBALS['phpgw_info']['server']['account_repository']))
        {
@@ -286,6 +286,21 @@
                }
 
                /**
+               * Get a list of members of the current group
+               */
+               function get_members()
+               {
+                       $members = array();
+                       $sql = "SELECT acl_account FROM phpgw_acl WHERE 
acl_appname = 'phpgw_group' and acl_location =" . (int) $this->account_id;
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $members[] =  $this->db->f('acl_account');
+                       }
+                       return $members;
+               }
+
+               /**
                * Find the next available account_id
                *
                * @param string $account_type Account type 'u' : user; 'g' : 
group

Index: inc/accounts/class.accounts_ldap.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/accounts/class.accounts_ldap.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/accounts/class.accounts_ldap.inc.php    28 Jul 2006 03:06:01 -0000      
1.7
+++ inc/accounts/class.accounts_ldap.inc.php    6 Aug 2006 04:51:26 -0000       
1.8
@@ -11,7 +11,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.accounts_ldap.inc.php,v 1.7 2006/07/28 03:06:01 
skwashd Exp $
+       * @version $Id: class.accounts_ldap.inc.php,v 1.8 2006/08/06 04:51:26 
skwashd Exp $
        */
 
        /**
@@ -23,31 +23,49 @@
        */
        class accounts_ldap extends accounts_
        {
+               /**
+               * @var resource $ds ldap connection resource
+               */
                var $ds;
+
+               /**
+               * @var string $user_context the ldap accounts context
+               */
                var $user_context  = '';
+
+               /**
+               * @var string $group_context the ldap groups context
+               */
                var $group_context = '';
 
                /**
-               * @internal Be Carefull to correctly set the following! 
-               * @internal Need to be set in the setup system! (Caeies)
-               * @internal Be very carefull - it will certainly break the 
account system
+               * @var string $rdn_account the user attribute
+               * @internal TODO move to setup
                */
                var $rdn_account = 'uid';
+
+               /**
+               * @var string $rdn_group the group attribute
+               * @internal TODO move to setup
+               */
                var $rdn_group   = 'cn';
+
                /**
-               * @internal Be secure by default (Caeies)
+               * @var string $fallback_homedirectory the default home 
directory for users
+               * @internal secure by default - no home directory
                */
                var $fallback_homedirectory = '/dev/null';
+
                /**
-               * @internal Nothing allowed (Caeies)
+               * @var string $fallback_loginshell the default user shell
+               * @internal secure by default - no login allowed
                */
                var $fallback_loginshell    = '/bin/false';
-               var $fallback_apps          = array('addressbook',
-                                                   'calendar',
-                                                   'email',
-                                                   'notes',
-                                                   'todo'
-                                                                     );
+
+               /**
+               * @var array $fallback_apps the base applications to enable for 
users
+               */
+               var $fallback_apps = array('addressbook', 'calendar', 'email', 
'notes', 'todo');
 
                function accounts_ldap($account_id = null, $account_type = null)
                {
@@ -67,45 +85,49 @@
                        {
                                $sri = ldap_search($this->ds, 
$this->group_context, 'gidnumber='.$this->account_id);
                        }
-                       else
+                       else if ($acct_type == 'u' && $this->user_context )
                        {
                                $sri = ldap_search($this->ds, 
$this->user_context, 'uidnumber='.$this->account_id);
                        }
-                       $allValues = ldap_get_entries($this->ds, $sri);
+                       else
+                       {
+                               return array
+                               (
+                                       'account_id'            => '',
+                                       'account_lid'           => '',
+                                       'account_firstname'     => '',
+                                       'account_lastname'      => '',
+                                       'type'                          => ''
+                               );
+                       }
+                       $entries = ldap_get_entries($this->ds, $sri);
 
                        /* Now dump it into the array; take first entry found */
+                       $this->data['account_dn']             = 
$entries[0]['dn'];
+                       $this->data['fullname']               = 
$entries[0]['cn'][0];
                        if($acct_type == 'g')
                        {
-                               $this->account_id       = 
$this->data['account_id']             = $allValues[0]['gidnumber'][0];
-                               $this->lid              = 
$this->data['account_lid']            = $allValues[0]['cn'][0];
-                               $this->firstname        = 
$this->data['account_firstname']      = utf8_decode($allValues[0]['cn'][0]);
-                               $this->lastname         = 
$this->data['account_lastname']       = 'Group';
+                               $this->account_id       = 
$this->data['account_id']                     = $entries[0]['gidnumber'][0];
+                               $this->lid                      = 
$this->data['account_lid']            = $entries[0]['cn'][0];
+                               $this->firstname        = 
$this->data['account_firstname']      = $entries[0]['cn'][0];
+                               $this->lastname         = 
$this->data['account_lastname']       = lang('group');
                                $this->account_type     = $this->data['type']   
                = 'g';
                        }
                        else
                        {
-                               $this->account_id       = 
$this->data['account_id']             = $allValues[0]['uidnumber'][0];
-                               $this->lid              = 
$this->data['account_lid']            = $allValues[0]['uid'][0];
-                               $this->firstname        = 
$this->data['account_firstname']      = 
utf8_decode($allValues[0]['givenname'][0]);
-                               $this->lastname         = 
$this->data['account_lastname']       = utf8_decode($allValues[0]['sn'][0]);
+                               $this->account_id       = 
$this->data['account_id']                     = $entries[0]['uidnumber'][0];
+                               $this->lid                      = 
$this->data['account_lid']            = $entries[0]['uid'][0];
+                               $this->firstname        = 
$this->data['account_firstname']      = $entries[0]['givenname'][0];
+                               $this->lastname         = 
$this->data['account_lastname']       = $entries[0]['sn'][0];
+                               $this->expires          = 
$this->data['expires'] = $this->data['account_expires'] = 
$entries[0]['phpgwaccountexpires'][0];
+                               $this->data['homedirectory']          = 
isset($entries[0]['homedirectory']) ? $entries[0]['homedirectory'][0] : 
$this->fallback_homedirectory;
+                               $this->data['loginshell']             = 
isset($entries[0]['loginshell']) ? $entries[0]['loginshell'][0] : 
$this->fallback_loginshell;
+                               $this->status = $this->data['status'] = 
isset($entries[0]['phpgwaccountstatus']) && 
$entries[0]['phpgwaccountstatus'][0] == 'A' ? 'A' : '';
                                $this->account_type     = $this->data['type']   
                = 'u';
                        }
-                       $this->data['account_dn']             = 
$allValues[0]['dn'];
-                       $this->data['fullname']               = 
utf8_decode($allValues[0]['cn'][0]);
-
-                       $this->data['homedirectory']          = 
$allValues[0]['homedirectory'][0];
-                       $this->data['loginshell']             = 
$allValues[0]['loginshell'][0];
-
-                       $this->expires          = $this->data['expires'] = 
$this->data['account_expires'] = $allValues[0]['phpgwaccountexpires'][0];
-                       //$allValues[0]['description'][0] is not needed
-                       if ($allValues[0]['phpgwaccountstatus'][0] == 'A')
-                       {
-                               $this->status = $this->data['status'] = 'A';
-                       }
-                       
-                       if ( $allValues[0]['phpgwcontactid'][0] )
+                       if ( isset($entries[0]['phpgwcontactid']) )
                        {
-                               $this->person_id                = 
$this->data['person_id'] = $allValues[0]['phpgwcontactid'][0];
+                               $this->person_id        = 
$this->data['person_id'] = $entries[0]['phpgwcontactid'][0];
                        }
                        return $this->data;
                }
@@ -132,17 +154,17 @@
                */
                function delete($id = '')
                {
-                       $id = get_account_id($id);
+                       $id = (int) get_account_id($id);
                        $type = $this->get_type($id);
 
                        if ($type == 'g')
                        {
-                               $sri = ldap_search($this->ds, 
$this->group_context, '(&(objectclass=phpgwgroup)(gidnumber='.$id.'))');
+                               $sri = ldap_search($this->ds, 
$this->group_context, "(&(objectclass=phpgwgroup)(gidnumber={$id}))");
                                $allValues = ldap_get_entries($this->ds, $sri);
                        }
                        else
                        {
-                               $sri = ldap_search($this->ds, 
$this->user_context, '(&(objectclass=phpgwaccount)(uidnumber='.$id.'))');
+                               $sri = ldap_search($this->ds, 
$this->user_context, "(&(objectclass=phpgwaccount)(uidnumber={$id}))");
                                $allValues = ldap_get_entries($this->ds, $sri);
                        }
                                
@@ -168,8 +190,9 @@
                * @param integer $offset Offset from start position (-1 == no 
limit)
                * @return array|boolean List with all accounts|groups or false
                */
-               function get_list($_type='both', $start = -1,$sort = '', $order 
= '', $query = '', $offset = -1)
+               function get_list($_type = 'both', $start = -1, $sort = '', 
$order = '', $query = '', $offset = -1)
                {
+                       //echo "accounts_ldap:get_list($_type, $start, $sort, 
$order, $query, $offset) called<br>";
                        $query = strtolower($query);
                        if ($offset != -1)
                        {
@@ -187,17 +210,19 @@
 
                        if ($_type == 'accounts')
                        {
-                               $listentries = $this->get_accountList($query);
+                               $listentries = $this->get_account_list($query);
                        }
                        elseif ($_type == 'groups')
                        {
-                               $listentries = $this->get_groupList($query);
+                               $listentries = $this->get_group_list($query);
                        }
                        else
                        {
-                               $listentries = 
array_merge($this->get_accountList($query), $this->get_groupList($query));
+                               $listentries = 
array_merge($this->get_account_list($query), $this->get_group_list($query));
                        }
 
+                       //echo 'listentries <pre>' . print_r($listentries, 
true) . '</pre>';
+
                        // sort the array
                        $arrayFunctions = 
CreateObject('phpgwapi.arrayfunctions');
                        if(empty($order))
@@ -206,20 +231,23 @@
                        }
                        $sortedlist = 
$arrayFunctions->arfsort($listentries,array($order),$sort);
                        $this->total = count($listentries); // this shouldn't 
be an obejct var for one account/group whatever
+                       unset($listentries);
 
-                       if (is_array($sortedlist))
+                       if ( is_array($sortedlist) )
                        {
-                               reset($sortedlist);
-                               if($start != -1 && $offset != -1)
+                               if( $start > 0 && $offset > 0 )
                                {
+                                       //echo "defined limit - start: $start, 
offset: $offset<br>";
                                        return array_slice($sortedlist, $start, 
$offset);
                                }
                                elseif($start != -1)
                                {
+                                       //echo "defined limit - start: $start, 
offset: user[max]<br>";
                                        return array_slice($sortedlist, $start, 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
                                }
                                else
                                {
+                                       //echo "return all<br>";
                                        return $sortedlist;
                                }
                        }
@@ -232,34 +260,48 @@
                * @param string $query LDAP query
                * @return array Array with account fields 'acount_id', 
'account_lid', 'account_type', 'account_firstname', 'account_lastname', 
'account_status'
                */
-               function get_accountList($query)
+               function get_account_list($query)
                {
+                       $accounts = array();
                        if(empty($query) || $query == "*")
                        {
                                $filter = 
'(&(uidnumber=*)(objectclass=posixaccount))';
                        }
                        else
                        {
+                               //escaping
+                               $query = str_replace('\\', '\\\\', $query);
                                $filter = 
"(&(uidnumber=*)(objectclass=posixaccount)(|(uid=*$query*)(sn=*$query*)(cn=*$query*)(givenname=*$query*)))";
                        }
+                       
                        $sri = ldap_search($this->ds, $this->user_context, 
$filter);
-                       $allValues = ldap_get_entries($this->ds, $sri);
-                       while (list($null,$allVals) = @each($allValues))
+                       $entries = ldap_get_entries($this->ds, $sri);
+                       if ( !is_array($entries) )
+                       {
+                               return $accounts;
+                       }
+
+                       foreach ( $entries as $entry )
+                       {
+                               if ( !strlen($test = $entry['uid'][0]) )
                        {
-                               settype($allVals,'array');
-                               $test = @$allVals['uid'][0];
-                               if 
(!$GLOBALS['phpgw_info']['server']['global_denied_users'][$test] && 
$allVals['uid'][0])
-                               {
-                                       $accounts[] = Array(
-                                               'account_id'        => 
$allVals['uidnumber'][0],
-                                               'account_lid'       => 
$allVals['uid'][0],
+                                       continue;
+                               }
+
+                               if 
(!isset($GLOBALS['phpgw_info']['server']['global_denied_users'][$test]) )
+                               {
+                                       $accounts[] = array
+                                       (
+                                               'account_id'        => 
$entry['uidnumber'][0],
+                                               'account_lid'       => 
$entry['uid'][0],
                                                'account_type'      => 'u',
-                                               'account_firstname' => 
utf8_decode($allVals['givenname'][0]),
-                                               'account_lastname'  => 
utf8_decode($allVals['sn'][0]),
-                                               'account_status'    => 
$allVals['phpgwaccountstatus'][0]
+                                               'account_firstname' => 
$entry['givenname'][0],
+                                               'account_lastname'  => 
$entry['sn'][0],
+                                               'account_status'    => 
$entry['phpgwaccountstatus'][0] == 'A' ? 'A' : 'I'
                                        );
                                }
                        }
+                       //echo '<pre>' . print_r($accounts, true) .'</pre>';
                        return $accounts;
                }
 
@@ -269,8 +311,10 @@
                * @param string $query LDAP query
                * @return array Array with group fields 'account_id', 
'account_lid', 'account_type'
                */
-               function get_groupList($query)
+               function get_group_list($query)
                {
+                       $groups = array();
+
                        if(empty($query) || $query == "*")
                        {
                                $filter = 
'(&(gidnumber=*)(objectclass=posixgroup))';
@@ -280,17 +324,29 @@
                                $filter = 
"(&(gidnumber=*)(objectclass=posixgroup)(|(uid=*$query*)(sn=*$query*)(cn=*$query*)(givenname=*$query*)))";
                        }
                        $sri = ldap_search($this->ds, $this->group_context, 
$filter);
-                       $allValues = ldap_get_entries($this->ds, $sri);
-                       while (list($null,$allVals) = @each($allValues))
+                       $entries = ldap_get_entries($this->ds, $sri);
+
+                       if (!is_array($entries) )
                        {
-                               settype($allVals,'array');
-                               $test = $allVals['cn'][0];
-                               if 
(!$GLOBALS['phpgw_info']['server']['global_denied_groups'][$test] && 
$allVals['cn'][0])
-                               {
-                                       $groups[] = Array(
-                                               'account_id'        => 
$allVals['gidnumber'][0],
-                                               'account_lid'       => 
$allVals['cn'][0],
-                                               'account_type'      => 'g'
+                               return $groups;
+                       }
+
+                       foreach ( $entries as $entry )
+                       {
+                               if ( !strlen($test = $entry['cn'][0]) )
+                               {
+                                       continue;
+                               }
+
+                               if ( 
!isset($GLOBALS['phpgw_info']['server']['global_denied_groups'][$test]) )
+                               {
+                                       $groups[] = array
+                                       (
+                                               'account_id'        => 
$entry['gidnumber'][0],
+                                               'account_lid'       => 
$entry['cn'][0],
+                                               'account_firstname' => 
$entry['cn'][0],
+                                               'account_lastname'  => 
lang('group'),
+                                               'account_type'      => 'g',
                                        );
                                }
                        }
@@ -307,13 +363,13 @@
                {
                        static $name_list;
 
-                       if(@isset($name_list[$account_lid]) && 
$name_list[$account_lid])
+                       if ( isset($name_list[$account_lid]) && 
$name_list[$account_lid] )
                        {
                                return $name_list[$account_lid];
                        }
 
-                       $id  = $this->groupName2id($account_lid);
-                       $uid = $this->accountName2id($account_lid);
+                       $id  = $this->group_name2id($account_lid);
+                       $uid = $this->account_name2id($account_lid);
                        
                        if ($uid)
                        {
@@ -328,14 +384,15 @@
                * @param string $name Group name for which you want the id
                * @return integer|boolean Id of the group when found otherwise 
false
                */
-               function groupName2id($name)
+               function group_name2id($name)
                {
-                       $sri = ldap_search($this->ds, $this->group_context, 
'(&('.$this->rdn_group.'='. $name .')(objectclass=phpgwgroup))');
+                       $sri = ldap_search($this->ds, $this->group_context, 
"(&({$this->rdn_group}={$name})(objectclass=phpgwgroup))");
                        $allValues = ldap_get_entries($this->ds, $sri);
                        
-                       if (@$allValues[0]['gidnumber'][0])
+                       //echo "searching for name {$name} <pre>" . 
print_r($allValues, true) . '</pre>';
+                       if ( isset($allValues[0]['gidnumber'][0]) )
                        {
-                               return intval($allValues[0]['gidnumber'][0]);
+                               return (int) $allValues[0]['gidnumber'][0];
                        }
                        else
                        {
@@ -349,14 +406,14 @@
                * @param string $name Account name
                * @return integer|boolean Id of the account when found 
otherwise false
                */
-               function accountName2id($name)
+               function account_name2id($name)
                {
-                       $sri = ldap_search($this->ds, $this->user_context, 
'(&('.$this->rdn_account.'='. $name .')(objectclass=phpgwaccount))');
+                       $sri = ldap_search($this->ds, $this->user_context, 
"(&({$this->rdn_account}={$name})(objectclass=phpgwaccount))");
                        $allValues = ldap_get_entries($this->ds, $sri);
 
-                       if (@$allValues[0]['uidnumber'][0])
+                       if ( isset($allValues[0]['uidnumber'][0]) )
                        {
-                               return intval($allValues[0]['uidnumber'][0]);
+                               return (int) $allValues[0]['uidnumber'][0];
                        }
                        else
                        {
@@ -392,7 +449,7 @@
                        }
                        else
                        {
-                               return false;
+                               return '';
                        }
                        return $name;
                }
@@ -432,19 +489,28 @@
                /**
                * Get type (account or group) for an id
                *
+               * @internal FIXME this should not contain a die
                * @param integer $id Account or group id
-               * @return string|boolean 'u' : account (user); 'g' : group; 
false for none existing id
+               * @return string|boolean 'u' : account (user); 'g' : group; 
empty string for none existing id
                */
-               function get_type($id = '') // get_type() without an id - what 
do you expect me to return!?
+               function get_type($id = 0) // get_type() without an id - what 
do you expect me to return!?
+               {
+                       $type = '';
+                       if ( $id == 0 )
                {
+                               return $type;
+                       }
+
                        if ($this->account_exists($id))
                        {
                                $type = 'u';
                        }
+
                        if ($this->group_exists($id))
                        {
                                if ($type == 'u')
                                {
+                                       //FIXME handle this more gracefully
                                        die('account/group id ('.$id.')conflict 
- bad luck');
                                }
                                else
@@ -452,15 +518,8 @@
                                        $type = 'g';
                                }
                        }
-                       if ($type)
-                       {
                                return $type;
                        }
-                       else
-                       {
-                               return false;
-                       }
-               }
 
                
 
@@ -468,21 +527,21 @@
                * Get new id for an account/group
                *
                * @param string $type 'u' : account (user); 'g' : group
-               * @return integer|boolean New id for an account/group or false
+               * @return integer New id for an account/group, 0 == failure
                */
                function get_nextid($type = 'u')
                {
                        if ($type == 'u')
                        {
-                               return $this->get_nextAccountID();
+                               return $this->_get_next_account_id();
                        }
                        elseif ($type == 'g')
                        {
-                               return $this->get_nextGroupID();
+                               return $this->_get_next_group_id();
                        }
                        else
                        {
-                               return false;
+                               return 0;
                        }
                }
                
@@ -491,21 +550,26 @@
                *
                * @return integer|boolean New id for an account or false
                */
-               function get_nextAccountID()
+               function _get_next_account_id()
                {
                        $filter = 
'(|(objectclass=posixaccount)(objectclass=phpgwaccount))';
                        $result = ldap_search($this->ds, $this->user_context, 
$filter, array('uidnumber'));
-                       $allValues = ldap_get_entries($this->ds, $result);
+                       $entries = ldap_get_entries($this->ds, $result);
+
+                       if ( !is_array($entries) && !count($entries) )//this 
shouldn't happen
+                       {
+                               return 
$GLOBALS['phpgw_info']['server']['account_min_id'];
+                       }
 
                        // parse all LDAP uidnumbers in a single array '$IDs'
-                       while (list($key,$val) = each($allValues))
+                       foreach ( $entries as $entry )
                        {
-                               if (is_int($key))
+                               if ( is_int($key) )
                                {
-                                       $IDs[] = 
$allValues[$key]['uidnumber'][0];
+                                       $ids[$entries[$key]['uidnumber'][0]] = 
true;
                                }
                        }
-                       return $this->idTester($IDs, 
$GLOBALS['phpgw_info']['server']['account_min_id'], 
$GLOBALS['phpgw_info']['server']['account_max_id'] );
+                       return $this->id_tester($ids, 
$GLOBALS['phpgw_info']['server']['account_min_id'], 
$GLOBALS['phpgw_info']['server']['account_max_id'] );
                }
                
                /**
@@ -513,20 +577,28 @@
                *
                * @return integer|boolean New id for a group or false
                */
-               function get_nextGroupID()
+               function _get_next_group_id()
                {
                        $filter = 
'(|(objectclass=posixgroup)(objectclass=phpgwgroup))';
                        $result = ldap_search($this->ds, $this->group_context, 
$filter, array('gidnumber'));
-                       $allValues = ldap_get_entries($this->ds, $result);
+                       $entries = ldap_get_entries($this->ds, $result);
 
-                       while (list($key,$val) = each($allValues))
+                       if ( !is_array($entries) || !count($entries) )//this 
shouldn't happen
                        {
-                               if (is_int($key))
+                               return (int) 
$GLOBALS['phpgw_info']['server']['group_min_id'];
+                       }
+
+                       $ids = array();
+                       // parse all LDAP uidnumbers in a single array '$IDs'
+                       foreach ( $entries as $entry )
+                       {
+                               if ( isset($entry['gidnumber'][0]) && 
is_numeric($entry['gidnumber'][0]) )
                                {
-                                       $IDs[] = 
$allValues[$key]['gidnumber'][0];
+                                       $ids[$entry['gidnumber'][0]] = true;
                                }
                        }
-                       return $this->idTester($IDs, 
$GLOBALS['phpgw_info']['server']['group_min_id'], 
$GLOBALS['phpgw_info']['server']['group_max_id'] );
+                       //echo 'accts_ldap::_get_next_group_id - ids == <pre>' 
. print_r($ids, true) . "</pre><br>range - min: 
{$GLOBALS['phpgw_info']['server']['group_min_id']} max: 
{$GLOBALS['phpgw_info']['server']['group_max_id']}";
+                       return $this->id_tester($ids, 
$GLOBALS['phpgw_info']['server']['group_min_id'], 
$GLOBALS['phpgw_info']['server']['group_max_id'] );
                }
 
                /**
@@ -540,11 +612,16 @@
                {
                        if ($id)
                        {
-                               $result = ldap_search($this->ds, 
$this->group_context, '(&(gidnumber='.$id.')(objectclass=posixgroup))');
-                               $allValues = ldap_get_entries($this->ds, 
$result);
-                               if ($allValues[0]['dn'])
+                               $result = ldap_search($this->ds, 
$this->group_context, "(&(gidnumber={$id})(objectclass=posixgroup))");
+                               $entries = ldap_get_entries($this->ds, $result);
+                               if ( !is_array($entries) || !count($entries) )
                                {
-                                       return $allValues[0];
+                                       return array();
+                               }
+                               
+                               if ( isset($entries[0]) && 
is_array($entries[0]) )
+                               {
+                                       return $entries[0];
                                }
                                else
                                {
@@ -565,9 +642,9 @@
                {
                        if ($id)
                        {
-                               $result = ldap_search($this->ds, 
$this->user_context, '(&(uidnumber='.$id.')(objectclass=posixaccount))');
+                               $result = ldap_search($this->ds, 
$this->user_context, "(&(uidnumber={$id})(objectclass=posixaccount))");
                                $allValues = ldap_get_entries($this->ds, 
$result);
-                               if ($allValues[0]['dn'])
+                               if ( isset($allValues[0]['dn']) )
                                {
                                        return $allValues[0];
                                }
@@ -590,7 +667,7 @@
                {
                        if ($id)
                        {
-                               $result = ldap_search($this->ds, 
$this->user_context, 'phpgwcontact=' . $id);
+                               $result = ldap_search($this->ds, 
$this->user_context, "phpgwcontact={$id}");
                                $allValues = ldap_get_entries($this->ds, 
$result);
                                if ($allValues[0]['dn'])
                                {
@@ -615,7 +692,7 @@
                {
                        if ($dn != '')
                        {
-                               $result = @ldap_search($this->ds, $dn, 
'objectclass=*');
+                               $result = @ldap_search($this->ds, $dn, 
'objectClass=*');
                                if ($result)
                                {
                                        $allValues = 
ldap_get_entries($this->ds, $result);
@@ -669,10 +746,14 @@
                */
                function create($account_info, $default_prefs = true)
                {
-                       if (empty($account_info['account_id']) || 
!$account_info['account_id'])
+                       //echo 'create called!';
+                       if ( !isset($account_info['account_id']) || 
empty($account_info['account_id']) || !$account_info['account_id'] == 0 )
                        {
+                               //echo 'need new acct id for new group';
                                $account_info['account_id'] = 
$this->get_nextid($account_info['account_type']);
+                               //echo "- got given 
{$account_info['account_id']}<br>";
                        }
+
                        if ($account_info['account_type'] == 'u')
                        {
                                $this->create_account($account_info);
@@ -685,7 +766,6 @@
                        {
                                return false;
                        }
-                       
                        return parent::create($account_info, $default_prefs);
                }
 
@@ -699,10 +779,13 @@
                {
                        $dn = $this->rdn_account .
                              '=' .
-                             
$this->get_leafName($account_info['account_firstname'], 
$account_info['account_lastname'], $account_info['account_lid']) .
+                             
$this->get_leaf_Name($account_info['account_firstname'], 
$account_info['account_lastname'], $account_info['account_lid']) .
                              ',' .
                              $this->user_context;
                                
+                       //This is here to stop object class violations! - 
skwashd Jul-2006
+                       $entry['objectclass'][]       = 'inetOrgPerson';
+
                        // phpgw attributes
                        $entry['objectclass'][]       = 'phpgwAccount';
                        $entry['phpgwaccountid']      = 
$account_info['account_id'];
@@ -741,17 +824,17 @@
 
                        // additional attributes from the phpgw for groups
                        $entry['objectclass'][]       = 'posixAccount';
-                       $entry['cn']                  = 
utf8_encode($this->get_fullname($account_info['account_firstname'], 
$account_info['account_lastname']));
+                       $entry['cn']                  = 
$this->get_fullname($account_info['account_firstname'], 
$account_info['account_lastname']);
                        $entry['uidnumber']           = 
$account_info['account_id'];
                        $entry['uid']                 = 
$account_info['account_lid'];
-                       $entry['description']         = 
utf8_encode(str_replace('*','',lang('phpgw-created account')));
+                       $entry['description']         = 
str_replace('*','',lang('phpgw-created account'));
                        if ( $account_info['account_firstname'] )
                        {
-                               $entry['givenname'] = 
utf8_encode($account_info['account_firstname']);
+                               $entry['givenname'] = 
$account_info['account_firstname'];
                        }
                        if ( $account_info['account_lastname'] )
                        {
-                               $entry['sn'] = 
utf8_encode($account_info['account_lastname']);
+                               $entry['sn'] = 
$account_info['account_lastname'];
                        }
                        else
                        {
@@ -784,7 +867,7 @@
                                if ($this->createMode == 'replace')
                                {
                                        ldap_delete($this->ds, $oldEntry['dn']);
-                                       $this->add_LDAP_Entry($dn, $entry);
+                                       $this->add_ldap_entry($dn, $entry);
                                }
                                elseif ($this->createMode == 'extend')
                                {
@@ -796,13 +879,16 @@
                                        {
                                                if (!is_int($key))
                                                {
+                                                       if ( 
isset($oldEntry[$key]) && is_array($oldEntry[$key]) )
+                                                       {
                                                        
unset($oldEntry[$key]['count']);
+                                                       }
                                                        switch ($key)
                                                        {
                                                                case 'dn':
                                                                        if 
($oldEntry['dn'] != $dn)  // new group name DN should renamed as well
                                                                        {
-                                                                               
$oldEntry['dn'] = $this->rename_LDAP_entry($oldEntry['dn'], $dn, 
$this->user_context);
+                                                                               
$oldEntry['dn'] = $this->rename_ldap_entry($oldEntry['dn'], $dn, 
$this->user_context);
                                                                                
if (!$oldEntry)
                                                                                
{
                                                                                
        die('ldap_rename FAILED: [' . ldap_errno($this->ds) . '] ' . 
ldap_error($this->ds));
@@ -873,18 +959,18 @@
                                                        }
                                                }
                                                ldap_delete($this->ds, 
$oldEntry['dn']);
-                                               return 
$this->add_LDAP_Entry($oldEntry['dn'], $entry);
+                                               return 
$this->add_ldap_entry($oldEntry['dn'], $entry);
                                        }
                                        else
                                        {
-                                               return 
$this->modify_LDAP_Entry($oldEntry['dn'], $entry);
+                                               return 
$this->modify_ldap_entry($oldEntry['dn'], $entry);
                                        }
                                        $dn = $oldEntry['dn'];
                                }
                        }
                        else // entry not yet in LDAP
                        {
-                               return $this->add_LDAP_Entry($dn, $entry);
+                               return $this->add_ldap_entry($dn, $entry);
                        }                               
                }
                
@@ -908,7 +994,7 @@
                        $entry['objectclass'][]  = 'posixGroup';
                        $entry['cn']             = $account_info['account_lid'];
                        $entry['description']    = utf8_encode(str_replace('*', 
'', lang('phpgw-created group')));
-                       $entry['memberuid']      = 
$this->get_memberUIDs($account_info['account_id']);
+                       $entry['memberuid']      = 
$this->get_member_uids($account_info['account_id']);
                        if (!$entry['memberuid'])
                        {
                                unset ($entry['memberuid']);
@@ -921,7 +1007,7 @@
                                if ($this->createMode == 'replace')
                                {
                                        ldap_delete($this->ds, $oldEntry['dn']);
-                                       $this->add_LDAP_Entry($dn, $entry);
+                                       $this->add_ldap_entry($dn, $entry);
                                }
                                elseif ($this->createMode == 'extend')
                                {
@@ -933,13 +1019,16 @@
                                        {
                                                if (!is_int($key))
                                                {
+                                                       if ( 
isset($oldEntry[$key]) && is_array($oldEntry[$key]) )
+                                                       {
                                                        
unset($oldEntry[$key]['count']);
+                                                       }
                                                        switch ($key)
                                                        {
                                                                case 'dn':
                                                                        if 
($oldEntry['dn'] != $dn)  // new group name DN should renamed as well
                                                                        {
-                                                                               
$oldEntry['dn'] = $this->rename_LDAP_entry($oldEntry['dn'], $dn, 
$this->group_context);
+                                                                               
$oldEntry['dn'] = $this->rename_ldap_entry($oldEntry['dn'], $dn, 
$this->group_context);
                                                                                
if (!$oldEntry)
                                                                                
{
                                                                                
       die('ldap_rename FAILED: [' . ldap_errno($this->ds) . '] ' . 
ldap_error($this->ds));
@@ -976,7 +1065,7 @@
                        }
                        else // entry not yet in LDAP
                        {
-                               $this->add_LDAP_Entry($dn, $entry);
+                               $this->add_ldap_entry($dn, $entry);
                        }                               
                }
                
@@ -987,18 +1076,15 @@
                * @param array $entry Array of all LDAP attributes to be added
                * @return boolean True when successful otherwise false (die for 
now)
                */
-               function add_LDAP_Entry($dn, $entry)
+               function add_ldap_entry($dn, $entry)
                {
+                       //die("<pre>" . print_r($entry, true) . "</pre>\n<br>");
                        $success = ldap_add($this->ds, $dn, $entry);
                        if (!$success)
                        {
-                               echo 'ldap_add FAILED: [' . 
ldap_errno($this->ds) . '] ' . ldap_error($this->ds).'<br /><br />';
-                               echo "<strong>Adds: ".$dn."</strong><br />";
-                               echo "<pre>";
-                               print_r($entry);
-                               echo "</pre>";
-                               echo "<br />";
-                               die('');
+                               echo 'ldap_add FAILED: [' . 
ldap_errno($this->ds) . '] ' . ldap_error($this->ds).'<br><br>';
+                               echo "<strong>Adds: {$dn}</strong><br>";
+                               die("<pre>" . print_r($entry, true) . 
"</pre>\n<br>");
                        }
                        else
                        {
@@ -1013,18 +1099,14 @@
                * @param array $entry Array of all LDAP attributes which are 
going to be modified
                * @return boolean True on success otherwise false (die for now)
                */
-               function modify_LDAP_Entry($dn, $entry)
+               function modify_ldap_entry($dn, $entry)
                {
                        $success = ldap_modify($this->ds, $dn, $entry);
                        if (!$success)
                        {
                                echo 'ldap_modified FAILED: [' . 
ldap_errno($this->ds) . '] ' . ldap_error($this->ds).'<br /><br />';
-                               echo "<strong>Modifies: ".$dn."</strong><br />";
-                               echo "<pre>";
-                               print_r($entry);
-                               echo "</pre>";
-                               echo "<br />";
-                               die('');
+                               echo "<strong>Modifies: {$dn}</strong><br>";
+                               die("<pre>" . print_r($entry, true) . 
"</pre>\n<br>");
                        }
                        else
                        {
@@ -1040,7 +1122,7 @@
                * @param string $baseDN Base distinguised name for the rename 
operation
                * @return string|boolean The new distinguised name on success 
otherwise false
                */
-               function rename_LDAP_Entry($oldDN, $newDN, $baseDN)
+               function rename_ldap_entry($oldDN, $newDN, $baseDN)
                {
                        $newDN_array = (ldap_explode_dn($newDN, 0));
                        $oldDN_array = (ldap_explode_dn($oldDN, 0));
@@ -1065,7 +1147,7 @@
                        }
                }
 
-               function get_account_name($accountid,&$lid,&$fname,&$lname)
+               function get_account_name($accountid, &$lid, &$fname, &$lname)
                {
                        static $account_name;
                        
@@ -1114,9 +1196,9 @@
                * @param interger $id Account id
                * @return string|boolean Distinguised name or false
                */
-               function getDNforID($id = '')
+               function get_dn_for_id($id = '')
                {
-                       return $this->getDNforAccountID($id); 
+                       return $this->get_dn_for_account_id($id); 
                }
 
                /**
@@ -1125,7 +1207,7 @@
                * @param integer $_accountid Account id
                * @return string|boolean Distinguised name or false
                */
-               function getDNforAccountID($id = '')
+               function get_dn_for_account_id($id = '')
                {
                        $_account_id = get_account_id($id);
 
@@ -1165,7 +1247,7 @@
                        if(is_array($allValues))
                        {
                                $count = intval($allValues['count']);
-                               for($i=0;$i<$count;$i++)//foreach(allValues as 
$value)
+                               for ( $i = 0; $i < $count; 
++$i)//foreach(allValues as $value)
                                {
                                        $value = &$allValue[$i];
                                        $accounts[] = $value['uidnumber'][0];
@@ -1182,7 +1264,7 @@
                * @param string $login Login name
                * @return string Generated name of leaf of the distinguised name
                */
-               function get_leafName($first, $last, $login)
+               function get_leaf_name($first, $last, $login)
                {
                        //if ($first != '' && $last == '')
                        {
@@ -1210,54 +1292,36 @@
                /**
                * Test an array with ids for a free id in respect to a min and 
max id
                *
-               * @param array $IDs Array with existing id's
+               * @param array $ids Array with existing id's
                * @param integer $min Minimum for id number
                * @param integer $max Maximum for id number 
                * @return integer New id that can be used
                */
-               function idTester($IDs, $min = 1, $max = 0)
+               function id_tester($ids, $min = 1, $max = 0)
                {
-                       $interval = intval($max) - intval($min);
-                       $base = intval($min) ? intval($min) : 1;
-                       if ($interval > 0)
+                       //echo 'IDs<pre>' . print_r($ids, true) . '</pre>';
+                       if ( $min > $max )
                        {
-                               if($IDs[count($IDs)-1] < $base ) // still, 
there are low ids
-                               {
-                                       $pointer = $start = 
($IDs[count($IDs)-1] - 0 )     % $interval;
-                               }
-                               else
-                               {
-                                       $pointer = $start = 
($IDs[count($IDs)-1] - $base ) % $interval;
-                               }
+                               echo 'FIXME: Your server is misconfigured!<br>';
+                               return 0;
                        }
-                       else
+                       
+                       if ( !is_array($ids) )
                        {
-                               $pointer = $IDs[count($IDs)-1];
+                               $ids = array();
                        }
-                       if (is_array($IDs))
-                       {
-                               do
-                               {
-                                       if ($interval > 0)
+                       
+                       for ( $i = $min; $i <= $max; ++$i )
                                        {
-                                               $pointer = ($pointer+1) % 
$interval;
-                                               if ($pointer == $start)
+                               if ( !isset($ids[$i]) )
                                                {
-                                                       die('no free id found');
+                                       //echo "found $i as the next id<br>";
+                                       return $i;
                                                }
                                        }
-                                       else
-                                       {
-                                               $pointer++;
-                                       }
-                               }
-                               while (in_array($base + $pointer, $IDs) && 
$pointer != $start);
-                       }
-                       else
-                       {
-                               $pointer = 0;
-                       }
-                       return $base + $pointer;
+                       
+                       die('FIXME: no free id found');
+                       //return 0;
                }
                
                function get_homedirectory($newValue, $login)
@@ -1300,7 +1364,7 @@
                        return $return;
                }
                
-               function get_memberUIDs($account_id = '')
+               function get_member_uids($account_id = '')
                {
                        if ( !empty($account_id) )
                        {
@@ -1337,7 +1401,7 @@
                * @param integer $groupID Group id
                * @return boolean True on success otherwise false
                */
-               function add_account2Group($accountID, $groupID)
+               function add_account2group($accountID, $groupID)
                {
                        if ($accountID && $groupID)
                        {

Index: inc/accounts/class.accounts_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/accounts/class.accounts_sql.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- inc/accounts/class.accounts_sql.inc.php     11 Apr 2006 21:32:38 -0000      
1.11
+++ inc/accounts/class.accounts_sql.inc.php     6 Aug 2006 04:51:26 -0000       
1.12
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.accounts_sql.inc.php,v 1.11 2006/04/11 21:32:38 
skwashd Exp $
+       * @version $Id: class.accounts_sql.inc.php,v 1.12 2006/08/06 04:51:26 
skwashd Exp $
        */
 
        /**
@@ -200,18 +200,6 @@
                        return $accounts;
                }
 
-               function get_members()
-               {
-                       $sql = "SELECT acl_account FROM phpgw_acl WHERE 
acl_appname = 'phpgw_group' and acl_location =" . intval($this->account_id);
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $members[] =  $this->db->f('acl_account');
-                       }
-
-                       return $members;
-               }
-               
                function name2id($account_lid)
                {
                        static $name_list;

Index: templates/idots/css.tpl
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/templates/idots/css.tpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- templates/idots/css.tpl     30 Dec 2004 06:47:34 -0000      1.4
+++ templates/idots/css.tpl     6 Aug 2006 04:51:26 -0000       1.5
@@ -1,5 +1 @@
-<style type="text/css">
-<!--
-       {app_css}
--->
-</style>
+

Index: templates/idots/head.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/templates/idots/head.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- templates/idots/head.inc.php        19 Jul 2006 01:40:11 -0000      1.11
+++ templates/idots/head.inc.php        6 Aug 2006 04:51:26 -0000       1.12
@@ -7,6 +7,12 @@
        * @subpackage gui
        * @version $Id: head.inc.php,v 1.4 2004/12/30 06:47:34 skwashd Exp 
        */
+       
+       if ( !isset($GLOBALS['phpgw_info']['server']['site_title']) )
+       {
+               $GLOBALS['phpgw_info']['server']['site_title'] = lang('please 
set a site name in admin &gt; siteconfig');
+       }
+       
        $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
        $GLOBALS['phpgw']->template->set_unknowns('remove');
        $GLOBALS['phpgw']->template->set_file('head', 'head.tpl');
@@ -45,20 +51,19 @@
                        $GLOBALS['phpgw']->template->set_var('theme_style', 
$style);
                        $GLOBALS['phpgw']->template->parse('theme_stylesheets', 
'theme_stylesheet', true);
                }
-       }
 
        $app = $app ? ' ['.(isset($GLOBALS['phpgw_info']['apps'][$app]) ? 
$GLOBALS['phpgw_info']['apps'][$app]['title'] : lang($app)).']':'';
 
        $GLOBALS['phpgw']->template->set_var(array
        (
                'css'                   => $GLOBALS['phpgw']->common->get_css(),
-               'java_script'   => $GLOBALS['phpgw']->common->get_java_script(),
+                       'javascript'    => 
$GLOBALS['phpgw']->common->get_javascript(),
                'img_icon'      => PHPGW_IMAGES_DIR . '/favicon.ico',
                'img_shortcut'  => PHPGW_IMAGES_DIR . '/favicon.ico',
-               'font_family'   => $GLOBALS['phpgw_info']['theme']['font'],
                'str_base_url'  => $GLOBALS['phpgw']->link('/'),                
-               'website_title' => 
$GLOBALS['phpgw_info']['server']['site_title'].$app,
+                       'website_title' => 
$GLOBALS['phpgw_info']['server']['site_title'] . $app,
                'win_on_events' => $GLOBALS['phpgw']->common->get_on_events(),
        ));
+       }
        $GLOBALS['phpgw']->template->pfp('out','head');
 ?>

Index: templates/idots/head.tpl
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/templates/idots/head.tpl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- templates/idots/head.tpl    24 Apr 2006 09:49:25 -0000      1.9
+++ templates/idots/head.tpl    6 Aug 2006 04:51:26 -0000       1.10
@@ -14,14 +14,14 @@
                 <link href="{theme_style}" type="text/css" rel="StyleSheet" />
                 <!-- END theme_stylesheet -->
                <title>{website_title}</title>
-               {java_script}
+               {javascript}
                <script type="text/javascript">
-                       //<![CDATA[
+               //<!--
 
                        var strBaseURL = '{str_base_url}';
 
-                       //]]>
                        {win_on_events}
+               //-->
                </script>
        </head>
        <body>

Index: templates/idots/navbar.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/templates/idots/navbar.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- templates/idots/navbar.inc.php      23 Jul 2006 07:21:07 -0000      1.11
+++ templates/idots/navbar.inc.php      6 Aug 2006 04:51:26 -0000       1.12
@@ -5,7 +5,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage gui
-       * @version $Id: navbar.inc.php,v 1.11 2006/07/23 07:21:07 skwashd Exp $
+       * @version $Id: navbar.inc.php,v 1.12 2006/08/06 04:51:26 skwashd Exp $
        */
 
 
@@ -29,10 +29,9 @@
                
$GLOBALS['phpgw']->template->set_block('navbar','navbar_footer','navbar_footer');
 
                $var['img_root'] = 
$GLOBALS['phpgw_info']['server']['webserver_url'] . 
'/phpgwapi/templates/idots/images';
-               $var['table_bg_color'] = 
$GLOBALS['phpgw_info']['theme']['navbar_bg'];
 
                $applications = '';
-               $items++;
+               $items = 0;
 
 //_debug_array($GLOBALS['phpgw_info']['navbar']);
 
@@ -75,7 +74,9 @@
                        
$var['current_app_title']=$GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title'];
                }
 
-               if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers'])
+               if (isset($GLOBALS['phpgw_info']['navbar']['admin']) 
+                       && 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers'])
+                       && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers'] )
                {
                        $var['current_users'] = '<a href="'
                        . 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions')
 . '">'
@@ -84,15 +85,17 @@
                $now = time();
                $var['user_info'] = 
'<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - '
                . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' '
-               . 
$GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+               . $GLOBALS['phpgw']->common->show_date($now, 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
 
-               if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0)
+               if ( 
!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) 
+                       || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] 
== 0)
                {
                        $api_messages = lang('You are required to change your 
password during your first login')
                        . '<br> Click this image on the navbar: <img src="'
                        . 
$GLOBALS['phpgw']->common->image('preferences','navbar').'">';
                }
-               else if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < 
time() - (86400*30))
+               else if ( 
isset($GLOBALS['phpgw_info']['user']['lastpasswd_change'])
+                       && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] 
< time() - (86400*30))
                {
                        $api_messages = lang('it has been more then %1 days 
since you changed your password',30);
                }
@@ -126,10 +129,12 @@
                $GLOBALS['phpgw']->template->pparse('out','navbar_footer');
 
                // If the application has a header include, we now include it
-               if (address@hidden'phpgw_info']['flags']['noappheader'] && 
@isset($_GET['menuaction']))
+               if ( (!isset($GLOBALS['phpgw_info']['flags']['noappheader'])
+                       || !$GLOBALS['phpgw_info']['flags']['noappheader'] )
+                       && isset($_GET['menuaction']) )
                {
                        list($app,$class,$method) = 
explode('.',$_GET['menuaction']);
-                       if (is_array($GLOBALS[$class]->public_functions) && 
$GLOBALS[$class]->public_functions['header'])
+                       if (is_array($GLOBALS[$class]->public_functions) && 
isset($GLOBALS[$class]->public_functions['header']) )
                        {
                                $GLOBALS[$class]->header();
                        }
@@ -157,8 +162,12 @@
                        $GLOBALS['phpgw']->template->set_var($var);
                        
$GLOBALS['phpgw']->template->pfp('out','extra_blocks_header');
                        
-                       foreach($file as $null => $item)
+                       foreach($file as $item)
                        {
+                               if ( !isset($item['image']) )
+                               {
+                                       $item['image'] = '';
+                               }
                                sidebox_menu_item($item['url'], $item['text'], 
$item['image'], $use_lang);
                        }
 
@@ -197,23 +206,24 @@
        * Parse navigation bar end
        * @ignore
        */
+       /**
+       * Parse navigation bar end
+       * @ignore
+       */
        function parse_navbar_end()
        {
-               $GLOBALS['phpgw']->template = 
createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
+               $GLOBALS['phpgw']->hooks->process('navbar_end');
 
-               $GLOBALS['phpgw']->template->set_file(
-                       array(
-                               'footer' => 'footer.tpl'
-                       )
-               );
-               $var = Array(
+               $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
+               $GLOBALS['phpgw']->template->set_file('footer', 'footer.tpl');
+
+               $var = array
+               (
                        'img_root'              => 
$GLOBALS['phpgw_info']['server']['webserver_url'] . 
'/phpgwapi/templates/idots/images',
-                       'table_bg_color'        => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'powered_by'    => lang('Powered by phpGroupWare 
version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']),
                        'version'               => 
$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
                );
-               $GLOBALS['phpgw']->hooks->process('navbar_end');
-
-               $var['powered_by'] = lang('Powered by phpGroupWare version 
%1',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
                $GLOBALS['phpgw']->template->set_var($var);
                $GLOBALS['phpgw']->template->pfp('out','footer');
        }
+?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]