function _set_relevant_data($index = null, $value = null, $force = false)
 {
     global $epl_on_admin, $epl_current_step;
     if (!$_POST && !$force) {
         return;
     }
     $events_in_cart = $this->get_events_in_cart();
     foreach ($events_in_cart as $event_id => $totals) {
         //$event_id = $this->get_current_event_id();
         setup_event_details($event_id);
         //adjust for date specific price.
         if (epl_is_date_level_price() && !empty($_POST['_epl_start_date'][$event_id]) && isset($_POST['_att_quantity'])) {
             $dates = array_flip(epl_get_element_m($event_id, '_epl_start_date', $_POST, array()));
             $prices = epl_get_element_m($event_id, '_att_quantity', $_POST);
             foreach ($prices as $price_id => $data) {
                 $_temp = array_intersect_key($data, $dates);
                 $_REQUEST['_att_quantity'][$event_id][$price_id] = $_temp;
             }
         }
         //adjust for date specific time.
         if (!epl_is_time_optonal() && epl_is_date_level_time() && !empty($_POST['_epl_start_date'][$event_id]) && isset($_POST['_epl_start_time'])) {
             $dates = array_flip((array) epl_get_element_m($event_id, '_epl_start_date', $_POST));
             $times = epl_get_element_m($event_id, '_epl_start_time', $_POST);
             $_temp = array_intersect_key($times, $dates);
             $_REQUEST['_epl_start_time'][$event_id] = $_temp;
         }
     }
     $rel_fields = array('_dates' => array('_epl_start_date' => '', '_epl_start_time' => '', '_att_quantity' => '', '_epl_discount_code' => ''), '_attendee_info' => $this->ecm->get_list_of_available_fields(), 'newsletter_signup' => '', '_epl_start_week' => 0, '_epl_donation_amount' => '', '_epl_payment_method' => '', 'alt_total' => '');
     $temp_fields = array('user_id' => !epl_user_is_admin() ? get_current_user_id() : '', 'user_login' => '', 'user_pass' => '', 'user_pass_confirm' => '');
     if (!epl_is_empty_array(epl_get_element('temp_fields', $_SESSION))) {
         $temp_fields = epl_get_element('temp_fields', $_SESSION);
     }
     $incoming_data = apply_filters('epl_erm__set_relevant_data__incoming_data', $_REQUEST);
     //if waitlist record.
     if (epl_get_element('epl_rid', $_REQUEST) && (epl_is_waitlist_record() && epl_is_waitlist_approved() || epl_is_valid_url_hash(false))) {
         global $regis_details;
         $regis_details = $this->ecm->setup_regis_details(intval(epl_get_element('epl_rid', $_REQUEST)));
         $this->regis_id = $regis_details['post_title'];
         if ($this->flow_mode == 'p' && $epl_current_step == 'process_cart_action' || epl_is_waitlist_record()) {
             $this->current_data = $regis_details['__epl'];
             $this->current_data['post_ID'] = intval(epl_get_element('epl_rid', $_REQUEST));
         }
     }
     foreach ($rel_fields as $rel_section => $rel_field) {
         $old_val = '';
         //need to use the old val so that when a new event is added to the cart, the old value does not get overwritten
         //as the post vals for the other events will not be coming in
         if (epl_get_element('from_modal', $_REQUEST) == 1) {
             $old_val = epl_get_element_m($rel_section, $this->regis_id, $this->current_data);
         }
         if (is_array($rel_field)) {
             //$old_val = array_intersect_key( $incoming_data, $old_val );
             $value = array_intersect_key($incoming_data, $rel_field);
             if (!epl_is_empty_array($old_val)) {
                 $value = $this->array_merge_recursive_new($old_val, $value);
             }
             if (!epl_is_empty_array($value)) {
                 $value = $this->epl_util->clean_input($value);
                 $this->data[$this->regis_id][$rel_section] = $value;
                 $this->current_data[$this->regis_id][$rel_section] = $value;
             }
         } else {
             $value = $this->epl_util->clean_input(epl_get_element($rel_section, $_REQUEST, ''));
             //redundant
             if (!epl_is_empty_array($old_val)) {
                 $value = $this->array_merge_recursive_new($old_val, $value);
             }
             if ($value !== '') {
                 $this->current_data[$this->regis_id][$rel_section] = $value;
             }
         }
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $merged_temp_fields = array_intersect_key($incoming_data, $temp_fields);
         $_SESSION['temp_fields'] = epl_is_empty_array($merged_temp_fields) ? $temp_fields : $merged_temp_fields;
     }
     //if edit mode
     //        $this->calculate_cart_totals();
     $this->refresh_data();
 }
Пример #2
0
 function check_for_waitlist()
 {
     if (epl_is_waitlist_record() && !epl_is_waitlist_session_approved()) {
         if (!epl_is_valid_url_hash()) {
             return epl__('There seems to be something wrong with the url.  Please contact the website administrator.');
         }
         if (!epl_is_waitlist_approved()) {
             return epl__('This waitlist has not been approved.');
         }
         if (epl_is_waitlist_link_expired()) {
             return epl__('This link has expired.');
         }
         $_SESSION['__epl']['waitlist_approved'] = intval($_GET['event_id']);
         $this->erm->setup_current_data();
         wp_redirect(add_query_arg(array('epl_rid' => false, 'epl_wlh' => false), epl_get_url()));
         die;
     }
     return true;
 }