HordeTurbaAddressbookFix

From xbe wiki

Jump to: navigation, search

[edit] Addressbook Fix for Turba/IMP (Sources)

[edit] Why?

IMP and Turba misbehaved after database change to UTF8.. Don't know why, but it just sucked. And i didn't want to really diagnostic it as it pissed my off - i fiddled for days in order to really find the problem.

What I do know is, that it has something to do with the sources. All my addresses were saved in the MySQL turba table, but Turba always got the request from IMP to deliver addresses from prefs - and they weren't there. A problematic situation as IMP address lookups didn't work.

[edit] Fix

File: turba/lib/api.php, starting around line ~520

<?php

function _turba_import($content$contentType 'array'$source null)
{
    require_once dirname(__FILE__) . '/base.php';
    global $cfgSources$prefs;

    /* Get default address book from user preferences. */
    if (empty($source)) {
        $source $prefs->getValue('default_dir');
        /* On new installations default_dir is not set. */
        /* Use first source instead. */
        if (empty($source)) {
            $source array_keys($cfgSources);
            $source $source[0];
        }
    }

    $source "localsql"// NEW LINE!!

    // Check existance of and permissions on the specified source.
    if (!isset($cfgSources[$source])) {
        return PEAR::raiseError(sprintf(_("Invalid address book: %s"), $source), 'horde.warning');
    }

?>

This is an absolutely quickfix to be sure that turba picks the correct source. It also comes with the need to modify it again with every update - arrg! ;-)

Personal tools