PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.4.0
Firebase Authentication v1.4.0
1.7.0 trunk 1.0.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9
firebase-authentication / class-contact-us.php
firebase-authentication Last commit date
admin 5 years ago includes 5 years ago js 5 years ago languages 5 years ago public 5 years ago views 5 years ago README.txt 5 years ago class-contact-us.php 5 years ago class-mo-firebase-config.php 5 years ago firebase-authentication.php 5 years ago index.php 5 years ago uninstall.php 5 years ago
class-contact-us.php
138 lines
1 <?php
2 class MO_Firebase_contact_us{
3 private $defaultCustomerKey = "16555";
4 private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
5
6 function mo_firebase_auth_contact_us( $email, $phone, $query ) {
7 global $current_user;
8 wp_get_current_user();
9 $version = get_option("mo_firebase_authentication_current_plugin_version");
10 $query = '[WP Firebase Authentication Plugin] ' . $version . " - " . $query;
11 $fields = array(
12 'firstName' => $current_user->user_firstname,
13 'lastName' => $current_user->user_lastname,
14 'company' => site_url(),
15 'email' => $email,
16 'ccEmail' => 'oauthsupport@xecurify.com',
17 'phone' => $phone,
18 'query' => $query
19 );
20 $field_string = json_encode( $fields );
21
22 $url = 'https://login.xecurify.com/moas/rest/customer/contact-us';
23
24 $headers = array(
25 'Content-Type' => 'application/json',
26 'charset' => 'UTF - 8',
27 'Authorization' => 'Basic'
28 );
29 $args = array(
30 'method' =>'POST',
31 'body' => $field_string,
32 'timeout' => '5',
33 'redirection' => '5',
34 'httpversion' => '1.0',
35 'blocking' => true,
36 'headers' => $headers,
37 );
38
39 $response = wp_remote_post( $url, $args );
40 if ( is_wp_error( $response ) ) {
41 $error_message = $response->get_error_message();
42 echo "Something went wrong: $error_message";
43 exit();
44 }
45
46 return true;
47 }
48
49 function mo_firebase_auth_send_email_alert( $email, $message, $subject ) {
50
51 if( ! $this->check_internet_connection() )
52 return;
53
54 $url = get_option( 'host_name' ) . '/moas/api/notify/send';
55 $customerKey = $this->defaultCustomerKey;
56 $apiKey = $this->defaultApiKey;
57 $currentTimeInMillis = self::get_timestamp();
58 $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
59 $hashValue = hash("sha512", $stringToHash);
60 $customerKeyHeader = "Customer-Key: " . $customerKey;
61 $timestampHeader = "Timestamp: " . $currentTimeInMillis;
62 $authorizationHeader = "Authorization: " . $hashValue;
63 $fromEmail = $email;
64 $subject = "Feedback: WP Firebase Authentication Plugin";
65 $site_url = site_url();
66
67 global $user;
68 $user = wp_get_current_user();
69 $query = '[WP Firebase Authentication] : ' . $message;
70
71 $content = '<div >Hello, <br><br>First Name :'.$user->user_firstname.'<br><br>Last Name :'.$user->user_lastname.' <br><br>Company :<a href="'.$site_url.'" target="_blank" >'.$site_url.'</a><br><br>Email :<a href="mailto:'.$fromEmail.'" target="_blank">'.$fromEmail.'</a><br><br>Query :'.$query.'</div>';
72
73 $fields = array(
74 'customerKey' => $customerKey,
75 'sendEmail' => true,
76 'email' => array(
77 'customerKey' => $customerKey,
78 'fromEmail' => $fromEmail,
79 'bccEmail' => 'oauthsupport@xecurify.com',
80 'fromName' => 'miniOrange',
81 'toEmail' => 'oauthsupport@xecurify.com',
82 'toName' => 'oauthsupport@xecurify.com',
83 'subject' => $subject,
84 'content' => $content
85 ),
86 );
87 $field_string = json_encode($fields);
88 $headers = array( 'Content-Type' => 'application/json');
89 $headers['Customer-Key'] = $customerKey;
90 $headers['Timestamp'] = $currentTimeInMillis;
91 $headers['Authorization'] = $hashValue;
92
93 $args = array(
94 'method' =>'POST',
95 'body' => $field_string,
96 'timeout' => '5',
97 'redirection' => '5',
98 'httpversion' => '1.0',
99 'blocking' => true,
100 'headers' => $headers,
101 );
102
103 $response = wp_remote_post( $url, $args );
104
105 if ( is_wp_error( $response ) ) {
106 $error_message = $response->get_error_message();
107 echo "Something went wrong: $error_message";
108 exit();
109 }
110 }
111 function check_internet_connection() {
112 return (bool) @fsockopen('login.xecurify.com', 443, $iErrno, $sErrStr, 5);
113 }
114
115 public function get_timestamp() {
116 $url = get_option ( 'host_name' ) . '/moas/rest/mobile/get-timestamp';
117 $headers = array( 'Content-Type' => 'application/json', 'charset' => 'UTF - 8', 'Authorization' => 'Basic' );
118 $args = array(
119 'method' =>'POST',
120 'body' => array(),
121 'timeout' => '5',
122 'redirection' => '5',
123 'httpversion' => '1.0',
124 'blocking' => true,
125 'headers' => $headers,
126 );
127
128 $response = wp_remote_post( $url, $args );
129 if ( is_wp_error( $response ) ) {
130 $error_message = $response->get_error_message();
131 echo "Something went wrong: $error_message";
132 exit();
133 }
134
135 return wp_remote_retrieve_body($response);
136 }
137 }
138 ?>