function epl_check_token($v = null, $forec_check = false)
{
    if (epl_user_is_admin()) {
        return true;
    }
    if (epl_get_regis_setting('epl_regis_add_url_token') != 10) {
        return true;
    }
    if (!isset($_GET['epl_token'])) {
        return false;
    }
    return $_GET['epl_token'] == epl_get_token($v);
}
예제 #2
0
 function thank_you_page($add_to_db = true)
 {
     global $cart_totals, $wpdb;
     if ($this->erm->is_empty_cart()) {
         return $this->epl_util->epl_invoke_error(20, null, false);
     }
     global $event_details;
     $this->erm->_set_relevant_data();
     if (epl_is_waitlist_flow()) {
         $this->erm->add_registration_to_db();
     }
     // echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($_SESSION, true). "</pre>";
     $this->ecm->setup_event_details($this->erm->get_current_event_id());
     if (epl_regis_flow() == 2 && $add_to_db) {
         $this->erm->add_registration_to_db();
     }
     if (epl_regis_flow() == 10) {
         if ($this->erm->ok_to_proceed(true) !== true) {
             return $this->erm->ok_to_proceed;
         }
     }
     $post_ID = epl_get_element_m('post_ID', '__epl', $_SESSION, null);
     if (!$post_ID) {
         $regis_key = $_SESSION['__epl']['_regis_id'];
         $post_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts}\n                 WHERE post_status ='publish' \n                 AND post_type='epl_registration' \n                 AND post_title=%s\n                        ORDER BY ID DESC\n                        LIMIT 1", $regis_key));
         $_SESSION['__epl']['post_ID'] = $post_ID;
     }
     $this->regis_id = $post_ID;
     $this->ecm->setup_regis_details($post_ID);
     $this->erm->set_mode('overview');
     $_totals = $this->erm->calculate_cart_totals();
     $grand_total = $cart_totals['money_totals']['grand_total'];
     $data['cart_data'] = $this->erm->show_cart();
     $data['regis_form'] = $this->erm->regis_form(null, false, false, false);
     $gateway_info = $this->erm->get_gateway_info();
     $data['post_ID'] = $post_ID;
     $data['_epl_regis_status'] = 1;
     $data['_epl_payment_method'] = epl_is_free_event() || epl_is_zero_total() ? '1' : $gateway_info['_epl_pay_type'];
     $data['payment_instructions'] = '';
     if (!epl_is_waitlist_flow() && (epl_is_free_event() || epl_is_zero_total())) {
         $data['_epl_regis_status'] = 5;
         $data['_epl_grand_total'] = '0';
         $data['_epl_payment_amount'] = '0';
         $data['_epl_payment_date'] = '';
         $data['_epl_payment_method'] = '1';
         $data['_epl_transaction_id'] = '';
         $this->erm->update_payment_data($data);
     } elseif ($this->erm->has_selected_offline_payment() || epl_is_waitlist_flow()) {
         $data['_epl_regis_status'] = epl_is_waitlist_flow() ? 20 : 2;
         $data['_epl_payment_method'] = epl_is_waitlist_flow() ? '' : $gateway_info['_epl_pay_type'];
         $data['_epl_prediscount_total'] = epl_get_element('pre_discount_total', $cart_totals['money_totals'], 0);
         $data['_epl_discount_amount'] = epl_get_element('discount_amount', $cart_totals['money_totals'], 0);
         $data['_epl_grand_total'] = $grand_total;
         $data['_epl_balance_due'] = $grand_total;
         $data['_epl_transaction_id'] = '';
         $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true);
         $this->erm->update_payment_data($data);
     }
     $this->ecm->setup_regis_details($post_ID);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     $data = apply_filters('epl_update_payment_data_thank_you_page', $data);
     if ($this->erm->has_selected_offline_payment()) {
         $data['payment_instructions'] = epl_get_element('_epl_check_instructions', $gateway_info);
     }
     $data['mode'] = 'overview';
     $data['tracking_code'] = 1;
     $data['overview'] = $this->epl->load_view('front/registration/regis-thank-you-page', $data, true);
     $this->epl_util->regis_id = $post_ID;
     if (epl_is_addon_active('ASDFAWEEFADSF')) {
         epl_mailchimp_subscribe();
     }
     do_action('epl_efc__thank_you_page__before_session_destroy', $post_ID);
     $new_user = $this->erm->maybe_add_new_user();
     if ($new_user !== false) {
         $this->erm->assign_event_to_user($post_ID, $new_user);
     }
     $this->epl->load_model('epl-db-model');
     EPL_db_model::get_instance()->reset_table_for_registration($post_ID, get_current_user_id());
     $this->epl_util->send_confirmation_email($data);
     $url = apply_filters('epl_efc__thank_you_page__redirect_url', '');
     $_SESSION['__epl'] = array();
     unset($_SESSION['__epl']);
     @session_destroy();
     $_SESSION = array();
     epl_delete_transient();
     if ($url != '' || $this->epl->locate_template('single-epl_registration.php')) {
         $url = $url != '' ? $url : get_permalink($this->regis_id);
         $url_params = array();
         if (epl_get_regis_setting('epl_tracking_code')) {
             $url_params['cnv_tr'] = 1;
         }
         $url_params['epl_token'] = epl_get_token();
         $url_params = apply_filters('epl_efc__thank_you_page__url_params', $url_params);
         $url = add_query_arg($url_params, $url);
         wp_redirect($url, 301);
         die;
     }
     return $data['overview'];
 }
        setup_event_details($event_id);
        //date capacity
        $date_capacity = epl_get_element_m($regis->date_id, '_epl_date_capacity', $event_details, '&infin;');
        //if there is time capacity, grab that or default to date capacity
        $capacity = epl_get_element_m($regis->time_id, '_epl_time_capacity', $event_details, $date_capacity);
        //get counts for this event, cached
        $counts = $erptm->get_attendee_counts($event_id);
        //count date specific key
        $counts_day_key = $event_id . "_time_{$regis->date_id}";
        //counts time specific key
        $counts_time_key = $event_id . "_time_{$regis->date_id}_{$regis->time_id}";
        //if count for that time exists, get num regis, defaults to 0
        $num_regis = epl_get_element('_total_att_' . $counts_time_key, $counts, 0);
        $url_params['epl_token'] = epl_get_token($regis->regis_id . $regis->regis_date);
        $regis_summary_url = add_query_arg($url_params, get_permalink($regis->regis_id));
        $pdf_url = array('epl_action' => 'invoice', 'regis_id' => $regis->regis_id, 'epl_token' => epl_get_token($regis->regis_id . $regis->regis_date));
        $pdf_url = add_query_arg($pdf_url, home_url());
        $arr = array($regis->regis_key, epl_formatted_date($regis->regis_date), epl_formatted_date($event_details['_epl_start_date'][$regis->date_id], 'D'), epl_formatted_date($event_details['_epl_start_date'][$regis->date_id]), $event_details['_epl_start_time'][$regis->time_id], $event_details['post_title'], $regis->ticket_count, get_the_regis_status($regis->status), epl_anchor($regis_summary_url, epl__('Details')) . ' ' . (!$attach_pdf || epl_get_element('_epl_attach_invoice', $event_details, 10) == 0 ? '' : epl_anchor($pdf_url, epl__('PDF'))));
        echo '<tr><td>' . implode('</td><td>', $arr) . '</td></tr>';
    }
    ?>
        </tbody>
    </table>
