· 6 years ago · Aug 22, 2019, 07:20 AM
1<?php get_header(); ?>
2
3<?php
4 // Send Message
5 if(!empty($_POST)) {
6 if(nt_get_option('advance', 'recaptchar_site_key') && nt_get_option('advance', 'recaptchar_secret_key')) {
7
8 $secretKey = nt_get_option('advance', 'recaptchar_secret_key');
9 $response = $_POST['g-recaptcha-response'];
10 $reCaptchaValidationUrl = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$response");
11 $result = json_decode($reCaptchaValidationUrl, TRUE);
12
13 if($result['success']) {
14 $is_valid = true;
15 } else {
16 $is_valid = false;
17 }
18
19 } else {
20 $is_valid = true;
21 }
22
23 global $nt_site_message;
24 if($is_valid) {
25 $from = $_REQUEST['from'];
26
27
28 $phone = $_REQUEST['phone'];
29 $msg = $_REQUEST['message'];
30 $to = '';
31 if(isset($_REQUEST['to'])) $to = $_REQUEST['to'];
32 if(!$to) $to = nt_get_option('property', 'contact_email', get_bloginfo('admin_email'));
33
34 $subject = __('Inquiry Property', 'theme_front');
35 $property_id = get_post_meta( $post->ID, '_meta_id', true );
36 if($property_id) {
37 $subject .= ' #'.$property_id;
38 }
39
40 $headers[] = 'From: '.$from;
41 $headers[] = 'Reply-To: '.$from;
42 $headers[] = 'MIME-Version: 1.0';
43 $headers[] = 'Content-type: text/html; charset=utf-8';
44
45 $message = '<strong>'.__('Email Address', 'theme_front').'</strong>: '.$from;
46 $message .= '<br /><strong>'.__('Phone Number', 'theme_front').'</strong>: '.$phone;
47 $message .= '<br /><strong>'.__('Property', 'theme_front').'</strong>: <a href="'.get_the_permalink().'">'.$post->post_title.'</a>';
48 $message .= '<br /><br /><strong>'.__('Message', 'theme_front').'</strong>: <br />'.$msg;
49
50 do_action('nt_mail', $to, $subject, $message, $headers);
51 $nt_site_message = __('Your message has been sent.', 'theme_front');
52 } else {
53 $nt_site_message = __('There are something wrong.', 'theme_front');
54 }
55 }
56?>
57
58
59
60<div class="main-content">
61<div class="row">
62
63<?php if(isset($_REQUEST['compare-with'])): ?>
64 <div class="large-6 columns compare-left">
65 <div class="section"><?php nt_single_property($post->ID, true); ?></div>
66 </div>
67 <div class="large-6 columns compare-right">
68 <div class="section"><?php nt_single_property($_REQUEST['compare-with'], true); ?></div>
69 </div>
70<?php else: ?>
71
72 <?php if(nt_get_option('property', 'single_layout', 'sidebar') == 'sidebar-left'): ?>
73 <div class="large-8 large-push-4 columns">
74 <?php elseif(nt_get_option('property', 'single_layout', 'sidebar') == 'full-width'): ?>
75 <div class="large-12 columns">
76 <?php else: ?>
77 <div class="large-8 columns">
78 <?php endif; ?>
79
80 <div class="section">
81 <?php
82 if(post_password_required()) {
83 the_content();
84 } else {
85 nt_single_property($post->ID);
86 }
87 ?>
88<?php if(!post_password_required()) comments_template(); ?>
89 </div>
90 </div>
91
92 <?php if(nt_get_option('property', 'single_layout', 'sidebar') != 'full-width'): ?>
93 <?php if(nt_get_option('property', 'single_layout', 'sidebar') == 'sidebar'): ?>
94 <aside class="sidebar large-4 columns">
95 <?php else: ?>
96 <aside class="sidebar sidebar-left large-4 large-pull-8 columns">
97 <?php endif; ?>
98 <div class="section">
99 <?php if ( dynamic_sidebar( 'property' ) ); ?>
100 </div>
101 </aside>
102 <?php endif; ?>
103
104<?php endif; ?>
105
106</div><!-- .row -->
107</div><!-- #content -->
108
109<?php get_footer(); ?>