PEEL Shopping
Open source ecommerce : PEEL Shopping
display.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: display.php 47256 2015-10-08 19:53:07Z gboussin $
14 if (!defined('IN_PEEL')) {
15  die();
16 }
17 
18 if (!function_exists('tr_rollover')) {
29  function tr_rollover($line_number, $return_mode = false, $style = null, $onclick = null, $id = null)
30  {
31  static $tpl;
32  if(empty($tpl)) {
33  $tpl = $GLOBALS['tplEngine']->createTemplate('tr_rollover.tpl');
34  }
35  $tpl->assign('onclick', $onclick);
36  $tpl->assign('style', $style);
37  $tpl->assign('line_number', $line_number);
38  $tpl->assign('id', $id);
39 
40  $output = $tpl->fetch();
41  if ($return_mode) {
42  return $output;
43  } else {
44  echo $output;
45  }
46  }
47 }
48 if (!function_exists('affiche_meta')) {
61  function affiche_meta($page_name, $return_mode = false)
62  {
63  $output = '';
64  // PRIORITE 1 : Mix entre $GLOBALS['meta_title'] et table spécifique des metas peel_metas :
65  // PRIORITE 2 : Récupération des métas définis en BDD pour des éléments précis
66  if (!empty($_GET['id']) && defined('IN_LEXIQUE')) {
67  $sql_Meta = 'SELECT word_' . $_SESSION['session_langue'] . ' AS nom, meta_title_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_definition_' . $_SESSION['session_langue'] . ' AS meta_desc
68  FROM peel_lexique
69  WHERE id = "' . intval($_GET['id']) . '" AND '. get_filter_site_cond('lexique');
70  } elseif (!empty($_GET['catid']) && (defined('IN_CATALOGUE_ANNONCE') || defined('IN_CATALOGUE_ANNONCE_DETAILS'))) {
71  $sql_Meta = 'SELECT nom_' . $_SESSION['session_langue'] . ' AS nom, meta_titre_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, meta_desc_' . vb($_SESSION['session_langue']) . ' AS meta_desc, image_' . $_SESSION['session_langue'] . ' AS image
72  FROM peel_categories_annonces
73  WHERE id = "' . intval($_GET['catid']) . '" AND ' . get_filter_site_cond('categories_annonces') . '';
74  } elseif (!empty($_GET['id']) && defined('IN_SEARCH_BRAND')) {
75  // Si on est dans une marque
76  $sql_Meta = 'SELECT nom_' . $_SESSION['session_langue'] . ' AS nom, meta_titre_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_desc_' . $_SESSION['session_langue'] . ' AS meta_desc, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, image
77  FROM peel_marques
78  WHERE id = "' . intval($_GET['id']) . '" AND ' . get_filter_site_cond('marques');
79  } elseif (!empty($_GET['catid']) && empty($_GET['id'])) {
80  // Si on est dans une catégorie
81  $sql_Meta = 'SELECT nom_' . $_SESSION['session_langue'] . ' AS nom, meta_titre_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_desc_' . $_SESSION['session_langue'] . ' AS meta_desc, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, image_' . $_SESSION['session_langue'] . ' AS image
82  FROM peel_categories
83  WHERE id = "' . intval($_GET['catid']) . '" AND ' . get_filter_site_cond('categories') . '';
84  } elseif (!empty($_GET['rubid']) && empty($_GET['id'])) {
85  // Si on est dans une rubrique
86  $sql_Meta = 'SELECT nom_' . $_SESSION['session_langue'] . ' AS nom, meta_titre_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_desc_' . $_SESSION['session_langue'] . ' AS meta_desc, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, image
87  FROM peel_rubriques
88  WHERE id = "' . intval($_GET['rubid']) . '" AND ' . get_filter_site_cond('rubriques') . '';
89  } elseif (!empty($_GET['id']) && defined('IN_CATALOGUE_PRODUIT')) {
90  // Si on est dans une fiche produit
91  $display_facebook_tag = 'product';
92  $sql_Meta = "SELECT nom_".(!empty($GLOBALS['site_parameters']['product_name_forced_lang'])?$GLOBALS['site_parameters']['product_name_forced_lang']:$_SESSION['session_langue'])." AS nom, meta_titre_" . $_SESSION['session_langue'] . ' AS meta_titre, meta_desc_' . $_SESSION['session_langue'] . ' AS meta_desc, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, image1 AS image
93  FROM peel_produits
94  WHERE id = "' . intval($_GET['id']) . '" AND ' . get_filter_site_cond('produits') . '';
95  } elseif (!empty($_GET['id']) && defined('IN_RUBRIQUE_ARTICLE')) {
96  // Si on est dans un article de contenu
97  $display_facebook_tag = 'article';
98  $sql_Meta = 'SELECT titre_' . $_SESSION['session_langue'] . ' AS nom, meta_titre_' . $_SESSION['session_langue'] . ' AS meta_titre, meta_desc_' . $_SESSION['session_langue'] . ' AS meta_desc, meta_key_' . $_SESSION['session_langue'] . ' AS meta_key, image1 AS image
99  FROM peel_articles
100  WHERE id = "' . intval($_GET['id']) . '" AND ' . get_filter_site_cond('articles') . '';
101  }
102  $sql_Meta = call_module_hook('meta_sql_get', array(), 'unique');
103  if (!empty($sql_Meta)) {
104  $query_Meta = query($sql_Meta);
105  $m = fetch_assoc($query_Meta);
106  } else {
107  $no_meta_by_page_content = true;
108  }
109  // PRIORITE 3 : Récupération des metas par URL ou code technique
110  $sql_Meta = 'SELECT *
111  FROM peel_meta
112  WHERE (technical_code="'.real_escape_string(get_current_url(false)).'" OR technical_code="'.real_escape_string(get_current_url(false, true)).'") AND ' . get_filter_site_cond('meta');
113  $query_Meta = query($sql_Meta);
114  $m_peel_meta = fetch_assoc($query_Meta);
115  if(!empty($m_peel_meta)) {
116  $meta_by_exact_url = true;
117  } elseif(!empty($page_name)) {
118  $sql_Meta = 'SELECT *
119  FROM peel_meta
120  WHERE technical_code="'.real_escape_string($page_name).'" AND ' . get_filter_site_cond('meta');
121  $query_Meta = query($sql_Meta);
122  $m_peel_meta = fetch_assoc($query_Meta);
123  }
124  // PRIORITE 4 : Définition de certains métas par défaut, en complément de ce qui est présent dans les fichiers de meta par langue
125  if (defined('IN_PARTNER')) {
126  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_OUR_PARTNER'];
127  } elseif (defined('IN_MAP')) {
128  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_WORD_RESELLER'];
129  } elseif (defined('IN_RETAILER')) {
130  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_RETAILER_SUBSCRIBE'];
131  } elseif (defined('IN_REFERENCE')) {
132  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_REFERENCE_ON_LINE_SHOP'];
133  } elseif (defined('IN_DEVIS')) {
134  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_DEVIS_ON_LINE_SHOP'];
135  } elseif (defined('IN_DOWNLOAD_PEEL') && !empty($GLOBALS['STR_MODULE_PEEL_DOWNLOAD_PEEL'])) {
136  $GLOBALS['strSpecificMeta']['Title'][$page_name] = $GLOBALS['STR_MODULE_PEEL_DOWNLOAD_PEEL'];
137  }
138  // PRIORITE 5 : Récupération des metas par défaut
139  $sql_Meta = 'SELECT *
140  FROM peel_meta
141  WHERE ("'.real_escape_string(get_current_url(true)).'" LIKE CONCAT(technical_code, "%") OR "'.real_escape_string(get_current_url(true, true)).'" LIKE CONCAT(technical_code, "%")) AND ' . get_filter_site_cond('meta') . '
142  ORDER BY LENGTH(technical_code) DESC
143  LIMIT 1';
144  $query_Meta = query($sql_Meta);
145  $m_default = fetch_assoc($query_Meta);
146  // Application des priorités
147  if (!empty($meta_by_exact_url) && !empty($m_peel_meta) && !empty($m_peel_meta['meta_titre_' . $_SESSION['session_langue']])) {
148  // Une méta définie pour une URL bien précise a priorité sur tout
149  $this_title = $m_peel_meta['meta_titre_' . $_SESSION['session_langue']];
150  } elseif (!empty($GLOBALS['meta_title'])) {
151  $this_title = $GLOBALS['meta_title'];
152  } elseif (!empty($m) && !empty($m['meta_titre'])) {
153  $this_title = $m['meta_titre'];
154  } elseif (!empty($m) && !empty($m['nom'])) {
155  $this_title = $m['nom'];
156  } elseif (!empty($m_peel_meta) && !empty($m_peel_meta['meta_titre_' . $_SESSION['session_langue']])) {
157  $this_title = $m_peel_meta['meta_titre_' . $_SESSION['session_langue']];
158  } elseif (!empty($GLOBALS['DOC_TITLE'])) {
159  // DOC_TITLE est un titre par défaut d'une page : il est moins prioritaire notamment que les informations rentrées dans les metas en base de données
160  $this_title = $GLOBALS['DOC_TITLE'];
161  } elseif (!empty($GLOBALS['strSpecificMeta']['Title'][$page_name])) {
162  $this_title = $GLOBALS['strSpecificMeta']['Title'][$page_name];
163  } else {
164  $this_title = $m_default['meta_titre_' . $_SESSION['session_langue']];
165  }
166  $this_title = String::html_entity_decode($this_title);
167  if (!empty($GLOBALS['meta_description'])) {
168  $this_description = str_replace(array(' ', ' ', ' ', "\t"), ' ', trim(String::strip_tags($GLOBALS['meta_description']))) . ' ';
169  } else {
170  $this_description = '';
171  }
172  if (String::strlen($this_description) < 100) {
173  if (!empty($m['meta_desc'])) {
174  $this_description .= $m['meta_desc'];
175  } elseif (!empty($m_peel_meta['meta_desc_' . $_SESSION['session_langue']])) {
176  $this_description .= $m_peel_meta['meta_desc_' . $_SESSION['session_langue']];
177  } elseif (!empty($GLOBALS['strSpecificMeta']['Description'][$page_name])) {
178  $this_description .= $GLOBALS['strSpecificMeta']['Description'][$page_name];
179  } else {
180  $this_description .= $m_default['meta_desc_' . $_SESSION['session_langue']];
181  if (!empty($m['nom'])) {
182  $this_description = $m['nom'] . '. ' . $this_description;
183  } elseif(!empty($GLOBALS['meta_title'])) {
184  $this_description = $GLOBALS['meta_title'] . '. ' . $this_description;
185  } elseif(!empty($GLOBALS['DOC_TITLE'])) {
186  $this_description = $GLOBALS['DOC_TITLE'] . '. ' . $this_description;
187  }
188  }
189  }
190  if (!empty($this_title) && $this_title == String::strtoupper($this_title) && String::strlen($this_title) > 25) {
191  // Titre tout en majuscule et pas juste un ou deux mots => on passe en minuscule car sinon mauvais pour moteurs de recherche
192  $this_title = String::strtolower($this_title);
193  }
194  if (!empty($GLOBALS['STR_TITLE_SUFFIX'])) {
195  foreach(explode(' ', $GLOBALS['STR_TITLE_SUFFIX']) as $this_word) {
196  if ((String::strlen($this_word)<=2 || String::strpos(String::strtolower($this_title), String::strtolower($this_word)) === false) && String::strlen($this_title . ' ' . $this_word) < 80) {
197  $this_title .= ' ' .$this_word;
198  }
199  }
200  }
201  if(!empty($m) && !empty($m['meta_key']) && String::strlen($m['meta_key']) > 40 && String::strlen($m['meta_key']) < 200) {
202  // On respecte la balise méta keywords définie dans le contenu de la page en base de données, car elle parait de taille cohérente
203  $this_keywords = $m['meta_key'];
204  } elseif((!empty($meta_by_exact_url) || !empty($no_meta_by_page_content)) && !empty($m_peel_meta) && !empty($m_peel_meta['meta_key_' . $_SESSION['session_langue']]) && String::strlen($m_peel_meta['meta_key_' . $_SESSION['session_langue']]) > 40 && String::strlen($m_peel_meta['meta_key_' . $_SESSION['session_langue']]) < 150) {
205  // On respecte la balise méta keywords définie par URL exacte en base de données, ou par technical code si on est dans une page sans définition possible directe des métas
206  // car elle parait de taille cohérente
207  $this_keywords = $m_peel_meta['meta_key_' . $_SESSION['session_langue']];
208  } else {
209  $this_keywords = $this_title . ' ' . vb($GLOBALS['meta_keywords']) . ' ' . vb($m['nom']) . ' ' . vb($m['meta_key']) . ' '. vb($GLOBALS['strSpecificMeta']['Keywords'][$page_name]) . ' ' . vb($m_peel_meta['meta_key_' . $_SESSION['session_langue']]);
210  if (String::strlen($this_keywords) < 70) {
211  $this_keywords .= ' ' . $this_description;
212  }
213  if (String::strlen($this_keywords) < 100) {
214  $this_keywords .= ' ' . $m_default['meta_key_' . $_SESSION['session_langue']];
215  }
216  if (!empty($this_keywords)) {
217  // Nettoyage des mots clés - on n'en garde que 12 maximum (conseillé : max 8)
218  $temp_array = array_unique(explode(',', trim(String::strip_tags(str_replace(array("\r", "\n", "\t", '!', '?', '(', ')', '.', '#', ':', ';', '&nbsp;', '+', '-', " ", ".", '"', "'"), ',', String::html_entity_decode(str_replace(array('&nbsp;'), ',', String::strtolower($this_keywords))))))));
219  foreach($temp_array as $this_key => $this_value) {
220  if (String::strlen($this_value) < 4 || (String::strlen($this_value) < 5 && $this_key > 6) ) {
221  unset($temp_array[$this_key]);
222  }
223  }
224  $this_keywords = implode(', ', array_slice($temp_array, 0, 12));
225  }
226  }
227  $GLOBALS['meta_description_html_uncut'] = $this_description;
228  if (!empty($this_description)) {
229  $this_description = String::str_shorten(str_replace(array(' ', ' ', ' ', ' .', '....'), array(' ', ' ', ' ', '.', '.'), trim(String::strip_tags(String::html_entity_decode_if_needed(str_replace(array("\r", "\n", "<br>", "<br />", "</p>"), ' ', $this_description))))), 190, '', '...', 170);
230  if ($this_description == String::strtoupper($this_description)) {
231  $this_description = String::strtolower($this_description);
232  }
233  }
234  $tpl = $GLOBALS['tplEngine']->createTemplate('meta.tpl');
235  $tpl->assign('charset', GENERAL_ENCODING);
236  $tpl->assign('title', String::ucfirst(String::str_shorten(trim(String::strip_tags(String::html_entity_decode_if_needed(str_replace(array("\r", "\n"), '', $this_title)))), 80, '', '', 65)));
237  $tpl->assign('keywords', $this_keywords);
238  $tpl->assign('site', $GLOBALS['site']);
239  if($_SESSION['session_langue'] == 'fr') {
240  $tpl->assign('generator', 'https://www.peel.fr/');
241  } else {
242  $tpl->assign('generator', 'http://www.peel-shopping.com/');
243  }
244  $tpl->assign('description', String::ucfirst($this_description));
245  $tpl->assign('content_language', $_SESSION['session_langue']);
246  if ((!empty($display_facebook_tag) || !empty($GLOBALS['site_parameters']['facebook_meta_force_all_pages'])) && check_if_module_active('facebook')) {
247  if(empty($GLOBALS['facebook_image'])) {
248  $GLOBALS['facebook_image'] = vb($m['image']);
249  }
250  $display_facebook_tag_array = array('meta_titre' => $this_title, 'meta_desc' => $this_description, 'image' => $GLOBALS['facebook_image'], 'type' => (!empty($display_facebook_tag) && is_string($display_facebook_tag)?$display_facebook_tag:'website'), 'image_size' => vb($GLOBALS['facebook_image_size']));
251  $tpl->assign('facebook_tag', display_facebook_tag($display_facebook_tag_array));
252  }
253  if(!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
254  $tpl->assign('specific_meta', '<meta name="viewport" content="width=device-width, initial-scale=1.0" />');
255  }
256  if((!empty($_GET['update']) && $_GET['update'] == 1) || !empty($GLOBALS['robots_noindex'])|| !empty($_GET['follow']) || !empty($_GET['nofollow'])) {
257  $robots = 'noindex, nofollow';
258  } else {
259  $robots = 'all';
260  }
261  $tpl->assign('robots', $robots);
262 
263  $output .= $tpl->fetch();
264  if ($return_mode) {
265  return $output;
266  } else {
267  echo $output;
268  }
269  }
270 }
271 
272 if (!function_exists('affiche_ariane')) {
281  function affiche_ariane($show_home = true, $page_name = null, $buttons = null)
282  {
283  $ariane = array();
284  $tpl = $GLOBALS['tplEngine']->createTemplate('ariane.tpl');
285  $hidden = !empty($GLOBALS['site_parameters']['module_ariane_hidden']);
286  $tpl->assign('hidden', $hidden);
287 
288  if($show_home) {
289  $ariane = array('href' => false,
290  'txt' => $GLOBALS['site']
291  );
292  }
293  $other = array('href' => false,
294  'txt' => false
295  );
296 
297  if (!defined('IN_HOME')) {
298  if($show_home) {
299  $ariane['href'] = get_url('/');
300  }
301  if (defined('IN_CATALOGUE')) {
302  $other['txt'] = affiche_arbre_categorie(vn($_GET['catid']), null, null, array());
303  if($hidden) {
304  $other['hidden'] = affiche_arbre_categorie(vn($_GET['catid']), null, null, array(), true);
305  }
306  } elseif (defined('IN_CATALOGUE_PRODUIT')) {
307  $other['txt'] = affiche_arbre_categorie(vn($_GET['catid']), null, null, array());
308  if($hidden) {
309  $other['hidden'] = affiche_arbre_categorie(vn($_GET['catid']), null, null, array(), true);
310  }
311  } elseif (defined('IN_RUBRIQUE')) {
312  $other['txt'] = affiche_arbre_rubrique(vn($_GET['rubid']), null);
313  if($hidden) {
314  $other['hidden'] = affiche_arbre_rubrique(vn($_GET['rubid']), null, true);
315  }
316  } elseif (defined('IN_RUBRIQUE_ARTICLE')) {
317  $other['txt'] = affiche_arbre_rubrique(vn($_GET['rubid']), null);
318  if($hidden) {
319  $other['hidden'] = affiche_arbre_rubrique(vn($_GET['rubid']), null, true);
320  }
321  } elseif (defined('IN_NOUVEAUTES')) {
322  $other['txt'] = $GLOBALS['STR_NOUVEAUTES'];
323  $other['href'] = get_url('/achat/nouveautes.php');
324  } elseif (defined('IN_PROMOTIONS')) {
325  $other['txt'] = $GLOBALS['STR_PROMOTIONS'];
326  $other['href'] = get_url('/achat/promotions.php');
327  } elseif (defined('IN_SPECIAL')) {
328  $other['txt'] = $GLOBALS['STR_SPECIAL'];
329  $other['href'] = get_url('/achat/special.php');
330  } elseif (defined('IN_TOP')) {
331  $other['txt'] = $GLOBALS['STR_TOP'];
332  $other['href'] = get_url('/achat/top.php');
333  } elseif (defined('IN_FLASH')) {
334  $other['txt'] = $GLOBALS['STR_FLASH'];
335  $other['href'] = get_url('/modules/flash/flash.php');
336  } elseif (defined('IN_CHEQUE_CADEAU')) {
337  $other['txt'] = $GLOBALS['STR_CHEQUE_CADEAU'];
338  $other['href'] = get_url('/modules/gift_check/cheques.php');
339  } elseif (defined('IN_ORDER_HISTORY')) {
340  $other['txt'] = $GLOBALS['STR_ORDER_HISTORY'];
341  $other['href'] = get_url('/achat/historique_commandes.php');
342  } elseif (defined('IN_COMPTE')) {
343  $other['txt'] = $GLOBALS['STR_COMPTE'];
344  $other['href'] = get_account_url(false, false);
345  } elseif (defined('IN_CONTACT')) {
346  $other['txt'] = $GLOBALS['STR_CONTACT'];
347  if (check_if_module_active('url_rewriting')) {
348  $other['href'] = get_contact_url(false, false);
349  } else {
350  $other['href'] = get_url('/utilisateurs/contact.php');
351  }
352  } elseif (defined('IN_CONTACT_US')) {
353  $other['txt'] = $GLOBALS['STR_CONTACT_US'];
354  $other['href'] = get_url('/contacts.php');
355  } elseif (defined('IN_SEARCH')) {
356  $other['txt'] = $GLOBALS['STR_SEARCH'];
357  $other['href'] = get_url('search');
358  } elseif (defined('IN_SITEMAP')) {
359  $other['txt'] = $GLOBALS['STR_SITEMAP'];
360  $other['href'] = get_url('sitemap');
361  } elseif (defined('IN_CGV')) {
362  $other['txt'] = $GLOBALS['STR_CGV'];
363  $other['href'] = get_cgv_url(false);
364  } elseif (defined('IN_FAQ')) {
365  $other['txt'] = $GLOBALS['STR_FAQ_TITLE'];
366  $other['href'] = get_url('/modules/faq/faq.php');
367  } elseif (defined('IN_INFO_LEGALE')) {
368  $other['txt'] = $GLOBALS['STR_LEGAL_INFORMATION'];
369  $other['href'] = get_url('legal');
370  } elseif (defined('IN_CONDITION_PARRAIN')) {
371  $other['txt'] = $GLOBALS['STR_CONDITION_PARRAIN'];
372  $other['href'] = get_url('/modules/parrainage/conditions.php');
373  } elseif (defined('IN_PARRAIN_ENTETE')) {
374  $other['txt'] = $GLOBALS['STR_PARRAIN_ENTETE'];
375  $other['href'] = get_url('/modules/parrainage/parrain.php');
376  } elseif (defined('IN_CONDITION_AFFILI')) {
377  $other['txt'] = $GLOBALS['STR_CONDITION_AFFILI'];
378  $other['href'] = get_url('/modules/affiliation/conditions.php');
379  } elseif (defined('IN_AFFILIATE')) {
380  $other['txt'] = $GLOBALS['STR_AFFILIATE'];
381  $other['href'] = get_url('/modules/affiliation/affiliate.php');
382  } elseif (defined('IN_RETAILER')) {
383  $other['txt'] = $GLOBALS['STR_RETAILER'];
384  $other['href'] = get_url('/modules/reseller/retailer.php');
385  } elseif (defined('IN_CHANGE_PASSWORD')) {
386  $other['txt'] = $GLOBALS['STR_CHANGE_PASSWORD'];
387  $other['href'] = get_url('/utilisateurs/change_mot_passe.php');
388  } elseif (defined('IN_CHANGE_PARAMS')) {
389  $other['txt'] = $GLOBALS['STR_CHANGE_PARAMS'];
390  $other['href'] = get_url('/utilisateurs/change_params.php');
391  } elseif (defined('IN_GET_PASSWORD')) {
392  $other['txt'] = $GLOBALS['STR_GET_PASSWORD'];
393  $other['href'] = get_url('/utilisateurs/oubli_mot_passe.php');
394  } elseif (defined('IN_REGISTER')) {
395  $other['txt'] = $GLOBALS['STR_REGISTER'];
396  $other['href'] = get_account_register_url(false, false);
397  } elseif (defined('IN_ACCES_ACCOUNT')) {
398  $other['txt'] = $GLOBALS['STR_ACCES_ACCOUNT'];
399  $other['href'] = get_url('membre');
400  } elseif (defined('IN_TELL_FRIEND')) {
401  $other['txt'] = $GLOBALS['STR_TELL_FRIEND'];
402  $other['href'] = get_tell_friends_url(false);
403  } elseif (defined('IN_TOUS_LES_AVIS')) {
404  $other['txt'] = $GLOBALS['STR_TOUS_LES_AVIS'];
405  } elseif (defined('IN_DONNEZ_AVIS')) {
406  $other['txt'] = $GLOBALS['STR_DONNEZ_AVIS'];
407  } elseif (defined('IN_CADDIE')) {
408  $other['txt'] = $GLOBALS['STR_CADDIE'];
409  $other['href'] = get_url('caddie_affichage');
410  } elseif (defined('IN_STEP1')) {
411  $other['txt'] = $GLOBALS['STR_STEP1'];
412  } elseif (defined('IN_STEP2')) {
413  $other['txt'] = $GLOBALS['STR_STEP2'];
414  } elseif (defined('IN_STEP3')) {
415  $other['txt'] = $GLOBALS['STR_STEP3'];
416  } elseif (defined('IN_SEARCH_BRAND')) {
417  $other['txt'] = $GLOBALS['STR_SEARCH_BRAND'];
418  } elseif (defined('IN_PENSE_BETE')) {
419  $other['txt'] = $GLOBALS['STR_PENSE_BETE'];
420  $other['href'] = get_url('/modules/pensebete/voir.php');
421  } elseif (defined('IN_DOWNLOAD')) {
422  $other['txt'] = $GLOBALS['STR_YOUR_ORDER_DOWNLOAD'];
423  $other['href'] = get_url('/modules/download/telecharger.php', array('id' => vb($_GET['id']) , 'key' => vb($_GET['key'])));
424  } elseif (defined('IN_FORUM')) {
425  $other['txt'] = $GLOBALS['STR_FORUM'];
426  $other['href'] = get_url('/modules/forum/index.php');
427  } elseif (defined('IN_LEXIQUE')) {
428  $other['txt'] = $GLOBALS['STR_LEXIQUE'];
429  $other['href'] = get_lexicon_url();
430  }
431  if(!empty($page_name)) {
432  $other['txt'] .= ' &gt; ' . $page_name;
433  }
434  $tpl->assign('ariane', $ariane);
435  $tpl->assign('other', $other);
436  $tpl->assign('buttons', $buttons);
437  return $tpl->fetch();
438  }
439  }
440 }
441 
442 if (!function_exists('affiche_filtre')) {
449  function affiche_filtre($id = null, $return_mode = false)
450  {
451  $output = '';
452  if (vn($GLOBALS['site_parameters']['module_filtre']) == 1) {
453  if (!empty($id)) {
454  $qid = query('SELECT id, c.nom_' . $_SESSION['session_langue'] . ' as categorie, c.image_' . $_SESSION['session_langue'] . '
455  FROM peel_categories c
456  WHERE c.nom_' . $_SESSION['session_langue'] . '!="" AND c.etat="1" AND id="' . intval($id) . '" AND ' . get_filter_site_cond('categories', 'c') . '
457  ORDER BY c.position');
458  $cat = fetch_assoc($qid);
459  $urlcat_with_suffixe = get_product_category_url($id, $cat['categorie'], true, true);
460  // En cas d'ajout d'une option ici, il faut aussi ajouter le champ dans le tableau de vérification dans la fonction params_affiche_produits => if(!in_array($_GET['tri'], array('nom_fr', 'prix'))) {
461  } else {
462  $urlcat_with_suffixe = get_current_url(false) . '?';
463  }
464  $tpl = $GLOBALS['tplEngine']->createTemplate('filtre.tpl');
465  $tpl->assign('options', array(
466  $_SERVER['REQUEST_URI'] => $GLOBALS['STR_ORDER_RESULTS_BY'],
467  $urlcat_with_suffixe . 'tri=nom_' . $_SESSION['session_langue'] . '&sort=asc' => $GLOBALS['STR_PRODUCT_NAME'] . ' ' . $GLOBALS['STR_ASC'],
468  $urlcat_with_suffixe . 'tri=nom_' . $_SESSION['session_langue'] . '&sort=desc' => $GLOBALS['STR_PRODUCT_NAME'] . ' ' . $GLOBALS['STR_DESC'],
469  $urlcat_with_suffixe . 'tri=prix&sort=asc' => $GLOBALS['STR_PRICE'] . ' ' . $GLOBALS['STR_ASC'],
470  $urlcat_with_suffixe . 'tri=prix&sort=desc' => $GLOBALS['STR_PRICE'] . ' ' . $GLOBALS['STR_DESC']
471  ));
472  $selected = '';
473  if(!empty($_GET['tri']) && !empty($_GET['sort'])) {
474  $selected = $urlcat_with_suffixe . 'tri=' . $_GET['tri'] . '&sort=' . $_GET['sort'];
475  }
476  $tpl->assign('selected', $selected);
477  $output .= $tpl->fetch();
478  }
479  if ($return_mode) {
480  return $output;
481  } else {
482  echo $output;
483  }
484  }
485 }
486 
487 if (!function_exists('get_brand_link_html')) {
497  function get_brand_link_html($id_marque = null, $return_mode = false, $show_all_brands_link = false, $location = null)
498  {
499  $output = '';
500  $sql = '
501  SELECT m.id, m.nom_' . $_SESSION['session_langue'] . ' AS marque, m.image
502  FROM peel_marques m';
503  if (empty($id_marque)) {
504  $sql .= '
505  LEFT JOIN peel_produits p ON p.id_marque=m.id AND p.etat=1 AND ' . get_filter_site_cond('produits', 'p') . '';
506  }
507  $sql .= '
508  WHERE m.etat=1 AND ' . get_filter_site_cond('marques', 'm');
509  if (!empty($id_marque)) {
510  $sql .= ' AND m.id="' . intval($id_marque) . '"
511  LIMIT 1';
512  } else {
513  $sql .= '
514  GROUP BY m.id
515  ORDER BY count(m.id) DESC
516  LIMIT 5';
517  }
518  $query = query($sql);
519  $links = array();
520  while ($brand = fetch_object($query)) {
521  $this_url = get_url('/achat/marque.php', array('id' => $brand->id));
522  $links[] = array('href' => $this_url,
523  'value' => $brand->marque,
524  'image' => $brand->image,
525  'is_current' => (get_current_url(true) == $this_url));
526  }
527  if($show_all_brands_link) {
528  $this_url = get_url('/achat/marque.php');
529  $links[] = array('href' => $this_url,
530  'value' => $GLOBALS['STR_ALL_BRAND'],
531  'image' => '',
532  'is_current' => (get_current_url(true) == $this_url));
533  }
534  $tpl = $GLOBALS['tplEngine']->createTemplate('brand_link_html.tpl');
535  $tpl->assign('as_list', empty($id_marque));
536  $tpl->assign('links', $links);
537  $tpl->assign('location', $location);
538  $output .= $tpl->fetch();
539  return $output;
540  }
541 }
542 
543 if (!function_exists('get_brand_description_html')) {
552  function get_brand_description_html($id_marque, $return_mode = false, $show_links_to_details = true)
553  {
554  $tpl = $GLOBALS['tplEngine']->createTemplate('brand_description_html.tpl');
555  $sql = "SELECT id, image, description_" . $_SESSION['session_langue'] . " AS description, nom_" . $_SESSION['session_langue'] . " AS nom
556  FROM peel_marques
557  WHERE etat=1" . (!empty($id_marque)?" AND id = '" . intval($id_marque) . "'":"") . " AND " . get_filter_site_cond('marques') ."
558  ORDER BY position ASC, nom ASC";
559  $query = query($sql);
560  $tplData = array();
561  while ($brand_object = fetch_object($query)) {
562  $sql2 = 'SELECT COUNT(*) AS nb_produits
563  FROM peel_produits
564  WHERE id_marque=' . intval($brand_object->id) . ' AND etat=1 AND nom_'.(!empty($GLOBALS['site_parameters']['product_name_forced_lang'])?$GLOBALS['site_parameters']['product_name_forced_lang']:$_SESSION['session_langue']).' != ""' . " AND " . get_filter_site_cond('produits');
565  $query2 = query($sql2);
566  $brand_products = fetch_assoc($query2);
567  $tmpData = array('nom' => $brand_object->nom,
568  'display_brand' => true
569  );
570  $tmpData['admin_content'] = a_priv('admin_content');
571  if ($tmpData['admin_content']) {
572  $tmpData['admin_link'] = array('href' => $GLOBALS['administrer_url'] . '/marques.php?mode=modif&id=' . $brand_object->id, 'name' => $GLOBALS['STR_MODIFY_BRAND']);
573  }
574  $tmpData['small_width'] = $GLOBALS['site_parameters']['small_width'];
575  $tmpData['has_image'] = !empty($brand_object->image);
576  if ($tmpData['has_image']) {
577  $thumb_file = thumbs($brand_object->image, $GLOBALS['site_parameters']['small_width'], $GLOBALS['site_parameters']['small_height'], 'fit');
578  if(!empty($thumb_file)) {
579  $tmpData['image'] = array('href' => ($show_links_to_details ? get_url('/achat/marque.php', array('id' => $brand_object->id)) : ''),
580  'src' => $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($brand_object->image, $GLOBALS['site_parameters']['small_width'], $GLOBALS['site_parameters']['small_height'], 'fit')
581  );
582  }
583  }
584  $tmpData['href'] = ($show_links_to_details ? get_url('/achat/marque.php', array('id' => $brand_object->id)) : '');
585  $tmpData['nb_produits_txt'] = $brand_products['nb_produits'] . ' ' . $GLOBALS['STR_ARTICLES'];
586  if($brand_products['nb_produits']<=1 && String::strtolower(String::substr($tmpData['nb_produits_txt'], -1)) == 's') {
587  $tmpData['nb_produits_txt'] = String::substr($tmpData['nb_produits_txt'], 0, String::strlen($tmpData['nb_produits_txt'])-1);
588  }
589  $tmpData['description'] = $brand_object->description;
590  $tplData[] = $tmpData;
591  }
592 
593  if (empty($tplData)) {
594  $tpl->assign('is_error', true);
595  $tpl->assign('error_header', $GLOBALS['STR_BRAND']);
596  $tpl->assign('error_content', $GLOBALS['STR_SEARCH_NO_RESULT_BRAND']);
597  } else {
598  $tpl->assign('is_error', false);
599  $tpl->assign('data', $tplData);
600  }
601  if ($return_mode) {
602  return $tpl->fetch();
603  } else {
604  echo $tpl->fetch();
605  }
606  }
607 }
608 
609 if (!function_exists('get_categories_output')) {
626  function get_categories_output($location = null, $mode = 'categories', $selected_item = null, $display_mode = 'option', $add_indent = '&nbsp;&nbsp;', $input_name = null, $technical_code = null, $use_admin_rights = false, $text_max_length = 25, $max_depth_allowed = null, $columns_if_related_display_mode = null, $parent_id=null, $exclude_id=null)
627  {
628  $output = '';
629  if($mode == 'categories') {
630  // Dans l'admin, il faut pouvoir voir les catégories qui n'ont pas de nom. Cela arrive lorque les information d'une catégorie ne sont pas renseigné pour toutes les langues,dans ce cas l'id entre crochet sera affiché en BO à la place du nom.
631  $sql = 'SELECT c.id, c.parent_id, c.nom_' . $_SESSION['session_langue'] . ' AS nom
632  FROM peel_categories c
633  WHERE c.etat="1" '.(!defined('IN_PEEL_ADMIN')?' AND nom_' . $_SESSION['session_langue'] . '!="" ':'').' '.(!empty($technical_code)?' AND technical_code ="' . nohtml_real_escape_string($technical_code) . '"':'').' AND ' . get_filter_site_cond('categories', 'c', $use_admin_rights) . ' '.(!empty($exclude_id)?' AND c.id !="' . intval($exclude_id) . '"':'').' '.($parent_id!==null?' AND parent_id ="' . intval($parent_id) . '"':'').'
634  ORDER BY c.position ASC, nom ASC';
635  } elseif($mode == 'rubriques') {
636  $sql = 'SELECT r.id, r.parent_id, r.nom_' . $_SESSION['session_langue'] . ' AS nom
637  FROM peel_rubriques r
638  WHERE r.etat = "1" AND r.nom_' . $_SESSION['session_langue'] . '!="" AND r.technical_code NOT IN ("other", "iphone_content") AND r.position>=0 AND ' . get_filter_site_cond('rubriques', 'r', $use_admin_rights) . '
639  ORDER BY r.position ASC, nom ASC';
640  if(!empty($GLOBALS['site_parameters']['content_categories_nb_limit_footer'])){
641  $sql .=' LIMIT '.$GLOBALS['site_parameters']['content_categories_nb_limit_footer'];
642  }
643  } elseif($mode == 'categories_annonces') {
644  $sql = 'SELECT c.id, c.parent_id, c.nom_' . $_SESSION['session_langue'] . ' AS nom
645  FROM peel_categories_annonces c
646  WHERE '.(!defined('IN_PEEL_ADMIN')?'c.nom_' . $_SESSION['session_langue'] . '!="" AND c.etat=1':'1') . ' AND ' . get_filter_site_cond('categories_annonces', 'c') . '
647  ORDER BY c.position ASC, '.word_real_escape_string($GLOBALS['site_parameters']['ads_categories_order_by']).' ASC';
648  } elseif($mode == 'partenaires_categories') {
649  $sql = 'SELECT r.id, r.parent_id, r.nom_' . $_SESSION['session_langue'] . ' AS nom
650  FROM peel_partenaires_categories r
651  WHERE 1
652  ORDER BY r.position ASC, nom ASC';
653  } else {
654  return null;
655  }
656  $qid = query($sql);
657  while ($result = fetch_assoc($qid)) {
658  $all_parents_with_ordered_direct_sons_array[$result['parent_id']][] = $result['id'];
659  $item_name_array[$result['id']] = (!empty($result['nom'])?$result['nom']:'['.$result['id'].']');
660  }
661  if (!empty($all_parents_with_ordered_direct_sons_array)) {
662  $class = null;
663  $columns = null;
664  if($display_mode == 'columns_linear') {
665  $class = 'col-sm-4 col-md-3';
666  } elseif($display_mode == 'columns') {
667  $columns = $columns_if_related_display_mode;
668  }
669  $output .= get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, 0, 0, $selected_item, $mode, $location, $max_depth_allowed, $text_max_length, $display_mode, $add_indent, $input_name, $class, $columns);
670  if($display_mode == 'columns_linear') {
671  $output = '<div class="row"><ul>' . $output . '</ul></div>';
672  }
673  }
674  return $output;
675  }
676 }
677 
678 if (!function_exists('get_recursive_items_display')) {
698  function get_recursive_items_display(&$all_parents_with_ordered_direct_sons_array, &$item_name_array, $this_parent, $this_parent_depth, $selected_item = null, $mode = 'categories', $location = null, $max_depth_allowed = null, $item_max_length = 25, $display_mode = 'option', $add_indent = '&nbsp;&nbsp;', $input_name = null, $class = null, $columns = null)
699  {
700  static $tpl;
701  $output = '';
702  if (!empty($all_parents_with_ordered_direct_sons_array[$this_parent])) {
703  if(empty($tpl)) {
704  $tpl = $GLOBALS['tplEngine']->createTemplate('recursive_items_display.tpl');
705  }
706  $tpl->assign('sons_ico_src', get_url('/images/right.gif'));
707  $tpl->assign('display_mode', $display_mode);
708  $tpl->assign('location', $location);
709  $tpl->assign('input_name', $input_name);
710  $tplItems = array();
711  $this_depth = $this_parent_depth + 1;
712  $indent = '';
713  for($i=1;$i<$this_depth;$i++) {
714  $indent .= $add_indent;
715  }
716  foreach ($all_parents_with_ordered_direct_sons_array[$this_parent] as $this_item) {
717  $searched_item = '';
718  $tplItem = array();
719  if (is_array($selected_item)) {
720  // Plusieurs sélections possibles : checkbox par exemple, ou select multiple
721  $is_selected = in_array($this_item, $selected_item);
722  } else {
723  $is_selected = ($this_item == $selected_item);
724  }
725  if (!empty($all_parents_with_ordered_direct_sons_array[$this_item])) {
726  if(empty($max_depth_allowed) || $this_depth<$max_depth_allowed) {
727  $tplItem['has_sons'] = true;
728  } else {
729  $tplItem['has_sons'] = false;
730  }
731  if (!is_array($selected_item)) {
732  // On cherche si le noeud est sélectionné ou un de ses fils l'est
733  // On commence par regarder si le noeud actuel est le parent de la sélection
734  $searched_item = $selected_item;
735  $i = 0;
736  // On met une sécurité pour éviter boucle infinie si un fils est son propre parent
737  while ($i++ < 500 && !empty($searched_item) && $searched_item != $this_item && !in_array($searched_item, $all_parents_with_ordered_direct_sons_array[$this_item])) {
738  // On cherche un cran plus loin dans l'arborescence
739  $result = false;
740  foreach ($all_parents_with_ordered_direct_sons_array as $this_tested_item => $tested_items_array) {
741  if (in_array($searched_item, $tested_items_array)) {
742  $result = $this_tested_item;
743  }
744  }
745  if ($result != $searched_item) {
746  $searched_item = $result;
747  } else {
748  $searched_item = false;
749  }
750  }
751  }
752  } else {
753  $tplItem['has_sons'] = false;
754  }
755  $tplItem['is_current'] = ($is_selected || !empty($searched_item));
756  $tplItem['is_selected'] = $is_selected;
757 
758  if (!empty($item_name_array[$this_item])) {
759  if ($mode == 'categories') {
760  $tplItem['href'] = get_product_category_url($this_item, $item_name_array[$this_item]);
761  } elseif ($mode == 'categories_annonces') {
762  $tplItem['href'] = get_annonce_category_url($this_item, $item_name_array[$this_item]);
763  } else {
764  $tplItem['href'] = get_content_category_url($this_item, $item_name_array[$this_item]);
765  }
766  $tplItem['nb'] = null;
767  if (vn($GLOBALS['site_parameters']['display_nb_product']) == 1) {
768  if ($mode == 'categories_annonces') {
769  $nb = calcul_nbannonces_parcat($this_item, $all_parents_with_ordered_direct_sons_array);
770  $tplItem['nb'] = $nb;
771  } elseif ($mode == 'categories') {
772  $nb = calcul_nbprod_parcat($this_item, $all_parents_with_ordered_direct_sons_array);
773  $tplItem['nb'] = $nb;
774  }
775  }
776  $tplItem['name'] = $item_name_array[$this_item];
777  }
778 
779  if ($tplItem['has_sons']) {
780  $tplItem['SONS'] = get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, $this_item, $this_depth, $selected_item, $mode, $location, $max_depth_allowed, $item_max_length, $display_mode, $add_indent, $input_name, $class);
781  }
782  if (function_exists('get_technical_code')) {
783  $tplItem['technical_code'] = get_technical_code($this_item);
784  }
785  $tplItem['value'] = $this_item;
786  $tplItem['id'] = 'menu_'.substr(md5(vb($tplItem['href']) . '_' . vb($tplItem['name'])),0,8);
787  $tplItem['depth'] = $this_depth;
788  $tplItem['indent'] = $indent;
789  $tplItem['item_max_length'] = $item_max_length;
790  $tplItem['class'] = $class;
791  $tplItems[] = $tplItem;
792  }
793  $tpl->assign('items', $tplItems);
794  $tpl->assign('columns', $columns);
795 
796  $output .= $tpl->fetch();
797  }
798  return $output;
799  }
800 }
801 
802 if (!function_exists('print_societe')) {
809  function print_societe($return_mode = false)
810  {
811  $output = '';
812  $qid = query("SELECT *
813  FROM peel_societe
814  WHERE " . get_filter_site_cond('societe') . "
815  LIMIT 1");
816  if ($ligne = fetch_object($qid)) {
817  $tpl = $GLOBALS['tplEngine']->createTemplate('societe.tpl');
818  $tpl->assign('societe', $ligne->societe);
819  $tpl->assign('adresse', $ligne->adresse);
820  $tpl->assign('code_postal', $ligne->code_postal);
821  $tpl->assign('ville', $ligne->ville);
822  $tpl->assign('pays', $ligne->pays);
823  $tpl->assign('tel', $ligne->tel);
824  $tpl->assign('tel_label', $GLOBALS['STR_SHORT_TEL'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
825  $tpl->assign('fax', $ligne->fax);
826  $tpl->assign('fax_label', $GLOBALS['STR_SHORT_FAX'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
827  $tpl->assign('siren', $ligne->siren);
828  $tpl->assign('siren_label', $GLOBALS['STR_SIREN'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
829  $tpl->assign('tvaintra', $ligne->tvaintra);
830  $tpl->assign('tvaintra_label', $GLOBALS['STR_VAT_INTRACOM'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
831  $tpl->assign('cnil', $ligne->cnil);
832  $tpl->assign('cnil_label', $GLOBALS['STR_CNIL_NUMBER'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
833  $output .= $tpl->fetch();
834  }
835  if ($return_mode) {
836  return $output;
837  } else {
838  echo $output;
839  }
840  }
841 }
842 
843 if (!function_exists('print_rib')) {
850  function print_rib($return_mode = false)
851  {
852  $output = '';
853  $qid = query("SELECT *
854  FROM peel_societe
855  WHERE " . get_filter_site_cond('societe') . "
856  LIMIT 1");
857  if ($ligne = fetch_object($qid)) {
858  $tplData = array();
859  if (!empty($ligne->code_banque)) {
860  $tplData[] = array('label' => $GLOBALS['STR_BANK_ACCOUNT_CODE'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->code_banque);
861  }
862  if (!empty($ligne->code_guichet)) {
863  $tplData[] = array('label' => $GLOBALS['STR_BOX_OFFICE_CODE'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->code_guichet);
864  }
865  if (!empty($ligne->numero_compte)) {
866  $tplData[] = array('label' => $GLOBALS['STR_ACCOUNT_NUMBER'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->numero_compte);
867  }
868  if (!empty($ligne->cle_rib)) {
869  $tplData[] = array('label' => $GLOBALS['STR_BANK_ACCOUNT_RIB_KEY'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->cle_rib);
870  }
871  if (!empty($ligne->titulaire)) {
872  $tplData[] = array('label' => $GLOBALS['STR_ACCOUNT_MASTER'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->titulaire);
873  }
874  if (!empty($ligne->domiciliation)) {
875  $tplData[] = array('label' => $GLOBALS['STR_DOMICILIATION'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->domiciliation);
876  }
877  if (!empty($ligne->iban)) {
878  $tplData[] = array('label' => $GLOBALS['STR_IBAN'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->iban);
879  }
880  if (!empty($ligne->swift)) {
881  $tplData[] = array('label' => $GLOBALS['STR_SWIFT'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $ligne->swift);
882  }
883 
884  if (!empty($tplData)) {
885  $tpl = $GLOBALS['tplEngine']->createTemplate('rib.tpl');
886  $tpl->assign('data', $tplData);
887  $output .= $tpl->fetch();
888  }
889  }
890  if ($return_mode) {
891  return $output;
892  } else {
893  echo $output;
894  }
895  }
896 }
897 
898 if (!function_exists('print_cgv')) {
906  function print_cgv($return_mode = false)
907  {
908  $output = '';
909  $sql = 'SELECT titre_' . $_SESSION['session_langue'] . ' as titre, texte_' . $_SESSION['session_langue'] . ' as texte
910  FROM peel_cgv
911  WHERE ' . get_filter_site_cond('cgv');
912  $res = query($sql);
913  $cgv = fetch_object($res);
914  if (!empty($cgv->texte)) {
916  $title = $cgv->titre;
917  } else {
918  $title = '';
919  $longtext = $GLOBALS['STR_EMPTY_TEXT_CGV'];
920  }
921  $output .= get_formatted_longtext_with_title($longtext, $title, 'cgv');
922  if ($return_mode) {
923  return $output;
924  } else {
925  echo $output;
926  }
927  }
928 }
929 
930 if (!function_exists('print_legal')) {
938  function print_legal($return_mode = false)
939  {
940  $output = '';
941  $sql = "SELECT titre_" . $_SESSION['session_langue'] . " as titre, texte_" . $_SESSION['session_langue'] . " as texte
942  FROM peel_legal
943  WHERE " . get_filter_site_cond('legal');
944  $res = query($sql);
945  $cgv = fetch_object($res);
946  if (!empty($cgv->texte)) {
948  $title = $cgv->titre;
949  } else {
950  $title = '';
951  $longtext = $GLOBALS['STR_EMPTY_TEXT_LEGAL'];
952  }
953  $output .= get_formatted_longtext_with_title($longtext, $title, 'legal');
954  if ($return_mode) {
955  return $output;
956  } else {
957  echo $output;
958  }
959  }
960 }
961 
962 if (!function_exists('print_contact')) {
970  function print_contact($return_mode = false)
971  {
972  $output = '';
973  $sql = "SELECT titre_" . $_SESSION['session_langue'] . " AS titre, texte_" . $_SESSION['session_langue'] . " AS texte
974  FROM peel_contacts
975  WHERE " . get_filter_site_cond('contacts');
976  $res = query($sql);
977  $contact_infos = fetch_object($res);
978  if (!empty($contact_infos) && !empty($contact_infos->titre)) {
979  $title = $contact_infos->titre;
980  } else {
981  $title = $GLOBALS["STR_CONTACT"];
982  }
983  if (!empty($contact_infos) && !empty($contact_infos->texte)) {
984  $longtext = String::nl2br_if_needed(String::html_entity_decode_if_needed($contact_infos->texte));
985  } else {
986  $longtext = $GLOBALS['STR_EMPTY_TEXT_CONTACTS'];
987  }
988  $output .= get_formatted_longtext_with_title($longtext, $title, 'contact');
989  if ($return_mode) {
990  return $output;
991  } else {
992  echo $output;
993  }
994  }
995 }
996 
997 if (!function_exists('print_actu')) {
1005  function print_actu($return_mode = false, $rubid = null)
1006  {
1007  $output = '';
1008  $sql = 'SELECT p.id, p.on_reseller, p.surtitre_' . $_SESSION['session_langue'] . ', p.titre_' . $_SESSION['session_langue'] . ', p.chapo_' . $_SESSION['session_langue'] . ', p.texte_' . $_SESSION['session_langue'] . ', p.image1, p.on_special, p.date_maj
1009  FROM peel_articles p
1010  '.(!empty($rubid)?'INNER JOIN peel_articles_rubriques pc ON p.id = pc.article_id AND pc.rubrique_id='.intval($rubid):'').'
1011  WHERE p.on_special = "1" AND p.etat = "1" AND ' . get_filter_site_cond('articles', 'p') . '
1012  ORDER BY p.date_maj DESC
1013  LIMIT 0,1';
1014  $query = query($sql);
1015 
1016  if (num_rows($query) > 0) {
1017  $tpl = $GLOBALS['tplEngine']->createTemplate('actu.tpl');
1018  $tplData = array();
1019  while ($art = fetch_assoc($query)) {
1020  if ((!a_priv("admin_product") && !a_priv("reve")) && $art['on_reseller'] == 1) {
1021  continue;
1022  } else {
1023  $tplData[] = array('titre' => $art['titre_' . $_SESSION['session_langue']],
1024  'date' => get_formatted_date(time()),
1025  'image_src' => (!empty($art['image1']) ? $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($art['image1'], $GLOBALS['site_parameters']['medium_width'], $GLOBALS['site_parameters']['medium_height'], 'fit') : null),
1026  'chapo' => $art['chapo_' . $_SESSION['session_langue']]
1027  );
1028  }
1029  }
1030  $tpl->assign('data', $tplData);
1031  $output .= $tpl->fetch();
1032  }
1033  if ($return_mode) {
1034  return $output;
1035  } else {
1036  echo $output;
1037  }
1038  }
1039 }
1040 
1041 if (!function_exists('print_compte')) {
1048  function print_compte($return_mode = false)
1049  {
1050  $output = '';
1051  $est_identifie = est_identifie();
1052  if ($est_identifie) {
1053  $user_infos = get_user_information($_SESSION['session_utilisateur']['id_utilisateur']);
1054  if (!empty($user_infos)) {
1055  // $user_infos sera rempli même si vide si on fait vb() de certains éléments => on stocke l'information maintenant de savoir si infos trouvées ou pas
1056  // $iuser_infos est vide si l'utilisateur est un utilisateur demo avec droits automatiques (validateur W3C par exemple, si la configuration l'autorise)
1057  $user_found = true;
1058  }
1059  }
1060  if (String::substr(vb($user_infos['email_bounce']), 0, 2) == '5.' || empty($user_infos['email'])) {
1061  // Email vide ou ayant généré une erreur
1062  $email_form = '';
1063  $domain = explode('@', vb($user_infos['email']));
1064  $email_explain = sprintf($GLOBALS['STR_EMAIL_BOUNCE_REPLACE'], vb($domain[1]), vb($user_infos['email_bounce']), vb($user_infos['email']));
1065  $output .= $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => $GLOBALS['STR_IMPORTANT'] . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ': <a href="' . $GLOBALS['wwwroot'] . '/utilisateurs/change_params.php">' . $email_explain . '</a>'))->fetch();
1066  }
1067  $tpl = $GLOBALS['tplEngine']->createTemplate('compte.tpl');
1068 
1069  // On va utiliser sur cette page spécifiquement les icônes Font Awesome
1070  $GLOBALS['css_files']['font-awesome'] = get_url('/lib/css/font-awesome.min.css');
1071  // On exclue ce fichier de la minification car usage ponctuel
1072  $GLOBALS['site_parameters']['minify_css_exclude_array'][] = 'font-awesome.min.css';
1073 
1074  if (check_if_module_active('download')) {
1075  $tpl->assign('downloadable_file_link_array', get_downloadable_file_link(array('user_id' => $_SESSION['session_utilisateur']['id_utilisateur'])));
1076  $tpl->assign('STR_MODULE_TELECHARGEMENT_FOR_DOWNLOAD', $GLOBALS['STR_MODULE_TELECHARGEMENT_FOR_DOWNLOAD']);
1077  }
1078  $tpl->assign('compte', $GLOBALS['STR_COMPTE']);
1079  $tpl->assign('msg_support', $GLOBALS['STR_SUPPORT']);
1080  $tpl->assign('est_identifie', $est_identifie);
1081  if ($est_identifie) {
1082  $modules_data = array();
1083  $modules_data_group = array();
1084  $tpl->assign('number', $GLOBALS['STR_NUMBER']);
1085  $tpl->assign('code_client', vb($user_infos['code_client']));
1086  $tpl->assign('my_order', $GLOBALS['STR_MY_ORDER']);
1087  if(empty($GLOBALS['site_parameters']['user_multiple_addresses_disable'])) {
1088  $tpl->assign('STR_ADDRESS_TEXT', $GLOBALS['STR_ADDRESS_TEXT']);
1089  }
1090  $tpl->assign('STR_ADDRESS', $GLOBALS['STR_ADDRESS']);
1091 
1092  $modules_data_group['other'] = array('header' => $GLOBALS["STR_OTHER"], 'position' => null);
1093  $modules_data_group['cart'] = array('header' => $GLOBALS['STR_MY_ORDER'], 'position' => 2);
1094  $modules_data['cart'][] = array('txt' => '<span class="fa fa-shopping-cart fa-5x"></span> <span class="fa fa-history fa-3x"></span><br />' . $GLOBALS['STR_ORDER_HISTORY'], 'href' => get_url('/achat/historique_commandes.php'));
1095  $modules_data['cart'][] = array('txt' => '<span class="fa fa-cart-arrow-down fa-5x"></span><br />' . $GLOBALS['STR_PRODUCTS_PURCHASED_LIST'], 'href' => get_url('/achat/historique_commandes.php', array('mode' => 'product_ordered_history')));
1096  if (!empty($GLOBALS['site_parameters']['enable_create_product_in_front'])) {
1097  $modules_data_group['catalog'] = array('header' => $GLOBALS['STR_CATALOGUE'], 'position' => 6);
1098  $modules_data['catalog'][] = array('txt' => '' . $GLOBALS['STR_MODULE_CREATE_PRODUCT_IN_FRONT_OFFICE_CREATE_PRODUCT'], 'href' => get_content_url(null, null, null, null, false, false, 'display_product_form'));
1099  }
1100  $modules_data_group['account'] = array('header' => null, 'position' => 1);
1101  $modules_data['account'][] = array('txt' => '<span class="glyphicon glyphicon-user fa-5x"></span> <span class="fa fa-pencil fa-3x"></span><br />' . $GLOBALS['STR_CHANGE_PARAMS'], 'href' => get_url('/utilisateurs/change_params.php'));
1102  $modules_data['account'][] = array('txt' => '<span class="fa fa-key fa-5x"></span><br />' . $GLOBALS['STR_CHANGE_PASSWORD'], 'href' => get_url('/utilisateurs/change_mot_passe.php'));
1103  $modules_data['account'][] = array('txt' => '<span class="fa fa-location-arrow fa-5x"></span><br />' . $GLOBALS['STR_ADDRESS_TEXT'], 'href' => get_url('/utilisateurs/adresse.php'));
1104  // les codes promo utilisés
1105  $code_promo_query = query('SELECT code_promo, valeur_code_promo, percent_code_promo
1106  FROM peel_commandes pc
1107  WHERE pc.id_utilisateur = "' . intval($_SESSION['session_utilisateur']['id_utilisateur']) . '" AND code_promo != "" AND ' . get_filter_site_cond('commandes', 'pc'));
1108  if (num_rows($code_promo_query) > 0) {
1109  $cpu_data = array();
1110  while ($cp = fetch_assoc($code_promo_query)) {
1111  $cpu_data[] = array('code_promo' => $cp['code_promo'], 'discount_text' => get_discount_text($cp['valeur_code_promo'], $cp['percent_code_promo'], true));
1112  }
1113  $tpl->assign('code_promo_utilise', array('header' => $GLOBALS['STR_MES_CODE_PROMO_UTILISE'], 'data' => $cpu_data));
1114  }
1115  // les codes qui peuvent être encore utilisés
1116  $current_code_promo_query = query('SELECT *
1117  FROM peel_utilisateurs_codes_promos ucp
1118  INNER JOIN peel_codes_promos cp ON cp.id = ucp.id_code_promo AND ' . get_filter_site_cond('codes_promos', 'cp') . ' AND cp.etat = "1" AND ("' . date('Y-m-d', time()) . '" BETWEEN cp.date_debut AND cp.date_fin)
1119  WHERE ucp.id_utilisateur = "' . intval($_SESSION['session_utilisateur']['id_utilisateur']) . '" AND (cp.nombre_prevue=0 OR ucp.utilise<cp.nombre_prevue) AND (cp.nb_used_per_client=0 OR ucp.utilise<cp.nb_used_per_client)');
1120  if (num_rows($current_code_promo_query) > 0) {
1121  $cpv_data = array();
1122  while ($cp = fetch_assoc($current_code_promo_query)) {
1123  $cpv_data[] = array('nom_code' => $cp['nom_code'],
1124  'discount_text' => get_discount_text($cp['remise_valeur'], $cp['remise_percent'], display_prices_with_taxes_active()),
1125  'code_promo_valid_from' => $GLOBALS['STR_CODE_PROMO_VALID_FROM'],
1126  'date_from' => get_formatted_date($cp['date_debut']),
1127  'flash_to' => $GLOBALS['STR_FLASH_TO'],
1128  'date_to' => get_formatted_date($cp['date_fin'])
1129  );
1130  }
1131  $tpl->assign('code_promo_valide', array('header' => $GLOBALS['STR_MES_CODE_PROMO_VALIDE'], 'data' => $cpv_data));
1132  }
1133  if (vn($user_infos['remise_percent']) > 0) {
1134  $tpl->assign('remise_percent', array('label' => $GLOBALS['STR_REMISE'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $user_infos['remise_percent']));
1135  }
1136  if (vn($user_infos['avoir']) > 0) {
1137  $tpl->assign('avoir', array('label' => $GLOBALS['STR_AVOIR'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => fprix($user_infos['avoir'], true)));
1138  }
1139  $tpl->assign('logout', array('href' => get_url('sortie'), 'txt' => $GLOBALS['STR_LOGOUT']));
1140 
1141  if (a_priv('admin*', true)) {
1142  $tpl->assign('admin', array('href' => $GLOBALS['administrer_url'] . '/index.php', 'txt' => $GLOBALS['STR_ADMIN']));
1143  }
1144  if (check_if_module_active('abonnement')) {
1145  $tpl->assign('ABONNEMENT_MODULE', verified_status_activated());
1146  }
1147  if (function_exists('get_user_infos_resume_array') && !empty($_GET['display_user_infos_resume_array'])) {
1148  $tpl->assign('user_infos_resume_array', get_user_infos_resume_array());
1149  }
1150  $hook_result = call_module_hook('account_show', array(), 'array');
1151  $modules_data = array_merge_recursive($modules_data, vb($hook_result['modules_data'], array()));
1152  $modules_data_group = array_merge_recursive($modules_data_group, vb($hook_result['modules_data_group'], array()));
1153  if(!empty($modules_data)) {
1154  $position_if_null = 100000;
1155  foreach(array_keys($modules_data_group) as $this_group) {
1156  if(!empty($modules_data_group[$this_group]['disabled'])) {
1157  unset($modules_data_group[$this_group]);
1158  unset($modules_data[$this_group]);
1159  continue;
1160  }
1161  // Les positions par défaut définies en interne et par les modules peuvent être modifiées avec la variable de configuration account_show_modules_data_group_position
1162  if(!empty($GLOBALS['site_parameters']['account_show_modules_data_group_position'])) {
1163  if(isset($GLOBALS['site_parameters']['account_show_modules_data_group_position'][$this_group])) {
1164  $modules_data_group[$this_group]['position'] = $GLOBALS['site_parameters']['account_show_modules_data_group_position'][$this_group];
1165  }
1166  }
1167  if(!isset($modules_data_group[$this_group]['position'])) {
1168  // On ajoute des positions pour que le tri par usort ne change pas l'ordre d'éléments de position indéfinie
1169  $modules_data_group[$this_group]['position'] = $position_if_null++;
1170  }
1171  }
1172  foreach(array_keys($modules_data) as $this_group) {
1173  foreach(array_keys($modules_data[$this_group]) as $this_key) {
1174  if(!empty($modules_data[$this_group][$this_key]['disabled'])) {
1175  unset($modules_data[$this_group][$this_key]);
1176  continue;
1177  }
1178  if(!isset($modules_data[$this_group][$this_key]['position'])) {
1179  // On ajoute des positions pour que le tri par usort ne change pas l'ordre d'éléments de position indéfinie
1180  $modules_data[$this_group][$this_key]['position'] = $position_if_null++;
1181  }
1182  }
1183  }
1184  uasort($modules_data_group, 'data_position_sort');
1185  $temp = array();
1186  foreach(array_keys($modules_data_group) as $this_group) {
1187  if(!empty($modules_data[$this_group])) {
1188  $temp[$this_group] = $modules_data[$this_group];
1189  unset($modules_data[$this_group]);
1190  }
1191  }
1192  $modules_data = array_merge($temp, $modules_data);
1193  unset($temp);
1194  foreach(array_keys($modules_data) as $this_key) {
1195  usort($modules_data[$this_key], 'data_position_sort');
1196  }
1197  $tpl->assign('modules_data_group', $modules_data_group);
1198  $tpl->assign('modules_data', $modules_data);
1199  }
1200  if(!empty($GLOBALS['site_parameters']['disable_account_by_user_in_front_office'])) {
1201  $tpl->assign('disable_account', true);
1202  $tpl->assign('disable_account_text', $GLOBALS["STR_DISABLE_ACCOUNT"]);
1203  $tpl->assign('disable_account_href', $GLOBALS['wwwroot'] . '/compte.php?unsubscribe_account=true');
1204  $tpl->assign('confirm_disable_account', $GLOBALS["STR_CONFIRM_DISABLE_ACCOUNT"]);
1205  }
1206  } else {
1207  $tpl->assign('register_href', get_account_register_url(false, false));
1208  $tpl->assign('register', $GLOBALS['STR_REGISTER']);
1209  $tpl->assign('login_href', get_url('membre'));
1210  $tpl->assign('login', $GLOBALS['STR_LOGIN']);
1211  }
1212  $output .= $tpl->fetch();
1213  if ($return_mode) {
1214  return $output;
1215  } else {
1216  echo $output;
1217  }
1218  }
1219 }
1220 
1221 if (!function_exists('affiche_mini_caddie')) {
1229  function affiche_mini_caddie($detailed = true, $return_mode = false)
1230  {
1231  $tpl = $GLOBALS['tplEngine']->createTemplate('mini_caddie.tpl');
1232  $tpl->assign('logo_src', $GLOBALS['repertoire_images'] . '/cart-logo.png');
1233  $tpl->assign('affichage_href', get_url('caddie_affichage'));
1234  $tpl->assign('count_products', $_SESSION['session_caddie']->count_products());
1235  $tpl->assign('products_txt', ($_SESSION['session_caddie']->count_products() > 1 ? str_replace(array('(', ')'), array(''), $GLOBALS['STR_CADDIE_OBJECTS_COUNT']) : str_replace(array('(s)', '(es)', '(n)', '(en)'), '', $GLOBALS['STR_CADDIE_OBJECTS_COUNT'])));
1236 
1237  $tpl->assign('has_details', $detailed);
1238  $tplProducts = array();
1239  foreach ($_SESSION['session_caddie']->articles as $numero_ligne => $product_id) {
1240  $tmpProd = array();
1241  $product_object = new Product($product_id, null, false, null, true, !is_user_tva_intracom_for_no_vat() && !check_if_module_active('micro_entreprise'));
1242  $product_object->set_configuration($_SESSION['session_caddie']->couleurId[$numero_ligne], $_SESSION['session_caddie']->tailleId[$numero_ligne], check_if_module_active('reseller') && is_reseller());
1243  // Récupére la taille si elle existe
1244  if (!empty($product_object->configuration_size_id)) {
1245  $tmpProd['size'] = array('label' => $GLOBALS['STR_SIZE'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $product_object->get_size());
1246  }
1247  $urlprod = $product_object->get_product_url();
1248  if (!empty($product_object->configuration_color_id)) {
1249  // Si le produit a une couleur
1250  $tmpProd['color'] = array('label' => $GLOBALS['STR_COLOR'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => $product_object->get_color());
1251  $urlprod .= '?cId=' . $_SESSION['session_caddie']->couleurId[$numero_ligne];
1252  if (isset($tmpProd['size'])) { // Si le produit a une couleur et une taille
1253  $urlprod .= '&sId=' . $_SESSION['session_caddie']->tailleId[$numero_ligne];
1254  }
1255  } elseif (isset($tmpProd['size'])) { // si le produit a seulement une taille
1256  $urlprod .= '?sId=' . $_SESSION['session_caddie']->tailleId[$numero_ligne];
1257  }
1258  $tmpProd['href'] = $urlprod;
1259 
1261  $price_displayed = $_SESSION['session_caddie']->total_prix[$numero_ligne];
1262  } else {
1263  $price_displayed = $_SESSION['session_caddie']->total_prix_ht[$numero_ligne];
1264  }
1265  $tmpProd['quantite'] = $_SESSION['session_caddie']->quantite[$numero_ligne];
1266  $tmpProd['name'] = $product_object->name;
1267  $tmpProd['price'] = fprix($price_displayed, true);
1268  $display_picture = $product_object->get_product_main_picture(false);
1269  if ($display_picture) {
1270  $product_picture = $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($display_picture, 75, 75, 'fit');
1271  } elseif(!empty($GLOBALS['site_parameters']['default_picture'])) {
1272  $product_picture = $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($GLOBALS['site_parameters']['default_picture'], 75, 75, 'fit');
1273  } else {
1274  $product_picture = null;
1275  }
1276  $tmpProd['picture'] = $product_picture;
1277  $tplProducts[] = $tmpProd;
1278  unset($product_object);
1279  }
1280  $tpl->assign('products', $tplProducts);
1282  $total_displayed = $_SESSION['session_caddie']->total;
1283  $shipping_displayed = $_SESSION['session_caddie']->cout_transport;
1284  } else {
1285  $total_displayed = $_SESSION['session_caddie']->total_ht;
1286  $shipping_displayed = $_SESSION['session_caddie']->cout_transport_ht;
1287  }
1288  if (!empty($_SESSION['session_caddie']->cout_transport)) {
1289  $tpl->assign('transport', array('label' => $GLOBALS['STR_SHIPPING_COST'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => fprix($shipping_displayed, true)));
1290  }
1292  $tpl->assign('total', array('label' => $GLOBALS["STR_NET"] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => fprix($total_displayed, true)));
1293  } else {
1294  $tpl->assign('total', array('label' => $GLOBALS['STR_TOTAL_HT'] . $GLOBALS['STR_BEFORE_TWO_POINTS'], 'value' => fprix($total_displayed, true)));
1295  }
1296  $tpl->assign('STR_CADDIE', $GLOBALS['STR_CADDIE']);
1297  $tpl->assign('STR_DETAILS_ORDER', $GLOBALS['STR_DETAILS_ORDER']);
1298  if ($return_mode) {
1299  return $tpl->fetch();
1300  } else {
1301  echo $tpl->fetch();
1302  }
1303  }
1304 }
1305 
1306 if (!function_exists('affiche_sideblock')) {
1314  function affiche_sideblock($title, $text, $block_class, $return_mode = false)
1315  {
1316  $output = '';
1317  $tpl = $GLOBALS['tplEngine']->createTemplate('sideblock.tpl');
1318  $tpl->assign('block_class', $block_class);
1319  $tpl->assign('text', $text);
1320  $output .= $tpl->fetch();
1321  if ($return_mode) {
1322  return $output;
1323  } else {
1324  echo $output;
1325  }
1326  }
1327 }
1328 
1329 if (!function_exists('affiche_sideblocktitle')) {
1337  function affiche_sideblocktitle($title, $text, $block_class, $return_mode = false)
1338  {
1339  $output = '';
1340  $tpl = $GLOBALS['tplEngine']->createTemplate('sideblocktitle.tpl');
1341  $tpl->assign('block_class', $block_class);
1342  $tpl->assign('title', $title);
1343  $tpl->assign('text', $text);
1344  $output .= $tpl->fetch();
1345  if ($return_mode) {
1346  return $output;
1347  } else {
1348  echo $output;
1349  }
1350  }
1351 }
1352 
1353 if (!function_exists('affiche_block')) {
1369  function affiche_block($display_mode = 'sideblocktitle', $location = '', $technical_code = '', $title = '', $content = '', $block_class = '', $block_style = '', $return_mode = true, $is_slider_mode = false, $is_simplify_mode = false, $extra_class = false)
1370  {
1371  $mode = (!empty($rewrite_mame_mode)) ? clean_str($display_mode) : $display_mode;
1372  $tpl = $GLOBALS['tplEngine']->createTemplate('block.tpl');
1373  $tpl->assign('is_slider_mode', $is_slider_mode);
1374  $tpl->assign('extra_class', $extra_class);
1375  $tpl->assign('is_simplify_mode', $is_simplify_mode);
1376  $tpl->assign('lang', $_SESSION['session_langue']);
1377  $tpl->assign('mode', $mode);
1378  $tpl->assign('block_class', $block_class);
1379  $tpl->assign('location', $location);
1380  $tpl->assign('technical_code', $technical_code);
1381  $tpl->assign('block_style', $block_style);
1382  $tpl->assign('content', $content);
1383  $tpl->assign('title', $title);
1384  $tpl->assign('block_columns_width_sm', vb($GLOBALS['site_parameters']['block_columns_width_sm'], 4));
1385  $tpl->assign('block_columns_width_md', vb($GLOBALS['site_parameters']['block_columns_width_md'], 3));
1386  $tpl->assign('STR_PREVIOUS_PAGE', $GLOBALS['STR_PREVIOUS_PAGE']);
1387  $tpl->assign('STR_NEXT_PAGE', $GLOBALS['STR_NEXT_PAGE']);
1388  $output = $tpl->fetch();
1389  if ($return_mode) {
1390  return $output;
1391  } else {
1392  echo $output;
1393  }
1394  }
1395 }
1396 
1397 if (!function_exists('affiche_menu_recherche')) {
1405  function affiche_menu_recherche($return_mode = false, $display_mode = 'header')
1406  {
1407  $tpl = $GLOBALS['tplEngine']->createTemplate('menu_recherche.tpl');
1408  // Sur la homepage on veut des microdatas pour préciser le moteur de recherche du site
1409  // comme défini sur : https://developers.google.com/webmasters/richsnippets/sitelinkssearch et http://schema.org/WebSite
1410  $tpl->assign('add_webpage_microdata', defined('IN_HOME'));
1411  $tpl->assign('action', get_url('search'));
1412  $tpl->assign('display_mode', $display_mode);
1413  if (check_if_module_active('search')) {
1414  $tpl->assign('advanced_search_script', get_advanced_search_script());
1415  $tpl->assign('select_marque', affiche_select_marque(true));
1416  }
1417  // on construit la liste des catégories
1418  if(check_if_module_active('annonces')) {
1419  // on construit les options du select des catégories
1420  if(empty($GLOBALS['site_parameters']['advanced_fields_in_search_bar_disabled'])) {
1421  $tpl->assign('select_categorie', get_categories_output(null, 'categories_annonces', vn($_GET["categorie"]), 'option', '&nbsp;&nbsp;', null, null, false, 40));
1422  }
1423  $tpl->assign('STR_CATEGORY', $GLOBALS['STR_MODULE_ANNONCES_SEARCH_CATEGORY_AD']);
1424  if(!empty($GLOBALS['STR_MODULE_ANNONCES_SEARCH_TYPOLOGIE']) && empty($GLOBALS['site_parameters']['ad_search_typologie_disable'])) {
1425  $additionnal_select = '';
1426  if (!empty($GLOBALS['site_parameters']['ads_verified_status_per_subscription'])) {
1427  $additionnal_select .= '
1428  <option value="1" ' . frmvalide((!empty($_GET['cat_statut_detail']) && $_GET['cat_statut_detail'] == 1), 'selected="selected"') . '>' . $GLOBALS['STR_MODULE_ANNONCES_ALT_VERIFIED_ADS'] . '</option>
1429 ';
1430  }
1431  if(!empty($GLOBALS['site_parameters']['ads_contain_lot_sizes'])) {
1432  $additionnal_select .= '
1433  <option value="gros" ' . frmvalide((!empty($_GET['cat_statut_detail']) && $_GET['cat_statut_detail'] == 'gros'), 'selected="selected"') . '>' . $GLOBALS['STR_MODULE_ANNONCES_OFFER_GROS'] . '</option>
1434  <option value="demigros" ' . frmvalide((!empty($_GET['cat_statut_detail']) && $_GET['cat_statut_detail'] == 'demigros'), 'selected="selected"') . '>' . $GLOBALS['STR_MODULE_ANNONCES_OFFER_DEMIGROS'] . '</option>
1435  <option value="detail" ' . frmvalide((!empty($_GET['cat_statut_detail']) && $_GET['cat_statut_detail'] == 'detail'), 'selected="selected"') . '>' . $GLOBALS['STR_MODULE_ANNONCES_OFFER_DETAIL'] . '</option>';
1436  }
1437  if(!empty($additionnal_select)) {
1438  $additionnal_select = ' <select class="form-control" name="cat_statut_detail">
1439  <option value="">' . $GLOBALS['STR_MODULE_ANNONCES_SEARCH_TYPOLOGIE'] . '</option>
1440  ' . $additionnal_select . '
1441  </select>
1442 ';
1443  $tpl->assign('additionnal_select', $additionnal_select);
1444  }
1445  }
1446  } else {
1447  // on construit les options du select des catégories
1448  if(empty($GLOBALS['site_parameters']['advanced_fields_in_search_bar_disabled'])) {
1449  $tpl->assign('select_categorie', get_categories_output(null, 'categories', vb($_GET["categorie"]), 'option', '&nbsp;&nbsp;', null, null, false, 40));
1450  }
1451  $tpl->assign('STR_CATEGORY', $GLOBALS['STR_CATEGORY']);
1452  }
1453  if(!empty($GLOBALS['site_parameters']['header_search_form_additionnal_button'])) {
1454  $additionnal_button = '<a class="btn btn-default btn-header_search" href="'.$GLOBALS['site_parameters']['header_search_form_additionnal_button']['href'].'" title="">'.$GLOBALS['site_parameters']['header_search_form_additionnal_button']['anchor'] . '</a>
1455 ';
1456  $tpl->assign('additionnal_button', $additionnal_button);
1457  }
1458  $tpl->assign('STR_SEARCH', $GLOBALS["STR_SEARCH"]);
1459  if ($return_mode) {
1460  return $tpl->fetch();
1461  } else {
1462  echo $tpl->fetch();
1463  }
1464  }
1465 }
1466 
1467 if (!function_exists('affiche_guide')) {
1475  function affiche_guide($location, $return_mode = false, $more_infos = true)
1476  {
1477  $tpl = $GLOBALS['tplEngine']->createTemplate('guide.tpl');
1478  $tplLinks = array();
1479  $tplLinks['cgv'] = array('href' => get_url('cgv'), 'label' => $GLOBALS['STR_CGV'], 'selected' => defined('IN_CGV'));
1480  $tplLinks['contact'] = array('name' => 'contact', 'href' => get_url('/contacts.php'), 'label' => $GLOBALS['STR_CONTACT_INFO'], 'selected' => defined('IN_CONTACT_US'));
1481 
1482  $hook_result = call_module_hook('affiche_guide', array('location' => $location), 'array');
1483  $tplLinks = array_merge_recursive($tplLinks, $hook_result);
1484  $tplLinks['access_plan'] = array('name' => 'access_plan', 'href' => get_url('/plan_acces.php'), 'label' => $GLOBALS['STR_ACCESS_PLAN'], 'selected' => defined('IN_PLAN_ACCES'));
1485  if(isset($GLOBALS['site_parameters']['show_on_affiche_guide']) && is_array($GLOBALS['site_parameters']['show_on_affiche_guide'])) {
1486  $temp = array();
1487  foreach($GLOBALS['site_parameters']['show_on_affiche_guide'] as $this_value) {
1488  if(isset($tplLinks[$this_value])) {
1489  $temp[$this_value] = $tplLinks[$this_value];
1490  }
1491  }
1492  $tplLinks = $temp;
1493  }
1494  $tpl->assign('links', $tplLinks);
1495  $content_categories = get_categories_output($location, 'rubriques', vn($_GET['rubid']), 'list', null);
1496  $tpl->assign('menu_contenu', $content_categories);
1497  $tpl->assign('affiche_guide_returned_link_list_without_ul', vb($GLOBALS['site_parameters']['affiche_guide_returned_link_list_without_ul']));
1498 
1499  if ($return_mode) {
1500  return $tpl->fetch();
1501  } else {
1502  echo $tpl->fetch();
1503  }
1504  }
1505 }
1506 
1507 if (!function_exists('affiche_footer')) {
1514  function affiche_footer($return_mode = false)
1515  {
1516  $tpl = $GLOBALS['tplEngine']->createTemplate('footer.tpl');
1517  $tpl->assign('footer_columns_width_sm', vb($GLOBALS['site_parameters']['footer_columns_width_sm'], 4));
1518  $tpl->assign('footer_columns_width_md', vb($GLOBALS['site_parameters']['footer_columns_width_md'], 3));
1519  $tpl->assign('site', $GLOBALS['site']);
1520  $tpl->assign('propulse', $GLOBALS['STR_PROPULSE']);
1521  // Valeur par défaut de la colonne de liens du footer
1522  $tplLinks = array();
1523  $tplLinks['legal'] = array('href' => get_url('legal'), 'label' => $GLOBALS['STR_LEGAL_INFORMATION'], 'selected' => defined('IN_INFO_LEGALE'));
1524  $tplLinks['cgv'] = array('href' => get_url('cgv'), 'label' => $GLOBALS['STR_CGV'], 'selected' => defined('IN_CGV'));
1525  if (check_if_module_active('parrainage')) {
1526  $tplLinks['parrain'] = array('href' => get_url('/modules/parrainage/conditions.php'), 'label' => $GLOBALS['STR_CONDITION_PARRAIN'], 'selected' => defined('IN_CONDITION_PARRAIN'));
1527  }
1528  if (check_if_module_active('affiliation')) {
1529  $tplLinks['affiliate'] = array('href' => get_url('/modules/affiliation/conditions.php'), 'label' => $GLOBALS['STR_CONDITION_AFFILI'], 'selected' => defined('IN_CONDITION_AFFILI'));
1530  }
1531  $tpl->assign('links', vb($GLOBALS['site_parameters']['footer_links'], $tplLinks));
1532  $tpl->assign('links_2', vb($GLOBALS['site_parameters']['footer_links_2'], array()));
1533  if (empty($GLOBALS['site_parameters']['social_icons_disable'])) {
1534  $tpl->assign('rss', affiche_social_icons(true));
1535  $tpl->assign('facebook_page', null);
1536  } elseif (check_if_module_active('facebook')) {
1537  $tpl->assign('facebook_page', get_facebook_page('Facebook'));
1538  }
1539  if(function_exists('get_footer_additional')) {
1540  $tpl->assign('footer_additional', get_footer_additional());
1541  } else {
1542  $tpl->assign('footer_additional', vb($GLOBALS['site_parameters']['footer_additional']));
1543  }
1544  if(function_exists('get_footer_additional_link')) {
1545  $tpl->assign('footer_additional_link', get_footer_additional_link());
1546  } else {
1547  $tpl->assign('footer_additional_link', vb($GLOBALS['site_parameters']['get_footer_additional_link']));
1548  }
1549  $tpl->assign('STR_SITE_GENERATOR', $GLOBALS['STR_SITE_GENERATOR']);
1550  if ($return_mode) {
1551  return $tpl->fetch();
1552  } else {
1553  echo $tpl->fetch();
1554  }
1555  }
1556 }
1557 
1558 if (!function_exists('affiche_social_icons')) {
1565  function affiche_social_icons($return_mode = false)
1566  {
1567  $output = '';
1568  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/rss_func.tpl');
1569  if (empty($GLOBALS['site_parameters']['rss_page_link_disable']) && check_if_module_active('rss')) {
1570  if (check_if_module_active('annonces')) {
1571  $tpl->assign('href', get_url('/modules/annonces/rss.php'));
1572  $tpl->assign('rss_new_window', false);
1573  } else {
1574  $tpl->assign('href', $GLOBALS['wwwroot'] . '/modules/rss/rss.php');
1575  $tpl->assign('rss_new_window', true);
1576  }
1577  $tpl->assign('src', $GLOBALS['repertoire_images'] . '/rss.png');
1578  $load = true;
1579  }
1580  if (!empty($GLOBALS['site_parameters']['facebook_page_link'])) {
1581  $tpl->assign('fb_href', $GLOBALS['site_parameters']['facebook_page_link']);
1582  $tpl->assign('fb_src', $GLOBALS['repertoire_images'] . '/facebook.png');
1583  $load = true;
1584  }
1585  if (!empty($GLOBALS['site_parameters']['twitter_page_link'])) {
1586  $tpl->assign('twitter_href', $GLOBALS['site_parameters']['twitter_page_link']);
1587  $tpl->assign('twitter_src', $GLOBALS['repertoire_images'] . '/twitter.png');
1588  $load = true;
1589  }
1590  if (!empty($GLOBALS['site_parameters']['googleplus_page_link'])) {
1591  $tpl->assign('googleplus_href', $GLOBALS['site_parameters']['googleplus_page_link']);
1592  $tpl->assign('googleplus_src', $GLOBALS['repertoire_images'] . '/googleplus.png');
1593  $load = true;
1594  }
1595  if(!empty($load)) {
1596  $tpl->assign('block_columns_width_sm', vb($GLOBALS['site_parameters']['footer_columns_width_sm'], 4));
1597  $tpl->assign('block_columns_width_md', vb($GLOBALS['site_parameters']['footer_columns_width_md'], 3));
1598  $output .= $tpl->fetch();
1599  }
1600  if ($return_mode) {
1601  return $output;
1602  } else {
1603  echo $output;
1604  }
1605  }
1606 }
1607 
1608 if (!function_exists('affiche_compte')) {
1616  function affiche_compte($return_mode = false, $location)
1617  {
1618  $output = '';
1619  if (est_identifie()) {
1620  $tpl = $GLOBALS['tplEngine']->createTemplate('compte_mini.tpl');
1621  $tpl->assign('location', $location);
1622  $tpl->assign('repertoire_images', $GLOBALS['repertoire_images']);
1623  $tpl->assign('membre_href', get_url('membre'));
1624  $tpl->assign('prenom', vb($_SESSION['session_utilisateur']['prenom']));
1625  $tpl->assign('nom_famille', vb($_SESSION['session_utilisateur']['nom_famille']));
1626  $tpl->assign('sortie_href', get_url('sortie'));
1627  if (function_exists('get_social_icone')) {
1628  $tpl->assign('social_icone', get_social_icone());
1629  }
1630  $tpl->assign('compte_href', get_account_url(false, false));
1631  $tpl->assign('history_href', get_url('/achat/historique_commandes.php'));
1632  if (check_if_module_active('facebook_connect') && !empty($_SESSION['session_utilisateur']['connected_by_fb'])) {
1633  $tpl->assign('fb_deconnect_lbl', $GLOBALS['STR_FB_DECONNECT']);
1634  }
1635  if (a_priv('admin*', true)) {
1636  $tpl->assign('admin', array('href' => $GLOBALS['administrer_url'] . '/index.php', 'txt' => $GLOBALS['STR_ADMINISTRATION']));
1637  }
1638  if (!empty($GLOBALS['site_parameters']['quick_add_product_from_search_page'])) {
1639  $tpl->assign('quick_add_product_from_search_page_href', $GLOBALS['wwwroot'] . '/search.php?type=quick_add_product_from_search_page');
1640  }
1641  $tpl->assign('STR_HELLO', $GLOBALS['STR_HELLO']);
1642  $tpl->assign('STR_COMPTE', $GLOBALS['STR_COMPTE']);
1643  $tpl->assign('STR_DECONNECT', $GLOBALS['STR_DECONNECT']);
1644  $tpl->assign('STR_ORDER_HISTORY', $GLOBALS['STR_ORDER_HISTORY']);
1645  $output .= $tpl->fetch();
1646  } else {
1647  $tpl = $GLOBALS['tplEngine']->createTemplate('compte_login_mini.tpl');
1648  $tpl->assign('location', $location);
1649  $tpl->assign('repertoire_images', $GLOBALS['repertoire_images']);
1650  $tpl->assign('email_lbl', $GLOBALS['STR_EMAIL']);
1651  $tpl->assign('email', vb($frm['email']));
1652  $tpl->assign('password_lbl', $GLOBALS['STR_PASSWORD']);
1653  $tpl->assign('password', vb($frm['mot_passe']));
1654  $tpl->assign('TOKEN', get_form_token_input('membre.php', true));
1655  $tpl->assign('forgot_pass_href', get_url('/utilisateurs/oubli_mot_passe.php'));
1656  $tpl->assign('forgot_pass_lbl', $GLOBALS['STR_FORGOT_YOUR_PASSWORD']);
1657  if (empty($GLOBALS['site_parameters']['disable_register_button_on_login_form'])) {
1658  $url_enregistrement = get_account_register_url(false, false);
1659  $tpl->assign('enregistrement_href', $url_enregistrement);
1660  $tpl->assign('enregistrement_lbl', $GLOBALS['STR_OPEN_ACCOUNT']);
1661  }
1662  $tpl->assign('via_lbl', $GLOBALS['STR_VIA']);
1663  if (function_exists('get_social_icone')) {
1664  $tpl->assign('social_icone', get_social_icone());
1665  }
1666  $social = array('is_any' => false);
1667  if (check_if_module_active('facebook_connect')) {
1668  $social['is_any'] = true;
1669  $social['facebook'] = get_facebook_connect_btn();
1670  }
1671  if (check_if_module_active('sign_in_twitter')) {
1672  $social['is_any'] = true;
1673  $social['twitter'] = get_sign_in_twitter_btn();
1674  }
1675  if (check_if_module_active('openid')) {
1676  $social['is_any'] = true;
1677  $social['openid'] = get_openid_btn();
1678  }
1679  $tpl->assign('social', $social);
1680  $tpl->assign('STR_COMPTE', $GLOBALS['STR_COMPTE']);
1681  $tpl->assign('STR_LOGIN', $GLOBALS['STR_LOGIN']);
1682  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
1683  $output .= $tpl->fetch();
1684  }
1685  if ($return_mode) {
1686  return $output;
1687  } else {
1688  echo $output;
1689  }
1690  }
1691 }
1692 
1693 if (!function_exists('getHTMLHead')) {
1700  function getHTMLHead($page_name, &$category_introduction_text)
1701  {
1702  $output = '';
1703  $js_output = '';
1704  $tpl = $GLOBALS['tplEngine']->createTemplate('HTMLHead.tpl');
1705  if (check_if_module_active('facebook')) {
1706  $tpl->assign('head_attributes', get_facebook_xmlns());
1707  }
1708  if(!empty($GLOBALS['meta_rss_links_array'])){
1709  $link_rss_html = '';
1710  foreach($GLOBALS['meta_rss_links_array'] as $this_title => $this_url){
1711  $link_rss_html .= '
1712  <link rel="alternate" type="application/rss+xml" title="'.String::str_form_value($this_title).'" href="'.String::str_form_value($this_url).'" />';
1713  }
1714  $tpl->assign('link_rss_html', $link_rss_html);
1715  }
1716  if (!empty($page_name)) {
1717  $tpl->assign('meta', affiche_meta($page_name, true));
1718  } else {
1719  if (defined('IN_PARTNER')) {
1720  $default_title = $GLOBALS['STR_OUR_PARTNER'];
1721  } elseif (defined('IN_MAP')) {
1722  $default_title = $GLOBALS['STR_WORD_RESELLER'];
1723  } elseif (defined('IN_RETAILER')) {
1724  $default_title = $GLOBALS['STR_RETAILER_SUBSCRIBE'];
1725  } elseif (defined('IN_REFERENCE')) {
1726  $default_title = $GLOBALS['STR_REFERENCE_ON_LINE_SHOP'];
1727  } elseif (defined('IN_DEVIS')) {
1728  $default_title = $GLOBALS['STR_DEVIS_ON_LINE_SHOP'];
1729  } elseif (defined('IN_DOWNLOAD_PEEL') && !empty($GLOBALS['STR_MODULE_PEEL_DOWNLOAD_PEEL'])) {
1730  $default_title = $GLOBALS['STR_MODULE_PEEL_DOWNLOAD_PEEL'];
1731  } else {
1732  $default_title = null;
1733  }
1734  $tpl->assign('meta', affiche_meta($default_title, true));
1735  }
1736 
1737  if (!empty($GLOBALS['site_parameters']['favicon'])) {
1738  $tpl->assign('favicon_href', $GLOBALS['repertoire_upload'] . '/' . $GLOBALS['site_parameters']['favicon']);
1739  }
1740  if (check_if_module_active('vitrine')) {
1741  $GLOBALS['css_files'][] = get_url('/modules/vitrine/css/vitrine.css');
1742  }
1743  if (check_if_module_active('annonces')) {
1744  $GLOBALS['css_files'][] = get_url('/modules/annonces/rating_bar/rating.css');
1745  $GLOBALS['css_files'][] = get_url('/modules/annonces/annonces.css');
1746  }
1747  if (check_if_module_active('carrousel')) {
1748  // Librairie pour activer le carrousel Module a la carte et partenaire
1749  // Chargé exprès sur toutes les pages pour avoir fichier CSS minifié unique
1750  $GLOBALS['css_files'][] = get_url('/modules/carrousel/css/carrousel.css');
1751  $GLOBALS['js_files'][-21] = get_url('/modules/carrousel/js/carrousel.js');
1752  }
1753  if (empty($GLOBALS['site_parameters']['lightbox_disable']) || !empty($GLOBALS['lightbox_force'])) {
1754  // Lightbox peut servir à différents endroits du logiciel. Si on est sûr qu'on ne s'en sert pas, on peut le désactiver avec disable_lightbox
1755  $GLOBALS['css_files'][] = get_url('/lib/css/lightbox.css');
1756  if (!empty($GLOBALS['lightbox_force'])) {
1757  // On n'utilise la lightbox qu'exceptionnellement, on ne veut donc pas que ce soit minifié avec le reste
1758  $GLOBALS['site_parameters']['minify_css_exclude_array'][] = 'lightbox.css';
1759  }
1760  }
1761  if (vb($GLOBALS['site_parameters']['zoom']) == 'jqzoom' && vb($GLOBALS['site_parameters']['enable_jquery']) == 1) {
1762  $GLOBALS['css_files'][] = get_url('/lib/css/jqzoom.css');
1763  } elseif (vb($GLOBALS['site_parameters']['zoom']) == 'cloud-zoom' && vb($GLOBALS['site_parameters']['enable_jquery']) == 1) {
1764  $GLOBALS['css_files'][] = get_url('/lib/css/cloudzoom.css');
1765  }
1766  // Début des javascripts
1767  if (check_if_module_active('fianet')) {
1768  $GLOBALS['js_files'][] = get_url('/modules/fianet/lib/js/fianet.js');
1769  }
1770  if (vb($GLOBALS['site_parameters']['enable_jquery']) == 1) {
1771  $GLOBALS['js_files'][-100] = get_url('/lib/js/jquery.js');
1772  }
1773  $GLOBALS['css_files'][] = get_url('/lib/css/jquery-ui.css');
1774  $GLOBALS['js_files'][-90] = get_url('/lib/js/jquery-ui.js');
1775  if(file_exists($GLOBALS['dirroot'] . '/lib/js/jquery.ui.datepicker-'.$_SESSION['session_langue'].'.js')) {
1776  // Configuration pour une langue donnée
1777  $GLOBALS['js_files'][] = get_url('/lib/js/jquery.ui.datepicker-'.$_SESSION['session_langue'].'.js');
1778  }
1779  // <!-- librairie pour activer le zoom sur les categories (et produits si configuration dans l'administration) -->
1780  if (empty($GLOBALS['site_parameters']['lightbox_disable']) || !empty($GLOBALS['lightbox_force'])) {
1781  // Lightbox peut servir à différents endroits du logiciel. Si on est sûr qu'on ne s'en sert pas, on peut le désactiver avec disable_lightbox
1782  $GLOBALS['js_files'][] = get_url('/lib/js/lightbox.js');
1783  if (!empty($GLOBALS['lightbox_force'])) {
1784  // On n'utilise la lightbox qu'exceptionnellement, on ne veut donc pas que ce soit minifié avec le reste
1785  $GLOBALS['site_parameters']['minify_js_exclude_array'][] = 'lightbox.js';
1786  }
1787  }
1788  // <!-- fin de librairie pour activer le zoom sur les categories -->
1789  if (vb($GLOBALS['site_parameters']['enable_prototype']) == 1 && empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
1790  $GLOBALS['js_files'][] = get_url('/lib/js/prototype.js');
1791  $GLOBALS['js_files'][] = get_url('/lib/js/effects.js');
1792  $GLOBALS['js_files'][] = get_url('/lib/js/controls.js');
1793  }
1794  if (check_if_module_active('annonces')) {
1795  $GLOBALS['js_files'][] = get_url('/modules/annonces/rating_bar/js/rating.js');
1796  }
1797  if (!empty($GLOBALS['load_anythingslider'])) {
1798  // Pour ajouter des vidéos ou des effets au carrousel nivo_slider, il faut inclure les fichiers suivants :
1799  // AnythingSlider optional extensions
1800  // $GLOBALS['js_files_nominify'][-18] = get_url('/modules/carrousel/js/jquery.anythingslider.fx.min.js');
1801  // $GLOBALS['js_files_nominify'][-17] = get_url('/modules/carrousel/js/jquery.anythingslider.video.min.js');
1802  $GLOBALS['js_files_nominify'][-19] = get_url('/modules/carrousel/js/jquery.anythingslider.min.js');
1803  }
1804  if (((defined('IN_RUBRIQUE') && vb($rub['technical_code']) == 'creation') || (defined('IN_REFERENCE') && !empty($GLOBALS['site_parameters']['affiche_reference_multipage_with_pheonix_gallery']))) && check_if_module_active('references')) {
1805  $GLOBALS['css_files'][] = get_url('/modules/references/style/style.css');
1806  $GLOBALS['css_files'][] = get_url('/modules/references/phoenixgallery/style/style.css');
1807  $GLOBALS['js_files'][-60] = get_url('/lib/js/jquery.easing.min.js');
1808  $GLOBALS['js_files'][] = get_url('/modules/references/phoenixgallery/js/phoenixgallery.js');
1809  }
1810  if (defined('IN_CONTACT') && check_if_module_active('photodesk')) {
1811  $GLOBALS['css_files'][] = get_url('/modules/photodesk/css/style.css');
1812  $GLOBALS['js_files'][-50] = get_url('/modules/photodesk/js/jquery.transform-0.6.2.min.js');
1813  $GLOBALS['js_files'][-49] = get_url('/modules/photodesk/js/jquery.animate-shadow-min.js');
1814  $GLOBALS['js_files'][-48] = get_url('/modules/photodesk/js/jquery-ui-1.8.16.custom.min.js');
1815  $GLOBALS['js_files'][-47] = get_url('/modules/photodesk/js/photodesk.js');
1816  }
1817  // Librairie pour activer le zoom sur les produits
1818  if (check_if_module_active('welcome_ad')) {
1819  $js_output .= get_welcome_ad_script();
1820  }
1821  if ($GLOBALS['site_parameters']['zoom'] == 'jqzoom' && $GLOBALS['site_parameters']['enable_jquery'] == 1) {
1822  $GLOBALS['js_files'][-70] = get_url('/lib/js/jquery.jqzoom-core-pack.js');
1823  } elseif ($GLOBALS['site_parameters']['zoom'] == 'cloud-zoom' && $GLOBALS['site_parameters']['enable_jquery'] == 1) {
1824  $GLOBALS['js_files'][] = get_url('/lib/js/cloud-zoom.1.0.2.js');
1825  }
1826  foreach($GLOBALS['modules_installed'] as $this_module) {
1827  if(!empty($GLOBALS['site_parameters']['modules_front_office_js_array'][$this_module])) {
1828  $GLOBALS['js_files'][] = get_url($GLOBALS['site_parameters']['modules_front_office_js_array'][$this_module]);
1829  }
1830  }
1831  if (check_if_module_active('cart_popup') && !empty($_SESSION['session_show_caddie_popup'])) {
1832  $js_output .= get_cart_popup_script();
1833  unset($_SESSION['session_show_caddie_popup']);
1834  }
1835  if (check_if_module_active('googlefriendconnect')) {
1836  $js_output .= google_friend_connect_javascript_library();
1837  }
1838  $GLOBALS['js_ready_content_array'][] = get_datepicker_javascript() . '
1839  '.vb($js_sortable).'
1840 ';
1841  if (empty($GLOBALS['site_parameters']['disable_autocomplete'])) {
1842  // Barre de recherche principale
1843  $GLOBALS['js_ready_content_array'][] = '
1844  bind_search_autocomplete("search", "' . $GLOBALS['wwwroot'] . '/modules/search/produit.php", true);
1845 ';
1846  }
1847  if (empty($GLOBALS['site_parameters']['autocomplete_search_advanced_enable'])) {
1848  // Formulaire de recherche avancée, pas adapté a priori à l'autocomplete en terme d'usage, mais parfois l'autocomplete peut être souhaité
1849  $GLOBALS['js_ready_content_array'][] = '
1850  bind_search_autocomplete("search_advanced", "' . $GLOBALS['wwwroot'] . '/modules/search/produit.php", true);
1851 ';
1852  }
1853  if(!empty($GLOBALS['load_nyromodal'])){
1854  // Nyromodal ne charge pas en asynchrone, si nyromodal est activé on désactive l'asynchrone pour permettre au 'diaporama' Nyromodal de fonctionner.
1855  $GLOBALS['site_parameters']['load_javascript_async'] = false;
1856  $GLOBALS['css_files'][] = get_url('/lib/css/nyroModal.css');
1857  $GLOBALS['js_files'][] = get_url('/lib/js/jquery.nyroModal.custom.js');
1858 
1859  $GLOBALS['js_ready_content_array'][] = '
1860  $(function() {
1861  $(".nyroModal").nyroModal();
1862  });
1863 ';
1864  }
1865  if(!empty($GLOBALS['site_parameters']['scroll_to_top'])) {
1866  // Footer sur toutes les pages
1867  $GLOBALS['js_ready_content_array'][] = '
1868  // Compatibilité pour iOS
1869  $(document).touchmove(function() { advisto_scroll() });
1870  $(window).scroll(function() { advisto_scroll() });
1871  function advisto_scroll() {
1872  if ($(document).scrollTop() > 100) {
1873  if($(".scroll_to_top").css("display") == "none") {
1874  $(".scroll_to_top").stop(true, false).show(800);
1875  }
1876  } else if($(".scroll_to_top").css("display") != "none") {
1877  $(".scroll_to_top").stop(true, false).hide(400);
1878  }
1879  }
1880 ';
1881  }
1882  if(!empty($GLOBALS['site_parameters']['images_preload_urls_array'])) {
1883  foreach($GLOBALS['site_parameters']['images_preload_urls_array'] as $this_image_url) {
1884  if (String::strpos($this_image_url, '//') === false) {
1885  $this_image = $GLOBALS['wwwroot'] . $this_image_url;
1886  }
1887  $GLOBALS['js_content_array'][] = '
1888  loadImage=new Image();
1889  loadImage.src="' . $this_image_url . '";';
1890  }
1891  }
1892  // On met Bootstrap en dernier fichier CSS du site pour qu'ils aient priorité
1893  if(!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
1894  $GLOBALS['css_files'][] = get_url('/lib/css/bootstrap.css');
1895  $GLOBALS['js_files'][] = $GLOBALS['wwwroot_in_admin'] . '/lib/js/bootstrap.js';
1896  $GLOBALS['js_ready_content_array'][] = '
1897  bootbox.setDefaults({
1898  locale: "'.$_SESSION['session_langue'].'"
1899  });';
1900  }
1901  $GLOBALS['js_files'][] = get_url('/lib/js/advisto.js');
1902  if (vb($GLOBALS['site_parameters']['anim_prod']) == 1) {
1903  $GLOBALS['js_files'][] = get_url('/lib/js/fly-to-basket.js');
1904  }
1905  if(!empty($GLOBALS['site_parameters']['css'])) {
1906  foreach (get_array_from_string($GLOBALS['site_parameters']['css']) as $this_css_file) {
1907  $this_css_file = trim($this_css_file);
1908  if (String::strpos($this_css_file, '//') !== false) {
1909  $GLOBALS['css_files'][] = $this_css_file;
1910  } elseif(file_exists($GLOBALS['repertoire_modele'] . '/css/' . $this_css_file)) {
1911  $GLOBALS['css_files'][] = $GLOBALS['repertoire_css'] . '/' . $this_css_file; // .'?'.time()
1912  }
1913  }
1914  }
1915 
1916  $tpl->assign('css_files', get_css_files_to_load(!empty($GLOBALS['site_parameters']['minify_css'])));
1917 
1918  // L'ordre des fichiers js doit être respecté ensuite dans le template
1919  if (!empty($GLOBALS['site_parameters']['javascript_force_load_header'])) {
1920  $tpl->assign('js_output', $js_output . get_javascript_output(false, !empty($GLOBALS['site_parameters']['minify_js']), empty($GLOBALS['site_parameters']['javascript_content_force_load_header'])));
1921  } else {
1922  $tpl->assign('js_output', $js_output);
1923  }
1924  $tpl->assign('msg_err_keyb', $GLOBALS['STR_ERR_KEYB']);
1925 
1926  if (isset($_GET['catid'])) {
1927  $queryCP = query('SELECT header_html_' . $_SESSION['session_langue'] . ' AS category_introduction_text, background_menu, background_color
1928  FROM peel_categories
1929  WHERE id="' . intval($_GET['catid']) . '" AND ' . get_filter_site_cond('categories') . '');
1930  if ($CP = fetch_object($queryCP)) {
1931  // $category_introduction_text is a reference of a global variable => it will be used outside this function
1932  $category_introduction_text = String::html_entity_decode_if_needed(trim($CP->category_introduction_text));
1933  $background_menu = String::html_entity_decode_if_needed($CP->background_menu);
1934  $background_color = String::html_entity_decode_if_needed($CP->background_color);
1935 
1936  if (strlen($background_color) > 1 || strlen($background_menu) > 1) {
1937  $tpl->assign('bg_colors', array('body' => $background_color,
1938  'menu' => $background_menu
1939  ));
1940  }
1941  }
1942  }
1943  $output .= $tpl->fetch();
1944  return $output;
1945  }
1946 }
1947 
1948 if (!function_exists('get_menu')) {
1954  function get_menu()
1955  {
1956  // Android et Windows mobile déclenchent le hover en même temps que le clic sur un lien, contrairement à iOS sur iPad et iPhone
1957  $avoid_links_when_hover = !empty($GLOBALS['site_parameters']['bootstrap_enabled']) && (String::strpos(String::strtolower(vb($_SERVER['HTTP_USER_AGENT'])),'android') !== false || (String::strpos(String::strtolower(vb($_SERVER['HTTP_USER_AGENT'])),'windows') !== false && String::strpos(String::strtolower(vb($_SERVER['HTTP_USER_AGENT'])),'mobile') !== false));
1958  if (!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
1959  // bootstrap est actif, l'affichage de l'arborescence des catégories est faite via des sous menu distinct, qui s'affiche au survol de la souris. Il n'est pas nécessaire de mettre une indentation en plus.
1960  $indent = '';
1961  } else {
1962  // Menu sans bootstrap, les sous catégories sont décallées par rapport à la catégorie mère, pour permettre un affichage clair de l'arborescence
1963  $indent = '&nbsp;&nbsp;';
1964  }
1965  if (empty($GLOBALS['main_menu_items']) || isset($GLOBALS['site_parameters']['main_menu_items_if_available'])) {
1966  $GLOBALS['main_menu_items']['home'] = array($GLOBALS['wwwroot'] . '/' => $GLOBALS['STR_HOME']);
1967  $GLOBALS['main_menu_items']['catalog'] = array(get_product_category_url() => $GLOBALS['STR_CATALOGUE']);
1968  $GLOBALS['main_menu_items']['news'] = array(get_product_category_url() . 'nouveautes.php' => $GLOBALS['STR_NOUVEAUTES']);
1969  $GLOBALS['main_menu_items']['content'] = array(get_content_category_url() => $GLOBALS["STR_INFORMATIONS"]);
1970  $GLOBALS['main_menu_items']['other'] = array('#' => $GLOBALS["STR_OTHER"]);
1971  $GLOBALS['main_menu_items']['faq'] = array(get_url('/modules/faq/faq.php') => $GLOBALS['STR_FAQ_TITLE']);
1972  $GLOBALS['main_menu_items']['brand'] = array(get_url('/achat/marque.php') => $GLOBALS['STR_ALL_BRAND']);
1973  $GLOBALS['main_menu_items']['contact_us'] = array(get_url('/contacts.php') => $GLOBALS['STR_CONTACT_US']);
1974  $GLOBALS['main_menu_items']['flash'][get_url('/modules/flash/flash.php')] = $GLOBALS['STR_FLASH'];
1975  $GLOBALS['main_menu_items']['promotions'][get_product_category_url() . 'promotions.php'] = $GLOBALS['STR_PROMOTIONS'];
1976  $GLOBALS['main_menu_items']['reseller'][get_url('/modules/reseller/retailer.php')] = $GLOBALS['STR_RETAILER'];
1977  if (!empty($GLOBALS['site_parameters']['enable_create_product_in_front'])) {
1978  $result = fetch_assoc(query("SELECT id FROM peel_categories WHERE technical_code = 'show_draft' AND etat = 1 AND " . get_filter_site_cond('categories') . ""));
1979  if (!empty($result['id'])) {
1980  $GLOBALS['main_menu_items']['draft'] = array(get_product_category_url($result['id']) => $GLOBALS['STR_MODULE_CREATE_PRODUCT_IN_FRONT_OFFICE_SORTIE_SAVE_DRAFT']);
1981  }
1982  }
1983  if (est_identifie()) {
1984  $GLOBALS['main_menu_items']['account'] = array(get_account_url(false, false) => $GLOBALS['STR_COMPTE']);
1985  if(!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
1986  $GLOBALS['menu_items']['account'][get_account_url(false, false)] = $GLOBALS['STR_COMPTE'];
1987  }
1988  $GLOBALS['menu_items']['account'][get_product_category_url() . 'historique_commandes.php'] = $GLOBALS['STR_ORDER_HISTORY'];
1989  $GLOBALS['menu_items']['account'][get_url('/utilisateurs/change_mot_passe.php')] = $GLOBALS['STR_CHANGE_PASSWORD'];
1990  if (check_if_module_active('cart_preservation')) {
1991  $GLOBALS['menu_items']['account'][get_url('/modules/cart_preservation/cart_preservation.php')] = $GLOBALS['STR_CART_PRESERVATION_TITLE'];
1992  }
1993  $GLOBALS['menu_items']['account'][get_url('/utilisateurs/change_params.php')] = $GLOBALS['STR_CHANGE_PARAMS'];
1994  $GLOBALS['menu_items']['account'][get_url('sortie')] = $GLOBALS['STR_LOGOUT'];
1995  } else {
1996  $GLOBALS['main_menu_items']['account'] = array(get_url('membre') => $GLOBALS['STR_COMPTE']);
1997  }
1998  $GLOBALS['main_menu_items']['contact'] = array(get_contact_url(false, false) => $GLOBALS['STR_CONTACT']);
1999  if(!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
2000  $GLOBALS['menu_items']['contact'][get_contact_url(false, false)] = $GLOBALS['STR_CONTACT'];
2001  }
2002  $GLOBALS['menu_items']['contact'][get_url('/plan_acces.php')] = $GLOBALS['STR_ACCESS_PLAN'];
2003  if (a_priv('admin*', true)) {
2004  $GLOBALS['main_menu_items']['admin'] = array($GLOBALS['administrer_url'] . '/' => $GLOBALS['STR_ADMIN']);
2005  }
2006  $GLOBALS['menu_items']['news'][get_product_category_url() . 'promotions.php'] = $GLOBALS['STR_PROMOTIONS'];
2007  if (is_flash_active_on_site()) {
2008  $GLOBALS['menu_items']['news'][get_url('/modules/flash/flash.php')] = $GLOBALS['STR_FLASH'];
2009  }
2010  if (check_if_module_active('devis')) {
2011  $GLOBALS['menu_items']['devis'][get_url('/modules/devis/devis.php')] = $GLOBALS['STR_DEVIS'];
2012  } else {
2013  $GLOBALS['menu_items']['devis'] = array();
2014  }
2015  foreach(vb($GLOBALS['site_parameters']['main_menu_custom_titles'], array()) as $this_key => $this_title) {
2016  $GLOBALS['main_menu_items'][$this_key][vb($GLOBALS['site_parameters']['main_menu_custom_urls'][$this_key], '#')] = $this_title;
2017  }
2018  $hook_result = call_module_hook('menu_items', array('indent' => $indent), 'array');
2019  $GLOBALS['main_menu_items'] = array_merge_recursive($GLOBALS['main_menu_items'], vb($hook_result['main_menu_items'], array()));
2020  $GLOBALS['menu_items'] = array_merge_recursive($GLOBALS['menu_items'], vb($hook_result['menu_items'], array()));
2021  // $GLOBALS['main_menu_items']['news'] est ajouté dans le sous menu de "Autre" si il n'est pas présent dans les éléments principaux du menu
2022  $GLOBALS['menu_items']['other'] = array_merge($GLOBALS['main_menu_items']['catalog'], $GLOBALS['menu_items']['news'], (!in_array('news', $GLOBALS['site_parameters']['main_menu_items_if_available'])? $GLOBALS['main_menu_items']['news']:array()), array('' => 'divider'), $GLOBALS['menu_items']['contact'], $GLOBALS['menu_items']['devis'],(!in_array('contact', $GLOBALS['site_parameters']['main_menu_items_if_available'])? $GLOBALS['main_menu_items']['contact']:array()));
2023  }
2024  if(isset($GLOBALS['site_parameters']['main_menu_items_if_available']) && is_array($GLOBALS['site_parameters']['main_menu_items_if_available'])) {
2025  $temp = array();
2026  foreach($GLOBALS['site_parameters']['main_menu_items_if_available'] as $this_value) {
2027  if(isset($GLOBALS['main_menu_items'][$this_value])) {
2028  $temp[$this_value] = $GLOBALS['main_menu_items'][$this_value];
2029  }
2030  }
2031  $GLOBALS['main_menu_items'] = $temp;
2032  }
2033  // Préparation du contenu du menu catalogue produits
2034  if(!empty($GLOBALS['site_parameters']['product_categories_depth_in_menu'])) {
2035  $selected_item = intval(vn($_GET['catid']));
2036  $sql = 'SELECT c.id, c.parent_id, c.nom_' . $_SESSION['session_langue'] . ' as nom, parent_id
2037  FROM peel_categories c
2038  WHERE c.etat="1" AND nom_' . $_SESSION['session_langue'] . '!="" AND ' . get_filter_site_cond('categories', 'c') . ' ' . (!empty($GLOBALS['site_parameters']['categories_exclude_from_main_menu'])?' AND id NOT IN ("'.implode($GLOBALS['site_parameters']['categories_exclude_from_main_menu'], '","').'")':'') . '
2039  ORDER BY c.position ASC, nom ASC';
2040  $qid = query($sql);
2041  while ($result = fetch_assoc($qid)) {
2042  $all_parents_with_ordered_direct_sons_array[$result['parent_id']][] = $result['id'];
2043  $item_name_array[$result['id']] = $result['nom'];
2044  if(empty($result['parent_id'])) {
2045  $result['nom'] = String::strtoupper($result['nom']);
2046  }
2047  if(!empty($GLOBALS['site_parameters']['insert_product_categories_in_menu'])) {
2048  // Il faut définir par la suite cat_XX dans le paramètre main_menu_items_if_available depuis le back office pour que la catégorie s'affiche.
2049  if(!isset($GLOBALS['main_menu_items']["cat_" . $result['id']])) {
2050  $GLOBALS['main_menu_items']["cat_" . $result['id']] = array(get_product_category_url($result['id'], $result['nom']) => $result['nom']);
2051  }
2052  $GLOBALS['categories_level'][$result['parent_id']][] = "cat_" . $result['id'];
2053  }
2054  }
2055  $GLOBALS['submenu_html_array']['catalog'] = '';
2056  if(!empty($item_name_array) && !empty($GLOBALS['site_parameters']['product_categories_depth_in_menu'])) {
2057  $GLOBALS['submenu_html_array']['catalog'] .= '<ul class="sousMenu dropdown-menu" role="menu">'.get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, 0, 0, $selected_item, 'categories', 'left', vn($GLOBALS['site_parameters']['product_categories_depth_in_menu']), vb($GLOBALS['site_parameters']['categories_top_menu_item_max_length'], 25), 'list', $indent, null).'</ul>';
2058  foreach($item_name_array as $catid => $nom) {
2059  if (!empty($all_parents_with_ordered_direct_sons_array[$catid]) && !isset($GLOBALS['submenu_html_array']["cat_".$catid])) {
2060  $GLOBALS['submenu_html_array']["cat_".$catid] = '<ul class="sousMenu dropdown-menu" role="menu">';
2061  if(!empty($GLOBALS['site_parameters']['submenus_include_products'])) {
2062  // Récupération de liste de produits de la catégorie concernée
2063  $sql_offre = 'SELECT p.nom_' . $_SESSION['session_langue'] . ' AS nom_produit, p.id
2064  FROM peel_produits p
2065  INNER JOIN peel_produits_categories pc ON pc.produit_id = p.id
2066  INNER JOIN peel_categories c ON pc.categorie_id = c.id
2067  WHERE p.etat="1" AND p.nom_' . $_SESSION['session_langue'] . '!="" AND pc.categorie_id="'.intval($catid).'"
2068  GROUP BY p.id
2069  ORDER BY p.`position` ASC, p.id ASC';
2070  $qid = query($sql_offre);
2071  while ($result = fetch_assoc($qid)) {
2072  $product_object = new Product($result['id']);
2073  $GLOBALS['submenu_html_array']["cat_".$catid] .= '<li><a href="'. $product_object->get_product_url(). '">' . $result['nom_produit'] . '</a></li>';
2074  unset($product_object);
2075  }
2076  }
2077  $GLOBALS['submenu_html_array']["cat_".$catid] .= get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, $catid, 0, $selected_item, 'categories', 'left', vn($GLOBALS['site_parameters']['product_categories_depth_in_menu']), vb($GLOBALS['site_parameters']['categories_submenu_item_max_length'], 50), 'list', $indent, null);
2078  if($avoid_links_when_hover) {
2079  // Si le lien n'est pas généré dans le menu pour une catégorie mère, il faut ajouter ce lien dans le sous menu pour que la catégorie mère reste accessible
2080  // On utilise array_shift( array_keys() ) car array_keys()[0] n'est disponible qu'à partir de la version 5.4 de PHP
2081  // array_shift() extrait la première valeur d'un tableau et la retourne, en raccourcissant le tableau d'un élément, et en déplaçant tous les éléments vers le bas. Toutes les clés numériques seront modifiées pour commencer à zéro.
2082  $GLOBALS['submenu_html_array']["cat_".$catid] .= '<li><a href="'. array_shift(array_keys($GLOBALS['main_menu_items']["cat_".$catid])) . '">' . array_shift(array_values($GLOBALS['main_menu_items']["cat_".$catid])) . '</a></li>';
2083  }
2084  $GLOBALS['submenu_html_array']["cat_".$catid] .='</ul>';
2085  }
2086  }
2087  }
2088  } elseif (check_if_module_active('sauvegarde_recherche') && est_identifie()) {
2089  $GLOBALS['submenu_html_array']['catalog'] .= '<ul class="sousMenu dropdown-menu" role="menu">'.display_ads_search_list($_SESSION['session_utilisateur']['id_utilisateur'], true).'</ul>';
2090  }
2091 
2092  // Lien d'articles dans le menu
2093  if(!empty($GLOBALS['site_parameters']['insert_article_in_menu'])) {
2094  $sql = 'SELECT a.id, a.on_reseller, a.titre_' . $_SESSION['session_langue'] . ' as nom
2095  FROM peel_articles a
2096  WHERE a.etat = "1" AND a.technical_code NOT IN ("other", "iphone_content") AND a.position>=0 AND ' . get_filter_site_cond('articles', 'a') . '
2097  ORDER BY a.position ASC, nom ASC';
2098  $qid = query($sql);
2099 
2100  while ($result = fetch_assoc($qid)) {
2101  if ((!a_priv("admin_product") && !a_priv("reve")) && $result['on_reseller'] == 1) {
2102  continue;
2103  } else {
2104  // Il faut définir par la suite art_XX dans le paramètre main_menu_items_if_available depuis le back office pour que la rubrique s'affiche.
2105  $GLOBALS['main_menu_items']["art_".$result['id']] = array(get_content_url($result['id']) => $result['nom']);
2106  }
2107  }
2108  }
2109 
2110  // Préparation du contenu du menu contenu rédactionnel
2111  if(!empty($GLOBALS['site_parameters']['content_categories_depth_in_menu'])) {
2112  // Au moins 1 niveau d'arborescence.
2113  $selected_item = intval(vn($_GET['rubid']));
2114  unset($all_parents_with_ordered_direct_sons_array);
2115  unset($item_name_array);
2116  $sql = 'SELECT r.id, r.parent_id, r.nom_' . $_SESSION['session_langue'] . ' AS nom
2117  FROM peel_rubriques r
2118  WHERE r.etat = "1" AND r.technical_code NOT IN ("other", "iphone_content") AND r.position>=0 AND ' . get_filter_site_cond('rubriques', 'r') . '
2119  ORDER BY r.position ASC, nom ASC';
2120  $qid = query($sql);
2121 
2122  while ($result = fetch_assoc($qid)) {
2123  $all_parents_with_ordered_direct_sons_array[$result['parent_id']][] = $result['id'];
2124  $item_name_array[$result['id']] = $result['nom'];
2125  if(!empty($GLOBALS['site_parameters']['insert_article_categories_in_menu'])) {
2126  // Il faut définir par la suite rub_XX dans le paramètre main_menu_items_if_available depuis le back office pour que la rubrique s'affiche.
2127  if(!isset($GLOBALS['main_menu_items']["rub_" . $result['id']])) {
2128  $GLOBALS['main_menu_items']["rub_".$result['id']] = array(get_content_category_url($result['id'], $result['nom']) => $result['nom']);
2129  }
2130  $GLOBALS['rubriques_level'][$result['parent_id']][] = "rub_" . $result['id'];
2131  }
2132  }
2133  $GLOBALS['submenu_html_array']['content'] = '';
2134  if(!empty($item_name_array)) {
2135  $GLOBALS['submenu_html_array']['content'] .= '<ul class="sousMenu dropdown-menu" role="menu">'.get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, 0, 0, $selected_item, 'rubriques', 'left', $GLOBALS['site_parameters']['content_categories_depth_in_menu'], vb($GLOBALS['site_parameters']['categories_top_menu_item_max_length'], 25), 'list', $indent, null).'</ul>';
2136  foreach($item_name_array as $rubid => $nom) {
2137  if(!isset($GLOBALS['submenu_html_array']["rub_".$rubid])) {
2138  if (!empty($GLOBALS['site_parameters']['insert_content_articles_in_menu'])) {
2139  // Affichage des articles de la rubrique dans le sous menu
2140  $sql = "SELECT a.id, a.titre_" . $_SESSION['session_langue'] . " as nom
2141  FROM peel_rubriques r
2142  INNER JOIN peel_articles_rubriques pc ON r.id = pc.rubrique_id
2143  INNER JOIN peel_articles a ON a.id = pc.article_id AND " . get_filter_site_cond('articles', 'a') . "
2144  WHERE r.id ='" . intval($rubid) . "' AND r.technical_code NOT IN ('other', 'iphone_content') AND " . get_filter_site_cond('rubriques', 'r') . "";
2145  $qid = query($sql);
2146  $GLOBALS['submenu_html_array']["rub_".$rubid] = '<ul class="sousMenu dropdown-menu" role="menu">';
2147  if($avoid_links_when_hover) {
2148  // Si le lien n'est pas généré dans le menu pour une rubrique mère, il faut ajouter ce lien dans le sous menu pour que la rubrique mère reste accessible
2149  $GLOBALS['submenu_html_array']["rub_".$rubid] .= '<li><a href="'. array_shift(array_keys($GLOBALS['main_menu_items']["rub_".$rubid])) . '">' . array_shift(array_values($GLOBALS['main_menu_items']["rub_".$rubid])) . '</a></li>';
2150  }
2151  while ($result = fetch_assoc($qid)) {
2152  $GLOBALS['submenu_html_array']["rub_".$rubid] .= '<li><a href="'. get_content_url($result['id']) . '">' . $result['nom'] . '</a></li>';
2153  }
2154  $GLOBALS['submenu_html_array']["rub_".$rubid] .= '</ul>';
2155  } elseif (!empty($all_parents_with_ordered_direct_sons_array[$rubid])) {
2156  // Affichage des sous-rubriques dans le sous-menu
2157  $GLOBALS['submenu_html_array']["rub_".$rubid] = '
2158  <ul class="sousMenu dropdown-menu" role="menu">' . get_recursive_items_display($all_parents_with_ordered_direct_sons_array, $item_name_array, $rubid, 0, $selected_item, 'rubriques', 'left', $GLOBALS['site_parameters']['content_categories_depth_in_menu'], vb($GLOBALS['site_parameters']['categories_submenu_item_max_length'], 50), 'list', $indent, null) . vb($article) .'</ul>';
2159  }
2160  }
2161  }
2162  }
2163  }
2164  if(in_array('brand',$GLOBALS['site_parameters']['main_menu_items_if_available'])) {
2165  $sql = "SELECT id, image, description_" . $_SESSION['session_langue'] . " AS description, nom_" . $_SESSION['session_langue'] . " AS nom
2166  FROM peel_marques
2167  WHERE etat=1 AND " . get_filter_site_cond('marques') . "
2168  ORDER BY position ASC, nom ASC";
2169  $query = query($sql);
2170 
2171  $GLOBALS['submenu_html_array']['brand'] = '<ul class="sousMenu dropdown-menu" role="menu">';
2172  while ($result = fetch_assoc($query)) {
2173  $GLOBALS['submenu_html_array']['brand'] .= '<li><a href="'.get_url('/achat/marque.php', array('id' => $result['id'])).'">
2174  '.$result['nom'].'
2175  </a></li>';
2176  }
2177  $GLOBALS['submenu_html_array']['brand'] .= '</ul>';
2178  }
2179  if(!empty($GLOBALS['site_parameters']['insert_article_in_menu'])) {
2180  // Lien d'articles (/lire/article_details.php) dans le menu principal. Il faut définir art_XX dans le paramètre main_menu_items_if_available depuis le back office pour que le lien de l'article s'affiche dans les onglets du menu principal
2181  $sql = 'SELECT a.id, a.titre_' . $_SESSION['session_langue'] . ' as nom
2182  FROM peel_articles a
2183  WHERE a.etat = "1" AND a.technical_code NOT IN ("other", "iphone_content") AND a.position>=0 AND ' . get_filter_site_cond('articles', 'a') . '
2184  ORDER BY a.position ASC, nom ASC';
2185  $qid = query($sql);
2186  while ($result = fetch_assoc($qid)) {
2187  // Charge tous les articles dans main_menu_items, qui sera filtré avec ce que contient main_menu_items_if_available quelques lignes en dessous
2188  $GLOBALS['main_menu_items']["art_".$result['id']] = array(get_content_url($result['id']) => $result['nom']);
2189  }
2190  }
2191 
2192  if(in_array('brand',$GLOBALS['site_parameters']['main_menu_items_if_available'])) {
2193  // On vérifie si "brand" fait parti des onglet à afficher au menu : administrable en back office
2194  // Récupération des infos liées aux marques
2195  $sql = "SELECT id, image, description_" . $_SESSION['session_langue'] . " AS description, nom_" . $_SESSION['session_langue'] . " AS nom
2196  FROM peel_marques
2197  WHERE etat=1 AND " . get_filter_site_cond('marques') . "
2198  ORDER BY position ASC, nom ASC";
2199  $query = query($sql);
2200  // On crée le sous menu des marques
2201  $GLOBALS['submenu_html_array']['brand'] = '<ul class="sousMenu dropdown-menu" role="menu">';
2202  while ($result = fetch_assoc($query)) {
2203  $GLOBALS['submenu_html_array']['brand'] .= '<li><a href="'.get_url('/achat/marque.php', array('id' => $result['id'])).'">
2204  '.$result['nom'].'
2205  </a></li>';
2206  }
2207  $GLOBALS['submenu_html_array']['brand'] .= '</ul>';
2208  }
2209  if(!empty($GLOBALS['site_parameters']['main_menu_items_if_available']) && is_array($GLOBALS['site_parameters']['main_menu_items_if_available'])) {
2210  $temp_main_menu_items = array();
2211  if(in_array('cat_*', $GLOBALS['site_parameters']['main_menu_items_if_available']) && !empty($GLOBALS['categories_level'][0])) {
2212  $new_menu = array();
2213  foreach($GLOBALS['site_parameters']['main_menu_items_if_available'] as $this_key => $this_value) {
2214  if($this_value=='cat_*') {
2215  foreach($GLOBALS['categories_level'][0] as $this_imported_value) {
2216  if(String::strpos($this_value, 'cat_') === 0) {
2217  $new_menu[] = $this_imported_value;
2218  }
2219  }
2220  } elseif(!is_numeric($this_key)) {
2221  $new_menu[$this_key] = $this_value;
2222  } else {
2223  $new_menu[] = $this_value;
2224  }
2225  }
2226  $GLOBALS['site_parameters']['main_menu_items_if_available'] = $new_menu;
2227  }
2228  if(in_array('rub_*', $GLOBALS['site_parameters']['main_menu_items_if_available']) && !empty($GLOBALS['rubriques_level'][0])) {
2229  $new_menu = array();
2230  foreach($GLOBALS['site_parameters']['main_menu_items_if_available'] as $this_key => $this_value) {
2231  if($this_value=='rub_*') {
2232  foreach($GLOBALS['rubriques_level'][0] as $this_imported_value) {
2233  if(String::strpos($this_value, 'rub_') === 0) {
2234  $new_menu[] = $this_imported_value;
2235  }
2236  }
2237  } elseif(!is_numeric($this_key)) {
2238  $new_menu[$this_key] = $this_value;
2239  } else {
2240  $new_menu[] = $this_value;
2241  }
2242  }
2243  $GLOBALS['site_parameters']['main_menu_items_if_available'] = $new_menu;
2244  }
2245  $custom = 0;
2246  foreach($GLOBALS['site_parameters']['main_menu_items_if_available'] as $this_key => $this_value) {
2247  if(isset($GLOBALS['main_menu_items'][$this_value])) {
2248  // Filtre des entrées principales du menu à partir de la valeur de main_menu_items_if_available défini en back office
2249  $temp_main_menu_items[$this_value] = $GLOBALS['main_menu_items'][$this_value];
2250  } elseif(!is_numeric($this_key)) {
2251  $custom++;
2252  if(String::substr($this_value, 0, 4) == 'STR_' && isset($GLOBALS[$this_value])) {
2253  $this_text = $GLOBALS[$this_value];
2254  } else {
2255  $this_text = $this_value;
2256  }
2257  if(String::strpos($this_key, '//') !== false) {
2258  $this_url = $this_key;
2259  } else {
2260  if(String::strpos($this_key, '/') !== 0) {
2261  $this_url = $GLOBALS['wwwroot'] . '/' . $this_key;
2262  } else {
2263  $this_url = $GLOBALS['wwwroot'] . $this_key;
2264  }
2265  }
2266  $temp_main_menu_items['custom'.$custom] = array($this_url => $this_text);
2267  }
2268  if(!empty($GLOBALS['site_parameters']['menu_custom_submenus']) && is_array($GLOBALS['site_parameters']['menu_custom_submenus']) && isset($GLOBALS['site_parameters']['menu_custom_submenus'][$this_value])) {
2269  // Gestion des sous menus paramétrés
2270  // Modèle de menu_custom_submenus : technical_code_main_menu_items1 => "technical_code_pour_le_sousmenu1, technical_code_pour_le_sousmenu2 ,technical_code_pour_le_sousmenu3", technical_code_main_menu_items2 => "technical_code_pour_le_sousmenu1, technical_code_pour_le_sousmenu2, technical_code_pour_le_sousmenu3"
2271  $temp_menu_items = array();
2272  if(!empty($GLOBALS['site_parameters']['menu_custom_submenus_keep_default'])) {
2273  $temp_menu_items = $GLOBALS['menu_items'];
2274  }
2275  foreach($GLOBALS['site_parameters']['menu_custom_submenus'] as $this_main_menu_items_value => $this_menu_items_value) {
2276  if(isset($GLOBALS['main_menu_items'][$this_main_menu_items_value])) {
2277  // Un sous menu est configuré pour ce menu principal
2278  if(String::strpos($this_menu_items_value, 'menu_html_') === 0) {
2279  $this_output = affiche_contenu_html($this_menu_items_value, true);
2280  if(!empty($this_output)) {
2281  $GLOBALS['submenu_html_array'][$this_main_menu_items_value] = '
2282  <ul class="sousMenu dropdown-menu" role="menu">
2283  <li>
2284  <div class="yamm-content">
2285  ' . $this_output . '
2286  </div>
2287  </li>
2288  </ul>';
2289  }
2290  } else {
2291  foreach(explode(',',str_replace(' ', '', $this_menu_items_value)) as $this_submenu) {
2292  // Le différents liens du sous menu sont séparés par des virgules
2293  if(!empty($GLOBALS['site_parameters']['menu_custom_urls'][$this_submenu]) && !empty($GLOBALS['site_parameters']['menu_custom_titles'][$this_submenu])) {
2294  // modèle pour menu_custom_urls : technical_code_main_menu_items1 => "http://www.url1.fr", technical_code_main_menu_items2 => "http://www.url2.fr"
2295  // modèle pour menu_custom_titles : technical_code_main_menu_items1 => "STR_XXXXX", technical_code_main_menu_items2 => "STR_XXX"
2296  $temp_menu_items[$this_main_menu_items_value][$GLOBALS['site_parameters']['menu_custom_urls'][$this_submenu]] = $GLOBALS[$GLOBALS['site_parameters']['menu_custom_titles'][$this_submenu]];
2297  } elseif(!empty($GLOBALS['site_parameters']['menu_custom_submenus_keep_default'])) {
2298  unset($temp_menu_items[$this_main_menu_items_value]);
2299  }
2300  }
2301  }
2302  }
2303  }
2304  $GLOBALS['menu_items'] = $temp_menu_items;
2305  }
2306  }
2307  $GLOBALS['main_menu_items'] = $temp_main_menu_items;
2308  }
2309  // Génération du menu
2310  $current_url = get_current_url(false);
2311  $current_url_full = get_current_url(true);
2312  $menu = array();
2313  foreach($GLOBALS['main_menu_items'] as $this_main_item => $this_main_array) {
2314  // On ne prend que les menus demandés pour l'affichage
2315  foreach ($this_main_array as $this_main_url => $this_main_title) {
2316  // $this_main_url peut être vide, auquel cas il n'y aura pas de lien direct à partir du menu
2317  if($avoid_links_when_hover && (!empty($GLOBALS['menu_items'][$this_main_item]) || !empty($GLOBALS['submenu_html_array'][$this_main_item]))) {
2318  // On retire le lien sur le menu principal pour le mettre sur un élément en haut du menu si pas existant
2319  if(!empty($GLOBALS['menu_items'][$this_main_item]) && empty($GLOBALS['menu_items'][$this_main_item][$this_main_url])) {
2320  $GLOBALS['menu_items'][$this_main_item] = array_merge(array($this_main_url => $this_main_title), $GLOBALS['main_menu_items'][$this_main_item]);
2321  }
2322  $this_main_url = '#';
2323  }
2324  if($this_main_item == 'other' && ((defined("IN_CATALOGUE") && !empty($_GET['catid'])) || (defined("IN_RUBRIQUE") && !empty($_GET['rubid'])))) {
2325  // On ne sélectionne pas le menu "Autre" si on est dans une catégorie de produits ou une rubrique de contenu
2326  $current_menu = false;
2327  $full_match = false;
2328  } else {
2329  $current_menu = (!empty($GLOBALS['menu_items'][$this_main_item][$current_url_full]));
2330  $full_match = true;
2331  if ($current_menu === false && ((defined('IN_RUBRIQUE_ARTICLE') && $this_main_item === 'rub_' . intval(vn($_GET['rubid']))) || (defined('IN_CATALOGUE_PRODUIT') && $this_main_item === 'cat_' . intval(vn($_GET['catid']))))) {
2332  $current_menu = true;
2333  $full_match = true;
2334  }
2335  if ($current_menu === false && !empty($GLOBALS['menu_items'][$this_main_item])) {
2336  $current_menu = (!empty($GLOBALS['menu_items'][$this_main_item][$current_url]));
2337  $full_match = false;
2338  }
2339  }
2340  $tmp_menu_item = array('name' => $this_main_item,
2341  'id' => 'menu_' . String::substr(md5($this_main_item.'_'.$this_main_title.'_'.$this_main_url), 0, 4),
2342  'label' => $this_main_title,
2343  'href' => (!empty($this_main_url) && !is_numeric($this_main_url)) ? ($this_main_url != get_current_url(true) || !empty($_POST)? $this_main_url : '#') : false,
2344  'selected' => ($current_menu !== false || !empty($this_main_array[$current_url]) || !empty($this_main_array[$current_url_full]) || String::strpos(vb($GLOBALS['submenu_html_array'][$this_main_item]),'class="minus active"')!==false),
2345  'submenu_global' => vb($GLOBALS['submenu_html_array'][$this_main_item]),
2346  'class' => vb($GLOBALS['site_parameters']['main_menu_custom_classes'][$this_main_item]),
2347  'submenu' => array()
2348  );
2349  if (!empty($GLOBALS['menu_items'][$this_main_item])) {
2350  foreach ($GLOBALS['menu_items'][$this_main_item] as $this_url => $this_title) {
2351  $tmp_menu_item['submenu'][] = array('label' => $this_title,
2352  'href' => (!empty($this_url) && !is_numeric($this_url)) ? $this_url : false,
2353  'selected' => (($current_url == $this_url && !$full_match) || $current_url_full == $this_url)
2354  );
2355  }
2356  }
2357  $menu[] = $tmp_menu_item;
2358  }
2359  }
2360  $tpl = $GLOBALS['tplEngine']->createTemplate('menu.tpl');
2361  $tpl->assign('menu', template_tags_replace($menu));
2362  $tpl->assign('site', $GLOBALS['site']);
2363  $tpl->assign('affiche_contenu_html_menu', affiche_contenu_html('affiche_contenu_html_menu', true));
2364  return $tpl->fetch();
2365  }
2366 }
2367 
2368 if (!function_exists('affiche_flags')) {
2379  function affiche_flags($return_mode = false, $forced_destination_url = null, $display_names = false, $langs_array = array(), $big_flags = false, $force_width = null)
2380  {
2381  $tpl = $GLOBALS['tplEngine']->createTemplate('flags.tpl');
2382  $data = array();
2383  if (count($langs_array) > 1 || !empty($forced_destination_url)) {
2384  foreach ($langs_array as $this_lang) {
2385  if(!empty($forced_destination_url)){
2386  $url = $forced_destination_url . '?langue=' . $this_lang;
2387  } else {
2389  }
2390  if($big_flags && !empty($GLOBALS['lang_flags_big'][$this_lang])) {
2391  $this_flag = $GLOBALS['lang_flags_big'][$this_lang];
2392  } else {
2393  $this_flag = $GLOBALS['lang_flags'][$this_lang];
2394  }
2395  if(String::strpos($this_flag, '/') === false) {
2396  $this_flag = '/lib/flag/' . $this_flag;
2397  }
2398  if(String::substr($this_flag, 0, 1) == '/' && String::substr($this_flag, 0, 2) != '//') {
2399  $this_flag = (defined('IN_PEEL_ADMIN') ? $GLOBALS['wwwroot_in_admin'] : $GLOBALS['wwwroot']) . $this_flag;
2400  }
2401  $data[] = array('lang' => $this_lang,
2402  'lang_name' => (!empty($GLOBALS['lang_names'][$this_lang])?$GLOBALS['lang_names'][$this_lang]:$this_lang),
2403  'href' => $url,
2404  'src' => $this_flag,
2405  'selected' => ($_SESSION['session_langue'] == $this_lang && empty($forced_destination_url)),
2406  'flag_css_class' => (($_SESSION['session_langue'] == $this_lang && empty($forced_destination_url)) ? "flag_selected":"flag_not_selected")
2407  );
2408  }
2409  }
2410  $tpl->assign('data', $data);
2411  $tpl->assign('display_names', $display_names);
2412  $tpl->assign('force_width', $force_width);
2413  if ($return_mode) {
2414  return $tpl->fetch();
2415  } else {
2416  echo $tpl->fetch();
2417  }
2418  }
2419 }
2420 
2421 if (!function_exists('getFlag')) {
2429  function getFlag($country_code, $country_name)
2430  {
2431  if (!empty($country_code)) {
2432  $flag = '<img src="' . $GLOBALS['wwwroot'] . '/lib/flag/' . strtolower($country_code) . '.gif" width="18" height="12" alt="" title="' . String::str_form_value($country_name) . '" /> ';
2433  } else {
2434  $flag = '';
2435  }
2436  return $flag;
2437  }
2438 }
2439 
2440 if (!function_exists('get_formatted_longtext_with_title')) {
2448  function get_formatted_longtext_with_title($longtext, $title, $mode = 'general')
2449  {
2450  $tpl = $GLOBALS['tplEngine']->createTemplate('longtext_with_title.tpl');
2451  $tpl->assign('mode', $mode);
2452  if(strip_tags($longtext)==$longtext) {
2453  $longtext = '<p>' . $longtext . '</p>';
2454  }
2455  $tpl->assign('longtext', $longtext);
2456  $tpl->assign('title', $title);
2457  return $tpl->fetch();
2458  }
2459 }
2460 
2461 if (!function_exists('output_light_html_page')) {
2474  function output_light_html_page($body, $title = '', $additional_header = null, $convert_to_encoding = null, $full_head_section_text = null, $onload = null, $add_general_css_js_files = true)
2475  {
2476  if (!empty($convert_to_encoding)) {
2477  $encoding = $convert_to_encoding;
2478  } else {
2479  $encoding = GENERAL_ENCODING;
2480  }
2481  header('Content-type: text/html; charset=' . $encoding);
2482  $tpl = $GLOBALS['tplEngine']->createTemplate('light_html_page.tpl');
2483  $tpl->assign('lang', $_SESSION['session_langue']);
2484  $tpl->assign('charset', $encoding);
2485  $tpl->assign('title', $title);
2486  $tpl->assign('onload', $onload);
2487  $tpl->assign('additional_header', $additional_header);
2488  $tpl->assign('body', $body);
2489  $tpl->assign('full_head_section_text', $full_head_section_text);
2490  if (empty($full_head_section_text) && $add_general_css_js_files) {
2491  if(!empty($GLOBALS['site_parameters']['bootstrap_enabled'])) {
2492  $GLOBALS['js_files'][-100] = get_url('/lib/js/jquery.js');
2493  $GLOBALS['css_files'][] = get_url('/lib/css/bootstrap.css');
2494  $GLOBALS['js_files'][] = get_url('/lib/js/bootstrap.js');
2495  }
2496  foreach (get_array_from_string($GLOBALS['site_parameters']['css']) as $this_css_filename) {
2497  $this_css_file = trim($this_css_filename);
2498  if (String::strpos($this_css_file, '//') !== false) {
2499  $GLOBALS['css_files'][] = $this_css_file;
2500  } elseif(file_exists($GLOBALS['repertoire_modele'] . '/css/' . $this_css_file)) {
2501  $GLOBALS['css_files'][] = $GLOBALS['repertoire_css'] . '/' . $this_css_file; // .'?'.time()
2502  }
2503  }
2504  if(!empty($GLOBALS['css_files'])) {
2505  ksort($GLOBALS['css_files']);
2506  $tpl->assign('css_files', array_unique($GLOBALS['css_files']));
2507  }
2508  $tpl->assign('js_output', get_javascript_output(!empty($GLOBALS['site_parameters']['load_javascript_async']), !empty($GLOBALS['site_parameters']['minify_js'])));
2509  }
2510  $output = $tpl->fetch();
2511  if (!empty($convert_to_encoding)) {
2512  echo String::convert_encoding($output, $convert_to_encoding);
2513  } else {
2514  echo $output;
2515  }
2516  }
2517 }
2518 
2519 if (!function_exists('print_alpha')) {
2525  function print_alpha()
2526  {
2527  $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
2528  $map = array();
2529  foreach ($alpha as $value) {
2530  // Catégories de produits
2531  $tmp = array('value' => $value, 'items' => array());
2532  $sqlCat = "SELECT c.id, c.nom_" . $_SESSION['session_langue'] . ", c.alpha_" . $_SESSION['session_langue'] . ", c.image_" . $_SESSION['session_langue'] . "
2533  FROM peel_categories c
2534  WHERE c.etat = '1' AND c.alpha_" . $_SESSION['session_langue'] . "='" . nohtml_real_escape_string($value) . "' AND " . get_filter_site_cond('categories', 'c') . "";
2535  $resCat = query($sqlCat);
2536  while ($cat = fetch_assoc($resCat)) {
2537  $sqlCount = "SELECT COUNT(*) AS this_count
2538  FROM peel_produits_categories pc
2539  INNER JOIN peel_produits p ON p.id = pc.produit_id AND " . get_filter_site_cond('produits','p') . "
2540  WHERE pc.categorie_id='" . intval($cat['id']) . "'";
2541  $resCount = query($sqlCount);
2542  if ($Count = fetch_assoc($resCount)) {
2543  $urlcat = get_product_category_url($cat['id'], $cat['nom_' . $_SESSION['session_langue']]);
2544  $tmp['items'][String::strtoupper($cat['nom_' . $_SESSION['session_langue']]).md5($urlcat)] = array('href' => $urlcat,
2545  'name' => $cat['nom_' . $_SESSION['session_langue']],
2546  'count' => $Count['this_count']
2547  );
2548  }
2549  }
2550  // Rubriques de contenu
2551  $sqlCat = "SELECT r.id, r.nom_" . $_SESSION['session_langue'] . ", r.image
2552  FROM peel_rubriques r
2553  WHERE r.etat = '1' AND r.nom_" . $_SESSION['session_langue'] . " LIKE '" . nohtml_real_escape_string($value) . "%' AND " . get_filter_site_cond('rubriques', 'r') . "";
2554  $resCat = query($sqlCat);
2555  while ($cat = fetch_assoc($resCat)) {
2556  $id = $cat['id'];
2557  $tmp['items'][String::strtoupper($cat['nom_' . $_SESSION['session_langue']]).md5(get_content_category_url($id, $cat['nom_' . $_SESSION['session_langue']]))] = array('href' => get_content_category_url($id, $cat['nom_' . $_SESSION['session_langue']]),
2558  'name' => $cat['nom_' . $_SESSION['session_langue']],
2559  'count' => calcul_nbarti_parrub($id)
2560  );
2561  }
2562  $map[$value] = $tmp;
2563  }
2564  $general_items[] = array('href' => get_url('cgv'), 'name' => $GLOBALS['STR_CGV']);
2565  $general_items[] = array('href' => get_url('legal'), 'name' => $GLOBALS['STR_LEGAL_INFORMATION']);
2566  $general_items[] = array('href' => get_url('sitemap'), 'name' => $GLOBALS['STR_SITEMAP']);
2567  foreach($general_items as $this_item) {
2568  $alpha = String::substr(String::strtoupper(String::convert_accents($this_item['name'])), 0, 1);
2569  $map[$alpha]['value'] = $alpha;
2570  $map[$alpha]['items'][String::strtoupper($this_item['name']).md5($this_item['href'])] = $this_item;
2571  }
2572  foreach($map as $this_key => $this_map) {
2573  ksort($map[$this_key]['items']);
2574  }
2575  $tpl = $GLOBALS['tplEngine']->createTemplate('alpha.tpl');
2576  $tpl->assign('title', $GLOBALS['STR_SITEMAP']);
2577  $tpl->assign('map', $map);
2578  echo $tpl->fetch();
2579  }
2580 }
2581 
2582 if (!function_exists('print_delete_installation_folder')) {
2588  function print_delete_installation_folder()
2589  {
2590  // Tout ce qui est ci-dessous ne peut pas aller chercher d'informations en base de données car logiciel non installé
2591  $title = $GLOBALS['STR_INSTALLATION'];
2592  // Gestion de l'affichage des drapeaux lors de l'installation
2593  if (!is_writable($GLOBALS['dirroot'] . "/lib/templateEngines/smarty/compile")) {
2594  echo sprintf($GLOBALS['STR_ADMIN_INSTALL_DIRECTORY_NOK'], "/lib/templateEngines/smarty/compile");
2595  die();
2596  } else {
2597  $tpl = $GLOBALS['tplEngine']->createTemplate('delete_installation_folder.tpl');
2598  $tpl->assign('installation_links', affiche_flags(true, get_url('/installation/index.php'), true, $GLOBALS['admin_lang_codes'], true, null));
2599  $tpl->assign('STR_INSTALLATION_PROCEDURE', $GLOBALS['STR_INSTALLATION_PROCEDURE']);
2600  $tpl->assign('STR_INSTALLATION_DELETE_EXPLAIN', $GLOBALS['STR_INSTALLATION_DELETE_EXPLAIN']);
2601  $tpl->assign('STR_INSTALLATION_DELETE_EXPLAIN_ALTERNATIVE', $GLOBALS['STR_INSTALLATION_DELETE_EXPLAIN_ALTERNATIVE']);
2602  $tpl->assign('STR_INSTALLATION_DELETED_LINK', $GLOBALS['STR_INSTALLATION_DELETED_LINK']);
2603  $tpl->assign('PEEL_VERSION', PEEL_VERSION);
2604  $body = $tpl->fetch();
2605  }
2606  $additional_header = '
2607  <style>
2608  h1 { font-size: 24px; color: #337733; }
2609  h2 { font-size: 20px; }
2610  .launch_installation, .center { text-align:center; margin-top: 10px; }
2611  .flag_not_selected { width: 167px; height:167px; }
2612  .full_flag { display: inline-block; font-size: 18px; font-weight: bold; color: #000000; padding:15px; }
2613  .full_flag a { text-decoration: none; color: #000000 !important;}
2614  .full_flag a:hover { text-decoration: underline;}
2615  .footer { padding-top:10px; margin-top: 10px;}
2616  </style>
2617 ';
2618  output_light_html_page($body, $title, $additional_header);
2619  }
2620 }
2621 
2622 if (!function_exists('print_access_plan')) {
2630  function print_access_plan()
2631  {
2632  $output = '';
2633  $sql = "SELECT map_tag AS map_tag, text_" . $_SESSION['session_langue'] . " AS texte
2634  FROM peel_access_map
2635  WHERE " . get_filter_site_cond('access_map');
2636  $res = query($sql);
2637  $access_plan_infos = fetch_assoc($res);
2638  if (!empty($access_plan_infos['texte'])) {
2639  // Comme le tag a probablement été copié collé dans la source de l'éditeur, les & ne sont probablement pas sous la forme &amp;
2640  // On décode et on réencode donc les &
2641  $tag = String::htmlentities(String::html_entity_decode($access_plan_infos['map_tag']), ENT_COMPAT, GENERAL_ENCODING, false, true);
2642  $longtext = String::nl2br_if_needed(String::html_entity_decode_if_needed($access_plan_infos['texte']));
2643  } else {
2644  $tag = '';
2645  $longtext = $GLOBALS['STR_EMPTY_TEXT_ACCESS_PLAN'];
2646  }
2647  $title = $GLOBALS['STR_ACCESS_PLAN'];
2648  $output .= get_formatted_longtext_with_title($longtext, $title, 'access_plan') . $tag;
2649 
2650  return $output;
2651  }
2652 }
2653 
2654 if (!function_exists('get_modules_paiement_secu')) {
2661  function get_modules_paiement_secu()
2662  {
2663  $tpl = $GLOBALS['tplEngine']->createTemplate('modules_paiement_secu.tpl');
2664  $tpl->assign('name', $GLOBALS['STR_PAIEMENT_SECURISE']);
2665  return $tpl->fetch();
2666  }
2667 }
2668 
2669 if (!function_exists('get_contact_sideblock')) {
2676  function get_contact_sideblock($return_mode = true)
2677  {
2678  $tpl = $GLOBALS['tplEngine']->createTemplate('contact_sideblock.tpl');
2679  $tpl->assign('lang', $_SESSION['session_langue']);
2680  if (check_if_module_active('url_rewriting')) {
2681  $tpl->assign('href', get_contact_url(false, false));
2682  } else {
2683  $tpl->assign('href', get_url('/utilisateurs/contact.php'));
2684  }
2685  if ($return_mode) {
2686  return $tpl->fetch();
2687  } else {
2688  echo $tpl->fetch();
2689  }
2690  }
2691 }
2692 
2693 if (!function_exists('extra_catalogue_condition')) {
2697  function extra_catalogue_condition()
2698  {
2699  return true;
2700  }
2701 }
2702 
2703 if (!function_exists('is_flash_active_on_site')) {
2708  function is_flash_active_on_site()
2709  {
2710  return (check_if_module_active('flash') && !empty($GLOBALS['site_parameters']['module_flash']));
2711  }
2712 }
2713 
2714 if (!function_exists('get_newsletter_form')) {
2720  function get_newsletter_form()
2721  {
2722  $tpl = $GLOBALS['tplEngine']->createTemplate('newsletter_form.tpl');
2723  $tpl->assign('form_token', get_form_token_input('get_simple_newsletter', true));
2724  $tpl->assign('label', $GLOBALS['STR_NEWSLETTER'] . $GLOBALS['STR_BEFORE_TWO_POINTS']);
2725  $tpl->assign('default', $GLOBALS['STR_WRITE_EMAIL_HERE']);
2726  return $tpl->fetch();
2727  }
2728 }
2729 
2730 if (!function_exists('newsletter_desinscription_form')) {
2738  function newsletter_desinscription_form(&$frm, $form_error_object)
2739  {
2740  $tpl = $GLOBALS['tplEngine']->createTemplate('newsletter_desinscription_form.tpl');
2741  $tpl->assign('header', $GLOBALS['STR_DESINSCRIPTION_NEWSLETTER']);
2742  $tpl->assign('action', get_current_url());
2743  $tpl->assign('label', $GLOBALS['STR_EMAIL'] . '' . $GLOBALS['STR_BEFORE_TWO_POINTS']);
2744  $tpl->assign('error', $form_error_object->text('email'));
2745  $tpl->assign('email', String::str_form_value(vb($frm['email'])));
2746  $tpl->assign('submit', $GLOBALS['STR_DESINSCRIPTION']);
2747  return $tpl->fetch();
2748  }
2749 }
2750 
2751 if (!function_exists('newsletter_validation')) {
2757  function newsletter_validation($frm, $form_error_object)
2758  {
2759  if (empty($frm)) {
2760  return false;
2761  }
2762  $message = "";
2763  $tpl = $GLOBALS['tplEngine']->createTemplate('newsletter_validation.tpl');
2764  $tpl->assign('header', $GLOBALS['STR_NEWSLETTER_TITLE']);
2765  if (!$form_error_object->count()) {
2766  // MAJ du compte client s'il existe
2767  $q_count_users = query("SELECT COUNT(id_utilisateur) AS nb_users
2768  FROM peel_utilisateurs
2769  WHERE email = '" . word_real_escape_string($frm['email']) . "' AND " . get_filter_site_cond('utilisateurs') . "");
2770  $r_count_users = fetch_assoc($q_count_users);
2771  if ($r_count_users['nb_users'] > 0) {
2772  query("UPDATE peel_utilisateurs
2773  SET newsletter = '1'
2774  WHERE email='" . nohtml_real_escape_string($frm['email']) . "' AND " . get_filter_site_cond('utilisateurs') . "");
2775  } else {
2776  $frm['newsletter'] = 1;
2777  $frm['priv'] = 'newsletter';
2779  }
2780  $custom_template_tags['EMAIL'] = $frm['email'];
2781  // Envoi d'un email confirmant l'inscription à la newsletter
2782  send_email($frm['email'], '', '', 'inscription_newsletter', $custom_template_tags, null, $GLOBALS['support']);
2783  $message .= $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_REQUEST_OK'] . ' ' . $GLOBALS['STR_SEE_YOU_SOON'] . ' ' . $GLOBALS['wwwroot']))->fetch();
2784  } else {
2785  foreach ($form_error_object->error as $key => $error) {
2786  $message .= $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => $error))->fetch();
2787  }
2788  }
2789  $tpl->assign('message', $message);
2790  return $tpl->fetch();
2791  }
2792 }
2793 
2794 if (!function_exists('affiche_contenu_html')) {
2803  function affiche_contenu_html($place, $return_mode = false, $custom_template_tags = null)
2804  {
2805  $output = '';
2806  if (!isset($_SESSION['session_site_country']) && !empty($_SERVER['REMOTE_ADDR']) && check_if_module_active('geoip')) {
2807  include($GLOBALS['dirroot'] . '/modules/geoip/class/geoIP.php');
2808  $geoIP = new geoIP();
2809  $_SESSION['session_site_country'] = $geoIP->geoIPCountryIDByAddr($_SERVER['REMOTE_ADDR']);
2810  $geoIP->geoIPClose();
2811  unset($geoIP);
2812  }
2813  $sql_cond_array[] = 'etat="1"';
2814  $sql_cond_array[] = get_filter_site_cond('html');
2815  $sql_cond_array[] = '(lang="' . $_SESSION['session_langue'] . '" OR lang="")';
2816  if (!empty($_SESSION['session_site_country'])) {
2817  $sql_cond_array[] = '(emplacement="' . nohtml_real_escape_string($place) . '|country='.$_SESSION['session_site_country'].'" OR emplacement="' . nohtml_real_escape_string($place) . '")';
2818  } else {
2819  $sql_cond_array[] = 'emplacement="' . nohtml_real_escape_string($place) . '"';
2820  }
2821  $GLOBALS['affiche_contenu_html_last_found'] = false;
2822  $sql = 'SELECT *
2823  FROM peel_html
2824  WHERE ' . implode(' AND ', $sql_cond_array) . '
2825  ORDER BY LENGTH(emplacement) DESC, a_timestamp DESC';
2826  $query = query($sql);
2827  while ($obj = fetch_object($query)) {
2828  if(!empty($last_emplacement) && String::strlen($obj->emplacement) < String::strlen($last_emplacement)) {
2829  // On a déjà chargé du contenu spécifique pour un pays, on ne veut pas prendre de contenu non-spécifique à ce pays, donc on s'arrête
2830  break;
2831  }
2832  // On préserve le HTML mais on corrige les & isolés
2833  $output .= template_tags_replace(String::htmlentities(String::html_entity_decode_if_needed($obj->contenu_html), ENT_COMPAT, GENERAL_ENCODING, false, true), $custom_template_tags, false, 'html');
2834  $last_emplacement = $obj->emplacement;
2835  $GLOBALS['affiche_contenu_html_last_found'] = true;
2836  }
2837  correct_output($output, false, 'html', $_SESSION['session_langue']);
2838  if ($return_mode) {
2839  return $output;
2840  } else {
2841  echo $output;
2842  }
2843  }
2844 }
2845 
2846 if (!function_exists('addthis_buttons')) {
2853  function addthis_buttons($share_item_array = null, $text = null)
2854  {
2855  static $jquery_called;
2856  if (empty($share_item_array)) {
2857  if (!empty($GLOBALS['site_parameters']['addthis_share_item_array'])) {
2858  // Configuration administrable
2859  $share_item_array = $GLOBALS['site_parameters']['addthis_share_item_array'];
2860  } else {
2861  // Configuration par défaut
2862  $share_item_array = array('twitter', 'google_plusone_share', 'facebook', 'pinterest_share', 'more');
2863  }
2864  }
2865  $output = '
2866  <table class="addthis_32x32_style">
2867  <tr>';
2868  if (!empty($text)) {
2869  $output .= '
2870  <td>
2871  <span class="text_product" style="display:block;height:100%;float:left;vertical-align:middle;">' . $text . '</span>
2872  </td>';
2873  }
2874  foreach($share_item_array as $this_item) {
2875  $output .= '
2876  <td>
2877  <a class="addthis_button_' . $this_item . '"></a>
2878  </td>';
2879  }
2880  $output .= '
2881  </tr>
2882  </table>';
2883  if(empty($jquery_called)) {
2884  // On ne veut pas minifier le fichier addthis avec le reste pour éviter de rajouter un délai de génération du minified ou poser un problème si addthis ne répond pas
2885  // Par ailleurs ça permet à la page d'accueil d'un site d'aller plus vite si elle n'a pas addthis
2886  // NB : Le fichier d'origine est https://s7.addthis.com/js/300/addthis_widget.js (On appelle addthis en https pour éviter problème d'alerte de sécurité du navigateur si le site est en https.)
2887  // Là on met le fichier directement sur le site en changeant son nom pour éviter le filtrage par Adblock Plus "Fanboy's Social Blocking List" qui empêche l'exécution du reste du javascript si on charge en mode asynchrone
2888  $GLOBALS['js_files_nominify'][] = get_url('/lib/js/add_widget300_this.js');
2889  $jquery_called = true;
2890  }
2891  return $output;
2892  }
2893 }
2894 
2895 if (!function_exists('get_user_picture')) {
2903  function get_user_picture($priv, $nb = 4, $rand = true) {
2904  $output_array = array();
2905  $sql_cond = '';
2906  if (empty($priv) || intval($nb) == 0) {
2907  // Erreur de paramétrage
2908  return false;
2909  }
2910  if ($priv != '*') {
2911  // * pour tous les utilisateurs
2912  $sql_cond .= ' AND priv="'.nohtml_real_escape_string($priv).'"';
2913  }
2914  $sql = 'SELECT logo
2915  FROM peel_utilisateurs
2916  WHERE logo !="" AND ' . get_filter_site_cond('utilisateurs') . ' ' . $sql_cond;
2917  if ($rand) {
2918  $sql .= '
2919  ORDER BY RAND()';
2920  }
2921  $sql .= '
2922  LIMIT 0,' . intval($nb);
2923  $q = query($sql);
2924  while($result = fetch_assoc($q)) {
2925  $output_array[] = $result['logo'];
2926  }
2927  return $output_array;
2928  }
2929 }
2930 
2931 if (!function_exists('get_diaporama')) {
2937  function get_diaporama($mode, $id)
2938  {
2939  if(empty($id)) {
2940  // Erreur de paramétrage
2941  return false;
2942  }
2943  if ($mode == 'content_category') {
2944  $id_field = 'id_rubrique';
2945  } else {
2946  // Erreur de paramétrage
2947  return false;
2948  }
2949  $nb_colonnes = 3;
2950  $j = 0;
2951  $diapo = array();
2952  $q = query("SELECT `image`
2953  FROM `peel_diaporama`
2954  WHERE `" . word_real_escape_string($id_field) . "`=" . intval($id));
2955  $total_img = num_rows($q);
2956  while($img_diapo = fetch_assoc($q)) {
2957  $tmpdiapo['j'] = $j;
2958  $tmpdiapo['image'] = $GLOBALS['repertoire_upload'] . '/' . $img_diapo["image"];
2959  $tmpdiapo['thumbs'] = $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($img_diapo["image"], 175, 275, "fit");
2960  $tmpdiapo['is_row'] = ($j % $nb_colonnes == 0);
2961  $j++;
2962 
2963  if ($j % $nb_colonnes == 0 || $j == $total_img) {
2964  $tmpdiapo['empty_cells'] = 0;
2965  if($j > $nb_colonnes) {
2966  // On a déjà une ligne pleine => il faut compléter la dernière ligne pour du XTML bien structuré
2967  while ($j % $nb_colonnes != 0) {
2968  $tmpdiapo['empty_cells']++;
2969  $j++;
2970  }
2971  } else {
2972  // Une seule ligne => on ajuste le nombre de colonnes à la réalité de ce qu'on a affiché
2973  $nb_colonnes = $j;
2974  }
2975  }
2976  $diapo[] = $tmpdiapo;
2977  }
2978  if(count($diapo)) {
2979  $GLOBALS['load_nyromodal']=true;
2980  $tpl = $GLOBALS['tplEngine']->createTemplate('diaporama.tpl');
2981  $tpl->assign('diaporama', $diapo);
2982  return $tpl->fetch();
2983  } else {
2984  return null;
2985  }
2986  }
2987 }
2988 
2989 if (!function_exists('get_search_form')) {
2990  /*
2991  *
2992  * @param string $search
2993  * @param string $match
2994  * @param string $real_search
2995  * @param array $frm
2996  * @return
2997  */
2998  function get_search_form($frm = null, $search=null, $match = null, $real_search = false, $display = 'full', $quick_add_product_from_search_page = null) {
2999  $tpl_f = $GLOBALS['tplEngine']->createTemplate('search_form.tpl');
3000  $tpl_f->assign('STR_SEARCH_PRODUCT', $GLOBALS['STR_SEARCH_PRODUCT']);
3001  $tpl_f->assign('action', get_url('search'));
3002  $tpl_f->assign('value', $search);
3003  $tpl_f->assign('match', ($display == 'full' ? $match : ''));
3004  $tpl_f->assign('display', $display);
3005  $tpl_f->assign('search', String::strtoupper($real_search));
3006  $tpl_f->assign('prix_min', vb($frm['prix_min']));
3007  $tpl_f->assign('prix_max', vb($frm['prix_max']));
3008  $tpl_f->assign('date_flash', vb($frm['date_flash']));
3009  $tpl_f->assign('STR_DATE', $GLOBALS['STR_DATE']);
3010  $tpl_f->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
3011  $tpl_f->assign('STR_SEARCH', $GLOBALS['STR_SEARCH']);
3012  $tpl_f->assign('STR_ENTER_KEY', $GLOBALS['STR_ENTER_KEY']);
3013  $tpl_f->assign('STR_SEARCH_ALL_WORDS', $GLOBALS['STR_SEARCH_ALL_WORDS']);
3014  $tpl_f->assign('STR_SEARCH_ANY_WORDS', $GLOBALS['STR_SEARCH_ANY_WORDS']);
3015  $tpl_f->assign('STR_SEARCH_EXACT_SENTENCE', $GLOBALS['STR_SEARCH_EXACT_SENTENCE']);
3016  $tpl_f->assign('STR_SEARCH', $GLOBALS['STR_SEARCH']);
3017  $tpl_f->assign('STR_TOWN', $GLOBALS['STR_TOWN']);
3018  $tpl_f->assign('STR_ZIP', $GLOBALS['STR_ZIP']);
3019  $tpl_f->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
3020  $tpl_f->assign('STR_COUNTRY', $GLOBALS['STR_COUNTRY']);
3021  $tpl_f->assign('is_advanced_search_active', check_if_module_active('search'));
3022  $tpl_f->assign('is_annonce_module_active', check_if_module_active('annonces'));
3023  $additional_search_form_parts_array = call_module_hook('search_form_part', array('frm' => $frm), 'array');
3024  $tpl_f->assign('additional_search_form_parts_array', $additional_search_form_parts_array);
3025 
3026  if (!empty($_GET['load_saved_products_list'])) {
3027  $sql = "SELECT *
3028  FROM peel_save_cart
3029  WHERE saved_products_list_id='".intval($_GET['load_saved_products_list'])."'";
3030  if ($query = query($sql)) {
3031  // suppression de la liste en cours pour charger une autre liste à la place.
3032  unset($_SESSION['session_search_product_list']);
3033  while ($result = fetch_assoc($query)) {
3034  $products_list[$result['produit_id']] = $result['quantite'];
3035  // Par simplicité, chaque ligne contient le nom de la liste à laquelle il appartient.
3036  $products_list_name = $result['products_list_name'];
3037  }
3038  }
3039  } elseif (!empty($_SESSION['session_search_product_list'])) {
3040  $products_list = $_SESSION['session_search_product_list'];
3041  }
3042  $tpl_f->assign('products_list_name', vb($products_list_name));
3043  if (!empty($products_list)) {
3044  $i=0;
3045  foreach ($products_list as $product_id=>$quantity) {
3047  $display_picture = $product_object->get_product_main_picture(false);
3048  if ($display_picture) {
3049  $product_picture = $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($display_picture, 75, 75, 'fit');
3050  } else {
3051  $product_picture = $GLOBALS['repertoire_upload'] . '/thumbs/' . thumbs($GLOBALS['site_parameters']['default_picture'], 75, 75, 'fit');
3052  }
3053  $produits_options[] = array(
3054  'ref' => $product_object->reference,
3055  'category_name' => $product_object->categorie,
3056  'nom_produit' => $product_object->name,
3057  'href_produit' => $product_object->get_product_url(),
3058  'quantite' => $quantity,
3059  'id' => $product_object->id,
3060  'photo_src' => vb($product_picture),
3061  'barcode_image_src' => $product_object->barcode_image_src(),
3062  'brand_link_html' => (!empty($product_object->id_marque)?get_brand_link_html($product_object->id_marque):''),
3063  'href_category' => get_product_category_url($product_object->categorie_id, $product_object->categorie),
3064  'marque' => $product_object->get_product_brands(false),
3065  'prix' => $product_object->get_original_price(display_prices_with_taxes_active(), check_if_module_active('reseller') && is_reseller(), false),
3066  'ean_code' => $product_object->ean_code,
3067  'reference' => $product_object->reference,
3068  'minimal_price' => $product_object->get_minimal_price(false),
3069  'product_id' => $product_object->id,
3070  'i' => $i
3071  );
3072  $i++;
3073  }
3074  }
3075  if (!empty($quick_add_product_from_search_page)) {
3076  $sqlPays = 'SELECT p.id, p.pays_' . $_SESSION['session_langue'] . ' as pays, p.zone, z.tva, z.on_franco
3077  FROM peel_pays p
3078  LEFT JOIN peel_zones z ON z.id=p.zone AND ' . get_filter_site_cond('zones', 'z', true) . '
3079  WHERE p.etat = "1" AND p.id ="' . nohtml_real_escape_string(vb($_SESSION['session_utilisateur']['pays'])) . '"
3080  LIMIT 1';
3081  $query = query($sqlPays);
3082  if ($result = fetch_assoc($query)) {
3083  $user_vat = $result['tva'];
3084  } else {
3085  $user_vat = 1;
3086  }
3087 
3088  $tpl_f->assign('zone_tva', ($user_vat && !is_user_tva_intracom_for_no_vat(vn($_SESSION['session_utilisateur']['id_utilisateur'])) && !check_if_module_active('micro_entreprise')));
3089  $tpl_f->assign('id_utilisateur', vn($_SESSION['session_utilisateur']['id_utilisateur']));
3090  $tpl_f->assign('devise', $_SESSION['session_devise']['code']);
3091  $tpl_f->assign('currency_rate', $_SESSION['session_devise']['conversion']);
3092  $tpl_f->assign('rpc_path', get_url('/modules/search/produit.php'));
3093  $tpl_f->assign('produits_options', vb($produits_options));
3094  $tpl_f->assign('STR_SCAN_CODE_AND_ADD_LIST', $GLOBALS['STR_SCAN_CODE_AND_ADD_LIST']);
3095  $tpl_f->assign('quick_add_product_from_search_page', vb($quick_add_product_from_search_page));
3096  $tpl_f->assign('STR_WHAT_DO_YOU_DO_WITH_THAT_LIST', $GLOBALS['STR_WHAT_DO_YOU_DO_WITH_THAT_LIST']);
3097  $tpl_f->assign('STR_MODULE_FACTURES_ADVANCED_EXPORT_LIST_PDF', $GLOBALS['STR_MODULE_FACTURES_ADVANCED_EXPORT_LIST_PDF']);
3098  $tpl_f->assign('display_barcode', !empty($GLOBALS['site_parameters']['display_ean_code_on_product_list']));
3099  $tpl_f->assign('search_product_list_save_cart', vb($GLOBALS['site_parameters']['search_product_list_save_cart']));
3100  }
3101 
3102  if(check_if_module_active('funding')) {
3103  // Affichage des champs de recherche lié au module de financement
3104  $tpl_f->assign('funding_display_search_funding_field', funding_display_search_funding_field($_GET));
3105  $tpl_f->assign('STR_MODULE_FUNDING_TITLE', $GLOBALS['STR_MODULE_FUNDING_TITLE']);
3106  }
3107  if (check_if_module_active('sauvegarde_recherche')) {
3108  $tpl_f->assign('display_save_search_button', display_save_search_button($frm));
3109  }
3110  if (check_if_module_active('search')) {
3111  if (!check_if_module_active('annonces') || (check_if_module_active('annonces') && !empty($GLOBALS['site_parameters']['search_in_product_and_ads']))) {
3112  // tableau regroupant les caractéristiques des attributs fixes dans peel
3113  $search_attribute_tab = array('marque' => array('table' => 'marques', 'join' => 'produits', 'join_id' => 'id_marque', 'label' => $GLOBALS['STR_BRAND_LB']),
3114  'couleur' => array('table' => 'couleurs', 'join' => 'produits_couleurs', 'join_id' => 'couleur_id', 'label' => $GLOBALS['STR_COLOR_LB']),
3115  'taille' => array('table' => 'tailles', 'join' => 'produits_tailles', 'join_id' => 'taille_id', 'label' => $GLOBALS['STR_TALL_LB'])
3116  );
3117 
3118  // on construit la liste des catégories
3119  if(empty($GLOBALS['select_categorie'])) {
3120  // Si plusieurs formulaires de recherche sont présents sur la même page, on garde en mémoire $GLOBALS['select_categorie']
3121  $GLOBALS['parent_categorie'] = vn($frm["categorie"]); // catégorie sélectionnée
3122  $GLOBALS['select_categorie'] = get_categories_output(null, 'categories', vn($_GET["categorie"]), vb($GLOBALS['site_parameters']['search_form_category_display_mode'], 'option'), '&nbsp;&nbsp;', null);
3123  }
3124  $tpl_f->assign('select_categorie', $GLOBALS['select_categorie']);
3125  $tpl_f->assign('STR_CAT_LB', $GLOBALS['STR_CAT_LB']);
3126 
3127  $tpl_f_select_attributes = array();
3128  // affichage des attributs fixes
3129  foreach ($search_attribute_tab as $index => $attribute) {
3130  $tpl_f_select_attributes[] = display_select_attribute($index, $attribute);
3131  }
3132  $tpl_f->assign('select_attributes', $tpl_f_select_attributes);
3133  // affichage des attributs variables
3134  if (!empty($GLOBALS['site_parameters']['custom_attribut_displayed_in_search_form']) && $display == 'module_products') {
3135  $technical_code = $GLOBALS['site_parameters']['custom_attribut_displayed_in_search_form'];
3136  }
3137  $tpl_f->assign('custom_attribute', display_custom_attribute(vb($frm['custom_attribut']), vb($technical_code), true));
3138  }
3139  if(check_if_module_active('annonces') && $display != 'module_products') {
3140  $tpl_f_cat_ann_opts = array();
3141  $ad_categories = get_ad_categories();
3142  foreach ($ad_categories as $this_category_id => $this_category_name) {
3143  $tpl_f_cat_ann_opts[] = array('value' => $this_category_id,
3144  'issel' => (!empty($_GET['cat_select']) && ($_GET['cat_select'] == $this_category_id || (is_array($_GET['cat_select']) && in_array($this_category_id, $_GET['cat_select'])))),
3145  'name' => $this_category_name
3146  );
3147  }
3148  // Possibilités : option ou checkbox
3149  $tpl_f->assign('search_form_category_display_mode', vb($GLOBALS['site_parameters']['search_form_category_display_mode'], 'option'));
3150  $tpl_f->assign('cat_ann_opts', $tpl_f_cat_ann_opts);
3151  $tpl_f->assign('display_city_zip', empty($GLOBALS['site_parameters']['disable_city_zip_input_on_search_form']));
3152  // Définit le type d'annonce détail,gros, etc.. Cependant il y a deux filtres sur Destockplus, d'où le test sur les deux get
3153  if (!empty($frm['cat_statut_detail'])) {
3154  $type_detail = $frm['cat_statut_detail'];
3155  } elseif (!empty($frm['cat_detail'])) {
3156  $type_detail = $frm['cat_detail'];
3157  }
3158  if (!empty($frm['cat_statut_detail'])) {
3159  $type_statut = $frm['cat_statut_detail'];
3160  } elseif (!empty($frm['cat_statut'])) {
3161  $type_statut = $frm['cat_statut'];
3162  }
3163  $tpl_f->assign('cat_detail', vb($type_detail));
3164  $tpl_f->assign('cat_statut', vb($type_statut));
3165  if (count($GLOBALS['lang_names'])>1) {
3166  $tpl_f->assign('ad_lang_select', get_lang_ads_choose(false));
3167  }
3168  $tpl_f->assign('city_zip', vb($frm['city_zip']));
3169  if(!empty($GLOBALS['site_parameters']['ads_filter_countries_in_search'])) {
3170  $sql = "SELECT u.pays AS pays
3171  FROM peel_utilisateurs u
3172  INNER JOIN peel_lot_vente a ON a.id_personne=u.id_utilisateur AND " . get_filter_site_cond('lot_vente', 'a') . "
3173  WHERE a.enligne='OK'
3174  GROUP BY u.pays";
3175  $query = query($sql);
3176  while ($result = fetch_assoc($query)) {
3177  $country_allowed_ids[$result['pays']] = $result['pays'];
3178  }
3179  $sql = "SELECT u.pays
3180  FROM peel_adresses u
3181  INNER JOIN peel_funding f ON f.address_id=u.id
3182  INNER JOIN peel_lot_vente a ON a.ref=f.project_id AND " . get_filter_site_cond('lot_vente', 'a') . "
3183  WHERE a.enligne='OK'
3184  GROUP BY u.pays";
3185  $query = query($sql);
3186  while ($result = fetch_assoc($query)) {
3187  $country_allowed_ids[$result['pays']] = $result['pays'];
3188  }
3189  }
3190  $tpl_f->assign('country', get_country_select_options(vb($frm['country']), null, 'name', false, null, false, null, vb($country_allowed_ids, null)));
3191 
3192  if (empty($GLOBALS['site_parameters']['disable_continent_input_on_search_form'])) {
3193  $tpl_continent_inps = array();
3194  unset($sql);
3195  if(!empty($GLOBALS['site_parameters']['ads_filter_countries_in_search'])) {
3196  if(!empty($country_allowed_ids)) {
3197  $sql = "SELECT c.id, c.name_" . $_SESSION['session_langue'] . " AS name
3198  FROM peel_continents c
3199  INNER JOIN peel_pays p ON p.continent_id=c.id AND p.id IN ('" . implode("','", real_escape_string($country_allowed_ids)) . "') AND " . get_filter_site_cond('pays', 'p') . "
3200  WHERE " . get_filter_site_cond('continents', 'c') . "
3201  GROUP BY c.id
3202  ORDER BY c.name_".$_SESSION['session_langue'] . "";
3203  }
3204  } else {
3205  $sql = "SELECT id, name_" . $_SESSION['session_langue'] . " AS name
3206  FROM peel_continents
3207  WHERE " . get_filter_site_cond('continents') . "
3208  ORDER BY name_".$_SESSION['session_langue'];
3209  }
3210  if(!empty($sql)) {
3211  $query_continent = query($sql);
3212  while ($continent = fetch_assoc($query_continent)) {
3213  $tpl_continent_inps[] = array('value' => $continent['id'],
3214  'issel' => !empty($frm['continent']) && is_array($frm['continent']) && in_array($continent['id'], $frm['continent']),
3215  'name' => $continent['name']
3216  );
3217  }
3218  }
3219  $tpl_f->assign('continent_inputs', $tpl_continent_inps);
3220  }
3221  if (check_if_module_active('maps') && empty($GLOBALS['site_parameters']['disable_near_position_input_on_search_form'])) {
3222  if(empty($_SESSION['session_latitude'])){
3223  $get_position_text = '<a href="javascript:load_position()">'.$GLOBALS['STR_GET_MY_POSITION'].'</a>';
3224  $get_position_script = getPositionFromUser('document.getElementById("load_position").innerHTML="<span style=\"color:green\">Position OK</span>"; document.getElementById("latitude").value=latitude; document.getElementById("longitude").value=longitude;');
3225  }else{
3226  // On connait déjà la position
3227  $get_position_text = '<span style="color:green">Position OK</span>';
3228  $get_position_script = '';
3229  }
3230  $tpl_f->assign('near_position', sprintf($GLOBALS['STR_NEAR_POSITION_INPUT'], '<input type="text" id="near_position" name="near_position" class="form-control" size="6" value="' . String::str_form_value(vb($frm['near_position'])) . '" style="width:80px" />').' <input type="hidden" id="latitude" name="latitude" value="'.vb($_SESSION['session_latitude']).'" /><input type="hidden" id="longitude" name="longitude" value="'.vb($_SESSION['session_longitude']).'" /> - <span id="load_position">'.$get_position_text.'</span>'. $get_position_script);
3231  }
3232  if (empty($GLOBALS['site_parameters']['ads_search_end_date_past'])) {
3233  $tpl_f->assign('date_end_past', !empty($frm['date_end_past']));
3234  $tpl_f->assign('STR_MODULE_ANNONCES_DATE_END_PAST', $GLOBALS['STR_MODULE_ANNONCES_DATE_END_PAST']);
3235  }
3236  $tpl_f->assign('user_verified_status_disable', !empty($GLOBALS['site_parameters']['user_verified_status_disable']));
3237  $tpl_f->assign('ads_contain_lot_sizes', $GLOBALS['site_parameters']['ads_contain_lot_sizes']);
3238  $tpl_f->assign('STR_TYPE', $GLOBALS['STR_TYPE']);
3239  $tpl_f->assign('STR_MODULE_ANNONCES_AD_CATEGORY', $GLOBALS['STR_MODULE_ANNONCES_AD_CATEGORY']);
3240  $tpl_f->assign('STR_MODULE_ANNONCES_OFFER_GROS', $GLOBALS['STR_MODULE_ANNONCES_OFFER_GROS']);
3241  $tpl_f->assign('STR_MODULE_ANNONCES_OFFER_DEMIGROS', $GLOBALS['STR_MODULE_ANNONCES_OFFER_DEMIGROS']);
3242  $tpl_f->assign('STR_MODULE_ANNONCES_OFFER_DETAIL', $GLOBALS['STR_MODULE_ANNONCES_OFFER_DETAIL']);
3243  $tpl_f->assign('STR_STATUS', $GLOBALS['STR_STATUS']);
3244  $tpl_f->assign('STR_MODULE_ANNONCES_ALT_VERIFIED_ADS', $GLOBALS['STR_MODULE_ANNONCES_ALT_VERIFIED_ADS']);
3245  $tpl_f->assign('STR_MODULE_ANNONCES_NOT_VERIFIED_ADS', $GLOBALS['STR_MODULE_ANNONCES_NOT_VERIFIED_ADS']);
3246  $tpl_f->assign('STR_MODULE_ANNONCES_SEARCH_CATEGORY_AD', $GLOBALS['STR_MODULE_ANNONCES_SEARCH_CATEGORY_AD']);
3247  }
3248  }
3249  return $tpl_f->fetch();
3250  }
3251 }
3252 
3253 if (!function_exists('get_address_list')) {
3260  function get_address_list($user_id) {
3261  $output = '';
3262  if(empty($user_id)) {
3263  return false;
3264  }
3265  $q = query('SELECT email, nom_famille, prenom, adresse, code_postal, ville, telephone, portable, pays, address_bill_default, address_ship_default
3266  FROM peel_utilisateurs
3267  WHERE id_utilisateur="' . intval($user_id) . '"');
3268  $result = fetch_assoc($q);
3269  $address_select_array[] = '<p>' . $GLOBALS['STR_INVOICE_ADDRESS'] . ' ' . $GLOBALS['STR_DEFAULT'] . '' . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ': ' . get_personal_address_form(vn($_SESSION['session_utilisateur']['id_utilisateur']), 'bill', vb($_SESSION['session_utilisateur']['address_bill_default']), false, 'max-width:300px;') . '</p>
3270 ';
3271  if (!empty($GLOBALS['site_parameters']['mode_transport'])) {
3272  $address_select_array[] = '<p>' . $GLOBALS['STR_SHIP_ADDRESS'] . ' ' . $GLOBALS['STR_DEFAULT'] . '' . $GLOBALS['STR_BEFORE_TWO_POINTS'] . ': ' . get_personal_address_form(vn($_SESSION['session_utilisateur']['id_utilisateur']), 'ship', vb($_SESSION['session_utilisateur']['address_ship_default']), false, 'max-width:300px;') . '</p>
3273 ';
3274  }
3275  $output .= '
3276 <h1>'.$GLOBALS['STR_ADDRESS_TEXT'].'</h1>
3277 <p>'.$GLOBALS['STR_INFO_ADDRESS'].'</p>
3278 <form id="address_default" method="post" action="' . String::str_form_value(get_current_url(false)) . '" class="entryform form-inline">
3279  ' . implode('', $address_select_array). '
3280 </form>
3281 ';
3282 
3283  if(num_rows($q) < vb($GLOBALS['site_parameters']['addresses_per_user_max'], 1000)) {
3284  // N adresses en plus maximum de l'adresse enregistrée lors de l'inscription.
3285  $output .= '
3286  <p><a class="btn btn-primary" href="'.$GLOBALS['wwwroot'].'/utilisateurs/adresse.php?mode=create_new_adress" title="'.$GLOBALS['STR_REGISTER_ORDER_ADDRESS'].'">'.$GLOBALS['STR_REGISTER_ORDER_ADDRESS'].'</a></p>';
3287  }
3288  $output .= '
3289  <div class="row">
3290  <div class="col-sm-6 col-md-4">
3291  <div class="well">
3292  <h2>'.$GLOBALS['STR_DEFAULT_ADDRESS'].'</h2>
3293  <div>'.$result['prenom'].' '.strtoupper($result['nom_famille']).'</div>
3294  <div>'.$result['adresse'].'</div>
3295  <div>'.$result['code_postal'].' '.$result['ville'].'</div>
3296  <div>'.get_country_name($result['pays']).'</div>
3297  <div>'.$result['telephone'].'</div>
3298  <div>'.$result['email'].'</div>
3299  <div style="margin-top:10px;"><a class="btn btn-default" href="'.$GLOBALS['wwwroot'].'/utilisateurs/change_params.php" title="'.$GLOBALS['STR_MODIFY'].'">'.$GLOBALS['STR_MODIFY'].'</a></div>
3300  </div>
3301  </div>
3302 ';
3303  $q = query('SELECT *
3304  FROM peel_adresses
3305  WHERE id_utilisateur = "' . intval($user_id) . '"');
3306  while($result = fetch_assoc($q)) {
3307  $output .= '
3308  <div class="col-sm-6 col-md-4">
3309  <div class="well">
3310  <h2>'.$result['nom'] . ($result['address_type']=='bill'?' ('.$GLOBALS['STR_INVOICE_ADDRESS'].')':($result['address_type']=='ship'?' ('.$GLOBALS['STR_SHIP_ADDRESS'].')':'')).'</h2>
3311  <div>'.$result['prenom'].' '.$result['nom_famille'].'</div>
3312  <div>'.$result['adresse'].'</div>
3313  <div>'.$result['code_postal'].' '.$result['ville'].'</div>
3314  <div>'.get_country_name($result['pays']).'</div>
3315  <div>'.$result['portable'].'</div>
3316  <div>'.$result['email'].'</div>
3317  <div style="margin-top:10px;">
3318  <a class="btn btn-warning" data-confirm="'.$GLOBALS['STR_DELETE_CONFIRM'].'" style="width:auto;" href="'.$GLOBALS['wwwroot'].'/utilisateurs/adresse.php?mode=suppr_address&id='.$result['id'].'" title="'.$GLOBALS['STR_DELETE'].'">'.$GLOBALS['STR_DELETE'].'</a>
3319  <a class="btn btn-default" href="'.$GLOBALS['wwwroot'].'/utilisateurs/adresse.php?mode=modif_address&id='.$result['id'].'" title="'.$GLOBALS['STR_MODIFY'].'">'.$GLOBALS['STR_MODIFY'].'</a>
3320  </div>
3321  </div>
3322  </div>
3323  ';
3324  }
3325  $output .= '
3326  </div>
3327 ';
3328  return $output;
3329  }
3330 }
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
Definition: chart-data.php:29
static strtoupper($string)
Returns string with all alphabetic characters converted to uppercase.
Definition: String.php:154
if(isset($_GET['catid'])&&empty($_GET['catid'])) if(empty($_GET['catid'])&&!empty($GLOBALS['site_parameters']['disallow_main_category'])&&empty($_GET['convert_gift_points'])) $catid
Definition: index.php:26
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']
static htmlentities($string, $flags=ENT_COMPAT, $charset=GENERAL_ENCODING, $suppr_endline=false, $encode_only_isolated_amperstands=false, $decode_html_entities_first=false)
Convert all applicable characters to HTML entities Cette fonction sert si on veut afficher du contenu...
Definition: String.php:411
$result
get_discount_text($remise_valeur, $remise_percent, $is_remise_valeur_including_taxe)
Retourne la remise d'un code promotionnel (en % dans le cas d'une remise en pourcentage ou dans le fo...
Definition: fonctions.php:421
static convert_encoding($string, $new_encoding, $original_encoding=null)
Converts the character encoding of string $string to $new_encoding from optionally $original_encoding...
Definition: String.php:375
get_user_information($user_id=null, $get_full_infos=false)
Chargement des détails de l'utilisateur.
Definition: user.php:906
get_personal_address_form($id_utilisateur, $address_type= 'bill', $selected=null, $add_manage_choice=true, $css_style=null)
Retourne le menu déroulant avec la lsite des adresses disponibles par utilisateur.
Definition: user.php:1116
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
Definition: String.php:54
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
is_user_tva_intracom_for_no_vat($user_id=null)
is_user_tva_intracom_for_no_vat()
Definition: user.php:959
display_select_attribute($categorie, $attribute)
Definition: fonctions.php:81
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
Definition: index.php:68
insere_utilisateur(&$frm, $password_already_encoded=false, $send_user_confirmation=false, $warn_admin_if_template_active=true, $skip_existing_account_tests=false)
Ajout d'un utilisateur.
Definition: user.php:134
static html_entity_decode_if_needed($string)
String::html_entity_decode_if_needed()
Definition: String.php:533
$id_marque
Definition: marque.php:20
if(!select_db($_SESSION['session_install_choixbase'], $GLOBALS['database_object'], true)) $error
Definition: verifdroits.php:33
word_real_escape_string($value)
Applique real_escape_string dans le cas où on n'insère qu'un seul mot, de moins de 30 caractères...
Definition: database.php:424
static strtolower($string)
Returns string with all alphabetic characters converted to lowercase.
Definition: String.php:135
$mode
static strlen($string)
Returns the length of the given string.
Definition: String.php:36
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['country'])) $search_attribute_tab
Definition: search.php:133
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(empty($_GET['id'])) if(!empty($GLOBALS['site_parameters']['allow_multiple_product_url_with_category'])) $product_object
if(!defined('IN_PEEL')) thumbs($source_filename, $width, $height, $method= 'fit', $source_folder=null, $thumb_folder=null, $thumb_rename=true, $return_absolute_path=false)
Charge l'image dont le nom est $source_filename dans le répertoire d'upload, et crée une vignette pou...
Definition: fonctions.php:33
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
get_javascript_output($async=false, $minify=false, $output_only_script_loading=false, $js_filenames_array=array('js_files', 'js_files_pageonly', 'js_files_nominify', 'js_files_noasync', 'js_files_nominify_noasync'))
Chargement du chargement des scripts.
Definition: fonctions.php:1275
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
if(!defined('IN_PEEL')) display_prices_with_taxes_active()
display_prices_with_taxes_active()
Definition: fonctions.php:23
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
if(!defined('IN_PEEL')) est_identifie()
Retourne true si l'utilisateur est identifié
Definition: user.php:23
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
get_country_select_options($selected_country_name=null, $selected_country_id=null, $option_value= 'name', $display_inactive_country=false, $allowed_zone_id=null, $preselect_shop_country_if_none_selected=true, $selected_country_lang=null, $allowed_ids=null)
get_country_select_options()
Definition: fonctions.php:1005
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
num_rows($query_result)
num_rows()
Definition: database.php:321
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
display_custom_attribute($selected_attributes=null, $technical_code=null, $show_all=false)
Definition: fonctions.php:119
$priv
$search
Definition: rpc.php:29
fetch_object($query_result)
fetch_object()
Definition: database.php:302
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
get_array_from_string($string)
Convertit une chaine de caractère simple à gérer par un utilisateur en un tableau PHP...
Definition: format.php:1011
call_module_hook($hook, $params, $mode= 'boolean')
Appelle la fonction correspondant au $hook pour chaque module installé La fonction doit s'appeler : [...
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
$GLOBALS['page_columns_count']
$real_search
Definition: search.php:88
const PEEL_VERSION(version_compare(PHP_VERSION, '5.1.2', '<'))
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
Definition: fonctions.php:94
calcul_nbprod_parcat($catid, $all_parents_with_ordered_direct_sons_array)
calcul_nbprod_parcat()
Definition: fonctions.php:176
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
get_css_files_to_load($minify=false)
get_css_files_to_load()
Definition: fonctions.php:1504
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
Definition: user.php:63
$match
Definition: search.php:86
affiche_select_marque($return_mode=false)
affiche_select_marque()
Definition: fonctions.php:43
$hook_result
static html_entity_decode($string, $quote_style=ENT_COMPAT, $charset=GENERAL_ENCODING)
String::html_entity_decode()
Definition: String.php:517
get_current_url_in_other_language($this_lang)
Ce module de gestion des URL dans d'autres langues doit être compatible avec l'URL Rewriting si activ...
Definition: fonctions.php:1680
$load
$id
Definition: articles.php:22
fprix($price, $display_currency=false, $currency_code_or_default=null, $convertion_needed_into_currency=true, $currency_rate=null, $display_iso_currency_code=false, $format=true, $force_format_separator=null, $add_rdfa_properties=false, $round_even_if_no_format=false)
fprix formatte le prix donné en le convertissant si nécessaire au préalable et en ajoutant éventuelle...
Definition: fonctions.php:242
if(!defined('IN_PEEL')) get_advanced_search_script()
get_advanced_search_script()
Definition: fonctions.php:23
$rubid
Definition: index.php:29
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
static convert_accents($string, $convert_umlaut=false, $strip_umlaut=true)
convert_accents()
Definition: String.php:341
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112
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...
clean_str($string)
Filtre une chaine de caractères.
Definition: fonctions.php:3226
template_tags_replace($text, $custom_template_tags=array(), $replace_only_custom_tags=false, $format=null, $lang=null, $avoid_load_urls=false)
Remplace les tags d'un texte au format [TAG] par les valeurs correspondantes.
Definition: format.php:599
correct_output(&$output, $replace_template_tags=false, $format=null, $lang=null)
Corrige le contenu à afficher, notamment pour avoir du https même si http est stocké en BDD...
Definition: format.php:854
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
static str_shorten($string, $length_limit, $middle_separator= '', $ending_if_no_middle_separator= '...', $ideal_length_with_clean_cut_if_possible=null)
Raccourcit une chaine de caractère en insérant au milieu ou à la fin un séparateur.
Definition: String.php:233
static ucfirst($string)
Returns string with first letter uppercase.
Definition: String.php:173
get_datepicker_javascript($load_timepicker=false)
get_datepicker_javascript()
Definition: fonctions.php:1443
calcul_nbarti_parrub($rub)
calcul_nbrub()
Definition: fonctions.php:216
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']
get_country_name($id)
Renvoie le nom d'un pays.
Definition: fonctions.php:856

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