Copyright 2009-2016 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you did not
receive this file, see
http://www.horde.org/licenses/lgpl21.
public function testDispatchError() { $e = new Horde_Kolab_FreeBusy('DOESNOTEXISTS', 'DOESNOTEXIST', array('writer' => array('class' => 'Horde_Controller_ResponseWriter_WebDebug'))); ob_start(); $e->dispatch(); $output = ob_get_clean(); $this->assertContains('Class Horde_Kolab_FreeBusy_DOESNOTEXISTS_Factory_DOESNOTEXIST does not exist', $output); }
/** * Test triggering a folder. * * @return NULL */ public function testTriggering() { $this->markTestIncomplete(); $params = array('script' => '/freebusy/freebusy.php', 'request' => array('params' => array('server' => array('REQUEST_URI' => '/freebusy/test@example.com/Kalender.pxfb'))), 'logger' => array('Horde_Log_Handler_Null' => array())); $application = new Horde_Kolab_FreeBusy('Kolab', 'Freebusy', $params); ob_start(); $application->dispatch(); $output = ob_get_clean(); $this->assertEquals('', $output); }
/** * Test triggering the folder of another user. * * @return NULL */ public function testForeignTrigger() { $start = time(); $this->_addEvent($start); $this->assertTrue($this->auth->authenticate('*****@*****.**', array('password' => 'test'))); $_GET['folder'] = 'wrobel@example.org/Calendar'; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $view = $fb->trigger(); $this->assertEquals('Horde_Kolab_FreeBusy_View_vfb', get_class($view)); $vcal = $view->_data['fb']; $vfb = $vcal->findComponent('VFREEBUSY'); $p = $vfb->getBusyPeriods(); $this->assertTrue($p[$start] == $start + 120); }
<?php /** * The web entry point for the Kolab free/busy system. * * Copyright 2004-2009 Klarälvdalens Datakonsult AB * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see * http://www.horde.org/licenses/lgpl21. * * PHP version 5 * * @category Kolab * @package Kolab_FreeBusy * @author Thomas Arendsen Hein <*****@*****.**> * @author Steffen Hansen <*****@*****.**> * @author Gunnar Wrobel <*****@*****.**> * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @link http://pear.horde.org/index.php?package=Kolab_FreeBusy */ /** * The Autoloader allows us to omit "require/include" statements. */ require_once 'Horde/Autoloader.php'; /** Dispatch the request. */ $params = array('config' => array('dir' => __DIR__ . '/config')); $application = Horde_Kolab_FreeBusy::singleton($params); $application->dispatch();
public function dispatch($url, $params = array(), $inject = array()) { $params = array_merge(array('script' => '/freebusy/freebusy.php', 'request' => array('class' => 'Horde_Controller_Request_Mock', 'params' => array('server' => array('REQUEST_URI' => $url))), 'logger' => array('Horde_Log_Handler_Null' => array())), $params); $injector = $this->getInjector(); $injector->setInstance('Horde_Kolab_FreeBusy_UserDb', $this->getDb()); if (!empty($inject)) { foreach ($inject as $interface => $instance) { $injector->setInstance($interface, $instance); } } $params['injector'] = $injector; $application = new Horde_Kolab_FreeBusy('Freebusy', 'Kolab', $params); ob_start(); $application->dispatch(); return ob_get_clean(); }
/** * Handle a "when" step. * * @param array &$world Joined "world" of variables. * @param string $action The description of the step. * @param array $arguments Additional arguments to the step. * * @return mixed The outcome of the step. */ public function runWhen(&$world, $action, $arguments) { switch ($action) { case 'adding an event to a folder': $world['result']['add_event'][] = $this->addEvent($arguments[0], $arguments[1]); break; case 'triggering the folder': include_once 'Horde/Kolab/FreeBusy.php'; $_GET['folder'] = $arguments[0]; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $world['result']['trigger'] = $fb->trigger(); break; case 'fetching the free/busy information for': include_once 'Horde/Kolab/FreeBusy.php'; $_GET['uid'] = $arguments[0]; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $world['result']['fetch'] = $fb->fetch(); break; default: return parent::runWhen($world, $action, $arguments); } }
<?php /** * A script for triggering an update of the Kolab Free/Busy information. * * This script generates partial free/busy information based on a * single calendar folder on the Kolab groupware server. The partial * information is cached and later assembled for display by the * freebusy.php script. * * Copyright 2004-2009 Klarälvdalens Datakonsult AB * * @author Steffen Hansen <*****@*****.**> * @author Gunnar Wrobel <*****@*****.**> * @author Thomas Arendsen Hein <*****@*****.**> * @package Kolab_FreeBusy */ /** Load the required free/busy library */ require_once 'Horde/Kolab/FreeBusy.php'; /** Load the configuration */ require_once 'config.php'; $fb = new Horde_Kolab_FreeBusy(); $view = $fb->trigger(); $view->render();
* @package Kolab_FreeBusy */ /** Report all errors */ error_reporting(E_ALL); /** requires safe_mode to be turned off */ ini_set('memory_limit', -1); /** * Load the required free/busy libraries - this also loads Horde:: and * Horde_Util:: as well as the PEAR constants */ require_once 'Horde/Kolab/FreeBusy.php'; require_once 'Horde/Kolab/FreeBusy/Report.php'; /** Load the configuration */ require_once 'config.php'; $conf['kolab']['misc']['allow_special'] = true; if (empty($_SERVER['SERVER_NAME'])) { $_SERVER['SERVER_NAME'] = $conf['kolab']['imap']['server']; } $fb_reporter = new Horde_Kolab_FreeBusy_Report(); $fb_reporter->start(); $fb = new Horde_Kolab_FreeBusy(); $result = $fb->regenerate($fb_reporter); if (is_a($result, 'PEAR_Error')) { echo $result->getMessage(); exit(1); } $result = $fb_reporter->stop(); if ($result === false) { exit(1); } exit(0);