403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /nas/content/live/bartislaw/wp-content/plugins/speak-api/inc/send-mail-newsletter.php
<?php

include_once 'config.php';
include_once 'SpeakApiCheck.php';
include_once 'gump.class.php';
include_once('PHPMailer/PHPMailerAutoload.php');
include_once 'AntiSpamValidator.php';
/* ............................................................................ */
$isValid = GUMP::is_valid($_POST, array(
    'name' => 'required|valid_name',
    'email' => 'required|valid_email'
)); // <--- CLOSE THIS LINE

// If form validation fails, return field errors
if ($isValid !== true) {
    $result = array(
        'result' => 'error',
        'msg' => $isValid
    );
    wp_send_json($result);
    exit;
}


// Initialize anti-spam validator
$anti_spam = new AntiSpamValidator();

// Validate form for spam (only if form fields are valid)
$spam_validation = $anti_spam->validate_form($_POST, 'newsletter');
if (!$spam_validation['result'] == 'success') {
    wp_send_json($spam_validation);
    exit;
}

// Form fields and anti-spam validation passed, proceed with submission
$result = SendCurl_Newsletter($_POST);
wp_send_json($result);

/* ........................................................................................ */
function SendCurl_Newsletter($Data_Array)
{
    $newsletter_options = get_option("SpeakApiNewsletter");
    $ApiKey = Get_ApiKey();
    $Array_Post['speak_api_key'] = $ApiKey;
    $Status_ApiKey = SpeakApiCheck::CheckAPIKey($Array_Post);

    if ($Status_ApiKey) {
        $Url_Web = trim(get_bloginfo('url'));
        $lead_data2['name'] = $Data_Array['name'];
        $lead_data2['email'] = $Data_Array['email'];
        $lead_data2['tags'] = $newsletter_options['n_tags'];
        $lead_data2['type'] = 'newsletter';
        $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/spk-nl-apply-tag",
            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);
    }

    // Send admin notification email
    $admin_status = send_admin_email($Data_Array);

    // Return status based on both operations
      if ($admin_status['result'] === 'success') {
        return array(
            'result' => 'success',
            'msg' => array("You've successfully subscribed. Thank You!")
        );
    } else {
        return array(
            'result' => 'error',
            'msg' => array("Subscription was recorded, but there was an issue sending notifications.")
        );
    }
}

function send_admin_email($Data_Array)
{
    $newsletter_options = get_option("SpeakApiNewsletter");
    $ApiKey = Get_ApiKey();
    $Array_Post['speak_api_key'] = $ApiKey;
    $Status_ApiKey = SpeakApiCheck::CheckAPIKey($Array_Post);

    if ($Status_ApiKey && !empty($newsletter_options['n_email_address'])) {
        $Url_Web = trim(get_bloginfo('url'));
        $admin_emails = $newsletter_options['n_email_address'];

        $lead_data = array(
            'name' => $Data_Array['name'],
            'email' => $Data_Array["email"],
            'url' => $Url_Web,
            'ip' => getClientIP(),
            'api_key' => $ApiKey
        );

        $curl_options = array(
            CURLOPT_URL => "http://api.speakeasymarketinginc.com/send-email-newsletter",
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => http_build_query($lead_data),
            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);
        curl_close($curl);

        if ($result != 'yes') {
            error_log("Failed to send admin notification to");
        }


        return array('result' => 'success');
    }
    return array('result' => 'error');
}

function buildBody($Data_Array)
{
    $Url_Web = trim(get_bloginfo('url'));
    $noptions = get_option("SpeakApiNewsletter");
    $ip = getClientIP();

    // Get template from options
    $body = $noptions["n_email_temp"];

    // Replace all placeholders with actual data
    $body = str_replace('[site_url]', $Url_Web, $body);
    $body = str_replace('[name]', $Data_Array["name"], $body);
    $body = str_replace('[email]', $Data_Array["email"], $body);
    $body = str_replace('[ip]', $ip, $body);

    return $body;
}

function BodyAlt($Data_Array)
{
    $noptions = get_option("SpeakApiNewsletter");

    // Get template
    $body = $noptions["n_email_user_temp"];

    // Replace placeholder with actual user name
    $body = str_replace('[username]', $Data_Array["name"], $body);

    return $body;
}

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');
}

Youez - 2016 - github.com/yon3zu
LinuXploit