Exemplo n.º 1
0
                }
            }
        }
        if ($is_update) {
            update_option('brainstrom_products', $brainstrom_products);
        }
        //new Ultimate_Auto_Update(ULTIMATE_VERSION, 'http://ec2-54-183-173-184.us-west-1.compute.amazonaws.com/updates/?'.time(), 'Ultimate_VC_Addons/Ultimate_VC_Addons.php');
    }
}
if (!defined('BSF_CHECK_PRODUCT_UPDATES')) {
    $BSF_CHECK_PRODUCT_UPDATES = true;
} else {
    $BSF_CHECK_PRODUCT_UPDATES = BSF_CHECK_PRODUCT_UPDATES;
}
if (false === get_transient('bsf_check_product_updates') && ($BSF_CHECK_PRODUCT_UPDATES === true || $BSF_CHECK_PRODUCT_UPDATES === 'true')) {
    bsf_check_product_update();
    set_transient('bsf_check_product_updates', true, 2 * 24 * 60 * 60);
}
if (!function_exists('get_bsf_product_upgrade_link')) {
    function get_bsf_product_upgrade_link($product)
    {
        $brainstrom_products = get_option('brainstrom_products') ? get_option('brainstrom_products') : array();
        $mix = $bsf_product_plugins = $bsf_product_themes = $registered = array();
        if (!empty($brainstrom_products)) {
            $bsf_product_plugins = isset($brainstrom_products['plugins']) ? $brainstrom_products['plugins'] : array();
            $bsf_product_themes = isset($brainstrom_products['themes']) ? $brainstrom_products['themes'] : array();
        }
        $mix = array_merge($bsf_product_plugins, $bsf_product_themes);
        $status = isset($product['status']) ? $product['status'] : '';
        $name = isset($product['bundled']) && $product['bundled'] ? $product['name'] : $product['product_name'];
        $free = isset($product['is_product_free']) && ($product['is_product_free'] == true || $product['is_product_free'] == 'true') ? $product['is_product_free'] : 'false';
Exemplo n.º 2
0
 function bsf_register_user_callback()
 {
     global $bsf_product_validate_url;
     $brainstrom_users = get_option('brainstrom_users') ? get_option('brainstrom_users') : array();
     $bsf_username = isset($_POST['bsf_username']) ? $_POST['bsf_username'] : '';
     $bsf_useremail = isset($_POST['bsf_useremail']) ? $_POST['bsf_useremail'] : '';
     $bsf_useremail_reenter = isset($_POST['bsf_useremail_reenter']) ? $_POST['bsf_useremail_reenter'] : '';
     $subscribe = isset($_POST['ultimate_user_receive']) ? $_POST['ultimate_user_receive'] : '';
     $token = bsf_generate_rand_token();
     if ($bsf_useremail !== $bsf_useremail_reenter) {
         $response['response'] = array('title' => 'Error', 'message_html' => 'Email address did not matched');
         $response['proceed'] = false;
         echo json_encode($response);
         wp_die();
     }
     $domain = substr(strrchr($bsf_useremail, "@"), 1);
     if ($domain === '' || $domain === false) {
         $domain = $bsf_useremail;
     }
     if (function_exists('checkdnsrr')) {
         $dns_check = checkdnsrr($domain, 'MX');
         if (!$dns_check) {
             $response['response'] = array('title' => 'Error', 'message_html' => 'Please enter valid email address, username and password will sent to your provided email address');
             $response['proceed'] = false;
             echo json_encode($response);
             wp_die();
         }
     }
     $path = $bsf_product_validate_url;
     $data = array('action' => 'bsf_user_registration', 'bsf_username' => $bsf_username, 'bsf_useremail' => $bsf_useremail, 'bsf_useremail_confirm' => $bsf_useremail_reenter, 'ultimate_user_receive' => $subscribe, 'site_url' => get_site_url(), 'token' => $token);
     $request = @wp_remote_post($path, array('body' => $data, 'timeout' => '60', 'sslverify' => false));
     if (!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
         $result = json_decode($request['body']);
         if (isset($result->proceed) && ($result->proceed === 'true' || $result->proceed === true)) {
             $user_array = array('name' => $bsf_username, 'email' => $bsf_useremail, 'token' => $token);
             if (!empty($brainstrom_users)) {
                 $find_key = false;
                 foreach ($brainstrom_users as $key => $user) {
                     if ($user['email'] === $bsf_useremail) {
                         $brainstrom_users[$key]['name'] = $bsf_username;
                         $brainstrom_users[$key]['token'] = $token;
                         $find_key = true;
                         break;
                     }
                 }
                 if (!$find_key) {
                     array_push($brainstrom_users, $user_array);
                 }
             } else {
                 array_push($brainstrom_users, $user_array);
             }
             update_option('brainstrom_users', $brainstrom_users);
             bsf_check_product_update();
         }
         echo json_encode($result);
     } else {
         $arr = array('response' => $request->get_error_message());
         echo json_encode($arr);
     }
     wp_die();
 }