[kronolith] Further work on kronolith/lib/api.php

Matthew Sackman matthew at sackman.co.uk
Sun Apr 20 01:37:20 PDT 2003


Hello yet again,

I've now managed to get the _kronolith_import_vevent to work correctly
from xml_rpc. In that function I require horde/lib/iCalendar.php and
horde/lib/iCalendar/vevent.php

Then I create a new Horde_iCalendar_vevent object and then call
parsevCalendar on the $vevent passed to the function. This then works,
though is probably not the 'right' way of doing things:

function _kronolith_import_vevent($veventR, $cal = null)
{
    require_once dirname(__FILE__) . '/base.php';
    require_once dirname(__FILE__) . '/../../lib/iCalendar.php';
    require_once dirname(__FILE__) . '/../../lib/iCalendar/vevent.php';
    global $calendar, $prefs;

    // Set the calendar to the user's default calendar if none is
    // specified, and check for permissions to that calendar.
    if (is_null($cal)) {
        $cal = $prefs->getValue('default_share');
    }
    if (!array_key_exists($cal, Kronolith::listCalendars(false,
_PERMS_EDIT))) {
        return PEAR::raiseError(_("Permission Denied"));
    }
    $calendar->open($cal);

    $vevent = new Horde_iCalendar_vevent();
    $vevent->parsevCalendar($veventR);

...

If I shouldn't be making these changes to api.php but should be making
them elsewhere in some file which has closer workings with the xml_rpc
layer rather than the generic api then please let me know. I would
imagine that the API shouldn't require objects which are unique to Horde
as arguments, so by that justification, my changes are valid in api.php.

Many thanks,

Matthew
-- 
Matthew Sackman

BOFH excuse #275:
Bit rot


More information about the kronolith mailing list