| Server IP : 141.193.213.11 / Your IP : 216.73.216.101 Web Server : nginx System : Linux pod-400555 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64 User : fpm200079 ( 200079) PHP Version : 8.2.36 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nas/content/live/bartislaw/wp-content/plugins/speak-api/inc/ |
Upload File : |
<?php
include_once 'config.php';
include_once 'SpeakApiCheck.php';
include_once 'gump.class.php';
/* ............................................................................ */
$isValid = GUMP::is_valid($_POST, array(
'first-name' => 'required',
'last-name' => 'required',
'daytime-phone' => 'required',
'email' => 'required',
'seminar-location' => 'required',
'seminar-date' => 'required',
));
if ($isValid === true) {
//InsertData_cForm($_POST);
$Get_Result = SendCurl_cForm($_POST);
SendMailUser($_POST);
if ($Get_Result) {
$result = array(
'result' => 'success',
'msg' => array('')
);
wp_send_json($result);
// echo json_encode($result);
} else {
$result = array(
'result' => 'error',
'msg' => array('ApiKey Not Active')
);
wp_send_json($result);
//echo json_encode($result);
}
} else {
$result = array(
'result' => 'error',
'msg' => $isValid
);
wp_send_json($result);
//echo json_encode($result);
}
/* ............................................................................................... */
function checkurl($string_value) {
$var = '/((?:https?\:\/\/|www\.)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)/i';
$var1 = '/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/';
$words = array('.com', '.org', '.in', '.pk', '.eu', '.net', '.my', '.edu', '.info', '.biz', '.pro', '.jobs', '.cc');
$matches_words = 0;
foreach ($words as $word) {
if (strpos($string_value, $word) !== false) {
$matches_words = 1;
}
}
if ($matches_words == '1') {
return TRUE;
}
preg_match($var1, $string_value, $matches);
preg_match($var, $string_value, $matchess);
if (count($matches) == 0 && count($matchess) == 0) {
return FALSE;
} else {
return TRUE;
}
}
/* ........................................................................................ */
function SendCurl_cForm($Data_Array) {
$ApiKey = Get_ApiKey();
$Array_Post['speak_api_key'] = $ApiKey;
$Status_ApiKey = SpeakApiCheck::CheckAPIKey($Array_Post);
$Check_ApiOptions = Get_ApiOptions();
$Data_Api_Array = explode(',', $Check_ApiOptions);
if ($Status_ApiKey) {
$Url_Web = trim(get_bloginfo('url'));
$lead_data2['body'] = stripslashes(buildBody($Data_Array));
$lead_data2['from'] = $Url_Web;
$lead_data2['subject'] = "A user signup for one of the seminar on your website";
$lead_data2['smartsheet'] = "1";
$lead_data2['name'] = $Data_Array['first-name'];
$lead_data2['email'] = $Data_Array['email'];
$lead_data2['phone'] = $Data_Array['daytime-phone'];
$lead_data2['sendUserCC'] = ($Data_Array['cbContactCopy']) ? TRUE : FALSE;
$lead_data2['type'] = 'CF';
$lead_data2['url'] = $Url_Web;
$lead_data2['api_key'] = Get_ApiKey();
$lead_data2['admin_name'] = get_bloginfo('name');
$curl_options = array(
CURLOPT_URL => "http://api.speakeasymarketinginc.com/send-email-direct",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS =>
http_build_query($lead_data2),
CURLOPT_HTTP_VERSION => 1.0,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10
);
$curl = curl_init();
curl_setopt_array($curl, $curl_options);
$result = curl_exec($curl);
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($result == 'yes') {
return TRUE;
} else {
return FALSE;
}
} else {
return send_by_mailer($Data_Array);
}
}
/* ........................................................................................ */
function buildBody($Data_Array) {
$Url_Web = trim(get_bloginfo('url'));
$ip = getClientIP();
$body = '<h2>A Lead Just Came In From ' . $Data_Array["opn-url"] . '</h2>';
$body .= '<p><b>Seminar Title: </b> ' . $Data_Array["opn-title"] . '</p>';
$body .= '<p><b>Seminar Date: </b> ' . $Data_Array["opn-date"] . '</p><br>';
$body .= '<p><b>First Name: </b> ' . $Data_Array["first-name"] . '</p>';
$body .= '<p><b>Last Name: </b> ' . $Data_Array["last-name"] . '</p>';
$body .= '<p><b>Daytime Phone: </b> ' . $Data_Array["daytime-phone"] . '</p>';
$body .= '<p><b>Email: </b> ' . $Data_Array["email"] . '</p>';
$body .= '<p><b>Seminar Location: </b> ' . $Data_Array["seminar-location"] . '</p>';
$body .= '<p><b>Seminar Date: </b> ' . $Data_Array["seminar-date"] . '</p>';
$body .= '<p style="color: #fff;"> <br> <br> <br>' . $ip . '</p>';
return $body;
}
/* ................Get Curent Date.................... */
function mysqlNow() {
return date('Y:m:d H:i:s');
}
function send_by_mailer($Data_Array) {
include_once('PHPMailer/PHPMailerAutoload.php');
$site_url = substr(get_bloginfo('url'), 7);
$reply_to = $Data_Array['email'];
$Get_Email_Data = get_option("SpeakApiCBAlerts");
$body = buildBody($Data_Array);
// Submit Mail
$mail = new PHPMailer;
//$mail->SMTPDebug = 0;
$mail->AddReplyTo($reply_to);
$Email_array = $Get_Email_Data['c_email_address'];
$email_array = explode(',', $Email_array);
for ($i = 0; $i < sizeof($email_array); $i++) {
$mail->addAddress($email_array[$i]);
}
$mail->SetFrom($Get_Email_Data['ex_email_from'], $site_url);
$mail->Subject = "A user signup for one of the seminar on your website";
$mail->isHTML(true);
$mail->Body = $body;
if ($mail->send()) {
return TRUE;
} else {
return FALSE;
}
}
function buildBodyuser($Data_Array) {
$body .= '<p>Hi ' . $Data_Array["first-name"] . $Data_Array["last-name"] . '</p><br>';
$body .= '<p>Here are the details for the Seminar.</p>';
$body .= '<p><b>Seminar Location: </b> ' . $Data_Array["seminar-location"] . '</p>';
$body .= '<p><b>Seminar Date & Time: </b> ' . $Data_Array["seminar-date"] . '</p>';
$body .= '<p><b>See you at event.</b></p><br>';
$body .= '<p>Thanks,</p>';
$body .= '<p>Seminar Support Team</p>';
$body .= '<p>Law Offices of Boyd & Boyd, P.C</p>';
return $body;
}
//-----------------------------------------
function SendMailUser($Data_Array) {
/* ...................................................... */
require_once 'PHPMailer/class.phpmailer.php';
$mails = new PHPMailer;
/* ...................................................... */
$ip_address = getClientIP();
// $mails->From = 'no-reply@speakeasymarketinginc.com';
$mails->FromName = 'Seminar Registration';
$mails->addAddress($_POST['email']);
$mails->addReplyTo("seolawyers2012@gmail.com");
$mails->WordWrap = 50;
$mails->isHTML(true);
$mails->Subject = 'Thank you for signing up for a Seminar (' . $Data_Array["opn-title"] . ')';
$mails->Body = buildBodyuser($Data_Array);
//Mail it
$res = $mails->send();
if ($res) {
return TRUE;
} else {
echo 'Mailer Error: ' . $mails->ErrorInfo;
}
$mails->ClearAllRecipients();
}
function getClientIP() {
if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
return $_SERVER["HTTP_X_FORWARDED_FOR"];
if (isset($_SERVER["HTTP_CLIENT_IP"]))
return $_SERVER["HTTP_CLIENT_IP"];
return $_SERVER["REMOTE_ADDR"];
}
if (getenv('HTTP_X_FORWARDED_FOR'))
return getenv('HTTP_X_FORWARDED_FOR');
if (getenv('HTTP_CLIENT_IP'))
return getenv('HTTP_CLIENT_IP');
return getenv('REMOTE_ADDR');
}