コード例 #1
0
ファイル: func.php プロジェクト: ambient-lounge/site
function fn_unisender_subscribe($user_data, $list_id, $activated = false)
{
    $api_key = Registry::get('addons.rus_unisender.api_key');
    if (!empty($api_key) && !empty($user_data['email'])) {
        $ip = fn_get_ip();
        $user_field = fn_unisender_get_user_fields();
        $post = array('api_key' => $api_key, 'fields' => fn_uniseder_get_fields($user_data, $user_field), 'request_ip' => $ip['host'], 'request_time' => date('Y-m-d H:m:s', TIME), 'overwrite' => 2, 'double_optin' => '0', 'list_ids' => $list_id);
        if ($activated) {
            $post['double_optin'] = 3;
        }
        if (fn_unisender_api('subscribe', $post, $response)) {
            $data = array('subscriber_id' => fn_unisender_get_subscriber_id($user_data['email'], true), 'list_id' => $list_id);
            db_query("REPLACE INTO ?:unisender_user_mailing_lists ?e", $data);
            return true;
        }
    }
    return false;
}
コード例 #2
0
ファイル: profiles.post.php プロジェクト: ambient-lounge/site
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
// rus_build_unisender
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if ($mode == 'update') {
        $email = $_REQUEST['user_data']['email'];
        $subscriber_id = fn_unisender_get_subscriber_id($email);
        if (!empty($auth['user_id'])) {
            $_REQUEST['user_data']['user_id'] = $auth['user_id'];
        }
        if (!empty($_REQUEST['unisender_lists']) && !fn_is_empty($_REQUEST['unisender_lists'])) {
            if (empty($subscriber_id)) {
                $subscriber_id = fn_unisender_add_subscriber($email);
            }
            fn_unisender_subscribe($_REQUEST['user_data'], reset($_REQUEST['unisender_lists']), true);
        } else {
            if (!empty($subscriber_id)) {
                fn_unisender_unsubscribe($subscriber_id);
            }
        }
    }
}
コード例 #3
0
ファイル: checkout.pre.php プロジェクト: ambient-lounge/site
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if ($mode == 'place_order' || $mode == 'subscribe_unisender_customer') {
        $user_data = $_SESSION['cart']['user_data'];
        $subscriber_id = fn_unisender_get_subscriber_id($user_data['email']);
        if (!empty($_REQUEST['unisender_lists']) && !fn_is_empty($_REQUEST['unisender_lists'])) {
            if (empty($subscriber_id)) {
                $subscriber_id = fn_unisender_add_subscriber($user_data['email']);
            }
            fn_unisender_subscribe($user_data, reset($_REQUEST['unisender_lists']), true);
        } else {
            if (!empty($subscriber_id)) {
                fn_unisender_unsubscribe($subscriber_id);
            }
        }
        if ($mode == 'subscribe_unisender_customer') {
            return array(CONTROLLER_STATUS_REDIRECT, 'checkout.checkout');
        }
    }
}