[kronolith] Shared Calendars - other people's pref values

Akom lists@akom2.2y.net
Fri, 13 Sep 2002 09:51:28 -0400


When you share a calendar, the other person needs to access your values for things like "event_colors" and custom categories, etc.  This is done in Kronolith.php by checking who owns the stuff, etc.  If the owner has the values set in their options, then all works well.  Unfortunately if the owner of the calendar doesn't - problems begin.  Here is the problem code:

(Kronolith.php::getPrefsByShare())
-----------------------
   function getPrefByShare($pref)
    {
        global $prefs, $registry, $currentShare;

        $c = parse_url($_SERVER['PHP_SELF']);
        if (preg_match('|prefs.php$|', $c['path'])) {
            return $prefs->getValue($pref);
        } else {
            $owner = $currentShare->getOwner();
            if ($owner != Auth::getAuth()) {
                $_prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
                                            $registry->getApp(),
                                            $owner, '');

                $_prefs->setDefaults($registry->getParam('fileroot', 'horde') . '/config/prefs.php');
                $_prefs->setDefaults($registry->getParam('fileroot') . '/config/prefs.php');
                return $_prefs->getPref($owner, $pref, $registry->getApp());
            } else {
                return $prefs->getValue($pref);
            }
        }
    }
----------------------
As you can see, if the owner doesn't have it set, this will still return the owner's value, which will be null, causing things to break. 

Here is my "patch":
Index: Kronolith.php
===================================================================
RCS file: /repository/kronolith/lib/Kronolith.php,v
retrieving revision 1.65
diff -r1.65 Kronolith.php
839c839,844
<                 return $_prefs->getPref($owner, $pref, $registry->getApp());
---
>                 $r = $_prefs->getPref($owner, $pref, $registry->getApp());
>                 if (!$r) {
>                     return $prefs->getValue($pref);
>                 } else {
>                     return $r;
>                 }
--------------------

This fixed it for me.

Akom

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/