[kronolith] How to serialize calendar entries in prefs.php

Rich Hutchinson rich at adastral.ucl.ac.uk
Thu Aug 9 16:11:54 UTC 2007


Thanks for that, Chuck.

I've tried setting the value for a user, then copying it out of MySQL
but the value for each user's calendar is obviously different for each
person. I don't want each user to be able to see other people's
calendars (except the explicitly shared one)

What I want is some way of being able to use a kind of wildcard to
substitute for the correct one.

I need each individual user's own calendar, PLUS the shared one to be
shown...

Chuck Hagenbuch wrote:
> Quoting Rich Hutchinson <rich at adastral.ucl.ac.uk>:
>
>   
>> I'm looking to include some default user prefs inside
>> kronolith/config/prefs.php for the following options:
>>
>> display_cals - to display selected calendars by default
>> fb_cals - to choose which calendars are used for free/busy info
>>
>> For instance, say I had configured a shared calendar (or shared address
>> book) which has the id "abc123", I'd like it so that both this
>> calendar/address book and the user's own default calendar are
>> displayed/included in the preference.
>>
>> I can't work out how to format the serialization, however. I know for
>> the calendar that it should be something like the form:
>>
>> a:2:{i:0;s:9:"username";i:1;s:32:"abc123";}
>>
>> How do you get the correct serialization for the first (user's default)
>> calendar? Obviously, the second one will always be in the form:
>> i:1;s:32:"abc123";
>>
>> I've tried variations on "Auth::GetAuth()" in place of the username etc
>> but nothing seems to work - the "s" value is different for each user too...
>>     
>
> This is a serialized PHP array - see http://php.net/serialize. The  
> easiest way to get the correct value is to set a user's preferences to  
> what you want the defaults to be, then copy that value.
>
> In general, if it's not working, it's probably because you're not  
> adjusting the s: value to be the length of the string that you're  
> putting in after it. But I strongly discourage you from mucking with  
> serialized data directly.
>
> -chuck
>   


More information about the kronolith mailing list