[dev] Littles questions for using API's methods

Jan Schneider jan at horde.org
Mon Jun 11 14:58:13 UTC 2012


Install Xdebug and you should get a backtrace with function call  
parameter that would help identifying the broken event.

Zitat von Gerard Breiner <gerard.breiner at ias.u-psud.fr>:

> Hello,
>
> I come here back for saying my script works and do what he is  
> supposed to do? I think to have identified the calendar for which  
> "calendar/exportCalendars" rise the error  "Double timezone  
> specification".
> Is there a way for identifying what is not clean inside this calendar ?
>
> Many thanks in advance.
>
> Best regards.
>
> Gérard
>
>
> Le 6 juin 2012 à 17:08, Gerard Breiner a écrit :
>
>> Many thanks Jan, Mike?.
>>
>> I picked up a few pieces of code and now I might expect  to get an  
>> export of all the calendar but I'm facing an error when I run  
>> 'calendar/exportCalendars' method :
>> It seems this error occurs for calendars whose owners has never  
>> create an event.
>>
>> Fatal Error:
>> DateTime::__construct(): Failed to parse time string (-001-11-01)  
>> at position 7 (-): Double timezone specification
>>
>> It seems this error is raised at :
>> DateTime->__construct() /www/horde4/pear/php/Horde/Date/Utils.php:58
>>
>> At this time my code is :
>>
>> [CODE]
>> #!/usr/bin/env php
>> <?php
>> set_include_path('/www/horde4/pear/php' . PATH_SEPARATOR .  
>> get_include_path());
>> if (file_exists(dirname(__FILE__) .  
>> '/../../kronolith/lib/Application.php')) {
>>    $baseDir = dirname(__FILE__) . '/../';
>> } else {
>>    require_once 'PEAR/Config.php';
>>    $baseDir = PEAR_Config::singleton()
>>        ->get('horde_dir', null, 'pear.horde.org') . '/kronolith/';
>> }
>>
>> require_once dirname(__FILE__) . '/../lib/Application.php';
>> Horde_Registry::appInit('kronolith', array(
>>    'cli' => true
>> ));
>> // Call a Registry method.
>> // Retrieve a list of users associated with each calendar, and
>>    // thus a list of users who have used kronolith and
>>    // potentially have an agenda preference set.
>>    $calendars = $GLOBALS['kronolith_shares']->listAllShares();
>>    $users = array();
>>    foreach (array_keys($calendars) as $calendarId) {
>>        try {
>>            $calendar = $GLOBALS['kronolith_shares']->getShare($calendarId);
>>        } catch (Exception $e) {
>>            continue;
>>        }
>>        $users = array_merge($users,  
>> $calendar->listUsers(Horde_Perms::READ));
>>    }
>> // Remove duplicates.
>>    $users = array_unique($users);
>>
>> // Tell the registry that we are doing authentication ourselves.
>> define('AUTH_HANDLER', true);
>>
>> $contentType = 'text/calendar';
>> foreach ($users as $user) {
>>   $registry->setAuth($user, array('password' => ''));
>>   $cals[$user] = $registry->call('calendar/listCalendars',  
>> array('true', 'HORDE_PERMS::READ'));
>>   if ($cals[$user]['0'] != '') {
>>       $export[$user] = $registry->call('calendar/exportCalendar',  
>> array($cals[$user]['0'], $contentType, 'Horde_Perms::READ'));
>>       $file = '/home/webadm/exportCalendars/' . $user . '.ics';
>>       $hdl = fopen($file, a);
>>       fwrite($hdl, $export[$user]);
>>   }
>>
>> }
>> fclose($hdl);
>> [/CODE]
>>
>> Best regards.
>>
>> Gérard
>>
>>
>> Le 4 juin 2012 à 17:20, Michael J Rubinsky a écrit :
>>
>>
>>>
>>> Quoting Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>>>
>>>> Hello Mike,
>>>>
>>>> Thanks for these precisions? It make me understand what Jan meant?
>>>> I will try soon to reduce registry.local.php and kept only what  
>>>> is necessary.
>>>>
>>>> I have another question about calendar permissions and listCalendars.
>>>> In the admin interface admin/perms I have assigned the  
>>>> permissions 'show' and 'read' to allow the user webadm access to  
>>>> all agendas.
>>>> I dont understand why with the below code I do not list all the  
>>>> calendars but only the others users shares with "webadm" user? It  
>>>> is like the perms I setup has not been validated.
>>>
>>> Permissions for calendars are set by the owner of the calendar,  
>>> from within Kronolith - not from the administrative interface.  
>>> Look on the calendar's property view.
>>>
>>>
>>> --
>>> mike
>>>
>>> The Horde Project (www.horde.org)
>>> mrubinsk at horde.org
>>
>> --
>> dev mailing list
>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org

-- 
Jan Schneider
The Horde Project
http://www.horde.org/




More information about the dev mailing list