PEEL Shopping
Open source ecommerce : PEEL Shopping
avis.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: avis.php 47317 2015-10-12 13:33:32Z gboussin $
14 if (defined('IN_PEEL')) {
15  return;
16 }
17 include("../../configuration.inc.php");
18 
19 if (!check_if_module_active('avis')) {
20  // This module is not activated => we redirect to the homepage
21  redirect_and_die(get_url('/'));
22 }
23 
24 if (!est_identifie()) {
25  // User not logged in ==> we redirect to login page.
26  $_SESSION['session_redirect_after_login'] = get_current_url(true);
27  redirect_and_die(get_url('membre'));
28 }
29 
30 define('IN_DONNEZ_AVIS', true);
31 include($GLOBALS['repertoire_modele'] . "/haut.php");
32 
33 $frm = $_POST;
34 // Recuperation de la langue session
35 $frm['langue'] = $_SESSION['session_langue'];
37 
38 if (!empty($_GET['prodid'])) {
39  $id = $_GET['prodid'];
40  $type = 'produit';
41 } elseif (!empty($_GET['ref'])) {
42  $id = $_GET['ref'];
43  $annonce_object = new Annonce($id);
44  $type = 'annonce';
45 } elseif (!empty($_GET['id'])) {
46  $id = $_GET['id'];
47  $annonce_object = new Annonce($id);
48  $type = 'annonce';
49 } else {
50  $id = null;
51 }
53 if (vb($type) == 'annonce' && $annonce_object->id_utilisateur == vn($_SESSION['session_utilisateur']['id_utilisateur'])) {
54  $ad_owner_opinion = true;
55 }
56 if (check_if_module_active('avis') && !empty($id)) {
57  // On charge les fonctions d'avis
58  switch (vb($_REQUEST['mode'])) {
59  case "insere" :
60  $form_error_object->valide_form($frm, array('avis' => $GLOBALS['STR_DONT_FORGET_COMMENT']));
61  if(empty($GLOBALS['site_parameters']['module_avis_no_notation']) && !$ad_owner_opinion) {
62  $form_error_object->valide_form($frm,
63  array('note' => $GLOBALS['STR_DONT_FORGET_NOTE']));
64  }
65  if (!$form_error_object->count()) {
67  } else {
69  }
70  break;
71 
72  case "edit" :
73  if(!empty($GLOBALS['site_parameters']['edit_avis_by_owner']) && !empty($_GET['id'])) {
74  $query = query("SELECT a.*,".(!empty($_GET['type']) && $_GET['type']=='annonce' ?'ref':'id_produit')." as item_id
75  FROM peel_avis a
76  WHERE a.id = '" . intval($_GET['id']) . "' AND a.etat = '1' AND a.id_utilisateur = '" . intval($_SESSION['session_utilisateur']['id_utilisateur']) . "'");
78  echo formulaire_avis($frm['item_id'], $frm, $form_error_object, $_GET['type'], true);
79  }
80  break;
81 
82  case "suppr" :
83  echo delete_avis($_GET['id']);
84  break;
85 
86  default :
88  break;
89  }
90 }
91 
92 include($GLOBALS['repertoire_modele'] . "/bas.php");
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
redirect_and_die($url, $permanent_redirection=false, $avoid_loop=false)
Redirige vers l'URL demandée et arrête le programme.
Definition: fonctions.php:1551
$form_error_object
Definition: avis.php:25
delete_avis($id)
Definition: fonctions.php:393
$ad_owner_opinion
Definition: avis.php:52
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
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
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
$frm
Definition: avis.php:24
$GLOBALS['DOC_TITLE']
Definition: avis.php:19
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
formulaire_avis($id, &$frm, &$form_error_object, $type, $ad_owner_opinion=false, $opinion_id=null)
formulaire_avis()
Definition: fonctions.php:59
insere_avis($frm, $ad_owner_opinion)
insere_avis()
Definition: fonctions.php:126
$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...
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:41:26 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.