PEEL Shopping
Open source ecommerce : PEEL Shopping
fonctions.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: fonctions.php 46961 2015-09-21 06:36:49Z sdelaporte $
14 if (!defined('IN_PEEL')) {
15  die();
16 }
17 
24 function webmail_hook_admin_menu_items($params) {
25  $result['menu_items']['users_sales'][$GLOBALS['wwwroot_in_admin'] . '/modules/webmail/administrer/webmail_send.php'] = $GLOBALS["STR_ADMIN_MENU_MANAGE_WEBMAIL_SEND"];
26  $result['menu_items']['users_sales'][$GLOBALS['wwwroot_in_admin'] . '/modules/webmail/administrer/list_mails_send.php'] = $GLOBALS["STR_ADMIN_MENU_MANAGE_SENT_EMAILS"];
27  $result['menu_items']['users_sales'][$GLOBALS['wwwroot_in_admin'] . '/modules/webmail/administrer/list_mails.php'] = $GLOBALS["STR_ADMIN_MENU_MANAGE_LIST_EMAILS"];
28  return $result;
29 }
30 
37 function webmail_hook_list_user_mail($params) {
38  $output = '';
39  // Requête d'emails à partir du site
40  $sql_formulaire = 'SELECT *
41  FROM peel_webmail
42  WHERE id_user="' . intval(vn($params['id_utilisateur'])) . '" AND ' . get_filter_site_cond('webmail', null, true) . '
43  ORDER BY date DESC, heure DESC';
44  $Links_formulaire = new Multipage($sql_formulaire, 'affiche_liste_mail_annonce', '*');
45  $HeaderTitlesArray = array($GLOBALS['STR_ADMIN_TITLE'], $GLOBALS['STR_MESSAGE'], $GLOBALS['STR_DATE'], $GLOBALS['STR_ADMIN_INFO']);
46  $Links_formulaire->HeaderTitlesArray = $HeaderTitlesArray;
47  $result_formulaire = $Links_formulaire->Query();
48 
49  $output .= '
50  <table class="full_width">
51  <tr>
52  <td class="entete" colspan="2">'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_LIST_IN_SITE_CONTACT_FORM'].'</td>
53  </tr>
54  <tr>
55  <td colspan="2">
56  <table id="tablesForm" style="width:100%;">
57  ' . $Links_formulaire->getHeaderRow();
58  $i = 0;
59  if (empty($result_formulaire)) {
60  $output .= '<tr><td colspan="4" class="center"><b>'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_NO_EMAIL_FOUND'].'</b></td></tr>';
61  } else {
62  foreach($result_formulaire as $formulaire) {
63  $output .= tr_rollover($i, true) . '
64  <td class="center">' . vb($formulaire['titre']) . '</td>
65  <td class="center">' . vb($formulaire['message']) . '</td>
66  <td class="center">' . vb($formulaire['date']) . ' ' . vb($formulaire['heure']) . '</td>
67  <td class="center">' . vb($formulaire['ip']) . '</td>
68  </tr>';
69  }
70  }
71  $output .= '
72  </table>
73  </td>
74  </tr>
75  <tr>
76  <td colspan="2">' . $Links_formulaire->GetMultipage() . '</td>
77  </tr>
78  </table>';
79  return $output;
80 }
81 
89 function affiche_form_send_mail($frm, $return_mode = false, &$form_error_object = null)
90 {
91  $output = '';
92  // Si $id_account existe, alors on envoie un email à un utilisateur connu.
93  if (!empty($frm['id_utilisateur'])) {
94  $q = 'SELECT *
95  FROM peel_utilisateurs
96  WHERE id_utilisateur ="' . intval(vn($frm['id_utilisateur'])) . '" AND ' . get_filter_site_cond('utilisateurs') . '';
97  $result = query($q);
98  $row_account = fetch_assoc($result);
99  $user_id = $row_account['id_utilisateur'];
100  $user_email = $row_account['email'];
101  $user_gender = $row_account['civilite'];
102  $user_name = $row_account['nom_famille'];
103  $user_first_name = $row_account['prenom'];
104  $user_login = $row_account['pseudo'];
105  $user_password = $row_account['mot_passe'];
106  } elseif (!empty($frm['id_webmail'])) {
107  // On répond à un email envoyé par un utilisateur
108  $q = query("SELECT *
109  FROM peel_webmail
110  WHERE id='" . intval(vn($frm['id_webmail'])) . "' AND " . get_filter_site_cond('webmail', null, true) . "");
111  $row_mail = fetch_assoc($q);
112  // on update ensuite pour marquer le email comme répondu
113  if ($row_mail['read'] == 'NO') {
114  query("UPDATE `peel_webmail`
115  SET `read` = 'READ'
116  WHERE `id`='" . intval($frm['id_webmail']) . "' AND " . get_filter_site_cond('webmail', null, true) . "");
117  }
118 
119  $user_id = $row_mail['id_user'];
120  $user_email = $row_mail['email'];
121  $user_name = $row_mail['nom'] ;
122  $user_first_name = $row_mail['prenom'] ;
123 
124  if (!empty($user_id)) {
125  // on récupère les infos persos dans la BDD si l'utilisateur était loggué
126  $q = query("SELECT *
127  FROM peel_utilisateurs
128  WHERE id_utilisateur='" . intval($user_id) . "' AND " . get_filter_site_cond('utilisateurs') . "") ;
129  $row_account = fetch_assoc($q);
130  $user_gender = $row_account['civilite'];
131  $user_login = $row_account['pseudo'];
132  $user_password = $row_account['mot_passe'];
133  }
134  } elseif (!empty($frm['user_ids'])) {
135  $q = 'SELECT email
136  FROM peel_utilisateurs
137  WHERE id_utilisateur IN("' . implode('","', real_escape_string($frm['user_ids'])) . '") AND ' . get_filter_site_cond('utilisateurs') . '';
138  $result = query($q);
139  while ($users_email = fetch_assoc($result)) {
140  $users_email_array[] = $users_email['email'];
141  }
142  $user_email = implode(';', $users_email_array);
143  }
144  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/webmailAdmin_form.tpl');
145  $GLOBALS['js_ready_content_array'][] = '
146  $("#signature_template_options").change(function () {
147  form_template_content_add("signature_template_options", "signature", "message", "' . $GLOBALS['wwwroot'] . '");
148  }).change();
149  $("#template").change(function () {
150  form_template_content_add("template", "message", "message", "' . $GLOBALS['wwwroot'] . '");
151  form_template_content_add("template", "subject", "title", "' . $GLOBALS['wwwroot'] . '");
152  form_template_content_add("template", "lang", "lang", "' . $GLOBALS['wwwroot'] . '");
153  }).change();
154 ';
155  if (!empty($frm['id_utilisateur'])) {
156  $tpl->assign('edit_href', $GLOBALS['administrer_url'] . '/utilisateurs.php?mode=modif&id_utilisateur=' . intval(vn($frm['id_utilisateur'])));
157  }
158  $tpl->assign('id_utilisateur', intval(vn($frm['id_utilisateur'])));
159  $tpl->assign('user_gender', vb($user_gender));
160  $tpl->assign('user_name', vb($user_name));
161  $tpl->assign('user_first_name', vb($user_first_name));
162  $tpl->assign('user_email', vb($user_email));
163  $tpl->assign('my_email', $_SESSION['session_utilisateur']['email']);
164 
165  if (!empty($frm['id_utilisateur'])) {
166  $tpl->assign('by_lang_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['id_cat'])?'id_cat=' . $_GET['id_cat'] . '&':'') . 'lang_mail=\'+lang_mail+\'&id_utilisateur=' . intval(vn($frm['id_utilisateur'])) . '\'');
167  $tpl->assign('ctl_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['lang_mail'])?'lang_mail=' . $_GET['lang_mail'] . '&':'') . 'id_cat=\'+cat_id+\'&id_utilisateur=' . intval(vn($frm['id_utilisateur'])) . '\'');
168  } elseif (!empty($frm['id_webmail'])) {
169  $tpl->assign('by_lang_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['id_cat'])?'id_cat=' . $_GET['id_cat'] . '&':'') . 'lang_mail=\'+lang_mail+\'&id_webmail=' . intval(vn($frm['id_webmail'])) . '\'');
170  $tpl->assign('ctl_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['lang_mail'])?'lang_mail=' . $_GET['lang_mail'] . '&':'') . 'id_cat=\'+cat_id+\'&id_webmail=' . intval(vn($frm['id_webmail'])) . '\'');
171  } elseif (!empty($frm['user_ids'])) {
172  $user_ids = '';
173  $i = 0;
174  foreach ($frm['user_ids'] as $user_id) {
175  $i++;
176  $user_ids .= '&user_ids[]=' . $user_id;
177  }
178  $tpl->assign('by_lang_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['id_cat'])?'id_cat=' . $_GET['id_cat'] . '&':'') . 'lang_mail=\'+lang_mail+\'' . $user_ids . '\'');
179  $tpl->assign('ctl_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['lang_mail'])?'lang_mail=' . $_GET['lang_mail'] . '&':'') . 'id_cat=\'+cat_id+\'' . $user_ids . '\'');
180  } else {
181  $tpl->assign('by_lang_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['id_cat'])?'id_cat=' . $_GET['id_cat'] . '&':'') . 'lang_mail=\'+lang_mail');
182  $tpl->assign('ctl_href', '\'' . get_current_url(false) . '?' . (!empty($_GET['email_all_hash'])?'email_all_hash=' . $_GET['email_all_hash'] . '&':'') . (!empty($_GET['lang_mail'])?'lang_mail=' . $_GET['lang_mail'] . '&':'') . 'id_cat=\'+cat_id');
183  }
184  if (!empty($row_mail)) {
185  $tpl->assign('row_mail', array(
186  'email' => $row_mail['email'],
187  'titre' => $row_mail['titre'],
188  'message' => $row_mail['message']
189  ));
190  }
191  $tpl->assign('action', get_current_url(true));
192  $tpl->assign('form_token', get_form_token_input($_SERVER['PHP_SELF']));
193  $tpl->assign('email_templates_href', $GLOBALS['administrer_url'] . '/email-templates.php');
194  $tpl->assign('email_templates_admin_href', $GLOBALS['administrer_url'] . '/administrer/email-templates.php');
195  $tpl_options = array();
196  $sql = 'SELECT tc.id, tc.name_' . $_SESSION['session_langue'] . ' AS name, tc.site_id
197  FROM peel_email_template_cat tc
198  INNER JOIN peel_email_template t ON t.id_cat=tc.id AND t.active="TRUE" AND ' . get_filter_site_cond('email_template', 't') . '
199  WHERE ' . get_filter_site_cond('email_template_cat', 'tc') . '
200  GROUP BY tc.id
201  ORDER BY name';
202  $result = query($sql);
203  while ($row_categories = fetch_assoc($result)) {
204  $tpl_options[] = array(
205  'value' => intval(vn($row_categories['id'])),
206  'issel' => !empty($frm['id_cat']) && $frm['id_cat'] == $row_categories['id'],
207  'name' => get_site_info($row_categories) . vb($row_categories['name'])
208  );
209  }
210  $tpl->assign('options', $tpl_options);
211  $tpl->assign('email_template_options', get_email_template_options('id', vn($frm['id_cat']), vb($frm['lang_mail'])));
212 
213  // Sélection de la signature par défaut (support_clientèle)
214  $q = query('SELECT id
215  FROM peel_email_template
216  WHERE ' . get_filter_site_cond('email_template', null) . ' AND lang="' . nohtml_real_escape_string(!empty($frm['lang_mail'])? $frm['lang_mail']:$_SESSION['session_langue']) . '" AND technical_code = "signature_support"');
217  if($default_signature = fetch_assoc($q)) {
218  $default_signature_id = $default_signature['id'];
219  } else {
220  // Il n'y a pas forcement de résultat pour la requête
221  $default_signature_id = null;
222  }
223 
224  $tpl->assign('signature_template_options', get_email_template_options('id', null, $frm['lang_mail'], $default_signature_id, true));
225  $langs_array = $GLOBALS['admin_lang_codes'];
226  foreach ($langs_array as $lng) {
227  $tpl_langs[] = array('lng' => $lng,
228  'issel' => !empty($frm['lang_mail']) && $frm['lang_mail'] == $lng
229  );
230  if(!empty($frm['lang_mail']) && $frm['lang_mail'] == $lng) {
231  $tpl->assign('selected_lang', $lng);
232  }
233  }
234  $tpl->assign('langs', $tpl_langs);
235  if (!empty($_GET['email_all_hash']) && !empty($_SESSION['count_from_send_email_all'][$_GET['email_all_hash']])) {
236  $tpl->assign('is_multidestinataire', true);
237  $tpl->assign('multidestinataire_txt', sprintf('%s destinataire(s) sélectionné(s)', $_SESSION['count_from_send_email_all'][$_GET['email_all_hash']]));
238  } elseif (empty($frm['id_utilisateur'])) {
239  $tpl->assign('is_multidestinataire', false);
240  $tpl->assign('is_destinataire', true);
241  $tpl->assign('destination_mail_error', (!empty($form_error_object) ? $form_error_object->text('destination_mail') : ''));
242  } else {
243  $tpl->assign('is_multidestinataire', false);
244  $tpl->assign('is_destinataire', false);
245  $tpl->assign('user_id', intval(vn($user_id)));
246  }
247  $tpl->assign('nom_famille', vb($_SESSION['session_utilisateur']['nom_famille']));
248  $tpl->assign('prenom', vb($_SESSION['session_utilisateur']['prenom']));
249  $tpl->assign('site', vb($GLOBALS['site']));
250  $tpl->assign('HTTP_HOST', $GLOBALS['_SERVER']['HTTP_HOST']);
251  $tpl->assign('sites_href', $GLOBALS['administrer_url'] . '/sites.php');
252  if((isset($_SESSION['request_from_send_email_all'][$_GET['email_all_hash']]))){
253  $tpl->assign('count_email_all_hash', $_SESSION['count_from_send_email_all'][$_GET['email_all_hash']]);
254  $tpl->assign('request_email_all_hash', $_SESSION['request_from_send_email_all'][$_GET['email_all_hash']]);
255  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SEND_EMAIL_TO_N_USERS', sprintf($GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SEND_EMAIL_TO_N_USERS'], $_SESSION['count_from_send_email_all'][$_GET['email_all_hash']]));
256  }
257  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
258  $tpl->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
259  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_CLIENT_INFORMATION', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_CLIENT_INFORMATION']);
260  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EDIT_USER', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EDIT_USER']);
261  $tpl->assign('STR_GENDER', $GLOBALS['STR_GENDER']);
262  $tpl->assign('STR_UNAVAILABLE', $GLOBALS['STR_UNAVAILABLE']);
263  $tpl->assign('STR_ADMIN_NAME', $GLOBALS['STR_ADMIN_NAME']);
264  $tpl->assign('STR_FIRST_NAME', $GLOBALS['STR_FIRST_NAME']);
265  $tpl->assign('STR_EMAIL', $GLOBALS['STR_EMAIL']);
266  $tpl->assign('STR_UNAVAILABLE', $GLOBALS['STR_UNAVAILABLE']);
267  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_ANSWER_EMAIL_SENT_BY', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_ANSWER_EMAIL_SENT_BY']);
268  $tpl->assign('STR_ADMIN_SUBJECT', $GLOBALS['STR_ADMIN_SUBJECT']);
269  $tpl->assign('STR_MESSAGE', $GLOBALS['STR_MESSAGE']);
270  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_ADD_NAME', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_ADD_NAME']);
271  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EMAIL_TEMPLATES', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EMAIL_TEMPLATES']);
272  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EXPLAIN_TEMPLATES', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EXPLAIN_TEMPLATES']);
273  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EXPLAIN_TAGS', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EXPLAIN_TAGS']);
274  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_CHOOSE_LANG', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_CHOOSE_LANG']);
275  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_CHOOSE_CATEGORY', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_CHOOSE_CATEGORY']);
276  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_CHOSSE_TEMPLATE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_CHOSSE_TEMPLATE']);
277  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_FORM_TITLE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_FORM_TITLE']);
278  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EMAIL_FIELD', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EMAIL_FIELD']);
279  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_RECIPIENTS', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_RECIPIENTS']);
280  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_RECIPIENT_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_RECIPIENT_EMAIL']);
281  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_RECIPIENT_EMAIL_EXPLAIN', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_RECIPIENT_EMAIL_EXPLAIN']);
282  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE']);
283  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_NONE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_NONE']);
284  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_UNDEFINED_SERVICE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_UNDEFINED_SERVICE']);
285  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_CLIENT_SERVICE', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_CLIENT_SERVICE']);
286  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_SALES', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_SALES']);
287  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_ACCOUNTING', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_ACCOUNTING']);
288  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_SEO', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_SEO']);
289  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_TECHNICAL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_TECHNICAL']);
290  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_COMMUNICATION', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_COMMUNICATION']);
291  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_MARKETING', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_MARKETING']);
292  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_DIRECTION', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_DIRECTION']);
293  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_EXTERNAL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SIGNATURE_EXTERNAL']);
294  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SENDER_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SENDER_EMAIL']);
295  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_WEBMASTER_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_WEBMASTER_EMAIL']);
296  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_ORDER_MANAGEMENT_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_ORDER_MANAGEMENT_EMAIL']);
297  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_CLIENT_SERVICE_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_CLIENT_SERVICE_EMAIL']);
298  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_EMAIL_EXPLAIN', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EMAIL_EXPLAIN']);
299  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_SEND_EMAIL', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_SEND_EMAIL']);
300  $output .= $tpl->fetch();
301 
302  if ($return_mode) {
303  return $output;
304  } elseif (!empty($output)) {
305  echo $output;
306  } else {
307  return false;
308  }
309 }
310 
318 {
319  $output = '';
320  $raison = '';
321  $custom_template_tags = array();
322  if (!empty($frm)) {
323  if (empty($frm['destination_mail']) && empty($_SESSION['count_from_send_email_all'][$_GET['email_all_hash']])) {
324  return $tplEngine->createTemplate('global_error.tpl', array('message' => $GLOBALS["STR_MODULE_WEBMAIL_ADMIN_ERR_SENT_NO_EMAIL"]))->fetch();
325  }
326  $mail_subject = vb($frm['subject']);
327  // Utilisation de \r\n. Ce sera transformé si nécessaire en <br /> par la fonction send_email
328  $mail_content = vb($frm['message']) . "\r\n" . vb($frm['signature']);
329  $template_id = vn($frm['template']);
330  if (!empty($frm['email_from']) && !empty($GLOBALS['site_parameters'][$frm['email_from']])) {
331  // On envoie à partir de l'email choisi parmi ceux configurés dans la gestion du site
332  $email_from = $GLOBALS['site_parameters'][$frm['email_from']];
333  } elseif(!empty($frm['email_from']) && $frm['email_from'] == 'my_email') {
334  // Utilisation de l'email du compte administrateur
335  $email_from = $_SESSION['session_utilisateur']['email'];
336  } else {
337  $email_from = $GLOBALS['site_parameters']['email_webmaster'];
338  }
339  if(!empty($template_id)) {
340  // Le texte tapé par l'administrateur est issu d'un modèle d'email
341  $this_data = 'template_' . vn($template_id);
342  // Donc on ne stocke pas le message réellement envoyé pour ne pas saturer la BDD
343  // (le message est issu d'un template, donc le contenu est proche du modèle original)
344  // NB : On pourrait faire des tests complémentaires en utilisant $template_infos = getTextAndTitleFromEmailTemplateLang(null, $frm['lang'], $template_id);
345  $this_comment = '';
346  } else {
347  $this_data = 'NO_TEMPLATE';
348  // On stocke le message car il n'est pas issu d'un template
349  $this_comment = $frm['message'];
350  }
351  if (!empty($frm['submit_send_email_all'])) {
352  // $custom_template_tags ne contient pas d'info utilisateur car on envoie à potentiellement N personnes
353  program_cron_email($_SESSION['request_from_send_email_all'][$_GET['email_all_hash']], $mail_content, $mail_subject, $_SESSION['session_utilisateur']['email'], null, $frm['lang'], $custom_template_tags);
354  $output .= $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS["STR_MODULE_WEBMAIL_ADMIN_MSG_WILL_SEND_BY_CRON_OK"]))->fetch();
355  unset($_SESSION['request_from_send_email_all'][$_GET['email_all_hash']]);
356  // on va envoyer plus tard par cron
357  $send_now = false;
358  tracert_history_admin(intval(vn($frm['id_utilisateur'])), 'SEND_EMAIL', $this_data, $this_comment, $raison, $_SESSION['count_from_send_email_all'][$_GET['email_all_hash']] . ' destinataires');
359  } else {
360  $destination_mail_array = explode(';', $frm['destination_mail']);
361  foreach($destination_mail_array as $this_destination_mail) {
362  // Récupération des données en fonction d'une adresse email pour les envois direct.
363  $sql = 'SELECT *
364  FROM peel_utilisateurs
365  WHERE email="' . nohtml_real_escape_string($this_destination_mail) . '" AND ' . get_filter_site_cond('utilisateurs') . '';
366  $result_user = query($sql);
367  $user_infos = fetch_assoc($result_user);
368  $user_template_tags = array();
369  if (!empty($user_infos)) {
370  $user_template_tags['CIVILITE'] = $user_infos['civilite'];
371  $user_template_tags['PRENOM'] = $user_infos['prenom'];
372  $user_template_tags['NOM_FAMILLE'] = $user_infos['nom_famille'];
373  $user_template_tags['PSEUDO'] = $user_infos['pseudo'];
374  $user_template_tags['SOCIETE'] = $user_infos['societe'];
375  $user_template_tags['TELEPHONE'] = $user_infos['telephone'];
376  $user_template_tags['EMAIL'] = $user_infos['email'];
377  if (count($destination_mail_array) == 1) {
378  // On va récupérer l'identité du seul utilisateur pour logguer l'action ci-dessous
379  $frm['id_utilisateur'] = $user_infos['id_utilisateur'];
380  }
381  }
382  $mail_sended = send_email($this_destination_mail, $mail_subject, $mail_content, $template_id, array_merge($custom_template_tags, $user_template_tags) , null, $email_from, true, false, true, $_SESSION['session_utilisateur']['email'], null);
383  if ($mail_sended) {
384  $output .= $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS['STR_MODULE_WEBMAIL_ADMIN_MSG_SENT_OK'], $this_destination_mail)))->fetch();
385  } else {
386  $output .= $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => sprintf($GLOBALS['STR_MODULE_WEBMAIL_ADMIN_ERR_SENT'], $this_destination_mail)))->fetch();
387  }
388  }
389  tracert_history_admin(intval(vn($frm['id_utilisateur'])), 'SEND_EMAIL', $this_data, $this_comment, $raison, $frm['destination_mail']);
390  }
391  }
392  return $output;
393 }
394 
402 function affiche_list_send_mail($recherche, $return_mode = false)
403 {
404  $output = '';
405  $sql_cond = array();
406  if (!empty($recherche)) {
407  if (!empty($recherche['date'])) {
408  $sql_cond[] = 'AND ac.date LIKE "' . nohtml_real_escape_string(get_mysql_date_from_user_input(vb($recherche['date']))) . '%"';
409  }
410  if (!empty($recherche['admin'])) {
411  $sql_cond[] = 'AND ac.id_user = "' . nohtml_real_escape_string(vb($recherche['admin'])) . '"';
412  }
413  if (!empty($recherche['template'])) {
414  $sql_cond[] = 'AND ac.data LIKE "%' . nohtml_real_escape_string(vb($recherche['template'])) . '%"';
415  }
416  }
417  $sql = 'SELECT ac.*, u_admins.nom_famille AS admin_nom, u_admins.prenom AS admin_prenom, u_users.nom_famille AS user_nom, u_users.prenom AS user_prenom, u_users.pseudo AS user_login
418  FROM peel_admins_actions ac
419  INNER JOIN peel_utilisateurs u_admins ON u_admins.id_utilisateur = ac.id_user AND ' . get_filter_site_cond('utilisateurs', 'u_admins') . '
420  LEFT JOIN peel_utilisateurs u_users ON u_users.id_utilisateur = ac.id_membre AND ' . get_filter_site_cond('utilisateurs', 'u_users') . '
421  WHERE ac.action="SEND_EMAIL" ' . (!empty($sql_cond)? implode(' ', $sql_cond):'') . ' AND ' . get_filter_site_cond('admins_actions', 'ac') . '
422  ORDER BY ac.date DESC';
423  $Links = new Multipage($sql, 'affiche_liste_send_email');
424  $HeaderTitlesArray = array($GLOBALS["STR_ADMIN_ADMINISTRATOR"], $GLOBALS['STR_DATE'], $GLOBALS["STR_MODULE_WEBMAIL_ADMIN_EMAIL_SENT"], $GLOBALS["STR_ADMIN_EMAIL_TEMPLATE"], $GLOBALS["STR_ADMIN_USER"]);
425  $Links->HeaderTitlesArray = $HeaderTitlesArray;
426  $result = $Links->Query();
427  $output .= '
428  <form method="post" action=""' . get_current_url(false) . '"">
429  <table class="affiche_list_send_mail">
430  <tr>
431  <td class="entete" colspan="2">'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_LIST_TITLE'].'</td>
432  </tr>
433  <tr>
434  <th>'.$GLOBALS['STR_ADMIN_DATE'].'' . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
435  <td>
436  <input type="text" name="date" class="form-control datepicker" value="' . String::str_form_value(vb(($recherche['date']))) . '" style="width:110px" />
437  <input type="hidden" name="mode" value="search" />
438  </td>
439  </tr>
440  <tr>
441  <th>' . $GLOBALS['STR_ADMIN_ADMINISTRATOR'] . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
442  <td>
443  <select name="admin" class="form-control">
444  <option value="">' . $GLOBALS['STR_CHOOSE'] . '...</option>';
445  // Requete récupérant la liste des admin disponible sur le site
446  $sql = 'SELECT id_utilisateur, nom_famille , prenom
447  FROM peel_utilisateurs
448  WHERE priv = "admin" AND ' . get_filter_site_cond('utilisateurs') . '
449  ORDER BY id_utilisateur ASC';
450  $result_admins = query($sql);
451  while ($admins_array = fetch_assoc($result_admins)) {
452  $output .= '
453  <option value="' . intval(vn($admins_array['id_utilisateur'])) . '" ' . frmvalide(!empty($recherche['admin']) && $recherche['admin'] == $admins_array['id_utilisateur'], ' selected="selected"') . '>' . vb($admins_array['prenom']) . ' ' . vb($admins_array['nom_famille']) . '</option>';
454  }
455  $output .= '
456  </select>
457  </td>
458  </tr>
459  <tr>
460  <th>' .$GLOBALS['STR_ADMIN_EMAIL_TEMPLATE']. $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
461  <td>
462  <select name="template" id="template" class="form-control">
463  ' . get_email_template_options('id') . '
464  </select>
465  </td>
466  </tr>
467  <tr>
468  <td colspan="2" class="center">
469  <input type="submit" value="'.$GLOBALS['STR_SEARCH'].'" class="btn btn-primary" />
470  </td>
471  </tr>
472  </table>
473  </form>
474  <table class="main_table">
475  <tr>
476  <td>' . $Links->GetMultipage() . '</td>
477  </tr>
478  <tr>
479  <td>
480  <div class="table-responsive">
481  <table class="table">
482  ' . $Links->getHeaderRow();
483  $i = 0;
484  if (empty($result)) {
485  $output .= '
486  <tr><td colspan="5" class="left"><div class="alert alert-warning">'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_NO_EMAIL_SENT_FOUND'].'</div></td></tr>';
487  } else {
488  foreach($result as $mails_send_array) {
489  $template_infos = getTextAndTitleFromEmailTemplateLang(null, null, $mails_send_array['data']);
490  $send_email_list = explode(',', $mails_send_array['raison']);
491  $nb_send_email_list = count($send_email_list);
492  if ($nb_send_email_list > 1) {
493  $multi_send_texte = '<i style="color:red;">Envoi multiple</i><br />';
494  // Récupération du nombre d'envoi, qui est indiqué au début de la chaine de caractère dans le cas d'envoi multiple
495  } else {
496  $multi_send_texte = '';
497  }
498  $output .= tr_rollover($i, true) . '
499  <td class="center">
500  ' . $mails_send_array["admin_prenom"] . ' ' . $mails_send_array["admin_nom"] . '
501  </td>
502  <td class="center">
503  ' . get_formatted_date(vb($mails_send_array['date']), 'short', true) . '
504  </td>
505  <td class="center">';
506  // Si un template a été envoyé, alors on récupère le contenu de ce template
507  if (!empty($template_infos) && $mails_send_array['remarque'] == $template_infos['text']) {
508  $email_sended_infos = '<b>Template</b> : <br />' . $multi_send_texte . $template_infos["name"] . ($template_infos['text'] != String::strip_tags($template_infos['text'])?' (HTML)':'');
509  } else {
510  $email_sended_infos = $multi_send_texte . $mails_send_array['remarque'];
511  }
512  $output .= $email_sended_infos . '
513  </td>
514  <td class="center">';
515  if (!empty($template_infos)) {
516  $output .= $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_BASE_TEMPLATE_USED'] . ' ' . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':<br />' . $template_infos['technical_code'] . ' - ' . String::strtoupper($template_infos['lang']);
517  } else {
518  $output .= $mails_send_array["data"];
519  }
520 
521  $output .= '
522  </td>
523  <td class="center">';
524  // Si il y un id_membre nous affichons le lien de la fiche utilisateur
525  if ($nb_send_email_list > 1) {
526  $output .= sprintf($GLOBALS['STR_MODULE_WEBMAIL_ADMIN_EMAIL_SENT_TO_N_CLIENTS'], $nb_send_email_list);
527  } elseif (!empty($mails_send_array['id_membre'])) {
528  $output .= '<b><a href="' . $GLOBALS['administrer_url'] . '/utilisateurs.php?mode=modif&id_utilisateur=' . intval($mails_send_array['id_membre']) . '">' . $mails_send_array["user_prenom"] . ' ' . $mails_send_array["user_nom"] . '</a></b><br />' . $mails_send_array["user_login"];
529  } else {
530  $output .= (!empty($mails_send_array['raison'])?$mails_send_array['raison']:$GLOBALS['STR_INFORMATION_NOT_AVAILABLE']);
531  }
532  $output .= '
533  </td>
534  </tr>';
535  }
536  }
537  $output .= '
538  </table>
539  </div>
540  </td>
541  </tr>
542  <tr>
543  <td>&nbsp;</td>
544  </tr>
545  <tr>
546  <td>' . $Links->GetMultipage() . '</td>
547  </tr>
548  </table>';
549  if ($return_mode) {
550  return $output;
551  } elseif (!empty($output)) {
552  echo $output;
553  } else {
554  return false;
555  }
556 }
557 
565 function affiche_list_receveid_mail($recherche, $return_mode = false)
566 {
567  $output = '';
568  $sql_cond = array();
569  if (!empty($recherche)) {
570  // Recherche par date
571  if (!empty($recherche['date']) && $recherche['date'] != 'any') {
572  $sql_cond[] = ' w.date="' . nohtml_real_escape_string($recherche['date']) . '" ';
573  }
574  // Recherche par nom
575  if (!empty($recherche['nom'])) {
576  $sql_cond[] = ' w.nom LIKE "%' . nohtml_real_escape_string($recherche['nom']) . '%" ';
577  }
578  // Recherche par email
579  if (!empty($recherche['email'])) {
580  $sql_cond[] = ' w.email= "' . nohtml_real_escape_string($recherche['email']) . '" ';
581  }
582  }
583  $sql = "SELECT w.*, u.pseudo AS login
584  FROM peel_webmail w
585  LEFT JOIN peel_utilisateurs u ON u.id_utilisateur = w.id_user AND " . get_filter_site_cond('utilisateurs', 'u') . "
586  WHERE " . get_filter_site_cond('webmail', 'w', true) . " " . (!empty($sql_cond)?' AND ' . implode(' AND ', $sql_cond):'') . "
587  ORDER BY w.Date DESC, w.Heure DESC";
588  $Links = new Multipage($sql, 'affiche_liste_send_email');
589  $HeaderTitlesArray = array(' ', $GLOBALS['STR_ADMIN_TITLE'], $GLOBALS['STR_LAST_NAME'].'/'.$GLOBALS['STR_FIRST_NAME'].'/'.$GLOBALS['STR_DATE'], $GLOBALS['STR_MESSAGE'], 'IP', $GLOBALS["STR_ADMIN_WEBSITE"]);
590  $Links->HeaderTitlesArray = $HeaderTitlesArray;
591  $result = $Links->Query();
592 
593  $output .= '
594 <form method="post" action=""' . get_current_url(false) . '"">
595  <table class="full_width">
596  <tr>
597  <td class="entete" colspan="2">'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_RECEIVED_LIST_TITLE'].'</td>
598  </tr>
599  <tr>
600  <td colspan="2">
601  &nbsp;
602  <input type="hidden" name="mode" value="search" />
603  </td>
604  </tr>
605  <tr>
606  <th>' . $GLOBALS['STR_DATE'] . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
607  <td>
608  <select name="date" class="form-control">';
609  // Affiche le select avec les differentes date d'email, ainsi qu'avec le signalement lu ou pas
610  $row_affdate = query("SELECT count(*) AS this_count, `Read`, `Date`
611  FROM peel_webmail
612  WHERE " . get_filter_site_cond('webmail', null, true) . "
613  GROUP BY `Date`, `Read`
614  ORDER BY `Date` DESC ");
615  while ($row_row_affdate = fetch_assoc($row_affdate)) {
616  if (empty($messages_count[$row_row_affdate['Date']])) {
617  $messages_count[$row_row_affdate['Date']] = 0;
618  $messages_not_read[$row_row_affdate['Date']] = 0;
619  }
620  $messages_count[$row_row_affdate['Date']] += $row_row_affdate['this_count'];
621  if ($row_row_affdate['Read'] == 'NO') {
622  $messages_not_read[$row_row_affdate['Date']] += $row_row_affdate['this_count'];
623  }
624  }
625 
626  $i = 0;
627  if (!empty($messages_count)) {
628  foreach ($messages_count AS $this_date => $this_messages_count) {
629  $jour = String::substr($this_date, 8, 2);
630  $mois = String::substr($this_date, 5, 2);
631  $annee = String::substr($this_date, 0, 4);
632  if ($messages_not_read[$this_date] > 0) {
633  $style = ' style="color:#FF0000"';
634  } else {
635  $style = '';
636  }
637  if (empty($i)) {
638  // C'est la première date : c'est possiblement la date du jour (sinon c'est qu'il n'y a pas de message aujourd'hui
639  if (/*date('Y-m-d') == $this_date ||*/$messages_not_read[$this_date] > 0) {
640  $style = ' style="color:#FF0000"';
641  } else {
642  $style = '';
643  }
644  $output .= '
645  <option value="' . date('Y-m-d') . '" ' . frmvalide(!empty($recherche['date']) && $recherche['date'] == date('Y-m-d'), ' selected="selected"') . ' ' . $style . '>Aujourd\'hui</option>
646  <option value="any" ' . frmvalide(!empty($recherche['date']) && $recherche['date'] == 'any', ' selected="selected"') . '>Toutes dates</option>';
647 
648  /*<option value="any_not_read"' . ((!empty($_GET['date'])) && ($_GET['date'] == 'any_not_read')?' selected="selected"':'') . '>Toutes dates</option>';*/
649  }
650  $output .= '<option value="' . String::str_form_value(vb($this_date)) . '" ' . frmvalide(!empty($recherche['date']) && $recherche['date'] == $this_date , ' selected="selected"') . ' ' . $style . '>' . $jour . "/" . $mois . "/" . $annee . ' ' . $GLOBALS['day_of_week'][date('w', strtotime($this_date))];
651  if ($this_date == date('Y-m-d')) {
652  $output .= ' ('.$GLOBALS['strToday'].')';
653  } elseif ($this_date == date('Y-m-d', time() - 24 * 3600)) {
654  $output .= ' ('.$GLOBALS['strYesterday'].')';
655  }
656  if ($this_messages_count - $messages_not_read[$this_date] > 0) {
657  $output .= ' ' . ($this_messages_count - $messages_not_read[$this_date]) . ' lu';
658  if (($this_messages_count - $messages_not_read[$this_date]) > 1) {
659  $output .= 's';
660  }
661  }
662  if ($messages_not_read[$this_date] > 0) {
663  if ($this_messages_count - $messages_not_read[$this_date] > 0) {
664  $output .= ' +';
665  }
666  $output .= ' ' . $messages_not_read[$this_date] . ' A LIRE';
667  }
668  $output .= '</option>
669  ';
670  $i++;
671  }
672  }
673  $output .= '
674  </select>
675  </td>
676  </tr>
677  <tr>
678  <th>' . $GLOBALS['STR_ADMIN_NAME'] . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
679  <td><input class="form-control" type="text" name="nom" value="' . String::str_form_value(vb($recherche['nom'])) . '" /></td>
680  </tr>
681  <tr>
682  <th>' . $GLOBALS['STR_EMAIL'] . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ':</th>
683  <td><input class="form-control" type="email" name="email" value="' . String::str_form_value(vb($recherche['email'])) . '" /></td>
684  </tr>
685  <tr>
686  <td>&nbsp;</td>
687  <td>
688  <input type="submit" value="'.$GLOBALS['STR_SEARCH'].'" class="btn btn-primary" />
689  </td>
690  </tr>
691  </table>
692 </form>
693 <form method="post" action=""' . get_current_url(false) . '"">
694  <div class="table-responsive" style="margin-top:10px">
695  <input type="hidden" name="mode" value="change_state_mail" />
696  <table id="tablesForm" class="table">
697  ' . $Links->getHeaderRow();
698  $i = 0;
699  if (empty($result)) {
700  $output .= '<tr><td colspan="6" class="center"><b>'.$GLOBALS['STR_MODULE_WEBMAIL_ADMIN_NO_EMAIL_FOUND'].'</b></td></tr>';
701  } else {
702  $read_title_array = array('NO' => $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_TO_ANSWER'], 'READ' => $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_READ'], 'SEND' => $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_ANSWERED']);
703 
704  foreach($result as $message) {
705  $output .= tr_rollover($i, true) . '
706  <td class="center" style="width:5px;">
707  <input name="form_delete[]" type="checkbox" value="' . intval(vn($message['id'])) . '" id="cbx_' . intval(vn($message['id'])) . '" />
708  </td>
709  <td class="center" style="width:15%">
710  <b>' . String::strtoupper(vb($message['titre'])) . '</b><br /><span style="color:' . ($message['read'] == 'NO'?'Red':($message['read'] == 'SEND'?'Green':'Black')) . '">[' . $read_title_array[$message['read']] . ']</span><br /><br /><a style="' . ($message['read'] == 'NO'?'font-size:13px; color:Red':($message['read'] == 'SEND'?'color:Green':'color:Black')) . '" href="' . $GLOBALS['wwwroot_in_admin'] . '/modules/webmail/administrer/webmail_send.php?id_webmail=' . intval(vn($message['id'])) . '">' . sprintf(($message['read'] == 'SEND'?$GLOBALS["STR_MODULE_WEBMAIL_ADMIN_ANSWER_AGAIN"]:$GLOBALS["STR_MODULE_WEBMAIL_ADMIN_ANSWER_TO"]), $message['email']) . '</a>
711  </td>
712  <td class="center" style="width:15%">
713  '.$GLOBALS["STR_ADMIN_NAME"].$GLOBALS['STR_BEFORE_TWO_POINTS'].': <b>' . ucfirst(vb($message['nom'])) . '</b><br />'.$GLOBALS["STR_FIRST_NAME"].$GLOBALS['STR_BEFORE_TWO_POINTS'].': <b>' . ucfirst(vb($message['prenom'])) . '</b><br />'.$GLOBALS["STR_TELEPHONE"].$GLOBALS['STR_BEFORE_TWO_POINTS'].': <b>' . vb($message['telephone']) . '</b><br />'.$GLOBALS["STR_DATE"].$GLOBALS['STR_BEFORE_TWO_POINTS'].': <b>' . vb($message['date']) . ' ' . vb($message['heure']) . '</b><br />' . (intval(vn($message['id_user'])) != 0? '<a href="' . $GLOBALS['administrer_url'] . '/utilisateurs.php?mode=modif&id_utilisateur=' . intval(vn($message['id_user'])) . '" style="color:Grey;">'.$GLOBALS["STR_CUSTOMER"].' # ' . intval(vn($message['id_user'])) . '<br />'.$GLOBALS["STR_ADMIN_LOGIN"].' : <b>' . vb($message['login']) . '</b>':'') . '
714  </td>
715  <td class="center" style="width:35%">
716  <font color="' . (($message['read'] == 'NO')?'Red':'Black') . '">' . String::nl2br_if_needed(String::str_shorten_words(String::strip_tags(trim($message['message'])), 60, ' ', true)) . '</font>' . ($message['id_user'] == 0 && $message['read'] == 'SEND'?'<p><a href="list_admin_actions.php?action_cat=SEND_EMAIL&search=' . vb($message['email']) . '&type=1">Voir message(s) envoyé(s) par nous à ' . vb($message['email']) . '</a></p>':'') . '
717  </td>
718  <td class="center" style="width:15%">
719  ' . vb($message['ip']) . '
720  </td>
721  <td class="center" style="width:15%">
722  ' . get_site_name($message['site_id']) . '
723  </td>
724  </tr>';
725  $i++;
726  }
727  }
728  $output .= '
729  </table>
730  </div>
731  <div class="center">
732  <input type="button" value="'.$GLOBALS["STR_ADMIN_CHECK_ALL"].'" onclick="if (markAllRows(\'tablesForm\')) return false;" class="btn btn-info" />&nbsp;&nbsp;&nbsp;
733  <input type="button" value="'.$GLOBALS["STR_ADMIN_UNCHECK_ALL"].'" onclick="if (unMarkAllRows(\'tablesForm\')) return false;" class="btn btn-info" />&nbsp;&nbsp;&nbsp;
734  <input type="submit" value="'.$GLOBALS["STR_MODULE_WEBMAIL_ADMIN_MARK_AS_READ"].'" class="btn btn-primary" name="mail_is_read" />
735  <input type="submit" value="'.$GLOBALS["STR_MODULE_WEBMAIL_ADMIN_MARK_AS_NOT_READ"].'" class="btn btn-primary" name="mail_is_not_read" />
736  </div>
737  <div class="center">' . $Links->GetMultipage() . '</div>
738 </form>';
739  if ($return_mode) {
740  return $output;
741  } elseif (!empty($output)) {
742  echo $output;
743  } else {
744  return false;
745  }
746 }
747 
755 {
756  if (!empty($frm) && !empty($frm['form_delete'])) {
757  if (!empty($frm['mail_is_not_read'])) {
758  foreach($_POST['form_delete'] as $this_post => $this_value) {
759  query('UPDATE `peel_webmail`
760  SET `read`="NO"
761  WHERE `id`="' . intval(vn($this_value)) . '" AND `read`!="NO" AND ' . get_filter_site_cond('webmail', null, true));
762  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS["STR_MODULE_WEBMAIL_ADMIN_MSG_STATUS_NOT_READ_OK"], intval(vn($this_value)))))->fetch();
763  }
764  } else {
765  foreach($_POST['form_delete'] as $this_post => $this_value) {
766  query('UPDATE `peel_webmail`
767  SET `read`="READ"
768  WHERE `id`="' . intval(vn($this_value)) . '" AND `read`="NO" AND ' . get_filter_site_cond('webmail', null, true));
769  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS["STR_MODULE_WEBMAIL_ADMIN_MSG_STATUS_READ_OK"], intval(vn($this_value)))))->fetch();
770  }
771  }
772  }
773 }
static strtoupper($string)
Returns string with all alphabetic characters converted to uppercase.
Definition: String.php:154
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id.
Definition: fonctions.php:4763
static strip_tags($string, $allowed_tags=null)
String::strip_tags()
Definition: String.php:548
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
$result
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
$tpl_langs
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 ...
Definition: database.php:400
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
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
Definition: fonctions.php:19
real_escape_string($value)
real_escape_string()
Definition: database.php:374
if(isset($_POST['pays_zone'])) elseif(empty($_SESSION['session_caddie']->zoneId)&&!empty($GLOBALS['site_parameters']['default_delivery_zone_id'])) if(isset($_POST['type'])) elseif(empty($_SESSION['session_caddie']->typeId)&&!empty($GLOBALS['site_parameters']['default_delivery_type_id'])) if(!empty($_POST['code_promo'])) if(!empty($_GET['code_promo'])&&$_GET['code_promo']== 'delete') $form_error_object
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...
Definition: String.php:305
$tpl_options
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.
Definition: fonctions.php:4643
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.
Definition: database.php:158
affiche_form_send_mail($frm, $return_mode=false, &$form_error_object=null)
Affiche le formulaire d'envoi d'email.
Definition: fonctions.php:89
static str_form_value($value, $flags=ENT_COMPAT)
Encode une chaine de caractères pour affichage dans un value="".
Definition: String.php:480
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
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))
Definition: chart-data.php:160
if(!defined('IN_PEEL')) send_email($to, $mail_subject= '', $mail_content= '', $template_technical_code=null, $template_tags=null, $format=null, $sender=null, $html_add_structure=true, $html_correct_conformity=false, $html_convert_url_to_links=true, $reply_to=null, $attached_files_infos_array=null, $lang=null, $additional_infos_array=array(), $attachment_not_sent_by_email=false)
Envoi d'un email à un utilisateur.
Definition: emails.php:38
tracert_history_admin($member_id, $action, $data, $remarque=null, $raison=null)
Inscrit les différentes actions administrateur Liste des $actions possibles : 'SEARCH_USER', 'ADD_FILTER', 'EDIT_FILTER', 'DEL_FILTER', 'EDIT_AD', 'SUP_AD', 'EDIT_VOTE', 'SUP_DETAILS', 'EDIT_PROFIL', 'SUP_FORUM', 'ACTIVATE_COMPTE', 'NOTES_RECUES', 'NOTES_DONNEES', 'NOTE_PROFIL', 'AUTRE', 'SEND_EMAIL', 'CREATE_ORDER', 'EDIT_ORDER', 'SUP_ORDER', 'PHONE_EMITTED', 'EVENT', 'PHONE_RECEIVED'.
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
get_formatted_date($datetime_or_timestamp=null, $mode= 'short', $hour_minute=false)
Afficher une date formatée, en évitant les problèmes liés aux noms de mois sur les serveurs qui ne so...
Definition: format.php:440
update_state_mail($frm)
Fonction permettant de mettre à jour l'état d'un courrier lu ou non.
Definition: fonctions.php:754
webmail_hook_list_user_mail($params)
Fonction affichant la liste d'emails sur le compte utilisateur.
Definition: fonctions.php:37
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_mysql_date_from_user_input($string, $use_current_hour_min_sec_if_missing=false)
Transforme une date formattée par get_formatted_date() en date MySQL Si la date est vide...
Definition: format.php:496
getTextAndTitleFromEmailTemplateLang($template_technical_code, $template_lang, $template_technical_id=null)
getTextAndTitleFromEmailTemplateLang()
Definition: emails.php:331
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
Definition: fonctions.php:94
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
affiche_list_send_mail($recherche, $return_mode=false)
Affiche la liste des emails envoyer.
Definition: fonctions.php:402
frmvalide($variable_to_test, $true_value= 'checked="checked"', $false_value="")
Affiche le mot "checked" si la variable est vraie sinon rien.
Definition: format.php:80
if(!defined('IN_PEEL')) webmail_hook_admin_menu_items($params)
Renvoie les éléments de menu affichables.
Definition: fonctions.php:24
affiche_list_receveid_mail($recherche, $return_mode=false)
Affiche la affiche la liste des emails reçus.
Definition: fonctions.php:565
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112
static nl2br_if_needed($string)
Fonction de compatibilité avec de vieilles versions de PEEL ou du contenu qui vient d'ailleurs...
Definition: String.php:559
get_site_info($array)
get_site_info()
send_mail_admin($frm)
Fonction de traitement d'envoi d'email.
Definition: fonctions.php:317
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:31:07 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.