Location: PHPKode > projects > JaxBlog > JaxBlog/app/user/user_events/user_events.php
<?php

require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'database.php');

// Check for XML request (XMLHttpRequest).
$request = isset($_GET['request']) ? $_GET['request'] : '';
if ($request == 'xml') {
	error_reporting(E_ALL);
	
	header('Content-Type: text/xml');
	$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
	
	if (!(isset($_GET['year']) && isset($_GET['month']))) {
		echo "<root></root>\n";
		exit;
	}
	
	$year = (int) $_GET['year'];
	$month_current = (int) $_GET['month'];
	$month_next = ((int) $_GET['month']) + 1;
	
	$date_start = date('Y-m-d', mktime(0, 0, 0, $month_current, 1, $year));
	$date_end = date('Y-m-d', mktime(0, 0, 0, $month_next, 1, $year));

	$sql = 'SELECT ' . databaseGetDate('scheduled_date', 'd') . ' AS day, title, description FROM Calendar WHERE scheduled_date >= ? AND scheduled_date < ? ORDER BY scheduled_date';
	$rows = databaseGetRows($sql, array($date_start, $date_end));
	
	$xml .= "<root>\n";
	foreach ($rows as $row) {
		$xml .= "<record>\n";
		$xml .= "\t<day>" . $row['day'] . "</day>\n";
		$xml .= "\t<title><![CDATA[" . $row['title'] . "]]></title>\n";
		$xml .= "\t<description><![CDATA[" . $row['description'] . "]]></description>\n";
		$xml .= "</record>\n";
	}
	$xml .= "</root>\n";
	
	echo $xml;
	exit;
}

?>
Return current item: JaxBlog