From: Michael M Slusarz Date: Mon, 19 Jan 2009 06:59:52 +0000 (-0700) Subject: Remove cruft/@since/CVS tags; autoloading X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9910e685f9ac27e8205ecd78230c60ea0c58c4e8;p=horde.git Remove cruft/@since/CVS tags; autoloading --- diff --git a/kronolith/add.php b/kronolith/add.php index 09b236d2f..50e250074 100644 --- a/kronolith/add.php +++ b/kronolith/add.php @@ -1,7 +1,5 @@ + * @author Jan Schneider + * @package Kronolith */ @define('AUTH_HANDLER', true); diff --git a/kronolith/attendees.php b/kronolith/attendees.php index c4341aede..841066d18 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -1,7 +1,5 @@ * Copyright 2004-2007 Stuart Binge * @@ -11,11 +9,7 @@ @define('KRONOLITH_BASE', dirname(__FILE__)); require_once KRONOLITH_BASE . '/lib/base.php'; -require_once KRONOLITH_BASE . '/lib/FreeBusy.php'; -require_once KRONOLITH_BASE . '/lib/FBView.php'; -require_once KRONOLITH_BASE . '/lib/Imple.php'; require_once 'Horde/Identity.php'; -require_once 'Horde/UI/Tabs.php'; require_once 'Horde/Variables.php'; // Get the current attendees array from the session cache. @@ -35,7 +29,6 @@ $actionValue = Util::getFormData('actionValue'); // Perform the specified action, if there is one. switch ($actionID) { case 'add': - require_once 'Mail/RFC822.php'; $parser = new Mail_RFC822; // Add new attendees. Multiple attendees can be seperated on a single line // by whitespace and/or commas. @@ -259,7 +252,7 @@ $date = new Horde_Date($date); $vfb_html = $attendee_view->render($date); // Add the ContactAutoCompleter -Imple::factory('ContactAutoCompleter', array('triggerId' => 'newAttendees')); +Kronolith_Imple::factory('ContactAutoCompleter', array('triggerId' => 'newAttendees')); $title = _("Edit attendees"); require KRONOLITH_TEMPLATES . '/common-header.inc'; diff --git a/kronolith/contacts.php b/kronolith/contacts.php index 19fab9490..49dd14051 100644 --- a/kronolith/contacts.php +++ b/kronolith/contacts.php @@ -1,7 +1,5 @@ + * @author Jan Schneider + * @package Kronolith */ function _cleanup() @@ -19,7 +18,6 @@ function _cleanup() @define('KRONOLITH_BASE', dirname(__FILE__)); require_once KRONOLITH_BASE . '/lib/base.php'; -require_once 'Horde/Data.php'; if (!$conf['menu']['import_export']) { require KRONOLITH_BASE . '/index.php'; @@ -160,7 +158,6 @@ case 'export': case EXPORT_ICALENDAR: require_once 'Horde/Identity.php'; - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); $calNames = array(); diff --git a/kronolith/day.php b/kronolith/day.php index a2696dbef..9b52da000 100644 --- a/kronolith/day.php +++ b/kronolith/day.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ require_once dirname(__FILE__) . '/lib/base.php'; diff --git a/kronolith/delete.php b/kronolith/delete.php index 49a7df2c9..c64007df7 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ @define('KRONOLITH_BASE', dirname(__FILE__)); diff --git a/kronolith/edit.php b/kronolith/edit.php index 304b35f46..c4a793cc8 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ function _save(&$event) diff --git a/kronolith/event.php b/kronolith/event.php index 007699442..87601ea55 100644 --- a/kronolith/event.php +++ b/kronolith/event.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ @define('KRONOLITH_BASE', dirname(__FILE__)); diff --git a/kronolith/fb.php b/kronolith/fb.php index f84a18a2e..55a48db9d 100644 --- a/kronolith/fb.php +++ b/kronolith/fb.php @@ -1,21 +1,18 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ @define('AUTH_HANDLER', true); @define('KRONOLITH_BASE', dirname(__FILE__)); $session_control = 'none'; require_once KRONOLITH_BASE . '/lib/base.php'; -require_once KRONOLITH_BASE . '/lib/FreeBusy.php'; -require_once 'Horde/Cache.php'; // We want to always generate UTF-8 iCalendar data. NLS::setCharset('UTF-8'); diff --git a/kronolith/ics.php b/kronolith/ics.php index 2da105b81..180f4c3bd 100644 --- a/kronolith/ics.php +++ b/kronolith/ics.php @@ -1,21 +1,18 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ @define('AUTH_HANDLER', true); @define('KRONOLITH_BASE', dirname(__FILE__)); $session_control = 'none'; require_once KRONOLITH_BASE . '/lib/base.php'; -require_once 'Horde/Cache.php'; -require_once 'Horde/iCalendar.php'; // We want to always generate UTF-8 iCalendar data. NLS::setCharset('UTF-8'); diff --git a/kronolith/imple.php b/kronolith/imple.php index 96c9634e4..46b468df0 100644 --- a/kronolith/imple.php +++ b/kronolith/imple.php @@ -12,7 +12,6 @@ @define('KRONOLITH_BASE', dirname(__FILE__)); require_once KRONOLITH_BASE . '/lib/base.php'; -require_once KRONOLITH_BASE . '/lib/Imple.php'; $path = Util::getFormData('imple'); if (!$path) { @@ -24,7 +23,7 @@ if ($path[0] == '/') { $path = explode('/', $path); $impleName = array_shift($path); -$imple = Imple::factory($impleName); +$imple = Kronolith_Imple::factory($impleName); if (!$imple) { exit; } @@ -50,7 +49,6 @@ if (!empty($_SERVER['Content-Type'])) { switch ($ct) { case 'json': header('Content-Type: application/json'); - require_once 'Horde/Serialize.php'; echo Horde_Serialize::serialize($result, SERIALIZE_JSON, NLS::getCharset()); break; diff --git a/kronolith/index.php b/kronolith/index.php index e2771a18e..f01badf5f 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -1,7 +1,5 @@ - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith_Day extends Horde_Date { diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index 03e7ff5ad..de218bc1d 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -3,11 +3,8 @@ * Kronolith_Driver defines an API for implementing storage backends for * Kronolith. * - * $Horde: kronolith/lib/Driver.php,v 1.303 2008/10/24 21:10:06 jan Exp $ - * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith_Driver { @@ -54,8 +51,6 @@ class Kronolith_Driver { /** * Returns a configuration for this driver. * - * @since Kronolith 3.0 - * * @param string $param A parameter name. * * @return mixed The parameter value or null if not set. @@ -275,7 +270,6 @@ class Kronolith_Driver { * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith_Event { @@ -422,8 +416,6 @@ class Kronolith_Event { /** * Whether this is an all-day event. * - * @since Kronolith 3.0 - * * @var boolean */ var $allday = false; @@ -561,7 +553,6 @@ class Kronolith_Event { if ($alarm) { $alarm['start'] = new Horde_Date($alarm['start']); $alarm['end'] = new Horde_Date($alarm['end']); - require_once 'Horde/Alarm.php'; $horde_alarm = Horde_Alarm::factory(); $horde_alarm->set($alarm); } @@ -1301,7 +1292,6 @@ class Kronolith_Event { } if ($this->start && $this->end) { - require_once 'Date/Calc.php'; $dur_day_match = Date_Calc::dateDiff($this->start->mday, $this->start->month, $this->start->year, @@ -2152,7 +2142,6 @@ class Kronolith_Event { } if (!$this->_varRenderer) { - require_once 'Horde/UI/VarRenderer.php'; $this->_varRenderer = Horde_UI_VarRenderer::factory('html'); } diff --git a/kronolith/lib/Driver/holidays.php b/kronolith/lib/Driver/holidays.php index c5a7b9906..554e5fb31 100644 --- a/kronolith/lib/Driver/holidays.php +++ b/kronolith/lib/Driver/holidays.php @@ -3,12 +3,9 @@ * The Kronolith_Driver_holidays implements support for the PEAR package * Date_Holidays. * - * $Horde: kronolith/lib/Driver/holidays.php,v 1.13 2008/11/15 15:43:24 jan Exp $ - * * @see http://pear.php.net/packages/Date_Holidays * @author Stephan Hohmann * @package Kronolith - * @since Kronolith 2.2 */ class Kronolith_Driver_holidays extends Kronolith_Driver { diff --git a/kronolith/lib/Driver/ical.php b/kronolith/lib/Driver/ical.php index 98935e8c0..fb31ad101 100644 --- a/kronolith/lib/Driver/ical.php +++ b/kronolith/lib/Driver/ical.php @@ -3,10 +3,7 @@ * The Kronolith_Driver_ical:: class implements the Kronolith_Driver * API for iCalendar data. * - * $Horde: kronolith/lib/Driver/ical.php,v 1.11 2008/04/30 21:32:13 chuck Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.0 * @package Kronolith */ class Kronolith_Driver_ical extends Kronolith_Driver { diff --git a/kronolith/lib/Driver/kolab.php b/kronolith/lib/Driver/kolab.php index 7d52d8423..dc8163dc3 100644 --- a/kronolith/lib/Driver/kolab.php +++ b/kronolith/lib/Driver/kolab.php @@ -5,9 +5,8 @@ require_once 'Horde/Identity.php'; /** * Horde Kronolith driver for the Kolab IMAP Server. - * Copyright 2004-2009 The Horde Project (http://www.horde.org/) * - * $Horde: kronolith/lib/Driver/kolab.php,v 1.77 2009/01/06 18:01:01 jan Exp $ + * Copyright 2004-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. @@ -15,7 +14,6 @@ require_once 'Horde/Identity.php'; * @author Thomas Jarosch * @author Gunnar Wrobel * @author Stuart Binge - * @since Kronolith 2.0 * @package Kronolith */ class Kronolith_Driver_kolab extends Kronolith_Driver { diff --git a/kronolith/lib/Driver/sql.php b/kronolith/lib/Driver/sql.php index b41a8a534..076269bae 100644 --- a/kronolith/lib/Driver/sql.php +++ b/kronolith/lib/Driver/sql.php @@ -3,11 +3,8 @@ * The Kronolith_Driver_sql:: class implements the Kronolith_Driver * API for a SQL backend. * - * $Horde: kronolith/lib/Driver/sql.php,v 1.214 2008/10/22 21:14:07 jan Exp $ - * * @author Luc Saillard * @author Chuck Hagenbuch - * @since Kronolith 0.3 * @package Kronolith */ class Kronolith_Driver_sql extends Kronolith_Driver { diff --git a/kronolith/lib/FBView.php b/kronolith/lib/FBView.php deleted file mode 100644 index ca4fe580b..000000000 --- a/kronolith/lib/FBView.php +++ /dev/null @@ -1,264 +0,0 @@ - - * @author Jan Schneider - * @package Kronolith - */ -class Kronolith_FreeBusy_View { - - var $_requiredMembers = array(); - var $_optionalMembers = array(); - var $_timeBlocks = array(); - - var $_startHour; - var $_endHour; - - var $_start; - var $_end; - - function addRequiredMember($vFreebusy) - { - $this->_requiredMembers[] = Util::cloneObject($vFreebusy); - } - - function addOptionalMember($vFreebusy) - { - $this->_optionalMembers[] = Util::cloneObject($vFreebusy); - } - - function render($day = null) - { - global $prefs; - - $this->_startHour = floor($prefs->getValue('day_hour_start') / 2); - $this->_endHour = floor(($prefs->getValue('day_hour_end') + 1) / 2); - - $this->_render($day); - - require_once 'Horde/iCalendar.php'; - $vCal = new Horde_iCalendar(); - $required = &Horde_iCalendar::newComponent('vfreebusy', $vCal); - foreach ($this->_requiredMembers as $member) { - $required->merge($member, false); - } - $required->simplify(); - - $optional = &Horde_iCalendar::newComponent('vfreebusy', $vCal); - foreach ($this->_optionalMembers as $member) { - $optional->merge($member, false); - } - $optional->simplify(); - - $optimal = &Horde_iCalendar::newComponent('vfreebusy', $vCal); - $optimal->merge($required, false); - $optimal->merge($optional); - - $base_url = Horde::selfUrl(); - $base_url = Util::removeParameter($base_url, 'date'); - $base_url = Util::removeParameter($base_url, 'fbview'); - $base_url = Util::addParameter($base_url, 'fbview', $this->view); - - $template = &new Horde_Template(); - $template->set('title', $this->_title()); - - $html = $template->fetch(KRONOLITH_TEMPLATES . '/fbview/header.html') . - '
'; - - $hours_html = $this->_hours(); - - // Set C locale to avoid localized decimal separators during CSS width - // calculation. - $lc = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, 'C'); - - // Required to attend. - if (count($this->_requiredMembers) > 0) { - $template = new Horde_Template(); - $rows = ''; - foreach ($this->_requiredMembers as $member) { - $member->simplify(); - $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy")); - $template = new Horde_Template(); - $template->set('blocks', $blocks); - $template->set('name', $member->getName()); - $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); - } - - $template = new Horde_Template(); - $template->set('title', _("Required Attendees")); - $template->set('rows', $rows); - $template->set('span', count($this->_timeBlocks)); - $template->set('hours', $hours_html); - $template->set('legend', ''); - $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); - } - - // Optional to attend. - if (count($this->_optionalMembers) > 0) { - $template = new Horde_Template(); - $rows = ''; - foreach ($this->_optionalMembers as $member) { - $member->simplify(); - $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy")); - $template = new Horde_Template(); - $template->set('blocks', $blocks); - $template->set('name', $member->getName()); - $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); - } - - $template = new Horde_Template(); - $template->set('title', _("Optional Attendees")); - $template->set('rows', $rows); - $template->set('span', count($this->_timeBlocks)); - $template->set('hours', $hours_html); - $template->set('legend', ''); - $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); - } - - // Possible meeting times. - $optimal->setAttribute('ORGANIZER', _("All Attendees")); - $blocks = $this->_getBlocks($optimal, - $optimal->getFreePeriods($this->_start->timestamp(), $this->_end->timestamp()), - 'meetingblock.html', _("All Attendees")); - - $template = new Horde_Template(); - $template->set('name', _("All Attendees")); - $template->set('blocks', $blocks); - $rows = $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); - - // Possible meeting times. - $required->setAttribute('ORGANIZER', _("Required Attendees")); - $blocks = $this->_getBlocks($required, - $required->getFreePeriods($this->_start->timestamp(), $this->_end->timestamp()), - 'meetingblock.html', _("Required Attendees")); - - $template = new Horde_Template(); - $template->set('name', _("Required Attendees")); - $template->set('blocks', $blocks); - $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); - - // Reset locale. - setlocale(LC_NUMERIC, $lc); - - $template = new Horde_Template(); - $template->set('rows', $rows); - $template->set('title', _("Overview")); - $template->set('span', count($this->_timeBlocks)); - $template->set('hours', $hours_html); - if ($prefs->getValue('show_fb_legend')) { - $template->setOption('gettext', true); - $template->set('legend', $template->fetch(KRONOLITH_TEMPLATES . '/fbview/legend.html')); - } else { - $template->set('legend', ''); - } - - return $html . $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html') . '
'; - } - - /** - * Attempts to return a concrete Kronolith_FreeBusy_View instance based on - * $view. - * - * @param string $view The type of concrete Kronolith_FreeBusy_View - * subclass to return. - * - * @return mixed The newly created concrete Kronolith_FreeBusy_View - * instance, or false on an error. - */ - function factory($view) - { - $driver = basename($view); - require_once dirname(__FILE__) . '/FBView/' . $driver . '.php'; - $class = 'Kronolith_FreeBusy_View_' . $driver; - if (class_exists($class)) { - return new $class($user, $params); - } - - return false; - } - - /** - * Attempts to return a reference to a concrete Kronolith_FreeBusy_View - * instance based on $view. It will only create a new instance if no - * Kronolith_FreeBusy_View instance with the same parameters currently - * exists. - * - * This method must be invoked as: - * $var = &Kronolith_FreeBusy_View::singleton() - * - * @param string $view The type of concrete Kronolith_FreeBusy_View - * subclass to return. - * - * @return mixed The created concrete Kronolith_FreeBusy_View instance, or - * false on an error. - */ - function &singleton($view) - { - static $instances = array(); - - if (!isset($instances[$view])) { - $instances[$view] = Kronolith_FreeBusy_View::factory($view); - } - - return $instances[$view]; - } - - function _getBlocks($member, $periods, $blockfile, $label) - { - $template = new Horde_Template(); - $template->set('label', $label); - - reset($periods); - list($periodStart, $periodEnd) = each($periods); - - $blocks = ''; - foreach ($this->_timeBlocks as $span) { - /* Horde_iCalendar_vfreebusy only supports timestamps at the - * moment. */ - $start = $span[0]->timestamp(); - $end = $span[1]->timestamp(); - if ($member->getStart() > $start || - $member->getEnd() < $end) { - $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/unknownblock.html'); - continue; - } - - while ($start > $periodEnd && - list($periodStart, $periodEnd) = each($periods)); - - if (($periodStart <= $start && $periodEnd >= $start) || - ($periodStart <= $end && $periodEnd >= $end) || - ($periodStart <= $start && $periodEnd >= $end) || - ($periodStart >= $start && $periodEnd <= $end)) { - - $l_start = ($periodStart < $start) ? $start : $periodStart; - $l_end = ($periodEnd > $end) ? $end : $periodEnd; - $plen = ($end - $start) / 100.0; - - $left = ($l_start - $start) / $plen; - $width = ($l_end - $l_start) / $plen; - - $template->set('left', $left . '%'); - $template->set('width', $width . '%'); - - $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile); - } else { - $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/emptyblock.html'); - } - } - - return $blocks; - } - -} diff --git a/kronolith/lib/FBView/day.php b/kronolith/lib/FBView/day.php deleted file mode 100644 index ea08e5feb..000000000 --- a/kronolith/lib/FBView/day.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @author Jan Schneider - * @package Kronolith - */ -class Kronolith_FreeBusy_View_day extends Kronolith_FreeBusy_View { - - var $view = 'day'; - - function _title() - { - global $registry, $prefs; - - $prev = new Horde_Date($this->_start); - $prev->mday--; - $prev->correct(); - $next = new Horde_Date($this->_start); - $next->mday++; - $next->correct(); - return Horde::link('#', _("Previous Day"), '', '', 'return switchDate(' . $prev->dateString() . ');') - . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) - . '' - . $this->_start->strftime($prefs->getValue('date_format')) - . Horde::link('#', _("Next Day"), '', '', 'return switchDate(' . $next->dateString() . ');') - . Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) - . ''; - } - - function _hours() - { - global $prefs; - - $hours_html = ''; - $width = round(100 / ($this->_endHour - $this->_startHour + 1)); - $start = new Horde_Date($this->_start); - $end = new Horde_Date($this->_start); - $end->min = 59; - for ($i = $this->_startHour; $i < $this->_endHour; $i++) { - $start->hour = $end->hour = $i; - $this->_timeBlocks[] = array(clone $start, clone $end); - $hours_html .= '' . $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00') . ''; - } - - return $hours_html; - } - - function _render($day = null) - { - $this->_start = new Horde_Date($day); - $this->_start->hour = $this->_startHour; - $this->_end = new Horde_Date($this->_start); - $this->_end->hour = $this->_endHour; - } - -} diff --git a/kronolith/lib/FBView/month.php b/kronolith/lib/FBView/month.php deleted file mode 100644 index cecda70b1..000000000 --- a/kronolith/lib/FBView/month.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @author Jan Schneider - * @package Kronolith - */ -class Kronolith_FreeBusy_View_month extends Kronolith_FreeBusy_View { - - var $view = 'month'; - var $_days = 30; - - function _title() - { - global $registry, $prefs; - - $end = new Horde_Date($this->_start); - $end->mday += $this->_days - 1; - $end->correct(); - $prev = new Horde_Date($this->_start); - $prev->month--; - $prev->correct(); - $next = new Horde_Date($this->_start); - $next->month++; - $next->correct(); - return Horde::link('#', _("Previous Month"), '', '', 'return switchDate(' . $prev->dateString() . ');') - . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) - . '' - . $this->_start->strftime('%B %Y') - . Horde::link('#', _("Next Month"), '', '', 'return switchDate(' . $next->dateString() . ');') - . Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) - . ''; - } - - function _hours() - { - global $prefs; - - $hours_html = ''; - $dayWidth = round(100 / $this->_days); - $date_format = $prefs->getValue('date_format'); - - $week = Date_Calc::weekOfYear(1, $this->_start->month, $this->_start->year); - $span = (7 - $week) % 7 + 1; - $span_left = $this->_days; - $t = new Horde_Date($this->_start); - while ($span_left > 0) { - $span_left -= $span; - $week_label = Horde::link('#', '', '', '', 'return switchDateView(\'week\',' . $t->dateString() . ');') . ("Week") . ' ' . $week . ''; - $hours_html .= sprintf('%s', - $span, $dayWidth, $week_label); - $week++; - $t->mday += 7; - $t->correct(); - $span = min($span_left, 7); - } - $hours_html .= ' '; - - for ($i = 0; $i < $this->_days; $i++) { - $t = new Horde_Date(array('month' => $this->_start->month, - 'mday' => $this->_start->mday + $i, - 'year' => $this->_start->year)); - $day_label = Horde::link('#', '', '', '', 'return switchDateView(\'day\',' . $t->dateString() . ');') . sprintf("%s.", $i + 1) . ''; - $hours_html .= sprintf('%s', - $dayWidth, $day_label); - } - - for ($i = 0; $i < $this->_days; $i++) { - $start = new Horde_Date(array('hour' => $this->_startHour, - 'month' => $this->_start->month, - 'mday' => $this->_start->mday + $i, - 'year' => $this->_start->year)); - $end = new Horde_Date(array('hour' => $this->_endHour, - 'month' => $this->_start->month, - 'mday' => $this->_start->mday + $i, - 'year' => $this->_start->year)); - $this->_timeBlocks[] = array($start, $end); - } - - return $hours_html; - } - - function _render($day = null) - { - $this->_start = new Horde_Date($day); - $this->_start->mday = 1; - $this->_days = Horde_Date::daysInMonth($day->month, $day->year); - $this->_end = new Horde_Date($this->_start); - $this->_end->hour = 23; - $this->_end->min = $this->_end->sec = 59; - $this->_end->mday = $this->_days; - } - -} diff --git a/kronolith/lib/FBView/week.php b/kronolith/lib/FBView/week.php deleted file mode 100644 index 7347244d1..000000000 --- a/kronolith/lib/FBView/week.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @author Jan Schneider - * @package Kronolith - */ -class Kronolith_FreeBusy_View_week extends Kronolith_FreeBusy_View { - - var $view = 'week'; - var $_days = 7; - - function _title() - { - global $registry, $prefs; - - $prev = new Horde_Date($this->_start); - $prev->mday -= 7; - $prev->correct(); - $next = new Horde_Date($this->_start); - $next->mday += 7; - $next->correct(); - $end = new Horde_Date($this->_start); - $end->mday += $this->_days - 1; - $end->correct(); - return Horde::link('#', _("Previous Week"), '', '', 'return switchDate(' . $prev->dateString() . ');') - . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) - . '' - . $this->_start->strftime($prefs->getValue('date_format')) . ' - ' - . $end->strftime($prefs->getValue('date_format')) - . Horde::link('#', _("Next Week"), '', '', 'return switchDate(' . $next->dateString() . ');') . - Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) . - ''; - } - - function _hours() - { - global $prefs; - - $hours_html = ''; - $dayWidth = round(100 / $this->_days); - $span = floor(($this->_endHour - $this->_startHour) / 3); - if (($this->_endHour - $this->_startHour) % 3) { - $span++; - } - $date_format = $prefs->getValue('date_format'); - for ($i = 0; $i < $this->_days; $i++) { - $t = new Horde_Date(array('month' => $this->_start->month, - 'mday' => $this->_start->mday + $i, - 'year' => $this->_start->year)); - $t->correct(); - $day_label = Horde::link('#', '', '', '', 'return switchDateView(\'day\',' . $t->dateString() . ');') . $t->strftime($date_format) . ''; - $hours_html .= sprintf('%s', - $span, $dayWidth, $day_label); - } - $hours_html .= ' '; - - $width = round(100 / ($span * $this->_days)); - for ($i = 0; $i < $this->_days; $i++) { - for ($h = $this->_startHour; $h < $this->_endHour; $h += 3) { - $start = new Horde_Date(array('hour' => $h, - 'month' => $this->_start->month, - 'mday' => $this->_start->mday + $i, - 'year' => $this->_start->year)); - $end = new Horde_Date($start); - $end->hour += 2; - $end->min = 59; - $this->_timeBlocks[] = array($start, $end); - - $hour = $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00'); - $hours_html .= sprintf('%s', $width, $hour); - } - } - - return $hours_html; - } - - function _render($day = null) - { - $this->_start = new Horde_Date(Date_Calc::beginOfWeek($day->mday, $day->month, $day->year, '%Y%m%d000000')); - $this->_end = new Horde_Date($this->_start); - $this->_end->hour = 23; - $this->_end->min = $this->_end->sec = 59; - $this->_end->mday += $this->_days - 1; - $this->_end->correct(); - } - -} diff --git a/kronolith/lib/FBView/workweek.php b/kronolith/lib/FBView/workweek.php deleted file mode 100644 index 5f392b51e..000000000 --- a/kronolith/lib/FBView/workweek.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @author Jan Schneider - * @package Kronolith - */ -class Kronolith_FreeBusy_View_workweek extends Kronolith_FreeBusy_View_week { - - var $view = 'workweek'; - var $_days = 5; - -} diff --git a/kronolith/lib/Forms/CreateCalendar.php b/kronolith/lib/Forms/CreateCalendar.php index 09866fa03..e00f70573 100644 --- a/kronolith/lib/Forms/CreateCalendar.php +++ b/kronolith/lib/Forms/CreateCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for creating calendars. * - * $Horde: kronolith/lib/Forms/CreateCalendar.php,v 1.2 2007/12/19 17:41:15 chuck Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * creating a calendar. * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_CreateCalendarForm extends Horde_Form { diff --git a/kronolith/lib/Forms/DeleteCalendar.php b/kronolith/lib/Forms/DeleteCalendar.php index 6239d5c25..2235fb00c 100644 --- a/kronolith/lib/Forms/DeleteCalendar.php +++ b/kronolith/lib/Forms/DeleteCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for deleting calendars. * - * $Horde: kronolith/lib/Forms/DeleteCalendar.php,v 1.3 2007/12/20 05:55:31 chuck Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * deleting a calendar. * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_DeleteCalendarForm extends Horde_Form { diff --git a/kronolith/lib/Forms/EditCalendar.php b/kronolith/lib/Forms/EditCalendar.php index 8b07eeb74..94aefa2ff 100644 --- a/kronolith/lib/Forms/EditCalendar.php +++ b/kronolith/lib/Forms/EditCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for editing calendars. * - * $Horde: kronolith/lib/Forms/EditCalendar.php,v 1.2 2008/11/12 09:16:12 wrobel Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * editing a calendar. * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_EditCalendarForm extends Horde_Form { diff --git a/kronolith/lib/Forms/EditRemoteCalendar.php b/kronolith/lib/Forms/EditRemoteCalendar.php index b43aab9e2..c4f562102 100644 --- a/kronolith/lib/Forms/EditRemoteCalendar.php +++ b/kronolith/lib/Forms/EditRemoteCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for editing remote calendars. * - * $Horde: kronolith/lib/Forms/EditRemoteCalendar.php,v 1.1 2007/12/19 19:32:33 chuck Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * editing a remote calendar. * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_EditRemoteCalendarForm extends Horde_Form { diff --git a/kronolith/lib/Forms/SubscribeRemoteCalendar.php b/kronolith/lib/Forms/SubscribeRemoteCalendar.php index e304a0aca..f49af9d07 100644 --- a/kronolith/lib/Forms/SubscribeRemoteCalendar.php +++ b/kronolith/lib/Forms/SubscribeRemoteCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for subscribing to remote calendars. * - * $Horde: kronolith/lib/Forms/SubscribeRemoteCalendar.php,v 1.1 2007/12/19 19:32:33 chuck Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * for subscribing to remote calendars * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_SubscribeRemoteCalendarForm extends Horde_Form { diff --git a/kronolith/lib/Forms/UnsubscribeRemoteCalendar.php b/kronolith/lib/Forms/UnsubscribeRemoteCalendar.php index eb1d4e952..6eb34e419 100644 --- a/kronolith/lib/Forms/UnsubscribeRemoteCalendar.php +++ b/kronolith/lib/Forms/UnsubscribeRemoteCalendar.php @@ -2,8 +2,6 @@ /** * Horde_Form for unsubscribing from remote calendars. * - * $Horde: kronolith/lib/Forms/UnsubscribeRemoteCalendar.php,v 1.1 2007/12/19 19:32:34 chuck Exp $ - * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * @@ -24,7 +22,6 @@ require_once 'Horde/Form/Renderer.php'; * deleting a calendar. * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_UnsubscribeRemoteCalendarForm extends Horde_Form { diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index 03d79f84e..a78f497e6 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -2,10 +2,7 @@ /** * Free/Busy functionality. * - * $Horde: kronolith/lib/FreeBusy.php,v 1.19 2009/01/07 13:03:55 jan Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_FreeBusy { @@ -29,7 +26,6 @@ class Kronolith_FreeBusy { global $kronolith_shares; require_once 'Horde/Identity.php'; - require_once 'Horde/iCalendar.php'; require_once KRONOLITH_BASE . '/lib/version.php'; if (!is_array($calendar)) { @@ -131,9 +127,6 @@ class Kronolith_FreeBusy { */ function get($email) { - require_once 'Horde/iCalendar.php'; - require_once 'Mail/RFC822.php'; - /* Properly handle RFC822-compliant email addresses. */ static $rfc822; if (is_null($rfc822)) { @@ -168,7 +161,6 @@ class Kronolith_FreeBusy { $options = array_merge($options, $GLOBALS['conf']['http']['proxy']); } - require_once 'HTTP/Request.php'; $http = new HTTP_Request($url, $options); if (is_a($response = @$http->sendRequest(), 'PEAR_Error')) { return PEAR::raiseError(sprintf(_("The free/busy url for %s cannot be retrieved."), $email)); diff --git a/kronolith/lib/FreeBusy/FreeBusy.php b/kronolith/lib/FreeBusy/FreeBusy.php new file mode 100644 index 000000000..b9181cceb --- /dev/null +++ b/kronolith/lib/FreeBusy/FreeBusy.php @@ -0,0 +1,258 @@ + + * @author Jan Schneider + * @package Kronolith + */ +class Kronolith_FreeBusy_View { + + var $_requiredMembers = array(); + var $_optionalMembers = array(); + var $_timeBlocks = array(); + + var $_startHour; + var $_endHour; + + var $_start; + var $_end; + + function addRequiredMember($vFreebusy) + { + $this->_requiredMembers[] = Util::cloneObject($vFreebusy); + } + + function addOptionalMember($vFreebusy) + { + $this->_optionalMembers[] = Util::cloneObject($vFreebusy); + } + + function render($day = null) + { + global $prefs; + + $this->_startHour = floor($prefs->getValue('day_hour_start') / 2); + $this->_endHour = floor(($prefs->getValue('day_hour_end') + 1) / 2); + + $this->_render($day); + + $vCal = new Horde_iCalendar(); + $required = &Horde_iCalendar::newComponent('vfreebusy', $vCal); + foreach ($this->_requiredMembers as $member) { + $required->merge($member, false); + } + $required->simplify(); + + $optional = &Horde_iCalendar::newComponent('vfreebusy', $vCal); + foreach ($this->_optionalMembers as $member) { + $optional->merge($member, false); + } + $optional->simplify(); + + $optimal = &Horde_iCalendar::newComponent('vfreebusy', $vCal); + $optimal->merge($required, false); + $optimal->merge($optional); + + $base_url = Horde::selfUrl(); + $base_url = Util::removeParameter($base_url, 'date'); + $base_url = Util::removeParameter($base_url, 'fbview'); + $base_url = Util::addParameter($base_url, 'fbview', $this->view); + + $template = new Horde_Template(); + $template->set('title', $this->_title()); + + $html = $template->fetch(KRONOLITH_TEMPLATES . '/fbview/header.html') . + '
'; + + $hours_html = $this->_hours(); + + // Set C locale to avoid localized decimal separators during CSS width + // calculation. + $lc = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, 'C'); + + // Required to attend. + if (count($this->_requiredMembers) > 0) { + $template = new Horde_Template(); + $rows = ''; + foreach ($this->_requiredMembers as $member) { + $member->simplify(); + $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy")); + $template = new Horde_Template(); + $template->set('blocks', $blocks); + $template->set('name', $member->getName()); + $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); + } + + $template = new Horde_Template(); + $template->set('title', _("Required Attendees")); + $template->set('rows', $rows); + $template->set('span', count($this->_timeBlocks)); + $template->set('hours', $hours_html); + $template->set('legend', ''); + $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); + } + + // Optional to attend. + if (count($this->_optionalMembers) > 0) { + $template = new Horde_Template(); + $rows = ''; + foreach ($this->_optionalMembers as $member) { + $member->simplify(); + $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy")); + $template = new Horde_Template(); + $template->set('blocks', $blocks); + $template->set('name', $member->getName()); + $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); + } + + $template = new Horde_Template(); + $template->set('title', _("Optional Attendees")); + $template->set('rows', $rows); + $template->set('span', count($this->_timeBlocks)); + $template->set('hours', $hours_html); + $template->set('legend', ''); + $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); + } + + // Possible meeting times. + $optimal->setAttribute('ORGANIZER', _("All Attendees")); + $blocks = $this->_getBlocks($optimal, + $optimal->getFreePeriods($this->_start->timestamp(), $this->_end->timestamp()), + 'meetingblock.html', _("All Attendees")); + + $template = new Horde_Template(); + $template->set('name', _("All Attendees")); + $template->set('blocks', $blocks); + $rows = $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); + + // Possible meeting times. + $required->setAttribute('ORGANIZER', _("Required Attendees")); + $blocks = $this->_getBlocks($required, + $required->getFreePeriods($this->_start->timestamp(), $this->_end->timestamp()), + 'meetingblock.html', _("Required Attendees")); + + $template = new Horde_Template(); + $template->set('name', _("Required Attendees")); + $template->set('blocks', $blocks); + $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); + + // Reset locale. + setlocale(LC_NUMERIC, $lc); + + $template = new Horde_Template(); + $template->set('rows', $rows); + $template->set('title', _("Overview")); + $template->set('span', count($this->_timeBlocks)); + $template->set('hours', $hours_html); + if ($prefs->getValue('show_fb_legend')) { + $template->setOption('gettext', true); + $template->set('legend', $template->fetch(KRONOLITH_TEMPLATES . '/fbview/legend.html')); + } else { + $template->set('legend', ''); + } + + return $html . $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html') . '
'; + } + + /** + * Attempts to return a concrete Kronolith_FreeBusy_View instance based on + * $view. + * + * @param string $view The type of concrete Kronolith_FreeBusy_View + * subclass to return. + * + * @return mixed The newly created concrete Kronolith_FreeBusy_View + * instance, or false on an error. + */ + function factory($view) + { + $driver = basename($view); + require_once dirname(__FILE__) . '/FBView/' . $driver . '.php'; + $class = 'Kronolith_FreeBusy_View_' . $driver; + if (class_exists($class)) { + return new $class($user, $params); + } + + return false; + } + + /** + * Attempts to return a reference to a concrete Kronolith_FreeBusy_View + * instance based on $view. It will only create a new instance if no + * Kronolith_FreeBusy_View instance with the same parameters currently + * exists. + * + * This method must be invoked as: + * $var = &Kronolith_FreeBusy_View::singleton() + * + * @param string $view The type of concrete Kronolith_FreeBusy_View + * subclass to return. + * + * @return mixed The created concrete Kronolith_FreeBusy_View instance, or + * false on an error. + */ + function &singleton($view) + { + static $instances = array(); + + if (!isset($instances[$view])) { + $instances[$view] = Kronolith_FreeBusy_View::factory($view); + } + + return $instances[$view]; + } + + function _getBlocks($member, $periods, $blockfile, $label) + { + $template = new Horde_Template(); + $template->set('label', $label); + + reset($periods); + list($periodStart, $periodEnd) = each($periods); + + $blocks = ''; + foreach ($this->_timeBlocks as $span) { + /* Horde_iCalendar_vfreebusy only supports timestamps at the + * moment. */ + $start = $span[0]->timestamp(); + $end = $span[1]->timestamp(); + if ($member->getStart() > $start || + $member->getEnd() < $end) { + $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/unknownblock.html'); + continue; + } + + while ($start > $periodEnd && + list($periodStart, $periodEnd) = each($periods)); + + if (($periodStart <= $start && $periodEnd >= $start) || + ($periodStart <= $end && $periodEnd >= $end) || + ($periodStart <= $start && $periodEnd >= $end) || + ($periodStart >= $start && $periodEnd <= $end)) { + + $l_start = ($periodStart < $start) ? $start : $periodStart; + $l_end = ($periodEnd > $end) ? $end : $periodEnd; + $plen = ($end - $start) / 100.0; + + $left = ($l_start - $start) / $plen; + $width = ($l_end - $l_start) / $plen; + + $template->set('left', $left . '%'); + $template->set('width', $width . '%'); + + $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile); + } else { + $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/emptyblock.html'); + } + } + + return $blocks; + } + +} diff --git a/kronolith/lib/FreeBusy/View/Day.php b/kronolith/lib/FreeBusy/View/Day.php new file mode 100644 index 000000000..030d71c31 --- /dev/null +++ b/kronolith/lib/FreeBusy/View/Day.php @@ -0,0 +1,62 @@ + + * @author Jan Schneider + * @package Kronolith + */ +class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View { + + var $view = 'day'; + + function _title() + { + global $registry, $prefs; + + $prev = new Horde_Date($this->_start); + $prev->mday--; + $prev->correct(); + $next = new Horde_Date($this->_start); + $next->mday++; + $next->correct(); + return Horde::link('#', _("Previous Day"), '', '', 'return switchDate(' . $prev->dateString() . ');') + . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) + . '' + . $this->_start->strftime($prefs->getValue('date_format')) + . Horde::link('#', _("Next Day"), '', '', 'return switchDate(' . $next->dateString() . ');') + . Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) + . ''; + } + + function _hours() + { + global $prefs; + + $hours_html = ''; + $width = round(100 / ($this->_endHour - $this->_startHour + 1)); + $start = new Horde_Date($this->_start); + $end = new Horde_Date($this->_start); + $end->min = 59; + for ($i = $this->_startHour; $i < $this->_endHour; $i++) { + $start->hour = $end->hour = $i; + $this->_timeBlocks[] = array(clone $start, clone $end); + $hours_html .= '' . $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00') . ''; + } + + return $hours_html; + } + + function _render($day = null) + { + $this->_start = new Horde_Date($day); + $this->_start->hour = $this->_startHour; + $this->_end = new Horde_Date($this->_start); + $this->_end->hour = $this->_endHour; + } + +} diff --git a/kronolith/lib/FreeBusy/View/Month.php b/kronolith/lib/FreeBusy/View/Month.php new file mode 100644 index 000000000..08be0087c --- /dev/null +++ b/kronolith/lib/FreeBusy/View/Month.php @@ -0,0 +1,99 @@ + + * @author Jan Schneider + * @package Kronolith + */ +class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { + + var $view = 'month'; + var $_days = 30; + + function _title() + { + global $registry, $prefs; + + $end = new Horde_Date($this->_start); + $end->mday += $this->_days - 1; + $end->correct(); + $prev = new Horde_Date($this->_start); + $prev->month--; + $prev->correct(); + $next = new Horde_Date($this->_start); + $next->month++; + $next->correct(); + return Horde::link('#', _("Previous Month"), '', '', 'return switchDate(' . $prev->dateString() . ');') + . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) + . '' + . $this->_start->strftime('%B %Y') + . Horde::link('#', _("Next Month"), '', '', 'return switchDate(' . $next->dateString() . ');') + . Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) + . ''; + } + + function _hours() + { + global $prefs; + + $hours_html = ''; + $dayWidth = round(100 / $this->_days); + $date_format = $prefs->getValue('date_format'); + + $week = Date_Calc::weekOfYear(1, $this->_start->month, $this->_start->year); + $span = (7 - $week) % 7 + 1; + $span_left = $this->_days; + $t = new Horde_Date($this->_start); + while ($span_left > 0) { + $span_left -= $span; + $week_label = Horde::link('#', '', '', '', 'return switchDateView(\'week\',' . $t->dateString() . ');') . ("Week") . ' ' . $week . ''; + $hours_html .= sprintf('%s', + $span, $dayWidth, $week_label); + $week++; + $t->mday += 7; + $t->correct(); + $span = min($span_left, 7); + } + $hours_html .= ' '; + + for ($i = 0; $i < $this->_days; $i++) { + $t = new Horde_Date(array('month' => $this->_start->month, + 'mday' => $this->_start->mday + $i, + 'year' => $this->_start->year)); + $day_label = Horde::link('#', '', '', '', 'return switchDateView(\'day\',' . $t->dateString() . ');') . sprintf("%s.", $i + 1) . ''; + $hours_html .= sprintf('%s', + $dayWidth, $day_label); + } + + for ($i = 0; $i < $this->_days; $i++) { + $start = new Horde_Date(array('hour' => $this->_startHour, + 'month' => $this->_start->month, + 'mday' => $this->_start->mday + $i, + 'year' => $this->_start->year)); + $end = new Horde_Date(array('hour' => $this->_endHour, + 'month' => $this->_start->month, + 'mday' => $this->_start->mday + $i, + 'year' => $this->_start->year)); + $this->_timeBlocks[] = array($start, $end); + } + + return $hours_html; + } + + function _render($day = null) + { + $this->_start = new Horde_Date($day); + $this->_start->mday = 1; + $this->_days = Horde_Date::daysInMonth($day->month, $day->year); + $this->_end = new Horde_Date($this->_start); + $this->_end->hour = 23; + $this->_end->min = $this->_end->sec = 59; + $this->_end->mday = $this->_days; + } + +} diff --git a/kronolith/lib/FreeBusy/View/Week.php b/kronolith/lib/FreeBusy/View/Week.php new file mode 100644 index 000000000..8310b8860 --- /dev/null +++ b/kronolith/lib/FreeBusy/View/Week.php @@ -0,0 +1,93 @@ + + * @author Jan Schneider + * @package Kronolith + */ +class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { + + var $view = 'week'; + var $_days = 7; + + function _title() + { + global $registry, $prefs; + + $prev = new Horde_Date($this->_start); + $prev->mday -= 7; + $prev->correct(); + $next = new Horde_Date($this->_start); + $next->mday += 7; + $next->correct(); + $end = new Horde_Date($this->_start); + $end->mday += $this->_days - 1; + $end->correct(); + return Horde::link('#', _("Previous Week"), '', '', 'return switchDate(' . $prev->dateString() . ');') + . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) + . '' + . $this->_start->strftime($prefs->getValue('date_format')) . ' - ' + . $end->strftime($prefs->getValue('date_format')) + . Horde::link('#', _("Next Week"), '', '', 'return switchDate(' . $next->dateString() . ');') . + Horde::img('nav/right.png', '>', null, $registry->getImageDir('horde')) . + ''; + } + + function _hours() + { + global $prefs; + + $hours_html = ''; + $dayWidth = round(100 / $this->_days); + $span = floor(($this->_endHour - $this->_startHour) / 3); + if (($this->_endHour - $this->_startHour) % 3) { + $span++; + } + $date_format = $prefs->getValue('date_format'); + for ($i = 0; $i < $this->_days; $i++) { + $t = new Horde_Date(array('month' => $this->_start->month, + 'mday' => $this->_start->mday + $i, + 'year' => $this->_start->year)); + $t->correct(); + $day_label = Horde::link('#', '', '', '', 'return switchDateView(\'day\',' . $t->dateString() . ');') . $t->strftime($date_format) . ''; + $hours_html .= sprintf('%s', + $span, $dayWidth, $day_label); + } + $hours_html .= ' '; + + $width = round(100 / ($span * $this->_days)); + for ($i = 0; $i < $this->_days; $i++) { + for ($h = $this->_startHour; $h < $this->_endHour; $h += 3) { + $start = new Horde_Date(array('hour' => $h, + 'month' => $this->_start->month, + 'mday' => $this->_start->mday + $i, + 'year' => $this->_start->year)); + $end = new Horde_Date($start); + $end->hour += 2; + $end->min = 59; + $this->_timeBlocks[] = array($start, $end); + + $hour = $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00'); + $hours_html .= sprintf('%s', $width, $hour); + } + } + + return $hours_html; + } + + function _render($day = null) + { + $this->_start = new Horde_Date(Date_Calc::beginOfWeek($day->mday, $day->month, $day->year, '%Y%m%d000000')); + $this->_end = new Horde_Date($this->_start); + $this->_end->hour = 23; + $this->_end->min = $this->_end->sec = 59; + $this->_end->mday += $this->_days - 1; + $this->_end->correct(); + } + +} diff --git a/kronolith/lib/FreeBusy/View/Workweek.php b/kronolith/lib/FreeBusy/View/Workweek.php new file mode 100644 index 000000000..fb32a4b3f --- /dev/null +++ b/kronolith/lib/FreeBusy/View/Workweek.php @@ -0,0 +1,18 @@ + + * @author Jan Schneider + * @package Kronolith + */ +class Kronolith_FreeBusy_View_Workweek extends Kronolith_FreeBusy_View_Week { + + var $view = 'workweek'; + var $_days = 5; + +} diff --git a/kronolith/lib/Imple.php b/kronolith/lib/Imple.php index 87ee3289b..5e975ac78 100644 --- a/kronolith/lib/Imple.php +++ b/kronolith/lib/Imple.php @@ -1,7 +1,5 @@ * @package Kronolith */ -class Imple { +class Kronolith_Imple { /** * Parameters needed by the subclasses. diff --git a/kronolith/lib/Imple/ContactAutoCompleter.php b/kronolith/lib/Imple/ContactAutoCompleter.php index a69cd9180..cf2819f1a 100644 --- a/kronolith/lib/Imple/ContactAutoCompleter.php +++ b/kronolith/lib/Imple/ContactAutoCompleter.php @@ -8,7 +8,7 @@ * @author Michael Slusarz * @package Kronolith */ -class Imple_ContactAutoCompleter extends Imple +class Kronolith_Imple_ContactAutoCompleter extends Kronolith_Imple { /** * Constructor. diff --git a/kronolith/lib/Imple/Embed.php b/kronolith/lib/Imple/Embed.php index fed200113..ebc4ec09a 100644 --- a/kronolith/lib/Imple/Embed.php +++ b/kronolith/lib/Imple/Embed.php @@ -4,15 +4,13 @@ * websites. Meant to be called via a single script tag, therefore this will * always return nothing but valid javascript. * - * $Horde: kronolith/lib/Imple/Embed.php,v 1.10 2009/01/06 18:01:01 jan Exp $ - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * @author Michael J. Rubinsky * * @package Ansel */ -class Imple_Embed extends Imple { +class Kronolith_Imple_Embed extends Kronolith_Imple { /** * Override the parent method since it uses Horde::addScriptFile() diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 96064ed78..d46b279b4 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -1,7 +1,5 @@ - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith { @@ -46,8 +43,6 @@ class Kronolith { /** * Output everything up to but not including the tag. * - * @since Kronolith 3.0 - * * @param string $title The title of the page. * @param array $scripts Any additional scripts that need to be loaded. * Each entry contains the three elements necessary @@ -109,8 +104,6 @@ class Kronolith { * Outputs the javascript code which defines all javascript variables * that are dependent on the local user's account. * - * @since Kronolith 3.0 - * * @private * * @return string @@ -119,8 +112,6 @@ class Kronolith { { global $browser, $conf, $prefs, $registry; - require_once 'Horde/Serialize.php'; - $kronolith_webroot = $registry->get('webroot'); $horde_webroot = $registry->get('webroot', 'horde'); @@ -160,8 +151,6 @@ class Kronolith { /** * Add inline javascript to the output buffer. * - * @since Kronolith 2.2 - * * @param mixed $script The script text to add (can be stored in an * array also). * @param string $onload Load the script after the page has loaded? @@ -205,8 +194,6 @@ class Kronolith { /** * Print inline javascript to the output buffer. * - * @since Kronolith 2.2 - * * @return string The javascript text to output. */ function outputInlineScript() @@ -226,8 +213,6 @@ class Kronolith { * Print inline javascript to output buffer after wrapping with necessary * javascript tags. * - * @since Kronolith 3.0 - * * @param array $script The script to output. * * @return string The script with the necessary HTML javascript tags @@ -241,8 +226,6 @@ class Kronolith { /** * Outputs the necessary script tags, honoring local configuration choices * as to script caching. - * - * @since Kronolith 3.0 */ function includeScriptFiles() { @@ -285,7 +268,6 @@ class Kronolith { break; case 'horde_cache': - require_once 'Horde/Cache.php'; $cache = &Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver'])); $exists = $cache->exists($sig, empty($conf['server']['cachejsparams']['lifetime']) ? 0 : $conf['server']['cachejsparams']['lifetime']); $js_url = Kronolith::getCacheURL('js', $sig); @@ -327,8 +309,6 @@ class Kronolith { * Outputs the necessary style tags, honoring local configuration choices * as to stylesheet caching. * - * @since Kronolith 3.0 - * * @param boolean $print Include print CSS? */ function includeStylesheetFiles($print = false) @@ -392,7 +372,6 @@ class Kronolith { break; case 'horde_cache': - require_once 'Horde/Cache.php'; $cache = &Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver'])); $exists = $cache->exists($sig, empty($GLOBALS['conf']['server']['cachecssparams']['lifetime']) ? 0 : $GLOBALS['conf']['server']['cachecssparams']['lifetime']); $css_url = Kronolith::getCacheURL('css', $sig); @@ -431,8 +410,6 @@ class Kronolith { /** * Creates a URL for cached Kronolith data. * - * @since Kronolith 3.0 - * * @param string $type The cache type. * @param string $cid The cache id. * @@ -452,8 +429,6 @@ class Kronolith { /** * Do garbage collection in the statically served file directory. * - * @since Kronolith 3.0 - * * @access private * * @param string $type Either 'css' or 'js'. @@ -843,7 +818,6 @@ class Kronolith { $options = array_merge($options, $GLOBALS['conf']['http']['proxy']); } - require_once 'HTTP/Request.php'; $http = new HTTP_Request($url, $options); /* Check for HTTP authentication credentials */ $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals')); @@ -895,7 +869,6 @@ class Kronolith { return $data; } - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); if (!$iCal->parsevCalendar($data)) { return array(); @@ -962,7 +935,6 @@ class Kronolith { return $data; } - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); if (!$iCal->parsevCalendar($data)) { return array(); @@ -1919,8 +1891,6 @@ class Kronolith { } /* Build the iCalendar data */ - require_once 'Horde/Data.php'; - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); $iCal->setAttribute('METHOD', $method); $iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8')); @@ -2162,8 +2132,6 @@ class Kronolith { /** * Returns the specified permission for the current user. * - * @since Kronolith 2.1 - * * @param string $permission A permission, currently only 'max_events'. * * @return mixed The value of the specified permission. @@ -2196,7 +2164,6 @@ class Kronolith { $date = Kronolith::currentDate(); $date_stamp = $date->dateString(); - require_once 'Horde/UI/Tabs.php'; require_once 'Horde/Variables.php'; $tabs = new Horde_UI_Tabs('view', Variables::getDefaultVariables()); $tabs->preserve('date', $date_stamp); @@ -2228,7 +2195,6 @@ class Kronolith { return; } - require_once 'Horde/UI/Tabs.php'; require_once 'Horde/Variables.php'; $tabs = new Horde_UI_Tabs('event', Variables::getDefaultVariables()); @@ -2415,7 +2381,6 @@ class Kronolith { */ function foregroundColor($calendar) { - require_once 'Horde/Image.php'; return Horde_Image::brightness(Kronolith::backgroundColor($calendar)) < 128 ? '#f6f6f6' : '#000'; } diff --git a/kronolith/lib/Maintenance/kronolith.php b/kronolith/lib/Maintenance/kronolith.php index 005c1f724..81890e204 100644 --- a/kronolith/lib/Maintenance/kronolith.php +++ b/kronolith/lib/Maintenance/kronolith.php @@ -4,8 +4,6 @@ require_once 'Horde/Maintenance.php'; require_once $GLOBALS['registry']->get('fileroot', 'kronolith') . '/lib/base.php'; /** - * $Horde: kronolith/lib/Maintenance/kronolith.php,v 1.2 2009/01/06 18:01:01 jan Exp $ - * * The Maintenance_Kronolith class defines the maintenance operations run upon * login to Kronolith * @@ -14,7 +12,6 @@ require_once $GLOBALS['registry']->get('fileroot', 'kronolith') . '/lib/base.php * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * - * @since Kronolith 2.2.1 * @package Horde_Maintenance */ class Maintenance_Kronolith extends Maintenance { diff --git a/kronolith/lib/Views/Day.php b/kronolith/lib/Views/Day.php index 60afd6d81..8c0c9a5ce 100644 --- a/kronolith/lib/Views/Day.php +++ b/kronolith/lib/Views/Day.php @@ -5,11 +5,8 @@ require_once KRONOLITH_BASE . '/lib/Day.php'; /** * The Kronolith_View_Day:: class provides an API for viewing days. * - * $Horde: kronolith/lib/Views/Day.php,v 1.39 2008/10/21 21:58:29 jan Exp $ - * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith_View_Day extends Kronolith_Day { diff --git a/kronolith/lib/Views/DeleteEvent.php b/kronolith/lib/Views/DeleteEvent.php index 4e0c8004c..18d1e6957 100644 --- a/kronolith/lib/Views/DeleteEvent.php +++ b/kronolith/lib/Views/DeleteEvent.php @@ -3,10 +3,7 @@ * The Kronolith_View_DeleteEvent:: class provides an API for viewing * event delete forms. * - * $Horde: kronolith/lib/Views/DeleteEvent.php,v 1.4 2008/10/13 23:00:18 jan Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_DeleteEvent { diff --git a/kronolith/lib/Views/EditEvent.php b/kronolith/lib/Views/EditEvent.php index f1ca8b5d0..649fa8399 100644 --- a/kronolith/lib/Views/EditEvent.php +++ b/kronolith/lib/Views/EditEvent.php @@ -3,10 +3,7 @@ * The Kronolith_View_EditEvent:: class provides an API for viewing * event edit forms. * - * $Horde: kronolith/lib/Views/EditEvent.php,v 1.11 2008/10/13 23:00:18 jan Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_EditEvent { diff --git a/kronolith/lib/Views/Event.php b/kronolith/lib/Views/Event.php index af87dc184..2587ed96c 100644 --- a/kronolith/lib/Views/Event.php +++ b/kronolith/lib/Views/Event.php @@ -2,10 +2,7 @@ /** * The Kronolith_View_Event:: class provides an API for viewing events. * - * $Horde: kronolith/lib/Views/Event.php,v 1.12 2008/11/10 05:13:43 chuck Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_Event { diff --git a/kronolith/lib/Views/ExportEvent.php b/kronolith/lib/Views/ExportEvent.php index e82e8bb29..c29e03d0e 100644 --- a/kronolith/lib/Views/ExportEvent.php +++ b/kronolith/lib/Views/ExportEvent.php @@ -3,10 +3,7 @@ * The Kronolith_View_ExportEvent:: class provides an API for exporting * events. * - * $Horde: kronolith/lib/Views/ExportEvent.php,v 1.2 2008/03/14 13:55:05 jan Exp $ - * * @author Jan Schneider - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_ExportEvent { diff --git a/kronolith/lib/Views/Month.php b/kronolith/lib/Views/Month.php index 45ab66674..47502e159 100644 --- a/kronolith/lib/Views/Month.php +++ b/kronolith/lib/Views/Month.php @@ -6,11 +6,8 @@ require_once KRONOLITH_BASE . '/lib/Day.php'; * The Kronolith_View_Month:: class provides an API for viewing * months. * - * $Horde: kronolith/lib/Views/Month.php,v 1.20 2008/10/13 23:00:18 jan Exp $ - * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_Month { diff --git a/kronolith/lib/Views/Week.php b/kronolith/lib/Views/Week.php index c8963fa4e..46856afa6 100644 --- a/kronolith/lib/Views/Week.php +++ b/kronolith/lib/Views/Week.php @@ -5,11 +5,8 @@ require_once dirname(__FILE__) . '/Day.php'; /** * The Kronolith_View_Week:: class provides an API for viewing weeks. * - * $Horde: kronolith/lib/Views/Week.php,v 1.34 2008/11/03 22:50:06 jan Exp $ - * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 0.1 * @package Kronolith */ class Kronolith_View_Week { diff --git a/kronolith/lib/Views/WorkWeek.php b/kronolith/lib/Views/WorkWeek.php index a3b527262..572dad91d 100644 --- a/kronolith/lib/Views/WorkWeek.php +++ b/kronolith/lib/Views/WorkWeek.php @@ -6,10 +6,7 @@ require_once dirname(__FILE__) . '/Week.php'; * The Kronolith_View_WorkWeek:: class provides a shortcut for a week * view that is only Monday through Friday. * - * $Horde: kronolith/lib/Views/WorkWeek.php,v 1.3 2006/11/07 21:47:42 chuck Exp $ - * * @author Chuck Hagenbuch - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_WorkWeek extends Kronolith_View_Week { diff --git a/kronolith/lib/Views/Year.php b/kronolith/lib/Views/Year.php index 75cb44013..3482f1d65 100644 --- a/kronolith/lib/Views/Year.php +++ b/kronolith/lib/Views/Year.php @@ -5,11 +5,8 @@ require_once KRONOLITH_BASE . '/lib/Day.php'; /** * The Kronolith_View_Year:: class provides an API for viewing years. * - * $Horde: kronolith/lib/Views/Year.php,v 1.17 2008/10/21 04:23:07 chuck Exp $ - * * @author Chuck Hagenbuch * @author Jan Schneider - * @since Kronolith 2.2 * @package Kronolith */ class Kronolith_View_Year { diff --git a/kronolith/lib/api.php b/kronolith/lib/api.php index 9ccd7acd6..2d8247861 100644 --- a/kronolith/lib/api.php +++ b/kronolith/lib/api.php @@ -517,7 +517,6 @@ function _kronolith_put($path, $content, $content_type) switch ($content_type) { case 'text/calendar': case 'text/x-vcalendar': - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); if (!is_a($content, 'Horde_iCalendar_vevent')) { if (!$iCal->parsevCalendar($content)) { @@ -789,7 +788,6 @@ function _kronolith_import($content, $contentType, $calendar = null) switch ($contentType) { case 'text/calendar': case 'text/x-vcalendar': - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); if (!is_a($content, 'Horde_iCalendar_vevent')) { if (!$iCal->parsevCalendar($content)) { @@ -886,7 +884,6 @@ function _kronolith_export($uid, $contentType) case 'text/calendar': $share = &$kronolith_shares->getShare($event->getCalendar()); - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar($version); $iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8')); @@ -939,7 +936,6 @@ function _kronolith_exportCalendar($calendar, $contentType) case 'text/calendar': $share = &$kronolith_shares->getShare($calendar); - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar($version); $iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8')); @@ -1060,7 +1056,6 @@ function _kronolith_replace($uid, $content, $contentType) case 'text/calendar': case 'text/x-vcalendar': if (!is_a($content, 'Horde_iCalendar_vevent')) { - require_once 'Horde/iCalendar.php'; $iCal = new Horde_iCalendar(); if (!$iCal->parsevCalendar($content)) { return PEAR::raiseError(_("There was an error importing the iCalendar data.")); @@ -1111,7 +1106,6 @@ function _kronolith_getFreeBusy($startstamp = null, $endstamp = null, $calendar = null) { require_once dirname(__FILE__) . '/base.php'; - require_once KRONOLITH_BASE . '/lib/FreeBusy.php'; if (is_null($calendar)) { $calendar = Kronolith::getDefaultCalendar(); diff --git a/kronolith/lib/base.php b/kronolith/lib/base.php index fa6ea0e41..264861ac2 100644 --- a/kronolith/lib/base.php +++ b/kronolith/lib/base.php @@ -14,20 +14,23 @@ * @package Kronolith */ +$kronolith_dir = dirname(__FILE__); + // Check for a prior definition of HORDE_BASE. if (!defined('HORDE_BASE')) { /* Temporary fix - if horde does not live directly under the imp * directory, the HORDE_BASE constant should be defined in * imp/lib/base.local.php. */ - $krono_dir = dirname(__FILE__); - if (file_exists($krono_dir . '/base.local.php')) { - include $krono_dir . '/base.local.php'; + if (file_exists($kronolith_dir . '/base.local.php')) { + include $kronolith_dir . '/base.local.php'; } else { - define('HORDE_BASE', dirname(__FILE__) . '/../..'); + define('HORDE_BASE', $kronolith_dir . '/../..'); } } /* Load the Horde Framework core, and set up inclusion paths. */ require_once HORDE_BASE . '/lib/core.php'; +Horde_Autoloader::addClassPath($kronolith_dir); +Horde_Autoloader::addClassPattern('/^Kronolith_/', $kronolith_dir); /* Registry. */ $session_control = Util::nonInputVar('session_control'); @@ -50,14 +53,11 @@ define('KRONOLITH_TEMPLATES', $registry->get('templates')); /* Find the base file path of Kronolith. */ if (!defined('KRONOLITH_BASE')) { - define('KRONOLITH_BASE', dirname(__FILE__) . '/..'); + define('KRONOLITH_BASE', $kronolith_dir . '/..'); } /* Horde framework libraries. */ -require_once 'Horde/Date.php'; -require_once 'Horde/Date/Recurrence.php'; require_once 'Horde/Help.php'; -require_once 'Horde/History.php'; /* Notification system. */ $notification = &Notification::singleton(); @@ -72,9 +72,6 @@ require_once 'Horde/Prefs/CategoryManager.php'; $GLOBALS['cManager'] = new Prefs_CategoryManager(); $GLOBALS['cManager_fgColors'] = $GLOBALS['cManager']->fgColors(); -/* PEAR Date_Calc. */ -require_once 'Date/Calc.php'; - /* Start compression, if requested. */ Horde::compressOutput(); @@ -82,10 +79,9 @@ Horde::compressOutput(); NLS::setTimeZone(); /* Create a calendar backend object. */ -$GLOBALS['kronolith_driver'] = &Kronolith_Driver::factory(); +$GLOBALS['kronolith_driver'] = Kronolith_Driver::factory(); /* Create a share instance. */ -require_once 'Horde/Share.php'; $GLOBALS['kronolith_shares'] = &Horde_Share::singleton($registry->getApp()); Kronolith::initialize(); @@ -99,26 +95,22 @@ require_once 'Horde/Maintenance.php'; if (Kronolith::loginTasksFlag() && !strstr($_SERVER['PHP_SELF'], 'maintenance.php') && !headers_sent() && !defined('AUTH_HANDLER') && - $GLOBALS['prefs']->getValue('do_maintenance')) { - + $GLOBALS['prefs']->getValue('do_maintenance')) { Kronolith::loginTasksFlag(2); - $maint = &Maintenance::factory('kronolith', array('last_maintenance' => $GLOBALS['prefs']->getValue('last_kronolith_maintenance'))); + $maint = Maintenance::factory('kronolith', array('last_maintenance' => $GLOBALS['prefs']->getValue('last_kronolith_maintenance'))); if (!$maint) { $GLOBALS['notification']->push(_("Could not execute maintenance operations."), 'horde.warning'); } else { $maint->runMaintenance(); } Kronolith::loginTasksFlag(0); - } elseif (Util::getFormData(MAINTENANCE_DONE_PARAM) && Kronolith::loginTasksFlag()) { - - $maint = &Maintenance::factory('kronolith', array('last_maintenance' => $GLOBALS['prefs']->getValue('last_kronolith_maintenance'))); - if (!$maint) { - $GLOBALS['notification']->push(_("Could not execute maintenance operations."), 'horde.warning'); - } else { - $maint->runMaintenance(); - } - Kronolith::loginTasksFlag(0); - + $maint = Maintenance::factory('kronolith', array('last_maintenance' => $GLOBALS['prefs']->getValue('last_kronolith_maintenance'))); + if (!$maint) { + $GLOBALS['notification']->push(_("Could not execute maintenance operations."), 'horde.warning'); + } else { + $maint->runMaintenance(); + } + Kronolith::loginTasksFlag(0); } diff --git a/kronolith/lib/prefs.php b/kronolith/lib/prefs.php index 95da5e5a7..3bde1aaf2 100644 --- a/kronolith/lib/prefs.php +++ b/kronolith/lib/prefs.php @@ -21,7 +21,6 @@ function handle_remote_cal_management($updated) $key = Auth::getCredential('password'); if ($key) { - require_once 'Horde/Secret.php'; $calUser = base64_encode(Secret::write($key, $calUser)); $calPasswd = base64_encode(Secret::write($key, $calPasswd)); } @@ -156,7 +155,6 @@ function prefs_callback() if ($GLOBALS['prefs']->isDirty('event_alarms')) { $alarms = $GLOBALS['registry']->callByPackage('kronolith', 'listAlarms', array($_SERVER['REQUEST_TIME'])); if (!is_a($alarms, 'PEAR_Error') && !empty($alarms)) { - require_once 'Horde/Alarm.php'; $horde_alarm = Horde_Alarm::factory(); foreach ($alarms as $alarm) { $alarm['start'] = new Horde_Date($alarm['start']); diff --git a/kronolith/month.php b/kronolith/month.php index aecbfec3b..7c629cb00 100644 --- a/kronolith/month.php +++ b/kronolith/month.php @@ -1,7 +1,5 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ require_once dirname(__FILE__) . '/lib/base.php'; diff --git a/kronolith/workweek.php b/kronolith/workweek.php index 81711c6fa..ef76f0740 100644 --- a/kronolith/workweek.php +++ b/kronolith/workweek.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ require_once dirname(__FILE__) . '/lib/base.php'; diff --git a/kronolith/year.php b/kronolith/year.php index c6bee9460..3330c70c2 100644 --- a/kronolith/year.php +++ b/kronolith/year.php @@ -1,13 +1,12 @@ + * @author Chuck Hagenbuch + * @package Kronolith */ require_once dirname(__FILE__) . '/lib/base.php';