function cp_contactformpp_export_csv() { if (!is_admin()) { return; } global $wpdb; if (!defined('CP_CONTACTFORMPP_ID')) { define('CP_CONTACTFORMPP_ID', intval($_GET["cal"])); } $form_data = json_decode(cp_contactformpp_cleanJSON(cp_contactformpp_get_option('form_structure', CP_CONTACTFORMPP_DEFAULT_form_structure))); $cond = ''; if ($_GET["search"] != '') { $cond .= " AND (data like '%" . esc_sql($_GET["search"]) . "%' OR paypal_post LIKE '%" . esc_sql($_GET["search"]) . "%')"; } if ($_GET["dfrom"] != '') { $cond .= " AND (`time` >= '" . esc_sql($_GET["dfrom"]) . "')"; } if ($_GET["dto"] != '') { $cond .= " AND (`time` <= '" . esc_sql($_GET["dto"]) . " 23:59:59')"; } if (CP_CONTACTFORMPP_ID != 0) { $cond .= " AND formid=" . CP_CONTACTFORMPP_ID; } $events = $wpdb->get_results("SELECT * FROM " . CP_CONTACTFORMPP_POSTS_TABLE_NAME . " WHERE 1=1 " . $cond . " ORDER BY `time` DESC"); $fields = array("Form ID", "Time", "IP Address", "email", "Paid"); $values = array(); foreach ($events as $item) { $value = array($item->formid, $item->time, $item->ipaddr, $item->notifyto, $item->paid ? "Yes" : "No"); $data = array(); if ($item->posted_data) { $data = unserialize($item->posted_data); } else { if (!$item->paid) { $data = unserialize($item->paypal_post); } } $end = count($fields); for ($i = 0; $i < $end; $i++) { if (isset($data[$fields[$i]])) { $value[$i] = $data[$fields[$i]]; unset($data[$fields[$i]]); } } foreach ($data as $k => $d) { $fields[] = $k; $value[] = $d; } $values[] = $value; } header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=export" . date("Y-m-d") . ".csv"); $end = count($fields); for ($i = 0; $i < $end; $i++) { echo '"' . str_replace('"', '""', cp_contactformpp_get_field_name($fields[$i], @$form_data[0])) . '",'; } echo "\n"; foreach ($values as $item) { for ($i = 0; $i < $end; $i++) { if (!isset($item[$i])) { $item[$i] = ''; } if (is_array($item[$i])) { $item[$i] = implode($item[$i], ','); } echo '"' . str_replace('"', '""', $item[$i]) . '",'; } echo "\n"; } exit; }
?> :<br /> <input type="text" name="couponcode" value=""><br /> <?php } ?> <br /> <?php if (cp_contactformpp_get_option('cv_enable_captcha', CP_CONTACTFORMPP_DEFAULT_cv_enable_captcha, $id) != 'false') { ?> <?php echo __('Please enter the security code', 'cpcfwpp'); ?> :<br /> <img src="<?php echo cp_contactformpp_get_site_url() . '/?cp_contactformpp=captcha&ps=' . $CP_CPP_global_form_count . '&width=' . cp_contactformpp_get_option('cv_width', CP_CONTACTFORMPP_DEFAULT_cv_width, $id) . '&height=' . cp_contactformpp_get_option('cv_height', CP_CONTACTFORMPP_DEFAULT_cv_height, $id) . '&letter_count=' . cp_contactformpp_get_option('cv_chars', CP_CONTACTFORMPP_DEFAULT_cv_chars, $id) . '&min_size=' . cp_contactformpp_get_option('cv_min_font_size', CP_CONTACTFORMPP_DEFAULT_cv_min_font_size, $id) . '&max_size=' . cp_contactformpp_get_option('cv_max_font_size', CP_CONTACTFORMPP_DEFAULT_cv_max_font_size, $id) . '&noise=' . cp_contactformpp_get_option('cv_noise', CP_CONTACTFORMPP_DEFAULT_cv_noise, $id) . '&noiselength=' . cp_contactformpp_get_option('cv_noise_length', CP_CONTACTFORMPP_DEFAULT_cv_noise_length, $id) . '&bcolor=' . cp_contactformpp_get_option('cv_background', CP_CONTACTFORMPP_DEFAULT_cv_background, $id) . '&border=' . cp_contactformpp_get_option('cv_border', CP_CONTACTFORMPP_DEFAULT_cv_border, $id) . '&font=' . cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font, $id); ?> " id="captchaimg<?php echo $CP_CPP_global_form_count; ?> " alt="security code" border="0" /> <br /> <?php echo __('Security Code', 'cpcfwpp'); ?> :<br /> <div class="dfield"> <input type="text" size="20" name="hdcaptcha_cp_contact_form_paypal_post" id="hdcaptcha_cp_contact_form_paypal_post<?php echo $CP_CPP_global_form_count; ?> " value="" />
?> >Font 1</option> <option value="font-2.ttf"<?php if ("font-2.ttf" == cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font)) { echo " selected"; } ?> >Font 2</option> <option value="font-3.ttf"<?php if ("font-3.ttf" == cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font)) { echo " selected"; } ?> >Font 3</option> <option value="font-4.ttf"<?php if ("font-4.ttf" == cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font)) { echo " selected"; } ?> >Font 4</option> </select> </td> </tr> </table> </div> </div> <div id="metabox_basic_settings" class="postbox" >
global $wpdb; $message = ""; if (isset($_GET['a']) && $_GET['a'] == '1' && $verify_nonce) { define('CP_CONTACTFORMPP_DEFAULT_fp_from_email', get_the_author_meta('user_email', get_current_user_id())); define('CP_CONTACTFORMPP_DEFAULT_fp_destination_emails', CP_CONTACTFORMPP_DEFAULT_fp_from_email); // temporal lines to guarantee migration cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'paypal_zero_payment', " varchar(10) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'fp_emailformat', " varchar(10) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'cu_emailformat', " varchar(10) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'paypal_notiemails', " varchar(20) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'paypal_mode', " varchar(20) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'paypal_recurrent', " varchar(20) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'paypal_identify_prices', " varchar(20) NOT NULL default ''"); cp_contactformpp_add_field_verify($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, 'cp_emailformat', " varchar(10) NOT NULL default ''"); // insert line $wpdb->insert($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, array('form_name' => stripcslashes($_GET["name"]), 'form_structure' => CP_CONTACTFORMPP_DEFAULT_form_structure, 'fp_from_email' => cp_contactformpp_get_option('fp_from_email', CP_CONTACTFORMPP_DEFAULT_fp_from_email), 'fp_destination_emails' => cp_contactformpp_get_option('fp_destination_emails', CP_CONTACTFORMPP_DEFAULT_fp_destination_emails), 'fp_subject' => cp_contactformpp_get_option('fp_subject', CP_CONTACTFORMPP_DEFAULT_fp_subject), 'fp_inc_additional_info' => cp_contactformpp_get_option('fp_inc_additional_info', CP_CONTACTFORMPP_DEFAULT_fp_inc_additional_info), 'fp_return_page' => cp_contactformpp_get_option('fp_return_page', CP_CONTACTFORMPP_DEFAULT_fp_return_page), 'fp_message' => cp_contactformpp_get_option('fp_message', CP_CONTACTFORMPP_DEFAULT_fp_message), 'fp_emailformat' => cp_contactformpp_get_option('fp_emailformat', CP_CONTACTFORMPP_DEFAULT_email_format), 'cu_enable_copy_to_user' => cp_contactformpp_get_option('cu_enable_copy_to_user', CP_CONTACTFORMPP_DEFAULT_cu_enable_copy_to_user), 'cu_user_email_field' => cp_contactformpp_get_option('cu_user_email_field', CP_CONTACTFORMPP_DEFAULT_cu_user_email_field), 'cu_subject' => cp_contactformpp_get_option('cu_subject', CP_CONTACTFORMPP_DEFAULT_cu_subject), 'cu_message' => cp_contactformpp_get_option('cu_message', CP_CONTACTFORMPP_DEFAULT_cu_message), 'cp_emailformat' => cp_contactformpp_get_option('cp_emailformat', CP_CONTACTFORMPP_DEFAULT_email_format), 'vs_use_validation' => cp_contactformpp_get_option('vs_use_validation', CP_CONTACTFORMPP_DEFAULT_vs_use_validation), 'vs_text_is_required' => cp_contactformpp_get_option('vs_text_is_required', CP_CONTACTFORMPP_DEFAULT_vs_text_is_required), 'vs_text_is_email' => cp_contactformpp_get_option('vs_text_is_email', CP_CONTACTFORMPP_DEFAULT_vs_text_is_email), 'vs_text_datemmddyyyy' => cp_contactformpp_get_option('vs_text_datemmddyyyy', CP_CONTACTFORMPP_DEFAULT_vs_text_datemmddyyyy), 'vs_text_dateddmmyyyy' => cp_contactformpp_get_option('vs_text_dateddmmyyyy', CP_CONTACTFORMPP_DEFAULT_vs_text_dateddmmyyyy), 'vs_text_number' => cp_contactformpp_get_option('vs_text_number', CP_CONTACTFORMPP_DEFAULT_vs_text_number), 'vs_text_digits' => cp_contactformpp_get_option('vs_text_digits', CP_CONTACTFORMPP_DEFAULT_vs_text_digits), 'vs_text_max' => cp_contactformpp_get_option('vs_text_max', CP_CONTACTFORMPP_DEFAULT_vs_text_max), 'vs_text_min' => cp_contactformpp_get_option('vs_text_min', CP_CONTACTFORMPP_DEFAULT_vs_text_min), 'enable_paypal' => cp_contactformpp_get_option('enable_paypal', CP_CONTACTFORMPP_DEFAULT_ENABLE_PAYPAL), 'paypal_notiemails' => cp_contactformpp_get_option('paypal_notiemails', '0'), 'paypal_email' => cp_contactformpp_get_option('paypal_email', CP_CONTACTFORMPP_DEFAULT_PAYPAL_EMAIL), 'request_cost' => cp_contactformpp_get_option('request_cost', CP_CONTACTFORMPP_DEFAULT_COST), 'paypal_product_name' => cp_contactformpp_get_option('paypal_product_name', CP_CONTACTFORMPP_DEFAULT_PRODUCT_NAME), 'currency' => cp_contactformpp_get_option('currency', CP_CONTACTFORMPP_DEFAULT_CURRENCY), 'paypal_language' => cp_contactformpp_get_option('paypal_language', CP_CONTACTFORMPP_DEFAULT_PAYPAL_LANGUAGE), 'cv_enable_captcha' => cp_contactformpp_get_option('cv_enable_captcha', CP_CONTACTFORMPP_DEFAULT_cv_enable_captcha), 'cv_width' => cp_contactformpp_get_option('cv_width', CP_CONTACTFORMPP_DEFAULT_cv_width), 'cv_height' => cp_contactformpp_get_option('cv_height', CP_CONTACTFORMPP_DEFAULT_cv_height), 'cv_chars' => cp_contactformpp_get_option('cv_chars', CP_CONTACTFORMPP_DEFAULT_cv_chars), 'cv_font' => cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font), 'cv_min_font_size' => cp_contactformpp_get_option('cv_min_font_size', CP_CONTACTFORMPP_DEFAULT_cv_min_font_size), 'cv_max_font_size' => cp_contactformpp_get_option('cv_max_font_size', CP_CONTACTFORMPP_DEFAULT_cv_max_font_size), 'cv_noise' => cp_contactformpp_get_option('cv_noise', CP_CONTACTFORMPP_DEFAULT_cv_noise), 'cv_noise_length' => cp_contactformpp_get_option('cv_noise_length', CP_CONTACTFORMPP_DEFAULT_cv_noise_length), 'cv_background' => cp_contactformpp_get_option('cv_background', CP_CONTACTFORMPP_DEFAULT_cv_background), 'cv_border' => cp_contactformpp_get_option('cv_border', CP_CONTACTFORMPP_DEFAULT_cv_border), 'cv_text_enter_valid_captcha' => cp_contactformpp_get_option('cv_text_enter_valid_captcha', CP_CONTACTFORMPP_DEFAULT_cv_text_enter_valid_captcha))); $message = "Item added"; } else { if (isset($_GET['u']) && $_GET['u'] != '' && $verify_nonce) { $wpdb->query('UPDATE `' . $wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE . '` SET form_name="' . esc_sql($_GET["name"]) . '" WHERE id=' . intval($_GET['u'])); $message = "Item updated"; } else { if (isset($_GET['d']) && $_GET['d'] != '' && $verify_nonce) { $wpdb->query('DELETE FROM `' . $wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE . '` WHERE id=' . intval($_GET['d'])); $message = "Item deleted"; } else { if (isset($_GET['c']) && $_GET['c'] != '' && $verify_nonce) { $myrows = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE . " WHERE id=" . intval($_GET['c']), ARRAY_A); unset($myrows["id"]); $myrows["form_name"] = 'Cloned: ' . $myrows["form_name"]; $wpdb->insert($wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE, $myrows);
function cp_contactformpp_process_ready_to_go_reservation($itemnumber, $payer_email = "", $params = array()) { global $wpdb; $myrows = $wpdb->get_results("SELECT * FROM " . CP_CONTACTFORMPP_POSTS_TABLE_NAME . " WHERE id=" . $itemnumber); $mycalendarrows = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . CP_CONTACTFORMPP_FORMS_TABLE . ' WHERE `id`=' . $myrows[0]->formid); if (!defined('CP_CONTACTFORMPP_ID')) { define('CP_CONTACTFORMPP_ID', $myrows[0]->formid); } $buffer_A = $myrows[0]->data; $buffer = $buffer_A; if ('true' == cp_contactformpp_get_option('fp_inc_additional_info', CP_CONTACTFORMPP_DEFAULT_fp_inc_additional_info)) { $buffer .= "ADDITIONAL INFORMATION\n" . "*********************************\n" . "IP: " . $myrows[0]->ipaddr . "\n" . "Server Time: " . date("Y-m-d H:i:s") . "\n"; } // 1- Send email //--------------------------- $message = str_replace('<%INFO%>', $buffer, cp_contactformpp_get_option('fp_message', CP_CONTACTFORMPP_DEFAULT_fp_message)); foreach ($params as $item => $value) { $message = str_replace('<%' . $item . '%>', is_array($value) ? implode(", ", $value) : $value, $message); if (strpos($item, "_link")) { $attachments[] = $value; } } $subject = cp_contactformpp_get_option('fp_subject', CP_CONTACTFORMPP_DEFAULT_fp_subject); $from = cp_contactformpp_get_option('fp_from_email', CP_CONTACTFORMPP_DEFAULT_fp_from_email); $to = explode(",", cp_contactformpp_get_option('fp_destination_emails', CP_CONTACTFORMPP_DEFAULT_fp_destination_emails)); foreach ($to as $item) { if (trim($item) != '') { wp_mail(trim($item), $subject, $message, "From: \"{$from}\" <" . $from . ">\r\n" . "Content-Type: text/plain; charset=utf-8\n" . "X-Mailer: PHP/" . phpversion()); } } // 2- Send copy to user //--------------------------- $to = cp_contactformpp_get_option('cu_user_email_field', CP_CONTACTFORMPP_DEFAULT_cu_user_email_field); $_POST[$to] = $myrows[0]->notifyto; if ((trim($_POST[$to]) != '' || $payer_email != '') && 'true' == cp_contactformpp_get_option('cu_enable_copy_to_user', CP_CONTACTFORMPP_DEFAULT_cu_enable_copy_to_user)) { $message = str_replace('<%INFO%>', $buffer_A, cp_contactformpp_get_option('cu_message', CP_CONTACTFORMPP_DEFAULT_cu_message)); foreach ($params as $item => $value) { $message = str_replace('<%' . $item . '%>', is_array($value) ? implode(", ", $value) : $value, $message); } $subject = cp_contactformpp_get_option('cu_subject', CP_CONTACTFORMPP_DEFAULT_cu_subject); if ($_POST[$to] != '') { wp_mail(trim($_POST[$to]), $subject, $message, "From: \"{$from}\" <" . $from . ">\r\n" . "Content-Type: text/plain; charset=utf-8\n" . "X-Mailer: PHP/" . phpversion()); } if ($_POST[$to] != $payer_email && $payer_email != '') { wp_mail(trim($payer_email), $subject, $message, "From: \"{$from}\" <" . $from . ">\r\n" . "Content-Type: text/plain; charset=utf-8\n" . "X-Mailer: PHP/" . phpversion()); } } }
" /> <input type="hidden" name="form_structure" id="form_structure" size="180" value="<?php echo str_replace("\r", "", str_replace("\n", "", esc_attr(cp_contactformpp_cleanJSON(cp_contactformpp_get_option('form_structure', CP_CONTACTFORMPP_DEFAULT_form_structure))))); ?> " /> <div id="fbuilder"> <div id="formheader"></div> <div id="fieldlist"></div> </div> <br /> <?php if (cp_contactformpp_get_option('cv_enable_captcha', CP_CONTACTFORMPP_DEFAULT_cv_enable_captcha) != 'false') { ?> Please enter the security code:<br /> <img src="<?php echo cp_contactformpp_get_site_url() . '/?cp_contactformpp=captcha&width=' . cp_contactformpp_get_option('cv_width', CP_CONTACTFORMPP_DEFAULT_cv_width) . '&height=' . cp_contactformpp_get_option('cv_height', CP_CONTACTFORMPP_DEFAULT_cv_height) . '&letter_count=' . cp_contactformpp_get_option('cv_chars', CP_CONTACTFORMPP_DEFAULT_cv_chars) . '&min_size=' . cp_contactformpp_get_option('cv_min_font_size', CP_CONTACTFORMPP_DEFAULT_cv_min_font_size) . '&max_size=' . cp_contactformpp_get_option('cv_max_font_size', CP_CONTACTFORMPP_DEFAULT_cv_max_font_size) . '&noise=' . cp_contactformpp_get_option('cv_noise', CP_CONTACTFORMPP_DEFAULT_cv_noise) . '&noiselength=' . cp_contactformpp_get_option('cv_noise_length', CP_CONTACTFORMPP_DEFAULT_cv_noise_length) . '&bcolor=' . cp_contactformpp_get_option('cv_background', CP_CONTACTFORMPP_DEFAULT_cv_background) . '&border=' . cp_contactformpp_get_option('cv_border', CP_CONTACTFORMPP_DEFAULT_cv_border) . '&font=' . cp_contactformpp_get_option('cv_font', CP_CONTACTFORMPP_DEFAULT_cv_font); ?> " id="captchaimg" alt="security code" border="0" /> <br /> Security Code (lowercase letters):<br /> <div class="dfield"> <input type="text" size="20" name="hdcaptcha_cp_contact_form_paypal_post" id="hdcaptcha_cp_contact_form_paypal_post" value="" /> <div class="error message" id="hdcaptcha_error" generated="true" style="display:none;position: absolute; left: 0px; top: 25px;"></div> </div> <br /> <?php } ?> <input type="submit" class="submit" name="cp_contactformpp_subbtn" id="cp_contactformpp_subbtn" value="<?php _e("Submit"); ?>