Problem with the whole-calendar iCal feed?

I tried to subscribe to the whole Boston Music Intelligencer calendar in Outlook, using the link webcal://classical-scene.com/?feed=gigpress-ical, and it didn’t work. The message was:

“Cannot verify or add the calendar to Outlook. Make sure the following link is a valid calendar link: webcal://classical-scene.com/?feed=gigpress-ical”

I looked under the covers and found that the server is reporting this error:

HTTP/1.1 500 Internal Server Error

Looking further I think I see the problem here:

function gigpress_ical() {

global $wpdb, $gpo;
$further_where = '';
if(isset($_GET['show_id'])) {
$further_where .= $wpdb->prepare(' AND s.show_id = %d', $_GET['show_id']);
}
if(isset($_GET['artist'])) {
$further_where .= $wpdb->prepare(' AND s.show_artist_id = %d', $_GET['artist']);
}
if(isset($_GET['tour'])) {
$further_where .= $wpdb->prepare(' AND s.show_tour_id = %d', $_GET['tour']);
}
if(isset($_GET['venue'])) {
$further_where .= $wpdb->prepare(' AND s.show_venue_id = %d', $_GET['venue']);
}

$shows = $wpdb->get_results(
$wpdb->prepare("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS ." AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id" . $further_where, $_GET['show_id'])
);

It looks like this will bomb if show_id, the 2nd argument to wpdb->prepare, isn't set. (And in fact, it looks like wpdb->prepare isn't even using that 2nd argument.)
1 person has
this problem
+1
Reply