PEEL Shopping
Open source ecommerce : PEEL Shopping
fonctions.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: fonctions.php 46935 2015-09-18 08:49:48Z gboussin $
14 if (!defined('IN_PEEL')) {
15  die();
16 }
17 
24 function banner_hook_admin_menu_items($params) {
25  $result['menu_items']['content_various'][$GLOBALS['wwwroot_in_admin'] . '/modules/banner/administrer/banner.php'] = $GLOBALS["STR_ADMIN_MENU_CONTENT_BANNERS"];
26  return $result;
27 }
28 
36 function affiche_formulaire_ajout_banniere($categorie_id = 0, &$frm)
37 {
38  /* Valeurs par défaut */
39  if(empty($frm)) {
40  $frm = array();
41  $frm["reference"] = "";
42  $frm["nom"] = "";
43  $frm["description"] = "";
44  $frm["image"] = "";
45  $frm["etat"] = "";
46  $frm["lien"] = "";
47  $frm["hit"] = "";
48  $frm["vue"] = "";
49  $frm["lang"] = "";
50  $frm["target"] = "";
51  $frm["tag_html"] = "";
52  $frm['id_categorie'] = "";
53  $frm['extra_javascript'] = "";
54  $frm['width'] = "";
55  $frm['height'] = "";
56  $frm["annonce_number"] = "";
57  $frm["on_home_page"] = "";
58  $frm["on_ad_creation_page"] = "";
59  $frm["on_first_page_category"] = "";
60  $frm["on_other_page_category"] = "";
61  $frm["on_ad_page_details"] = "";
62  $frm["on_other_page"] = "";
63  $frm["pages_allowed"] = "";
64  $frm["keywords"] = "";
65  }
66  $frm["titre_bouton"] = $GLOBALS["STR_MODULE_BANNER_ADMIN_ADD_BUTTON"];
67  $frm["nouveau_mode"] = "insere";
69 }
70 
81 {
82  if(empty($frm)){
83  // Pas de données venant de validation de formulaire, donc on charge le contenu de la base de données
84  /* Charge les informations de la bannière */
85  $qid = query("SELECT *
86  FROM peel_banniere
87  WHERE id = " . intval($id) . " AND " . get_filter_site_cond('banniere', null, true));
88  $frm = fetch_assoc($qid);
89  }
90  $frm["nouveau_mode"] = "maj";
91  $frm["titre_bouton"] = $GLOBALS['STR_ADMIN_FORM_SAVE_CHANGES'];
92 
94 }
95 
103 {
104  if ($frm['nouveau_mode'] != 'insere') {
105  $title = $GLOBALS['STR_MODULE_BANNER_ADMIN_UPDATE'];
106  } else {
107  $title = $GLOBALS['STR_MODULE_BANNER_ADMIN_CREATE'];
108  }
109  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/bannerAdmin_formulaire_banniere.tpl');
110  $tpl->assign('action', get_current_url(false) . '?start=0');
111  $tpl->assign('title', $title);
112  $tpl->assign('mode', $frm["nouveau_mode"]);
113  $tpl->assign('id', intval($GLOBALS['id']));
114  $tpl->assign('etat', vb($frm["etat"]));
115  $tpl->assign('description', vb($frm["description"]));
116  $tpl->assign('lien', vb($frm["lien"]));
117  $tpl->assign('extra_javascript', vb($frm["extra_javascript"]));
118  $tpl->assign('keywords', vb($frm["keywords"]));
119  $tpl->assign('tag_html', vb($frm["tag_html"]));
120  $tpl->assign('target', vb($frm["target"]));
121  $tpl->assign('position', vb($frm["position"]));
122  $tpl->assign('rang', vb($frm["rang"]));
123  $tpl->assign('banner_help', affiche_contenu_html("banner_help", true));
124  $tpl->assign('cette_page_href', $GLOBALS['administrer_url'] . '/sites.php');
125  $tpl->assign('STR_MODULE_BANNER_ADMIN_PLACE_EXPLAIN', sprintf($GLOBALS['STR_MODULE_BANNER_ADMIN_PLACE_EXPLAIN'], $GLOBALS['administrer_url'] . '/sites.php'));
126  $tpl->assign('is_annonce_module_active', check_if_module_active('annonces'));
127  $tpl->assign('date_debut', get_formatted_date(vb($frm["date_debut"])));
128  $tpl->assign('date_fin', get_formatted_date(vb($frm["date_fin"])));
129  $tpl->assign('on_other_page_category', vb($frm["on_other_page_category"]));
130  $tpl->assign('on_home_page', vb($frm["on_home_page"]));
131  $tpl->assign('on_other_page', vb($frm["on_other_page"]));
132  $tpl->assign('on_search_engine_page', vb($frm["on_search_engine_page"]));
133  $tpl->assign('site_id_select_options', get_site_id_select_options(vb($frm['site_id'])));
134  $tpl->assign('on_first_page_category', vb($frm["on_first_page_category"]));
135 
136  if (check_if_module_active('annonces')) {
137  $tpl->assign('on_ad_creation_page', vb($frm["on_ad_creation_page"]));
138  $tpl->assign('on_ad_page_details', vb($frm["on_ad_page_details"]));
139  $tpl->assign('list_id', vb($frm["list_id"]));
140  $tpl->assign('annonce_number', vb($frm["annonce_number"]));
141  $tpl->assign('pages_allowed', vb($frm["pages_allowed"]));
142  $tpl->assign('STR_MODULE_ANNONCES_DESCRIPTION', $GLOBALS['STR_MODULE_ANNONCES_DESCRIPTION']);
143  // Charge les informations sur les catégorie annonces lorsque le module est activée.
144  $qid = query("SELECT id, nom_" . $_SESSION['session_langue'] . "
145  FROM peel_categories_annonces
146  WHERE " . get_filter_site_cond('categories_annonces') . "");
147  } else {
148  // Charge les informations sur les catégorie présentes en base de donnée.
149  $qid = query("SELECT id, nom_" . $_SESSION['session_langue'] . "
150  FROM peel_categories
151  WHERE " . get_filter_site_cond('categories') . "");
152  }
153  $tpl_cat_opts = array();
154  while ($cat = fetch_assoc($qid)) {
155  $tpl_cat_opts[] = array(
156  'value' => intval($cat['id']),
157  'issel' => vb($frm["id_categorie"]) == $cat['id'],
158  'name' => $cat['nom_' . $_SESSION['session_langue']]
159  );
160  }
161  $tpl->assign('cat_options', $tpl_cat_opts);
162  $tpl->assign('conf_site_href', $GLOBALS['administrer_url'] . '/sites.php?mode=modif&id=1');
163  $tpl->assign('drop_src', $GLOBALS['administrer_url'] . '/images/b_drop.png');
164 
165  if (!empty($frm["image"])) {
166  $extension = @pathinfo($frm['image'], PATHINFO_EXTENSION);
167  $tpl_image = array(
168  'nom' => $frm["image"],
169  'drop_href' => get_current_url(false) . '?mode=supprfile&id=' . vb($frm['id']) . '&file=image'
170  );
171  if ($extension == 'swf') {
172  $tpl_image['swf'] = getFlashBannerHTML(get_url_from_uploaded_filename($frm['image']), 300, 300);
173  } else {
174  $tpl_image['src'] = get_url_from_uploaded_filename($frm['image']);
175  }
176  $tpl->assign('image', $tpl_image);
177  }
178  $tpl->assign('width', vb($frm["width"]));
179  $tpl->assign('height', vb($frm["height"]));
180  $tpl->assign('lang', vb($frm["lang"]));
181  $tpl->assign('titre_bouton', vb($frm["titre_bouton"]));
182  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
183  $tpl->assign('STR_ADMIN_WEBSITE', $GLOBALS['STR_ADMIN_WEBSITE']);
184  $tpl->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
185  $tpl->assign('STR_STATUS', $GLOBALS['STR_STATUS']);
186  $tpl->assign('STR_ADMIN_ONLINE', $GLOBALS['STR_ADMIN_ONLINE']);
187  $tpl->assign('STR_ADMIN_OFFLINE', $GLOBALS['STR_ADMIN_OFFLINE']);
188  $tpl->assign('STR_ADMIN_LINK', $GLOBALS['STR_ADMIN_LINK']);
189  $tpl->assign('STR_MODULE_BANNER_ADMIN_EXTRA_JAVASCRIPT', $GLOBALS['STR_MODULE_BANNER_ADMIN_EXTRA_JAVASCRIPT']);
190  $tpl->assign('STR_MODULE_BANNER_ADMIN_KEYWORDS', $GLOBALS['STR_MODULE_BANNER_ADMIN_KEYWORDS']);
191  $tpl->assign('STR_MODULE_BANNER_ADMIN_TAG_HTML', $GLOBALS['STR_MODULE_BANNER_ADMIN_TAG_HTML']);
192  $tpl->assign('STR_MODULE_BANNER_ADMIN_TAG_HTML_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_TAG_HTML_EXPLAIN']);
193  $tpl->assign('STR_MODULE_BANNER_ADMIN_TARGET', $GLOBALS['STR_MODULE_BANNER_ADMIN_TARGET']);
194  $tpl->assign('STR_MODULE_BANNER_ADMIN_TARGET_SELF', $GLOBALS['STR_MODULE_BANNER_ADMIN_TARGET_SELF']);
195  $tpl->assign('STR_MODULE_BANNER_ADMIN_TARGET_BLANK', $GLOBALS['STR_MODULE_BANNER_ADMIN_TARGET_BLANK']);
196  $tpl->assign('STR_MODULE_BANNER_ADMIN_TARGET_TOP', $GLOBALS['STR_MODULE_BANNER_ADMIN_TARGET_TOP']);
197  $tpl->assign('STR_MODULE_BANNER_ADMIN_TARGET_PARENT', $GLOBALS['STR_MODULE_BANNER_ADMIN_TARGET_PARENT']);
198  $tpl->assign('STR_MODULE_BANNER_ADMIN_PLACE', $GLOBALS['STR_MODULE_BANNER_ADMIN_PLACE']);
199  $tpl->assign('STR_MODULE_BANNER_ADMIN_PLACE_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_PLACE_EXPLAIN']);
200  $tpl->assign('STR_ADMIN_POSITION', $GLOBALS['STR_ADMIN_POSITION']);
201  $tpl->assign('STR_MODULE_BANNER_ADMIN_POSITION_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_POSITION_EXPLAIN']);
202  $tpl->assign('STR_MODULE_BANNER_ADMIN_AD_PLACE', $GLOBALS['STR_MODULE_BANNER_ADMIN_AD_PLACE']);
203  $tpl->assign('STR_MODULE_BANNER_ADMIN_AD_ID', $GLOBALS['STR_MODULE_BANNER_ADMIN_AD_ID']);
204  $tpl->assign('STR_MODULE_BANNER_ADMIN_ODD_EVEN_ALL', $GLOBALS['STR_MODULE_BANNER_ADMIN_ODD_EVEN_ALL']);
205  $tpl->assign('STR_MODULE_BANNER_ADMIN_ODD_EVEN_ODD', $GLOBALS['STR_MODULE_BANNER_ADMIN_ODD_EVEN_ODD']);
206  $tpl->assign('STR_MODULE_BANNER_ADMIN_ODD_EVEN_EVEN', $GLOBALS['STR_MODULE_BANNER_ADMIN_ODD_EVEN_EVEN']);
207  $tpl->assign('STR_MODULE_BANNER_ADMIN_START_PUBLICATION_DATE', $GLOBALS['STR_MODULE_BANNER_ADMIN_START_PUBLICATION_DATE']);
208  $tpl->assign('STR_MODULE_BANNER_ADMIN_END_PUBLICATION_DATE', $GLOBALS['STR_MODULE_BANNER_ADMIN_END_PUBLICATION_DATE']);
209  $tpl->assign('STR_MODULE_BANNER_ADMIN_DATES_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_DATES_EXPLAIN']);
210  $tpl->assign('STR_CATEGORY', $GLOBALS['STR_CATEGORY']);
211  $tpl->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
212  $tpl->assign('STR_MODULE_BANNER_ADMIN_SPACE_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_SPACE_EXPLAIN']);
213  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_AD_PAGE_DETAILS', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_AD_PAGE_DETAILS']);
214  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_ANNOUNCEMENT_CREATION_PAGE', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_ANNOUNCEMENT_CREATION_PAGE']);
215  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_FIRST_PAGE_CATEGORY', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_FIRST_PAGE_CATEGORY']);
216  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_OTHER_PAGE_CATEGORY', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_OTHER_PAGE_CATEGORY']);
217  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_HOME_PAGE', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_HOME_PAGE']);
218  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_OTHER_PAGE', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_OTHER_PAGE']);
219  $tpl->assign('STR_MODULE_BANNER_ADMIN_ON_SEARCH_ENGINE_PAGE', $GLOBALS['STR_MODULE_BANNER_ADMIN_ON_SEARCH_ENGINE_PAGE']);
220  $tpl->assign('STR_MODULE_BANNER_ADMIN_IMAGE_OR_FLASH', $GLOBALS['STR_MODULE_BANNER_ADMIN_IMAGE_OR_FLASH']);
221  $tpl->assign('STR_ADMIN_FILE_NAME', $GLOBALS['STR_ADMIN_FILE_NAME']);
222  $tpl->assign('STR_ADMIN_DELETE_IMAGE', $GLOBALS['STR_ADMIN_DELETE_IMAGE']);
223  $tpl->assign('STR_MODULE_BANNER_ADMIN_WIDTH', $GLOBALS['STR_MODULE_BANNER_ADMIN_WIDTH']);
224  $tpl->assign('STR_MODULE_BANNER_ADMIN_HEIGHT', $GLOBALS['STR_MODULE_BANNER_ADMIN_HEIGHT']);
225  $tpl->assign('STR_MODULE_BANNER_ADMIN_SIZE_EXPLAIN', $GLOBALS['STR_MODULE_BANNER_ADMIN_SIZE_EXPLAIN']);
226  $tpl->assign('STR_ADMIN_LANGUAGE', $GLOBALS['STR_ADMIN_LANGUAGE']);
227  $tpl->assign('STR_ADMIN_DESCRIPTION', $GLOBALS['STR_ADMIN_DESCRIPTION']);
228  echo $tpl->fetch();
229 }
230 
240 {
241  /* Charge les infos de la commande. */
242  $qid = query("SELECT description
243  FROM peel_banniere
244  WHERE id = " . intval($id) . " AND " . get_filter_site_cond('banniere', null, true));
245  $prod = fetch_assoc($qid);
246 
247  /* Efface la banniere */
248  query("DELETE FROM peel_banniere WHERE id='" . intval($id) . "' AND " . get_filter_site_cond('banniere', null, true));
249  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS["STR_MODULE_BANNER_ADMIN_MSG_DELETED_OK"], $prod['description'])))->fetch();
250  // Suppression des caches de bannières
251  $this_cache_object = new Cache(null, array('group' => 'affiche_banner_data'));
252  $this_cache_object->delete_cache_file(true);
253  unset($this_cache_object);
254 }
255 
264 {
265  /*ajoute le banniere dans la table banniere */
266  if (empty($frm['etat'])) {
267  $frm['etat'] = 0;
268  }
269  if (!empty($frm['image']) || !empty($frm['tag_html'])) {
270  $sql = "INSERT INTO peel_banniere (
271  description
272  , image
273  , date_debut
274  , date_fin
275  , etat";
276  if (check_if_module_active('annonces')) {
277  $sql .= "
278  , pages_allowed
279  , list_id
280  , do_not_display_on_pages_related_to_user_ids_list
281  , annonce_number
282  , on_ad_page_details
283  , on_ad_creation_page";
284  }
285  $sql .= "
286  , on_first_page_category
287  , on_other_page_category
288  , on_search_engine_page
289  , position
290  , lien
291  , lang
292  , target
293  , tag_html
294  , extra_javascript
295  , id_categorie
296  , width
297  , height
298  , rang
299  , on_home_page
300  , on_other_page
301  , keywords
302  , site_id
303  ) VALUES (
304  '" . nohtml_real_escape_string($frm['description']) . "'
305  , '" . nohtml_real_escape_string($frm['image']) . "'
308  , '" . nohtml_real_escape_string($frm['etat']) . "'";
309  if (check_if_module_active('annonces')) {
310  $sql .= "
311  , '" . nohtml_real_escape_string(vb($frm['pages_allowed'])) . "'
312  , '" . nohtml_real_escape_string(vn($frm['list_id'])) . "'
313  , '" . nohtml_real_escape_string(vb($frm['do_not_display_on_pages_related_to_user_ids_list'])) . "'
314  , '" . intval(vn($frm['annonce_number'])) . "'
315  , '" . intval(vn($frm['on_ad_page_details'])) . "'
316  , '" . intval(vn($frm['on_ad_creation_page'])) . "'";
317  }
318  $sql .= "
319  , '" . intval(vn($frm['on_first_page_category'])) . "'
320  , '" . intval(vn($frm['on_other_page_category'])) . "'
321  , '" . intval(vn($frm['on_search_engine_page'])) . "'
322  , '" . nohtml_real_escape_string($frm['position']) . "'
323  , '" . nohtml_real_escape_string($frm['lien']) . "'
324  , '" . nohtml_real_escape_string($frm['lang']) . "'
325  , '" . nohtml_real_escape_string($frm['target']) . "'
326  , '" . real_escape_string($frm['tag_html']) . "'
327  , '" . real_escape_string($frm['extra_javascript']) . "'
328  , '" . intval(vn($frm['id_categorie'])) . "'
329  , '" . intval(vn($frm['width'])) . "'
330  , '" . intval(vn($frm['height'])) . "'
331  , '" . intval(vn($frm['rang'])) . "'
332  , '" . intval(vn($frm['on_home_page'])) . "'
333  , '" . intval(vn($frm['on_other_page'])) . "'
334  , '" . nohtml_real_escape_string(vb($frm['keywords'])) . "'
336  )";
337  $qid = query($sql);
338  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS["STR_MODULE_BANNER_ADMIN_MSG_OK"], vb($_POST['description']))))->fetch();
339  // Suppression des caches de bannières
340  $this_cache_object = new Cache(null, array('group' => 'affiche_banner_data'));
341  $this_cache_object->delete_cache_file(true);
342  unset($this_cache_object);
343  } else {
344  echo $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => $GLOBALS["STR_MODULE_BANNER_ADMIN_ERROR_INSERTED"]))->fetch();
345  }
346 }
347 
355 function maj_banniere($id, &$frm)
356 {
357  /* Met à jour la table banniere */
358  $sql = 'UPDATE peel_banniere SET
359  description = "' . nohtml_real_escape_string($frm['description']) . '"
360  , date_debut = "' . nohtml_real_escape_string(get_mysql_date_from_user_input($frm['date_debut'])) . '"
361  , date_fin = "' . nohtml_real_escape_string(get_mysql_date_from_user_input($frm['date_fin'])) . '"
362  , image = "' . nohtml_real_escape_string($frm['image']) . '"
363  , etat = "' . nohtml_real_escape_string($frm['etat']) . '"';
364  if (check_if_module_active('annonces')) {
365  $sql .= '
366  , annonce_number = "' . intval(vn($frm['annonce_number'])) . '"
367  , pages_allowed = "' . nohtml_real_escape_string(vb($frm['pages_allowed'])) . '"
368  , list_id = "' . nohtml_real_escape_string(vn($frm['list_id'])) . '"
369  , on_ad_page_details = "' . intval(vn($frm['on_ad_page_details'])) . '"
370  , on_ad_creation_page = "' . intval(vn($frm['on_ad_creation_page'])) . '"';
371  }
372  $sql .= '
373  , on_other_page_category = "' . intval(vn($frm['on_other_page_category'])) . '"
374  , on_first_page_category = "' . intval(vn($frm['on_first_page_category'])) . '"
375  , on_search_engine_page = "' . intval(vn($frm['on_search_engine_page'])) . '"
376  , position = "' . nohtml_real_escape_string($frm['position']) . '"
377  , lien = "' . nohtml_real_escape_string($frm['lien']) . '"
378  , lang = "' . nohtml_real_escape_string($frm['lang']) . '"
379  , on_home_page = "' . intval(vn($frm['on_home_page'])) . '"
380  , on_other_page = "' . intval(vn($frm['on_other_page'])) . '"
381  , target = "' . nohtml_real_escape_string($frm['target']) . '"
382  , tag_html = "' . real_escape_string($frm['tag_html']) . '"
383  , extra_javascript = "' . real_escape_string($frm['extra_javascript']) . '"
384  , id_categorie = "' . intval(vn($frm['id_categorie'])) . '"
385  , width = "' . intval(vn($frm['width'])) . '"
386  , height = "' . intval(vn($frm['height'])) . '"
387  , rang = "' . intval(vn($frm['rang'])) . '"
388  , keywords = "' . nohtml_real_escape_string(vb($frm['keywords'])) . '"
389  , site_id = "' . nohtml_real_escape_string(get_site_id_sql_set_value(vn($frm['site_id']))) . '"
390  WHERE id = "' . intval($id) . '"';
391  if (query($sql)) {
392  $ouptut = $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS["STR_MODULE_BANNER_ADMIN_MSG_UPDATED_OK"], $id)))->fetch();
393  // Suppression des caches de bannières
394  $this_cache_object = new Cache(null, array('group' => 'affiche_banner_data'));
395  $this_cache_object->delete_cache_file(true);
396  unset($this_cache_object);
397  } else {
398  $ouptut = $GLOBALS['tplEngine']->createTemplate('global_error.tpl', array('message' => $GLOBALS["STR_MODULE_BANNER_ADMIN_ERR_UPDATED"]))->fetch();
399  }
400  return $ouptut;
401 }
402 
408 function affiche_liste_banniere($inner = '', $cond = '')
409 {
410  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/bannerAdmin_liste.tpl');
411  $tpl->assign('add_src', $GLOBALS['administrer_url'] . '/images/add.png');
412  $tpl->assign('add_href', get_current_url(false) . '?mode=ajout');
413  $tpl->assign('drop_src', $GLOBALS['administrer_url'] . '/images/b_drop.png');
414  $tpl->assign('edit_src', $GLOBALS['administrer_url'] . '/images/b_edit.png');
415  $sql = "SELECT *
416  FROM peel_banniere pb " . $inner . "
417  WHERE 1
418  " . $cond . " AND " . get_filter_site_cond('banniere', 'pb', true) .
419  " ORDER BY date_debut DESC";
420  $Links = new Multipage($sql, 'utilisateurs');
421  $results_array = $Links->Query();
422  if (!empty($results_array)) {
423  $tpl_results = array();
424  $i = 0;
425  foreach ($results_array as $ligne) {
426  $extension = @pathinfo($ligne['image'], PATHINFO_EXTENSION);
427  $tpl_swf = null;
428  $tpl_src = null;
429  if ($extension == 'swf') {
430  $tpl_swf = getFlashBannerHTML( get_url_from_uploaded_filename($ligne['image']), 150, 150);
431  } elseif (!empty($ligne['image'])) {
432  $tpl_src = get_url_from_uploaded_filename($ligne['image']);
433  }
434  $tpl_results[] = array(
435  'tr_rollover' => tr_rollover($i, true),
436  'description' => $ligne['description'],
437  'drop_href' => get_current_url(false) . '?mode=suppr&id=' . $ligne['id'],
438  'edit_href' => get_current_url(false) . '?mode=modif&id=' . $ligne['id'],
439  'position' => $ligne['position'],
440  'rang' => $ligne['rang'],
441  'swf' => $tpl_swf,
442  'src' => $tpl_src,
443  'date_debut' => get_formatted_date($ligne['date_debut']),
444  'date_fin' => get_formatted_date($ligne['date_fin']),
445  'hit' => $ligne['hit'],
446  'vue' => $ligne['vue'],
447  'lang' => $ligne['lang'],
448  'etat_onclick' => 'change_status("banner", "' . $ligne['id'] . '", this, "'.$GLOBALS['administrer_url'] . '")',
449  'modif_etat_src' => $GLOBALS['administrer_url'] . '/images/' . (empty($ligne['etat']) ? 'puce-blanche.gif' : 'puce-verte.gif'),
450  'site_name' => get_site_name($ligne['site_id'])
451  );
452  $i++;
453  }
454  $tpl->assign('results', $tpl_results);
455  }
456  $tpl->assign('links_multipage', $Links->GetMultipage());
457  $tpl->assign('STR_ADMIN_WEBSITE', $GLOBALS['STR_ADMIN_WEBSITE']);
458  $tpl->assign('STR_MODULE_BANNER_ADMIN_LIST_TITLE', $GLOBALS['STR_MODULE_BANNER_ADMIN_LIST_TITLE']);
459  $tpl->assign('STR_MODULE_BANNER_ADMIN_CREATE', $GLOBALS['STR_MODULE_BANNER_ADMIN_CREATE']);
460  $tpl->assign('STR_ADMIN_ACTION', $GLOBALS['STR_ADMIN_ACTION']);
461  $tpl->assign('STR_MODULE_BANNER_ADMIN_PLACE', $GLOBALS['STR_MODULE_BANNER_ADMIN_PLACE']);
462  $tpl->assign('STR_ADMIN_POSITION', $GLOBALS['STR_ADMIN_POSITION']);
463  $tpl->assign('STR_ADMIN_NAME', $GLOBALS['STR_ADMIN_NAME']);
464  $tpl->assign('STR_IMAGE', $GLOBALS['STR_IMAGE']);
465  $tpl->assign('STR_ADMIN_BEGIN_DATE', $GLOBALS['STR_ADMIN_BEGIN_DATE']);
466  $tpl->assign('STR_ADMIN_END_DATE', $GLOBALS['STR_ADMIN_END_DATE']);
467  $tpl->assign('STR_MODULE_BANNER_ADMIN_HIT', $GLOBALS['STR_MODULE_BANNER_ADMIN_HIT']);
468  $tpl->assign('STR_MODULE_BANNER_ADMIN_VIEWED', $GLOBALS['STR_MODULE_BANNER_ADMIN_VIEWED']);
469  $tpl->assign('STR_ADMIN_LANGUAGE', $GLOBALS['STR_ADMIN_LANGUAGE']);
470  $tpl->assign('STR_STATUS', $GLOBALS['STR_STATUS']);
471  $tpl->assign('STR_ADMIN_DELETE_WARNING', $GLOBALS['STR_ADMIN_DELETE_WARNING']);
472  $tpl->assign('STR_DELETE', $GLOBALS['STR_DELETE']);
473  $tpl->assign('STR_MODULE_BANNER_ADMIN_UPDATE', $GLOBALS['STR_MODULE_BANNER_ADMIN_UPDATE']);
474  $tpl->assign('STR_MODULE_BANNER_ADMIN_NOTHING_FOUND', $GLOBALS['STR_MODULE_BANNER_ADMIN_NOTHING_FOUND']);
475  echo $tpl->fetch();
476 }
477 
485 function delete_banner_image($id, $file)
486 {
487  /* Charge les infos du produit. */
488  switch ($file) {
489  case "image" :
490  $sql = "SELECT image
491  FROM peel_banniere
492  WHERE id = '" . intval($id) . "' AND " . get_filter_site_cond('banniere', null, true);
493  $res = query($sql);
494  $file = fetch_assoc($res);
495  query("UPDATE peel_banniere
496  SET image = ''
497  WHERE id = '" . intval($id) . "' AND " . get_filter_site_cond('banniere', null, true));
498  break;
499  }
500  delete_uploaded_file_and_thumbs($file['image']);
501  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS['STR_ADMIN_RUBRIQUES_MSG_DELETED_OK'], $file['image'])))->fetch();
502  // Suppression des caches de bannières
503  $this_cache_object = new Cache(null, array('group' => 'affiche_banner_data'));
504  $this_cache_object->delete_cache_file(true);
505  unset($this_cache_object);
506 }
507 
515 {
516  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/bannerAdmin_filtre.tpl');
517  $tpl->assign('action', get_current_url(false));
518  $tpl->assign('is_annonce_module_active', check_if_module_active('annonces'));
519  $tpl_options = array();
520  if (check_if_module_active('annonces')) {
521  $sql_annonce_categorie = query('SELECT id,nom_' . $_SESSION['session_langue'] . '
522  FROM peel_categories_annonces pca
523  WHERE etat=1 AND ' . get_filter_site_cond('categories_annonces', 'pca') . '
524  ORDER BY nom_' . $_SESSION['session_langue'] . '');
525  while ($this_categorie = fetch_assoc($sql_annonce_categorie)) {
526  $tpl_options[] = array(
527  'value' => $this_categorie['id'],
528  'issel' => intval(vb($frm['filter_categorie_banniere'])) == $this_categorie['id'],
529  'name' => vb($this_categorie['nom_' . $_SESSION['session_langue'] . ''])
530  );
531  }
532  } else {
533  $sql_annonce_categorie = query('SELECT id, nom_' . $_SESSION['session_langue'] . '
534  FROM peel_categories pc
535  WHERE etat=1 AND ' . get_filter_site_cond('categories', 'pc') . '
536  ORDER BY nom_' . $_SESSION['session_langue']);
537  while ($this_categorie = fetch_assoc($sql_annonce_categorie)) {
538  $tpl_options[] = array(
539  'value' => $this_categorie['id'],
540  'issel' => vb($frm['filter_categorie_banniere']) == $this_categorie['id'],
541  'name' => vb($this_categorie['nom_' . $_SESSION['session_langue'] . ''])
542  );
543  }
544  }
545  $tpl->assign('options', $tpl_options);
546  $tpl->assign('filter_lang', vb($frm['filter_lang']));
547  $tpl->assign('filter_date_debut', vb($frm['filter_date_debut']));
548  $tpl->assign('filter_date_fin', vb($frm['filter_date_fin']));
549  $tpl->assign('filter_description', vb($frm['filter_description']));
550  $tpl->assign('filter_categorie_banniere', vb($frm['filter_categorie_banniere']));
551  $tpl->assign('filter_etat', vb($frm['filter_etat']));
552  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
553  $tpl->assign('STR_CHOOSE', $GLOBALS['STR_CHOOSE']);
554  $tpl->assign('STR_ADMIN_CHOOSE_SEARCH_CRITERIA', $GLOBALS['STR_ADMIN_CHOOSE_SEARCH_CRITERIA']);
555  $tpl->assign('STR_ADMIN_SEARCH_IN_TITLE', $GLOBALS['STR_ADMIN_SEARCH_IN_TITLE']);
556  $tpl->assign('STR_CATEGORY', $GLOBALS['STR_CATEGORY']);
557  $tpl->assign('STR_ADMIN_LANGUAGE', $GLOBALS['STR_ADMIN_LANGUAGE']);
558  $tpl->assign('STR_ADMIN_BEGIN_DATE', $GLOBALS['STR_ADMIN_BEGIN_DATE']);
559  $tpl->assign('STR_ADMIN_END_DATE', $GLOBALS['STR_ADMIN_END_DATE']);
560  $tpl->assign('STR_STATUS', $GLOBALS['STR_STATUS']);
561  $tpl->assign('STR_MODULE_BANNER_ADMIN_ALL', $GLOBALS['STR_MODULE_BANNER_ADMIN_ALL']);
562  $tpl->assign('STR_ADMIN_ONLINE', $GLOBALS['STR_ADMIN_ONLINE']);
563  $tpl->assign('STR_ADMIN_OFFLINE', $GLOBALS['STR_ADMIN_OFFLINE']);
564  $tpl->assign('STR_SEARCH', $GLOBALS['STR_SEARCH']);
565  echo $tpl->fetch();
566 }
567 
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id.
Definition: fonctions.php:4763
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
$result
affiche_formulaire_ajout_banniere($categorie_id=0, &$frm)
Affiche un formulaire vierge pour ajouter une bannière.
Definition: fonctions.php:36
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
if(!defined('IN_PEEL')) banner_hook_admin_menu_items($params)
Renvoie les éléments de menu affichables.
Definition: fonctions.php:24
insere_banniere(&$frm)
insere_banniere()
Definition: fonctions.php:263
get_site_id_select_options($selected_site_id=null, $selected_site_name=null, $display_first_option=null, $select_current_site_id_by_default=false)
Créer les options pour le select qui liste les noms de sites configurés en back office.
affiche_filtre_banner($frm)
Supprime le produit spécifié par $id.
Definition: fonctions.php:514
$extension
affiche_formulaire_modif_banniere($id, &$frm)
affiche_formulaire_modif_banniere()
Definition: fonctions.php:80
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
$results_array
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
Definition: fonctions.php:19
real_escape_string($value)
real_escape_string()
Definition: database.php:374
supprime_banniere($id)
supprime_banniere()
Definition: fonctions.php:239
getFlashBannerHTML($url, $width=680, $height=250, $mode_transparent=false)
Renvoie le HTML d'un tag corespondant à l'URL du fichier flash transmis en paramètre.
Definition: fonctions.php:840
$tpl_options
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
Definition: fonctions.php:4643
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
Definition: database.php:158
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
delete_banner_image($id, $file)
Supprime le produit spécifié par $id.
Definition: fonctions.php:485
delete_uploaded_file_and_thumbs($filename)
delete_uploaded_file_and_thumbs()
Definition: fonctions.php:3417
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
get_formatted_date($datetime_or_timestamp=null, $mode= 'short', $hour_minute=false)
Afficher une date formatée, en évitant les problèmes liés aux noms de mois sur les serveurs qui ne so...
Definition: format.php:440
affiche_formulaire_banniere(&$frm)
affiche_formulaire_banniere()
Definition: fonctions.php:102
get_mysql_date_from_user_input($string, $use_current_hour_min_sec_if_missing=false)
Transforme une date formattée par get_formatted_date() en date MySQL Si la date est vide...
Definition: format.php:496
affiche_liste_banniere($inner= '', $cond= '')
affiche_liste_banniere()
Definition: fonctions.php:408
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
get_site_id_sql_set_value($site_ids)
Retourne la valeur SQL d'un champ INT ou SET suivant que ce soit un entier ou un tableau.
Definition: fonctions.php:4747
maj_banniere($id, &$frm)
Met à jour la bannière $id avec de nouvelles valeurs.
Definition: fonctions.php:355
get_url_from_uploaded_filename($filename)
get_url_from_uploaded_filename()
Definition: fonctions.php:3553
$id
Definition: articles.php:22
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...
Definition: Cache.php:27
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

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