From fbac860c3f42ab8ceec93c510a8adeac7b58657c Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 10 May 2010 15:48:11 +0200 Subject: [PATCH] Update/fix agenda script. --- kronolith/scripts/agenda.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kronolith/scripts/agenda.php b/kronolith/scripts/agenda.php index 82d03690a..d3f7c6eb1 100755 --- a/kronolith/scripts/agenda.php +++ b/kronolith/scripts/agenda.php @@ -9,7 +9,7 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/Application.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true)); send_agendas(); @@ -24,7 +24,7 @@ function send_agendas() $runtime = time(); } - $calendars = $GLOBALS['shares']->listAllShares(); + $calendars = $GLOBALS['kronolith_shares']->listAllShares(); // If there are no calendars to check, we're done. if (!count($calendars)) { @@ -41,7 +41,7 @@ function send_agendas() $users = array(); foreach (array_keys($calendars) as $calendarId) { try { - $calendar = $GLOBALS['shares']->getShare($calendarId); + $calendar = $GLOBALS['kronolith_shares']->getShare($calendarId); } catch (Exception $e) { continue; } @@ -86,18 +86,18 @@ function send_agendas() // If we found an email address, generate the agenda. switch ($agenda_calendars) { case 'owner': - $calendars = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, $user); + $calendars = $GLOBALS['kronolith_shares']->listShares($user, Horde_Perms::SHOW, $user); break; case 'read': - $calendars = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, null); + $calendars = $GLOBALS['kronolith_shares']->listShares($user, Horde_Perms::SHOW, null); break; case 'show': default: $calendars = array(); $shown_calendars = unserialize($prefs->getValue('display_cals')); - $cals = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, null); + $cals = $GLOBALS['kronolith_shares']->listShares($user, Horde_Perms::SHOW, null); foreach ($cals as $calId => $cal) { if (in_array($calId, $shown_calendars)) { $calendars[$calId] = $cal; @@ -113,7 +113,7 @@ function send_agendas() foreach ($events as $dayevents) { foreach ($dayevents as $event) { // The event list contains events starting at 12am. - if ($event->start->mday != $runtime->mday) { + if ($event->start->compareDate($runtime)) { continue; } $eventlist[$event->start->strftime('%Y%m%d%H%M%S')] = $event; @@ -131,16 +131,16 @@ function send_agendas() $twentyFour = $prefs->getValue('twentyFour'); $dateFormat = $prefs->getValue('date_format'); Horde_Nls::setLanguageEnvironment($lang); - $mime_mail = new Horde_Mime_Mail(array('subject' => sprintf(_("Your daily agenda for %s"), strftime($dateFormat, $runtime)), + $mime_mail = new Horde_Mime_Mail(array('subject' => sprintf(_("Your daily agenda for %s"), $runtime->strftime($dateFormat)), 'to' => $email, 'from' => $GLOBALS['conf']['reminder']['from_addr'], 'charset' => Horde_Nls::getCharset())); - $mime_mail->addHeader('User-Agent', 'Kronolith ' . $registry->getVersion()); + $mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); $pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8); $message = sprintf(_("Your daily agenda for %s"), - strftime($dateFormat, $runtime)) + $runtime->strftime($dateFormat)) . "\n\n"; foreach ($eventlist as $event) { if ($event->isAllDay()) { -- 2.11.0