Hello, I have some calendar code that works in MODx Revo versions up to 2.0.8. I've upgraded to Revo 2.1.5 and I now get a blank (white) page. Removing the script from the page will make it work again. Is there any legacy code being used in this PHP code?
<?php
/**
* @name EasyEvents_ListMini
* @package Easy Events
*
* This snippet does all the processing necessary to load a mini calendar and
* the event list/details on a page.
*
* Snippet parameters
*
* nodes (REQUIRED)
* A single document id, or a string of comma separated document IDs that serve
* as starting points under which events will be searched. You must have at
* least one node.
*
* calHolder, listHolder (Optional)
* These are the placeholder names you'll use to load the calendar and
* list/details respectively. If not specified, the default from the config file
* will be used. The only time you might want to specify this explicitly is when
* you have more than one mini calendar and list/details on a page and you need
* to separate them.
*
* calDiv, listDiv (Optional)
* These are the divs in which the placeholders (above) reside. Like the
* placeholders, these will default to the config file setting and don't
* generally need to be defined.
*/
// Initialize
$now = time();
$gotoDetailsPage = $modx->getOption('gotoDetailsPage',$scriptProperties,0);
$nodes = $modx->getOption('nodes',$scriptProperties,null);
if ( !isset($nodes) )
{
return 'Node specification error';
}
// Include Easy Events class and instantiate object
include_once $modx->getOption('core_path', $properties, MODX_CORE_PATH) . 'components/EasyEvents/EasyEvents.class.php';
$g_easyEvents = new EasyEvents($modx, $scriptProperties);
// Initialize placeholder names
$calHolder = $modx->getOption('miniCalPlaceholder',$scriptProperties,'');
$listHolder = $modx->getOption('listDetailsPlaceholder',$scriptProperties,'');
$monthLinksHolder = $modx->getOption('monthLinksPlaceholder',$scriptProperties,'');
$calDiv = $modx->getOption('calDiv',$scriptProperties,'');
$listDiv = $modx->getOption('listDiv',$scriptProperties,'');
// Gather relevant query string values and normalize (non-AJAX mode)
$month = ((int)$_GET[$g_easyEvents->properties['selectedMonth']]) ? str_pad((int)$_GET[$g_easyEvents->properties['selectedMonth']],2,'0',STR_PAD_LEFT) : date('m',$now);
$year = ((int)$_GET[$g_easyEvents->properties['selectedYear']]) ? str_pad((int)$_GET[$g_easyEvents->properties['selectedYear']],4,'0',STR_PAD_LEFT) : date('Y',$now);
$day = ((int)$_GET[$g_easyEvents->properties['selectedDay']]) ? str_pad((int)$_GET[$g_easyEvents->properties['selectedDay']],2,'0',STR_PAD_LEFT) : date('d',$now);
// Get calendar code
$miniCal = $g_easyEvents->makeMiniCalendar($year,$month,$day,$modx->resource->get('id'),$gotoDetailsPage);
$modx->setPlaceholder($calHolder,$miniCal);
/* ****************************************************************************
* List
* ***************************************************************************/
// Initialize
$listDetails = '';
$listPage = $modx->resource->get('id');
$maxEvents = $modx->getOption('maxEvents',$scriptProperties,10);
$inputEndDate = $modx->getOption('endDate',$scriptProperties,null);
// Under normal circumstances, AJAX manages what get's displayed (default data,
// list of events, or event details). When JavaScript is unavailable, it is
// necessary to inspect the query sting and act accordingly for functional
// degradation.
// An event ID is passed, so show details
if ( (int)$_GET[$g_easyEvents->properties['eventId']] )
{
$listDetails .= $g_easyEvents->makeEventDetails((int)$_GET[$g_easyEvents->properties['eventId']]);
}
// No event ID is passed, but date info is, show list
else if (
(int)$_GET[$g_easyEvents->properties['selectedYear']] &&
(int)$_GET[$g_easyEvents->properties['selectedMonth']] &&
(int)$_GET[$g_easyEvents->properties['selectedDay']]
) {
// Make date to show
$year = (int)$_GET[$g_easyEvents->properties['selectedYear']];
$month = (int)$_GET[$g_easyEvents->properties['selectedMonth']];
$day = (int)$_GET[$g_easyEvents->properties['selectedDay']];
$selectedDate = $year.'-'.str_pad($month,2,'0',STR_PAD_LEFT).'-'.str_pad($day,2,'0',STR_PAD_LEFT);
//$heading = date($g_easyEvents->properties['dateFormat'],strtotime($selectedDate));
$heading = null;
$listDetails .= $g_easyEvents->makeEventList($selectedDate,$selectedDate,$heading,$gotoDetailsPage,$listPage,0,FALSE);
}
// A month and year are provided but no date
else if(
(int)$year &&
(int)$month &&
!(int)$_GET[$g_easyEvents->properties['selectedDay']] &&
!$endDate
)
{
$startDate = "$year-$month-01";
$endDate = $year.'-'.$month.'-'.date('t',strtotime($startDate));
$heading = date($g_easyEvents->properties['dateFormat'],strtotime($startDate)).' - '.date($g_easyEvents->properties['dateFormat'],strtotime($endDate));
// return $g_easyEvents->makeEventList($startDate,$endDate,$heading,$gotoDetailsPage,$listPageId);
$listDetails = $g_easyEvents->makeEventList($startDate,$endDate,$heading,$gotoDetailsPage,$listPageId);
} else if ($inputEndDate) {
$startDate = date('Y-m-d',time());
$endDate = date('Y-m-d', strtotime($inputEndDate));
$heading = null;
$listDetails = $g_easyEvents->makeEventList($startDate,$endDate,$heading,$gotoDetailsPage,$listPageId);
}
// Default - adequate Easy Events query string variables not present
else
{
// Create today's events list
$today = date('Y-m-d',time());
$nowTime = date('g:i:s',time());
if ( $todaysEvents = $g_easyEvents->makeEventList($today,$today,$todayTitle,$gotoDetailsPage,$listPageId,0,FALSE,TRUE,$nowTime) )
{
$listDetails .= $todaysEvents;
}
// Coming events
$tomorrow = date('Y-m-d',time()+(60*60*24));
$endDay = $g_easyEvents->upperDateBoundary;
if ( $comingEvents = $g_easyEvents->makeEventList($tomorrow,$endDay,$comingTitle,$gotoDetailsPage,$listPageId,$maxEvents) )
{
$listDetails .= $comingEvents;
}
// Default message if no events found
if ( !$listDetails )
{
$listDetails .= $modx->getChunk($g_easyEvents->properties['tplNoEvents'],array(
$g_easyEvents->properties['missingEventsMessagePlaceholder'] => $modx->lexicon('easyevents.noEvents')
));
}
}
$modx->setPlaceholder($listHolder,$listDetails);
$monthLinks = $g_easyEvents->makeMonthLinks($month, $year, $listPageId);
$monthLinks = $modx->getChunk($g_easyEvents->properties['tplMonthLinksWrapper'],array('monthLinks' => $monthLinks));
$modx->setPlaceholder($monthLinksHolder, $monthLinks);
return;