PEEL Shopping
Open source ecommerce : PEEL Shopping
rpc_status.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: rpc_status.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('IN_PEEL_ADMIN', true);
15 define('IN_RPC', true);
16 include("../configuration.inc.php");
17 
18 if (!empty($_GET['encoding'])) {
19  $page_encoding = $_GET['encoding'];
20 } else {
21  $page_encoding = 'utf-8';
22 }
23 $output = '';
24 
25 if (!est_identifie() || empty($_POST)) {
26  $output .= 'nok';
27 } elseif(vb($_POST['mode']) == 'delivery_status' && !empty($GLOBALS['site_parameters']['statut_livraison_picto'][$_POST['new_status']])) {
28  query("UPDATE peel_commandes
29  SET id_statut_livraison ='" . intval($_POST['new_status']) . "'
30  WHERE id='" . intval($_POST['id']) . "' AND " . get_filter_site_cond('commandes', null, true));
31  $output .= $GLOBALS['administrer_url'] . '/images/' . $GLOBALS['site_parameters']['statut_livraison_picto'][$_POST['new_status']];
32 } else {
33  $mode = vb($_POST['mode']);
35  // On fait les tests de droits une bonne fois pour toutes
36  if($mode == 'langues') {
37  $new_status = ($_POST['current_status']+2)%3-1;
38  } else {
39  $new_status = 1-$_POST['current_status'];
40  }
41  $new_status_sql_value = $new_status;
42  if($mode == 'countries' && a_priv("admin_manage")) {
43  $sql = "UPDATE peel_pays
44  SET etat='%s'
45  WHERE id='%s' AND " . get_filter_site_cond('pays', null, true) . "";
46  }elseif($mode == 'types' && a_priv("admin_manage")) {
47  $sql = "UPDATE peel_types
48  SET etat='%s'
49  WHERE id='%s' AND " . get_filter_site_cond('types', null, true) . "";
50  }elseif($mode == 'tailles' && a_priv("admin_products")) {
51  $sql = "UPDATE peel_tailles
52  SET etat='%s'
53  WHERE id='%s' AND " . get_filter_site_cond('tailles', null, true) . "";
54  }elseif($mode == 'couleurs' && a_priv("admin_products")) {
55  $sql = "UPDATE peel_couleurs
56  SET etat='%s'
57  WHERE id='%s' AND " . get_filter_site_cond('couleurs', null, true) . "";
58  }elseif($mode == 'paiement' && a_priv("admin_manage")) {
59  $sql = "UPDATE peel_paiement
60  SET etat='%s'
61  WHERE id='%s' AND " . get_filter_site_cond('paiement', null, true) . "";
62  }elseif($mode == 'contact' && a_priv("admin_manage")) {
63  if(empty($new_status_sql_value)) {
64  $new_status_sql_value = "FALSE";
65  }else{
66  $new_status_sql_value = "TRUE";
67  }
68  $sql = "UPDATE peel_admins_contacts_planified
69  SET actif='%s'
70  WHERE id='%s'";
71  }elseif($mode == 'devises' && a_priv("admin_manage")) {
72  $sql = "UPDATE peel_devises
73  SET etat='%s'
74  WHERE id='%s' AND " . get_filter_site_cond('devises', null, true) . "";
75  }elseif($mode == 'banner' && a_priv("admin_content")) {
76  $sql = "UPDATE peel_banniere
77  SET etat='%s'
78  WHERE id='%s' AND " . get_filter_site_cond('banniere', null, true);
79  }elseif($mode == 'avis' && a_priv("admin_webmastering")) {
80  $sql = "UPDATE peel_avis
81  SET etat='%s'
82  WHERE id='%s'";
83  }elseif($mode == 'attributs' && a_priv("admin_products")) {
84  $sql = "UPDATE peel_nom_attributs
85  SET etat='%s'
86  WHERE id='%s' AND " . get_filter_site_cond('nom_attributs', null, true) . "";
87  }elseif($mode == 'articles' && a_priv("admin_content")) {
88  $sql = "UPDATE peel_articles
89  SET etat='%s'
90  WHERE id='%s' AND " . get_filter_site_cond('articles', null, true) . "";
91  }elseif($mode == 'rubriques' && a_priv("admin_content")) {
92  $sql = "UPDATE peel_rubriques
93  SET etat='%s'
94  WHERE id='%s' AND " . get_filter_site_cond('rubriques', null, true) . "";
95  }elseif($mode == 'produits' && a_priv("admin_products")) {
96  $sql = "UPDATE peel_produits
97  SET etat='%s'
98  WHERE id='%s' AND " . get_filter_site_cond('produits', null, true) . "";
99  }elseif($mode == 'utilisateurs' && a_priv("admin_users")) {
100  /*
101  // Pour la page de liste d'utilisateurs, on n'utilise pas le jquery pour gérer des points plus complexes (désactivation d'annonces ou autres) et mettre des messages spécifiques
102  $sql = "UPDATE peel_utilisateurs
103  SET etat='%s'
104  WHERE id='%s' AND " . get_filter_site_cond('utilisateurs', null, true) . "";
105  */
106  }elseif($mode == 'marques' && a_priv("admin_products")) {
107  $sql = "UPDATE peel_marques
108  SET etat='%s'
109  WHERE id='%s' AND " . get_filter_site_cond('marques', null, true);
110  }elseif($mode == 'langues' && a_priv("admin_manage")) {
111  $sql = "UPDATE peel_langues
112  SET etat='%s'
113  WHERE id='%s' AND " . get_filter_site_cond('langues', null, true) . "";
114  }elseif($mode == 'html' && a_priv("admin_content")) {
115  $sql = "UPDATE peel_html
116  SET etat='%s'
117  WHERE id='%s' AND " . get_filter_site_cond('html', null, true) . "";
118  }elseif($mode == 'email-templates' && a_priv("admin_content")) {
119  if(empty($new_status_sql_value)) {
120  $new_status_sql_value = "FALSE";
121  }else{
122  $new_status_sql_value = "TRUE";
123  }
124  $sql = "UPDATE peel_email_template
125  SET active='%s'
126  WHERE id='%s' AND " . get_filter_site_cond('email_template', null, true) . "";
127  }elseif($mode == 'codes_promos' && a_priv("admin_sales,admin_users")) {
128  $sql = "UPDATE peel_codes_promos
129  SET etat='%s'
130  WHERE id='%s' AND " . get_filter_site_cond('codes_promos', null, true) . "";
131  }elseif($mode == 'categories' && a_priv("admin_products")) {
132  $sql = "UPDATE peel_categories
133  SET etat='%s'
134  WHERE id='%s' AND " . get_filter_site_cond('categories', null, true) . "";
135  }elseif($mode == 'lexique' && a_priv("admin_products")) {
136  $sql = "UPDATE peel_lexique
137  SET etat='%s'
138  WHERE id='%s' AND " . get_filter_site_cond('lexique', null, true) . "";
139  }elseif($mode == 'configuration' && a_priv("admin_manage")) {
140  $sql = "UPDATE peel_configuration
141  SET etat='%s'
142  WHERE id='%s' AND " . get_filter_site_cond('configuration', null, true) . "";
143  } elseif($mode == 'abus' && a_priv("admin_moderation")) {
145  $sql = "UPDATE peel_abus_comment
146  SET status='%s', id_admin='".intval($_SESSION['session_utilisateur']['id_utilisateur'])."', status_change_date='".date('Y-m-d H:i:s')."'
147  WHERE id='%s'";
148  } elseif(function_exists('rpc_status_'.$mode)) {
149  $function_name = 'rpc_status_'.$mode;
150  $new_status = $function_name($_POST);
151  }
152  if(empty($function_name)) {
153  // On met à jour les positions en fonction de la liste reçue en POST
154  query(sprintf($sql, $new_status_sql_value, intval($_POST['id'])));
155  }
156  call_module_hook('rpc_status', array('new_status' => $new_status, 'current_status' => $_POST['current_status'], 'id' => intval($_POST['id']), 'mode' => $mode));
157  if(isset($new_status)) {
158  $output .= $new_status;
159  }
160 }
161 echo String::convert_encoding($output, $page_encoding, GENERAL_ENCODING);
162 
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
output_general_http_header($page_encoding=null, $cache_duration_in_seconds=null)
Envoie les headers avant l'envoi du HTML.
Definition: fonctions.php:1528
$mode
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
$output
Definition: rpc_status.php:23
$new_status_sql_value
Definition: rpc_status.php:41
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
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
call_module_hook($hook, $params, $mode= 'boolean')
Appelle la fonction correspondant au $hook pour chaque module installé La fonction doit s'appeler : [...
$GLOBALS['page_columns_count']
if(!check_if_module_active('search')) $page_encoding
Definition: produit.php:23
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
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:29:25 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.