phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.common.inc.php class.contact...


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc class.common.inc.php class.contact...
Date: Sat, 09 Sep 2006 11:43:15 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/09/09 11:43:15

Modified files:
        inc            : class.common.inc.php class.contacts_sql.inc.php 

Log message:
        notices and other cleanups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.common.inc.php?cvsroot=phpgwapi&r1=1.241&r2=1.242
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.contacts_sql.inc.php?cvsroot=phpgwapi&r1=1.32&r2=1.33

Patches:
Index: class.common.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.common.inc.php,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -b -r1.241 -r1.242
--- class.common.inc.php        3 Sep 2006 06:15:26 -0000       1.241
+++ class.common.inc.php        9 Sep 2006 11:43:15 -0000       1.242
@@ -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.241 2006/09/03 06:15:26 
skwashd Exp $
+       * @version $Id: class.common.inc.php,v 1.242 2006/09/09 11:43:15 
skwashd Exp $
        */
 
        /**
@@ -885,7 +885,7 @@
                        if ( !(isset($this->found_files[$appname]) && 
is_array($this->found_files[$appname]) ) )
                        {
                                $imagedir_default       = 
"/{$appname}/templates/base/images";
-                               $imagedir               = 
"/{$appname}/templates/{$GLOBALS['phpgw_info']['server']['template_set']}/images";
+                               $imagedir = 
"/{$appname}/templates/{$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']}/images";
 
                                if 
(@is_dir(PHPGW_INCLUDE_ROOT.$imagedir_default))
                                {
@@ -1049,10 +1049,10 @@
                                                
$GLOBALS['phpgw_info']['navbar'][$app]['icon_hover']  = 
$this->image($app,Array('navbar','nonav'));
                                        }
 
-//                                     
if($GLOBALS['phpgw_info']['navbar'][$app]['icon'] == '')
-//                                     {
-//                                             
$GLOBALS['phpgw_info']['navbar'][$app]['icon']  = 
$this->image('phpgwapi','nonav');
-//                                     }
+                                       
if($GLOBALS['phpgw_info']['navbar'][$app]['icon'] == '')
+                                       {
+                                               
$GLOBALS['phpgw_info']['navbar'][$app]['icon']  = 
$this->image('phpgwapi','nonav');
+                                       }
                                }
                        }
                        if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'home' || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences' || 
$GLOBALS['phpgw_info']['flags']['currentapp'] == 'about')
@@ -1073,9 +1073,9 @@
                        }
 
                        // We handle this here becuase its special
-                       $GLOBALS['phpgw_info']['navbar']['about']['title'] = 
lang('About %1',$app_title);
+                       $GLOBALS['phpgw_info']['navbar']['about']['title'] = 
lang('About %1', $app_title);
 
-                       $GLOBALS['phpgw_info']['navbar']['about']['url']   = 
$GLOBALS['phpgw']->link('/about.php','app='.$app);
+                       $GLOBALS['phpgw_info']['navbar']['about']['url']   = 
$GLOBALS['phpgw']->link('/about.php', array('app' => $app) );
                        $GLOBALS['phpgw_info']['navbar']['about']['icon']  = 
$this->image('phpgwapi',Array('about','nonav'));
                        $GLOBALS['phpgw_info']['navbar']['about']['icon_hover'] 
 = $this->image_on('phpgwapi',Array('about','nonav'),'-over');
 
@@ -1088,13 +1088,13 @@
                /**
                * Load header.inc.php for an application
                */
-               /*function app_header()
+               function app_header()
                {
                        if (file_exists(PHPGW_APP_INC . '/header.inc.php'))
                        {
                                include(PHPGW_APP_INC . '/header.inc.php');
                        }
-               }*/
+               }
 
                /**
                * Load the phpgw header

Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- class.contacts_sql.inc.php  3 Sep 2006 06:15:27 -0000       1.32
+++ class.contacts_sql.inc.php  9 Sep 2006 11:43:15 -0000       1.33
@@ -6,7 +6,7 @@
        * @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.32 2006/09/03 06:15:27 
skwashd Exp $
+       * @version $Id: class.contacts_sql.inc.php,v 1.33 2006/09/09 11:43:15 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        */
 
@@ -600,6 +600,16 @@
                var $_contact_person;
                var $_contact_org;
 
