| Server IP : 104.21.21.239 / 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/tgnewprod/mod/ |
Upload File : |
<?php require('_mod_security.php'); ?>
<?php
$slug1 = parse_uri('slug1', 1, 'home', true);
//$slug2 = parse_uri('slug2', 2);
if ($slug1 === 'locations') :
set_analytics_reference('locations', null);
echo '<div class="content_left">';
add_seo_page_header('Venues - ThoughtGallery.org', curr_page_url(), 'The top places to attend lectures, talks, readings, or discussions in NYC, including museums, colleges, book stores, cultural institutions, and more.');
$sql = "
SELECT DISTINCT l.* FROM locations l
INNER JOIN events e ON (l.id = e.location_id AND e.status = 1 AND e.start_time_local > NOW())
WHERE l.status = 1 ORDER BY l.name ASC
";
$rows = db_cached_query($sql, 'obj');
if (count($rows) > 0) :
echo '<h1>Venues</h1>';
echo '<h2>SEARCH for a specific venue by selecting an item below.</h2>';
echo '<h6>ALL NYC VENUES</h6>';
foreach ($rows as $row) :
echo '<div class="location_list_item">';
echo '<a href="locations/' . $row->slug . '/">' . $row->name . '</a>';
if (!empty($row->address)) :
echo ' | ' . $row->address;
endif;
echo '</div>';
endforeach;
else :
echo '<h1>No Locations</h1>';
echo '<h2>Please change your search criteria and try again.</h2>';
echo '<br><br><br>';
endif;
echo '</div>'; //content_left
else :
set_analytics_reference('all_categories', null);
$where_dates = ' AND e.start_time_local >= NOW() ';
$where_cat = '';
$where_title = '';
$where_ids = '';
$sql_parms = [];
$filter_search = false;
$ai_search = false;
$analytics_data = [];
if (!empty($_POST['range_search_submitted']) && $_POST['range_search_submitted'] == '1') :
if (!empty(trim($_POST['search_date_range']))) :
$filter_search = true;
$analytics_data['search_date_range'] = $_POST['search_date_range'];
$dates = explode(' to ', $_POST['search_date_range']);
$date_start = date('Y-m-d 00:00:00', strtotime($dates[0]));
if (empty($dates[1])) :
$dates[1] = $dates[0];
endif;
$date_end = date('Y-m-d 23:59:59', strtotime($dates[1]));
$where_dates = ' AND e.start_time_local BETWEEN :start_date AND :end_date ';
$sql_parms [':start_date'] = $date_start;
$sql_parms [':end_date'] = $date_end;
endif;
if (is_array($_POST['search_categories'] ?? '') && count($_POST['search_categories']) > 0) :
$filter_search = true;
$analytics_data['search_categories'] = $_POST['search_categories'];
$where_cat = ' AND ec.category_id IN (';
$ar_cat_parms = [];
foreach ($_POST['search_categories'] as $cat_id) :
$parm = ':cat_id_' . (int)$cat_id;
$sql_parms[$parm] = (int)$cat_id;
$ar_cat_parms[] = $parm;
endforeach;
$where_cat .= implode(', ', $ar_cat_parms);
$where_cat .= ') ';
endif;
if (!empty(trim($_POST['search_title']))) :
$filter_search = true;
$analytics_data['search_title'] = $_POST['search_title'];
$where_title = ' AND e.name LIKE :title ';
$sql_parms [':title'] = '%' . trim($_POST['search_title']) . '%';
endif;
if (count($analytics_data) > 0) :
analytics_tracking('filter_search', 'search', '', null, null, 20, json_encode($analytics_data));
endif;
endif;
if (!empty($_POST['ai_search_submitted']) && $_POST['ai_search_submitted'] == '1' && !empty($_POST['search_ai_text'])) :
require_once('admin/classes/lcs_ai_search.php');
$ai_search = true;
$analytics_data['search_ai_text'] = $_POST['search_ai_text'];
$ai_search = new lcs_ai_search($_POST['search_ai_text']);
$ar_ai_search_ids = $ai_search->filter_events_chatgpt();
if (count($ar_ai_search_ids) > 0) :
array_walk($ar_ai_search_ids, function (&$value) {
$value = (int) $value;
});
$where_ids = ' AND e.id IN (' . implode(',', $ar_ai_search_ids) . ')';
endif;
if (count($analytics_data) > 0) :
analytics_tracking('ai_search', 'search', '', null, null, 20, json_encode($analytics_data));
endif;
endif;
$sql = "SELECT e.*, l.name AS location_name, l.slug AS location_slug,
JSON_ARRAYAGG(
JSON_OBJECT('category_slug', c.slug, 'category_name', c.name)
) AS categories
FROM events e
LEFT JOIN locations l ON (l.id = e.location_id AND l.status = 1)
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.status = 1
$where_dates
$where_cat
$where_title
$where_ids
GROUP BY e.id
ORDER BY e.start_time_local ASC, e.id ASC
LIMIT 500
";
$rows = db_cached_query($sql, 'obj', $sql_parms);
echo '<div class="content_left">';
if ($_GET['IX'] == 'page_all_categories') :
add_seo_page_header('ALL Categories - ThoughtGallery.org');
echo '<h1>Talks, Seminars, & Readings</h1>';
endif;
if (!$filter_search) :
echo '<h2>Ask THOUGHT GALLERY CONCIERGE</h2>';
require('form_search_ai.php');
endif;
if (!$filter_search && !$ai_search) :
echo '<hr class="search_separator">';
endif;
if (!$ai_search) :
echo '<h2>Search for events by date range, category, and title:</h2>';
require('form_search.php');
endif;
if (count($rows) > 0) :
echo '<h1 id="top_of_pagination">Calendar</h1>';
$date_hold = '';
$page_count = 0;
$row_count = 999;
$row_count_total = 0;
$hidden = false;
foreach ($rows as $row) :
if ($row_count >= 50) :
$row_count = 0;
$page_count++;
$date_hold = '';
echo '<div class="pagination_page" id="pagination_' . $page_count . '" ' . ($hidden ? ' style="display: none;" ' : '') . '>'; //open pagination div
$hidden = true;
endif;
$row_count++;
$row_count_total++;
$date = date('l, F j, Y', strtotime($row->start_time_local));
if ($date !== $date_hold) :
echo '<h2 class="date_group_header">' . $date . '</h2>';
$date_hold = $date;
endif;
echo '<div class="all_categories_item_container">';
echo '<div class="all_categories_time_container">';
echo date('g:i A', strtotime($row->start_time_local));;
echo '</div>';
echo '<div class="all_categories_event_container">';
echo '<h3><a href="events/' . $row->slug . '/">' . $row->name . '</a></h3>';
if (!empty($row->location_name)) :
echo '<span class="location"><a href="locations/' . $row->location_slug . '/">' . $row->location_name . '</a></span><br>';
elseif (!empty($row->submitted_location)) :
echo '<span class="location">' . $row->submitted_location . '</span><br>';
endif;
$categories = json_decode($row->categories);
if (json_last_error() === JSON_ERROR_NONE) :
$i = 0;
if (count($categories) > 0) :
//echo '<br>';
endif;
foreach ($categories as $category) :
if ($i > 0) :
echo ', ';
endif;
echo '<span class="category"><a href="events/categories/' . $category->category_slug . '/">' . $category->category_name . '</a></span>';
$i++;
endforeach;
endif;
echo '</div>';
echo '</div>';
if ($row_count >= 50 || $row_count_total >= count($rows)) :
echo '</div>'; //close pagination div
endif;
endforeach;
echo '<div class="pagination_nav">';
echo '<a id="pagination_nav_prev" href="?pno=prev" onclick="navigate_page(event, this, pagination_cur_page - 1);"><</a> ';
for ($page = 1; $page <= $page_count; $page++) :
echo '<a id="pagination_nav_' . $page . '" href="?pno=' . $page . '" onclick="navigate_page(event, this, ' . $page . ');">' . $page . '</a> ';
endfor;
echo '<a id="pagination_nav_next" href="?pno=next" onclick="navigate_page(event, this, pagination_cur_page + 1);">></a> ';
echo '</div>'; //pagination_nav
else :
echo '<h1>No Events</h1>';
echo '<h2>Please change your search criteria and try again.</h2>';
echo '<br><br><br>';
endif;
echo '</div>'; // content_left
endif;
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
?>
<script>
var pagination_cur_page = 0;
var pagination_max_pages = <?= $page_count ?? 0 ?>;
function navigate_page(e, elem, page_no) {
if (e && e.preventDefault) {
e.preventDefault();
}
if (page_no == pagination_cur_page) {
return;
}
$('#pagination_nav_prev').show();
$('#pagination_nav_next').show();
if (page_no <= 1) {
page_no = 1;
$('#pagination_nav_prev').hide();
}
if (page_no >= pagination_max_pages) {
page_no = pagination_max_pages;
$('#pagination_nav_next').hide();
}
$('#pagination_nav_' + pagination_cur_page).removeClass('pagination_current');
pagination_cur_page = page_no;
$('.pagination_page').hide();
$('#pagination_' + page_no).show();
$('#pagination_nav_' + page_no).addClass('pagination_current');
if (elem) {
$('html, body').animate({
scrollTop: $('#top_of_pagination').offset().top
}, 600);
}
}
$(document).ready(function() {
navigate_page(null, null, 1);
});
</script>