X-Git-Url: https://git.danix.xyz/?p=danixland-contact-form.git;a=blobdiff_plain;f=danixland-contact-form.php;h=e5348d308722a3c5dee0c0e54193352802f54390;hp=8367d0da57e86a4e762513618505d934c4b4eac7;hb=HEAD;hpb=b96bc7586a5d69d408041a66d40a483f837e5e39 diff --git a/danixland-contact-form.php b/danixland-contact-form.php index 8367d0d..e5348d3 100644 --- a/danixland-contact-form.php +++ b/danixland-contact-form.php @@ -1,11 +1,11 @@ -
-
-

$sitename

-
-

$sitemsg

-

$visitus

-
- -DNX6655788EOT; -?> - - - - - array( - 'href' => array(), - 'title' => array() - ), - 'br' => array(), - 'em' => array(), - 'strong' => array(), - 'p' => array(), - 'pre' => array(), - 'code' => array() - ); - // security checks before submitting the form - if ( $_SERVER['REQUEST_URI'] == $_POST['_wp_http_referer'] && wp_verify_nonce( $_POST[ $dnxcf_form_name], $dnxcf_form_action ) ) { + if ( isset( $_POST[ $dnxcf_send_value ] ) ) { // the form has been submitted + $dnxcf_email_output = ( '1' == $dnxcf_options['dnxcf_content_type'] ) ? 'text/plain' : 'text/html'; + $dnxcf_form_name = 'dnxcf_form_' . $dnxcf_pid; + $dnxcf_form_action = 'dnxcf_submit_' . $dnxcf_form_id; + // valid html used to validate the comment content. + $valid_html = array( + 'a' => array( + 'href' => array(), + 'title' => array(), + ), + 'br' => array(), + 'em' => array(), + 'strong' => array(), + 'p' => array(), + 'pre' => array(), + 'code' => array(), + ); + // security checks before submitting the form + if ( $_SERVER['REQUEST_URI'] == $_POST['_wp_http_referer'] && wp_verify_nonce( $_POST[ $dnxcf_form_name ], $dnxcf_form_action ) ) { - $dnxcf_posted = array(); - // let's gather some data about the user submitting the form - $dnxcf_ltd = trim(strip_tags(stripslashes(current_time("mysql")))); - $dnxcf_hst = trim(strip_tags(stripslashes(getenv("REMOTE_ADDR")))); - $dnxcf_ua = trim(strip_tags(stripslashes($_SERVER['HTTP_USER_AGENT']))); - // our posted options, arranged in one nice array - $dnxcf_posted['dnxcf_name'] = sanitize_text_field($_POST['dnxcf_name']); - $dnxcf_posted['dnxcf_email'] = sanitize_email($_POST['dnxcf_email']); - $dnxcf_posted['dnxcf_website'] = esc_url($_POST['dnxcf_website']); - $dnxcf_posted['dnxcf_subject'] = sanitize_text_field($_POST['dnxcf_subject']); - $dnxcf_posted['dnxcf_message'] = wp_kses($_POST['dnxcf_message'], $valid_html); - // let's begin with our email data, like receiver email, subject ecc. - $dnxcf_to = $dnxcf_options['dnxcf_recv_email']; - $dnxcf_headers = "Reply-To: " . $dnxcf_posted['dnxcf_email']; - $dnxcf_subject = __('Contact from "', 'dnxcf') . get_bloginfo('name') . '" - ' . $dnxcf_posted['dnxcf_subject']; + // nonce and referrer are correct. Let's verify if the honeypot field is empty. + if ( empty( $_POST['dnxcf_pagelikes'] ) ) { - // check for our content type and arrange our info accordingly - if ( 'text/html' == $dnxcf_email_output ) { - require( apply_filters( 'dnxcf_template_file', dirname( __FILE__ ) . '/include/dnxcf_mail_template_danixland.php') ); - $dnxcf_email_data = array( - 'ownname' => $dnxcf_options['dnxcf_recv_name'], - 'site' => get_bloginfo('name'), - 'time' => $dnxcf_ltd, - 'host' => $dnxcf_hst, - 'ua' => $dnxcf_ua, - ); - $dnxcf_message = dnxcf_email_content( $dnxcf_email_data, $dnxcf_posted ); - } else { // content_type is set to text/plain - $dnxcf_message = sprintf( - __("Hello \"%s\",\nyou are being contacted by %s on %s.\n%s has provided the following informations:\n\tEmail:\t\t%s\n\tWebsite:\t%s\n\tMessage:\n\n%s", 'dnxcf'), - $dnxcf_options['dnxcf_recv_name'], - $dnxcf_posted['dnxcf_name'], - get_bloginfo('name'), - $dnxcf_posted['dnxcf_name'], - $dnxcf_posted['dnxcf_email'], - $dnxcf_posted['dnxcf_website'], - $dnxcf_posted['dnxcf_message'] - ); - $dnxcf_message .= "\n\n##-----------#-----------#-----------##\n\n"; - $dnxcf_message .= sprintf( - __("We have also collected the following informations:\n\tBrowser:\t%s\n\tTime:\t\t%s\n\tIP Address:\t%s\n", 'dnxcf'), - $dnxcf_ua, - $dnxcf_ltd, - $dnxcf_hst - ); - } // end check for mail_content_type - $dnxcf_mailed = wp_mail( $dnxcf_to, $dnxcf_subject, $dnxcf_message, $dnxcf_headers ); - if ( $dnxcf_mailed ) { ?> -

