<?php
/**
 * $Horde: kronolith/fb.php,v 1.13 2003/06/19 18:47:40 chuck Exp $
 *
 * Copyright 1999-2003 Charles J. Hagenbuch <chuck@horde.org>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

define('KRONOLITH_BASE', dirname(__FILE__));
require_once KRONOLITH_BASE . '/lib/base.php';
require_once HORDE_BASE . '/lib/Data/imc.php';
require_once HORDE_BASE . '/lib/Cache.php';

// Determine the username to show free/busy time for.
if (!empty($_SERVER['PATH_INFO'])) {
    $cal = basename($_SERVER['PATH_INFO']);
} else {
    $cal = Horde::getFormData('c');
}

$cache = &Horde_Cache::singleton($conf['cache']['driver']);
$key = 'kronolith.fb.' . Auth::getAuth() . '.' . $cal;

header('Content-Type: text/calendar');
if (is_a($fb = $cache->printData($key, "Kronolith::generateFreeBusy('$cal');", 360), 'PEAR_Error')) {
    Horde::logMessage($fb, __FILE__, __LINE__, PEAR_LOG_ERR);
}
