if ($query_result = mysql_query('SELECT EventName FROM Events WHERE EventID = ' . $inEventID)) { $url = ''; while ($table_row = mysql_fetch_array($query_result)) { $redirEventName = $table_row['EventName']; } if (strlen($redirEventName) < 0) { handle_error_no_exit('tickets.new_urls.php: redirecting production id=' . $id . ' eventid=' . $_REQUEST['event_id'] . ' from uri= ' . $_SERVER['REQUEST_URI'] . ' to home, returning 301'); redir_301(); } $url = make_event_url($redirEventName); $url = ltrim($url, '/'); handle_error_no_exit('tickets.new_urls.php: redirecting production id=' . $id . ' eventid=' . $_REQUEST['event_id'] . ' from uri= ' . $_SERVER['REQUEST_URI'] . ' to ' . $url . ', returning 301'); redir_301($url); } else { handle_error_no_exit('tickets.new_urls.php: query failed during redirect find: ' . mysql_error() . ' production id' . $id . ' eventid=' . $_REQUEST['event_id'] . ' uri= ' . $_SERVER['REQUEST_URI'] . ' to home returning 301'); redir_301(); } } } else { header('HTTP/1.0 500 Internal Server Error'); handle_error_no_exit('tickets.code: query failed: production id' . $id . ' eventid=' . $_REQUEST['event_id'] . ' uri= ' . $_SERVER['REQUEST_URI'] . ' ' . mysql_error()); $error_message = get_error_message(); $smarty->assign("ErrorMessage", $error_message); $smarty->display('main.tpl'); $smarty->display('error_page.tpl'); } if ($regionCode != '') { $venueUrl = make_venue_url($sanitizedVenueName); } $soapclient = new nusoap_client($serverpath); $method = 'SearchTickets';
function list_events_at_venue($smarty, $venueID) { $query = "SELECT Events.EventID, EventName, EventTypeID, VenueName, RegionCode,ProductionID,DATE_FORMAT(EventDate, '%a. %M %e, %Y'),CategoryUrl,City,Events.CategoryID, SanitizedVenueName, Address1, PostalCode,DATE_FORMAT(EventDate, '%h:%i %p') FROM Events inner join Productions on (Events.EventID = Productions.EventID) LEFT JOIN Venues on (Productions.VenueID = Venues.VenueID) LEFT JOIN ModifiedPreorderTreeTraversalCategories as c on (Events.CategoryID=c.CategoryID) WHERE Productions.VenueID = '{$venueID}' AND DATEDIFF(NOW(), EventDate) <= 0 ORDER BY EventDate ASC"; if ($query_result = mysql_query($query)) { $num_rows = mysql_num_rows($query_result); while ($table_row = mysql_fetch_row($query_result)) { $eventID = $table_row[0]; $eventName = $table_row[1]; $eventTypeID = $table_row[2]; $venueName = $table_row[3]; $regionCode = $table_row[4]; $productionID = $table_row[5]; $date = $table_row[6]; $categoryUrl = $table_row[7]; $city = utf8_decode($table_row[8]); $categoryID = $table_row[9]; $sanitizedVenueName = $table_row[10]; $address1 = $table_row[11]; $zipcode = $table_row[12]; $productionTime = $table_row[13]; if (strlen($eventName) < 1) { handle_error_no_exit('venues.php: empty event name from db query vid=' . $_REQUEST['venue_id'] . ' ' . $_SERVER['REQUEST_URI'] . ' returning 301'); redir_301(); } $venueUrl = make_venue_url($sanitizedVenueName); $prodUrl = make_production_url($eventName, $productionID, $city, $eventTypeID); $eventUrl = make_event_url($eventName); $events[] = array("name" => "{$eventName}", "date" => "{$date}", "event_url" => $eventUrl, "prod_url" => "{$prodUrl}", "venue_url" => "{$venueUrl}", "event_id" => $eventID, "time" => "{$productionTime}"); } if ($num_rows < 1) { $query = "SELECT VenueName, Address1, RegionCode,City,PostalCode FROM Venues WHERE VenueID = '{$venueID}'"; if ($query_result = mysql_query($query)) { $num_rows = mysql_num_rows($query_result); while ($table_row = mysql_fetch_row($query_result)) { $venueName = $table_row[0]; $address1 = $table_row[1]; $regionCode = $table_row[2]; $city = utf8_decode($table_row[3]); $zipcode = $table_row[4]; } if ($num_rows < 1) { handle_error_no_exit('venues.new_urls.php: no productions at venue and cannot find venue id in database vid=' . $_REQUEST['venue_id'] . ' ' . $_SERVER['REQUEST_URI'] . ' returning 301'); redir_301(); } } } $title = "{$venueName} Tickets, {$venueName} Seating Chart"; $smarty->assign("title", $title); $keywords = "{$venueName} Seating Chart, {$venueName} Tickets"; $smarty->assign("SeoKeywords", $keywords); $smarty->assign("MetaDescr", "{$venueName} Tickets. Buy tickets to events at {$venueName} in {$city}, {$regionCode} at MongoTickets."); $smarty->display('main.tpl'); $breadcrumb_str = '<a href="/">Home</a>'; # $venueUrl = make_venue_url($sanitizedVenueName); # $breadcrumb_str = AppendBreadcrumb($breadcrumb_str, "$venueUrl", $venueName); $breadcrumb_str = AppendBreadcrumbNoAnchor($breadcrumb_str, " {$venueName} Tickets"); $smarty->assign("Breadcrumbs", $breadcrumb_str); if (count($events) > 0) { $venueMapUrl = GetVenueMapUrl($venueID, $events[0]['event_id']); } else { $venueMapUrl = GetVenueMapUrl($venueID, 1); } $address1 = htmlspecialchars($address1); $smarty->assign("Address", $address1); $smarty->assign("City", $city); $smarty->assign("ZipCode", $zipcode); $smarty->assign("State", $regionCode); $smarty->assign("venueName", $venueName); $smarty->assign("EventsArray", $events); $smarty->assign("NumEvents", count($events)); $smarty->assign("Address", $address1); $smarty->assign("City", $city); $smarty->assign("ZipCode", $zipcode); $smarty->assign("State", $regionCode); $smarty->assign("SeatingChartUrl", $venueMapUrl); $smarty->display('events_at_venue.tpl'); #else { # echo '<div id="content">'; # echo '<div class="left_bar">'; # echo "<div id=\"breadcrumb_trail\">$breadcrumb_str</div>"; # echo "<div id=\"no_tickets\">"; # echo "<h1>$venueName Events</h1>"; # echo '<p>Address: 4 Yawkey Way<br/>'; # echo 'City: Boston<br/>'; # echo 'State: MA<br/>'; # echo 'Zip: 02215'; # echo '</p>'; # echo '<h2><strong>Events at ' . $venueName . '</strong></h2>'; # echo "<p>There are currently no events at $venueName.</p>"; # echo "</div>"; # echo "</div> <!-- end left_bar -->"; # $smarty->display('right_bar.tpl'); # $smarty->display('left_column.tpl'); #} } else { # 5xx status code header('HTTP/1.0 500 Internal Server Error'); handle_error_no_exit('venues.code:list_events_at_venue(): query failed because: ' . mysql_error() . ' ' . $_SERVER['REQUEST_URI'] . ' returning 500'); $error_message = get_error_message(); $smarty->assign("ErrorMessage", $error_message); $smarty->display('main.tpl'); $smarty->display('error_page.tpl'); } }