} } else { set_time_limit(300); $title = $description = $startDate = $startTime = $endDate = $endTime = $location = $curDate = $url = ''; $isLoop = false; $events = explode("BEGIN:VEVENT", $import); foreach ($events as $val) { $matches = preg_split("/([A-Z\\-\\;\\=]+.*):/", $val, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); if (in_array("SUMMARY", $matches)) { $dates = array(); $i = 0; $startDate = $endDate = ''; while ($i < count($matches)) { if (strrpos($matches[$i], "SUMMARY") === 0) { $title = preg_replace("/\r|\t|\\\\n|\\\\|\n|/", "", $matches[$i + 1]); $title = cleanXMLChars($title); } if (strrpos($matches[$i], "DESCRIPTION") === 0) { $description = preg_replace("/\r|\t|\\\\n|\\\\|/", "", $matches[$i + 1]); $description = preg_replace("/\n/", " ", $description); $description = preg_replace("/'/", "\\'", $description); $description = preg_replace("/______________________________Calendar Subscription Powered by Helios Calendar/", "", $description); $description = preg_replace("/______________________________This Event Downloaded From a Helios Calendar Powered Site/", "", $description); } if (strrpos($matches[$i], "DTSTART") === 0 || strrpos($matches[$i], "DTEND") === 0) { if ($startDate == '') { $startDate = date("Y-m-d", mktime(0, 0, 0, substr($matches[$i + 1], 4, 2), substr($matches[$i + 1], 6, 2), substr($matches[$i + 1], 0, 4))); if (substr($matches[$i + 1], 9, 6) != '' && is_numeric(substr($matches[$i + 1], 9, 6)) && substr($matches[$i + 1], 9, 6) != '') { $startTime = date("H:i:s", mktime(substr($matches[$i + 1], 9, 2), substr($matches[$i + 1], 11, 2), substr($matches[$i + 1], 13, 2), 1, 1, 1971)); } } else {
$result = doQuery($query); if (hasRows($result)) { echo ' <title>' . cleanXMLChars($feedName . ' - ' . CalName) . '</title>'; $cnt = 0; while ($row = mysql_fetch_row($result)) { $description = $hc_cfg[107] > 0 ? clean_truncate($row[2], $hc_cfg[107]) : $row[2]; $comment = $hc_cfg[25] != '' ? '<comments><![CDATA[' . CalRoot . '/index.php?eID=' . $row[0] . '#disqus_thread' . ']]></comments>' : ''; echo ' <item> <title>' . cleanXMLChars(stampToDate(cOut($row[3]), $hc_cfg[24])) . " - " . cleanXMLChars(cOut($row[1])) . '</title> <link><![CDATA[' . CalRoot . '/index.php?eID=' . $row[0] . ']]></link> <description>' . cleanXMLChars(cOut($description)) . '</description> ' . $comment . ' <guid>' . CalRoot . '/index.php?eID=' . $row[0] . '</guid> <pubDate>' . cleanXMLChars(stampToDate($row[3] . ' ' . $row[4], "%a, %d %b %Y %H:%M:%S") . ' ' . $tzRSS) . '</pubDate> </item>'; ++$cnt; } } else { echo ' <title>' . $hc_lang_rss['RSSSorry'] . '</title> <item> <title>' . $hc_lang_rss['RSSNoEvents'] . '</title> <link>' . CalRoot . '/</link> <description>' . $hc_lang_rss['RSSNoLink'] . '</description> <guid>' . CalRoot . '/</guid> </item>'; } echo ' </channel>
$summary = mysql_result($result, 0, 1); $description = $hc_cfg[109] > 0 ? clean_truncate(strip_tags(mysql_result($result, 0, 8)), $hc_cfg[109]) . ' ' . $hc_lang_event['ReadMore'] . ' ' . CalRoot . '/?eID=' . $eID : mysql_result($result, 0, 8); if (mysql_result($result, 0, 33) == 0 or mysql_result($result, 0, 33) == '') { $location = mysql_result($result, 0, 2) . " - " . mysql_result($result, 0, 3) . " " . mysql_result($result, 0, 4) . ", " . mysql_result($result, 0, 5) . ", " . mysql_result($result, 0, 6) . " " . mysql_result($result, 0, 35) . " " . mysql_result($result, 0, 7); } else { $result = doQuery("SELECT * FROM " . HC_TblPrefix . "locations WHERE PkID = '" . cIn(mysql_result($result, 0, 33)) . "'"); $location = mysql_result($result, 0, 1) . " - " . mysql_result($result, 0, 2) . " " . mysql_result($result, 0, 3) . ", " . mysql_result($result, 0, 4) . ", " . mysql_result($result, 0, 5) . " " . mysql_result($result, 0, 6) . " " . mysql_result($result, 0, 7); } $descFooter = "\\n______________________________\\nEvent Downloaded Powered by OU Calendar"; if ($cID == 3) { header('Content-type: text/Calendar'); header('Content-Disposition: inline; filename="' . cleanXMLChars(str_replace(" ", "", $summary), 1) . '.ics"'); } else { header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-type: text/x-vCalendar'); header('Content-Disposition: inline; filename="' . cleanXMLChars(str_replace(" ", "", $summary), 1) . '.vcs"'); } echo "BEGIN:VCALENDAR\r\n"; echo "VERSION:2.0\r\n"; echo "METHOD:PUBLISH\r\n"; echo "CALSCALE:GREGORIAN\r\n"; echo "PRODID:-//Helios Calendar//EN\r\n"; echo "X-FROM-URL:" . CalRoot . "/index.php?eID=" . $eID . "\r\n"; echo "X-WR-RELCALID:" . CalName . " " . cOut(cleanSpecialChars(strip_tags($summary))) . " " . $startDate . "\r\n"; echo "X-WR-TIMEZONE:" . $tzSend . "\r\n"; echo "X-WR-CALNAME:" . CalName . "\r\n"; echo "BEGIN:VEVENT\r\n"; echo "URL;VALUE=URI:" . CalRoot . "/index.php?eID=" . $eID . "\r\n"; if ($allDay == false) { echo "DTSTART:" . $startDate . "\r\n"; echo "DTEND:" . $endDate . "\r\n";
/** * Output Event Search Results * @since 2.0.0 * @version 2.0.0 * @return void */ function sr_forms_search_result() { global $hc_cfg, $hc_lang_search; $sQuery = $rQuery = $link = $date = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $startDate = isset($_POST['startDate']) ? strtotime(dateToMySQL(cIn(strip_tags($_POST['startDate'])), $hc_cfg[24])) : strtotime(SYSDATE); $endDate = isset($_POST['endDate']) ? strtotime(dateToMySQL(cIn(strip_tags($_POST['endDate'])), $hc_cfg[24])) : strtotime(SYSDATE) + 86400 * $hc_cfg[53]; $keyword = isset($_POST['keyword']) ? strip_tags(str_replace("'", "\"", $_POST['keyword'])) : ''; $keyword .= isset($_POST['hc_search_keyword']) ? strip_tags(str_replace("'", "\"", urldecode($_POST['hc_search_keyword']))) : ''; $location = isset($_POST['locPreset']) ? cIn(strip_tags($_POST['locPreset'])) : ''; $city = isset($_POST['city']) ? cIn(strip_tags($_POST['city'])) : ''; $state = isset($_POST['locState']) ? cIn(strip_tags($_POST['locState'])) : ''; $postal = isset($_POST['postal']) ? cIn(strip_tags($_POST['postal'])) : ''; $catIDs = isset($_POST['catID']) ? implode(',', array_filter($_POST['catID'], 'is_numeric')) : ''; $doRecur = isset($_POST['recurSet']) && $_POST['recurSet'] == 1 ? 1 : 0; } else { $startDate = isset($_GET['s']) ? cIn(strip_tags(urldecode($_GET['s']))) : strtotime(SYSDATE); $endDate = isset($_GET['e']) ? cIn(strip_tags(urldecode($_GET['e']))) : strtotime(SYSDATE) + 86400 * $hc_cfg[53]; $keyword = isset($_GET['k']) ? strip_tags(str_replace("\"", "'", html_entity_decode(urldecode($_GET['k'])))) : ''; $location = isset($_GET['l']) ? cIn(strip_tags(urldecode(cIn($_GET['l'])))) : ''; $city = isset($_GET['c']) ? cIn(strip_tags(urldecode($_GET['c']))) : ''; $state = isset($_GET['st']) ? cIn(strip_tags(urldecode($_GET['st']))) : ''; $postal = isset($_GET['p']) ? cIn(strip_tags(urldecode($_GET['p']))) : ''; $catIDs = isset($_GET['t']) ? implode(',', array_filter(explode(',', urldecode($_GET['t'])), 'is_numeric')) : ''; $doRecur = isset($_GET['r']) && $_GET['r'] == 1 ? 1 : 0; } if ($keyword != '') { $sQuery .= " AND MATCH(e.Title,e.LocationName,e.Description) AGAINST('" . cIn($keyword, 0) . "' IN BOOLEAN MODE) "; $link .= "&k=" . urlencode(cleanXMLChars(cOut($keyword), 1)); } if (is_numeric($location) && $location > 0) { $sQuery .= " AND l.PkID = '" . $location . "'"; $link .= "&l=" . urlencode($location); } if ($city != '') { $sQuery .= " AND (l.IsActive = 1 OR l.IsActive is NULL) AND (e.LocationCity = '" . cIn($city) . "' OR l.City = '" . cIn($city) . "')"; $link .= "&c=" . urlencode($city); } if ($state != '') { $sQuery .= " AND (e.LocationState = '" . cIn($state) . "' or l.State = '" . cIn($state) . "')"; $link .= "&st=" . urlencode($state); } if ($postal != '') { $sQuery .= " AND (e.LocationZip = '" . cIn($postal) . "' or l.Zip = '" . cIn($postal) . "')"; $link .= "&p=" . urlencode(cIn($postal)); } if ($catIDs != '') { $sQuery .= " AND (ec.CategoryID In(" . cIn($catIDs) . "))"; $link .= "&t=" . urlencode($catIDs); } if ($doRecur == 1) { $rQuery = " AND e.SeriesID IS NULL \r\n UNION\r\n SELECT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, \r\n e.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry,\r\n l.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID, GROUP_CONCAT(c.CategoryName), e.Description, l.Address2\r\n FROM " . HC_TblPrefix . "events e\r\n LEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n LEFT JOIN " . HC_TblPrefix . "events e2 ON (e.SeriesID = e2.SeriesID AND e2.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "' AND e.StartDate > e2.StartDate)\r\n LEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n LEFT JOIN " . HC_TblPrefix . "categories c ON (ec.CategoryID = c.PkID)\r\n WHERE\r\n e2.StartDate IS NULL AND e.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "'" . $sQuery . " AND e.IsActive = 1 AND e.IsApproved = 1 AND e.SeriesID IS NOT NULL \r\n GROUP BY e.SeriesID, e.PkID"; } if ($doRecur == 0) { $rQuery = " GROUP BY e.PkId"; } $startDate = $startDate == '' || !is_numeric($startDate) ? strtotime(SYSDATE) : $startDate; $endDate = $endDate == '' || !is_numeric($endDate) ? strtotime(SYSDATE) + $hc_cfg[53] * 86400 : $endDate; $result = doQuery("SELECT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, \r\n e.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry,\r\n l.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID, GROUP_CONCAT(c.CategoryName), e.Description, l.Address2\r\n FROM " . HC_TblPrefix . "events e\r\n LEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n LEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n LEFT JOIN " . HC_TblPrefix . "categories c ON (ec.CategoryID = c.PkID)\r\n WHERE e.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "'" . $sQuery . " AND e.IsActive = 1 AND e.IsApproved = 1" . $rQuery . " ORDER BY StartDate, TBD, StartTime, Title"); if (!hasRows($result)) { echo ' <p>' . $hc_lang_search['NoResults'] . '</p> <p><a href="' . CalRoot . '/index.php?com=search">' . $hc_lang_search['SearchAgain'] . '</a></p>'; return 0; } echo '<p>' . $hc_lang_search['ResultLabel'] . ' [<a href="' . CalRoot . '/index.php?com=searchresult&r=' . $doRecur . "&s=" . urlencode($startDate) . "&e=" . urlencode($endDate) . $link . '">' . $hc_lang_search['ResultLink'] . '</a>]'; $cnt = 0; $row_number = 1; $show_images = 1; echo '<div id="events">'; while ($row = mysql_fetch_row($result)) { if (is_null($row[0])) { continue; } //two matches in query lead to a null // if(($date != $row[2])){ // $date = $row[2]; // echo ($cnt > 0) ? ' // </ul>' : ''; // echo ' // <header>' . stampToDate($row[2], $hc_cfg[14]) . '</header> // <ul>'; // $cnt = 1; // } // $hl = ($cnt % 2 == 0) ? ' class="hl"' : ''; // if($row[5] == 0){ // $time = ($row[3] != '') ? stampToDate($row[3], $hc_cfg[23]) : ''; // $time .= ($row[4] != '') ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : ''; // $stamp = date("Y-m-d\Th:i:00.0",strtotime($row[2] . trim(' '.$row[3]))) . HCTZ; // } else { // $time = ($row[5] == 1) ? $hc_lang_search['AllDay'] : $hc_lang_search['TBA']; // $stamp = date("Y-m-d",strtotime($row[2]));} // echo ' // <li'.$hl.'><time datetime="'.$stamp.'">'.$time.'</time><a href="'.CalRoot . '/index.php?eID='.$row[0].'">'.cOut($row[1]).'</a></li>'; // ++$cnt; $color_class = sr_colorizer($row_number); $description = $hc_cfg[107] > 0 ? clean_truncate($row[21], $hc_cfg[107]) : $row[21]; $categories = explode(",", $row[20]); //filtering out ACE switch (count($categories)) { case 0: $category = 'No Category'; break; case 1: $category = substr($categories[0], 3); break; default: $category = substr($categories[0], -4) != '_ACE' ? substr($categories[0], 3) : substr($categories[1], 3); break; } $category = '<h4>' . $category . '</h4>'; if ($date != $row[2]) { $date = $row[2]; echo $cnt > 0 ? '</ul>' : ''; echo '<h2>' . stampToDate($row[2], '%A, %B %d, %Y') . '</h2><ul>'; $cnt = 1; } $limit = $row[8] > 0 ? cOut($row[8]) : $hc_cfg[134]; $expire = $limit > 0 ? date("Y-m-d", strtotime($date) + $limit * 86400) : ''; $cls = $cnt % 2 == 0 ? 'hl' : ''; $cls .= $row[7] > 0 ? ' featured' : ''; if ($row[5] == 0) { $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : ''; $time .= $row[4] != '' ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : ''; //$stamp = date("Y-m-d\Th:i:00",strtotime($row[2] . trim(' '.$row[3]))) . HCTZ; $stamp = stampToDate($row[2], '%A, %B %d'); //$hc_cfg[14] } else { $time = $row[5] == 1 ? $hc_lang_event['AllDay'] : $hc_lang_event['TBA']; $stamp = $row[2]; $stamp = stampToDate($row[2], '%A, %B %d'); } echo ' <li ' . ($cls != '' ? 'class="' . $color_class . ' ' . trim($cls) . '" ' : 'class="' . $color_class . '"') . 'itemscope itemtype="http://schema.org/Event"> <a href="' . CalRoot . '/index.php?eID=' . $row[0] . '">' . '<div class="event-content-container">' . $category . '<h3 itemprop="name">' . cOut($row[1]) . '</h3><div class="date-time"> <span itemprop="startDate" datetime="' . $stamp . '">' . $stamp . ', ' . $time . '</span> <span class="location"><i class="fa fa-map-marker"></i> ' . $row[14] . ($row[22] != '' ? ' - ' . $row[22] : '') . '</span></div><p>' . strip_tags(cOut($description)) . '<span class="readmore"> READ MORE</span></p></div>' . ($show_images == 1 && $row[6] != '' ? '<div class="event-image-container" style="background-image: url(' . $row[6] . '); min-width:' . (strlen($row[1]) > 43 ? 325 : 287) . 'px;"></div>' : '') . '</a></li>'; ++$cnt; ++$row_number; //<img itemprop="image" src="'.$row[6].'" class="eimage_b" /> } echo '</ul></div>'; }
} $comment = $hc_cfg[25] != '' ? '<comments><![CDATA[' . CalRoot . '/index.php?eID=' . $row[0] . '#disqus_thread' . ']]></comments>' : ''; echo ' <item> <title>' . cleanXMLChars(stampToDate(cOut($row[3]), $hc_cfg[24])) . " - " . cleanXMLChars(cOut($row[1])) . '</title> <link><![CDATA[' . CalRoot . '/index.php?eID=' . $row[0] . ']]></link> <description>' . cleanXMLChars(cOut($description)) . '</description> ' . $comment . ' <guid>' . CalRoot . '/index.php?eID=' . $row[0] . '</guid> <pubDate>' . cleanXMLChars(stampToDate($row[3] . ' ' . $row[4], "%a, %d %b %Y %H:%M:%S") . ' ' . $tzRSS) . '</pubDate> <date>' . $date . '</date> <startTime>' . date("h:i A", strtotime(stampToDate($row[3] . ' ' . $row[4], "%d %b %Y %H:%M:%S"))) . '</startTime> <endTime>' . date("h:i A", strtotime(stampToDate($row[3] . ' ' . $row[7], "%d %b %Y %H:%M:%S"))) . '</endTime> <location>' . $row[8] . '</location> <category>' . cleanXMLChars($category) . '</category> <eventName>' . cleanXMLChars(cOut($row[1])) . '</eventName> <test>' . $min . '</test> </item>'; ++$cnt; } } else { echo ' <title>' . $hc_lang_rss['RSSSorry'] . '</title> <item> <title>' . $hc_lang_rss['RSSNoEvents'] . '</title> <link>' . CalRoot . '/</link> <description>' . $hc_lang_rss['RSSNoLink'] . '</description> <guid>' . CalRoot . '/</guid> </item>'; } echo '
$location = mysql_result($result, 0, 1) . " - " . mysql_result($result, 0, 2) . " " . mysql_result($result, 0, 3) . ", " . mysql_result($result, 0, 4) . ", " . mysql_result($result, 0, 5) . " " . mysql_result($result, 0, 6) . " " . mysql_result($result, 0, 7); $tzOffset = date("O") + $hc_cfg[35] * 100; if ($tzOffset == 0) { $tzOffset = "+0000"; } elseif ($tzOffset < 0) { if (strlen($tzOffset) < 5) { $tzOffset = ltrim($tzOffset, "-"); $tzOffset = "-0" . $tzOffset; } } elseif ($tzOffset > 0) { $tzOffset = strlen($tzOffset) < 4 ? '+0' . $tzOffset : '+' . $tzOffset; } $result = doQuery("SELECT * FROM " . HC_TblPrefix . "events WHERE LocID = '" . $lID . "' AND StartDate >= '" . date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y"))) . "' ORDER BY StartDate, StartTime"); $descFooter = "\\n______________________________\\nCalendar Feed Powered by Helios Calendar"; header('Content-type: text/Calendar'); header('Content-Disposition: inline; filename="' . cleanXMLChars(str_replace(" ", "", $locName), 1) . '.ics"'); echo "BEGIN:VCALENDAR\r\n"; echo "VERSION:2.0\r\n"; echo "METHOD:PUBLISH\r\n"; echo "CALSCALE:GREGORIAN\r\n"; echo "PRODID:-//Helios Calendar//EN\r\n"; echo "X-FROM-URL:" . CalRoot . "/\r\n"; echo "X-WR-RELCALID:" . cleanSpecialChars(strip_tags($locName)) . " Event : Powered by Helios Calendar\r\n"; echo "X-WR-CALNAME:" . cleanSpecialChars($locName) . "\r\n"; while ($row = mysql_fetch_row($result)) { $dtStamp = date("Ymd\\TH:i:sO", mktime(0, 0, 0, 1, 1, 1971)); $starttimepart = explode(":", $row[10]); $startdatepart = explode("-", $row[9]); $endtimepart = explode(":", $row[12]); $allDay = false; if ($row[10] != '') {
/** * Output Event Search Results * @since 2.0.0 * @version 2.0.0 * @return void */ function search_result() { global $hc_cfg, $hc_lang_search; $sQuery = $rQuery = $link = $date = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $startDate = isset($_POST['startDate']) ? strtotime(dateToMySQL(cIn(strip_tags($_POST['startDate'])), $hc_cfg[24])) : strtotime(SYSDATE); $endDate = isset($_POST['endDate']) ? strtotime(dateToMySQL(cIn(strip_tags($_POST['endDate'])), $hc_cfg[24])) : strtotime(SYSDATE) + 86400 * $hc_cfg[53]; $keyword = isset($_POST['keyword']) ? strip_tags(str_replace("'", "\"", $_POST['keyword'])) : ''; $keyword .= isset($_POST['hc_search_keyword']) ? strip_tags(str_replace("'", "\"", urldecode($_POST['hc_search_keyword']))) : ''; $location = isset($_POST['locPreset']) ? cIn(strip_tags($_POST['locPreset'])) : ''; $city = isset($_POST['city']) ? cIn(strip_tags($_POST['city'])) : ''; $state = isset($_POST['locState']) ? cIn(strip_tags($_POST['locState'])) : ''; $postal = isset($_POST['postal']) ? cIn(strip_tags($_POST['postal'])) : ''; $catIDs = isset($_POST['catID']) ? implode(',', array_filter($_POST['catID'], 'is_numeric')) : ''; $doRecur = isset($_POST['recurSet']) && $_POST['recurSet'] == 1 ? 1 : 0; } else { $startDate = isset($_GET['s']) ? cIn(strip_tags(urldecode($_GET['s']))) : strtotime(SYSDATE); $endDate = isset($_GET['e']) ? cIn(strip_tags(urldecode($_GET['e']))) : strtotime(SYSDATE) + 86400 * $hc_cfg[53]; $keyword = isset($_GET['k']) ? strip_tags(str_replace("\"", "'", html_entity_decode(urldecode($_GET['k'])))) : ''; $location = isset($_GET['l']) ? cIn(strip_tags(urldecode(cIn($_GET['l'])))) : ''; $city = isset($_GET['c']) ? cIn(strip_tags(urldecode($_GET['c']))) : ''; $state = isset($_GET['st']) ? cIn(strip_tags(urldecode($_GET['st']))) : ''; $postal = isset($_GET['p']) ? cIn(strip_tags(urldecode($_GET['p']))) : ''; $catIDs = isset($_GET['t']) ? implode(',', array_filter(explode(',', urldecode($_GET['t'])), 'is_numeric')) : ''; $doRecur = isset($_GET['r']) && $_GET['r'] == 1 ? 1 : 0; } if ($keyword != '') { $sQuery .= " AND MATCH(e.Title,e.LocationName,e.Description) AGAINST('" . cIn($keyword, 0) . "' IN BOOLEAN MODE) "; $link .= "&k=" . urlencode(cleanXMLChars(cOut($keyword), 1)); } if (is_numeric($location) && $location > 0) { $sQuery .= " AND l.PkID = '" . $location . "'"; $link .= "&l=" . urlencode($location); } if ($city != '') { $sQuery .= " AND (l.IsActive = 1 OR l.IsActive is NULL) AND (e.LocationCity = '" . cIn($city) . "' OR l.City = '" . cIn($city) . "')"; $link .= "&c=" . urlencode($city); } if ($state != '') { $sQuery .= " AND (e.LocationState = '" . cIn($state) . "' or l.State = '" . cIn($state) . "')"; $link .= "&st=" . urlencode($state); } if ($postal != '') { $sQuery .= " AND (e.LocationZip = '" . cIn($postal) . "' or l.Zip = '" . cIn($postal) . "')"; $link .= "&p=" . urlencode(cIn($postal)); } if ($catIDs != '') { $sQuery .= " AND (ec.CategoryID In(" . cIn($catIDs) . "))"; $link .= "&t=" . urlencode($catIDs); } if ($doRecur == 1) { $rQuery = " AND SeriesID IS NULL \r\n\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\tSELECT DISTINCT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "events e2 ON (e.SeriesID = e2.SeriesID AND e2.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "' AND e.StartDate > e2.StartDate)\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\te2.StartDate IS NULL AND e.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "'" . $sQuery . " AND e.IsActive = 1 AND e.IsApproved = 1 AND e.SeriesID IS NOT NULL \r\n\t\t\t\t\t\tGROUP BY e.SeriesID, e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD"; } $startDate = $startDate == '' || !is_numeric($startDate) ? strtotime(SYSDATE) : $startDate; $endDate = $endDate == '' || !is_numeric($endDate) ? strtotime(SYSDATE) + $hc_cfg[53] * 86400 : $endDate; $result = doQuery("SELECT DISTINCT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\tWHERE e.StartDate BETWEEN '" . date("Y-m-d", $startDate) . "' AND '" . date("Y-m-d", $endDate) . "'" . $sQuery . " AND e.IsActive = 1 AND e.IsApproved = 1" . $rQuery . " ORDER BY StartDate, TBD, StartTime, Title"); if (!hasRows($result)) { echo ' <p>' . $hc_lang_search['NoResults'] . '</p> <p><a href="' . CalRoot . '/index.php?com=search">' . $hc_lang_search['SearchAgain'] . '</a></p>'; return 0; } echo '<p>' . $hc_lang_search['ResultLabel'] . ' [<a href="' . CalRoot . '/index.php?com=searchresult&r=' . $doRecur . "&s=" . urlencode($startDate) . "&e=" . urlencode($endDate) . $link . '">' . $hc_lang_search['ResultLink'] . '</a>]'; $cnt = 0; while ($row = mysql_fetch_row($result)) { if ($date != $row[2]) { $date = $row[2]; echo $cnt > 0 ? ' </ul>' : ''; echo ' <header>' . stampToDate($row[2], $hc_cfg[14]) . '</header> <ul>'; $cnt = 1; } $hl = $cnt % 2 == 0 ? ' class="hl"' : ''; if ($row[5] == 0) { $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : ''; $time .= $row[4] != '' ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : ''; $stamp = date("Y-m-d\\Th:i:00.0", strtotime($row[2] . trim(' ' . $row[3]))) . HCTZ; } else { $time = $row[5] == 1 ? $hc_lang_search['AllDay'] : $hc_lang_search['TBA']; $stamp = date("Y-m-d", strtotime($row[2])); } echo ' <li' . $hl . '><time datetime="' . $stamp . '">' . $time . '</time><a href="' . CalRoot . '/index.php?eID=' . $row[0] . '">' . cOut($row[1]) . '</a></li>'; ++$cnt; } echo '</ul>'; }