Contact Form by BestWebSoft - Version 2011.2.08

Version Description

Download this release

Release Info

Developer bestwebsoft
Plugin Icon 128x128 Contact Form by BestWebSoft
Version 2011.2.08
Comparing to
See all releases

Code changes from version 2011.2.07 to 2011.2.08

Files changed (2) hide show
  1. contact_form.php +69 -12
  2. readme.txt +7 -1
contact_form.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form Plugin
4
  Plugin URI: http://bestwebsoft.com/plugin/
5
  Description: Plugin for Contact Form.
6
  Author: BestWebSoft
7
- Version: 2.07
8
  Author URI: http://bestwebsoft.com/
9
  License: GPLv2 or later
10
  */
@@ -257,12 +257,12 @@ if( ! function_exists( 'cntctfrm_display_form' ) ) {
257
  }
258
  // If it is good
259
  if( true === $result ) {
260
- $content .= __( "Thank you for contacting us.", "cmntfrm" );
261
  }
262
  else if( false === $result )
263
  {
264
  // If email not be delivered
265
- $error_message['error_form'] = __( "Sorry, your e-mail could not be delivered.", "cmntfrm" );
266
  }
267
  else {
268
  // Output form
@@ -331,11 +331,11 @@ if( ! function_exists( 'cntctfrm_check_form' ) ) {
331
  $result = "";
332
  // Error messages array
333
  $error_message = array();
334
- $error_message['error_name'] = __( "Your name is required.", "cmntfrm" );
335
- $error_message['error_email'] = __( "A proper e-mail address is required.", "cmntfrm" );
336
- $error_message['error_subject'] = __( "Subject text is required.", "cmntfrm" );
337
- $error_message['error_message'] = __( "Message text is required.", "cmntfrm" );
338
- $error_message['error_form'] = __( "Please make corrections below and try again.", "cmntfrm" );
339
  // Check information wich was input in fields
340
  if( "" != $_REQUEST['cntctfrm_contact_name'] )
341
  unset( $error_message['error_name'] );
@@ -347,7 +347,7 @@ if( ! function_exists( 'cntctfrm_check_form' ) ) {
347
  unset( $error_message['error_message'] );
348
  // If captcha plugin exists
349
  if( ! apply_filters( 'cntctfrm_check_form', $_REQUEST ) )
350
- $error_message['error_captcha'] = __( "Please complete the CAPTCHA.", "cmntfrm" );
351
  if( 1 == count( $error_message ) ) {
352
  unset( $error_message['error_form'] );
353
  // If all is good - send mail
@@ -376,6 +376,20 @@ if( ! function_exists( 'cntctfrm_send_mail' ) ) {
376
  if( "" != $to ) {
377
  // subject
378
  $subject = $_REQUEST['cntctfrm_contact_subject'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  // message
380
  $message = '
381
  <html>
@@ -397,16 +411,32 @@ if( ! function_exists( 'cntctfrm_send_mail' ) ) {
397
  <td>Message</td><td>'.$_REQUEST['cntctfrm_contact_message'].'</td>
398
  </tr>
399
  <tr>
400
- <td></td><td></td>
 
 
 
401
  </tr>
402
  <tr>
403
- <td>Site</td><td>'.get_bloginfo("url").'</td>
 
 
 
 
 
 
 
 
 
 
 
 
404
  </tr>
405
  </table>
406
  </body>
407
  </html>
408
  ';
409
 
 
410
  // To send HTML mail, the Content-type header must be set
411
  $headers = 'MIME-Version: 1.0' . "\r\n";
412
  $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
@@ -415,7 +445,7 @@ if( ! function_exists( 'cntctfrm_send_mail' ) ) {
415
  $headers .= 'From: '.$_REQUEST['cntctfrm_contact_email']. "\r\n";
416
 
417
  // Mail it
418
- return @mail($to, $subject, $message, $headers);
419
  }
420
  return false;
421
  }
@@ -443,6 +473,33 @@ function cntctfrm_register_plugin_links($links, $file) {
443
  return $links;
444
  }
445
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  // adds "Settings" link to the plugin action page
447
  add_filter( 'plugin_action_links', 'cntctfrm_plugin_action_links',10,2);
448
 
4
  Plugin URI: http://bestwebsoft.com/plugin/
5
  Description: Plugin for Contact Form.
6
  Author: BestWebSoft
7
+ Version: 2.08
8
  Author URI: http://bestwebsoft.com/
9
  License: GPLv2 or later
10
  */
257
  }
258
  // If it is good
259
  if( true === $result ) {
260
+ $content .= __( "Thank you for contacting us.", "cntfrm" );
261
  }
262
  else if( false === $result )
263
  {
264
  // If email not be delivered
265
+ $error_message['error_form'] = __( "Sorry, your e-mail could not be delivered.", "cntfrm" );
266
  }
267
  else {
268
  // Output form
331
  $result = "";
332
  // Error messages array
333
  $error_message = array();
334
+ $error_message['error_name'] = __( "Your name is required.", "cntfrm" );
335
+ $error_message['error_email'] = __( "A proper e-mail address is required.", "cntfrm" );
336
+ $error_message['error_subject'] = __( "Subject text is required.", "cntfrm" );
337
+ $error_message['error_message'] = __( "Message text is required.", "cntfrm" );
338
+ $error_message['error_form'] = __( "Please make corrections below and try again.", "cntfrm" );
339
  // Check information wich was input in fields
340
  if( "" != $_REQUEST['cntctfrm_contact_name'] )
341
  unset( $error_message['error_name'] );
347
  unset( $error_message['error_message'] );
348
  // If captcha plugin exists
349
  if( ! apply_filters( 'cntctfrm_check_form', $_REQUEST ) )
350
+ $error_message['error_captcha'] = __( "Please complete the CAPTCHA.", "cntfrm" );
351
  if( 1 == count( $error_message ) ) {
352
  unset( $error_message['error_form'] );
353
  // If all is good - send mail
376
  if( "" != $to ) {
377
  // subject
378
  $subject = $_REQUEST['cntctfrm_contact_subject'];
379
+ $user_info_string = '';
380
+ $userdomain = '';
381
+ $form_action_url = '';
382
+ if ( getenv('HTTPS') == 'on' ) {
383
+ $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
384
+ } else {
385
+ $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
386
+ }
387
+
388
+ $userdomain = gethostbyaddr($_SERVER['REMOTE_ADDR']);
389
+ $user_info_string .= __('Sent from (ip address)', 'cntfrm').': '.$_SERVER['REMOTE_ADDR']." ( ". $userdomain ." )";
390
+ $user_info_string .= __('Date/Time', 'cntfrm').': '.date_i18n( get_option( 'date_format' ).' '.get_option( 'time_format' ), time() );
391
+ $user_info_string .= __('Coming from (referer)', 'cntfrm').': '.$form_action_url;
392
+ $user_info_string .= __('Using (user agent)', 'cntfrm').': '.cntctfrm_clean_input($_SERVER['HTTP_USER_AGENT']);
393
  // message
394
  $message = '
395
  <html>
411
  <td>Message</td><td>'.$_REQUEST['cntctfrm_contact_message'].'</td>
412
  </tr>
413
  <tr>
414
+ <td>Site</td><td>'.get_bloginfo("url").'</td>
415
+ </tr>
416
+ <tr>
417
+ <td><br /></td><td><br /></td>
418
  </tr>
419
  <tr>
420
+ <td><br /></td><td><br /></td>
421
+ </tr>
422
+ <tr>
423
+ <td>'.__('Sent from (ip address)', 'cntfrm').': </td><td>'.$_SERVER['REMOTE_ADDR']." ( ". $userdomain ." )".'</td>
424
+ </tr>
425
+ <tr>
426
+ <td>'.__('Date/Time', 'cntfrm').': </td><td>'.date_i18n( get_option( 'date_format' ).' '.get_option( 'time_format' ), time() ).'</td>
427
+ </tr>
428
+ <tr>
429
+ <td>'.__('Coming from (referer)', 'cntfrm').': </td><td>'.$form_action_url.'</td>
430
+ </tr>
431
+ <tr>
432
+ <td>'.__('Using (user agent)', 'cntfrm').': </td><td>'.cntctfrm_clean_input($_SERVER['HTTP_USER_AGENT']).'</td>
433
  </tr>
434
  </table>
435
  </body>
436
  </html>
437
  ';
438
 
439
+
440
  // To send HTML mail, the Content-type header must be set
441
  $headers = 'MIME-Version: 1.0' . "\r\n";
442
  $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
445
  $headers .= 'From: '.$_REQUEST['cntctfrm_contact_email']. "\r\n";
446
 
447
  // Mail it
448
+ return @mail($to, stripslashes($subject), stripslashes($message), $headers);
449
  }
450
  return false;
451
  }
473
  return $links;
474
  }
475
 
476
+ function cntctfrm_clean_input($string, $preserve_space = 0) {
477
+ if ( is_string( $string ) ) {
478
+ if($preserve_space) {
479
+ return cntctfrm_sanitize_string( strip_tags( stripslashes( $string ) ), $preserve_space );
480
+ }
481
+ return trim( cntctfrm_sanitize_string( strip_tags( stripslashes( $string ) ) ) );
482
+ }
483
+ else if ( is_array( $string ) ) {
484
+ reset( $string );
485
+ while ( list($key, $value ) = each( $string ) ) {
486
+ $string[$key] = cntctfrm_clean_input($value,$preserve_space);
487
+ }
488
+ return $string;
489
+ }
490
+ else {
491
+ return $string;
492
+ }
493
+ } // end function ctf_clean_input
494
+
495
+ // functions for protecting and validating form vars
496
+ function cntctfrm_sanitize_string($string, $preserve_space = 0 ) {
497
+ if( ! $preserve_space )
498
+ $string = preg_replace("/ +/", ' ', trim( $string ) );
499
+
500
+ return preg_replace( "/[<>]/", '_', $string );
501
+ }
502
+
503
  // adds "Settings" link to the plugin action page
504
  add_filter( 'plugin_action_links', 'cntctfrm_plugin_action_links',10,2);
505
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bestwebsoft.com/
4
  Tags: Contact Form, text, contact, form, contacts, contakt form, request, contact me, feedback form, feedback, contact button, contact form plugin, contacts form plugin
5
  Requires at least: 2.9
6
  Tested up to: 3.2
7
- Stable tag: 2011.2.07
8
 
9
  Add Contact Form to your WordPress website.
10
 
@@ -46,6 +46,9 @@ Contact Form allows you to add a feedback form easilly and simply to a post or a
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 2.07 =
50
  *We fixed the bug of complex form validation when captcha not used in the contact form. Upgrade immediately.
51
 
@@ -81,6 +84,9 @@ Contact Form allows you to add a feedback form easilly and simply to a post or a
81
 
82
  == Upgrade Notice ==
83
 
 
 
 
84
  = 2.07 =
85
  We fixed the bug of complex form validation when captcha not used in the contact form. Upgrade immediately.
86
 
4
  Tags: Contact Form, text, contact, form, contacts, contakt form, request, contact me, feedback form, feedback, contact button, contact form plugin, contacts form plugin
5
  Requires at least: 2.9
6
  Tested up to: 3.2
7
+ Stable tag: 2011.2.08
8
 
9
  Add Contact Form to your WordPress website.
10
 
46
 
47
  == Changelog ==
48
 
49
+ = 2.08 =
50
+ *We fixed the slashes bug in email and added server info to email.
51
+
52
  = 2.07 =
53
  *We fixed the bug of complex form validation when captcha not used in the contact form. Upgrade immediately.
54
 
84
 
85
  == Upgrade Notice ==
86
 
87
+ = 2.08 =
88
+ We fixed the slashes bug in email and added server info to email.
89
+
90
  = 2.07 =
91
  We fixed the bug of complex form validation when captcha not used in the contact form. Upgrade immediately.
92