*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/**
* \file htdocs/core/ajax/mailtemplate.php
* \ingroup core
* \brief File to return Ajax response on location_incoterms request
*/
// Just for display errors in editor
ini_set('display_errors', 1);
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
require_once '../../main.inc.php';
require_once '../lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
/*
* View
*/
top_httphead();
// TODO Replace with ID of template
if (GETPOSTISSET('content')) {
$content = filter_input(INPUT_POST, 'content', FILTER_UNSAFE_RAW);
$selectedPostsStr = GETPOST('selectedPosts', 'alpha');
$selectedPosts = explode(',', $selectedPostsStr);
if (is_array($selectedPosts) && !empty($selectedPosts)) {
$newsList = '';
foreach ($selectedPosts as $postId) {
$post = getNewsDetailsById($postId);
$newsList .= '
' . htmlentities($post['title']) . '
' . htmlentities($post['description']) . '
Created By: ' . htmlentities($post['user_fullname']) . '
' . dol_print_date($post['date_creation'], 'daytext', 'tzserver', $langs) . '
' . ($post['image'] ? '
 . ')
' : '

') . '
';
}
$content = str_replace('__NEWS_LIST__', $newsList, $content);
} else {
$content = str_replace('__NEWS_LIST__', 'No articles selected', $content);
}
print $content;
} else {
print 'No content provided or invalid token';
}