14 define(
'IN_PEEL_ADMIN',
true);
15 include(
"../configuration.inc.php");
26 if (!empty($_GET[
'id'])) {
27 if (isset($_POST[
'form_name'], $_POST[
'form_subject'], $_POST[
'form_text'])) {
32 if (empty($_POST[
'form_text'])) {
39 $_POST[
'form_text'] = str_replace(array(
"\n"),
"<br />\n", str_replace(array(
"\r\n",
"\r"),
"\n", $_POST[
'form_text']));
41 $_POST[
'form_text'] =
String::getCleanHTML($_POST[
'form_text'], null,
true,
true,
true, null,
false);
42 if (!empty($added_br)) {
43 $_POST[
'form_text'] = str_replace(array(
"<br />\n"),
"\n", $_POST[
'form_text']);
51 $action =
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_ERR_FILL_IN_ALL']))->fetch();
55 query(
'UPDATE peel_email_template SET
56 site_id="' . intval(
vn($_POST[
'site_id'])) .
'",
61 id_cat="' .intval($_POST[
'form_id_cat']) .
'",
64 WHERE id="' . intval($_GET[
'id']) .
'"');
65 $action =
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' =>
$GLOBALS[
"STR_ADMIN_EMAIL_TEMPLATES_MSG_UPDATED"]))->fetch();
69 $query_update =
query(
'SELECT id, technical_code, name, subject, text, lang, id_cat, default_signature_code, site_id
70 FROM peel_email_template
71 WHERE id="' . intval($_GET[
'id']) .
'" AND ' .
get_filter_site_cond(
'email_template', null,
true) .
'
75 $sql =
'SELECT id, name_' .
$_SESSION[
'session_langue'] .
' AS name, site_id
76 FROM peel_email_template_cat
80 $tpl_categories_list =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_categories_list.tpl');
81 $tpl_categories_list->assign(
'STR_CHOOSE',
$GLOBALS[
'STR_CHOOSE']);
83 while ($row_categories =
fetch_assoc($result_categories)) {
84 $tpl_options[] = array(
'value' => intval($row_categories[
'id']),
85 'issel' =>
vb($_POST[
'form_id_cat']) == $row_categories[
'id'] || $row_categories[
'id'] == $template_infos[
'id_cat'],
86 'name' =>
get_site_info($row_categories) . $row_categories[
'name']
90 $categories_list = $tpl_categories_list->fetch();
92 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_output.tpl');
94 $tpl->assign(
'href',
$GLOBALS[
'administrer_url'] .
'/email-templates.php');
95 $tpl->assign(
'id', $_GET[
'id']);
96 $tpl->assign(
'action',
$GLOBALS[
'administrer_url'] .
'/email-templates.php?id=' . $_GET[
'id']);
98 $tpl->assign(
'categories_list', $categories_list);
99 $tpl->assign(
'technical_code', (isset($_POST[
'form_technical_code']) ? $_POST[
'form_technical_code'] :
vb($template_infos[
'technical_code'])));
100 $tpl->assign(
'name', (isset($_POST[
'form_name']) ? $_POST[
'form_name'] :
vb($template_infos[
'name'])));
101 $tpl->assign(
'subject',
vb($template_infos[
'subject']));
102 $tpl->assign(
'text',
vb($template_infos[
'text']));
103 $tpl->assign(
'signature_template_options',
get_email_template_options(
'technical_code', null,
vb($template_infos[
'lang']),
vb($template_infos[
'default_signature_code']),
true));
106 $langs_array =
$GLOBALS[
'admin_lang_codes'];
107 if (!empty($template_infos[
'lang']) && !in_array($template_infos[
'lang'],
$GLOBALS[
'admin_lang_codes'])) {
108 $langs_array[] = $template_infos[
'lang'];
110 foreach ($langs_array as $lng) {
112 'issel' =>
vb($template_infos[
'lang']) == $lng
118 $tpl->assign(
'STR_ADMIN_WEBSITE',
$GLOBALS[
'STR_ADMIN_WEBSITE']);
119 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
122 $tpl->assign(
'STR_CLICK_HERE',
$GLOBALS[
'STR_CLICK_HERE']);
124 $tpl->assign(
'STR_ADMIN_SUBJECT',
$GLOBALS[
'STR_ADMIN_SUBJECT']);
125 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_UPDATE_TEMPLATE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_UPDATE_TEMPLATE']);
126 $tpl->assign(
'STR_ADMIN_LANGUAGE',
$GLOBALS[
'STR_ADMIN_LANGUAGE']);
127 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_INSERT_TEMPLATE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_INSERT_TEMPLATE']);
128 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_TABLE_EXPLAIN',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_TABLE_EXPLAIN']);
129 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TEMPLATE_NAME',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TEMPLATE_NAME']);
130 $tpl->assign(
'STR_ADMIN_TECHNICAL_CODE',
$GLOBALS[
'STR_ADMIN_TECHNICAL_CODE']);
131 $tpl->assign(
'STR_SIGNATURE',
$GLOBALS[
'STR_SIGNATURE']);
132 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_WARNING',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_WARNING']);
136 if (isset($_POST[
'form_name'], $_POST[
'form_subject'], $_POST[
'form_text'], $_POST[
'form_lang']) && empty($_GET[
'id'])) {
137 if (empty($_POST[
'form_name']) || empty($_POST[
'form_subject']) || empty($_POST[
'form_text']) || empty($_POST[
'form_lang']) || $_POST[
'form_id_cat'] ==
"0") {
138 $action =
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_ERR_FILL_IN_ALL']))->fetch();
143 if (empty($_POST[
'form_subject'])) {
146 if (empty($_POST[
'form_text'])) {
150 query(
'INSERT INTO peel_email_template (site_id, technical_code, name, subject, text, lang, id_cat, default_signature_code ) VALUES(
157 "' . intval($_POST[
'form_id_cat']) .
'",
159 $action =
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' =>
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_MSG_TEMPLATE_CREATED']))->fetch();
163 if (empty($_GET[
'id'])) {
165 $result_categories =
query(
'SELECT id, name_' .
$_SESSION[
'session_langue'] .
' AS name, site_id
166 FROM peel_email_template_cat
169 $tpl_categories_list =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_categories_list.tpl');
170 $tpl_categories_list->assign(
'STR_CHOOSE',
$GLOBALS[
'STR_CHOOSE']);
172 while ($row_categories =
fetch_assoc($result_categories)) {
173 $tpl_options[] = array(
'value' => intval($row_categories[
'id']),
174 'issel' =>
vb($_POST[
'form_id_cat']) == $row_categories[
'id'],
175 'name' =>
get_site_info($row_categories) . $row_categories[
'name']
179 $categories_list = $tpl_categories_list->fetch();
181 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_output2.tpl');
184 $tpl->assign(
'categories_list', $categories_list);
185 $tpl->assign(
'form_technical_code',
vb($_POST[
'form_technical_code']));
186 $tpl->assign(
'form_name',
vb($_POST[
'form_name']));
187 $tpl->assign(
'form_subject',
vb($_POST[
'form_subject']));
188 $tpl->assign(
'form_text',
vb($_POST[
'form_text']));
190 $langs_array =
$GLOBALS[
'admin_lang_codes'];
191 if (!empty($_POST[
'form_lang']) && !in_array($_POST[
'form_lang'],
$GLOBALS[
'admin_lang_codes'])) {
192 $langs_array[] = $_POST[
'form_lang'];
194 foreach ($langs_array as $lng) {
196 'issel' =>
vb($_POST[
'form_lang']) == $lng
203 $tpl->assign(
'STR_ADMIN_WEBSITE',
$GLOBALS[
'STR_ADMIN_WEBSITE']);
204 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_INSERT_TEMPLATE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_INSERT_TEMPLATE']);
205 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_MSG_LAYOUT_EXPLAINATION',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_MSG_LAYOUT_EXPLAINATION']);
206 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_TABLE_EXPLAIN',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_TABLE_EXPLAIN']);
207 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_EXPLAIN',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_EXPLAIN']);
209 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
210 $tpl->assign(
'STR_ADMIN_TECHNICAL_CODE',
$GLOBALS[
'STR_ADMIN_TECHNICAL_CODE']);
211 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TEMPLATE_NAME',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TEMPLATE_NAME']);
212 $tpl->assign(
'STR_ADMIN_SUBJECT',
$GLOBALS[
'STR_ADMIN_SUBJECT']);
214 $tpl->assign(
'STR_SIGNATURE',
$GLOBALS[
'STR_SIGNATURE']);
215 $tpl->assign(
'STR_ADMIN_LANGUAGE',
$GLOBALS[
'STR_ADMIN_LANGUAGE']);
220 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_search.tpl');
225 FROM peel_email_template_cat tc
226 INNER JOIN peel_email_template t ON t.id_cat=tc.id AND t.active="TRUE" AND ' .
get_filter_site_cond(
'email_template',
't',
true) .
'
231 $tpl_options[] = array(
'value' => intval($row_categories[
'id']),
232 'issel' =>
vb($_GET[
'form_lang_template']) == $row_categories[
'id'],
233 'name' =>
get_site_info($row_categories) . $row_categories[
'name']
238 foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
241 'issel' =>
vb($_GET[
'form_lang_template']) == $lng
245 $tpl->assign(
'etat',
vb($_GET[
'etat']));
247 $tpl->assign(
'STR_ADMIN_LANGUAGE',
$GLOBALS[
'STR_ADMIN_LANGUAGE']);
250 $tpl->assign(
'STR_ADMIN_ACTIVATED',
$GLOBALS[
'STR_ADMIN_ACTIVATED']);
251 $tpl->assign(
'STR_ADMIN_DEACTIVATED',
$GLOBALS[
'STR_ADMIN_DEACTIVATED']);
253 $tpl->assign(
'STR_ADMIN_CHOOSE_SEARCH_CRITERIA',
$GLOBALS[
'STR_ADMIN_CHOOSE_SEARCH_CRITERIA']);
254 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
258 $sql =
'SELECT id, technical_code, name, subject, text, lang, active, id_cat, site_id
259 FROM peel_email_template
262 if (!empty($_GET[
'form_lang_template'])) {
265 if (empty($_GET[
'form_lang_template'])) {
268 if (!empty($_GET[
'form_id_cat'])) {
269 $sql .=
' AND id_cat = "' . intval($_GET[
'form_id_cat']) .
'"';
271 if (empty($_GET[
'form_id_cat'])) {
275 if (isset($_GET[
'etat']) && empty($_GET[
'etat'])) {
278 if (isset($_GET[
'etat']) && $_GET[
'etat'] ==
"1") {
279 $sql .=
' AND active = "TRUE"';
281 if (isset($_GET[
'etat']) && $_GET[
'etat'] ==
"0") {
282 $sql .=
' AND active = "FALSE"';
285 $sql .=
' ORDER BY technical_code ASC, lang ASC';
290 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_email-templates_report.tpl');
291 $tpl->assign(
'links_multipage',
$Links->GetMultipage());
293 $tpl_results = array();
299 if ($this_template[
'id_cat'] != 0) {
300 $result_category =
query(
'SELECT name_' .
$_SESSION[
'session_langue'] .
' AS name, site_id
301 FROM peel_email_template_cat
302 WHERE id=' . intval($this_template[
'id_cat']) .
' AND ' .
get_filter_site_cond(
'email_template_cat', null));
303 if($row_category =
fetch_assoc($result_category)) {
304 $category_name =
get_site_info($row_category) . $row_category[
'name'];
309 $tpl_results[] = array(
'tr_rollover' => tr_rollover(
$i,
true),
310 'id' => $this_template[
"id"],
312 'category_name' => $category_name,
313 'name' => $this_template[
"name"],
316 'lang' => $this_template[
"lang"],
317 'etat_onclick' =>
'change_status("email-templates", "' . $this_template[
'id'] .
'", this, "'.
$GLOBALS[
'administrer_url'] .
'")',
318 'etat_src' => $GLOBALS[
'administrer_url'] .
'/images/' . ($this_template[
"active"] !=
"TRUE" ?
'puce-blanche.gif' :
'puce-verte.gif'),
319 'edit_href' =>
'email-templates.php?id=' . $this_template[
'id'],
324 $tpl->assign(
'results', $tpl_results);
326 $tpl->assign(
'STR_ADMIN_WEBSITE',
$GLOBALS[
'STR_ADMIN_WEBSITE']);
327 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TITLE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TITLE']);
328 $tpl->assign(
'STR_ADMIN_TECHNICAL_CODE',
$GLOBALS[
'STR_ADMIN_TECHNICAL_CODE']);
329 $tpl->assign(
'STR_ADMIN_SUBJECT',
$GLOBALS[
'STR_ADMIN_SUBJECT']);
330 $tpl->assign(
'STR_ADMIN_LANGUAGE',
$GLOBALS[
'STR_ADMIN_LANGUAGE']);
332 $tpl->assign(
'STR_ADMIN_ACTION',
$GLOBALS[
'STR_ADMIN_ACTION']);
335 $tpl->assign(
'STR_ADMIN_HTML_TEXT',
$GLOBALS[
'STR_ADMIN_HTML_TEXT']);
336 $tpl->assign(
'STR_ADMIN_NAME',
$GLOBALS[
'STR_ADMIN_NAME']);
341 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_haut.php");
343 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_bas.php");
352 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_emailLinksExplanations.tpl');
356 $this_wwwroot =
$GLOBALS[
'wwwroot'];
358 $tpl->assign(
'link', $this_wwwroot);
363 $tpl->assign(
'explication_tag_windows', get_explication_tag_windows(
true));
366 $tpl->assign(
'explication_tag_last_ads_verified', get_explication_tag_last_ads_verified(
true));
367 $tpl->assign(
'explication_tag_list_category_ads', get_explication_tag_list_category_ads(
true));
368 $tpl->assign(
'explication_tag_list_ads_by_category', get_explication_tag_list_ads_by_category(
true));
370 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_EXAMPLES_TITLE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_EXAMPLES_TITLE']);
371 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_EXPLAIN',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAGS_EXPLAIN']);
372 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
373 $tpl->assign(
'STR_ADMIN_WWWROOT',
$GLOBALS[
'STR_ADMIN_WWWROOT']);
374 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_SITE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_SITE']);
375 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_PHP_SELF',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_PHP_SELF']);
376 $tpl->assign(
'STR_ADMIN_REMOTE_ADDR',
$GLOBALS[
'STR_ADMIN_REMOTE_ADDR']);
377 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_DATETIME',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_DATETIME']);
378 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_NEWSLETTER',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_NEWSLETTER']);
379 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_LINK_EXPLAIN',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_LINK_EXPLAIN']);
380 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_LINK_EXAMPLE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_LINK_EXAMPLE']);
381 $tpl->assign(
'STR_ADMIN_EMAIL_TEMPLATES_TAG_OTHER_AVAILABLE',
$GLOBALS[
'STR_ADMIN_EMAIL_TEMPLATES_TAG_OTHER_AVAILABLE']);
382 return $tpl->fetch();
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id.
static strip_tags($string, $allowed_tags=null)
String::strip_tags()
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
static getCleanHTML($text, $max_width=null, $allow_form=false, $allow_object=false, $allow_class=false, $additional_config=null, $safe=true, $additional_elements=null, $max_caracters_length=50000, $max_octets_length=59000, $max_word_and_url_length=100)
Fonction qui nettoie le HTML.
emailLinksExplanations()
emailLinksExplanations()
get_site_id_select_options($selected_site_id=null, $selected_site_name=null, $display_first_option=null, $select_current_site_id_by_default=false)
Créer les options pour le select qui liste les noms de sites configurés en back office.
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
real_escape_string($value)
real_escape_string()
static str_shorten_words($string, $length_limit=100, $separator=" ", $force_shorten_if_special_content=false, $add_separator_instead_of_cutting=true)
On rajoute des espaces à l'intérieur des mots trop longs => à utiliser pour éviter de casser une mise...
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
fetch_assoc($query_result)
fetch_assoc()
if(!function_exists('affiche_liste_produits_acommander')) if(!function_exists('affiche_liste_articles')) get_email_template_options($option_id_nature= 'id', $category_id=null, $lang=null, $value_select=null, $get_signature=null)
Fonction affichant la liste d'emails sur le compte utilisateur.
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
get_site_wwwroot($site_id, $lang=null)
Renvoie l'URL d'un site donné
verify_token($name= 'general', $delay_in_minutes=60, $check_referer_if_set_by_server=true, $cancel_token=true, $minimum_wait_in_seconds_before_use=0)
Vérification de la validité d'un token Par défaut, un token est valide 1h, et utilisable 1 seule fois...
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
get_site_info($array)
get_site_info()
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']