[kronolith] How to serialize calendar entries in prefs.php
Chuck Hagenbuch
chuck at horde.org
Thu Aug 9 16:01:27 UTC 2007
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