<?php 
} else {
    ?>

<div><?php 
    epl_e('No Registrations');
    ?>
</div>
예제 #4
0
 function notif_tags($email_body, $data)
 {
     global $event_details, $system_email_tags, $email_regis_form;
     if ($this->regis_id == '') {
         return null;
     }
     $email_body = nl2br(stripslashes_deep(html_entity_decode($email_body, ENT_QUOTES)));
     $regis_meta = $this->ecm->setup_regis_details($this->regis_id);
     $reigs_id = $regis_meta['__epl']['_regis_id'];
     $event_id = key($regis_meta['__epl'][$reigs_id]['_events']);
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     $attendee_info = $regis_meta['__epl'][$reigs_id]['_attendee_info'];
     $_attendee_info = array();
     foreach ($attendee_info as $_f_id => $_att_data) {
         if (!isset($available_fields[$_f_id])) {
             continue;
         }
         //$_attendee_info[$_f_id] = epl_get_element( 0, epl_get_element( $event_id, $_att_data ) );
         $value = epl_get_element(0, $_att_data, false);
         if (!$value) {
             $value = epl_get_element(0, epl_get_element($event_id, $_att_data));
         }
         $input_type = epl_get_element('input_type', $available_fields[$_f_id]);
         if ($input_type == 'select' || $input_type == 'radio') {
             $field_choice_text = epl_get_element($value, $available_fields[$_f_id]['epl_field_choice_text'], null);
             $value = $field_choice_text && $field_choice_text != '' ? $field_choice_text : $value;
         } elseif ($input_type == 'checkbox') {
             $value = implode(',', (array) $value);
         } else {
             //TODO - eek, find a better way
             $value = html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES));
         }
         $_attendee_info[$_f_id] = $value;
     }
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $gateway_info = array();
     if (!epl_is_free_event()) {
         $gw_id = $this->erm->get_payment_profile_id();
         $gateway_info = $this->ecm->get_post_meta_all($gw_id);
     }
     $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     $registration_detail_link = add_query_arg(array('epl_token' => epl_get_token()), get_permalink($this->regis_id));
     $_system_email_tags = array('registration_id' => get_the_regis_id(), 'registration_detail_link' => '<a href="' . $registration_detail_link . '" target="_blank" alt="' . epl__('Registration Detail Link') . '">' . epl__('Click here') . '</a>', 'event_name' => get_the_title($event_id), 'registration_details' => str_replace('class="epl_dates_times_prices_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', get_the_regis_dates_times_prices($data['post_ID'])), 'registration_form_data' => $email_regis_form, 'payment_details' => str_replace('class="epl_payment_details_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', $data['payment_details']), 'waitlist_approved_link' => epl_anchor(epl_get_waitlist_approved_url(), epl__('Register')), 'waitlist_approved_until' => epl_waitlist_approved_until(), 'event_details_link' => epl_anchor(get_permalink($event_details['ID']), get_the_title($event_details['ID'])), 'location_details' => !epl_is_multi_location() && epl_get_event_property('_epl_event_location', true) > 0 ? epl_suffix(', ', get_the_location_name()) . epl_suffix(', ', get_the_location_address() . ' ' . get_the_location_address2()) . get_the_location_city() . ' ' . get_the_location_state() . ' ' . get_the_location_zip() : '', 'location_map_link' => get_the_location_gmap_icon(epl__('Click here'), true));
     $_system_email_tags = apply_filters('epl_system_email_tags', $_system_email_tags);
     //isolate the forms that are selected inside the event
     // $ticket_buyer_forms = array_intersect_key( $available_forms, $event_ticket_buyer_forms );
     /*
      $tickey_buyer_fields = array( );
      foreach ( $ticket_buyer_forms as $_form_id => $_form_info )
      $tickey_buyer_fields += $_form_info['epl_form_fields'];
     */
     preg_match_all('/(?<=\\{)(.*?)(?=\\})/', $email_body, $matches);
     $_tags_in_body = array_flip(epl_get_element(0, $matches, array()));
     $_field_input_tags = array();
     foreach ($available_fields as $f_id => $f_data) {
         $_field_input_tags[$f_data['input_slug']] = $f_id;
     }
     $tagss = array_intersect_key($_field_input_tags, $_tags_in_body);
     $final_tags = array();
     foreach ($tagss as $k => $v) {
         $final_tags[$k] = epl_get_element($v, $_attendee_info);
     }
     $final_tags += $_system_email_tags;
     $find = array_keys($final_tags);
     array_walk($find, create_function('&$val', '$val = "{".$val."}";'));
     $replace = array_values($final_tags);
     return str_ireplace($find, $replace, $email_body);
 }