| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/tgnewdev/mod/ |
Upload File : |
<?php require('_mod_security.php'); ?>
<?php
$slug1 = parse_uri('slug1', 1, 'home', true);
$slug2 = parse_uri('slug2', 2);
if ($slug1 === 'categories') :
set_analytics_reference('category', lookup_db_field('categories', 'slug', $slug2, 'id'));
$sql = "SELECT c.name AS category_name, e.*, l.name AS location_name, l.slug AS location_slug FROM categories c
LEFT JOIN events_categories ec ON (c.id = ec.category_id)
LEFT JOIN events e ON (e.id = ec.event_id)
LEFT JOIN locations l ON (e.location_id = l.id AND l.status = 1)
WHERE c.slug = :slug AND c.active = 1 AND e.start_time_local > NOW() AND e.status = 1
ORDER BY e.start_time_local ASC
";
$stmt = $db->prepare($sql);
$stmt->execute([
':slug' => $slug2,
]);
$rows = $stmt->fetchAll(PDO::FETCH_OBJ);
if (count($rows) > 0) :
echo '<div class="content_left">';
add_seo_page_header($rows[0]->category_name . ' | Talks, Seminars & Discussions');
echo '<h1>' . $rows[0]->category_name . ' | Talks, Seminars & Discussions</h1>';
echo '<hr>';
echo '<h2>Upcoming Events</h2>';
echo '<ul>';
foreach ($rows as $row) :
echo '<li>';
echo date('M j', strtotime($row->start_time_local)) . ': ';
echo '<a href="events/' . $row->slug . '/">' . $row->name . '</a>';
if (!empty($row->location_name)) :
echo '<span class="event_category_location"> - <a href="locations/' . $row->location_slug . '/">' . $row->location_name . '</a></span>';
elseif (!empty($row->submitted_location)) :
echo '<span class="event_category_location"> - ' . $row->submitted_location . '</span>';
endif;
echo '</li>';
endforeach;
echo '</ul>';
echo '</div>'; //content_left
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
else :
return(page_404());
endif;
elseif (is_date($slug1)) :
set_analytics_reference('events_by_date', null);
echo '<div class="content_left">';
add_seo_page_header('Events - ' . date('F, j, Y', strtotime($slug1)));
echo '<h1>Events - ' . date('F, j, Y', strtotime($slug1)) . '</h1>';
$sql = "SELECT e.*,
JSON_ARRAYAGG(
JSON_OBJECT('category_slug', c.slug, 'category_name', c.name)
) AS categories
FROM events e
LEFT JOIN events_categories ec ON (e.id = ec.event_id)
LEFT JOIN categories c ON (c.id = ec.category_id AND c.active =1)
WHERE e.start_time_local >= :start_date AND e.start_time_local < DATE_ADD(:start_date, INTERVAL 1 DAY) AND e.status = 1
GROUP BY e.id
ORDER BY e.id
";
$stmt = $db->prepare($sql);
$stmt->execute([
'start_date' => $slug1,
]);
$rows = $stmt->fetchAll(PDO::FETCH_OBJ);
if (count($rows) > 0) :
foreach ($rows as $row) :
echo '<div class="event_list_by_date">';
if (!empty($row->featured_image)) :
echo '<img src="' . image_cache('img/content/' . $row->featured_image, 85, 200, 200) . '">';
endif;
$categories = json_decode($row->categories);
if (json_last_error() === JSON_ERROR_NONE) :
$i = 0;
foreach ($categories as $category) :
if ($i > 0) :
echo ', ';
endif;
echo '<a href="events/categories/' . $category->category_slug . '/">' . $category->category_name . '</a>';
$i++;
endforeach;
endif;
echo '<h2><a href="events/' . $row->slug . '/">' . $row->name . '</a></h2>';
echo '<div>' . excerpt($row->html, 25) . '</div>';
echo '<div style="margin-top:10px;"><a href="events/' . $row->slug . '/">Read More »</a></div>';
echo '<div class="cleardiv"> </div>';
echo '</div>';
endforeach;
else :
echo '<h2>No events for this date</h2>';
endif;
echo '</div>'; // conttent_left
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
elseif (($row = load_event($slug1)) && $slug2 === 'ical') :
// Set headers if you want to force download in browser
ob_clean();
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=' . $slug1 . '.ics');
// Build iCal content
$tz = new DateTimeZone($row->event_timezone);
$start = new DateTime($row->start_time_local, $tz);
$end = new DateTime($row->end_time_local, $tz);
$start_utc = clone $start;
$start_utc->setTimezone(new DateTimeZone('UTC'));
$end_utc = clone $end;
$end_utc->setTimezone(new DateTimeZone('UTC'));
$ical = "BEGIN:VCALENDAR\r\n";
$ical .= "VERSION:2.0\r\n";
$ical .= "PRODID:-//ThoughtGallery.org//NONSGML v1.0//EN\r\n";
$ical .= "METHOD:PUBLISH\r\n";
$ical .= "TZID:" . $row->event_timezone . "\r\n";
$ical .= "BEGIN:VEVENT\r\n";
$ical .= "UID:" . uniqid() . "@thoughtgallery.org\r\n";
$ical .= "DTSTAMP:" . gmdate('Ymd\THis\Z') . "\r\n";
$ical .= "DTSTART:" . $start_utc->format('Ymd\THis\Z') . "\r\n";
$ical .= "DTEND:" . $end_utc->format('Ymd\THis\Z') . "\r\n";
$ical .= "SUMMARY:" . html_to_ical_description($row->name) . "\r\n";
//$ical .= "DESCRIPTION:" . html_to_ical_description($row->html) . "\r\n";
if (!empty($row->location_id)) :
$ical .= "LOCATION:" . escape_ical_text($row->location_name . ' - ' . $row->address . ', ' . $row->city . ', ' . $row->state . ', ' . $row->zip) . "\r\n";
elseif (!empty($row->submitted_location)) :
$ical .= "LOCATION:" . escape_ical_text($row->submitted_location) . "\r\n";
endif;
$ical .= "END:VEVENT\r\n";
$ical .= "END:VCALENDAR\r\n";
// Output
echo $ical;
exit;
elseif ($row = load_event($slug1, !empty($_SESSION['logged_in']) && ($_GET['preview'] ?? '') === 'true')) :
set_analytics_reference('event', $row->id);
echo '<div class="content_left">';
add_seo_page_header($row->name, curr_page_url(), $row->html, (!empty($row->featured_image) ? image_url_fix($row->featured_image, 'img/content/', true) : ''));
if (!empty($row->custom_css)) :
add_custom_css($row->custom_css);
endif;
echo '<h1>' . $row->name . '</h1>';
if (strtotime($row->end_time_local) < time()) :
echo '<p class="announcement">This event has already taken place. Find a full list of upcoming events <a href="all-categories/">here</a>.</p>';
endif;
if (!empty($row->featured_image)) :
echo '<img class="event_featured_image" src="' . image_url_fix($row->featured_image, 'img/content/') . '" alt="' . $row->name . '">';
if (!empty($row->media_credit)) :
echo '<div class="photo_credit">' . $row->media_credit . '</div>';
endif;
endif;
echo '<br><strong>When: </strong>' . format_event_date_display($row->start_time_local, $row->end_time_local);
if (!empty($row->location_id)) :
echo '<br><br><strong>Where: </strong><a href="locations/' . $row->location_slug . '/">' . $row->location_name;
if (!empty($row->address)) :
echo '<br>' . $row->address;
endif;
echo '</a>';
if (!empty($row->location_phone)) :
echo '<br>' . $row->location_phone;
endif;
elseif (!empty($row->submitted_location)) :
echo '<br><br><strong>Where: </strong>' . $row->submitted_location;
endif;
if (!empty($row->price)) :
echo '<br><strong>Price: </strong>' . $row->price;
endif;
echo '<br><br><div class="content_html">' . apply_shortcodes(format_html($row->html)) . '</div>';
if ($row->internal_ticketing == 1) :
echo '<br><br><a class="outbound_ticket_link" href="get-tickets?type=event&event_slug=' . $row->slug . '" target="_blank" onclick="ga_track_event(\'Outbound Ticket Link\', \'Click\', window.location.href, null, null, \'event\', ' . $row->id . ')">Get tickets/Register now</a>';
elseif (!empty($row->event_url)) :
echo '<br><br><a class="outbound_ticket_link" href="' . url_fix($row->event_url) . '" target="_blank" onclick="ga_track_event(\'Outbound Ticket Link\', \'Click\', window.location.href, null, null, \'event\', ' . $row->id . ')">Buy tickets/get more info now</a>';
endif;
echo '<br><br><strong>Add to Calendar</strong>';
echo '<br><a href="events/' . $row->slug . '/ical/"><img src="img/calendar_icon.png" style="width:45px;"></a>';
echo '<br><br><strong>See other events in these categories:</strong>';
$sql = "SELECT DISTINCT c.id, c.name, c.slug FROM categories c JOIN events_categories ec ON (ec.category_id = c.id) WHERE ec.event_id = " . nz($row->id, '0') . " AND c.active = 1 ";
$result_cat = $db->query($sql) or die('Database Error!');
if ($result_cat->rowCount() > 0) :
echo '<ul>';
while ($row_cat = $result_cat->fetch(PDO::FETCH_OBJ)) :
echo '<li><a href="events/categories/' . $row_cat->slug . '/">' . $row_cat->name . '</a></li>';
endwhile;
echo '</ul>';
else :
echo ' No Categories';
endif;
include('_subscribe_link.php');
echo '</div>'; //content_left
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
else :
return(page_404());
endif;