phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18593] Fix a wrong cloning issue (clone only when ne


From: Caeies
Subject: [Phpgroupware-cvs] [18593] Fix a wrong cloning issue (clone only when needed), fix a notice about strpos -> this is a symptom either of a broken acl class, so I won' t touch it waiting for it to be fixed, or that people fixes the preferences system : see the preferences/inc/ class.uiaclprefs.inc.php, thanks :)
Date: Wed, 04 Jun 2008 17:40:04 +0000

Revision: 18593
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18593
Author:   Caeies
Date:     2008-06-04 17:40:03 +0000 (Wed, 04 Jun 2008)

Log Message:
-----------
Fix a wrong cloning issue (clone only when needed), fix a notice about strpos 
-> this is a symptom either of a broken acl class, so I won't touch it waiting 
for it to be fixed, or that people fixes the preferences system : see the 
preferences/inc/class.uiaclprefs.inc.php, thanks :)

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.acl.inc.php

Modified: trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.acl.inc.php        2008-06-04 17:34:53 UTC (rev 
18592)
+++ trunk/phpgwapi/inc/class.acl.inc.php        2008-06-04 17:40:03 UTC (rev 
18593)
@@ -48,7 +48,7 @@
                /**
                * @var object $db2 cloned database object
                */
-               var $bb2;
+               var $db2;
 
                /**
                * @var string like ???
@@ -74,8 +74,14 @@
                */
                function acl($account_id = 0)
                {       
+                       //XXX Caeies : 1) If we have already initialized this 
object, don't need to clone db object 
+                       //2) for each change of account we do a new unneeded 
cloning
+                       //New code should fix this later.
+                       if($account_id !== 0 && $this->account_id == 
intval($account_id))
+                       {
+                               return;
+                       }
                        $this->db =& $GLOBALS['phpgw']->db;
-                       $this->db2 = clone($this->db);
 
                        $this->like =& $this->db->like;
                        $this->join =& $this->db->join;
@@ -426,7 +432,7 @@
                                        if ( 
isset($this->data[$this->account_id][$idx]['account'])
                                                && 
$this->data[$this->account_id][$idx]['account'] == $this->account_id
                                                && 
(($this->data[$this->account_id][$idx]['appname'] == $appname
-                                               && 
strpos($this->data[$this->account_id][$idx]['location'],$location)===0)
+                                               && !empty($location) && 
strpos($this->data[$this->account_id][$idx]['location'],$location)===0)
                                                || (!$location && 
$this->data[$this->account_id][$idx]['location']=='run')))
                                        {
                                                $sql = 'INSERT INTO phpgw_acl 
(acl_appname, acl_location, acl_account, acl_rights,acl_grantor,acl_type)';
@@ -928,6 +934,14 @@
                */
                function get_ids_for_location($location, $required, $app = '')
                {
+                       if(!is_object($this->db2))
+                       {
+                               if(!is_object($this->db))
+                               {
+                                       _debug_array(debug_backtrace());
+                               }
+                               $this->db2 = clone($this->db);
+                       }
                        if ($app == '')
                        {
                                $app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];






reply via email to

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