-

-

-
-
-
-
-
-
-
-
-
-

-

-

-

-
-
-
-
-
-

- -

administrator.', 'dnxcf'), get_bloginfo('admin_email') ); ?>

- + $dnxcf_posted = array(); + // let's gather some data about the user submitting the form + $dnxcf_ltd = trim( strip_tags( stripslashes( current_time( 'mysql' ) ) ) ); + $dnxcf_hst = trim( strip_tags( stripslashes( getenv( 'REMOTE_ADDR' ) ) ) ); + $dnxcf_ua = trim( strip_tags( stripslashes( $_SERVER['HTTP_USER_AGENT'] ) ) ); + // our posted options, arranged in one nice array + $dnxcf_posted['dnxcf_name'] = sanitize_text_field( $_POST['dnxcf_name'] ); + $dnxcf_posted['dnxcf_email'] = sanitize_email( $_POST['dnxcf_email'] ); + $dnxcf_posted['dnxcf_website'] = esc_url( $_POST['dnxcf_website'] ); + $dnxcf_posted['dnxcf_subject'] = sanitize_text_field( $_POST['dnxcf_subject'] ); + $dnxcf_posted['dnxcf_message'] = wp_kses( $_POST['dnxcf_message'], $valid_html ); + // let's begin with our email data, like receiver email, subject ecc. + $dnxcf_to = $dnxcf_options['dnxcf_recv_email']; + $dnxcf_headers = 'Reply-To: ' . $dnxcf_posted['dnxcf_email']; + $dnxcf_subject = __( 'Contact from "', 'dnxcf' ) . get_bloginfo( 'name' ) . '" - ' . $dnxcf_posted['dnxcf_subject']; - -

- $dnxcf_options['dnxcf_recv_name'], + 'site' => get_bloginfo( 'name' ), + 'time' => $dnxcf_ltd, + 'host' => $dnxcf_hst, + 'ua' => $dnxcf_ua, + ); + $dnxcf_message = dnxcf_email_content( $dnxcf_email_data, $dnxcf_posted ); + } else { // content_type is set to text/plain + $dnxcf_message = sprintf( + __( "Hello \"%1\$s\",\nyou are being contacted by %2\$s on %3\$s.\n%4\$s has provided the following informations:\n\tEmail:\t\t%5\$s\n\tWebsite:\t%6\$s\n\tMessage:\n\n%7\$s", 'dnxcf' ), + $dnxcf_options['dnxcf_recv_name'], + $dnxcf_posted['dnxcf_name'], + get_bloginfo( 'name' ), + $dnxcf_posted['dnxcf_name'], + $dnxcf_posted['dnxcf_email'], + $dnxcf_posted['dnxcf_website'], + $dnxcf_posted['dnxcf_message'] + ); + $dnxcf_message .= "\n\n##-----------#-----------#-----------##\n\n"; + $dnxcf_message .= sprintf( + __( "We have also collected the following informations:\n\tBrowser:\t%1\$s\n\tTime:\t\t%2\$s\n\tIP Address:\t%3\$s\n", 'dnxcf' ), + $dnxcf_ua, + $dnxcf_ltd, + $dnxcf_hst + ); + } // end check for mail_content_type - } else { // the post hasn't been submitted. Let's show the form - global $dnxcf_options; - $dnxcf_options = get_option('dnxcf_options'); -?> - -
- -

-
- -

*

-
- -
-

-
-
- -
-

-

- - -

-

- - -

-

- - -

-
-
-

-

- - -

-

- - -

-
-
- -
-
-
- - +

+

+

+
+
+
+
+
+
+
+
+
+

+

+

+

+
+
+
+
+
+

+ +

administrator.', 'dnxcf' ), get_bloginfo( 'admin_email' ) ); ?>

+ +

+ +

+ + +
+ +

*

+
+ +
+

+
+
+ +
+

+

+ + +

+ +

+ + +

+

+ + +

+
+
+

+

+ + +

+

+ + +

+
+
+ +
+
+
+ + \ No newline at end of file +?>