6.0.0-beta1
7/11/25

[#2623] Import uses wrong address book
Summary Import uses wrong address book
Queue Turba
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester tevans (at) tachometry (dot) com
Created 09/19/2005 (7235 days ago)
Due
Updated 09/19/2005 (7235 days ago)
Assigned
Resolved 09/19/2005 (7235 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
09/19/2005 08:46:46 AM Jan Schneider Comment #4 Reply to this comment
Ah true, fixed. I did this to avoid the source being set from any 
request variable (like cookie) if someone enabled register_globals.
09/19/2005 08:07:21 AM tevans (at) tachometry (dot) com Comment #3 Reply to this comment
Hi Jan -



I picked up your change to my patch, but unfortunately it doesn't 
work. The API method parameters are not registered as global 
variables, so the Util::nonInputVar method always returns null and the 
method parameter value is still overwritten.



Is there something wrong with "if (empty($source)) { ... }" that I may 
have overlooked? I want to ensure that any value currently set is not 
overwritten.



Thanks,

Tom


09/19/2005 07:35:26 AM Jan Schneider Comment #2
State ⇒ Resolved
Reply to this comment
Interesting approach, but in the end doesn't rely on more side effects 
than the former solution. Tweaked and committed, thanks.
09/19/2005 04:26:55 AM tevans (at) tachometry (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Import uses wrong address book
Queue ⇒ Turba
New Attachment: turba_source_patch.txt Download
Reply to this comment
For address book import operations (including IMP address import), the 
Turba 'default_dir' preference is always used even when the preferred 
address book is set to something else (e.g. via the IMP 'add_source' 
preference).



It appears that the turba/lib/base.php file is included in many of the 
Turba API methods (turba/lib/api.php). However, it defines a variable 
($source) that conflicts with parameters of the same name within these 
methods. In the case of an import, for example, the given method 
parameter is always superceded by the setting from base.php and all 
imports are forced into the default address book.



The attached patch simply checks to see whether the $source variable 
has already been defined, setting it to the Turba default value only 
if it is empty.



I believe this patch will fix a few other latent bugs as well:



- Delete a single entry from non-default address book fails (see _delete)

- Strange workaround for _getContact no longer needed (per patch)

- _getContacts only works for default address book

- _addField only works for default address book



Please review and advise. Thanks!

Saved Queries