| 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' && empty($slug2)) :
set_analytics_reference('off_broadway_locations', null);
echo '<div class="content_left">';
add_seo_page_header('Off Broadway 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 * FROM obw_locations WHERE status = 1 ORDER BY name ASC
";
$result = $db->query($sql);
if ($result->rowCount() > 0) :
echo '<h1>Off-Broadway Venues</h1>';
echo '<h2>SEARCH for a specific venue by selecting an item below.</h2>';
echo '<h6>ALL NYC VENUES</h6>';
while ($row = $result->fetch(PDO::FETCH_OBJ)) :
echo '<div class="location_list_item">';
echo '<a href="off-broadway/locations/' . $row->slug . '/">' . $row->name . '</a>';
if (!empty($row->address)) :
echo ' | ' . $row->address;
endif;
echo '</div>';
endwhile;
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
elseif ($slug1 === 'locations' && !empty($slug2)) :
$preview = ($_SESSION['logged_in'] ?? false) && ($_GET['preview'] ?? '') === 'true';
$sql = "SELECT * FROM obw_locations WHERE slug = :slug AND (status = 1 OR TRUE = :preview) ORDER BY id DESC";
$stmt = $db->prepare($sql);
$stmt->execute([
':slug' => $slug2,
':preview' => $preview,
]);
if ($row = $stmt->fetch(PDO::FETCH_OBJ)) :
set_analytics_reference('off_broadway_location', $row->id);
echo '<div class="content_left">';
add_seo_page_header($row->name, curr_page_url(), $row->html);
echo '<h1>' . $row->name . '</h1>';
if (!empty($row->address)) :
echo $row->address . '<br>';
endif;
if (!empty($row->city) && !empty($row->state)) :
echo $row->city . ', ' . $row->state . ' ' . $row->zip . '<br>';
endif;
if (!empty($row->phone)) :
echo $row->phone . '<br>';
endif;
if (!empty($row->url)) :
echo '<a target="_blank" href="' . url_fix($row->url) . '">' . $row->url . '</a><br>';
endif;
if (!empty($row->featured_image)) :
echo '<br><img src="' . image_url_fix($row->featured_image, 'img/content/') . '" alt="' . $row->name . '">';
endif;
echo '<br><br><div class="post_content content_html">' . apply_shortcodes(format_html($row->html)) . '</div>';
echo '<br><hr>';
echo '<h2>Current & Upcoming Shows</h2>';
$sql = "SELECT * FROM obw_shows WHERE status = 1 AND end_date > NOW() AND obw_location_id = :obw_location_id ORDER by name ASC";
$stmt = $db->prepare($sql);
$stmt->execute([
':obw_location_id' => $row->id,
]);
$rows_shows = $stmt->fetchAll(PDO::FETCH_OBJ);
if (count($rows_shows) > 0) :
echo '<ul>';
foreach ($rows_shows as $row_show) :
echo '<li>';
echo '<a href="off-broadway/' . $row_show->slug . '/">' . $row_show->name . '</a>';
echo '</li>';
endforeach;
echo '</ul>';
else :
echo 'There are no current or upcoming at this location';
endif;
echo '</div>'; // content_left
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
else :
return(page_404());
endif;
elseif (!empty($slug1)) :
$preview = ($_SESSION['logged_in'] ?? false) && ($_GET['preview'] ?? '') === 'true';
$sql = "SELECT os.*,
ol.name AS location_name,
ol.slug AS location_slug,
ol.address,
ol.city,
ol.state,
ol.zip,
ol.phone,
ol.url AS location_url,
ol.google_map,
ol.phone AS location_phone,
m.media_credit
FROM obw_shows os
LEFT JOIN obw_locations ol ON (os.obw_location_id = ol.id AND ol.status = 1)
LEFT JOIN media m ON (m.media_type = 'img' AND m.media_path = 'img/content/' AND m.media_filename = os.featured_image)
WHERE os.slug = :slug AND (os.status = 1 OR TRUE = :preview) ORDER BY id DESC
";
$stmt = $db->prepare($sql);
$stmt->execute([
':slug' => $slug1,
':preview' => $preview,
]);
if ($row = $stmt->fetch(PDO::FETCH_OBJ)) :
set_analytics_reference('off_broadway_show', $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) : ''));
echo '<h1>' . $row->name . '</h1>';
if (strtotime($row->end_date) < time()) :
echo '<p class="announcement">This show\'s run is over. Find a full list of current and upcoming Off-Broadway shows <a href="off-broadway/">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>' . nzdate_display($row->start_date) . ' - ' . nzdate_display($row->end_date);
if (!empty($row->obw_location_id)) :
echo '<br><br><strong>Where: </strong><a href="off-broadway/locations/' . $row->location_slug . '/">' . $row->location_name;
if (!empty($row->address)) :
echo '<br>' . $row->address;
if (!empty($row->city)) :
echo ', ' . $row->city;
endif;
if (!empty($row->state)) :
echo ', ' . $row->state;
endif;
endif;
echo '</a>';
if (!empty($row->location_phone)) :
echo '<br>' . $row->location_phone;
endif;
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 (!empty($row->show_url)) :
echo '<br><br><a class="outbound_ticket_link" href="' . url_fix($row->show_url) . '" target="_blank" onclick="ga_track_event(\'Outbound Ticket Link\', \'Click\', window.location.href, null, null, \'off_broadway_show\', ' . $row->id . ')">Buy tickets/get more info now</a>';
endif;
include('_subscribe_link.php');
echo '</div>'; //content_left
include_once('sidebar.php');
echo '<div class="cleardiv"> </div>';
else :
return(page_404());
endif;
else :
set_analytics_reference('off_broadway', null);
$search_rank = ' ,1 AS search_rank ';
$where_text = '';
$sql_parms = [];
if (!empty($_POST['search_submitted']) && $_POST['search_submitted'] == '1') :
if (!empty(trim($_POST['search_text']))) :
$title_search = '%' . trim($_POST['search_text']) . '%';
$where_text = ' AND (MATCH(os.name, os.html) AGAINST(:search_text) OR (os.name LIKE :title_search)) ';
$search_rank = ' ,MATCH(os.name, os.html) AGAINST(:search_text) AS search_rank ';
$sql_parms [':search_text'] = trim($_POST['search_text']);
$sql_parms[':title_search'] = $title_search;
endif;
endif;
$sql = "SELECT os.*
, ol.name AS location_name
, ol.slug AS location_slug
, ol.address
, ol.city
, ol.state
, IF(os.start_date <= NOW(), '1-now', '2-future') AS now_or_future
$search_rank
FROM obw_shows os
LEFT JOIN obw_locations ol ON (ol.id = os.obw_location_id AND ol.status = 1)
WHERE os.status = 1 AND os.end_date > NOW()
$where_text
GROUP BY os.id
ORDER BY search_rank DESC, now_or_future ASC, os.name ASC
LIMIT 500
";
$stmt = $db->prepare($sql);
$stmt->execute($sql_parms);
$rows = $stmt->fetchAll(PDO::FETCH_OBJ);
echo '<div class="content_left">';
add_seo_page_header('Off-Broadway Shows - ThoughtGallery.org');
echo '<h1>Off-Broadway Shows</h1>';
echo '<h2>Search for shows by title and description:</h2>';
require('form_search_obw.php');
if (count($rows) > 0) :
echo '<h1 id="top_of_pagination">Current & Upcoming Shows</h1>';
$date_hold = '';
$page_count = 0;
$row_count = 999;
$row_count_total = 0;
$hidden = false;
$now_or_future_hold = '';
$now_or_future_header = '';
foreach ($rows as $row) :
$new_page = false;
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;
$new_page = true;
endif;
if ($new_page || $row->now_or_future !== $now_or_future_hold) :
if ($row->now_or_future !== $now_or_future_hold) :
$now_or_future_hold = $row->now_or_future;
if ($now_or_future_hold === '1-now') :
$now_or_future_header = 'Now Playing';
elseif ($now_or_future_hold === '2-future') :
$now_or_future_header = 'Coming Soon';
endif;
endif;
echo '<h2 class="obw_subheader">' . $now_or_future_header . '</h2>';
endif;
$row_count++;
$row_count_total++;
echo '<div class="all_categories_item_container">';
echo '<div class="all_categories_event_container">';
echo '<h3><a href="off-broadway/' . $row->slug . '/">' . $row->name . '</a></h3>';
if (!empty($row->location_name)) :
echo '<span class="location"><a href="off-broadway/locations/' . $row->location_slug . '/">' . $row->location_name . '</a></span><br>';
if (!empty($row->address)) :
echo $row->address;
if (!empty($row->city)) :
echo ', ' . $row->city;
endif;
if (!empty($row->state)) :
echo ', ' . $row->state;
endif;
echo '<br>';
endif;
endif;
if (!empty($row->html)) :
echo '<div>' . excerpt($row->html, 35) . '</div>';
endif;
echo '<a class="read_more_button" href="off-broadway/' . $row->slug . '/">Read More...</a>';
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 Off-Broadway shows found.</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>