Guest User

Untitled

a guest
Jun 7th, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. <?php
  2. if($_POST)
  3. {
  4. if(function_exists('pt_check_captch_cond'))
  5. {
  6. if(!pt_check_captch_cond())
  7. {
  8. $url = get_permalink($post->ID);
  9. if(strstr($url,'?'))
  10. {
  11. $url = $url."&emsg=captch";
  12. }else
  13. {
  14. $url = $url."?emsg=captch";
  15. }
  16. wp_redirect($url);
  17. exit;
  18. }
  19. }
  20. $yourname = $_POST['inq_name'];
  21. $youremail = $_POST['inq_email'];
  22. $inq_phone = $_POST['inq_phone'];
  23. $frnd_comments = $_POST['inq_msg'];
  24. $pid = $_POST['pid'];
  25.  
  26. $post_title = '<a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a>';
  27. $to_name = get_post_meta($post->ID,'email',true);
  28. $to_email = get_post_meta($post->ID,'email',true);
  29. if($to_email=='')
  30. {
  31. $to_email = get_option('admin_email');
  32. }
  33. ///////Inquiry EMAIL START//////
  34. global $upload_folder_path;
  35. $clientdestinationfile = TEMPLATEPATH."/library/notification/send_inquiry.txt";
  36. //$message1 = file_get_contents($clientdestinationfile);
  37. $message1 = implode('',file($clientdestinationfile));
  38. $filecontent_arr1 = explode('[SUBJECT-STR]',$message1);
  39. $filecontent_arr2 = explode('[SUBJECT-END]',$filecontent_arr1[1]);
  40. $subject = $filecontent_arr2[0]. __(' for ').'"'.$post->post_title.'"';
  41.  
  42. $client_message = $filecontent_arr2[1];
  43. $yourname_link = __('<br>From : ').$yourname.__('<br>Phone : ').$inq_phone.'<br><br>Send from - <b><a href="'.get_option('siteurl').'">'.get_option('blogname').'</a></b>.';
  44. /////////////customer email//////////////
  45. $search_array = array('[#$to_name#]','[#$post_title#]','[#$frnd_subject#]','[#$frnd_comments#]','[#$your_name#]');
  46. $replace_array = array($to_name,$post_title,$frnd_subject,nl2br($frnd_comments),$yourname_link);
  47. $client_message = str_replace($search_array,$replace_array,$client_message);
  48. /* echo "From : $youremail Name : $yourname <br>";
  49. echo "To : $to_email Name : $to_name <br>";
  50. echo "Subject $subject <br>";
  51. echo "$client_message";
  52. exit;*/
  53. if($to_email)
  54. {
  55. sendEmail($youremail,$yourname,$to_email,$to_name,$subject,$client_message,$extra='');
  56. }
  57.  
  58. $to = get_option('admin_email');
  59. mail($to, $subject, $client_message);
  60. //////Inquiry EMAIL END////////
  61. $url = get_permalink($post->ID);
  62. if(strstr($url,'?'))
  63. {
  64. $url = $url."&send_inquiry=success";
  65. }else
  66. {
  67. $url = $url."?send_inquiry=success";
  68. }
  69. wp_redirect($url);
  70. }
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment