<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.7.0
 *	LISENSE: FL4HLD2A8696 - https://www.flynax.com/flynax-software-eula.html
 *	PRODUCT: Real Estate Agency
 *	DOMAIN : immofil.com
 *	FILE   : MASSMAILER_NEWSLETTER_SAVE.PHP
 *
 *	This script is a commercial software and any kind of using it must be
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2019
 *	https://www.flynax.com
 *
 ******************************************************************************/

/* system config */
require_once '../../../includes/config.inc.php';
require_once RL_ADMIN_CONTROL . 'ext_header.inc.php';
require_once RL_LIBS . 'system.lib.php';

$reefless->loadClass('Mail');
$reefless->loadClass('Actions');
$reefless->loadClass('Json');

$accounts_type = $_COOKIE['site_accounts'];
$update_data = array(
    'fields' => array(
        'From' => $_GET['from'],
        'Status' => $_GET['status'],
        'Date' => 'NOW()',
        'Subject' => trim($_GET['title']),
        'Body' => trim($_GET['body']),
        'Recipients_newsletter' => $_GET['newsletter_accounts'] ? 1 : 0,
        'Recipients_accounts' => $accounts_type,
        'Recipients_contact_us' => $_GET['contact_us_accounts'] ? 1 : 0,
    ),
    'where' => array('Key' => $_GET['key']),
);
$action = $rlActions->updateOne($update_data, 'massmailer');

if ($action) {
    echo $rlJson->encode(true);
} else {
    echo $rlJson->encode(false);
}
