diff --git a/booking.balance.inc b/booking.balance.inc index 86fc820..d96272d 100644 --- a/booking.balance.inc +++ b/booking.balance.inc @@ -12,7 +12,7 @@ function booking_balance_page() { $paypal_form = ""; //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) { + if (! ('/^[0-9A-Fa-f\-]+$/', arg(1))) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid session ID supplied to the balance payment page. Please use the contact us form to let us know.", 'error', FALSE); drupal_goto(''); diff --git a/booking.confirm.inc b/booking.confirm.inc index 280e634..4069cd2 100644 --- a/booking.confirm.inc +++ b/booking.confirm.inc @@ -12,7 +12,7 @@ function booking_confirm_page() { $paypal_form = ""; //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) { + if (! ('/^[0-9A-Fa-f\-]+$/', arg(1))) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid session ID supplied to the registration confirmation page. Please use the contact us form to let us know.", 'error', FALSE); drupal_goto(''); @@ -106,7 +106,7 @@ function booking_confirm_page() { $form_action = variable_get('booking_paypal_sandbox', 0) ? BOOKING_PAYPAL_SUBMIT_URL_SANDBOX : BOOKING_PAYPAL_SUBMIT_URL; //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) { + if (! ('/^[0-9A-Fa-f\-]+$/', arg(1))) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid session ID supplied. Please use the contact us form to let us know.", 'error', FALSE); return ""; @@ -142,7 +142,7 @@ function booking_confirm_page() { array('!fee' => $person->booking_price)); //watchdog('booking', 'Partner name "@info"', array ('@info' => var_export($person->booking_partner_name, TRUE))); - if (preg_match('/^(\w*?)\s+(\w*)/', $person->booking_partner_name, $matches)) + if (('/^(\w*?)\s+(\w*)/', $person->booking_partner_name, $matches)) { watchdog('booking', 'Spouse checking. Firstname: "!first", surname "!last"', array ('!first' => $matches[1], '!last' => $matches[2])); diff --git a/booking.events.inc b/booking.events.inc index 3819963..b695215 100644 --- a/booking.events.inc +++ b/booking.events.inc @@ -115,7 +115,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) else { //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $editid)) { + if (! ('/^[0-9]+$/', $editid)) { drupal_set_message("Error: Invalid event ID supplied. Unable to update event information.", 'error', FALSE); drupal_goto('admin/config/booking/events'); return ""; @@ -255,7 +255,7 @@ function booking_event_form_submit($form, &$form_state) { elseif ($form_state['values']['op'] == 'Delete') { //verify that booking_eid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_eid'])) { + if (! ('/^[0-9]+$/', $values['booking_eid'])) { drupal_set_message("Error: Invalid event ID supplied. Unable to delete event entry.", 'error', FALSE); return ""; } @@ -271,7 +271,7 @@ function booking_event_form_submit($form, &$form_state) { else { //verify that booking_eid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_eid'])) { + if (! ('/^[0-9]+$/', $values['booking_eid'])) { drupal_set_message("Error: Invalid event ID supplied. Unable to update event entry.", 'error', FALSE); return ""; } diff --git a/booking.partialbalance.inc b/booking.partialbalance.inc index 6886d43..18e94c5 100644 --- a/booking.partialbalance.inc +++ b/booking.partialbalance.inc @@ -14,7 +14,7 @@ function booking_partial_balance_page() { $partial_amount = arg(2); //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', $temp_id)) { + if (! ('/^[0-9A-Fa-f\-]+$/', $temp_id)) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid session ID supplied to the partial payment page. Please use the contact us form to let us know.", 'error', FALSE); drupal_goto(''); @@ -22,7 +22,7 @@ function booking_partial_balance_page() { } //verify that arg(2) is a number - if (! preg_match('/^[0-9]+$/', $partial_amount)) { + if (! ('/^[0-9]+$/', $partial_amount)) { drupal_set_message("Error: Invalid payment amount supplied to the partial payment page. Please use the contact us form to let us know.", 'error', FALSE); drupal_goto(''); return ""; diff --git a/booking.prices.inc b/booking.prices.inc index 5ad58dc..4b6fbf0 100644 --- a/booking.prices.inc +++ b/booking.prices.inc @@ -115,7 +115,7 @@ function booking_price_form($node, &$form_state, $create, $editid = 0) else { //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $editid)) { + if (! ('/^[0-9]+$/', $editid)) { drupal_set_message("Error: Invalid price ID supplied. Unable to update price entry.", 'error', FALSE); drupal_goto('admin/config/booking/prices'); return ""; @@ -240,7 +240,7 @@ function booking_price_form_submit($form, &$form_state) { elseif ($form_state['values']['op'] == 'Delete') { //verify that booking_pid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_pid'])) { + if (! ('/^[0-9]+$/', $values['booking_pid'])) { drupal_set_message("Error: Invalid price ID supplied. Unable to delete price entry.", 'error', FALSE); return ""; } @@ -259,7 +259,7 @@ function booking_price_form_submit($form, &$form_state) { } else { //verify that booking_pid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_pid'])) { + if (! ('/^[0-9]+$/', $values['booking_pid'])) { drupal_set_message("Error: Invalid price ID supplied. Unable to update price entry.", 'error', FALSE); return ""; } diff --git a/booking.reports.inc b/booking.reports.inc index 802da46..2f02cc7 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -129,9 +129,9 @@ function booking_report_summary() { } //define the row for this person - $this_row[] = l(t('View !id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))); + $this_row[] = l(t('Edit !id', array('!id' => $person->nid)), t('node/!id/edit', array('!id' => $person->nid))); $this_row[] = l(t('!first !last', array('!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))), - t('node/!id/edit', array('!id' => $person->nid)) + t('node/!id', array('!id' => $person->nid)) ); $this_row[] = _booking_status_generate($person->booking_status); @@ -586,7 +586,7 @@ function booking_csv_report() { global $event; $name = 'bookings-' . format_date(time(), 'custom', 'Y-m-d-His'); $filename = file_directory_temp() . '/' . $name; - + $csv = ''; $delimiter = ','; $enclosure = '"'; $encloseAll = true; @@ -641,7 +641,7 @@ function booking_csv_report() { //watchdog('booking', "CSV raw data: @info", array('@info' => var_export($result, TRUE))); //open the filehandle - $handle = @fopen($filename, 'w'); + //$handle = @fopen($filename, 'w'); //write the header based on the first result $header_array = array(); @@ -660,8 +660,8 @@ function booking_csv_report() { $header = implode( $delimiter, $header_array ); //watchdog('booking', "CSV header: @info", array('@info' => var_export($header_array, TRUE))); - @fwrite($handle, $header . "\n"); - + //@fwrite($handle, $header . "\n"); + $csv .= $header . "\n"; //each record foreach ($result as $record) { @@ -754,16 +754,27 @@ function booking_csv_report() { $row = implode($delimiter, $output) . "\n"; - @fwrite($handle, $row); + //@fwrite($handle, $row); + $csv .= $row; //$index++; } - @fclose($handle); + //@fclose($handle); + + //see http://stackoverflow.com/questions/4348802/how-can-i-output-a-utf-8-csv-in-php-that-excel-will-read-properly + // but none of these options seem to work drupal_add_http_header("Content-type", "application/octet-stream; charset=utf-8"); + //drupal_add_http_header("Content-type", "application/octet-stream; charset=UTF-16LE"); + //drupal_add_http_header("Content-Type: application/vnd.ms-excel"); drupal_add_http_header("Content-Disposition", "attachment; filename=" . $name . ".csv"); - @readfile($filename); - @unlink($filename); + // @readfile($filename); + //print chr(255) . chr(254); + //print 'sep=,' . "\n"; + print $csv; + //print mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8'); + + //@unlink($filename); exit(0); } \ No newline at end of file diff --git a/booking.rooms.inc b/booking.rooms.inc index c5ee807..793d373 100644 --- a/booking.rooms.inc +++ b/booking.rooms.inc @@ -130,7 +130,7 @@ function booking_room_edit_form($node, &$form_state, $nid) { $location_options[] = "--"; //verify that $nid is a number - if (! preg_match('/^[0-9]+$/', $nid)) { + if (! ('/^[0-9]+$/', $nid)) { drupal_set_message("Error: Invalid registration ID '" . $nid . "' supplied. Unable to edit study group sessions.", 'error', FALSE); drupal_goto('admin/booking/rooms'); return ""; @@ -449,7 +449,7 @@ function booking_rooms_allocate_form($node, &$form_state, $location_id) { $counter = 0; //verify that $location_id is a number - if (! preg_match('/^[0-9]+$/', $location_id)) { + if (! ('/^[0-9]+$/', $location_id)) { drupal_set_message("Error: Invalid room location ID '" . $location_id . "' supplied. Unable to allocate rooms.", 'error', FALSE); drupal_goto('admin/booking/rooms'); return ""; @@ -817,7 +817,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) { $form = array(); //verify that $location_id is a number - if (! preg_match('/^[0-9]+$/', $location_id)) { + if (! ('/^[0-9]+$/', $location_id)) { drupal_set_message("Error: Invalid room location ID '" . $location_id . "' supplied. Unable to allocate rooms.", 'error', FALSE); drupal_goto('admin/booking/rooms'); diff --git a/booking.rooms_admin.inc b/booking.rooms_admin.inc index dcd832c..3afecf0 100644 --- a/booking.rooms_admin.inc +++ b/booking.rooms_admin.inc @@ -64,7 +64,7 @@ function booking_roomlocation_define_form($node, &$form_state, $create, $editid { drupal_set_title('Edit Room Location'); //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $editid)) { + if (! ('/^[0-9]+$/', $editid)) { drupal_set_message("Error: Invalid room location ID supplied. Unable to edit room location definition.", 'error', FALSE); drupal_goto('admin/config/booking/rooms'); return ""; @@ -177,7 +177,7 @@ function booking_roomlocation_define_form_submit($form, &$form_state) { elseif ($form_state['values']['op'] == 'Delete') { //verify that booking_lid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_lid'])) { + if (! ('/^[0-9]+$/', $values['booking_lid'])) { drupal_set_message("Error: Invalid room location ID supplied. Unable to delete entry.", 'error', FALSE); return ""; } @@ -192,7 +192,7 @@ function booking_roomlocation_define_form_submit($form, &$form_state) { { //verify that booking_sid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_lid'])) { + if (! ('/^[0-9]+$/', $values['booking_lid'])) { drupal_set_message("Error: Invalid room location ID supplied. Unable to update room location definition.", 'error', FALSE); return ""; } @@ -335,7 +335,7 @@ function booking_rooms_definition_form($node, &$form_state, $create, $room_id = else { //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $room_id)) { + if (! ('/^[0-9]+$/', $room_id)) { drupal_set_message("Error: Invalid room ID supplied. Unable to update room definition.", 'error', FALSE); drupal_goto('admin/config/booking/rooms'); return ""; diff --git a/booking.studygroups.inc b/booking.studygroups.inc index f1414c4..1276ef9 100644 --- a/booking.studygroups.inc +++ b/booking.studygroups.inc @@ -26,7 +26,7 @@ function booking_available_leadhelp_select_form($node, &$form_state, $group_id) ); //verify that $group_id is a number - if (! preg_match('/^[0-9]+$/', $group_id)) { + if (! ('/^[0-9]+$/', $group_id)) { drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to edit group leaders and helpers.", 'error', FALSE); drupal_goto('admin/booking/studygroups'); return ""; @@ -383,7 +383,7 @@ function booking_studygroups_edit_form($node, &$form_state, $nid) { $readinggroup_options[0] = ''; //verify that $nid is a number - if (! preg_match('/^[0-9]+$/', $nid)) { + if (! ('/^[0-9]+$/', $nid)) { drupal_set_message("Error: Invalid registration ID '" . $nid . "' supplied. Unable to edit study group sessions.", 'error', FALSE); drupal_goto('admin/booking/studygroups'); return ""; @@ -522,7 +522,7 @@ function booking_studygroups_edit_form_submit($form, &$form_state) { $values = $form_state['input']; //check that $values['personid'] is a number - if (! preg_match('/^[0-9]+$/', $values['personid'])) { + if (! ('/^[0-9]+$/', $values['personid'])) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid form data supplied. Please use the contact us form to let us know.", 'error', FALSE); return ""; @@ -979,7 +979,7 @@ function booking_studygroups_update_form($node, &$form_state, $sid) { $inserts_to_confirm = array(); //verify that $nid is a number - if (! preg_match('/^[0-9]+$/', $sid)) { + if (! ('/^[0-9]+$/', $sid)) { drupal_set_message("Error: Invalid group ID '" . $sid . "' supplied. Unable to update study group session.", 'error', FALSE); drupal_goto('admin/booking/studygroups'); return ""; @@ -1484,7 +1484,7 @@ function booking_studygroups_printview_form($node, &$form_state, $group_id) { //verify that $group_id is a number - if (! preg_match('/^[0-9]+$/', $group_id)) { + if (! ('/^[0-9]+$/', $group_id)) { drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to view group membership.", 'error', FALSE); drupal_goto('admin/config/booking'); return ""; @@ -1612,7 +1612,7 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) { ); */ //verify that $group_id is a number - if (! preg_match('/^[0-9]+$/', $group_id)) { + if (! ('/^[0-9]+$/', $group_id)) { drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to view group membership.", 'error', FALSE); drupal_goto('admin/config/booking'); return ""; diff --git a/booking.studygroups_admin.inc b/booking.studygroups_admin.inc index 739128c..6f4ed89 100644 --- a/booking.studygroups_admin.inc +++ b/booking.studygroups_admin.inc @@ -96,7 +96,7 @@ function booking_studygroups_define_form($node, &$form_state, $create, $editid = { drupal_set_title('Edit Study Group'); //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $editid)) { + if (! ('/^[0-9]+$/', $editid)) { drupal_set_message("Error: Invalid study group ID supplied. Unable to edit study group definition.", 'error', FALSE); drupal_goto('admin/booking/config/studygroups'); return ""; @@ -220,7 +220,7 @@ function booking_studygroups_define_form_submit($form, &$form_state) { elseif ($form_state['values']['op'] == 'Delete Study Group Definition') { //verify that booking_pid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_sid'])) { + if (! ('/^[0-9]+$/', $values['booking_sid'])) { drupal_set_message("Error: Invalid studygroup ID supplied. Unable to delete entry.", 'error', FALSE); return ""; } @@ -238,7 +238,7 @@ function booking_studygroups_define_form_submit($form, &$form_state) { { //verify that booking_sid is a number - if (! preg_match('/^[0-9]+$/', $values['booking_sid'])) { + if (! ('/^[0-9]+$/', $values['booking_sid'])) { drupal_set_message("Error: Invalid studygroup ID supplied. Unable to update study group.", 'error', FALSE); return ""; } diff --git a/booking.travel.inc b/booking.travel.inc index 7565084..7f2dac0 100644 --- a/booking.travel.inc +++ b/booking.travel.inc @@ -9,7 +9,7 @@ function booking_travel_page() { $return_array = array(); //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) { + if (! ('/^[0-9A-Fa-f\-]+$/', arg(1))) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid session ID supplied. Please use the contact us form to let us know.", 'error', FALSE); return ""; @@ -418,7 +418,7 @@ function travel_form_submit($form, &$form_state) { //watchdog('booking', 'Submitting travel form: @info', array('@info' => var_export($values, TRUE))); //check that $values['personid'] is a number - if (! preg_match('/^[0-9]+$/', $values['personid'])) { + if (! ('/^[0-9]+$/', $values['personid'])) { //parameter from url is not what we were expecting drupal_set_message("Error: Invalid form data supplied. Please use the contact us form to let us know.", 'error', FALSE); return ""; diff --git a/booking.variety.inc b/booking.variety.inc index 2af46c9..1a7f3d6 100644 --- a/booking.variety.inc +++ b/booking.variety.inc @@ -76,7 +76,7 @@ function booking_variety_timeslot_form($node, &$form_state, $create, $editid = 0 else { //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $editid)) { + if (! ('/^[0-9]+$/', $editid)) { drupal_set_message("Error: Invalid variety ID supplied. Unable to update variety session information.", 'error', FALSE); drupal_goto('admin/config/booking/variety'); return ""; @@ -177,7 +177,7 @@ function booking_variety_timeslot_form_submit($form, &$form_state) { elseif ($form_state['values']['op'] == 'Delete') { //verify that tid is a number - if (! preg_match('/^[0-9]+$/', $values['tid'])) { + if (! ('/^[0-9]+$/', $values['tid'])) { drupal_set_message("Error: Invalid variety timeslot ID supplied. Unable to delete entry.", 'error', FALSE); return ""; } @@ -193,7 +193,7 @@ function booking_variety_timeslot_form_submit($form, &$form_state) { else { //verify that booking_eid is a number - if (! preg_match('/^[0-9]+$/', $values['tid'])) { + if (! ('/^[0-9]+$/', $values['tid'])) { drupal_set_message("Error: Invalid variety session timeslot ID supplied. Unable to update entry.", 'error', FALSE); return ""; } @@ -222,7 +222,7 @@ function booking_variety_create_session_form($node, &$form_state, $timeslot_id = $data = $node; //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $timeslot_id)) { + if (! ('/^[0-9]+$/', $timeslot_id)) { drupal_set_message("Error: Invalid variety ID supplied. Unable to update variety session information.", 'error', FALSE); drupal_goto('admin/config/booking/variety'); return ""; @@ -307,7 +307,7 @@ function booking_variety_list_session_form($node, &$form_state, $timeslot_id = 0 $data = $node; //verify that $editid is a number - if (! preg_match('/^[0-9]+$/', $timeslot_id)) { + if (! ('/^[0-9]+$/', $timeslot_id)) { drupal_set_message("Error: Invalid variety ID supplied. Unable to select variety session information.", 'error', FALSE); drupal_goto('admin/config/booking/variety'); return "";