+               /**
+               * @var bool $LDAPSyncEnabled synchronise contact with LDAP on 
add/edit/delete
+               */
+               var $LDAPSyncEnabled = false;
+
+               /**
+               * @var array $locked list of currently locked tables
+               */
+               var $locked = array();
+
                function contacts_($session=True)
                {
                        $this->db = &$GLOBALS['phpgw']->db;
@@ -2323,7 +2333,7 @@
                function add_contact($type, $principal=array(), $comms=array(), 
$locations=array(), $categories=array(), $others=array(), 
$contact_relations=array(), $notes=array())
                {
                        $this->contact = 
createObject('phpgwapi.contact_central');
-                       $owner = 
$principal['owner']?$principal['owner']:$GLOBALS['phpgw_info']['user']['account_id'];
+                       $owner = isset($principal['owner']) && 
$principal['owner'] ? $principal['owner'] : 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->lock_table($this->contact->table);
 
                        $this->contact->insert(array('owner' => $owner,
@@ -2495,6 +2505,7 @@
                */
                function add_orgs_for_person($organizations, $preferred_org, 
$addr_id, $cid, $action=PHPGW_SQL_RETURN_SQL)
                {
+                       $sql = array();
                        if(is_array($organizations))
                        {
                                foreach($organizations as $org)
@@ -3090,7 +3101,11 @@
 
                function get_categories($categories)
                {
-                       if (is_array($categories))
+                       if ( is_array($categories) && !count($categories) )
+                       {
+                               return '';
+                       }
+                       if ( is_array($categories) && count($categories) )
                        {
                                return count($categories) > 1 ? 
','.implode(',',$categories).',' : $categories[0];
                        }
@@ -3271,6 +3286,7 @@
 
                function get_account_id($contact_id)
                {
+                       $account_id = 0;
                        $accounts = $GLOBALS['phpgw']->accounts->get_list();
                        foreach($accounts as $account_data)
                        {
@@ -3632,7 +3648,7 @@
 
                function check_perms($has, $needed)
                {
-                       return (!!($has & $needed) == True);
+                       return !!($has & $needed);
                }
 
                /**
@@ -3650,7 +3666,13 @@
                        {
                                $owner_id = 
$this->get_contact_owner($contact_id);
                        }
-                       return($this->check_perms($grants[$owner_id],$needed) 
|| $GLOBALS['phpgw']->acl->check('addressmaster',7,'addressbook'));
+
+                       if ( !isset($grants[$owner_id]) )
+                       {
+                               $grants[$owner_id] = 0;
+                       }
+
+                       return ($this->check_perms($grants[$owner_id],$needed) 
|| $GLOBALS['phpgw']->acl->check('addressmaster',7,'addressbook'));
                }
 
                /**
@@ -3847,18 +3869,24 @@
                */
                function display_name($field)
                {
-                       if($this->contact_fields['showable'])
+                       if ( isset($this->contact_fields['showable']) 
+                               && 
isset($this->contact_fields['showable'][$field]) )
                        {
-                               return 
$GLOBALS['phpgw']->lang($this->contact_fields['showable'][$field]);
+                               return 
lang($this->contact_fields['showable'][$field]);
                        }
-                       if($this->contact_fields['retreivable'])
+
+                       if ( isset($this->contact_fields['retreivable']) 
+                               && 
isset($this->contact_fields['retreivable'][$field]) )
                        {
-                               return 
$GLOBALS['phpgw']->lang($this->contact_fields['retrievable'][$field]);
+                               return 
lang($this->contact_fields['retrievable'][$field]);
                        }
-                       if($this->contact_fields['catalogs'])
+
+                       if ( isset($this->contact_fields['catalogs']) 
+                               && 
isset($this->contact_fields['catalogs'][$field]) )
                        {
-                               return 
$GLOBALS['phpgw']->lang($this->contact_fields['catalogs'][$field]);
+                               return 
lang($this->contact_fields['catalogs'][$field]);
                        }
+                       return lang($field);
                }
 
                /**
@@ -3901,7 +3929,8 @@
 
                function lock_table($table, $action=PHPGW_SQL_RUN_SQL)
                {
-                       if (!($this->locked[$table]) && $action == 
PHPGW_SQL_RUN_SQL)
+                       if ( ( !isset($this->locked[$table]) || 
!$this->locked[$table] )
+                               && $action == PHPGW_SQL_RUN_SQL)
                        {
                                $this->db->lock($table);
                                $this->locked[$table] = TRUE;
@@ -4035,7 +4064,8 @@
 
                function finalize_edit($id)
                {
-                       if ($this->LDAPSyncEnabled)
+                       if (isset($this->LDAPSyncEnabled)
+                               && $this->LDAPSyncEnabled )
                        {
                                $this->LDAPSync($id);
                        }




reply via email to

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