$gig['band_start'] = trim($times[0]); $gig['band_end'] = trim($times[1]); } else { if ($bits[0]) { $gig[str_replace(' ', '_', strtolower($bits[0]))] = $bits[1]; } } } } } $gig['title'] = preg_replace('/Proposed Gig: [\\d\\-]+ /', '', $gig['title']); $gig['date'] = $gig['gCalDate']; $gig['action'] = 'saveGig'; $gig['google_gig_id'] = $gig['id']; $_REQUEST = $gig; gigs_saveGig($_REQUEST); } function fetch_gigs($new = 1, $calendarfeed = "https://www.google.com/calendar/feeds/9ap01kto79gs6jddoi8d1e4b38%40group.calendar.google.com/private-d9f3603174475e300a82afac095e7ce5/full/?orderby=starttime&singleevents=true&ctz=America/Los_Angeles") { $dateformat = "Y-m-d"; // 10 March 2009 - see http://www.php.net/date for details $nicedateformat = "F j"; // 10 March 2009 - see http://www.php.net/date for details $timeformat = "g:i A"; // 12.15am $cache_time = 60 * 0.5; // 5 minutes date_default_timezone_set('America/Los_Angeles'); $calendarfeed .= "&max-results=2000"; $cache_file = ''; if ($new) {
function addRehearsal($date) { $default_location = 'Greenpeace Warehouse'; $default_time = '17:00'; $default_end = '20:00'; if (!$date) { $date = date('Y-m-d', strtotime('next sunday + 6 weeks')); } $count = fetchValue("select count(*) as count from gigs where type='rehearsal' and date = '{$date}'") ?: 0; if ($count == 0) { $request['data'] = array('date' => $date, 'type' => 'rehearsal', 'title' => 'Rehearsal', 'band_start' => $default_time, 'band_end' => $default_end, 'location' => $default_location); gigs_saveGig($request); } }